feat(desktop): 支持插件声明一级主视图 - #3219
Conversation
|
| Filename | Overview |
|---|---|
| packages/plugin-protocol/src/manifest.ts | 新增跨消费者 main-view 清单契约与最低版本约束,同时保持 library 不进入公共 slot 集合。 |
| apps/desktop/src/shared/ghost.ts | 同步 Desktop runtime 的主视图校验、WebView 入口白名单和本地化处理,并保留既有 Desktop-only library 支持。 |
| apps/desktop/src/main/sidebarSettingsStore.ts | 将隐藏主视图插件 ID 纳入 owner-scoped 设置存储、并发写入防护和多窗口广播。 |
| apps/desktop/src/renderer/cindy-brain/mainViewVisibilityStore.ts | 镜像 Main 进程快照并处理主视图可见性更新及 owner generation 切换。 |
| apps/desktop/src/renderer/features/plugin/GhostMainViewHost.tsx | 使用既有 Ghost WebView 安全边界承载插件一级主视图。 |
| apps/desktop/src/renderer/components/sidebar/GhostMainViewNavEntries.tsx | 为已批准、启用且可见的插件主视图生成展开与折叠侧边栏入口。 |
| docs/dev-rules/protocol-compatibility.md | 明确记录 library 是唯一 Desktop-only slot 例外,并区分公共的 main-view 能力。 |
Sequence Diagram
sequenceDiagram
participant Plugin as Ghost 插件清单
participant Main as Desktop Main
participant Store as Sidebar Settings Store
participant Renderer as Renderer
participant WebView as 沙箱 WebView
Plugin->>Main: 声明 main-view / mainView
Main->>Main: 校验协议、版本与 HTML 入口
Main-->>Renderer: 提供已批准且启用的主视图
Store-->>Renderer: 广播 owner-scoped 显示偏好快照
Renderer->>Renderer: 渲染侧边栏入口与详情页开关
Renderer->>WebView: 进入插件主视图路由
Main->>WebView: 校验分区、入口白名单与插件状态
Reviews (5): Last reviewed commit: "test(device-link): stabilize link confir..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c8e363623
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@Evol1213 👋 这个 PR 还有 2 条 review conversation 没 resolve(packages/plugin-protocol/src/manifest.ts / apps/desktop/src/renderer/lib/sidebarOwnerStorage.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
这条 PR 需要维护者确认后才能合并。 它加了插件可声明的一级主视图(侧边栏入口 + 详情页显示开关),同时改到 Ghost manifest / 插件协议 / 基座投影,确认门当前在拦的是 product,并叠了 pluginBase。 请维护者在本 PR 上 Approve;若要改,请 Request Changes。讨论 issue:#3220 |
|
命中 UI 路径(apps/desktop/src/renderer/cindy-brain/GhostPermissionList.tsx / apps/desktop/src/renderer/cindy-brain/ghostMainViews.ts / apps/desktop/src/renderer/cindy-brain/ghostPanelBody.tsx 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范 |
Signed-off-by: xutianqi <xutianqi@xd.com>
Signed-off-by: xutianqi <xutianqi@xd.com>
2c8e363 to
fb09310
Compare
|
@codex review |
|
关于 Greptile 第二轮摘要再次提到的 library 最低版本:已复核,当前不改 Desktop validator。library 是本 PR 之前已存在的 Desktop-only 能力;本 PR 已撤回它在 packages/plugin-protocol 中的意外扩面,因此不会新增分发端接受范围。此时强制既有 Desktop manifest 补 minCindyVersion,一方面没有可填写的正式版本,另一方面会让已安装且未声明该字段的存量插件失效,违反插件兼容红线。后续应在 library 正式进入跨消费者发布契约、版本确定且迁移方案就绪时单独处理。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb0931082d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: xutianqi <xutianqi@xd.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
已补充 PR Description:新增当前 HEAD 的 Windows 保留路径修复记录,并在「UI 变化」中加入可直接审阅的 HTML 结构证据。测试插件与本地预览仍不纳入交付代码。 |
|
CI 复核结论(已在最新 HEAD a46c953 再现):两轮 Windows unit tests (1/2) 都只失败于 packages/device-link/src/tests/client.test.ts 的既有时序用例“新确认阶段:确认 ACK 丢失后自动有界重发,无需等待下一条控制端业务”,报错均为 MemoryRelay.settleUntil timed out(157 项中 156 通过)。PR 文件列表不包含 packages/device-link、CI/测试调度或依赖;同一 base 6ab605f 的 main client-ci 完整通过,因此判断为与本 PR 无关的 Windows 时序 flake,不应在本 PR 修改 device-link 或放宽测试。失败运行:32534909750、32537181376。当前账号无 Actions rerun 权限,请维护者重新运行失败 job。 |
Signed-off-by: xutianqi <xutianqi@xd.com>
|
@codex review 补充独立复核:发现规则文档把 library 写成了整个 Desktop validator 的“唯一例外”,范围过大。a46c95317 已将口径精确收窄为 GHOST_SLOTS 槽位集合中的唯一 Desktop-only 例外,并明确不代表两套 validator 的其它历史字段语义完全同构。独立 reviewer 复核后确认该 P1 已解决。 |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Signed-off-by: xutianqi <xutianqi@xd.com>
这次改了什么
摘要
为 Ghost 插件增加通用的一级主视图能力。插件可以在
ghost.json中通过main-viewslot 与mainView元数据声明一个由 Cindy 承载的管理界面;Cindy 负责协议校验、侧边栏导航、显示偏好和沙箱 WebView,业务逻辑仍由插件实现。这是一项通用插件基础设施能力,不与
xd-sites、其 API 或 OIDC 流程耦合。变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
main-view/mainViewmanifest 契约;系统线性图标枚举;展开与折叠侧边栏入口;主视图路由和沙箱承载;插件详情页显示开关;作者手册、兼容性文档、五语文案和自动化测试xd-sitesAPI、OIDC 或业务模型;根级插件品牌图片icon协议变更;cindy-xd-plugin改动;Desktop-only 的library槽公共协议扩面main-view插件必须声明合法 SemVer 的minCindyVersion。首个正式支持版本尚未确定,本 PR 不提供占位版本;插件发布时需填写最终裁决的正式 Cindy 版本。Review 修复
library是既有 Desktop-only 能力,本 PR 不把它加入跨消费者plugin-protocol;文档登记该唯一例外,避免在正式支持版本未确定时猜测版本门槛。mainView.html新增与公共协议一致的 Windows 设备保留名校验和assets/AUX.html回归测试;只收紧本 PR 新字段,不改变旧entry/panel/settingsHtml的存量接受范围。UI 变化
docs/design-rules/DESIGN.md§10:新增颜色使用语义 token,并按 Light / Dark 双模式契约实现docs/design-rules/DESIGN.md§11:侧边栏与设置文案保持简短、描述结果,不暴露内部 slot 名称docs/design-rules/DESIGN.md§14.6:折叠态图标入口保留可访问名称与提示语义docs/design-rules/DESIGN.md§15.10:导航和开关沿用中性状态,不引入品牌红作为普通主操作怎么验证的
自动验证
说明:本机默认 Node 22.12 缺少主干测试使用的 Zstd API,因此门禁使用仓库允许的 Node 24,并按
vitest.config.ts的既有 WebStorage 兼容路径切换到 forks;测试后已把better-sqlite3恢复到默认 Node 22 ABI。手工验证
mainView影响mainView时,原有入口和调用逻辑保持独立未执行的验证
风险
风险分类
影响与回滚
main-view/mainView是可选新增能力;跨消费者协议正本、Desktop runtime validator、作者手册和测试已同步。既有 Desktop-onlylibrary不在本 PR 中扩入公共协议main-view的插件生效提交前检查
git commit -s,见 DCO)Windows CI 稳定性修复
device-link的“确认 ACK 丢失后自动有界重发”用例改为 Vitest fake timer 显式推进,消除 Windows runner 对 20ms 真实定时器的调度抖动;没有修改生产状态机、协议、默认超时或重试预算。linkRequestId代际、恢复后可靠业务正常往返。@cindy/device-link217 项单测与 TypeScript build 通过;使用仓库指定 Node 22.22.3 和规范化临时目录运行pnpm test:unit:related -- --workspace-concurrency=1,所有 required workspace 通过。