@tt-a1i/openpi 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -11
- package/SETUP.md +2 -2
- package/THIRD_PARTY_NOTICES.md +242 -0
- package/extensions/ai-providers/README.md +12 -6
- package/extensions/ai-providers/cursor/connect-frame-reader.ts +76 -0
- package/extensions/ai-providers/cursor/input-images.ts +2 -3
- package/extensions/ai-providers/cursor/proto.ts +218 -11
- package/extensions/ai-providers/cursor/protobuf.ts +12 -2
- package/extensions/ai-providers/cursor/provider.ts +280 -37
- package/extensions/ai-providers/cursor/tool-bridge.ts +68 -0
- package/extensions/ai-providers/index.ts +3 -3
- package/extensions/file-mutation-display/index.ts +13 -9
- package/extensions/shared/agent-transcript.ts +3 -2
- package/extensions/shared/child-session.ts +14 -0
- package/extensions/subagents/index.ts +20 -3
- package/extensions/subagents/src/agent-types.ts +5 -17
- package/extensions/subagents/src/backends/pi.ts +70 -59
- package/extensions/subagents/src/backends/tool-preview.ts +29 -0
- package/extensions/subagents/src/manager.ts +2 -71
- package/extensions/subagents/src/prompt.ts +2 -2
- package/extensions/subagents/src/runtime.ts +10 -3
- package/extensions/web/index.ts +69 -5
- package/extensions/workflows/artifacts.ts +362 -23
- package/extensions/workflows/dashboard.ts +141 -21
- package/extensions/workflows/index.ts +62 -20
- package/extensions/workflows/progress-projection.ts +7 -1
- package/extensions/workflows/runner.ts +5 -162
- package/extensions/workflows/sandbox.ts +4 -0
- package/package.json +28 -4
- package/skills/subagents/REFERENCE.md +6 -7
- package/skills/subagents/SKILL.md +1 -1
- package/skills/workflows/REFERENCE.md +3 -1
- package/web/dist/app.js +87 -0
- package/web/dist/favicon.svg +9 -0
- package/web/dist/index.html +15 -0
- package/web/dist/styles.css +3 -0
- package/web/host/web-host.ts +6 -9
- package/web/ui/index.html +3 -131
- package/web/ui/public/favicon.svg +9 -0
- package/web/ui/src/app/App.tsx +134 -0
- package/web/ui/src/app/providers.tsx +38 -0
- package/web/ui/src/components/Markdown.tsx +58 -0
- package/web/ui/src/components/OpenPiLogo.tsx +41 -0
- package/web/ui/src/features/activity/ActivityBar.tsx +120 -0
- package/web/ui/src/features/composer/Composer.tsx +237 -0
- package/web/ui/src/features/sessions/SessionSidebar.tsx +418 -0
- package/web/ui/src/features/transcript/Transcript.tsx +860 -0
- package/web/ui/src/i18n.ts +159 -0
- package/web/ui/src/lib/format.ts +57 -0
- package/web/ui/src/main.tsx +16 -0
- package/web/ui/src/protocol/client.ts +199 -0
- package/web/ui/src/protocol/event-stream.ts +88 -0
- package/web/ui/src/store/web-store.ts +926 -0
- package/web/ui/src/styles.css +420 -0
- package/web/ui/tsconfig.json +12 -0
- package/web/ui/vite-env.d.ts +1 -0
- package/web/vite.config.mjs +21 -1
- package/web/host/static-assets.ts +0 -4
- package/web/ui/app.js +0 -1700
- package/web/ui/styles.css +0 -680
package/README.md
CHANGED
|
@@ -130,7 +130,7 @@ OpenPI 把成熟 Coding Agent 的工作习惯做成 Pi-native 能力,但不复
|
|
|
130
130
|
| 快捷工作流 | `/btw` 旁路提问(TUI)、`/lg` 浏览 Diff(TUI)、`/pr` 查 PR、`/copy-all`、`fd`、`rg`、只读 Git 工具 |
|
|
131
131
|
| 人类决策 | `ask_user` 草稿与最终复核、parent-only `human_handoff`、Plan Ready 实施门禁 |
|
|
132
132
|
| 统一配置 | `/openpi-setup` 管理 OpenPI 自有模型、并发、Footer、输出密度与 Post-edit 偏好 |
|
|
133
|
-
| 模型授权 | `/login google-antigravity`;实验性的 `/login cursor
|
|
133
|
+
| 模型授权 | `/login google-antigravity`;实验性的 `/login cursor`(支持 Pi 工具,不执行 Cursor 原生工具) |
|
|
134
134
|
|
|
135
135
|
OpenPI 采用 [MIT License](LICENSE);第三方来源与保留声明见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
|
|
136
136
|
|
|
@@ -196,23 +196,23 @@ subagent_spawn({
|
|
|
196
196
|
每个 Subagent 都是新的进程内 Pi SDK Session:
|
|
197
197
|
|
|
198
198
|
- 默认继承父会话的 Provider 与模型;用户可明确指定 Thinking Level,否则模型根据角色建议、任务难度与目标模型实际支持的档位选择;
|
|
199
|
-
-
|
|
199
|
+
- 继承父会话当前启用且允许委派的工具、Skills 和项目说明;目标目录的项目扩展按其自身 Trust 决策加载;
|
|
200
200
|
- 最多 4 个模型发起的 Subagent 并发运行,结束后自动回传;
|
|
201
201
|
- 可 `check`、`wait`、`cancel`,也可用 `subagent_send` 继续同一子会话;
|
|
202
202
|
- 输入框下方显示实时摘要,空输入时按 `↓` 聚焦,`Enter` 或 `→` 打开管理界面。
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
内置角色提供任务分工建议,普通模式下继承父会话当前启用且允许委派的工具,包括 Bash 和已启用的联网工具。角色名称本身不是只读权限边界;Plan Mode 与自定义角色的显式工具限制仍由 Harness 执行。
|
|
205
205
|
|
|
206
|
-
| `agent_type` | 适合 | 相对 effort 建议
|
|
207
|
-
| ------------- | ---------------- |
|
|
208
|
-
| `explorer` | 代码追踪与探索 | 中等,难题可提高
|
|
209
|
-
| `implementer` | 聚焦实现 | 中高,按范围与风险调整 |
|
|
210
|
-
| `reviewer` | 正确性与回归审查 | 较高
|
|
211
|
-
| `advisor` | 深度技术建议 | 较高
|
|
206
|
+
| `agent_type` | 适合 | 相对 effort 建议 |
|
|
207
|
+
| ------------- | ---------------- | ---------------- |
|
|
208
|
+
| `explorer` | 代码追踪与探索 | 中等,难题可提高 |
|
|
209
|
+
| `implementer` | 聚焦实现 | 中高,按范围与风险调整 |
|
|
210
|
+
| `reviewer` | 正确性与回归审查 | 较高 |
|
|
211
|
+
| `advisor` | 深度技术建议 | 较高 |
|
|
212
212
|
|
|
213
213
|
上述只是模型的相对选择提示,不会为内置角色写死具体档位。用户明确指定的 `reasoning_effort` 始终优先;否则模型结合任务难度,从目标模型实际支持的档位中选择。
|
|
214
214
|
|
|
215
|
-
角色可由全局 `~/.pi/agent/agents/*.md` 或受信任项目 `.pi/agents/*.md` 覆盖。模型优先级是:显式调用 > Agent Type 文件 > `/openpi-setup` 角色模型 > 父模型继承。更高优先级定义损坏时会阻断 fallback
|
|
215
|
+
角色可由全局 `~/.pi/agent/agents/*.md` 或受信任项目 `.pi/agents/*.md` 覆盖。模型优先级是:显式调用 > Agent Type 文件 > `/openpi-setup` 角色模型 > 父模型继承。更高优先级定义损坏时会阻断 fallback,而不是悄悄退回更宽松的能力。自定义角色省略 `tools` 时继承当前父工具;显式列表只能收窄,未在父会话启用的工具不会由委派自动激活。已有角色文件不会被升级覆盖;旧版 `explorer.md` 的只读列表仍然有效。工具可用性不等于文件系统沙箱;普通模式可使用绝对路径访问其他目录,目标仓库的执行 cwd 应通过 `working_dir` 指定。
|
|
216
216
|
|
|
217
217
|
<details>
|
|
218
218
|
<summary><strong>并行写文件时如何隔离 Worktree?</strong></summary>
|
|
@@ -275,7 +275,7 @@ return agent("Synthesize the verified findings", {
|
|
|
275
275
|
| `pipeline()` | 每个 item 完成上阶段后立即进入下一阶段;多阶段 fan-out 的默认选择 |
|
|
276
276
|
| `parallel()` | 并发 barrier;只在下一阶段确实需要全部结果时使用 |
|
|
277
277
|
|
|
278
|
-
Workflow 默认并发 8 个 Agent,单次最多 128 次调用;可配置到 64 和 1024。前台运行可实时查看,后台运行完成后自动回传;`/workflows` 展示阶段、Agent、Transcript、Graph
|
|
278
|
+
Workflow 默认并发 8 个 Agent,单次最多 128 次调用;可配置到 64 和 1024。前台运行可实时查看,后台运行完成后自动回传;`/workflows` 展示阶段、Agent、Transcript、Graph、用量与产物。普通子代理和 Workflow 都使用 Pi 原生传输超时与重试,不再用额外的 45 秒无可见输出计时器打断思考、排队或重试。显式取消和 Session 清理仍有界,原生 Provider 错误保留在 Child outcome 中。并发上限不代表账号的服务端速率额度;429 仍按 Pi 原生重试策略处理。
|
|
279
279
|
|
|
280
280
|
---
|
|
281
281
|
|
|
@@ -285,6 +285,8 @@ OpenPI 把一次调用拆成可以审计的生命周期,而不是把“进程
|
|
|
285
285
|
|
|
286
286
|
### Result Handoff 与派生 Graph
|
|
287
287
|
|
|
288
|
+
`agent(prompt, { working_dir: "/path/to/repository" })` 显式选择子代理工作目录;相对路径以父会话 cwd 解析,并在模型调用前验证。目标目录影响 Git、资源加载、Trust、Worktree 和 Replay 身份;只在 Prompt 中写路径不会切换 cwd。普通继承工具的内置角色不使用只读 Replay;明确配置只读工具的自定义角色仍保留原有 Replay 仓库边界。
|
|
289
|
+
|
|
288
290
|
成功调用返回同一 Run 内有效的 opaque `ref`。后续调用通过 `inputs: [previous.ref]` 显式接收上游结论;每个结论最多 16 KiB,合计最多 48 KiB,并标记为不可信数据。Artifacts 从这些引用派生只读 Graph,用来观察 lineage,不参与调度。
|
|
289
291
|
|
|
290
292
|
### Invocation Ledger
|
package/SETUP.md
CHANGED
|
@@ -16,7 +16,7 @@ Pi installs the package dependencies automatically. Restart Pi or run `/reload`
|
|
|
16
16
|
|
|
17
17
|
## fd, rg, and read-only git tools
|
|
18
18
|
|
|
19
|
-
The `file-search` extension registers `fd` and `rg` as model tools, and `git-read` registers `git_show`, `git_diff`, and `git_log` (read-only git inspection). They stay outside an ordinary parent turn until the user explicitly asks to use `fd`/`rg`/git history, or structured file search, or the model loads the `search` group through `openpi_load_tools`. Entering or restoring Plan Mode is a runtime-safety exception: it loads `search` for that Session so diff investigation can use the structured Git boundary. The gateway is shown after an explicit OpenPI-capability request, or remains visible when the user opts into adaptive discovery;
|
|
19
|
+
The `file-search` extension registers `fd` and `rg` as model tools, and `git-read` registers `git_show`, `git_diff`, and `git_log` (read-only git inspection). They stay outside an ordinary parent turn until the user explicitly asks to use `fd`/`rg`/git history, or structured file search, or the model loads the `search` group through `openpi_load_tools`. Entering or restoring Plan Mode is a runtime-safety exception: it loads `search` for that Session so diff investigation can use the structured Git boundary. The gateway is shown after an explicit OpenPI-capability request, or remains visible when the user opts into adaptive discovery; children receive these tools only when active in the parent and permitted by their role allowlist. No setup is normally needed: at startup `fd`/`rg` silently use a system-installed binary (`fd`/`fdfind` and `rg`) when available, or an existing binary in the agent's private managed bin directory (`~/.pi/agent/bin`). Only when neither exists does it download an official release binary (macOS/Linux, arm64/x64, over HTTPS) into that directory — a persistent cache that survives package updates — and show a one-time notification. If your platform is unsupported, install `fd` and `rg` with your package manager and restart Pi. The git tools require a system `git`.
|
|
20
20
|
|
|
21
21
|
While Plan Mode is active, raw Bash `git diff`, `git show`, and `git whatchanged` are refused, as are diff-generating `git log` options such as `-p`, `--stat`, `--name-only`, and `-L`. Use `git_log` to find commits and `git_diff` / `git_show` to inspect changes; the latter commands always pass `--no-ext-diff --no-textconv --no-color`, so repository-configured `diff.external` and textconv drivers are not executed. This guarantee is scoped to the Git diff-driver boundary rather than every possible hostile Git configuration; the remaining allowlisted Git investigation commands still run inside Pi's existing project Trust boundary.
|
|
22
22
|
|
|
@@ -60,7 +60,7 @@ Use the single canonical package-owned command. `/my-pi-setup` remains a compati
|
|
|
60
60
|
/openpi-setup 清除 explorer 的模型,让它继承父模型
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Capability discovery defaults to `explicit`, preserving the zero-resident OpenPI tool surface until the user asks for a capability. The case-insensitive English words `subagent` and `workflow` are reserved authorization words: entering either word is sufficient to load its capability group, and the interactive editor shows it in Claude Code-style lavender before submission, with a darker purple fallback for light themes. This makes discussion that contains either English word an intentional opt-in tradeoff; conditional and negated clauses remain inert, while Chinese capability names still require a recognized action request. `adaptive` is an explicit opt-in that keeps only `openpi_load_tools` visible and allows the model to load a useful group on its own; because this can start Subagents, Workflows, or background processes, normal permission and configured concurrency/call limits still apply. Changing the setting updates the current Session immediately, while already loaded groups remain stable for that Session. Accepted Suggestion text is classified only after it becomes real editor input. The visual feedback and runtime activation share one fail-closed intent classifier. Next-action suggestions default to off. Run `/openpi-setup` to explicitly choose an available model and reasoning level. After a fully settled main-agent run, one suggestion may appear as dim inline text on the first row of an empty editor; reserved cells at the row end keep CJK IME preedit from overwriting it. `Right` accepts it into the editor without submitting, while any other editor input dismisses it. Suggestions are ephemeral and never enter session history or model context. Workflows default to 8 concurrent agents and 128 total agent calls per run; configurable hard maxima are 64 and 1024. The large decorative header defaults off and the custom dashboard footer defaults on with a one-line plain layout (`model context |flex| git pr cwd`; `thinking`, `cache`, `cost`, and `throughput` remain opt-in metrics). Footer presets are `powerline`, `powerline-mono`, and `compact`; style can also be set independently to `plain`, `powerline`, or `powerline-mono`. Custom layouts use a 2D `footerLines` array with at most one `flex` per row for left/right alignment. Nerd Font affects powerline separator glyphs (``) and adds Codex-style outline icons to compact read, terminal, edit, search, and directory activity rows; all accompanying text remains readable without it. Footer metrics use one Codicon outline family (`` model, `` context, and `` directory) plus `⎇` for the branch. A Nerd Font containing Codicons renders them as designed; without one, the text labels remain readable even if an icon falls back to an empty box. Footer changes apply immediately in the active TUI session. Subagent results default to a compact status summary; full mode remains available as a per-user setting, and `app.tools.expand` (`Ctrl+O` by default) reveals the available child report. Ordinary `read`, `grep`, `find`, and `ls` operations render as one-line semantic activity summaries. Bash and Write/Edit default to the same activity-row projection, showing the target, running/success/failure state, and useful line or diff counts without replaying stdout or previews. Select full independently for Bash or Write/Edit to keep Pi's native rendering expanded. `app.tools.expand` temporarily restores the native arguments, output, errors, diff, timing, images, truncation notices, and full-output metadata; it never changes Session history or model context. An optional post-edit command is off by default: set one (for example `npm run format`, maximum 500 characters) and it runs once in the background after each interactive-TUI turn with successful Write/Edit operations, with failures reported as a notification. It deliberately does not guess whether arbitrary Bash commands changed files. Built-in Agent roles `explorer`, `implementer`, `reviewer`, and `advisor` are shared by `subagent_spawn.agent_type` and Workflow `agent(..., { agent_type })`; all inherit the parent model by default. `/openpi-setup` may assign a currently available Registry model to any subset; clearing one returns it to inheritance and omitted roles stay unchanged. Model precedence is explicit call > selected role-file model > setup assignment > parent inheritance; effort is explicit call > selected role > parent. A trusted project `.pi/agents/<role>.md` overrides global `~/.pi/agent/agents/<role>.md`, which overrides the complete built-in role definition; overrides are diagnosed. Role-model changes apply to the next spawn or Workflow agent call without reload. Configuration is stored privately at `~/.pi/agent/my-pi-setup.json`.
|
|
63
|
+
Capability discovery defaults to `explicit`, preserving the zero-resident OpenPI tool surface until the user asks for a capability. The case-insensitive English words `subagent` and `workflow` are reserved authorization words: entering either word is sufficient to load its capability group, and the interactive editor shows it in Claude Code-style lavender before submission, with a darker purple fallback for light themes. This makes discussion that contains either English word an intentional opt-in tradeoff; conditional and negated clauses remain inert, while Chinese capability names still require a recognized action request. `adaptive` is an explicit opt-in that keeps only `openpi_load_tools` visible and allows the model to load a useful group on its own; because this can start Subagents, Workflows, or background processes, normal permission and configured concurrency/call limits still apply. Changing the setting updates the current Session immediately, while already loaded groups remain stable for that Session. Accepted Suggestion text is classified only after it becomes real editor input. The visual feedback and runtime activation share one fail-closed intent classifier. Next-action suggestions default to off. Run `/openpi-setup` to explicitly choose an available model and reasoning level. After a fully settled main-agent run, one suggestion may appear as dim inline text on the first row of an empty editor; reserved cells at the row end keep CJK IME preedit from overwriting it. `Right` accepts it into the editor without submitting, while any other editor input dismisses it. Suggestions are ephemeral and never enter session history or model context. Workflows default to 8 concurrent agents and 128 total agent calls per run; configurable hard maxima are 64 and 1024. The large decorative header defaults off and the custom dashboard footer defaults on with a one-line plain layout (`model context |flex| git pr cwd`; `thinking`, `cache`, `cost`, and `throughput` remain opt-in metrics). Footer presets are `powerline`, `powerline-mono`, and `compact`; style can also be set independently to `plain`, `powerline`, or `powerline-mono`. Custom layouts use a 2D `footerLines` array with at most one `flex` per row for left/right alignment. Nerd Font affects powerline separator glyphs (``) and adds Codex-style outline icons to compact read, terminal, edit, search, and directory activity rows; all accompanying text remains readable without it. Footer metrics use one Codicon outline family (`` model, `` context, and `` directory) plus `⎇` for the branch. A Nerd Font containing Codicons renders them as designed; without one, the text labels remain readable even if an icon falls back to an empty box. Footer changes apply immediately in the active TUI session. Subagent results default to a compact status summary; full mode remains available as a per-user setting, and `app.tools.expand` (`Ctrl+O` by default) reveals the available child report. Ordinary `read`, `grep`, `find`, and `ls` operations render as one-line semantic activity summaries. Bash and Write/Edit default to the same activity-row projection, showing the target, running/success/failure state, and useful line or diff counts without replaying stdout or previews. Select full independently for Bash or Write/Edit to keep Pi's native rendering expanded. `app.tools.expand` temporarily restores the native arguments, output, errors, diff, timing, images, truncation notices, and full-output metadata; it never changes Session history or model context. An optional post-edit command is off by default: set one (for example `npm run format`, maximum 500 characters) and it runs once in the background after each interactive-TUI turn with successful Write/Edit operations, with failures reported as a notification. It deliberately does not guess whether arbitrary Bash commands changed files. Built-in Agent roles `explorer`, `implementer`, `reviewer`, and `advisor` are shared by `subagent_spawn.agent_type` and Workflow `agent(..., { agent_type })`; all inherit the parent model and currently active child-eligible tools by default. Explicit custom role `tools` lists narrow that surface; omitted lists inherit it. Built-in investigator roles suggest read-only work but do not impose a read-only tool boundary outside Plan Mode. Existing role files are preserved, so an old global `explorer.md` allowlist continues to exclude Bash/network tools until deliberately edited. `/openpi-setup` may assign a currently available Registry model to any subset; clearing one returns it to inheritance and omitted roles stay unchanged. Model precedence is explicit call > selected role-file model > setup assignment > parent inheritance; effort is explicit call > selected role > parent. A trusted project `.pi/agents/<role>.md` overrides global `~/.pi/agent/agents/<role>.md`, which overrides the complete built-in role definition; overrides are diagnosed. Role-model changes apply to the next spawn or Workflow agent call without reload. Configuration is stored privately at `~/.pi/agent/my-pi-setup.json`.
|
|
64
64
|
|
|
65
65
|
OpenPI Web theme defaults to `system`; `light` and `dark` are explicit canonical setup choices, and the browser consumes them from each authoritative snapshot without writing a competing local preference.
|
|
66
66
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -29,3 +29,245 @@ The upstream project is distributed under the MIT License. Its notice states
|
|
|
29
29
|
OpenPI is distributed under the MIT License; see [`LICENSE`](LICENSE). Portions
|
|
30
30
|
identified in this notice retain their original copyright notices and license
|
|
31
31
|
terms. The project-wide MIT license does not replace or remove those notices.
|
|
32
|
+
|
|
33
|
+
## Web production bundle
|
|
34
|
+
|
|
35
|
+
`web/dist/app.js` and `web/dist/styles.css` contain code from the packages
|
|
36
|
+
listed below. This inventory was taken from the Vite production module graph;
|
|
37
|
+
build-only packages are not included.
|
|
38
|
+
|
|
39
|
+
### MIT-licensed packages
|
|
40
|
+
|
|
41
|
+
Copyright (c) 2026 Meta Platforms, Inc.:
|
|
42
|
+
|
|
43
|
+
- `@astryxdesign/core@0.5.2`
|
|
44
|
+
- `@astryxdesign/theme-neutral@0.5.2`
|
|
45
|
+
|
|
46
|
+
Copyright (c) Meta Platforms, Inc. and affiliates:
|
|
47
|
+
|
|
48
|
+
- `@stylexjs/stylex@0.19.0`
|
|
49
|
+
- `react@19.2.8`
|
|
50
|
+
- `react-dom@19.2.8`
|
|
51
|
+
- `scheduler@0.27.0`
|
|
52
|
+
- `use-sync-external-store@1.6.0`
|
|
53
|
+
|
|
54
|
+
Copyright (c) 2023 FormatJS:
|
|
55
|
+
|
|
56
|
+
- `@formatjs/fast-memoize@3.1.7`
|
|
57
|
+
- `@formatjs/icu-messageformat-parser@3.5.17`
|
|
58
|
+
- `@formatjs/icu-skeleton-parser@2.1.11`
|
|
59
|
+
|
|
60
|
+
Copyright (c) 2011-present i18next:
|
|
61
|
+
|
|
62
|
+
- `i18next@26.4.1`
|
|
63
|
+
|
|
64
|
+
Copyright (c) 2015-present i18next:
|
|
65
|
+
|
|
66
|
+
- `react-i18next@17.0.13`
|
|
67
|
+
|
|
68
|
+
Copyright (c) 2026 Espen Hovlandsdal <espen@hovlandsdal.com>:
|
|
69
|
+
|
|
70
|
+
- `eventsource-parser@4.1.0`
|
|
71
|
+
|
|
72
|
+
Copyright (c) Espen Hovlandsdal:
|
|
73
|
+
|
|
74
|
+
- `react-markdown@10.1.0`
|
|
75
|
+
|
|
76
|
+
Copyright (c) 2019 Paul Henschel:
|
|
77
|
+
|
|
78
|
+
- `zustand@5.0.15`
|
|
79
|
+
|
|
80
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com>
|
|
81
|
+
(<https://sindresorhus.com>):
|
|
82
|
+
|
|
83
|
+
- `escape-string-regexp@5.0.0`
|
|
84
|
+
- `is-plain-obj@4.1.0`
|
|
85
|
+
|
|
86
|
+
Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>:
|
|
87
|
+
|
|
88
|
+
- `inline-style-parser@0.2.7`
|
|
89
|
+
|
|
90
|
+
Copyright (c) 2014 Stefan Thomas:
|
|
91
|
+
|
|
92
|
+
- `extend@3.0.2`
|
|
93
|
+
|
|
94
|
+
Copyright (c) 2017 Menglin "Mark" Xu <mark@remarkablemark.org>:
|
|
95
|
+
|
|
96
|
+
- `style-to-object@1.0.14`
|
|
97
|
+
|
|
98
|
+
Copyright (c) 2020 Menglin "Mark" Xu <mark@remarkablemark.org>:
|
|
99
|
+
|
|
100
|
+
- `style-to-js@1.1.21`
|
|
101
|
+
|
|
102
|
+
Copyright (c) 2014 Titus Wormer <tituswormer@gmail.com>:
|
|
103
|
+
|
|
104
|
+
- `remark-parse@11.0.0`
|
|
105
|
+
|
|
106
|
+
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>:
|
|
107
|
+
|
|
108
|
+
- `bail@2.0.2`, `ccount@2.0.1`, `mdast-util-to-string@4.0.0`
|
|
109
|
+
- `unified@11.0.5`, `unist-util-is@6.0.1`, `unist-util-position@5.0.0`
|
|
110
|
+
- `unist-util-visit@5.1.0`, `vfile@6.0.3`
|
|
111
|
+
|
|
112
|
+
Copyright (c) 2015 Titus Wormer <mailto:tituswormer@gmail.com>:
|
|
113
|
+
|
|
114
|
+
- `longest-streak@3.1.0`, `trim-lines@3.0.1`
|
|
115
|
+
|
|
116
|
+
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>:
|
|
117
|
+
|
|
118
|
+
- `comma-separated-tokens@2.0.3`, `hast-util-whitespace@3.0.0`
|
|
119
|
+
- `mdast-util-to-hast@13.2.1`, `rehype-sanitize@6.0.0`
|
|
120
|
+
- `space-separated-tokens@2.0.2`, `trough@2.2.0`
|
|
121
|
+
- `unist-util-stringify-position@4.0.0`, `unist-util-visit-parents@6.0.2`
|
|
122
|
+
|
|
123
|
+
Copyright (c) 2017 Titus Wormer <tituswormer@gmail.com>:
|
|
124
|
+
|
|
125
|
+
- `mdast-util-newline-to-break@2.0.0`, `remark-breaks@4.0.0`
|
|
126
|
+
|
|
127
|
+
Copyright (c) 2020 Titus Wormer <tituswormer@gmail.com>:
|
|
128
|
+
|
|
129
|
+
- `estree-util-is-identifier-name@3.0.0`
|
|
130
|
+
- `mdast-util-gfm-autolink-literal@2.0.1`
|
|
131
|
+
- `mdast-util-gfm-strikethrough@2.0.0`, `mdast-util-gfm-table@2.0.0`
|
|
132
|
+
- `mdast-util-gfm-task-list-item@2.0.0`, `micromark-extension-gfm@3.0.0`
|
|
133
|
+
- `micromark-extension-gfm-autolink-literal@2.1.0`
|
|
134
|
+
- `micromark-extension-gfm-strikethrough@2.1.0`
|
|
135
|
+
- `micromark-extension-gfm-task-list-item@2.1.0`
|
|
136
|
+
|
|
137
|
+
Copyright (c) 2021 Titus Wormer <tituswormer@gmail.com>:
|
|
138
|
+
|
|
139
|
+
- `micromark-extension-gfm-footnote@2.1.0`
|
|
140
|
+
|
|
141
|
+
Copyright (c) 2023 Titus Wormer <tituswormer@gmail.com>:
|
|
142
|
+
|
|
143
|
+
- `devlop@1.1.0`
|
|
144
|
+
|
|
145
|
+
Copyright (c) Titus Wormer <tituswormer@gmail.com>:
|
|
146
|
+
|
|
147
|
+
- `decode-named-character-reference@1.3.0`, `hast-util-sanitize@5.0.2`
|
|
148
|
+
- `hast-util-to-jsx-runtime@2.3.6`, `markdown-table@3.0.4`
|
|
149
|
+
- `mdast-util-find-and-replace@3.0.2`, `mdast-util-from-markdown@2.0.3`
|
|
150
|
+
- `mdast-util-gfm@3.1.0`, `mdast-util-gfm-footnote@2.1.0`
|
|
151
|
+
- `mdast-util-to-markdown@2.1.2`, `micromark@4.0.2`
|
|
152
|
+
- `micromark-core-commonmark@2.0.3`, `micromark-extension-gfm-table@2.1.1`
|
|
153
|
+
- `micromark-factory-destination@2.0.1`, `micromark-factory-label@2.0.1`
|
|
154
|
+
- `micromark-factory-space@2.0.1`, `micromark-factory-title@2.0.1`
|
|
155
|
+
- `micromark-factory-whitespace@2.0.1`, `micromark-util-character@2.1.1`
|
|
156
|
+
- `micromark-util-chunked@2.0.1`, `micromark-util-classify-character@2.0.1`
|
|
157
|
+
- `micromark-util-combine-extensions@2.0.1`
|
|
158
|
+
- `micromark-util-decode-numeric-character-reference@2.0.2`
|
|
159
|
+
- `micromark-util-decode-string@2.0.1`, `micromark-util-html-tag-name@2.0.1`
|
|
160
|
+
- `micromark-util-normalize-identifier@2.0.1`
|
|
161
|
+
- `micromark-util-resolve-all@2.0.1`, `micromark-util-sanitize-uri@2.0.1`
|
|
162
|
+
- `micromark-util-subtokenize@2.1.0`, `remark-gfm@4.0.1`
|
|
163
|
+
- `remark-rehype@11.1.2`, `vfile-message@4.0.3`
|
|
164
|
+
|
|
165
|
+
Copyright (c) Titus Wormer:
|
|
166
|
+
|
|
167
|
+
- `html-url-attributes@3.0.1`
|
|
168
|
+
|
|
169
|
+
Copyright (c) Titus Wormer <mailto:tituswormer@gmail.com>:
|
|
170
|
+
|
|
171
|
+
- `property-information@7.2.0`
|
|
172
|
+
|
|
173
|
+
`mdast-util-phrasing@4.1.0` retains both of its notices:
|
|
174
|
+
|
|
175
|
+
- Copyright (c) 2017 Titus Wormer <tituswormer@gmail.com>
|
|
176
|
+
- Copyright (c) 2017 Victor Felder <victor@draft.li>
|
|
177
|
+
|
|
178
|
+
The MIT terms for the packages above are:
|
|
179
|
+
|
|
180
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
181
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
182
|
+
> in the Software without restriction, including without limitation the rights
|
|
183
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
184
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
185
|
+
> furnished to do so, subject to the following conditions:
|
|
186
|
+
>
|
|
187
|
+
> The above copyright notice and this permission notice shall be included in
|
|
188
|
+
> all copies or substantial portions of the Software.
|
|
189
|
+
>
|
|
190
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
191
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
192
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
193
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
194
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
195
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
196
|
+
> SOFTWARE.
|
|
197
|
+
|
|
198
|
+
### ISC-licensed packages
|
|
199
|
+
|
|
200
|
+
Copyright (c) 2021, Andrea Giammarchi, @WebReflection:
|
|
201
|
+
|
|
202
|
+
- `@ungap/structured-clone@1.4.0`
|
|
203
|
+
|
|
204
|
+
Copyright (c) 2026 Lucide Icons and Contributors:
|
|
205
|
+
|
|
206
|
+
- `lucide-react@1.39.0`
|
|
207
|
+
|
|
208
|
+
The ISC terms for these packages are:
|
|
209
|
+
|
|
210
|
+
> Permission to use, copy, modify, and/or distribute this software for any
|
|
211
|
+
> purpose with or without fee is hereby granted, provided that the above
|
|
212
|
+
> copyright notice and this permission notice appear in all copies.
|
|
213
|
+
>
|
|
214
|
+
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
215
|
+
> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
216
|
+
> AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
217
|
+
> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
218
|
+
> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
219
|
+
> OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
220
|
+
> PERFORMANCE OF THIS SOFTWARE.
|
|
221
|
+
|
|
222
|
+
Some Lucide icons are derived from Feather and retain this additional notice:
|
|
223
|
+
|
|
224
|
+
> Copyright (c) 2013-present Cole Bemis
|
|
225
|
+
>
|
|
226
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
227
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
228
|
+
> in the Software without restriction, including without limitation the rights
|
|
229
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
230
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
231
|
+
> furnished to do so, subject to the following conditions:
|
|
232
|
+
>
|
|
233
|
+
> The above copyright notice and this permission notice shall be included in
|
|
234
|
+
> all copies or substantial portions of the Software.
|
|
235
|
+
>
|
|
236
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
237
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
238
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
239
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
240
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
241
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
242
|
+
> SOFTWARE.
|
|
243
|
+
|
|
244
|
+
### BSD-3-Clause package
|
|
245
|
+
|
|
246
|
+
`intl-messageformat@11.2.14` retains this notice:
|
|
247
|
+
|
|
248
|
+
> Copyright (c) 2023, Oath Inc.
|
|
249
|
+
>
|
|
250
|
+
> Redistribution and use of this software in source and binary forms, with or
|
|
251
|
+
> without modification, are permitted provided that the following conditions
|
|
252
|
+
> are met:
|
|
253
|
+
>
|
|
254
|
+
> - Redistributions of source code must retain the above copyright notice,
|
|
255
|
+
> this list of conditions and the following disclaimer.
|
|
256
|
+
> - Redistributions in binary form must reproduce the above copyright notice,
|
|
257
|
+
> this list of conditions and the following disclaimer in the documentation
|
|
258
|
+
> and/or other materials provided with the distribution.
|
|
259
|
+
> - Neither the name of Oath Inc. nor the names of its contributors may be used
|
|
260
|
+
> to endorse or promote products derived from this software without specific
|
|
261
|
+
> prior written permission.
|
|
262
|
+
>
|
|
263
|
+
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
264
|
+
> AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
265
|
+
> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
266
|
+
> ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
267
|
+
> LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
268
|
+
> CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
269
|
+
> SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
270
|
+
> INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
271
|
+
> CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
272
|
+
> ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
273
|
+
> POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -4,10 +4,12 @@ This extension registers two opt-in model providers backed by account OAuth:
|
|
|
4
4
|
|
|
5
5
|
- `google-antigravity` uses Google Cloud Code Assist and supports ordinary Pi
|
|
6
6
|
tool calls.
|
|
7
|
-
- `cursor` uses Cursor AgentService
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
- `cursor` uses Cursor AgentService with an experimental Pi tool bridge.
|
|
8
|
+
The active Pi tools are advertised as MCP tools. A complete invocation returns
|
|
9
|
+
to Pi for permission checks and execution; the next provider turn replays the
|
|
10
|
+
paired result. Cursor-native shell, editing, web, task, and interaction tools
|
|
11
|
+
remain unsupported and fail explicitly. The provider never executes tools
|
|
12
|
+
inside its transport or widens a child session's effective tool set.
|
|
11
13
|
|
|
12
14
|
After installing OpenPI, restart Pi or run `/reload`, then authenticate and
|
|
13
15
|
select a model:
|
|
@@ -43,8 +45,12 @@ When Cursor is selected, a supported PNG/JPEG/GIF/WebP path at the start of an
|
|
|
43
45
|
interactive prompt is converted into an actual image attachment (up to 10 MiB)
|
|
44
46
|
before the request is sent. The absolute path is not exposed to the model.
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
When Pi supplies tools, the provider directs Cursor to the advertised Pi MCP
|
|
49
|
+
catalog. Without tools it uses an explicit chat-only rule. Partial tool previews
|
|
50
|
+
and approval-only probes never execute a tool; unknown or malformed invocations
|
|
51
|
+
fail explicitly. Local HTTP/2 tests exercise a normal Pi tool lifecycle and
|
|
52
|
+
result replay, but account/model-specific compatibility still requires a live
|
|
53
|
+
smoke test. Cursor's native execution protocol is intentionally not enabled.
|
|
48
54
|
|
|
49
55
|
Cursor's token delta describes generated output only, so the provider does not
|
|
50
56
|
publish it as complete context usage. Pi 0.84.3+ can estimate an all-Cursor
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Incremental Cursor Connect framing; callbacks consume complete frames synchronously. */
|
|
2
|
+
export class ConnectFrameReader {
|
|
3
|
+
private readonly maxBytes: number;
|
|
4
|
+
private readonly header = Buffer.alloc(5);
|
|
5
|
+
private headerBytes = 0;
|
|
6
|
+
private payload: Buffer | undefined;
|
|
7
|
+
private payloadBytes = 0;
|
|
8
|
+
|
|
9
|
+
constructor(maxBytes: number) {
|
|
10
|
+
this.maxBytes = maxBytes;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get incomplete() {
|
|
14
|
+
return this.headerBytes !== 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get awaitingPayload() {
|
|
18
|
+
return this.payload !== undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
push(chunk: Buffer, onFrame: (flags: number, data: Buffer) => void) {
|
|
22
|
+
let offset = 0;
|
|
23
|
+
while (offset < chunk.length) {
|
|
24
|
+
if (this.payload) {
|
|
25
|
+
const copied = chunk.copy(
|
|
26
|
+
this.payload,
|
|
27
|
+
this.payloadBytes,
|
|
28
|
+
offset,
|
|
29
|
+
offset +
|
|
30
|
+
Math.min(
|
|
31
|
+
chunk.length - offset,
|
|
32
|
+
this.payload.length - this.payloadBytes,
|
|
33
|
+
),
|
|
34
|
+
);
|
|
35
|
+
offset += copied;
|
|
36
|
+
this.payloadBytes += copied;
|
|
37
|
+
} else {
|
|
38
|
+
if (this.headerBytes < 5) {
|
|
39
|
+
const copied = chunk.copy(
|
|
40
|
+
this.header,
|
|
41
|
+
this.headerBytes,
|
|
42
|
+
offset,
|
|
43
|
+
offset + Math.min(5 - this.headerBytes, chunk.length - offset),
|
|
44
|
+
);
|
|
45
|
+
offset += copied;
|
|
46
|
+
this.headerBytes += copied;
|
|
47
|
+
if (this.headerBytes < 5) return;
|
|
48
|
+
}
|
|
49
|
+
const size = this.header.readUInt32BE(1);
|
|
50
|
+
if (size > this.maxBytes)
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Cursor Connect frame exceeds ${this.maxBytes} bytes`,
|
|
53
|
+
);
|
|
54
|
+
if (chunk.length - offset >= size) {
|
|
55
|
+
const data = chunk.subarray(offset, offset + size);
|
|
56
|
+
const flags = this.header[0]!;
|
|
57
|
+
offset += size;
|
|
58
|
+
this.headerBytes = 0;
|
|
59
|
+
onFrame(flags, data);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
this.payload = Buffer.allocUnsafe(size);
|
|
63
|
+
this.payloadBytes = 0;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (this.payloadBytes === this.payload.length) {
|
|
67
|
+
const data = this.payload;
|
|
68
|
+
const flags = this.header[0]!;
|
|
69
|
+
this.payload = undefined;
|
|
70
|
+
this.payloadBytes = 0;
|
|
71
|
+
this.headerBytes = 0;
|
|
72
|
+
onFrame(flags, data);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { readFile, stat } from "node:fs/promises";
|
|
2
2
|
import { basename, isAbsolute } from "node:path";
|
|
3
|
+
import type { ImageContent } from "@earendil-works/pi-ai/compat";
|
|
3
4
|
import type {
|
|
4
5
|
ExtensionContext,
|
|
5
6
|
InputEvent,
|
|
6
7
|
InputEventResult,
|
|
7
8
|
} from "@earendil-works/pi-coding-agent";
|
|
8
|
-
import type { ImageContent } from "@earendil-works/pi-ai/compat";
|
|
9
9
|
|
|
10
10
|
const MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
11
11
|
|
|
@@ -58,8 +58,7 @@ function detectImageMimeType(
|
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Pi's TUI represents a clipboard image as a leading local path. Cursor's
|
|
61
|
-
*
|
|
62
|
-
* so convert an explicit leading image path into the same ImageContent shape
|
|
61
|
+
* provider does not execute Cursor-native read-file tools, so convert an explicit leading image path into the same ImageContent shape
|
|
63
62
|
* used by CLI/RPC attachments before the agent turn starts.
|
|
64
63
|
*/
|
|
65
64
|
export async function transformCursorImageInput(
|