Repository navigation
Desktop 窗口贡献 seam:让插件注册独立窗口(桌面伙伴 / 悬浮球 / 状态 HUD) #8044
DoodleBears
started this conversation in
Ideas
Replies: 1 comment
|
进展同步:按这条讨论的提案,seam 已经实现并本地验证完成。 不过我们发现仓库目前不接受外部 PR(CONTRIBUTING),GitHub 也返回 "An owner of this repository has disabled the ability to open pull requests",所以先在这里同步实现,等官方给出接收方式(开放 PR / patch / 其他)再提交。 实现分支: 包含:
第一个真实 consumer(纯插件 API,含截图):https://github.com/BotHarness/dsh-companion-example 演示形态:主窗口右下角 Slot 徽章 + 一个独立、透明、置顶的窗口,窗口 URL 为 如果后续开放 PR,或希望以其他形式接收这个 seam,我可以随时配合调整。 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
背景
DSH 的插件模型已经能把 Host 能力(Service / Event / Registry)和浏览器 UI(Slots)都交给社区插件;桌面端也已经有 Electron 壳(
apps/desktop+apps/desktop-host)。我们想做一个"桌面伙伴"插件:作为 Service 被其他插件调用、监听session/event等事件做出动作反馈,最终形态是一个独立窗口(置顶、透明、点击穿透、不被截屏)。初期可以渲染在主窗口的 Slot 里,但"始终漂浮在桌面上"必须由独立窗口承载。现状限制
BrowserWindow等窗口 API;apps/desktop外壳,社区先例是整仓 fork(mini-yifan/deepseek-harness-orb的floating-window.ts/observation-frame-window.ts/selection-toolbar-window.ts/macos-sck-napi),小需求承担了长期合并成本。用例
提案:window contribution seam
核心思路:窗口由 shell 创建并持有,插件只做注册;复用 DSH 现有 seam 模式,而不是开放 Electron API。
规范对齐(Cordis seam 映射)
实现遵循 DSH/Cordis 现有 seam 规范:贡献插件是 Consumer,Desktop Host 是 Provider(Service Definition 为
DesktopWindowsService);每个窗口是 shell 拥有的 Window Registry 里的一条 Registration,生命周期挂在贡献方 Fiber 的 effect 上(插件卸载 / 移除 bundle 即关窗);窗口状态变化用 Cordis Event 广播,不写入 SessionEvent;Host ↔ Client 走 TypertRemoteService + API Gateway(不新增/apiinterceptor);窗口内容作为 Slots 之外的第二类 UI surface 挂载,复用dsh.client浏览器 roster 机制;分发仍走 Bundle / Patch,不新增 manifest 格式。挂载方式(二选一或并存,想听维护者意见)
apps/desktop-host提供 application 服务ctx.desktopWindows,插件inject后register()并返回 disposer;bundle 契约不变,无需新 manifest 格式。cordis.patch.yml插入窗口声明行,Loader 直接生效,不需要插件写代码;适合纯展示型窗口,但无法表达运行期条件。内容承载(想听维护者意见)
dsh.client浏览器 roster 机制(packages/bundle/web-app/cordis.patch.yml里已有 Host 行与浏览器 roster 行同 bundle 的先例),只是多一个 window surface 挂载点。插件得到正常的浏览器插件环境,Slots 的认知可以直接迁移。apps/desktop/src/platform-view.ts(持久 partition + preload + 导航阻断)同级的隔离。适合非 DSH UI 的独立视图,但插件需要自带完整前端。能力位(v1 最小集,全部默认关闭)
alwaysOnTop/transparent/clickThrough(none、all、dynamic)/excludeFromCapture/skipTaskbar/focusable/ 尺寸与锚点 /rememberPosition/ 多显示器策略。安全与边界
BrowserWindow/webContents;renderer 依旧无 Node、无原始 IPC;excludeFromCapture与现有 Computer Use overlay exclusion 机制(ScreenCaptureKit exclude window id / Windows display affinity)对齐而不是另造一条路径,window id 只暴露给 shell 与显式授权的服务;接口草案
需要维护者拍板
apps/desktop-host的 application 服务(A)还是 Loader 声明行(B)?两者并存是否合理?excludeFromCapture与 Computer Use overlay exclusion 的关系:复用同一套 window id 注册还是分开?window contribution/desktop window/shell surface,请给一个官方术语。为什么独立 client 不够(预期讨论点)
独立进程完全可以做桌宠(我们也评估过),但满足不了:与桌面端同一 TCC 身份与权限链、同一单实例与应用生命周期、开箱即用(而不是"再装一个 App")、以及截屏排除需要同进程持有 window id(Computer Use 场景)。这也是我们倾向 shell seam 而不是外部 client 的原因。相关问题见 #19(原生 App)、#60(外部 GUI / 稳定 runtime 边界)与 #5180(App Plugin:App identity / standalone window 约定,首发于 #3328)——本提案是它们的补充:外部 client 解决"另一个 GUI 接 DSH",本提案解决"同一个桌面端内的插件窗口能力"。
我们愿意做什么
apps/desktop最小改动 +apps/desktop-host服务 + docs + 最小示例窗口 + 单测,保持默认关闭、可选、声明式;参考先例:上游
apps/desktop/src/platform-view.ts、update-overlay.ts、tray.ts、packages/bundle/web-app/cordis.patch.yml;社区mini-yifan/deepseek-harness-orb的apps/desktop/src/floating-window.ts。All reactions