feat(pi): 支持在 Cindy 中管理 Pi 扩展 - #2771
Conversation
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
…arser Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com> # Conflicts: # apps/desktop/src/main/maker-host/pi-host.ts
80af1f4 to
e0ac05a
Compare
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/maker-host/pi-package-store.ts | 实现受管 Pi 扩展的安装、状态持久化、资源发现、指纹、边界检查和会话快照。 |
| apps/desktop/src/main/maker-ipc/piPackageMutationIpc.ts | 增加 Pi 扩展管理 IPC,并将变更操作接入主机授权和串行执行边界。 |
| packages/maker-core/src/agents/pi/index.ts | 将受管扩展快照、确定性管理命令、专用工具和运行时能力清单接入 Pi 会话。 |
| packages/maker-core/src/agents/pi/cindy-bridge-source.ts | 扩展 Cindy-Pi bridge,提供带主机令牌的扩展管理工具与受限命令执行行为。 |
| apps/desktop/src/renderer/components/settings/PiPackagesSection.tsx | 新增 Pi 扩展安装和管理界面,包括加载、错误、兼容提示、确认及全局 mutation busy 状态。 |
| apps/mobile/src/device-link/mobileMakerTransport.ts | 扩展移动端到主机的 Pi 命令与技能清单传输契约,并保持管理操作留在主机侧。 |
Sequence Diagram
sequenceDiagram
participant User as 用户
participant UI as Desktop/Mobile
participant IPC as Cindy Host IPC
participant Store as Pi 扩展存储
participant Pi as Pi Runtime
User->>UI: 安装或管理 Pi 扩展
UI->>IPC: 受管扩展请求
IPC->>Store: 校验来源、授权与文件边界
Store-->>IPC: 已安装资源与兼容性结果
IPC-->>UI: 展示状态及批准要求
User->>UI: 批准并启用
UI->>IPC: 启用请求
IPC->>Store: 保存批准状态
User->>Pi: 新建或重启 Pi 任务
Pi->>Store: 获取已批准扩展快照
Store-->>Pi: Extension/Skill/Prompt 路径
Pi-->>UI: 暴露可用命令与技能
Reviews (57): Last reviewed commit: "fix(pi): isolate post-copy fingerprint b..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35003330f0
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be311682a7
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5106f2997
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b7a65ce3d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 169f3d1fd2
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 698d177b8f
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a91d61e9d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1810b1fe3d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b9ddae0f2
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ba7264172
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@zqchris 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/maker-host/pi-package-store.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d222ddc02d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@zqchris 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/maker-host/pi-package-store.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
MagicLizi
left a comment
There was a problem hiding this comment.
Auto Review — Heavy tier: APPROVED
安全审查 + 代码审查通过(0 P0/P1)。
验证要点:
- 3 个安全软命中均为误报(npm scoped identifier 命中 email regex × 2, test fixture forged token × 1)
- mutation 序列化正确(enqueueMutation + cross-process file lock)
- allowPiPackageManagement 在 RPC 执行侧做了 runtime check
- MAIN_OWNED_SEND_CONTEXT symbol-keyed trusted-origin 管道完整
- 新增依赖 @babel/parser / picomatch / semver 使用安全,无 prototype pollution 向量
- 恶意代码/数据外发专项:未发现隐藏网络调用或混淆代码
6 条 P2 defense-in-depth 建议(不阻塞合并)已记录。
|
这个 Pi 扩展管理功能的安全架构做得很扎实——mutation 序列化链路、symbol-keyed trusted-origin 校验、sandbox 环境隔离三层防护层层递进,重度审查里没发现任何实际漏洞。合并了 🎉 |
Signed-off-by: GardenX <20606485+gardenZzz@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> makecindy#2771 的 merge/shouldListPiPackageCommands 只认三家引擎,Cursor 作为第四家传入会让 desktop typecheck 失败。非 Pi 仍直接跳过扩展命令。
这次改了什么
摘要
在「设置 → 通用」中新增一行「Pi 扩展设置」入口,点开后可安装、启停、更新和卸载 Cindy 自己管理的 Pi 扩展。已安装扩展使用单行紧凑列表,详情按需展开,安装 5–6 个扩展不会堆成大卡片。
同时修复对话内安装链路:精确整句
pi install npm:context-mode现在由 Cindy Host 确定性解析并直接进入 Cindy 的受管扩展目录,不再交给模型判断,也不会落入用户自己的~/.pi/agent。自然语言安装请求走专用cindy_pi_extension工具;模型侧 Bash 会硬拦常见pi install/update/remove及其绝对路径、command/exec/env/sudo包装形式。原始失败根因
此前对话中的
pi install npm:context-mode被模型当作普通 shell 命令执行,调用 Pi CLI 的默认用户目录,因而安装到了~/.pi/agent,完全绕开了 Cindy 的pi-package-home、兼容检查和批准状态。这不是展示问题,而是安装链路没有接通。运行位置与边界
--no-extensions启动 Pi,关闭用户~/.pi和项目目录的隐式扩展发现。remoteHostId任务不会接收主机本地扩展路径,也不能管理主机扩展。兼容和安全
notify会进入 Cindy 消息流;select/confirm/input/editor会适配成 Cindy 选择卡。定时对话框和其他无法同步的 Pi TUI 能力会安全取消,并向用户说明未显示的能力。.cindy扩展体系及其存量安装、批准或配置。用户可见变化
UI 变化
docs/design-rules/DESIGN.md§4 Buttons / Dialog & Modal、§10 Light / Dark Dual-Mode Delivery Gate 与语义 token、§14.2 Focus Management。改动后界面 HTML 证据(静态页面,可复制保存为 .html 打开)
以下页面依据当前
SettingsView与PiPackagesSection的实际结构、文案和状态整理;同时展示设置入口、安装区、紧凑列表、兼容告警、展开详情及管理操作。颜色使用与实现一致的语义变量,并随系统 Light / Dark 切换。该静态页面不替代 Windows 实机验收;Windows 复验步骤与剩余风险仍保留在下文。
怎么验证的
真实
context-modeE2E在隔离 Desktop
pi-extension-preview中完成:pi install npm:context-mode。pi-package-home,识别为context-mode v1.0.169。notify部分兼容及静态分析未完成,lifecycle scripts 未执行。ctx_stats成功,返回context-mode v1.0.169的当前统计。notify消息可进入 Cindy 对话;命令被 Pi 接受后,即使后续get_state探测超时也不会把已执行命令误报失败。未读取、修改或清理用户正式
~/.pi/agent中此前误装的内容。UI 验收
自动验证
另有定向覆盖:确定性整句解析、自然语言专用工具、超大回执截断、Bash 防误装、Review 禁用、SSH remote 禁用、device-link 本机语义、并发 mutation queue、批准撤销、路径和符号链接越界、紧凑列表。
风险
第三方可执行 Extension 获得批准后可读取 Pi 能访问的文件和环境变量;设置页会在启用前明确提示。Windows 未做实机 UI 目检,最终以本次新 head 的 CI 为准。
提交前检查
独立 UI 代码审查第 1 轮修复
Windows 实机复验说明
Windows 尚未做实机 UI 目检;本 PR 的跨平台逻辑、类型检查和单元测试已覆盖,但不能把这些等同于 Windows 视觉验收。复验步骤:
独立 UI 代码审查第 2 轮(已按总控修复)
总控采用修法一:宽屏可见状态文字标记 aria-hidden="true",由 sr-only 作为唯一辅助技术语义源。结构测试同时约束同一 noticeCount 只有一份非 aria-hidden 文本,并确认宽屏可见分支被隐藏于可访问性树。剩余 UI finding:0。
PR 规模构成(pr-size-gate STOP 说明)
本 PR 是一个单一完整目标:让用户在 Cindy 内安装、检查、批准、管理并实际调用 Pi 扩展。规模主要由四个不可拆断的层组成:受管安装与安全边界、Pi runtime 装载与调用、设置管理及兼容提示、端到端与安全回归测试。少任一层都会形成“能装不能用”“能用不能管理”或绕过批准与兼容检查的残缺体验,因此不拆成独立 PR;命中的产品门与架构门均直接服务于该目标。
主干同步后的回归
已合并最新 upstream/main;新增主干提交只改动侧栏设备图标,与本轮 Pi mutation 边界及其测试无重叠。合并后重新通过定向测试、DCO、freshness 与 diff 检查;本机全量 unit 的既有失败已在上方如实列出,不将其写成全绿。