mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-24 01:05:29 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e03fe0d8e7 | ||
|
|
ff27da07bf | ||
|
|
1fea66215d | ||
|
|
ecb2501458 | ||
|
|
065e4a95b1 | ||
|
|
309a44c480 |
@@ -1,5 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## 0.17.4 - 2026-11-23
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed numbered sublists overlapping their text and quotes inside lists overlapping later messages on Android ([#10499](https://github.com/getpaseo/paseo/pull/10499))
|
||||
- Fixed Android terminal input so it asks the keyboard to exclude typed text from personalized learning ([#10586](https://github.com/getpaseo/paseo/pull/10586))
|
||||
- Fixed conversations disappearing when directory capitalization differs on a case-insensitive file system ([#10555](https://github.com/getpaseo/paseo/pull/10555) by [@yzim](https://github.com/yzim))
|
||||
- Fixed interrupt and steer messages to archived agents being queued without starting a turn ([#10611](https://github.com/getpaseo/paseo/pull/10611) by [@thomasvan](https://github.com/thomasvan))
|
||||
- Fixed Hermes Shell rows omitting part of the command ([#10614](https://github.com/getpaseo/paseo/pull/10614))
|
||||
- Fixed OpenCode Go usage for logins stored in the OpenCode 2 database, including Console sign-ins and API keys ([#8729](https://github.com/getpaseo/paseo/pull/8729), [#10612](https://github.com/getpaseo/paseo/pull/10612))
|
||||
- Fixed existing OpenCode sessions failing to reopen after Paseo tool definitions change ([#10533](https://github.com/getpaseo/paseo/pull/10533) by [@Peanut-HZM](https://github.com/Peanut-HZM))
|
||||
- Fixed Paseo tools missing from agents that use MCP protocol version `2026-07-28` ([#10558](https://github.com/getpaseo/paseo/pull/10558) by [@apple-ouyang](https://github.com/apple-ouyang))
|
||||
- Fixed Codex MCP startup failures missing from daemon warning logs ([#10566](https://github.com/getpaseo/paseo/pull/10566))
|
||||
- Fixed the daemon exiting when it closes a session after the plugin process has stopped ([#10585](https://github.com/getpaseo/paseo/pull/10585))
|
||||
- Fixed Git commands selecting the wrong repository when a directory has the layout of a bare repository ([#10587](https://github.com/getpaseo/paseo/pull/10587))
|
||||
- Fixed Claude Auto permission mode being unavailable on Bedrock and Vertex ([#6904](https://github.com/getpaseo/paseo/pull/6904))
|
||||
- Fixed the sidebar host settings button requiring two clicks to open settings ([#10562](https://github.com/getpaseo/paseo/pull/10562) by [@ShalokShalom](https://github.com/ShalokShalom))
|
||||
- Fixed the Changes pane not offering Push for a new branch that was never pushed in a regular checkout ([#10631](https://github.com/getpaseo/paseo/pull/10631))
|
||||
- Fixed the daemon using the wrong model catalog when Hub sends a workspace directory for trigger validation ([#10582](https://github.com/getpaseo/paseo/pull/10582))
|
||||
|
||||
## 0.17.3 - 2026-11-22
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## 0.17.4 - 2026-11-23
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复 Android 上嵌套编号列表的编号与正文重叠,以及列表中的引用与后续消息重叠的问题 ([#10499](https://github.com/getpaseo/paseo/pull/10499))
|
||||
- 修复 Android 终端输入,要求键盘不将输入内容用于个性化学习 ([#10586](https://github.com/getpaseo/paseo/pull/10586))
|
||||
- 修复在不区分大小写的文件系统上,目录路径大小写不一致导致对话消失的问题 ([#10555](https://github.com/getpaseo/paseo/pull/10555),贡献者:[@yzim](https://github.com/yzim))
|
||||
- 修复发给已归档 Agent 的中断和引导消息进入队列后未启动新轮次的问题 ([#10611](https://github.com/getpaseo/paseo/pull/10611),贡献者:[@thomasvan](https://github.com/thomasvan))
|
||||
- 修复 Hermes 的 Shell 工具行只显示命令摘要的问题,现在会显示完整命令 ([#10614](https://github.com/getpaseo/paseo/pull/10614))
|
||||
- 修复使用 OpenCode 2 数据库中保存的登录凭据时的 Go 用量显示,涵盖 Console 登录和 API 密钥 ([#8729](https://github.com/getpaseo/paseo/pull/8729), [#10612](https://github.com/getpaseo/paseo/pull/10612))
|
||||
- 修复 Paseo 工具定义变更后无法重新打开已有 OpenCode 会话的问题 ([#10533](https://github.com/getpaseo/paseo/pull/10533),贡献者:[@Peanut-HZM](https://github.com/Peanut-HZM))
|
||||
- 修复使用 MCP 协议版本 `2026-07-28` 的 Agent 缺少 Paseo 工具的问题 ([#10558](https://github.com/getpaseo/paseo/pull/10558),贡献者:[@apple-ouyang](https://github.com/apple-ouyang))
|
||||
- 修复 Codex MCP 启动失败时 daemon 未记录警告的问题 ([#10566](https://github.com/getpaseo/paseo/pull/10566))
|
||||
- 修复插件进程停止后 daemon 在关闭会话时退出的问题 ([#10585](https://github.com/getpaseo/paseo/pull/10585))
|
||||
- 修复目录结构与裸仓库相同时 Git 命令选错仓库的问题 ([#10587](https://github.com/getpaseo/paseo/pull/10587))
|
||||
- 修复在 Bedrock 和 Vertex 上无法选择 Claude Auto 权限模式的问题 ([#6904](https://github.com/getpaseo/paseo/pull/6904))
|
||||
- 修复侧边栏的主机设置按钮需要点击两次才能打开设置的问题 ([#10562](https://github.com/getpaseo/paseo/pull/10562),贡献者:[@ShalokShalom](https://github.com/ShalokShalom))
|
||||
- 修复普通检出中从未推送过的新分支在“变更”面板中不显示“推送”的问题 ([#10631](https://github.com/getpaseo/paseo/pull/10631))
|
||||
- 修复 Hub 在验证触发器时传入工作区目录后,daemon 使用错误模型目录的问题 ([#10582](https://github.com/getpaseo/paseo/pull/10582))
|
||||
|
||||
## 0.17.3 - 2026-11-22
|
||||
|
||||
### 修复
|
||||
|
||||
@@ -514,7 +514,7 @@ The [Agent Client Protocol (ACP)](https://agentclientprotocol.com) is an open st
|
||||
|
||||
ACP agents communicate over JSON-RPC 2.0 on stdio. Paseo spawns the agent process and talks to it through stdin/stdout.
|
||||
|
||||
Paseo also ships an in-app ACP provider catalog for common agents, including CodeWhale, Cursor, DeepAgents, DimCode, Gemini CLI, Hermes, Qwen Code, and Kimi Code. Most catalog entries create the same `extends: "acp"` provider config shown below. Hoplite activates its [bundled provider](plugins.md#built-in-plugins) instead.
|
||||
Paseo also ships an in-app ACP provider catalog for common agents, including CodeWhale, Cursor, DeepAgents, DimCode, Gemini CLI, Hermes, Qwen Code, and Kimi Code. Most catalog entries create the same `extends: "acp"` provider config shown below. Goose, Hermes, and Hoplite activate their [bundled providers](plugins.md#built-in-plugins) instead. An existing `extends: "acp"` entry for goose or Hermes migrates to the bundled provider on load and keeps a custom command. Hermes agents saved with the old adapter resume with their mode translated (`plugins/hermes-provider/server/legacy-modes.ts`).
|
||||
|
||||
### Adding a generic ACP provider
|
||||
|
||||
@@ -627,32 +627,6 @@ ACP probes use short timeouts and browser-suppression environment variables so a
|
||||
|
||||
Ref: [Gemini CLI ACP mode docs](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/acp-mode.md)
|
||||
|
||||
### Example: Hermes (Nous Research)
|
||||
|
||||
[Hermes](https://github.com/NousResearch/hermes-agent) is an open-source coding agent by Nous Research with persistent memory and multi-provider LLM support. It supports ACP via the `acp` subcommand.
|
||||
|
||||
1. Install: `curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash`
|
||||
2. Install ACP support: `pip install -e '.[acp]'`
|
||||
3. Configure Hermes credentials in `~/.hermes/`
|
||||
4. Add to config.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"agents": {
|
||||
"providers": {
|
||||
"hermes": {
|
||||
"extends": "acp",
|
||||
"label": "Hermes",
|
||||
"description": "Nous Research self-improving AI agent",
|
||||
"command": ["hermes", "acp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Ref: [Hermes ACP docs](https://hermes-agent.nousresearch.com/docs/user-guide/features/acp)
|
||||
|
||||
### How ACP providers work in Paseo
|
||||
|
||||
When you launch an agent with an ACP provider:
|
||||
@@ -853,12 +827,6 @@ A config.json with multiple custom providers:
|
||||
"extends": "acp",
|
||||
"label": "Google Gemini",
|
||||
"command": ["gemini", "--acp"]
|
||||
},
|
||||
|
||||
"hermes": {
|
||||
"extends": "acp",
|
||||
"label": "Hermes",
|
||||
"command": ["hermes", "acp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-3
@@ -118,7 +118,7 @@ appear in the plugin catalog. Editing one in development requires a daemon resta
|
||||
Directory, Git, and npm installs cannot use a built-in ID.
|
||||
|
||||
A provider registration with `requiresConfiguration: true` participates only while its ID exists
|
||||
under `agents.providers`. Hoplite and fx use this for catalog opt-in. Add writes `{ "enabled": true }`
|
||||
under `agents.providers`. Hoplite, fx, goose, and Hermes use this for catalog opt-in. Add writes `{ "enabled": true }`
|
||||
without `extends`, so it selects the bundled adapter. Remove deletes the config entry; setting
|
||||
`enabled: false` keeps the entry. The bundled JavaScript still loads at startup, but an absent
|
||||
provider does not enter executable resolution or catalog discovery.
|
||||
@@ -583,8 +583,12 @@ daemon launch from `connect` and the per-session env and MCP servers from `sessi
|
||||
no provider reload input.
|
||||
|
||||
For an ACP command, register `runAcpProvider({ id, label, command })` from
|
||||
`@getpaseo/plugin/server/acp`. Its transformer hooks cover narrow vendor differences; do not translate the
|
||||
whole provider event stream. The shim uses the resolved launch for every probe and session, overlaying
|
||||
`@getpaseo/plugin/server/acp`. The shim builds the standard row for each ACP tool `kind`
|
||||
(`acp-internal/tool-call-detail.ts`). Its transformer hooks cover narrow vendor differences; do not translate the
|
||||
whole provider event stream. A `toolCall` transformer sees the raw `input`, `output` and `content`, and a
|
||||
`detail` it sets replaces the standard row. Parse vendor display text defensively and return the call
|
||||
unchanged when the shape does not match, so an upstream format change falls back to the standard row
|
||||
(`plugins/hermes-provider/server/terminal-command.ts`). The shim uses the resolved launch for every probe and session, overlaying
|
||||
only the supplied per-session env for sessions. The direct and ACP examples live in
|
||||
`plugin-examples/provider-direct`
|
||||
and `plugin-examples/provider-acp-transformer`.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Fixed
|
||||
- Fixed numbered sublists overlapping their text and quotes inside lists overlapping later messages on Android
|
||||
- Fixed Android terminal input so it asks the keyboard to exclude typed text from personalized learning
|
||||
- Fixed conversations disappearing when directory capitalization differs on a case-insensitive file system
|
||||
- Fixed interrupt and steer messages to archived agents being queued without starting a turn
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,7 @@
|
||||
Fixed
|
||||
- Fixed numbered sublists overlapping their text and quotes inside lists overlapping later messages on Android
|
||||
- Fixed Android terminal input so it asks the keyboard to exclude typed text from personalized learning
|
||||
- Fixed conversations disappearing when directory capitalization differs on a case-insensitive file system
|
||||
- Fixed interrupt and steer messages to archived agents being queued without starting a turn
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,7 @@
|
||||
Fixed
|
||||
- Fixed numbered sublists overlapping their text and quotes inside lists overlapping later messages on Android
|
||||
- Fixed Android terminal input so it asks the keyboard to exclude typed text from personalized learning
|
||||
- Fixed conversations disappearing when directory capitalization differs on a case-insensitive file system
|
||||
- Fixed interrupt and steer messages to archived agents being queued without starting a turn
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,7 @@
|
||||
Fixed
|
||||
- Fixed numbered sublists overlapping their text and quotes inside lists overlapping later messages on Android
|
||||
- Fixed Android terminal input so it asks the keyboard to exclude typed text from personalized learning
|
||||
- Fixed conversations disappearing when directory capitalization differs on a case-insensitive file system
|
||||
- Fixed interrupt and steer messages to archived agents being queued without starting a turn
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-W725BRG14xajMsR4t8Y3NmxppMnJ8AUd7Kdb6F7LmMw=
|
||||
sha256-TAVzJzziWDAapQkG4TLkLzOlodkdFNKSl3y/Tm9HB28=
|
||||
|
||||
Generated
+29
-29
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paseo",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"workspaces": [
|
||||
@@ -37541,7 +37541,7 @@
|
||||
},
|
||||
"packages/app": {
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "6.10.4",
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -39694,13 +39694,13 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/server": "0.17.3",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/server": "0.17.4",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -39947,11 +39947,11 @@
|
||||
},
|
||||
"packages/client": {
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/relay": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/relay": "0.17.4",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
@@ -39963,7 +39963,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -40206,7 +40206,7 @@
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
@@ -40252,7 +40252,7 @@
|
||||
},
|
||||
"packages/highlight": {
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -40282,7 +40282,7 @@
|
||||
},
|
||||
"packages/plugin": {
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^1.4.0",
|
||||
@@ -40290,8 +40290,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -40301,8 +40301,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -40324,7 +40324,7 @@
|
||||
},
|
||||
"packages/protocol": {
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"semver": "^7.8.5",
|
||||
@@ -40351,7 +40351,7 @@
|
||||
}
|
||||
},
|
||||
"packages/react-native-enriched-markdown": {
|
||||
"version": "0.17.1",
|
||||
"version": "0.17.4",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
@@ -40367,7 +40367,7 @@
|
||||
},
|
||||
"packages/relay": {
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^2.4.0",
|
||||
@@ -40589,17 +40589,17 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.326",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.17.3",
|
||||
"@getpaseo/highlight": "0.17.3",
|
||||
"@getpaseo/plugin": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/relay": "0.17.3",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/highlight": "0.17.4",
|
||||
"@getpaseo/plugin": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/relay": "0.17.4",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/node": "2.1.2",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
@@ -41549,7 +41549,7 @@
|
||||
},
|
||||
"packages/website": {
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"dependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
@@ -43160,7 +43160,7 @@
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"private": true,
|
||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||
"keywords": [
|
||||
|
||||
@@ -471,6 +471,33 @@ test("All changes combines committed and pending edits and preserves an unfinish
|
||||
});
|
||||
});
|
||||
|
||||
test("Changes offers Push for a branch that was never pushed and the push sets its upstream", async ({
|
||||
page,
|
||||
}) => {
|
||||
const workspace = await createWorkspaceWithRemote((repoPath) => {
|
||||
execFileSync("git", ["checkout", "-b", "feature"], { cwd: repoPath });
|
||||
});
|
||||
await openWorkspaceChangesSurface(page, workspace);
|
||||
const primary = page.getByTestId("changes-primary-cta");
|
||||
|
||||
await test.step("committing the edit makes Push the primary action", async () => {
|
||||
await expect(primary).toHaveAccessibleName("Commit", { timeout: 30_000 });
|
||||
commitAllWithGit(workspace.repoPath, "Feature work");
|
||||
await expect(primary).toHaveAccessibleName("Push", { timeout: 30_000 });
|
||||
});
|
||||
await test.step("Push sends the branch and sets its upstream", async () => {
|
||||
await primary.click();
|
||||
await expect
|
||||
.poll(() => remoteBranchHead(workspace, "feature"), { timeout: 30_000 })
|
||||
.toBe(localHead(workspace));
|
||||
// git writes the upstream after the remote has the branch, so wait for it too.
|
||||
await expect
|
||||
.poll(() => branchUpstream(workspace, "feature"), { timeout: 30_000 })
|
||||
.toBe("origin/feature");
|
||||
await expect(primary).not.toHaveAccessibleName("Push", { timeout: 30_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test("Changes selects exact local and remote bases and retains the selection after reload", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
@@ -2122,6 +2149,68 @@ async function createWorkspaceWithMountedTabDiff(
|
||||
return { id: createdWorkspace.workspace.id, repoPath: repo.path };
|
||||
}
|
||||
|
||||
interface RemoteWorkspace extends DirtyWorkspace {
|
||||
remotePath: string;
|
||||
}
|
||||
|
||||
// A regular checkout with a local bare remote and one uncommitted edit.
|
||||
async function createWorkspaceWithRemote(
|
||||
prepare: (repoPath: string) => void,
|
||||
): Promise<RemoteWorkspace> {
|
||||
const repo = await createTempGitRepo("changes-push-", {
|
||||
withRemote: true,
|
||||
files: [{ path: "tracked.ts", content: "export const tracked = 1;\n" }],
|
||||
});
|
||||
const client = await connectSeedClient();
|
||||
cleanupTasks.push({
|
||||
run: async () => {
|
||||
await client.close();
|
||||
await repo.cleanup();
|
||||
},
|
||||
});
|
||||
// The helper keeps the bare remote inside the checkout; keep it out of the status.
|
||||
await writeFile(path.join(repo.path, ".git/info/exclude"), "remote.git/\n");
|
||||
prepare(repo.path);
|
||||
await writeFile(path.join(repo.path, "tracked.ts"), "export const tracked = 2;\n");
|
||||
const created = await client.createWorkspace({ source: { kind: "directory", path: repo.path } });
|
||||
if (!created.workspace) {
|
||||
throw new Error(created.error ?? `Failed to create workspace ${repo.path}`);
|
||||
}
|
||||
return {
|
||||
id: created.workspace.id,
|
||||
repoPath: repo.path,
|
||||
remotePath: path.join(repo.path, "remote.git"),
|
||||
};
|
||||
}
|
||||
|
||||
// The app's Commit asks an agent provider for a message, and this harness has none.
|
||||
function commitAllWithGit(repoPath: string, message: string): void {
|
||||
execFileSync("git", ["commit", "-am", message], { cwd: repoPath, stdio: "ignore" });
|
||||
}
|
||||
|
||||
function localHead(workspace: RemoteWorkspace): string {
|
||||
return execFileSync("git", ["rev-parse", "HEAD"], {
|
||||
cwd: workspace.repoPath,
|
||||
encoding: "utf8",
|
||||
}).trim();
|
||||
}
|
||||
|
||||
function remoteBranchHead(workspace: RemoteWorkspace, branch: string): string | null {
|
||||
const line = execFileSync("git", ["ls-remote", "--heads", workspace.remotePath, branch], {
|
||||
encoding: "utf8",
|
||||
}).trim();
|
||||
return line ? (line.split("\t")[0] ?? null) : null;
|
||||
}
|
||||
|
||||
// Empty until the branch has an upstream.
|
||||
function branchUpstream(workspace: RemoteWorkspace, branch: string): string {
|
||||
return execFileSync(
|
||||
"git",
|
||||
["for-each-ref", "--format=%(upstream:short)", `refs/heads/${branch}`],
|
||||
{ cwd: workspace.repoPath, encoding: "utf8" },
|
||||
).trim();
|
||||
}
|
||||
|
||||
async function createWorkspaceWithNetDiff(): Promise<DirtyWorkspace> {
|
||||
const repo = await createTempGitRepo("changes-net-", {
|
||||
files: [{ path: "a-tracked.ts", content: "base\n" }],
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { expect, test } from "../support/fixtures";
|
||||
import { gotoAppShell } from "../support/helpers/app";
|
||||
import {
|
||||
chooseProjectWithKeyboard,
|
||||
connectNewWorkspaceDaemonClient,
|
||||
expectNewWorkspaceControlsEnabled,
|
||||
expectNewWorkspaceProjectSelected,
|
||||
@@ -177,33 +176,6 @@ test.describe("New workspace entry points", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("choosing a project returns focus to the composer, even when the picker was opened by clicking it", async ({
|
||||
page,
|
||||
}) => {
|
||||
const projectA: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-focus-a-" });
|
||||
const projectB: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-focus-b-" });
|
||||
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarHydration(page);
|
||||
await openGlobalNewWorkspaceComposer(page);
|
||||
const composer = page.getByRole("textbox", { name: "Message agent..." });
|
||||
|
||||
await page.getByTestId("new-workspace-project-picker-trigger").click();
|
||||
await chooseProjectWithKeyboard(page, projectB.projectDisplayName);
|
||||
await expectNewWorkspaceProjectSelected(page, projectB.projectDisplayName);
|
||||
await expect(composer).toBeFocused();
|
||||
|
||||
await page.keyboard.press("Control+N");
|
||||
await chooseProjectWithKeyboard(page, projectA.projectDisplayName);
|
||||
await expectNewWorkspaceProjectSelected(page, projectA.projectDisplayName);
|
||||
await expect(composer).toBeFocused();
|
||||
} finally {
|
||||
await projectA.cleanup();
|
||||
await projectB.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps the in-progress form when the remembered workspace is archived elsewhere", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -2,7 +2,6 @@ import { expect, test, type Page } from "../support/fixtures";
|
||||
import { gotoAppShell } from "../support/helpers/app";
|
||||
import { waitForSidebarHydration } from "../support/helpers/workspace-ui";
|
||||
import {
|
||||
chooseProjectWithKeyboard,
|
||||
expectNewWorkspaceDraft,
|
||||
fillNewWorkspaceDraft,
|
||||
openNewWorkspaceComposer,
|
||||
@@ -110,27 +109,6 @@ test.describe("New workspace: launching a terminal", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("with a profile that takes no prompt, choosing a project keeps focus on the Project field", async ({
|
||||
page,
|
||||
}) => {
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarHydration(page);
|
||||
await openNewWorkspaceComposer(page, {
|
||||
projectKey: workspace.projectKey,
|
||||
projectDisplayName: workspace.projectDisplayName,
|
||||
});
|
||||
await selectLaunchOption(page, BARE_PROFILE.id);
|
||||
await expect(terminalPromptInput(page)).toHaveCount(0);
|
||||
|
||||
// The read-only command preview has nothing to type into, so the picker
|
||||
// hands focus back to the field that opened it.
|
||||
const projectTrigger = page.getByTestId("new-workspace-project-picker-trigger");
|
||||
await projectTrigger.focus();
|
||||
await page.keyboard.press("Enter");
|
||||
await chooseProjectWithKeyboard(page, workspace.projectDisplayName);
|
||||
await expect(projectTrigger).toBeFocused();
|
||||
});
|
||||
|
||||
test("switching terminal profiles restores the prompt and its fullscreen affordance", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -243,14 +243,6 @@ export async function openNewWorkspaceProjectPickerWithShortcut(
|
||||
await expect(searchInput).toBeFocused();
|
||||
}
|
||||
|
||||
export async function chooseProjectWithKeyboard(page: Page, projectName: string): Promise<void> {
|
||||
const searchInput = page.getByPlaceholder("Search projects");
|
||||
await expect(searchInput).toBeFocused({ timeout: 30_000 });
|
||||
await page.keyboard.type(projectName);
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(searchInput).toBeHidden({ timeout: 10_000 });
|
||||
}
|
||||
|
||||
export async function expectNewWorkspaceProjectSelected(
|
||||
page: Page,
|
||||
projectDisplayName: string,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -162,7 +162,6 @@ export interface HostPickerProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
anchorRef: React.RefObject<View | null>;
|
||||
restoreFocusRef?: ComboboxProps["restoreFocusRef"];
|
||||
includeAllHost?: boolean;
|
||||
includeAddHost?: boolean;
|
||||
onAddHost?: () => void;
|
||||
@@ -186,7 +185,6 @@ export function HostPicker({
|
||||
open,
|
||||
onOpenChange,
|
||||
anchorRef,
|
||||
restoreFocusRef,
|
||||
includeAllHost,
|
||||
includeAddHost,
|
||||
onAddHost,
|
||||
@@ -308,7 +306,6 @@ export function HostPicker({
|
||||
open={open}
|
||||
onOpenChange={onOpenChange}
|
||||
anchorRef={anchorRef}
|
||||
restoreFocusRef={restoreFocusRef}
|
||||
desktopPlacement={desktopPlacement}
|
||||
desktopMinWidth={desktopMinWidth}
|
||||
/>
|
||||
|
||||
@@ -138,8 +138,6 @@ export interface ComboboxProps {
|
||||
/** When true, selecting an option does not close the picker (multi-select mode). */
|
||||
keepOpenOnSelect?: boolean;
|
||||
anchorRef: React.RefObject<View | null>;
|
||||
/** Where focus goes when the picker closes. Defaults to whatever had focus when it opened. */
|
||||
restoreFocusRef?: React.RefObject<unknown>;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
@@ -1404,7 +1402,6 @@ export function Combobox({
|
||||
footer,
|
||||
keepOpenOnSelect = false,
|
||||
anchorRef,
|
||||
restoreFocusRef,
|
||||
children,
|
||||
}: ComboboxProps): ReactElement | null {
|
||||
const { t } = useTranslation();
|
||||
@@ -1670,7 +1667,6 @@ export function Combobox({
|
||||
layer: floatingLayer,
|
||||
keys: ["Escape", "Enter", "ArrowUp", "ArrowDown"],
|
||||
onKeyDown: (event) => (isDesktopKey(event.key) ? handleDesktopKey(event.key, event) : false),
|
||||
restoreFocusRef,
|
||||
});
|
||||
|
||||
const effectiveSearchPlaceholder = searchPlaceholder ?? resolvedPlaceholder;
|
||||
|
||||
@@ -244,6 +244,7 @@ const CATALOG_DATA = [
|
||||
},
|
||||
{
|
||||
id: "hermes",
|
||||
bundledProvider: { hostFeature: "hermesProvider" },
|
||||
title: "Hermes",
|
||||
description: "Nous Research self-improving AI agent",
|
||||
version: "manual",
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
buildGitActions,
|
||||
isCurrentBranchBase,
|
||||
canMergeIntoLocalBase,
|
||||
readUpstreamState,
|
||||
type BuildGitActionsInput,
|
||||
} from "./policy";
|
||||
import { deriveMergeCapability, type ForgeSpecificStatusFacts } from "./merge-capability";
|
||||
@@ -76,6 +77,8 @@ function createInput(
|
||||
pullRequestMergeable: "UNKNOWN",
|
||||
mergeCapability: deriveMergeCapability(pullRequestGithub),
|
||||
hasRemote: false,
|
||||
hasFirstPushRemote: rest.hasRemote ?? false,
|
||||
upstream: "tracked",
|
||||
isPaseoOwnedWorktree: false,
|
||||
isOnBaseBranch: true,
|
||||
canMergeLocally: true,
|
||||
@@ -169,6 +172,10 @@ function createInput(
|
||||
};
|
||||
}
|
||||
|
||||
function pushActionOf(actions: ReturnType<typeof buildGitActions>) {
|
||||
return actions.secondary.find((action) => action.id === "push");
|
||||
}
|
||||
|
||||
describe("git-actions-policy", () => {
|
||||
afterEach(async () => {
|
||||
await i18n.changeLanguage("en");
|
||||
@@ -346,6 +353,7 @@ describe("git-actions-policy", () => {
|
||||
const actions = buildGitActions(
|
||||
createInput({
|
||||
hasRemote: true,
|
||||
upstream: "none",
|
||||
isPaseoOwnedWorktree: true,
|
||||
isOnBaseBranch: false,
|
||||
aheadCount: 1,
|
||||
@@ -361,6 +369,207 @@ describe("git-actions-policy", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("re-publishes a Paseo worktree branch whose remote copy was deleted", () => {
|
||||
const actions = buildGitActions(
|
||||
createInput({
|
||||
hasRemote: true,
|
||||
upstream: "gone",
|
||||
isPaseoOwnedWorktree: true,
|
||||
isOnBaseBranch: false,
|
||||
aheadCount: 2,
|
||||
aheadOfOrigin: null,
|
||||
behindOfOrigin: null,
|
||||
shipDefault: "pr",
|
||||
}),
|
||||
);
|
||||
const pushAction = actions.secondary.find((action) => action.id === "push");
|
||||
|
||||
expect(actions.primary).toMatchObject({ id: "push", label: "Push" });
|
||||
expect(pushAction).toMatchObject({ disabled: false, unavailableMessage: undefined });
|
||||
});
|
||||
|
||||
describe("a never-pushed branch in a regular checkout", () => {
|
||||
const neverPushed = {
|
||||
hasRemote: true,
|
||||
upstream: "none",
|
||||
isOnBaseBranch: false,
|
||||
aheadCount: 1,
|
||||
aheadOfOrigin: null,
|
||||
behindOfOrigin: null,
|
||||
} as const;
|
||||
|
||||
it("offers Push first, ahead of Create PR", () => {
|
||||
const actions = buildGitActions(createInput({ ...neverPushed, shipDefault: "pr" }));
|
||||
|
||||
expect(actions.primary).toMatchObject({ id: "push", label: "Push" });
|
||||
});
|
||||
|
||||
it("offers Push first, ahead of Merge locally", () => {
|
||||
const actions = buildGitActions(
|
||||
createInput({ ...neverPushed, githubFeaturesEnabled: false, shipDefault: "merge" }),
|
||||
);
|
||||
|
||||
expect(actions.primary).toMatchObject({ id: "push", label: "Push" });
|
||||
});
|
||||
|
||||
it("does not offer Push when it has no commits of its own", () => {
|
||||
const actions = buildGitActions(createInput({ ...neverPushed, aheadCount: 0 }));
|
||||
const pushAction = pushActionOf(actions);
|
||||
|
||||
expect(actions.primary?.id).not.toBe("push");
|
||||
expect(pushAction?.unavailableMessage).toBe(
|
||||
"Push isn't available because there is nothing new to send",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not offer Push when the repository has no origin", () => {
|
||||
const actions = buildGitActions(createInput({ ...neverPushed, hasRemote: false }));
|
||||
const pushAction = pushActionOf(actions);
|
||||
|
||||
expect(actions.primary?.id).not.toBe("push");
|
||||
expect(pushAction?.unavailableMessage).toBe(
|
||||
"Push isn't available here because this branch is not connected to a remote yet",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not offer Push when Git pushes the branch to another remote", () => {
|
||||
const actions = buildGitActions(createInput({ ...neverPushed, hasFirstPushRemote: false }));
|
||||
const pushAction = pushActionOf(actions);
|
||||
|
||||
expect(actions.primary?.id).not.toBe("push");
|
||||
expect(pushAction?.unavailableMessage).toBe(
|
||||
"Push isn't available here because this branch is not connected to a remote yet",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps offering Push in a Paseo worktree when Git pushes the branch to another remote", () => {
|
||||
const actions = buildGitActions(
|
||||
createInput({ ...neverPushed, hasFirstPushRemote: false, isPaseoOwnedWorktree: true }),
|
||||
);
|
||||
|
||||
expect(actions.primary).toMatchObject({ id: "push", label: "Push" });
|
||||
});
|
||||
});
|
||||
|
||||
it("does not offer a first push when the branch's remote copy was deleted", () => {
|
||||
const actions = buildGitActions(
|
||||
createInput({
|
||||
hasRemote: true,
|
||||
upstream: "gone",
|
||||
isOnBaseBranch: false,
|
||||
aheadCount: 2,
|
||||
aheadOfOrigin: null,
|
||||
behindOfOrigin: null,
|
||||
shipDefault: "pr",
|
||||
}),
|
||||
);
|
||||
const pushAction = actions.secondary.find((action) => action.id === "push");
|
||||
|
||||
expect(actions.primary).toMatchObject({ id: "pr", label: "Create PR" });
|
||||
expect(pushAction?.unavailableMessage).toBe(
|
||||
"Push isn't available because the branch this one tracks no longer exists",
|
||||
);
|
||||
});
|
||||
|
||||
describe("a published branch whose upstream the daemon cannot read", () => {
|
||||
const unreadableUpstream = {
|
||||
hasRemote: true,
|
||||
upstream: "unknown",
|
||||
isOnBaseBranch: false,
|
||||
aheadCount: 2,
|
||||
aheadOfOrigin: null,
|
||||
behindOfOrigin: null,
|
||||
shipDefault: "pr",
|
||||
} as const;
|
||||
|
||||
it("does not offer a first push in a regular checkout", () => {
|
||||
const actions = buildGitActions(createInput(unreadableUpstream));
|
||||
|
||||
expect(actions.primary).toMatchObject({ id: "pr", label: "Create PR" });
|
||||
expect(pushActionOf(actions)?.unavailableMessage).toEqual(expect.any(String));
|
||||
});
|
||||
|
||||
it("keeps offering Push in a Paseo worktree", () => {
|
||||
const actions = buildGitActions(
|
||||
createInput({ ...unreadableUpstream, isPaseoOwnedWorktree: true }),
|
||||
);
|
||||
|
||||
expect(actions.primary).toMatchObject({ id: "push", label: "Push" });
|
||||
expect(pushActionOf(actions)).toMatchObject({
|
||||
disabled: false,
|
||||
unavailableMessage: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("readUpstreamState", () => {
|
||||
it("uses the upstream state the daemon reports", () => {
|
||||
expect(
|
||||
readUpstreamState({
|
||||
upstreamState: "none",
|
||||
aheadOfOrigin: null,
|
||||
isPaseoOwnedWorktree: false,
|
||||
}),
|
||||
).toBe("none");
|
||||
expect(
|
||||
readUpstreamState({
|
||||
upstreamState: "gone",
|
||||
aheadOfOrigin: null,
|
||||
isPaseoOwnedWorktree: true,
|
||||
}),
|
||||
).toBe("gone");
|
||||
});
|
||||
|
||||
it("keeps the old guess for daemons that predate upstream states", () => {
|
||||
expect(
|
||||
readUpstreamState({
|
||||
upstreamState: undefined,
|
||||
aheadOfOrigin: 1,
|
||||
isPaseoOwnedWorktree: false,
|
||||
}),
|
||||
).toBe("tracked");
|
||||
expect(
|
||||
readUpstreamState({
|
||||
upstreamState: undefined,
|
||||
aheadOfOrigin: null,
|
||||
isPaseoOwnedWorktree: true,
|
||||
}),
|
||||
).toBe("none");
|
||||
expect(
|
||||
readUpstreamState({
|
||||
upstreamState: undefined,
|
||||
aheadOfOrigin: null,
|
||||
isPaseoOwnedWorktree: false,
|
||||
}),
|
||||
).toBe("unknown");
|
||||
});
|
||||
|
||||
it("keeps an old daemon's never-pushed regular branch off Push", () => {
|
||||
const actions = buildGitActions(
|
||||
createInput({
|
||||
hasRemote: true,
|
||||
upstream: readUpstreamState({
|
||||
upstreamState: undefined,
|
||||
aheadOfOrigin: null,
|
||||
isPaseoOwnedWorktree: false,
|
||||
}),
|
||||
isOnBaseBranch: false,
|
||||
aheadCount: 1,
|
||||
aheadOfOrigin: null,
|
||||
behindOfOrigin: null,
|
||||
githubFeaturesEnabled: false,
|
||||
shipDefault: "merge",
|
||||
}),
|
||||
);
|
||||
const pushAction = pushActionOf(actions);
|
||||
|
||||
expect(actions.primary).toMatchObject({ id: "merge-branch" });
|
||||
expect(pushAction?.unavailableMessage).toBe(
|
||||
"Push isn't available because there is nothing new to send",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("prioritizes push over pull request merge when local commits are unpushed", () => {
|
||||
const actions = buildGitActions(
|
||||
createInput({
|
||||
|
||||
@@ -2,7 +2,11 @@ import type { ReactElement } from "react";
|
||||
|
||||
import type { ActionStatus } from "@/components/ui/dropdown-menu";
|
||||
import { i18n } from "@/i18n/i18next";
|
||||
import type { CheckoutPrMergeMethod, PullRequestMergeable } from "@getpaseo/protocol/messages";
|
||||
import type {
|
||||
CheckoutPrMergeMethod,
|
||||
CheckoutStatusResponse,
|
||||
PullRequestMergeable,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
|
||||
import type { MergeCapability } from "./merge-capability";
|
||||
|
||||
@@ -73,6 +77,25 @@ export function canMergeIntoLocalBase(
|
||||
return currentBranch !== localTarget;
|
||||
}
|
||||
|
||||
type CheckoutStatusPayload = CheckoutStatusResponse["payload"];
|
||||
|
||||
export type GitUpstreamState = NonNullable<CheckoutStatusPayload["upstreamState"]>;
|
||||
|
||||
export function readUpstreamState(
|
||||
status: Pick<CheckoutStatusPayload, "upstreamState" | "aheadOfOrigin" | "isPaseoOwnedWorktree">,
|
||||
): GitUpstreamState {
|
||||
if (status.upstreamState !== undefined) {
|
||||
return status.upstreamState;
|
||||
}
|
||||
// COMPAT(checkoutUpstreamState): added in v0.17.4, remove after 2027-05-23 once the daemon
|
||||
// floor reports upstreamState. Older daemons send a null upstream for both a never-pushed and
|
||||
// a deleted remote branch. Only a Paseo worktree's null was trusted as never pushed.
|
||||
if (status.aheadOfOrigin !== null) {
|
||||
return "tracked";
|
||||
}
|
||||
return status.isPaseoOwnedWorktree ? "none" : "unknown";
|
||||
}
|
||||
|
||||
export interface BuildGitActionsInput {
|
||||
isGit: boolean;
|
||||
githubFeaturesEnabled: boolean;
|
||||
@@ -89,6 +112,9 @@ export interface BuildGitActionsInput {
|
||||
pullRequestMergeable: PullRequestMergeable;
|
||||
mergeCapability: MergeCapability | null;
|
||||
hasRemote: boolean;
|
||||
/** The daemon confirmed where a first push publishes the branch. */
|
||||
hasFirstPushRemote: boolean;
|
||||
upstream: GitUpstreamState;
|
||||
isPaseoOwnedWorktree: boolean;
|
||||
isOnBaseBranch: boolean;
|
||||
canMergeLocally: boolean;
|
||||
@@ -554,12 +580,22 @@ function canPush(input: BuildGitActionsInput): boolean {
|
||||
}
|
||||
|
||||
function hasPushableCommits(input: BuildGitActionsInput): boolean {
|
||||
if ((input.aheadOfOrigin ?? 0) > 0) {
|
||||
return true;
|
||||
switch (input.upstream) {
|
||||
case "tracked":
|
||||
return (input.aheadOfOrigin ?? 0) > 0;
|
||||
case "none":
|
||||
// A first push, which sets the upstream. The commits to send are the ones ahead of the base.
|
||||
// Paseo worktrees always publish to origin. A regular checkout publishes only where the
|
||||
// daemon confirmed Git would push the branch too, so a fork setup is not sent to origin.
|
||||
return input.aheadCount > 0 && (input.isPaseoOwnedWorktree || input.hasFirstPushRemote);
|
||||
case "gone":
|
||||
case "unknown":
|
||||
// The branch has an upstream that is deleted or unreadable, so nothing counts the commits
|
||||
// left to send. Paseo worktrees publish whenever the branch is ahead of its base, for
|
||||
// example after a merged PR. Regular checkouts do not: Push would re-create a branch that
|
||||
// was deleted.
|
||||
return input.isPaseoOwnedWorktree && input.aheadCount > 0;
|
||||
}
|
||||
// No-upstream Paseo worktrees are first-pushable: the daemon push sets upstream with `git push -u`.
|
||||
// Do not fold this into aheadOfOrigin; null also covers deleted/pruned upstream branches.
|
||||
return input.isPaseoOwnedWorktree && input.aheadOfOrigin === null && input.aheadCount > 0;
|
||||
}
|
||||
|
||||
function canMergeFromBase(input: BuildGitActionsInput): boolean {
|
||||
@@ -664,10 +700,16 @@ function getPushUnavailableMessage(input: BuildGitActionsInput): string | undefi
|
||||
if ((input.behindOfOrigin ?? 0) > 0) {
|
||||
return i18n.t("workspace.git.actions.unavailable.pushBehind");
|
||||
}
|
||||
if (!hasPushableCommits(input)) {
|
||||
return i18n.t("workspace.git.actions.unavailable.pushNothing");
|
||||
if (hasPushableCommits(input)) {
|
||||
return undefined;
|
||||
}
|
||||
return undefined;
|
||||
if (input.upstream === "gone") {
|
||||
return i18n.t("workspace.git.actions.unavailable.pushUpstreamGone");
|
||||
}
|
||||
if (input.upstream === "none" && input.aheadCount > 0) {
|
||||
return i18n.t("workspace.git.actions.unavailable.pushNoRemote");
|
||||
}
|
||||
return i18n.t("workspace.git.actions.unavailable.pushNothing");
|
||||
}
|
||||
|
||||
function getPullAndPushUnavailableMessage(input: BuildGitActionsInput): string | undefined {
|
||||
|
||||
@@ -15,9 +15,11 @@ import {
|
||||
isCurrentBranchBase,
|
||||
canMergeIntoLocalBase,
|
||||
narrowPullRequestState,
|
||||
readUpstreamState,
|
||||
type BuildGitActionsInput,
|
||||
type GitAction,
|
||||
type GitActions,
|
||||
type GitUpstreamState,
|
||||
} from "@/git/policy";
|
||||
import { deriveMergeCapability } from "@/git/merge-capability";
|
||||
import type { CheckoutPrMergeMethod } from "@getpaseo/protocol/messages";
|
||||
@@ -129,6 +131,8 @@ interface DerivedGitActionsState {
|
||||
behindOfOrigin: number | null;
|
||||
hasPullRequest: boolean;
|
||||
hasRemote: boolean;
|
||||
hasFirstPushRemote: boolean;
|
||||
upstream: GitUpstreamState;
|
||||
isPaseoOwnedWorktree: boolean;
|
||||
isOnBaseBranch: boolean;
|
||||
canMergeLocally: boolean;
|
||||
@@ -180,6 +184,8 @@ function deriveGitActionsState(args: DeriveGitActionsStateArgs): DerivedGitActio
|
||||
...extractGitCommitCounts(gitStatus),
|
||||
hasPullRequest: Boolean(prStatus?.url),
|
||||
hasRemote: gitStatus?.hasRemote ?? false,
|
||||
hasFirstPushRemote: (gitStatus?.firstPushRemote ?? null) !== null,
|
||||
upstream: gitStatus ? readUpstreamState(gitStatus) : "unknown",
|
||||
isPaseoOwnedWorktree,
|
||||
isOnBaseBranch: isCurrentBranchBase(gitStatus?.currentBranch, baseRef),
|
||||
canMergeLocally: canMergeIntoLocalBase(gitStatus?.currentBranch, baseRef),
|
||||
@@ -668,6 +674,8 @@ export function useGitActions({ serverId, cwd, icons }: UseGitActionsInput): Use
|
||||
behindOfOrigin,
|
||||
hasPullRequest,
|
||||
hasRemote,
|
||||
hasFirstPushRemote,
|
||||
upstream,
|
||||
isPaseoOwnedWorktree,
|
||||
isOnBaseBranch,
|
||||
canMergeLocally,
|
||||
@@ -699,6 +707,8 @@ export function useGitActions({ serverId, cwd, icons }: UseGitActionsInput): Use
|
||||
pullRequestMergeable: prStatus?.mergeable ?? "UNKNOWN",
|
||||
mergeCapability: deriveMergeCapability(prStatus?.forgeSpecific, prStatus?.github),
|
||||
hasRemote,
|
||||
hasFirstPushRemote,
|
||||
upstream,
|
||||
isPaseoOwnedWorktree,
|
||||
isOnBaseBranch,
|
||||
canMergeLocally,
|
||||
@@ -807,6 +817,8 @@ export function useGitActions({ serverId, cwd, icons }: UseGitActionsInput): Use
|
||||
}, [
|
||||
isGit,
|
||||
hasRemote,
|
||||
hasFirstPushRemote,
|
||||
upstream,
|
||||
hasPullRequest,
|
||||
prStatus?.url,
|
||||
prStatus?.state,
|
||||
|
||||
@@ -151,20 +151,26 @@ describe("ACP provider catalog", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("adds bundled goose on capable hosts and uses the ACP config on older hosts", () => {
|
||||
const goose = findProvider("goose");
|
||||
expect(buildAcpProviderConfigPatch(goose, (feature) => feature === "gooseProvider")).toEqual({
|
||||
providers: { goose: { enabled: true } },
|
||||
});
|
||||
expect(buildAcpProviderConfigPatch(goose)).toEqual({
|
||||
providers: {
|
||||
goose: {
|
||||
extends: "acp",
|
||||
label: "goose",
|
||||
description: goose.description,
|
||||
command: ["goose", "acp"],
|
||||
env: {},
|
||||
it.each([
|
||||
{ id: "goose", feature: "gooseProvider" },
|
||||
{ id: "hermes", feature: "hermesProvider" },
|
||||
] as const)(
|
||||
"adds bundled $id on capable hosts and uses the ACP config on older hosts",
|
||||
({ id, feature }) => {
|
||||
const entry = findProvider(id);
|
||||
expect(buildAcpProviderConfigPatch(entry, (supported) => supported === feature)).toEqual({
|
||||
providers: { [id]: { enabled: true } },
|
||||
});
|
||||
expect(buildAcpProviderConfigPatch(entry)).toEqual({
|
||||
providers: {
|
||||
[id]: {
|
||||
extends: "acp",
|
||||
label: entry.title,
|
||||
description: entry.description,
|
||||
command: [id, "acp"],
|
||||
env: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
@@ -24,9 +24,10 @@ export function buildAcpProviderConfigPatch(
|
||||
return { providers: { [entry.id]: { enabled: true } } };
|
||||
}
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once host floor includes the bundled adapter.
|
||||
// COMPAT(hermesProvider): added in v0.17.4, remove after 2027-05-23 once host floor includes the bundled adapter.
|
||||
// COMPAT(hopliteProvider): added after v0.11.2, remove after 2027-04-15 once host floor includes the bundled adapter.
|
||||
// COMPAT(fxProvider): added after v0.15.3, remove after 2027-05-09 once host floor includes the bundled adapter.
|
||||
if (feature !== "gooseProvider") {
|
||||
if (feature !== "gooseProvider" && feature !== "hermesProvider") {
|
||||
throw new Error(`Update the host to add ${entry.title}.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,6 +912,7 @@ export const ar: TranslationResources = {
|
||||
pushNoRemote: "الدفع غير متاح هنا لأن هذا الفرع غير متصل بجهاز التحكم عن بعد بعد",
|
||||
pushBehind: "الدفع غير متاح حتى الآن نظرًا لوجود تغييرات أحدث يجب إدخالها أولاً",
|
||||
pushNothing: "خدمة الدفع غير متاحة لأنه لا يوجد شيء جديد لإرساله",
|
||||
pushUpstreamGone: "الدفع غير متاح لأن الفرع الذي يتتبعه هذا الفرع لم يعد موجودًا",
|
||||
pullAndPushNoRemote:
|
||||
"السحب والدفع غير متاح هنا لأن هذا الفرع غير متصل بجهاز التحكم عن بعد بعد",
|
||||
pullAndPushDirty:
|
||||
|
||||
@@ -913,6 +913,8 @@ export const en = {
|
||||
"Push isn't available here because this branch is not connected to a remote yet",
|
||||
pushBehind: "Push isn't available yet because there are newer changes to bring in first",
|
||||
pushNothing: "Push isn't available because there is nothing new to send",
|
||||
pushUpstreamGone:
|
||||
"Push isn't available because the branch this one tracks no longer exists",
|
||||
pullAndPushNoRemote:
|
||||
"Pull and push isn't available here because this branch is not connected to a remote yet",
|
||||
pullAndPushDirty:
|
||||
|
||||
@@ -925,6 +925,8 @@ export const es: TranslationResources = {
|
||||
pushBehind:
|
||||
"Push aún no está disponible porque hay cambios más nuevos que implementar primero",
|
||||
pushNothing: "Push no está disponible porque no hay nada nuevo que enviar",
|
||||
pushUpstreamGone:
|
||||
"Push no está disponible porque la rama que sigue esta rama ya no existe",
|
||||
pullAndPushNoRemote:
|
||||
"Tirar y empujar no está disponible aquí porque esta rama aún no está conectada a un control remoto",
|
||||
pullAndPushDirty:
|
||||
|
||||
@@ -926,6 +926,7 @@ export const fr: TranslationResources = {
|
||||
pushBehind:
|
||||
"Push indisponible pour l’instant : des modifications plus récentes doivent d’abord être récupérées",
|
||||
pushNothing: "Push indisponible : il n’y a rien de nouveau à pousser",
|
||||
pushUpstreamGone: "Push indisponible : la branche suivie par cette branche n’existe plus",
|
||||
pullAndPushNoRemote:
|
||||
"Pull et push indisponibles : cette branche n’est pas encore liée à un dépôt distant",
|
||||
pullAndPushDirty:
|
||||
|
||||
@@ -919,6 +919,8 @@ export const ja: TranslationResources = {
|
||||
"このブランチはまだリモートに接続されていないため、プッシュはここでは利用できません",
|
||||
pushBehind: "取り込む必要がある新しい変更があるため、まだプッシュは利用できません",
|
||||
pushNothing: "プッシュする変更がないため、プッシュは利用できません",
|
||||
pushUpstreamGone:
|
||||
"このブランチが追跡しているブランチが存在しないため、プッシュは利用できません",
|
||||
pullAndPushNoRemote:
|
||||
"このブランチはまだリモートに接続されていないため、プル&プッシュはここでは利用できません",
|
||||
pullAndPushDirty:
|
||||
|
||||
@@ -913,6 +913,7 @@ export const ko: TranslationResources = {
|
||||
"이 브랜치가 아직 원격에 연결되어 있지 않아 여기서 푸시를 사용할 수 없습니다",
|
||||
pushBehind: "먼저 가져와야 할 최신 변경 사항이 있어 아직 푸시를 사용할 수 없습니다",
|
||||
pushNothing: "새로 보낼 항목이 없어 푸시를 사용할 수 없습니다",
|
||||
pushUpstreamGone: "이 브랜치가 추적하는 브랜치가 더 이상 없어 푸시를 사용할 수 없습니다",
|
||||
pullAndPushNoRemote:
|
||||
"이 브랜치가 아직 원격에 연결되어 있지 않아 여기서 풀 후 푸시를 사용할 수 없습니다",
|
||||
pullAndPushDirty:
|
||||
|
||||
@@ -921,6 +921,8 @@ export const ptBR: TranslationResources = {
|
||||
pushBehind:
|
||||
"Push ainda não está disponível porque há alterações mais recentes para trazer primeiro",
|
||||
pushNothing: "Push não está disponível porque não há nada novo para enviar",
|
||||
pushUpstreamGone:
|
||||
"Push não está disponível porque a branch que esta branch acompanha não existe mais",
|
||||
pullAndPushNoRemote:
|
||||
"Pull e push não estão disponíveis aqui porque esta branch ainda não está conectada a um remoto",
|
||||
pullAndPushDirty:
|
||||
|
||||
@@ -924,6 +924,8 @@ export const ru: TranslationResources = {
|
||||
"Отправка изменений недоступна: эта ветка ещё не связана с удалённым репозиторием.",
|
||||
pushBehind: "Отправка изменений пока недоступна: сначала получите более новые изменения.",
|
||||
pushNothing: "Отправка изменений недоступна: нет новых изменений для отправки.",
|
||||
pushUpstreamGone:
|
||||
"Отправка изменений недоступна: ветка, которую отслеживает эта ветка, больше не существует.",
|
||||
pullAndPushNoRemote:
|
||||
"Получение и отправка изменений недоступны: эта ветка ещё не связана с удалённым репозиторием.",
|
||||
pullAndPushDirty:
|
||||
|
||||
@@ -908,6 +908,7 @@ export const zhCN: TranslationResources = {
|
||||
pushNoRemote: "此处无法 push,因为此分支尚未连接到 remote",
|
||||
pushBehind: "暂时无法 push,因为需要先拉取更新的变更",
|
||||
pushNothing: "无法 push,因为没有新的内容可发送",
|
||||
pushUpstreamGone: "无法 push,因为此分支跟踪的分支已不存在",
|
||||
pullAndPushNoRemote: "此处无法 pull 并 push,因为此分支尚未连接到 remote",
|
||||
pullAndPushDirty: "有本地变更时无法 pull 并 push,请先 commit 或 stash",
|
||||
pullAndPushNoIncoming: "无法 pull 并 push,因为没有需要先 pull 的传入变更",
|
||||
|
||||
@@ -9,10 +9,6 @@ export interface OverlayRegistration {
|
||||
*/
|
||||
keys: readonly string[];
|
||||
onKeyDown(event: KeyboardInputEvent): boolean;
|
||||
/**
|
||||
* Where focus goes when the overlay closes: an element, or any handle with `focus()`. Defaults
|
||||
* to whatever had focus when the overlay opened.
|
||||
*/
|
||||
restoreFocusRef?: RefObject<unknown>;
|
||||
manageFocus?: boolean;
|
||||
}
|
||||
|
||||
@@ -3,29 +3,12 @@ import { overlays, type OverlayEntry, type KeyboardInputEvent } from "./overlays
|
||||
import type { OverlayRegistration } from "./overlay-contract";
|
||||
type WebOverlayKeyHandler = (event: KeyboardInputEvent) => boolean;
|
||||
|
||||
/** A DOM element, or a component handle that knows how to focus itself (such as a text input). */
|
||||
interface FocusTarget {
|
||||
focus(): void;
|
||||
}
|
||||
|
||||
function isFocusTarget(value: unknown): value is FocusTarget {
|
||||
return (
|
||||
typeof value === "object" &&
|
||||
value !== null &&
|
||||
typeof (value as Partial<FocusTarget>).focus === "function"
|
||||
);
|
||||
}
|
||||
|
||||
function canRestoreFocusTo(target: FocusTarget): boolean {
|
||||
return !(target instanceof HTMLElement) || document.contains(target);
|
||||
}
|
||||
|
||||
interface WebOverlayEntry {
|
||||
getLayer: () => number;
|
||||
getKeys: () => readonly string[];
|
||||
getScope: () => HTMLElement | null;
|
||||
getKeyHandler: () => WebOverlayKeyHandler;
|
||||
restoreFocus: FocusTarget | null;
|
||||
restoreFocus: HTMLElement | null;
|
||||
manageFocus: boolean;
|
||||
}
|
||||
|
||||
@@ -173,7 +156,7 @@ function addWebOverlay(entry: WebOverlayEntry): (options?: RemoveWebOverlayOptio
|
||||
entry.manageFocus &&
|
||||
options?.restoreFocus !== false &&
|
||||
entry.restoreFocus &&
|
||||
canRestoreFocusTo(entry.restoreFocus)
|
||||
document.contains(entry.restoreFocus)
|
||||
) {
|
||||
entry.restoreFocus.focus();
|
||||
}
|
||||
@@ -198,7 +181,7 @@ export function useOverlayRegistration({
|
||||
keysRef.current = keys;
|
||||
const layerRef = useRef(layer);
|
||||
const keyHandlerRef = useRef(onKeyDown);
|
||||
const capturedRestoreFocusRef = useRef<FocusTarget | null>(null);
|
||||
const capturedRestoreFocusRef = useRef<HTMLElement | null>(null);
|
||||
const removeEntryRef = useRef<((options?: RemoveWebOverlayOptions) => void) | null>(null);
|
||||
const detachedRemoveEntryRef = useRef<((options?: RemoveWebOverlayOptions) => void) | null>(null);
|
||||
const registeredRef = useRef(false);
|
||||
@@ -210,7 +193,7 @@ export function useOverlayRegistration({
|
||||
keyHandlerRef.current = onKeyDown;
|
||||
if (active && !wasActiveRef.current && typeof document !== "undefined") {
|
||||
const requestedRestoreTarget = preferredRestoreFocusRef?.current;
|
||||
if (isFocusTarget(requestedRestoreTarget)) {
|
||||
if (requestedRestoreTarget instanceof HTMLElement) {
|
||||
capturedRestoreFocusRef.current = requestedRestoreTarget;
|
||||
} else {
|
||||
capturedRestoreFocusRef.current =
|
||||
|
||||
@@ -1578,18 +1578,9 @@ export function NewWorkspaceScreen({
|
||||
? t("newWorkspace.refPicker.searching")
|
||||
: t("newWorkspace.refPicker.noMatchingRefs");
|
||||
|
||||
// The prompt is where the user types; when a field's picker closes, focus returns there rather
|
||||
// than to whatever had focus when the picker opened. A terminal profile that takes no prompt
|
||||
// shows a read-only command preview, so its pickers keep returning focus to their field.
|
||||
const composerFocusRef = useRef<{ focus: () => void } | null>(null);
|
||||
const handleComposerFocusInput = useCallback((focus: () => void) => {
|
||||
composerFocusRef.current = { focus };
|
||||
}, []);
|
||||
|
||||
const formStack = useNewWorkspaceForm({
|
||||
isCompact,
|
||||
isPending,
|
||||
restoreFocusRef: terminalTakesPrompt ? composerFocusRef : undefined,
|
||||
pluginItems: (
|
||||
<PluginNewWorkspaceItems serverId={selectedServerId} screen={pluginScreen} setup={setup} />
|
||||
),
|
||||
@@ -1691,7 +1682,6 @@ export function NewWorkspaceScreen({
|
||||
clearDraft={noopClearDraft}
|
||||
autoFocus={terminalTakesPrompt}
|
||||
autoFocusKey={launchFocusKey}
|
||||
onFocusInput={handleComposerFocusInput}
|
||||
error={errorMessage}
|
||||
/>
|
||||
) : (
|
||||
@@ -1722,7 +1712,6 @@ export function NewWorkspaceScreen({
|
||||
clearDraft={handleClearDraft}
|
||||
autoFocus
|
||||
autoFocusKey={launchFocusKey}
|
||||
onFocusInput={handleComposerFocusInput}
|
||||
commandDraft={composerState?.commandDraft}
|
||||
agentControls={agentControlsWithDisabled}
|
||||
error={errorMessage}
|
||||
|
||||
@@ -67,11 +67,6 @@ export interface NewWorkspaceFormProps {
|
||||
isPending: boolean;
|
||||
/** Plugin fields, drawn after the base ref. */
|
||||
pluginItems: ReactNode;
|
||||
/**
|
||||
* Where focus goes when a field's picker closes, so the user keeps typing the prompt. Without
|
||||
* one, focus returns to the field that opened the picker.
|
||||
*/
|
||||
restoreFocusRef?: RefObject<unknown>;
|
||||
project: PickerControl & {
|
||||
options: ComboboxOption[];
|
||||
projectByOptionId: Map<string, HostProjectListItem>;
|
||||
@@ -378,17 +373,7 @@ function useRefPicker(base: NewWorkspaceFormProps["base"], isPending: boolean) {
|
||||
*/
|
||||
export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement {
|
||||
const { t } = useTranslation();
|
||||
const {
|
||||
isCompact,
|
||||
isPending,
|
||||
pluginItems,
|
||||
restoreFocusRef,
|
||||
project,
|
||||
host,
|
||||
isolation,
|
||||
base,
|
||||
launch,
|
||||
} = props;
|
||||
const { isCompact, isPending, pluginItems, project, host, isolation, base, launch } = props;
|
||||
const variant: FieldTriggerVariant = isCompact ? "field" : "badge";
|
||||
const projectPicker = useProjectPicker(project, isPending);
|
||||
const isolationPicker = useIsolationPicker({
|
||||
@@ -447,7 +432,6 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement
|
||||
open={host.openState}
|
||||
onOpenChange={host.onOpenChange}
|
||||
anchorRef={host.anchorRef}
|
||||
restoreFocusRef={restoreFocusRef}
|
||||
includeAddHost
|
||||
onAddHost={host.onAddHost}
|
||||
addHostTestID="new-workspace-host-picker-add-host"
|
||||
@@ -541,7 +525,6 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement
|
||||
desktopPlacement="bottom-start"
|
||||
desktopMinWidth={360}
|
||||
anchorRef={project.anchorRef}
|
||||
restoreFocusRef={restoreFocusRef}
|
||||
emptyText="No projects available."
|
||||
renderOption={projectPicker.renderOption}
|
||||
footer={projectPicker.footer}
|
||||
@@ -556,7 +539,6 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement
|
||||
searchable={false}
|
||||
desktopPlacement="bottom-start"
|
||||
anchorRef={isolation.anchorRef}
|
||||
restoreFocusRef={restoreFocusRef}
|
||||
desktopMinWidth={280}
|
||||
renderOption={isolationPicker.renderOption}
|
||||
/>
|
||||
@@ -573,7 +555,6 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement
|
||||
desktopPlacement="bottom-start"
|
||||
desktopMinWidth={440}
|
||||
anchorRef={base.anchorRef}
|
||||
restoreFocusRef={restoreFocusRef}
|
||||
emptyText={base.emptyText}
|
||||
toolbar={refPicker.toolbar}
|
||||
renderOption={refPicker.renderOption}
|
||||
@@ -590,7 +571,6 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement
|
||||
desktopPlacement="bottom-start"
|
||||
desktopMinWidth={360}
|
||||
anchorRef={worktreePicker.anchorRef}
|
||||
restoreFocusRef={restoreFocusRef}
|
||||
emptyText={t("newWorkspace.worktreePicker.empty")}
|
||||
renderOption={worktreePicker.renderOption}
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"description": "Paseo CLI - control your AI coding agents from the command line",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
@@ -29,9 +29,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/server": "0.17.3",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/server": "0.17.4",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"description": "Paseo client SDK package",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
@@ -49,8 +49,8 @@
|
||||
"measure:diff-materialization": "tsx scripts/measure-diff-materialization.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/relay": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/relay": "0.17.4",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"private": true,
|
||||
"description": "Paseo desktop app (Electron wrapper)",
|
||||
"homepage": "https://paseo.sh",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"description": "Native module for two way audio streaming",
|
||||
"keywords": [
|
||||
"ExpoTwoWayAudio",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"description": "Paseo plugin SDK package",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
@@ -78,8 +78,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -89,8 +89,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
@@ -13,14 +13,15 @@ import {
|
||||
type RequestPermissionRequest,
|
||||
type RequestPermissionResponse,
|
||||
type SessionConfigOption,
|
||||
type SessionInfo,
|
||||
type SessionNotification,
|
||||
type SessionUpdate,
|
||||
type ToolCall,
|
||||
type ToolCallContent,
|
||||
type ToolCallUpdate,
|
||||
type Stream,
|
||||
} from "@agentclientprotocol/sdk";
|
||||
import { z } from "zod";
|
||||
import type { JsonValue } from "@getpaseo/protocol/agent-types";
|
||||
import type {
|
||||
AcpConfigAccess,
|
||||
AcpConfigChange,
|
||||
@@ -31,6 +32,7 @@ import type {
|
||||
AcpVendorUpdate,
|
||||
RunAcpProviderOptions,
|
||||
} from "../acp.js";
|
||||
import { standardToolCallDetail } from "./tool-call-detail.js";
|
||||
import {
|
||||
PROVIDER_PROTOCOL_VERSION,
|
||||
ProviderEventSchema,
|
||||
@@ -48,6 +50,7 @@ import {
|
||||
type ProviderLaunch,
|
||||
type ProviderModel,
|
||||
type ProviderPermissionResponse,
|
||||
type ProviderToolCallDetail,
|
||||
type ProviderPersistence,
|
||||
type ProviderSessionConfig,
|
||||
type ProviderSetting,
|
||||
@@ -296,8 +299,7 @@ async function listSessions(
|
||||
emit: state.emit,
|
||||
});
|
||||
try {
|
||||
const response = await runtime.listSessions(input.cwd);
|
||||
const selected = input.limit ? response.sessions.slice(0, input.limit) : response.sessions;
|
||||
const selected = await runtime.listSessions({ cwd: input.cwd, limit: input.limit });
|
||||
state.emit({
|
||||
type: "sessions",
|
||||
requestId: input.requestId,
|
||||
@@ -408,14 +410,14 @@ interface ActivePrompt {
|
||||
}
|
||||
|
||||
const DEFAULT_DEFERRED_SETTLE_DELAY_MS = 500;
|
||||
const SESSION_SCAN_LIMIT = 500;
|
||||
// COMPAT(acpAutoAccept): added in v0.17.4, remove after 2027-05-23. The generic ACP adapter saves
|
||||
// its Auto Accept toggle as this setting on agents that later moved to a bundled ACP provider.
|
||||
const LEGACY_AUTO_ACCEPT_SETTING = "auto_accept";
|
||||
const DEFAULT_DEFERRED_QUIET_LIMIT_MS = 120_000;
|
||||
|
||||
type AcpToolCallSource = AcpToolCallSnapshot & {
|
||||
diff?: Extract<ToolCallContent, { type: "diff" }>;
|
||||
};
|
||||
|
||||
interface AcpToolCallState {
|
||||
source: AcpToolCallSource;
|
||||
source: AcpToolCallSnapshot;
|
||||
presentation: AcpToolCallSnapshot;
|
||||
}
|
||||
|
||||
@@ -916,8 +918,17 @@ class AcpRuntime {
|
||||
return true;
|
||||
}
|
||||
|
||||
listSessions(cwd?: string) {
|
||||
return this.call(this.connection.listSessions({ cwd }));
|
||||
/** Follows `nextCursor` until `limit` sessions, the last page, or the scan cap. */
|
||||
async listSessions({ cwd, limit }: { cwd?: string; limit?: number }): Promise<SessionInfo[]> {
|
||||
const wanted = Math.min(limit ?? SESSION_SCAN_LIMIT, SESSION_SCAN_LIMIT);
|
||||
const sessions: SessionInfo[] = [];
|
||||
let cursor: string | undefined;
|
||||
do {
|
||||
const page = await this.call(this.connection.listSessions({ cwd, cursor }));
|
||||
sessions.push(...page.sessions);
|
||||
cursor = page.nextCursor ?? undefined;
|
||||
} while (cursor && sessions.length < wanted);
|
||||
return sessions.slice(0, wanted);
|
||||
}
|
||||
|
||||
async drainNotifications(): Promise<void> {
|
||||
@@ -1072,17 +1083,41 @@ class AcpRuntime {
|
||||
const requested: AcpConfigChange[] = [];
|
||||
if (config.model) requested.push({ target: "model", value: config.model });
|
||||
const autoAcceptMode = this.options.options.acpOptions?.autoAcceptMode;
|
||||
const mode = config.mode ?? (autoAcceptMode?.default ? autoAcceptMode.mode.id : undefined);
|
||||
const { settings, legacyAutoAccept } = this.withoutLegacyAutoAccept(config.settings);
|
||||
// The toggle stays saved after a mode is chosen here, so it counts only while the saved mode
|
||||
// is one the generic adapter wrote.
|
||||
const mode =
|
||||
legacyAutoAccept && autoAcceptMode && !this.offersMode(config.mode)
|
||||
? autoAcceptMode.mode.id
|
||||
: (config.mode ?? (autoAcceptMode?.default ? autoAcceptMode.mode.id : undefined));
|
||||
if (mode) requested.push({ target: "mode", value: mode });
|
||||
if (config.thinkingOption) {
|
||||
requested.push({ target: "thinking", value: config.thinkingOption });
|
||||
}
|
||||
for (const [id, value] of Object.entries(config.settings)) {
|
||||
for (const [id, value] of Object.entries(settings)) {
|
||||
requested.push({ target: "setting", id, value });
|
||||
}
|
||||
for (const change of this.inAgentOrder(requested)) await this.applyConfigChange(change);
|
||||
}
|
||||
|
||||
private offersMode(mode: string | undefined): boolean {
|
||||
if (mode === undefined) return false;
|
||||
if (mode === this.options.options.acpOptions?.autoAcceptMode?.mode.id) return true;
|
||||
return toProviderCatalog(this.modes, this.configOptions).modes.some(({ id }) => id === mode);
|
||||
}
|
||||
|
||||
/** Reads the generic ACP adapter's saved Auto Accept toggle unless the agent has such a setting. */
|
||||
private withoutLegacyAutoAccept(settings: Readonly<Record<string, JsonValue>>): {
|
||||
settings: Readonly<Record<string, JsonValue>>;
|
||||
legacyAutoAccept: boolean;
|
||||
} {
|
||||
if (this.configOptions.some((option) => option.id === LEGACY_AUTO_ACCEPT_SETTING)) {
|
||||
return { settings, legacyAutoAccept: false };
|
||||
}
|
||||
const { [LEGACY_AUTO_ACCEPT_SETTING]: saved, ...rest } = settings;
|
||||
return { settings: rest, legacyAutoAccept: saved === true };
|
||||
}
|
||||
|
||||
// One option can reset another: choosing an fx provider also selects that provider's saved
|
||||
// model, so a model applied first would be lost. Agents list the option that decides first.
|
||||
private inAgentOrder(changes: readonly AcpConfigChange[]): AcpConfigChange[] {
|
||||
@@ -1282,6 +1317,7 @@ class AcpRuntime {
|
||||
}
|
||||
}
|
||||
const permissionId = `permission:${request.toolCall.toolCallId}`;
|
||||
const { presentation } = this.presentToolCall(request.toolCall);
|
||||
return new Promise((resolve) => {
|
||||
this.permissions.set(permissionId, { request, resolve, turnId: this.activePrompt?.turnId });
|
||||
if (this.activePrompt?.deferred) this.scheduleDeferredSettle();
|
||||
@@ -1294,6 +1330,7 @@ class AcpRuntime {
|
||||
kind: "tool",
|
||||
title: request.toolCall.title ?? undefined,
|
||||
input: jsonRecord(request.toolCall.rawInput),
|
||||
detail: toolCallDetail(presentation),
|
||||
actions: request.options.map((option) => ({
|
||||
id: option.optionId,
|
||||
label: option.name,
|
||||
@@ -1562,6 +1599,21 @@ class AcpRuntime {
|
||||
this.pendingCompactions.clear();
|
||||
}
|
||||
|
||||
/** Merges an update into the call's earlier updates and runs it through the transformers. */
|
||||
private presentToolCall(update: ToolCall | ToolCallUpdate): AcpToolCallState {
|
||||
const tool = this.toolCalls.get(update.toolCallId);
|
||||
const source = mergeToolCallSnapshot(update, tool?.source);
|
||||
const context = {
|
||||
sessionId: this.options.boundarySessionId,
|
||||
mcpServerNames: this.mcpServerNames,
|
||||
previous: tool?.presentation,
|
||||
};
|
||||
let presentation: AcpToolCallSnapshot = source;
|
||||
for (const transformer of this.transformers)
|
||||
presentation = transformer.toolCall?.(presentation, context) ?? presentation;
|
||||
return { source, presentation };
|
||||
}
|
||||
|
||||
private reduceToolCall(
|
||||
update: Extract<SessionUpdate, { sessionUpdate: "tool_call" | "tool_call_update" }>,
|
||||
wireSeq: number,
|
||||
@@ -1581,25 +1633,7 @@ class AcpRuntime {
|
||||
current !== undefined &&
|
||||
this.liveOpenToolIds.has(current.id) &&
|
||||
this.toolKeepsTurnOpen(current);
|
||||
const source = mergeToolCallSnapshot(update, tool?.source);
|
||||
let snapshot: AcpToolCallSnapshot = source;
|
||||
const context = {
|
||||
sessionId: this.options.boundarySessionId,
|
||||
mcpServerNames: this.mcpServerNames,
|
||||
};
|
||||
for (const transformer of this.transformers)
|
||||
snapshot = transformer.toolCall?.(snapshot, context) ?? snapshot;
|
||||
if (!snapshot.detail && source.diff && snapshot.kind === "edit") {
|
||||
snapshot = {
|
||||
...snapshot,
|
||||
detail: {
|
||||
type: "edit",
|
||||
filePath: source.diff.path,
|
||||
oldString: source.diff.oldText ?? undefined,
|
||||
newString: source.diff.newText,
|
||||
},
|
||||
};
|
||||
}
|
||||
const { source, presentation: snapshot } = this.presentToolCall(update);
|
||||
this.toolCalls.set(snapshot.id, { source, presentation: snapshot });
|
||||
const isOpen = snapshot.status === "pending" || snapshot.status === "in_progress";
|
||||
if (this.replayWindow === null) {
|
||||
@@ -2179,8 +2213,8 @@ function ownConnectorStream(source: Stream): {
|
||||
|
||||
function mergeToolCallSnapshot(
|
||||
update: ToolCall | ToolCallUpdate,
|
||||
current: AcpToolCallSource | undefined,
|
||||
): AcpToolCallSource {
|
||||
current: AcpToolCallSnapshot | undefined,
|
||||
): AcpToolCallSnapshot {
|
||||
return {
|
||||
id: update.toolCallId,
|
||||
name: firstText(update.name, current?.name),
|
||||
@@ -2190,10 +2224,7 @@ function mergeToolCallSnapshot(
|
||||
input: jsonValue(firstDefined(update.rawInput, current?.input, null)),
|
||||
output: jsonValue(firstDefined(update.rawOutput, current?.output, null)),
|
||||
locations: update.locations?.map((location) => location.path) ?? current?.locations ?? [],
|
||||
diff:
|
||||
update.content === undefined
|
||||
? current?.diff
|
||||
: update.content?.find((item) => item.type === "diff"),
|
||||
content: update.content === undefined ? current?.content : jsonValue(update.content),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2367,21 +2398,12 @@ function configValues(
|
||||
|
||||
type ToolCallTimelineItem = Extract<ProviderTimelineItem, { type: "tool_call" }>;
|
||||
|
||||
function toolCallDetail(snapshot: AcpToolCallSnapshot): ProviderToolCallDetail {
|
||||
return snapshot.detail ?? standardToolCallDetail(snapshot);
|
||||
}
|
||||
|
||||
function toolTimelineItem(snapshot: AcpToolCallSnapshot): ToolCallTimelineItem {
|
||||
const input = jsonRecord(snapshot.input);
|
||||
const isEdit = snapshot.kind === "edit" || snapshot.name?.toLowerCase().includes("edit") === true;
|
||||
const detail =
|
||||
snapshot.detail ??
|
||||
(isEdit
|
||||
? {
|
||||
type: "edit" as const,
|
||||
filePath:
|
||||
typeof input.filePath === "string" ? input.filePath : (snapshot.locations[0] ?? ""),
|
||||
oldString: typeof input.oldString === "string" ? input.oldString : undefined,
|
||||
newString: typeof input.newString === "string" ? input.newString : undefined,
|
||||
unifiedDiff: typeof input.unifiedDiff === "string" ? input.unifiedDiff : undefined,
|
||||
}
|
||||
: { type: "unknown" as const, input: snapshot.input, output: snapshot.output });
|
||||
const detail = toolCallDetail(snapshot);
|
||||
const status =
|
||||
snapshot.status === "in_progress" || snapshot.status === "pending"
|
||||
? "running"
|
||||
@@ -2416,6 +2438,7 @@ function jsonValue(value: unknown) {
|
||||
}
|
||||
|
||||
function jsonRecord(value: unknown): Record<string, ReturnType<typeof jsonValue>> {
|
||||
if (value === undefined) return {};
|
||||
const parsed = jsonValue(value);
|
||||
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return {};
|
||||
return parsed;
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
import type { JsonValue } from "@getpaseo/protocol/agent-types";
|
||||
import type { AcpToolCallSnapshot } from "../acp.js";
|
||||
import type { ProviderToolCallDetail } from "../provider.js";
|
||||
|
||||
type JsonRecord = Readonly<Record<string, JsonValue>>;
|
||||
|
||||
interface ToolCallParts {
|
||||
call: AcpToolCallSnapshot;
|
||||
input: JsonRecord;
|
||||
output: JsonRecord;
|
||||
text: string | undefined;
|
||||
}
|
||||
|
||||
type KindDetail = (parts: ToolCallParts) => ProviderToolCallDetail;
|
||||
|
||||
const KIND_DETAILS = new Map<string, KindDetail>(
|
||||
Object.entries({
|
||||
read: ({ call, input, output, text }) => ({
|
||||
type: "read",
|
||||
filePath: call.locations[0] ?? string(input, "path", "filePath", "file") ?? call.title,
|
||||
content: text ?? string(output, "content", "text"),
|
||||
offset: number(input, "offset", "line"),
|
||||
limit: number(input, "limit"),
|
||||
}),
|
||||
edit: editDetail,
|
||||
delete: editDetail,
|
||||
search: ({ call, input, output, text }) => ({
|
||||
type: "search",
|
||||
query: string(input, "query", "pattern") ?? call.title,
|
||||
toolName: "search",
|
||||
content: text ?? string(output, "content", "text"),
|
||||
filePaths: call.locations.length > 0 ? [...call.locations] : undefined,
|
||||
}),
|
||||
execute: ({ call, input, output, text }) => ({
|
||||
type: "shell",
|
||||
command: shellCommand(input) ?? call.title,
|
||||
cwd: string(input, "cwd"),
|
||||
output: text ?? string(output, "output", "text"),
|
||||
exitCode: number(output, "exitCode"),
|
||||
}),
|
||||
fetch: ({ call, input, output, text }) => ({
|
||||
type: "fetch",
|
||||
url: string(input, "url") ?? call.title,
|
||||
prompt: string(input, "prompt"),
|
||||
result: text ?? string(output, "result", "text", "content"),
|
||||
code: number(output, "status", "code"),
|
||||
}),
|
||||
think: ({ call, text }) => ({ type: "plain_text", label: call.title, icon: "brain", text }),
|
||||
switch_mode: ({ call, text }) => ({
|
||||
type: "plain_text",
|
||||
label: call.title,
|
||||
icon: "sparkles",
|
||||
text,
|
||||
}),
|
||||
} satisfies Record<string, KindDetail>),
|
||||
);
|
||||
|
||||
/**
|
||||
* The row for a tool call whose transformers set no detail, read from the call's ACP `kind`,
|
||||
* `rawInput`, `rawOutput`, `content` and `locations` the way the ACP spec defines them.
|
||||
*/
|
||||
export function standardToolCallDetail(call: AcpToolCallSnapshot): ProviderToolCallDetail {
|
||||
const parts: ToolCallParts = {
|
||||
call,
|
||||
input: record(call.input),
|
||||
output: record(call.output),
|
||||
text: contentText(call.content),
|
||||
};
|
||||
const kindDetail = call.kind === undefined ? undefined : KIND_DETAILS.get(call.kind);
|
||||
if (kindDetail) return kindDetail(parts);
|
||||
if (call.name?.toLowerCase().includes("edit")) return editDetail(parts);
|
||||
// Raw input or output is the most a client can show for a tool it does not know.
|
||||
if (parts.text !== undefined && call.input === null && call.output === null) {
|
||||
return { type: "plain_text", label: call.title, icon: "wrench", text: parts.text };
|
||||
}
|
||||
return { type: "unknown", input: call.input, output: call.output };
|
||||
}
|
||||
|
||||
function editDetail({ call, input, text }: ToolCallParts): ProviderToolCallDetail {
|
||||
const diff = contentDiff(call.content);
|
||||
const filePath =
|
||||
diff?.path ?? string(input, "filePath", "path", "file") ?? call.locations[0] ?? "";
|
||||
if (call.kind === "delete") {
|
||||
return {
|
||||
type: "edit",
|
||||
filePath,
|
||||
oldString: diff?.oldText ?? fileText(input, "oldText"),
|
||||
newString: "",
|
||||
unifiedDiff: text,
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: "edit",
|
||||
filePath,
|
||||
oldString: diff?.oldText ?? fileText(input, "oldString", "oldText"),
|
||||
newString: diff?.newText ?? fileText(input, "newString", "newText"),
|
||||
unifiedDiff: string(input, "unifiedDiff") ?? text,
|
||||
};
|
||||
}
|
||||
|
||||
function shellCommand(input: JsonRecord): string | undefined {
|
||||
const command = string(input, "command");
|
||||
if (!command) return undefined;
|
||||
const args = Array.isArray(input.args)
|
||||
? input.args.filter((arg): arg is string => typeof arg === "string")
|
||||
: [];
|
||||
return args.length > 0 ? `${command} ${args.join(" ")}` : command;
|
||||
}
|
||||
|
||||
function contentText(content: JsonValue | undefined): string | undefined {
|
||||
const parts = contentBlocks(content).flatMap((block) => {
|
||||
if (block.type !== "content") return [];
|
||||
const body = record(block.content ?? null);
|
||||
return body.type === "text" && typeof body.text === "string" && body.text.length > 0
|
||||
? [body.text]
|
||||
: [];
|
||||
});
|
||||
return parts.length > 0 ? parts.join("\n") : undefined;
|
||||
}
|
||||
|
||||
function contentDiff(
|
||||
content: JsonValue | undefined,
|
||||
): { path?: string; oldText?: string; newText?: string } | undefined {
|
||||
const diff = contentBlocks(content).find((block) => block.type === "diff");
|
||||
if (!diff) return undefined;
|
||||
return {
|
||||
path: string(diff, "path"),
|
||||
oldText: typeof diff.oldText === "string" ? diff.oldText : undefined,
|
||||
newText: typeof diff.newText === "string" ? diff.newText : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
function contentBlocks(content: JsonValue | undefined): JsonRecord[] {
|
||||
return Array.isArray(content) ? content.map((block) => record(block)) : [];
|
||||
}
|
||||
|
||||
function record(value: JsonValue): JsonRecord {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
||||
}
|
||||
|
||||
function string(value: JsonRecord, ...keys: string[]): string | undefined {
|
||||
for (const key of keys) {
|
||||
const entry = value[key];
|
||||
if (typeof entry === "string" && entry.trim().length > 0) return entry;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** File text is kept as written: whitespace or an empty string is the edit itself. */
|
||||
function fileText(value: JsonRecord, ...keys: string[]): string | undefined {
|
||||
for (const key of keys) {
|
||||
const entry = value[key];
|
||||
if (typeof entry === "string") return entry;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function number(value: JsonRecord, ...keys: string[]): number | undefined {
|
||||
for (const key of keys) {
|
||||
const entry = value[key];
|
||||
if (typeof entry === "number" && Number.isFinite(entry)) return entry;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
} from "@agentclientprotocol/sdk";
|
||||
import type { ProviderConnection, ProviderEvent, ProviderInput } from "./provider.js";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import type { JsonValue } from "@getpaseo/protocol/agent-types";
|
||||
import { AgentTimelineItemPayloadSchema } from "@getpaseo/protocol/messages";
|
||||
import { runAcpProvider, type AcpStreamMessage } from "./acp.js";
|
||||
|
||||
@@ -6724,3 +6725,403 @@ describe("deferTurnOnRunningTools", () => {
|
||||
await connection.close();
|
||||
});
|
||||
});
|
||||
|
||||
describe("ACP tool call rows", () => {
|
||||
function jsonRecord(value: JsonValue | undefined): Readonly<Record<string, JsonValue>> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
||||
}
|
||||
|
||||
function text(value: string) {
|
||||
return [{ type: "content", content: { type: "text", text: value } }];
|
||||
}
|
||||
|
||||
async function toolRows(
|
||||
updates: unknown[],
|
||||
transformers?: Parameters<typeof runAcpProvider>[0]["transformers"],
|
||||
) {
|
||||
const harness = connectorHarness({ promptUpdates: () => updates });
|
||||
const registration = runAcpProvider({
|
||||
id: "tool-rows-acp",
|
||||
label: "Tool rows ACP",
|
||||
connector: harness.connector,
|
||||
transformers,
|
||||
});
|
||||
const connection = await registration.connect({
|
||||
versions: [1],
|
||||
capabilities: ["prompt.message"],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
await connection.send(openInput());
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
await connection.send({
|
||||
type: "session.prompt",
|
||||
sessionId: "session-1",
|
||||
prompt: {
|
||||
clientMessageId: "first",
|
||||
delivery: "auto",
|
||||
input: { type: "message", content: [{ type: "text", text: "Use a tool" }] },
|
||||
},
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) => event.type === "session.turn" && event.state === "completed",
|
||||
);
|
||||
const rows = events.flatMap((event) =>
|
||||
event.type === "timeline.item" && event.item.type === "tool_call" ? [event.item] : [],
|
||||
);
|
||||
for (const row of rows) {
|
||||
expect(AgentTimelineItemPayloadSchema.safeParse(row).success).toBe(true);
|
||||
}
|
||||
return rows;
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
it.each([
|
||||
{
|
||||
kind: "execute",
|
||||
start: { title: "Run tests", rawInput: { command: "npm", args: ["test"], cwd: "/repo" } },
|
||||
end: { content: text("passed"), rawOutput: { exitCode: 0 } },
|
||||
detail: { type: "shell", command: "npm test", cwd: "/repo", output: "passed", exitCode: 0 },
|
||||
},
|
||||
{
|
||||
kind: "execute",
|
||||
start: { title: "Run tests" },
|
||||
end: { content: text("passed") },
|
||||
detail: { type: "shell", command: "Run tests", output: "passed" },
|
||||
},
|
||||
{
|
||||
kind: "read",
|
||||
start: { title: "Read a.ts", locations: [{ path: "/repo/a.ts" }], rawInput: { offset: 3 } },
|
||||
end: { content: text("const a = 1;") },
|
||||
detail: { type: "read", filePath: "/repo/a.ts", content: "const a = 1;", offset: 3 },
|
||||
},
|
||||
{
|
||||
kind: "search",
|
||||
start: { title: "Search TODO", rawInput: { pattern: "TODO" } },
|
||||
end: { content: text("a.ts:1"), locations: [{ path: "/repo/a.ts" }] },
|
||||
detail: {
|
||||
type: "search",
|
||||
query: "TODO",
|
||||
toolName: "search",
|
||||
content: "a.ts:1",
|
||||
filePaths: ["/repo/a.ts"],
|
||||
},
|
||||
},
|
||||
{
|
||||
kind: "fetch",
|
||||
start: { title: "Fetch example", rawInput: { url: "https://example.com" } },
|
||||
end: { content: text("Example Domain") },
|
||||
detail: { type: "fetch", url: "https://example.com", result: "Example Domain" },
|
||||
},
|
||||
{
|
||||
kind: "edit",
|
||||
start: {
|
||||
title: "Edit a.ts",
|
||||
content: [{ type: "diff", path: "/repo/a.ts", oldText: "a", newText: "b" }],
|
||||
},
|
||||
end: {},
|
||||
detail: { type: "edit", filePath: "/repo/a.ts", oldString: "a", newString: "b" },
|
||||
},
|
||||
{
|
||||
kind: "edit",
|
||||
start: { title: "Edit a.ts", locations: [{ path: "/repo/a.ts" }] },
|
||||
end: { content: text("Replaced 1 occurrence") },
|
||||
detail: { type: "edit", filePath: "/repo/a.ts", unifiedDiff: "Replaced 1 occurrence" },
|
||||
},
|
||||
{
|
||||
kind: "edit",
|
||||
start: {
|
||||
title: "Edit a.ts",
|
||||
rawInput: { filePath: "/repo/a.ts", oldString: "remove me", newString: " " },
|
||||
},
|
||||
end: {},
|
||||
detail: { type: "edit", filePath: "/repo/a.ts", oldString: "remove me", newString: " " },
|
||||
},
|
||||
{
|
||||
kind: "delete",
|
||||
start: { title: "Delete a.ts", locations: [{ path: "/repo/a.ts" }] },
|
||||
end: {},
|
||||
detail: { type: "edit", filePath: "/repo/a.ts", newString: "" },
|
||||
},
|
||||
{
|
||||
kind: "think",
|
||||
start: { title: "Plan" },
|
||||
end: { content: text("First read the tests") },
|
||||
detail: { type: "plain_text", label: "Plan", icon: "brain", text: "First read the tests" },
|
||||
},
|
||||
{
|
||||
kind: "other",
|
||||
start: { title: "Update todos" },
|
||||
end: { content: text("2 open") },
|
||||
detail: { type: "plain_text", label: "Update todos", icon: "wrench", text: "2 open" },
|
||||
},
|
||||
{
|
||||
kind: "other",
|
||||
start: { title: "Custom tool", rawInput: { value: 1 } },
|
||||
end: { content: text("done"), rawOutput: { ok: true } },
|
||||
detail: { type: "unknown", input: { value: 1 }, output: { ok: true } },
|
||||
},
|
||||
])("presents a completed $kind call as its standard row ($start.title)", async (example) => {
|
||||
const rows = await toolRows([
|
||||
{
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "tool-1",
|
||||
kind: example.kind,
|
||||
status: "in_progress",
|
||||
...example.start,
|
||||
},
|
||||
{
|
||||
sessionUpdate: "tool_call_update",
|
||||
toolCallId: "tool-1",
|
||||
status: "completed",
|
||||
...example.end,
|
||||
},
|
||||
]);
|
||||
expect(rows.at(-1)?.detail).toEqual(example.detail);
|
||||
});
|
||||
|
||||
it("gives transformers the call's content and the call as it was last presented", async () => {
|
||||
const commandFromStart: NonNullable<
|
||||
NonNullable<Parameters<typeof runAcpProvider>[0]["transformers"]>[number]["toolCall"]
|
||||
> = (call, { previous }) => {
|
||||
const first = Array.isArray(call.content) ? call.content[0] : undefined;
|
||||
const startText = jsonRecord(jsonRecord(first).content).text;
|
||||
if (typeof startText === "string" && startText.startsWith("$ ")) {
|
||||
return { ...call, input: { command: startText.slice(2) } };
|
||||
}
|
||||
const command = jsonRecord(previous?.input).command;
|
||||
return typeof command === "string" ? { ...call, input: { command } } : call;
|
||||
};
|
||||
const rows = await toolRows(
|
||||
[
|
||||
{
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "tool-1",
|
||||
title: "git status + 1 command",
|
||||
kind: "execute",
|
||||
status: "in_progress",
|
||||
content: text("$ git status && git diff"),
|
||||
},
|
||||
{
|
||||
sessionUpdate: "tool_call_update",
|
||||
toolCallId: "tool-1",
|
||||
status: "completed",
|
||||
content: text("clean"),
|
||||
},
|
||||
],
|
||||
[{ toolCall: commandFromStart }],
|
||||
);
|
||||
expect(rows.map((row) => row.detail)).toEqual([
|
||||
{ type: "shell", command: "git status && git diff", output: "$ git status && git diff" },
|
||||
{ type: "shell", command: "git status && git diff", output: "clean" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps a transformer's own detail over the standard row", async () => {
|
||||
const rows = await toolRows(
|
||||
[
|
||||
{
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "tool-1",
|
||||
title: "Run tests",
|
||||
kind: "execute",
|
||||
status: "completed",
|
||||
rawInput: { command: "npm test" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
toolCall: (call) => ({
|
||||
...call,
|
||||
detail: { type: "unknown", input: call.input, output: null },
|
||||
}),
|
||||
},
|
||||
],
|
||||
);
|
||||
expect(rows.at(-1)?.detail).toEqual({
|
||||
type: "unknown",
|
||||
input: { command: "npm test" },
|
||||
output: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("shows the call's row on its approval", async () => {
|
||||
const harness = connectorHarness({
|
||||
handleRequest(runtime, request) {
|
||||
if (request.method !== "session/prompt") return false;
|
||||
void runtime.request("session/request_permission", {
|
||||
sessionId: "connector-session",
|
||||
toolCall: {
|
||||
toolCallId: "edit-1",
|
||||
title: "Edit a.ts",
|
||||
kind: "edit",
|
||||
status: "pending",
|
||||
content: [{ type: "diff", path: "/repo/a.ts", oldText: "a", newText: "b" }],
|
||||
},
|
||||
options: [
|
||||
{ optionId: "allow", name: "Allow edit", kind: "allow_once" },
|
||||
{ optionId: "deny", name: "Deny", kind: "reject_once" },
|
||||
],
|
||||
});
|
||||
return true;
|
||||
},
|
||||
});
|
||||
const connection = await runAcpProvider({
|
||||
id: "approval-rows",
|
||||
label: "Approval rows",
|
||||
connector: harness.connector,
|
||||
}).connect({ versions: [1], capabilities: ["prompt.message", "permission"] });
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
await connection.send(openInput());
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
await connection.send({
|
||||
type: "session.prompt",
|
||||
sessionId: "session-1",
|
||||
prompt: {
|
||||
clientMessageId: "edit",
|
||||
delivery: "auto",
|
||||
input: { type: "message", content: [{ type: "text", text: "Edit a.ts" }] },
|
||||
},
|
||||
});
|
||||
expect(
|
||||
await waitForEvent(events, (event) => event.type === "session.permission"),
|
||||
).toMatchObject({
|
||||
request: {
|
||||
id: "permission:edit-1",
|
||||
title: "Edit a.ts",
|
||||
detail: { type: "edit", filePath: "/repo/a.ts", oldString: "a", newString: "b" },
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("lists sessions across every page the agent returns", async () => {
|
||||
const pages: Record<string, { sessions: unknown[]; nextCursor?: string }> = {
|
||||
first: {
|
||||
sessions: [{ sessionId: "s1", cwd: "/repo", title: "One" }],
|
||||
nextCursor: "second",
|
||||
},
|
||||
second: { sessions: [{ sessionId: "s2", cwd: "/repo", title: "Two" }] },
|
||||
};
|
||||
const harness = connectorHarness({
|
||||
capabilities: { sessionCapabilities: { list: {} } },
|
||||
handleRequest(runtime, request) {
|
||||
if (request.method !== "session/list") return false;
|
||||
const { cursor } = request.params as { cursor?: string };
|
||||
runtime.respond(request, pages[cursor ?? "first"]);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
const connection = await runAcpProvider({
|
||||
id: "paged-sessions",
|
||||
label: "Paged sessions",
|
||||
connector: harness.connector,
|
||||
}).connect({ versions: [1], capabilities: ["prompt.message", "session.list"] });
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
await connection.send({ type: "sessions", requestId: "list" });
|
||||
const listed = await waitForEvent(events, (event) => event.type === "sessions");
|
||||
expect(listed.type === "sessions" && listed.sessions.map((session) => session.title)).toEqual(
|
||||
["One", "Two"],
|
||||
);
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("resumes the generic ACP adapter's saved Auto Accept toggle in the unattended mode", async () => {
|
||||
const harness = connectorHarness({
|
||||
configOptions: [
|
||||
{
|
||||
id: "edit_approval_policy",
|
||||
name: "Edits",
|
||||
category: "mode",
|
||||
type: "select",
|
||||
currentValue: "ask",
|
||||
options: [
|
||||
{ value: "ask", name: "Default" },
|
||||
{ value: "session", name: "Don't Ask" },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
const connection = await runAcpProvider({
|
||||
id: "former-generic",
|
||||
label: "Former generic",
|
||||
connector: harness.connector,
|
||||
acpOptions: {
|
||||
autoAcceptMode: { mode: { id: "full-access", label: "Full access" }, nativeMode: "ask" },
|
||||
},
|
||||
}).connect({ versions: [1], capabilities: ["prompt.message", "session.configure"] });
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
const input = openInput();
|
||||
input.config.settings = { auto_accept: true };
|
||||
await connection.send(input);
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
const configs = events.flatMap((event) =>
|
||||
event.type === "session.config" ? [event.config.mode] : [],
|
||||
);
|
||||
expect(configs.at(-1)).toBe("full-access");
|
||||
const sentOptions = harness.instances
|
||||
.flatMap((instance) => instance.requests)
|
||||
.filter((request) => request.method === "session/set_config_option")
|
||||
.map((request) => (request.params as { configId: string }).configId);
|
||||
expect(sentOptions).not.toContain("auto_accept");
|
||||
expect(events.some((event) => event.type === "request.failed")).toBe(false);
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps a mode chosen after the generic ACP adapter's Auto Accept toggle was saved", async () => {
|
||||
const harness = connectorHarness({
|
||||
configOptions: [
|
||||
{
|
||||
id: "edit_approval_policy",
|
||||
name: "Edits",
|
||||
category: "mode",
|
||||
type: "select",
|
||||
currentValue: "session",
|
||||
options: [
|
||||
{ value: "ask", name: "Default" },
|
||||
{ value: "session", name: "Don't Ask" },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
const connection = await runAcpProvider({
|
||||
id: "former-generic",
|
||||
label: "Former generic",
|
||||
connector: harness.connector,
|
||||
acpOptions: {
|
||||
autoAcceptMode: { mode: { id: "full-access", label: "Full access" }, nativeMode: "ask" },
|
||||
},
|
||||
}).connect({ versions: [1], capabilities: ["prompt.message", "session.configure"] });
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
const input = openInput();
|
||||
input.config.mode = "ask";
|
||||
input.config.settings = { auto_accept: true };
|
||||
await connection.send(input);
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
const configs = events.flatMap((event) =>
|
||||
event.type === "session.config" ? [event.config.mode] : [],
|
||||
);
|
||||
expect(configs.at(-1)).toBe("ask");
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -117,9 +117,14 @@ export interface AcpToolCallSnapshot {
|
||||
title: string;
|
||||
kind?: string;
|
||||
status: "pending" | "in_progress" | "completed" | "failed";
|
||||
/** The call's ACP `rawInput`. */
|
||||
input: JsonValue;
|
||||
/** The call's ACP `rawOutput`. */
|
||||
output: JsonValue;
|
||||
/** The call's ACP `content` blocks. An update that sends `content` replaces them. */
|
||||
content?: JsonValue;
|
||||
locations: readonly string[];
|
||||
/** The row Paseo shows. Without it, Paseo builds the standard row for the call's ACP `kind`. */
|
||||
detail?: ProviderToolCallDetail;
|
||||
}
|
||||
|
||||
@@ -150,9 +155,14 @@ export interface AcpTransformer {
|
||||
notification: { method: string; params: JsonValue },
|
||||
context: AcpContext,
|
||||
): AcpVendorUpdate | readonly AcpVendorUpdate[] | null;
|
||||
/** Rewrites each update of a tool call, merged with the call's earlier updates. */
|
||||
toolCall?(
|
||||
toolCall: AcpToolCallSnapshot,
|
||||
context: AcpContext & { mcpServerNames?: readonly string[] },
|
||||
context: AcpContext & {
|
||||
mcpServerNames?: readonly string[];
|
||||
/** The call as Paseo last presented it, after every transformer. Absent on its first update. */
|
||||
previous?: AcpToolCallSnapshot;
|
||||
},
|
||||
): AcpToolCallSnapshot;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"description": "Paseo shared protocol schemas and wire types",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
|
||||
@@ -814,7 +814,7 @@ describe("checkout PR schemas", () => {
|
||||
});
|
||||
|
||||
test.each(
|
||||
["hopliteProvider", "fxProvider", "gooseProvider"].flatMap((name) =>
|
||||
["hopliteProvider", "fxProvider", "gooseProvider", "hermesProvider"].flatMap((name) =>
|
||||
[undefined, false, true].map((value) => [name, value] as const),
|
||||
),
|
||||
)("accepts optional bundled provider capability (%s: %s)", (name, value) => {
|
||||
|
||||
@@ -4168,6 +4168,8 @@ export const ServerInfoStatusPayloadSchema = z
|
||||
fxProvider: z.boolean().optional(),
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once host floor includes the bundled adapter.
|
||||
gooseProvider: z.boolean().optional(),
|
||||
// COMPAT(hermesProvider): added in v0.17.4, remove after 2027-05-23 once host floor includes the bundled adapter.
|
||||
hermesProvider: z.boolean().optional(),
|
||||
// COMPAT(importSessionWorkspaceTarget): added in v0.1.110, remove gate after 2027-01-16.
|
||||
importSessionWorkspaceTarget: z.boolean().optional(),
|
||||
// COMPAT(importSessionSearch): added in v0.8.0, remove gate after 2027-03-02.
|
||||
@@ -5816,6 +5818,17 @@ const CheckoutStatusCommonSchema = z.object({
|
||||
// upstream branch name is not necessarily currentBranch, so composing one is wrong.
|
||||
// aheadOfOrigin/behindOfOrigin are measured against exactly this ref.
|
||||
upstreamRef: z.string().nullable().optional(),
|
||||
// How currentBranch relates to its upstream: "tracked" (upstreamRef and the counts are set),
|
||||
// "none" (never pushed; Push does a first push), "gone" (the upstream's remote-tracking ref no
|
||||
// longer exists, as after the remote branch is deleted), or "unknown" (the daemon cannot tell,
|
||||
// as when the clone keeps no remote-tracking ref for the upstream). Absent from daemons that
|
||||
// predate it, which report all but "tracked" as a null upstreamRef.
|
||||
upstreamState: z.enum(["tracked", "none", "gone", "unknown"]).optional(),
|
||||
// The remote a first push publishes currentBranch to, when the daemon can confirm git would
|
||||
// push the branch there too. Null when there is no such remote, as when origin is missing or
|
||||
// git is set to push the branch to another remote (branch.<name>.pushRemote,
|
||||
// remote.pushDefault). Absent from daemons that predate it.
|
||||
firstPushRemote: z.string().nullable().optional(),
|
||||
forgeWeb: ForgeWebSchema.optional(),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-enriched-markdown",
|
||||
"version": "0.17.1",
|
||||
"version": "0.17.4",
|
||||
"private": true,
|
||||
"description": "Markdown-based Rich Text solution for React Native",
|
||||
"main": "./lib/module/index",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"description": "Paseo relay for bridging daemon and client connections",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"description": "Paseo backend server",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
@@ -109,11 +109,11 @@
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.326",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.17.3",
|
||||
"@getpaseo/highlight": "0.17.3",
|
||||
"@getpaseo/plugin": "0.17.3",
|
||||
"@getpaseo/protocol": "0.17.3",
|
||||
"@getpaseo/relay": "0.17.3",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/highlight": "0.17.4",
|
||||
"@getpaseo/plugin": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/relay": "0.17.4",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/node": "2.1.2",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
|
||||
@@ -237,6 +237,20 @@ second line'`,
|
||||
expect(result).toBe('[paseo__create_agent] {"cwd":"/tmp/repo","initialPrompt":"do the thing"}');
|
||||
});
|
||||
|
||||
it("summarizes a typed row by its detail when its name looks external", () => {
|
||||
const timeline: AgentTimelineItem[] = [
|
||||
toolCallItem({
|
||||
callId: "hermes-terminal",
|
||||
name: 'terminal: echo "whoami: $(whoami)" + 1 command',
|
||||
detail: { type: "shell", command: 'echo "whoami: $(whoami)" && uname -s' },
|
||||
}),
|
||||
];
|
||||
|
||||
const result = curateAgentActivity(timeline);
|
||||
|
||||
expect(result).toBe('[Shell] echo "whoami: $(whoami)" && uname -s');
|
||||
});
|
||||
|
||||
it("collapses repeated tool updates by callId", () => {
|
||||
const timeline: AgentTimelineItem[] = [
|
||||
toolCallItem({
|
||||
|
||||
@@ -84,7 +84,7 @@ function formatToolSummary(summary: string | undefined): string | null {
|
||||
function inputFromUnknownDetail(
|
||||
detail: Extract<AgentTimelineItem, { type: "tool_call" }>["detail"],
|
||||
): unknown {
|
||||
return detail.type === "unknown" ? detail.input : null;
|
||||
return detail.type === "unknown" ? detail.input : undefined;
|
||||
}
|
||||
|
||||
function projectForCuration(items: readonly AgentTimelineItem[]): AgentTimelineItem[] {
|
||||
|
||||
@@ -3168,15 +3168,8 @@ export class AgentManager {
|
||||
options?: AgentRunOptions,
|
||||
onAccepted?: () => void,
|
||||
): Promise<boolean> {
|
||||
if (this.collectingRuntimes.has(agentId) || !this.agents.has(agentId)) {
|
||||
await this.waitForAgentClose(agentId);
|
||||
await ensureAgentLoaded(agentId, {
|
||||
agentManager: this,
|
||||
agentStorage: this.requireRegistry(),
|
||||
logger: this.logger,
|
||||
});
|
||||
}
|
||||
const agent = await this.ensureInteractiveSession(agentId);
|
||||
const agent = await this.findOutOfBandRecipient(agentId);
|
||||
if (!agent) return false;
|
||||
// Providers parse slash commands from the raw text, so a command another agent sent
|
||||
// must reach them without its sender envelope.
|
||||
const agentMessage = typeof prompt === "string" ? parseAgentMessage(prompt) : null;
|
||||
@@ -3222,6 +3215,31 @@ export class AgentManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
private async findOutOfBandRecipient(agentId: string): Promise<ActiveManagedAgent | null> {
|
||||
const live = this.agents.get(agentId);
|
||||
const collecting = this.collectingRuntimes.has(agentId);
|
||||
if (live?.session && !collecting && !this.historySessions.has(live.session)) {
|
||||
return live;
|
||||
}
|
||||
if (collecting || !live) {
|
||||
await this.waitForAgentClose(agentId);
|
||||
const storage = this.requireRegistry();
|
||||
// Normal dispatch owns unarchiving. Decline without loading archived history.
|
||||
if ((await storage.get(agentId))?.archivedAt) return null;
|
||||
await ensureAgentLoaded(agentId, {
|
||||
agentManager: this,
|
||||
agentStorage: storage,
|
||||
logger: this.logger,
|
||||
});
|
||||
}
|
||||
return this.runLifecycleMutation(agentId, async () => {
|
||||
const record = await this.registry?.get(agentId);
|
||||
// Restore closes any history session. Normal dispatch can reopen the stored agent.
|
||||
if (record && (record.archivedAt || !this.agents.get(agentId)?.session)) return null;
|
||||
return this.upgradeHistorySessionUnlocked(this.requireSessionAgent(agentId));
|
||||
});
|
||||
}
|
||||
|
||||
async appendTimelineItem(
|
||||
agentId: string,
|
||||
item: AgentTimelineItem,
|
||||
@@ -3345,13 +3363,22 @@ export class AgentManager {
|
||||
/** Inside the agent's lane: a history session is upgraded before anything is applied to it. */
|
||||
private async ensureInteractiveSessionUnlocked(agentId: string): Promise<ActiveManagedAgent> {
|
||||
const agent = this.requireSessionAgent(agentId);
|
||||
if (this.historySessions.has(agent.session)) {
|
||||
const record = await this.registry?.get(agentId);
|
||||
if (record?.archivedAt) throw new Error(`Agent is archived: ${agentId}`);
|
||||
// Reload validates the directory before releasing readable history.
|
||||
await this.trackAgentRegistrationOperation(this.reloadAgentSessionInternal(agentId));
|
||||
if (
|
||||
this.historySessions.has(agent.session) &&
|
||||
(await this.registry?.get(agentId))?.archivedAt
|
||||
) {
|
||||
throw new Error(`Agent is archived: ${agentId}`);
|
||||
}
|
||||
return this.requireSessionAgent(agentId);
|
||||
return this.upgradeHistorySessionUnlocked(agent);
|
||||
}
|
||||
|
||||
private async upgradeHistorySessionUnlocked(
|
||||
agent: ActiveManagedAgent,
|
||||
): Promise<ActiveManagedAgent> {
|
||||
if (!this.historySessions.has(agent.session)) return agent;
|
||||
// Reload validates the directory before releasing readable history.
|
||||
await this.trackAgentRegistrationOperation(this.reloadAgentSessionInternal(agent.id));
|
||||
return this.requireSessionAgent(agent.id);
|
||||
}
|
||||
|
||||
/** Inside the agent's lane: transparently reopens a retired plugin session before applying config. */
|
||||
|
||||
@@ -25,6 +25,7 @@ import { z } from "zod";
|
||||
import { createTestLogger } from "../../test-utils/test-logger.js";
|
||||
import { createAgentMcpServer as createAgentMcpServerWithDependencies } from "./mcp-server.js";
|
||||
import { createMcpHandler } from "@modelcontextprotocol/server";
|
||||
import { ensureAgentLoaded } from "./agent-loading.js";
|
||||
import { AgentManager, type ManagedAgent } from "./agent-manager.js";
|
||||
import { AgentStorage, type StoredAgentRecord } from "./agent-storage.js";
|
||||
import { createTestAgentClients } from "../test-utils/fake-agent-client.js";
|
||||
@@ -3510,6 +3511,7 @@ class HeldTurnAgentSession implements AgentSession {
|
||||
private turnStartGate: Promise<void> | null = null;
|
||||
private cancelHeldStart: (() => void) | null = null;
|
||||
private interruptGate: Promise<void> | null = null;
|
||||
private closeGate?: { signalStart: () => void; waitForRelease: Promise<void> };
|
||||
private nextStartError: Error | null = null;
|
||||
|
||||
constructor(
|
||||
@@ -3701,7 +3703,19 @@ class HeldTurnAgentSession implements AgentSession {
|
||||
});
|
||||
}
|
||||
|
||||
async close(): Promise<void> {}
|
||||
holdClose(): { started: Promise<void>; release: () => void } {
|
||||
const started = Promise.withResolvers<void>();
|
||||
const released = Promise.withResolvers<void>();
|
||||
this.closeGate = { signalStart: started.resolve, waitForRelease: released.promise };
|
||||
return { started: started.promise, release: released.resolve };
|
||||
}
|
||||
|
||||
async close(): Promise<void> {
|
||||
if (this.closeGate) {
|
||||
this.closeGate.signalStart();
|
||||
await this.closeGate.waitForRelease;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class HeldTurnAgentClient implements AgentClient {
|
||||
@@ -3860,6 +3874,91 @@ describe("send_agent_prompt MCP tool", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
{ activeTurnBehavior: "interrupt", history: "closed" },
|
||||
{ activeTurnBehavior: "steer", history: "closed" },
|
||||
{ activeTurnBehavior: "queue", history: "closed" },
|
||||
{ activeTurnBehavior: "interrupt", history: "open" },
|
||||
{ activeTurnBehavior: "interrupt", history: "restoring" },
|
||||
] as const)(
|
||||
"an agent-scoped $activeTurnBehavior send starts a turn on an archived agent (history: $history)",
|
||||
async ({ activeTurnBehavior, history }) => {
|
||||
const workdir = await mkdtemp(join(tmpdir(), "mcp-send-archived-"));
|
||||
const storage = new AgentStorage(join(workdir, "agents"), logger);
|
||||
const client = new HeldTurnAgentClient("codex", true);
|
||||
const manager = new AgentManager({ clients: { codex: client }, registry: storage, logger });
|
||||
let mcpClient: Client | undefined;
|
||||
let restore: Promise<boolean> | undefined;
|
||||
let releaseHistoryClose: (() => void) | undefined;
|
||||
try {
|
||||
const sender = await manager.createAgent(
|
||||
{ provider: "codex", cwd: existingCwd },
|
||||
undefined,
|
||||
{ workspaceId: "wks_parent" },
|
||||
);
|
||||
const recipient = await manager.createAgent(
|
||||
{ provider: "codex", cwd: existingCwd },
|
||||
undefined,
|
||||
{ workspaceId: "wks_parent" },
|
||||
);
|
||||
await manager.archiveAgent(recipient.id);
|
||||
if (history !== "closed") {
|
||||
await ensureAgentLoaded(recipient.id, {
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
logger,
|
||||
});
|
||||
}
|
||||
const openedSessions = client.sessions.length;
|
||||
|
||||
const server = await createAgentMcpServer({
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
callerAgentId: sender.id,
|
||||
providerSnapshotManager: createOpenCodeManager().manager,
|
||||
logger,
|
||||
});
|
||||
mcpClient = await connectInMemoryMcpClient(server);
|
||||
if (history === "restoring") {
|
||||
const closing = client.sessions.at(-1)!.holdClose();
|
||||
releaseHistoryClose = closing.release;
|
||||
restore = manager.unarchiveSnapshot(recipient.id);
|
||||
await closing.started;
|
||||
}
|
||||
const response = await mcpClient.callTool({
|
||||
name: "send_agent_prompt",
|
||||
arguments: {
|
||||
agentId: recipient.id,
|
||||
prompt: "Start work",
|
||||
notifyOnFinish: false,
|
||||
activeTurnBehavior,
|
||||
},
|
||||
});
|
||||
expect(response.structuredContent).toMatchObject({
|
||||
success: true,
|
||||
deliveryStatus: "queued",
|
||||
activeTurnBehavior,
|
||||
});
|
||||
const dispatch = serverDeliveries
|
||||
.get(server)!
|
||||
.waitForDispatch(recipient.id, AbortSignal.timeout(5_000));
|
||||
releaseHistoryClose?.();
|
||||
await Promise.all([restore, dispatch]);
|
||||
expect((await storage.get(recipient.id))?.archivedAt).toBeNull();
|
||||
expect(manager.getAgent(recipient.id)?.lifecycle).toBe("running");
|
||||
expect(client.sessions).toHaveLength(openedSessions + 1);
|
||||
expect(client.sessions.at(-1)?.prompts.map(parseAgentMessage)).toEqual([
|
||||
expect.objectContaining({ text: "Start work" }),
|
||||
]);
|
||||
} finally {
|
||||
releaseHistoryClose?.();
|
||||
await restore?.catch(() => undefined);
|
||||
await mcpClient?.close();
|
||||
await removeAgentStateDir(manager, storage, workdir);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it("tells an agent caller that an idle recipient starts a turn with its queued message", async () => {
|
||||
const workdir = await mkdtemp(join(tmpdir(), "mcp-send-idle-"));
|
||||
const storage = new AgentStorage(join(workdir, "agents"), logger);
|
||||
|
||||
@@ -3063,31 +3063,34 @@ test("plugin provider import keeps the stats the plugin reported with its histor
|
||||
}
|
||||
});
|
||||
|
||||
test("resumes a goose session saved by the generic ACP provider", async () => {
|
||||
const logger = createTestLogger();
|
||||
const harness = createProviderHarness();
|
||||
const plugins = new PluginAgentClientRegistry(logger);
|
||||
plugins.replace([{ ...harness.registration, id: "goose" }]);
|
||||
const registry = buildProviderRegistry(logger, { pluginProviders: plugins.definitions() });
|
||||
const client = registry.goose.createClient(logger);
|
||||
test.each(["goose", "hermes"])(
|
||||
"resumes a %s session saved by the generic ACP provider",
|
||||
async (provider) => {
|
||||
const logger = createTestLogger();
|
||||
const harness = createProviderHarness();
|
||||
const plugins = new PluginAgentClientRegistry(logger);
|
||||
plugins.replace([{ ...harness.registration, id: provider }]);
|
||||
const registry = buildProviderRegistry(logger, { pluginProviders: plugins.definitions() });
|
||||
const client = registry[provider].createClient(logger);
|
||||
|
||||
try {
|
||||
const session = await client.resumeSession(
|
||||
{
|
||||
provider: "goose",
|
||||
sessionId: "native-goose-session",
|
||||
nativeHandle: "native-goose-session",
|
||||
},
|
||||
{ provider: "goose", cwd: "/tmp" },
|
||||
);
|
||||
expect(harness.inputs.findLast((input) => input.type === "session.open")).toMatchObject({
|
||||
persistence: { version: 1, data: { sessionId: "native-goose-session" } },
|
||||
});
|
||||
await session.close();
|
||||
} finally {
|
||||
await plugins.shutdown();
|
||||
}
|
||||
});
|
||||
try {
|
||||
const session = await client.resumeSession(
|
||||
{
|
||||
provider,
|
||||
sessionId: "native-session",
|
||||
nativeHandle: "native-session",
|
||||
},
|
||||
{ provider, cwd: "/tmp" },
|
||||
);
|
||||
expect(harness.inputs.findLast((input) => input.type === "session.open")).toMatchObject({
|
||||
persistence: { version: 1, data: { sessionId: "native-session" } },
|
||||
});
|
||||
await session.close();
|
||||
} finally {
|
||||
await plugins.shutdown();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
test("preserves a deferred ACP background job on steer and cancels it on explicit Stop through AgentManager", async () => {
|
||||
const logger = createTestLogger();
|
||||
|
||||
@@ -2245,13 +2245,20 @@ function encodePersistence(persistence: ProviderPersistence): string {
|
||||
return `plugin:${JSON.stringify(persistence)}`;
|
||||
}
|
||||
|
||||
// Providers whose agents were saved by the generic ACP provider before they became plugins.
|
||||
const FORMER_ACP_PROVIDERS = new Set<string>([
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once legacy handles have migrated.
|
||||
"goose",
|
||||
// COMPAT(hermesProvider): added in v0.17.4, remove after 2027-05-23 once legacy handles have migrated.
|
||||
"hermes",
|
||||
]);
|
||||
|
||||
function decodePersistence(handle: AgentPersistenceHandle): ProviderPersistence {
|
||||
const fromMetadata = handle.metadata?.pluginProviderPersistence;
|
||||
if (fromMetadata !== undefined) {
|
||||
return ProviderPersistenceSchema.parse(fromMetadata);
|
||||
}
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once legacy handles have migrated.
|
||||
if (handle.provider === "goose" && !handle.sessionId.startsWith("plugin:")) {
|
||||
if (FORMER_ACP_PROVIDERS.has(handle.provider) && !handle.sessionId.startsWith("plugin:")) {
|
||||
return { version: 1, data: { sessionId: handle.sessionId } };
|
||||
}
|
||||
return decodePersistenceId(handle.sessionId);
|
||||
|
||||
@@ -67,7 +67,9 @@ export function buildCheckoutStatusPayloadFromSnapshot({
|
||||
upstreamRef: snapshot.git.upstreamRef ?? null,
|
||||
aheadOfOrigin: snapshot.git.aheadOfOrigin ?? null,
|
||||
behindOfOrigin: snapshot.git.behindOfOrigin ?? null,
|
||||
upstreamState: snapshot.git.upstreamState,
|
||||
hasRemote: snapshot.git.hasRemote,
|
||||
firstPushRemote: snapshot.git.firstPushRemote,
|
||||
remoteUrl: snapshot.git.remoteUrl,
|
||||
...(snapshot.forgeWeb ? { forgeWeb: snapshot.forgeWeb } : {}),
|
||||
isPaseoOwnedWorktree: true,
|
||||
@@ -90,7 +92,9 @@ export function buildCheckoutStatusPayloadFromSnapshot({
|
||||
upstreamRef: snapshot.git.upstreamRef ?? null,
|
||||
aheadOfOrigin: snapshot.git.aheadOfOrigin ?? null,
|
||||
behindOfOrigin: snapshot.git.behindOfOrigin ?? null,
|
||||
upstreamState: snapshot.git.upstreamState,
|
||||
hasRemote: snapshot.git.hasRemote,
|
||||
firstPushRemote: snapshot.git.firstPushRemote,
|
||||
remoteUrl: snapshot.git.remoteUrl,
|
||||
...(snapshot.forgeWeb ? { forgeWeb: snapshot.forgeWeb } : {}),
|
||||
isPaseoOwnedWorktree: false,
|
||||
|
||||
@@ -314,6 +314,8 @@ test("streams whole-file batches and answers a same-socket ping before the revis
|
||||
).join("\n") + "\n";
|
||||
writeFileSync(join(cwd, `${file}.ts`), content);
|
||||
}
|
||||
// Stage the fixture so Git reads the added files in bulk. They are still new relative to HEAD.
|
||||
git(cwd, "add", ".");
|
||||
expect(ctx.client.getLastServerInfoMessage()).toMatchObject({
|
||||
features: { diffSubscription: true },
|
||||
});
|
||||
|
||||
@@ -1091,29 +1091,28 @@ describe("speech provider config normalization", () => {
|
||||
});
|
||||
|
||||
test.each([
|
||||
["goose", "acp"],
|
||||
["/opt/bin/goose", "acp"],
|
||||
])(
|
||||
"migrates the legacy goose entry and preserves command overrides (%s %s)",
|
||||
(binary, subcommand) => {
|
||||
const command = [binary, subcommand];
|
||||
const overrides = {
|
||||
enabled: false,
|
||||
label: "My goose",
|
||||
env: { GOOSE_PROVIDER: "openai" },
|
||||
models: [{ id: "primary", label: "Primary" }],
|
||||
additionalModels: [{ id: "secondary", label: "Secondary" }],
|
||||
};
|
||||
const parsed = PersistedConfigSchema.parse({
|
||||
agents: {
|
||||
providers: {
|
||||
goose: { ...overrides, extends: "acp", description: "Old description", command },
|
||||
},
|
||||
["goose", "goose"],
|
||||
["goose", "/opt/bin/goose"],
|
||||
["hermes", "hermes"],
|
||||
["hermes", "/opt/bin/hermes"],
|
||||
])("migrates the legacy %s entry and preserves command overrides (%s acp)", (provider, binary) => {
|
||||
const command = [binary, "acp"];
|
||||
const overrides = {
|
||||
enabled: false,
|
||||
label: `My ${provider}`,
|
||||
env: { PROVIDER_ENV: "value" },
|
||||
models: [{ id: "primary", label: "Primary" }],
|
||||
additionalModels: [{ id: "secondary", label: "Secondary" }],
|
||||
};
|
||||
const parsed = PersistedConfigSchema.parse({
|
||||
agents: {
|
||||
providers: {
|
||||
[provider]: { ...overrides, extends: "acp", description: "Old description", command },
|
||||
},
|
||||
});
|
||||
expect(parsed.agents?.providers?.goose).toEqual({
|
||||
...overrides,
|
||||
...(command[0] === "goose" ? {} : { command }),
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
});
|
||||
expect(parsed.agents?.providers?.[provider]).toEqual({
|
||||
...overrides,
|
||||
...(binary === provider ? {} : { command }),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -198,25 +198,30 @@ function isLegacyProviderEntry(value: unknown): boolean {
|
||||
return typeof (command as Record<string, unknown>).mode === "string";
|
||||
}
|
||||
|
||||
// Catalog providers that moved from `extends: "acp"` to a bundled plugin with the same ID.
|
||||
const BUNDLED_FORMER_ACP_PROVIDERS = [
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once legacy configs have migrated.
|
||||
"goose",
|
||||
// COMPAT(hermesProvider): added in v0.17.4, remove after 2027-05-23 once legacy configs have migrated.
|
||||
"hermes",
|
||||
] as const;
|
||||
|
||||
function normalizeAgentProviders(value: unknown): unknown {
|
||||
if (!isConfigRecord(value)) return value;
|
||||
|
||||
let rawProviders = value;
|
||||
const goose = configRecord(value.goose);
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once legacy configs have migrated.
|
||||
if (goose?.extends === "acp") {
|
||||
const { extends: _base, description: _description, command, ...overrides } = goose;
|
||||
const rawProviders: Record<string, unknown> = { ...value };
|
||||
for (const providerId of BUNDLED_FORMER_ACP_PROVIDERS) {
|
||||
const entry = configRecord(rawProviders[providerId]);
|
||||
if (entry?.extends !== "acp") continue;
|
||||
const { extends: _base, description: _description, command, ...overrides } = entry;
|
||||
const usesDefaultCommand =
|
||||
Array.isArray(command) &&
|
||||
command.length === 2 &&
|
||||
command[0] === "goose" &&
|
||||
command[0] === providerId &&
|
||||
command[1] === "acp";
|
||||
rawProviders = {
|
||||
...value,
|
||||
goose: {
|
||||
...overrides,
|
||||
...(command !== undefined && !usesDefaultCommand ? { command } : {}),
|
||||
},
|
||||
rawProviders[providerId] = {
|
||||
...overrides,
|
||||
...(command !== undefined && !usesDefaultCommand ? { command } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ export const builtinPlugins = [
|
||||
"fx-provider",
|
||||
"goose-provider",
|
||||
"grok-usage-source",
|
||||
"hermes-provider",
|
||||
"hoplite-provider",
|
||||
"kimi-usage-source",
|
||||
"minimax-usage-source",
|
||||
|
||||
@@ -4075,7 +4075,11 @@ describe("session checkout pull and push handling", () => {
|
||||
requestId: "request-push",
|
||||
});
|
||||
|
||||
expect(checkoutGitMocks.pushCurrentBranch).toHaveBeenCalledWith("/tmp/request-worktree");
|
||||
expect(checkoutGitMocks.pushCurrentBranch).toHaveBeenCalledWith(
|
||||
"/tmp/request-worktree",
|
||||
undefined,
|
||||
{ paseoHome: "/tmp/paseo-home", worktreesRoot: undefined },
|
||||
);
|
||||
expect(workspaceGitService.getSnapshot).toHaveBeenCalledWith("/tmp/request-worktree", {
|
||||
force: true,
|
||||
reason: "push",
|
||||
|
||||
@@ -10049,6 +10049,8 @@ test("workspace PR status survives session cleanup and reconnect", async () => {
|
||||
comparisonBaseRef: null,
|
||||
branchRemoteName: "origin",
|
||||
branchMergeRef: "refs/heads/feature",
|
||||
upstreamStatus: { state: "none" },
|
||||
firstPushRemote: null,
|
||||
pullRequestLookupTarget: { headRef: "feature" },
|
||||
};
|
||||
const githubStub = {
|
||||
|
||||
@@ -956,7 +956,10 @@ export class CheckoutSession {
|
||||
const { cwd, requestId } = msg;
|
||||
|
||||
try {
|
||||
await pushCurrentBranch(cwd);
|
||||
await pushCurrentBranch(cwd, undefined, {
|
||||
paseoHome: this.paseoHome,
|
||||
worktreesRoot: this.worktreesRoot,
|
||||
});
|
||||
await this.gitMutation.notifyGitMutation(cwd, "push", { invalidateForge: true });
|
||||
this.host.emit({
|
||||
type: "checkout_push_response",
|
||||
|
||||
@@ -246,7 +246,9 @@ function createFallbackWorkspaceGitSnapshot(cwd: string): WorkspaceGitRuntimeSna
|
||||
upstreamRef: null,
|
||||
aheadOfOrigin: null,
|
||||
behindOfOrigin: null,
|
||||
upstreamState: "none",
|
||||
hasRemote: false,
|
||||
firstPushRemote: null,
|
||||
diffStat: null,
|
||||
},
|
||||
forge: {
|
||||
@@ -2242,6 +2244,8 @@ export class VoiceAssistantWebSocketServer {
|
||||
fxProvider: this.providerSnapshotManager.supportsConfigRequiredProvider("fx"),
|
||||
// COMPAT(gooseProvider): added in v0.17.0, remove after 2027-05-20 once host floor includes the bundled adapter.
|
||||
gooseProvider: this.providerSnapshotManager.supportsConfigRequiredProvider("goose"),
|
||||
// COMPAT(hermesProvider): added in v0.17.4, remove after 2027-05-23 once host floor includes the bundled adapter.
|
||||
hermesProvider: this.providerSnapshotManager.supportsConfigRequiredProvider("hermes"),
|
||||
// COMPAT(importSessionWorkspaceTarget): added in v0.1.110, remove gate after 2027-01-16.
|
||||
importSessionWorkspaceTarget: true,
|
||||
// COMPAT(importSessionSearch): added in v0.7.3, remove gate after 2027-03-02.
|
||||
|
||||
@@ -41,6 +41,8 @@ function createFacts(cwd: string): CheckoutSnapshotFacts {
|
||||
comparisonBaseRef: null,
|
||||
branchRemoteName: null,
|
||||
branchMergeRef: null,
|
||||
upstreamStatus: { state: "none" },
|
||||
firstPushRemote: null,
|
||||
pullRequestLookupTarget: { headRef: "main" },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ function createCheckoutFacts(cwd: string): CheckoutSnapshotFacts {
|
||||
comparisonBaseRef: null,
|
||||
branchRemoteName: null,
|
||||
branchMergeRef: null,
|
||||
upstreamStatus: { state: "none" },
|
||||
firstPushRemote: null,
|
||||
pullRequestLookupTarget: { headRef: "main" },
|
||||
};
|
||||
}
|
||||
@@ -1017,7 +1019,8 @@ describe("WorkspaceGitService checkout observation", () => {
|
||||
comparisonBaseRef: null,
|
||||
branchRemoteName: null,
|
||||
branchMergeRef: null,
|
||||
upstreamStatus: null,
|
||||
upstreamStatus: { state: "none" },
|
||||
firstPushRemote: null,
|
||||
};
|
||||
});
|
||||
const runGitFetch = vi.fn(async () => ({
|
||||
@@ -1160,7 +1163,8 @@ describe("WorkspaceGitService checkout observation", () => {
|
||||
comparisonBaseRef: "refs/heads/main",
|
||||
branchRemoteName: "origin",
|
||||
branchMergeRef: `refs/heads/${branch}`,
|
||||
upstreamStatus: null,
|
||||
upstreamStatus: { state: "none" },
|
||||
firstPushRemote: null,
|
||||
} satisfies CheckoutSnapshotFacts;
|
||||
});
|
||||
const getCheckoutStatus = vi.fn(async (cwd: string) =>
|
||||
|
||||
@@ -80,6 +80,8 @@ function createCheckoutFacts(
|
||||
comparisonBaseRef: null,
|
||||
branchRemoteName: null,
|
||||
branchMergeRef: null,
|
||||
upstreamStatus: { state: "none" },
|
||||
firstPushRemote: null,
|
||||
pullRequestLookupTarget: { headRef: "main" },
|
||||
...overrides,
|
||||
};
|
||||
|
||||
@@ -171,6 +171,8 @@ function createCheckoutSnapshotFacts(cwd: string): CheckoutSnapshotFacts {
|
||||
comparisonBaseRef: null,
|
||||
branchRemoteName: "origin",
|
||||
branchMergeRef: "refs/heads/main",
|
||||
upstreamStatus: { state: "none" },
|
||||
firstPushRemote: null,
|
||||
pullRequestLookupTarget: { headRef: "main" },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,13 +7,14 @@ import pLimit from "p-limit";
|
||||
import type pino from "pino";
|
||||
import type { ForgeWeb, ProjectCheckoutLitePayload } from "@getpaseo/protocol/messages";
|
||||
import { parseGitRemoteLocation } from "@getpaseo/protocol/git-remote";
|
||||
import type { CheckoutContext } from "../utils/checkout-git.js";
|
||||
import type { CheckoutContext, UpstreamState } from "../utils/checkout-git.js";
|
||||
import {
|
||||
type BranchCheckoutResolution,
|
||||
type BranchSuggestion,
|
||||
type CheckoutSnapshotFacts,
|
||||
type CheckoutDiffCompare,
|
||||
type CheckoutDiffResult,
|
||||
configuredUpstreamRef,
|
||||
getCheckoutDiff,
|
||||
getCheckoutRefDerivedState,
|
||||
getCheckoutSnapshotFacts,
|
||||
@@ -22,6 +23,7 @@ import {
|
||||
getCheckoutWorktreeState,
|
||||
getPullRequestStatus,
|
||||
forgeAuthStateFromError,
|
||||
projectUpstreamStatus,
|
||||
hasOriginRemote,
|
||||
listBranchSuggestions,
|
||||
resolveRepositoryDefaultBranch,
|
||||
@@ -181,7 +183,9 @@ export interface WorkspaceGitRuntimeSnapshot {
|
||||
upstreamRef: string | null;
|
||||
aheadOfOrigin: number | null;
|
||||
behindOfOrigin: number | null;
|
||||
upstreamState: UpstreamState;
|
||||
hasRemote: boolean;
|
||||
firstPushRemote: string | null;
|
||||
diffStat: { additions: number; deletions: number } | null;
|
||||
};
|
||||
forge: {
|
||||
@@ -2882,7 +2886,7 @@ export class WorkspaceGitServiceImpl implements WorkspaceGitService {
|
||||
facts.storedBaseRef,
|
||||
facts.resolvedBaseRef,
|
||||
facts.comparisonBaseRef,
|
||||
facts.upstreamStatus?.ref,
|
||||
configuredUpstreamRef(facts.upstreamStatus),
|
||||
];
|
||||
const usesBranch = dependentRefs.some(
|
||||
(ref) => ref === branch || ref === `refs/heads/${branch}`,
|
||||
@@ -2919,7 +2923,7 @@ export class WorkspaceGitServiceImpl implements WorkspaceGitService {
|
||||
facts.storedBaseRef,
|
||||
facts.resolvedBaseRef,
|
||||
facts.comparisonBaseRef,
|
||||
facts.upstreamStatus?.ref,
|
||||
configuredUpstreamRef(facts.upstreamStatus),
|
||||
configuredRemoteRef,
|
||||
shortstatRemoteRef,
|
||||
];
|
||||
@@ -3684,9 +3688,7 @@ export class WorkspaceGitServiceImpl implements WorkspaceGitService {
|
||||
...latestGit,
|
||||
aheadBehind: derived.aheadBehind,
|
||||
diffStat: derived.diffStat,
|
||||
upstreamRef: derived.upstreamStatus?.ref ?? null,
|
||||
aheadOfOrigin: derived.upstreamStatus?.aheadBehind.ahead ?? null,
|
||||
behindOfOrigin: derived.upstreamStatus?.aheadBehind.behind ?? null,
|
||||
...projectUpstreamStatus(derived.upstreamStatus),
|
||||
};
|
||||
const loadedAtMs = this.deps.now().getTime();
|
||||
target.latestGitLoadedAtMs = loadedAtMs;
|
||||
@@ -3781,7 +3783,9 @@ export class WorkspaceGitServiceImpl implements WorkspaceGitService {
|
||||
upstreamRef: checkoutStatus.upstreamRef,
|
||||
aheadOfOrigin: checkoutStatus.aheadOfOrigin,
|
||||
behindOfOrigin: checkoutStatus.behindOfOrigin,
|
||||
upstreamState: checkoutStatus.upstreamState,
|
||||
hasRemote: checkoutStatus.hasRemote,
|
||||
firstPushRemote: checkoutStatus.firstPushRemote,
|
||||
diffStat,
|
||||
};
|
||||
const loadedAtMs = this.deps.now().getTime();
|
||||
@@ -4436,7 +4440,9 @@ function buildNotGitSnapshot(cwd: string): WorkspaceGitRuntimeSnapshot {
|
||||
upstreamRef: null,
|
||||
aheadOfOrigin: null,
|
||||
behindOfOrigin: null,
|
||||
upstreamState: "none",
|
||||
hasRemote: false,
|
||||
firstPushRemote: null,
|
||||
diffStat: null,
|
||||
},
|
||||
forge: buildForgeUnavailableSnapshot(),
|
||||
|
||||
@@ -63,9 +63,11 @@ function seedFeatureCheckout(): {
|
||||
branchRemoteName: "origin",
|
||||
branchMergeRef: "refs/heads/main",
|
||||
upstreamStatus: {
|
||||
state: "tracked",
|
||||
ref: "refs/remotes/origin/main",
|
||||
aheadBehind: { ahead: 0, behind: 0 },
|
||||
},
|
||||
firstPushRemote: "origin",
|
||||
pullRequestLookupTarget: { headRef: "feature" },
|
||||
},
|
||||
};
|
||||
@@ -105,9 +107,11 @@ function seedMainCheckout(): {
|
||||
branchRemoteName: "origin",
|
||||
branchMergeRef: "refs/heads/main",
|
||||
upstreamStatus: {
|
||||
state: "tracked",
|
||||
ref: "refs/remotes/origin/main",
|
||||
aheadBehind: { ahead: 1, behind: 0 },
|
||||
},
|
||||
firstPushRemote: "origin",
|
||||
pullRequestLookupTarget: { headRef: "main" },
|
||||
},
|
||||
};
|
||||
@@ -127,6 +131,7 @@ test("one comparison refresh updates a shared base and upstream ref", async () =
|
||||
|
||||
expect(result.aheadBehind).toEqual({ ahead: 1, behind: 0 });
|
||||
expect(result.upstreamStatus).toEqual({
|
||||
state: "tracked",
|
||||
ref: "refs/remotes/origin/main",
|
||||
aheadBehind: { ahead: 1, behind: 0 },
|
||||
});
|
||||
@@ -154,6 +159,7 @@ test("an upstream move refreshes the main checkout shortstat", async () => {
|
||||
aheadBehind: null,
|
||||
diffStat: null,
|
||||
upstreamStatus: {
|
||||
state: "tracked",
|
||||
ref: "refs/remotes/origin/main",
|
||||
aheadBehind: { ahead: 0, behind: 0 },
|
||||
},
|
||||
@@ -166,7 +172,7 @@ test("an origin move refreshes an untracked main checkout shortstat", async () =
|
||||
...seeded.facts,
|
||||
branchRemoteName: null,
|
||||
branchMergeRef: null,
|
||||
upstreamStatus: null,
|
||||
upstreamStatus: { state: "none" as const },
|
||||
};
|
||||
git(seeded.cwd, [
|
||||
"update-ref",
|
||||
@@ -181,5 +187,5 @@ test("an origin move refreshes an untracked main checkout shortstat", async () =
|
||||
{ aheadBehind: null, diffStat: { additions: 1, deletions: 0 } },
|
||||
new Set(["origin/main"]),
|
||||
),
|
||||
).toEqual({ aheadBehind: null, diffStat: null, upstreamStatus: null });
|
||||
).toEqual({ aheadBehind: null, diffStat: null, upstreamStatus: { state: "none" } });
|
||||
});
|
||||
|
||||
@@ -924,15 +924,23 @@ const x = 1;
|
||||
});
|
||||
|
||||
it("exposes hasRemote when origin is configured", async () => {
|
||||
const withoutRemote = await getCheckoutStatus(repoDir);
|
||||
expect(withoutRemote).toMatchObject({
|
||||
isGit: true,
|
||||
hasRemote: false,
|
||||
upstreamState: "none",
|
||||
});
|
||||
|
||||
const remoteDir = join(tempDir, "remote.git");
|
||||
execFileSync("git", ["init", "--bare", "-b", "main", remoteDir]);
|
||||
execFileSync("git", ["remote", "add", "origin", remoteDir], { cwd: repoDir });
|
||||
|
||||
const status = await getCheckoutStatus(repoDir);
|
||||
expect(status.isGit).toBe(true);
|
||||
if (status.isGit) {
|
||||
expect(status.hasRemote).toBe(true);
|
||||
}
|
||||
expect(status).toMatchObject({
|
||||
isGit: true,
|
||||
hasRemote: true,
|
||||
upstreamState: "none",
|
||||
});
|
||||
});
|
||||
|
||||
it("reports ahead/behind relative to origin on the base branch", async () => {
|
||||
@@ -1005,6 +1013,7 @@ const x = 1;
|
||||
return;
|
||||
}
|
||||
expect(status.upstreamRef).toBe("refs/remotes/upstream/main");
|
||||
expect(status.upstreamState).toBe("tracked");
|
||||
});
|
||||
|
||||
it("reports the upstream branch name when it differs from the local branch name", async () => {
|
||||
@@ -1034,6 +1043,191 @@ const x = 1;
|
||||
}
|
||||
expect(status.upstreamRef).toBe("refs/remotes/upstream/main");
|
||||
expect(status.aheadOfOrigin).toBe(0);
|
||||
expect(status.hasRemote).toBe(false);
|
||||
expect(status.upstreamState).toBe("tracked");
|
||||
});
|
||||
|
||||
it("reports origin as the first push remote for a never-pushed branch", async () => {
|
||||
setupRemoteTrackingMain(repoDir, tempDir);
|
||||
execFileSync("git", ["checkout", "-b", "feature"], { cwd: repoDir });
|
||||
commitFile(repoDir, "feature.txt", "feature\n", "feature commit");
|
||||
|
||||
const status = await getCheckoutStatus(repoDir);
|
||||
|
||||
expect(status).toMatchObject({ upstreamState: "none", firstPushRemote: "origin" });
|
||||
});
|
||||
|
||||
// The daemon's first push goes to origin. When git would send the branch to a fork instead,
|
||||
// the status must not present origin as the place to publish it, and Push must not send it.
|
||||
it.each([
|
||||
{ name: "the branch's pushRemote", key: "branch.feature.pushRemote" },
|
||||
{ name: "remote.pushDefault", key: "remote.pushDefault" },
|
||||
])("does not publish to origin when $name sends the branch to a fork", async ({ key }) => {
|
||||
const { remoteDir } = setupRemoteTrackingMain(repoDir, tempDir);
|
||||
const forkDir = join(tempDir, "fork.git");
|
||||
execFileSync("git", ["init", "--bare", "-b", "main", forkDir]);
|
||||
execFileSync("git", ["remote", "add", "fork", forkDir], { cwd: repoDir });
|
||||
execFileSync("git", ["checkout", "-b", "feature"], { cwd: repoDir });
|
||||
execFileSync("git", ["config", key, "fork"], { cwd: repoDir });
|
||||
commitFile(repoDir, "feature.txt", "feature\n", "feature commit");
|
||||
|
||||
const status = await getCheckoutStatus(repoDir);
|
||||
await expect(pushCurrentBranch(repoDir)).rejects.toThrow(
|
||||
"Git is set to push this branch to 'fork'",
|
||||
);
|
||||
|
||||
expect(status).toMatchObject({
|
||||
upstreamState: "none",
|
||||
hasRemote: true,
|
||||
firstPushRemote: null,
|
||||
});
|
||||
const originBranches = execFileSync("git", ["--git-dir", remoteDir, "branch", "--list"])
|
||||
.toString()
|
||||
.trim();
|
||||
expect(originBranches).toBe("* main");
|
||||
});
|
||||
|
||||
it("still publishes a branch that tracks a local branch to origin", async () => {
|
||||
const { remoteDir } = setupRemoteTrackingMain(repoDir, tempDir);
|
||||
execFileSync("git", ["checkout", "-b", "feature", "--track", "main"], { cwd: repoDir });
|
||||
commitFile(repoDir, "feature.txt", "feature\n", "feature commit");
|
||||
|
||||
await pushCurrentBranch(repoDir);
|
||||
|
||||
const localHead = execFileSync("git", ["rev-parse", "HEAD"], { cwd: repoDir })
|
||||
.toString()
|
||||
.trim();
|
||||
const remoteHead = execFileSync("git", [
|
||||
"--git-dir",
|
||||
remoteDir,
|
||||
"rev-parse",
|
||||
"refs/heads/feature",
|
||||
])
|
||||
.toString()
|
||||
.trim();
|
||||
expect(remoteHead).toBe(localHead);
|
||||
});
|
||||
|
||||
// With a tag of the same name, git spells the current branch "heads/release". Its settings and
|
||||
// its ref are still stored under "release".
|
||||
describe("a branch that shares its name with a tag", () => {
|
||||
it("does not publish to origin when the branch's pushRemote sends it to a fork", async () => {
|
||||
const { remoteDir } = setupRemoteTrackingMain(repoDir, tempDir);
|
||||
const forkDir = join(tempDir, "fork.git");
|
||||
execFileSync("git", ["init", "--bare", "-b", "main", forkDir]);
|
||||
execFileSync("git", ["remote", "add", "fork", forkDir], { cwd: repoDir });
|
||||
execFileSync("git", ["checkout", "-b", "release"], { cwd: repoDir });
|
||||
execFileSync("git", ["config", "branch.release.pushRemote", "fork"], { cwd: repoDir });
|
||||
commitFile(repoDir, "release.txt", "release\n", "release commit");
|
||||
execFileSync("git", ["tag", "release"], { cwd: repoDir });
|
||||
|
||||
const status = await getCheckoutStatus(repoDir);
|
||||
await expect(pushCurrentBranch(repoDir)).rejects.toThrow(
|
||||
"Git is set to push this branch to 'fork'",
|
||||
);
|
||||
|
||||
expect(status).toMatchObject({ upstreamState: "none", firstPushRemote: null });
|
||||
const originBranches = execFileSync("git", ["--git-dir", remoteDir, "branch", "--list"])
|
||||
.toString()
|
||||
.trim();
|
||||
expect(originBranches).toBe("* main");
|
||||
});
|
||||
|
||||
it("does not report a branch whose remote copy was deleted as never pushed", async () => {
|
||||
setupRemoteTrackingMain(repoDir, tempDir);
|
||||
execFileSync("git", ["checkout", "-b", "release"], { cwd: repoDir });
|
||||
commitFile(repoDir, "release.txt", "release\n", "release commit");
|
||||
execFileSync("git", ["push", "-u", "origin", "release"], { cwd: repoDir });
|
||||
execFileSync("git", ["tag", "release"], { cwd: repoDir });
|
||||
execFileSync("git", ["push", "origin", "--delete", "refs/heads/release"], { cwd: repoDir });
|
||||
execFileSync("git", ["fetch", "--prune", "origin"], { cwd: repoDir });
|
||||
|
||||
const status = await getCheckoutStatus(repoDir);
|
||||
|
||||
expect(status).toMatchObject({ upstreamState: "gone", aheadOfOrigin: null });
|
||||
});
|
||||
|
||||
it("pushes a branch that tracks a fork to the fork", async () => {
|
||||
const { remoteDir } = setupRemoteTrackingMain(repoDir, tempDir);
|
||||
const forkDir = join(tempDir, "fork.git");
|
||||
execFileSync("git", ["init", "--bare", "-b", "main", forkDir]);
|
||||
execFileSync("git", ["remote", "add", "fork", forkDir], { cwd: repoDir });
|
||||
execFileSync("git", ["checkout", "-b", "release"], { cwd: repoDir });
|
||||
commitFile(repoDir, "release.txt", "release\n", "release commit");
|
||||
execFileSync("git", ["push", "-u", "fork", "release"], { cwd: repoDir });
|
||||
execFileSync("git", ["tag", "release"], { cwd: repoDir });
|
||||
commitFile(repoDir, "release.txt", "release two\n", "second release commit");
|
||||
|
||||
await pushCurrentBranch(repoDir);
|
||||
|
||||
const localHead = execFileSync("git", ["rev-parse", "HEAD"], { cwd: repoDir })
|
||||
.toString()
|
||||
.trim();
|
||||
const forkHead = execFileSync("git", [
|
||||
"--git-dir",
|
||||
forkDir,
|
||||
"rev-parse",
|
||||
"refs/heads/release",
|
||||
])
|
||||
.toString()
|
||||
.trim();
|
||||
expect(forkHead).toBe(localHead);
|
||||
const originBranches = execFileSync("git", ["--git-dir", remoteDir, "branch", "--list"])
|
||||
.toString()
|
||||
.trim();
|
||||
expect(originBranches).toBe("* main");
|
||||
});
|
||||
});
|
||||
|
||||
it("still publishes a never-pushed Paseo worktree branch to origin in a fork setup", async () => {
|
||||
const { remoteDir } = setupRemoteTrackingMain(repoDir, tempDir);
|
||||
const forkDir = join(tempDir, "fork.git");
|
||||
execFileSync("git", ["init", "--bare", "-b", "main", forkDir]);
|
||||
execFileSync("git", ["remote", "add", "fork", forkDir], { cwd: repoDir });
|
||||
execFileSync("git", ["config", "remote.pushDefault", "fork"], { cwd: repoDir });
|
||||
const worktree = await createLegacyWorktreeForTest({
|
||||
branchName: "worktree-feature",
|
||||
cwd: repoDir,
|
||||
baseBranch: "main",
|
||||
worktreeSlug: "worktree-feature",
|
||||
paseoHome,
|
||||
});
|
||||
const worktreeDir = worktree.worktreePath;
|
||||
commitFile(worktreeDir, "feature.txt", "feature\n", "feature commit");
|
||||
|
||||
await pushCurrentBranch(worktreeDir, undefined, { paseoHome });
|
||||
|
||||
const localHead = execFileSync("git", ["rev-parse", "HEAD"], { cwd: worktreeDir })
|
||||
.toString()
|
||||
.trim();
|
||||
const remoteHead = execFileSync("git", [
|
||||
"--git-dir",
|
||||
remoteDir,
|
||||
"rev-parse",
|
||||
"refs/heads/worktree-feature",
|
||||
])
|
||||
.toString()
|
||||
.trim();
|
||||
expect(remoteHead).toBe(localHead);
|
||||
});
|
||||
|
||||
// Push's first push targets origin, so without origin a never-pushed branch has nowhere to go.
|
||||
it("reports a never-pushed branch and refuses its first push when origin is missing", async () => {
|
||||
const forkDir = join(tempDir, "fork.git");
|
||||
execFileSync("git", ["init", "--bare", "-b", "main", forkDir]);
|
||||
execFileSync("git", ["remote", "add", "upstream", forkDir], { cwd: repoDir });
|
||||
execFileSync("git", ["checkout", "-b", "local-only"], { cwd: repoDir });
|
||||
commitFile(repoDir, "local-only.txt", "local\n", "local commit");
|
||||
|
||||
const status = await getCheckoutStatus(repoDir);
|
||||
|
||||
expect(status).toMatchObject({
|
||||
isGit: true,
|
||||
upstreamState: "none",
|
||||
hasRemote: false,
|
||||
firstPushRemote: null,
|
||||
});
|
||||
await expect(pushCurrentBranch(repoDir)).rejects.toThrow("Remote 'origin' is not configured.");
|
||||
});
|
||||
|
||||
// A legal local branch named "origin/main" shadows the short form "origin/main" in git's
|
||||
@@ -1067,6 +1261,8 @@ const x = 1;
|
||||
}
|
||||
expect(status.upstreamRef).toBeNull();
|
||||
expect(status.aheadOfOrigin).toBeNull();
|
||||
expect(status.upstreamState).toBe("none");
|
||||
expect(status.aheadBehind).toEqual({ ahead: 1, behind: 0 });
|
||||
});
|
||||
|
||||
it("reports a PR worktree as not ahead when its branch is pushed to the configured PR remote", async () => {
|
||||
@@ -1170,6 +1366,79 @@ const x = 1;
|
||||
}
|
||||
expect(status.aheadOfOrigin).toBeNull();
|
||||
expect(status.behindOfOrigin).toBeNull();
|
||||
expect(status.upstreamRef).toBeNull();
|
||||
expect(status.upstreamState).toBe("gone");
|
||||
});
|
||||
|
||||
it("does not report a published branch as never pushed when the clone fetches only main", async () => {
|
||||
setupRemoteTrackingMain(repoDir, tempDir);
|
||||
// What `git clone --single-branch` and `--depth` leave behind: no tracking ref for other branches.
|
||||
execFileSync(
|
||||
"git",
|
||||
["config", "remote.origin.fetch", "+refs/heads/main:refs/remotes/origin/main"],
|
||||
{ cwd: repoDir },
|
||||
);
|
||||
execFileSync("git", ["checkout", "-b", "feature"], { cwd: repoDir });
|
||||
commitFile(repoDir, "feature.txt", "feature\n", "feature commit");
|
||||
execFileSync("git", ["push", "-u", "origin", "feature"], { cwd: repoDir });
|
||||
execFileSync("git", ["push", "origin", "--delete", "feature"], { cwd: repoDir });
|
||||
execFileSync("git", ["fetch", "--prune", "origin"], { cwd: repoDir });
|
||||
|
||||
const status = await getCheckoutStatus(repoDir);
|
||||
|
||||
expect(status).toMatchObject({
|
||||
isGit: true,
|
||||
aheadBehind: { ahead: 1, behind: 0 },
|
||||
upstreamRef: null,
|
||||
aheadOfOrigin: null,
|
||||
upstreamState: "unknown",
|
||||
});
|
||||
});
|
||||
|
||||
it("re-publishes a Paseo worktree branch whose remote copy was deleted and pruned", async () => {
|
||||
const { remoteDir } = setupRemoteTrackingMain(repoDir, tempDir);
|
||||
const worktree = await createLegacyWorktreeForTest({
|
||||
branchName: "merged-feature",
|
||||
cwd: repoDir,
|
||||
baseBranch: "main",
|
||||
worktreeSlug: "merged-feature",
|
||||
paseoHome,
|
||||
});
|
||||
const worktreeDir = worktree.worktreePath;
|
||||
commitFile(worktreeDir, "feature.txt", "feature\n", "feature commit");
|
||||
execFileSync("git", ["push", "-u", "origin", "merged-feature"], { cwd: worktreeDir });
|
||||
execFileSync("git", ["push", "origin", "--delete", "merged-feature"], { cwd: worktreeDir });
|
||||
execFileSync("git", ["fetch", "--prune", "origin"], { cwd: worktreeDir });
|
||||
|
||||
const gone = await getCheckoutStatus(worktreeDir, { paseoHome });
|
||||
expect(gone).toMatchObject({
|
||||
isPaseoOwnedWorktree: true,
|
||||
aheadBehind: { ahead: 1, behind: 0 },
|
||||
aheadOfOrigin: null,
|
||||
upstreamState: "gone",
|
||||
});
|
||||
|
||||
await pushCurrentBranch(worktreeDir);
|
||||
|
||||
const localHead = execFileSync("git", ["rev-parse", "HEAD"], { cwd: worktreeDir })
|
||||
.toString()
|
||||
.trim();
|
||||
const remoteHead = execFileSync("git", [
|
||||
"--git-dir",
|
||||
remoteDir,
|
||||
"rev-parse",
|
||||
"refs/heads/merged-feature",
|
||||
])
|
||||
.toString()
|
||||
.trim();
|
||||
expect(remoteHead).toBe(localHead);
|
||||
const republished = await getCheckoutStatus(worktreeDir, { paseoHome });
|
||||
expect(republished).toMatchObject({
|
||||
upstreamRef: "refs/remotes/origin/merged-feature",
|
||||
upstreamState: "tracked",
|
||||
aheadOfOrigin: 0,
|
||||
behindOfOrigin: 0,
|
||||
});
|
||||
});
|
||||
|
||||
it("does not report full history as unpushed for fresh no-track Paseo worktrees", async () => {
|
||||
|
||||
@@ -908,7 +908,9 @@ export interface CheckoutStatusGitNonPaseo {
|
||||
upstreamRef: string | null;
|
||||
aheadOfOrigin: number | null;
|
||||
behindOfOrigin: number | null;
|
||||
upstreamState: UpstreamState;
|
||||
hasRemote: boolean;
|
||||
firstPushRemote: string | null;
|
||||
remoteUrl: string | null;
|
||||
isPaseoOwnedWorktree: false;
|
||||
}
|
||||
@@ -926,7 +928,9 @@ export interface CheckoutStatusGitPaseo {
|
||||
upstreamRef: string | null;
|
||||
aheadOfOrigin: number | null;
|
||||
behindOfOrigin: number | null;
|
||||
upstreamState: UpstreamState;
|
||||
hasRemote: boolean;
|
||||
firstPushRemote: string | null;
|
||||
remoteUrl: string | null;
|
||||
isPaseoOwnedWorktree: true;
|
||||
}
|
||||
@@ -983,7 +987,8 @@ export type CheckoutSnapshotFacts =
|
||||
comparisonBaseRef: string | null;
|
||||
branchRemoteName: string | null;
|
||||
branchMergeRef: string | null;
|
||||
upstreamStatus: UpstreamStatus | null;
|
||||
upstreamStatus: UpstreamStatus;
|
||||
firstPushRemote: string | null;
|
||||
pullRequestLookupTarget: PullRequestStatusLookupTarget | null;
|
||||
};
|
||||
|
||||
@@ -1870,9 +1875,48 @@ async function getAheadBehind(
|
||||
return getAheadBehindForComparisonRef(cwd, comparisonBaseRef, currentBranch, context);
|
||||
}
|
||||
|
||||
export interface UpstreamStatus {
|
||||
ref: string;
|
||||
aheadBehind: AheadBehind;
|
||||
// How the current branch relates to its upstream. "none" means no upstream is configured: the
|
||||
// branch was never pushed. "gone" is git's `[gone]`: an upstream is configured but its
|
||||
// remote-tracking ref no longer exists, as after the remote branch is deleted and pruned.
|
||||
// "unknown" means git cannot say: the read failed, or an upstream is configured that this clone
|
||||
// keeps no remote-tracking ref for, as in a `--single-branch` or `--depth` clone.
|
||||
export type UpstreamStatus =
|
||||
| { state: "tracked"; ref: string; aheadBehind: AheadBehind }
|
||||
| { state: "gone"; ref: string }
|
||||
| { state: "none" }
|
||||
| { state: "unknown" };
|
||||
|
||||
export type UpstreamState = UpstreamStatus["state"];
|
||||
|
||||
export interface CheckoutUpstreamFields {
|
||||
upstreamRef: string | null;
|
||||
aheadOfOrigin: number | null;
|
||||
behindOfOrigin: number | null;
|
||||
upstreamState: UpstreamState;
|
||||
}
|
||||
|
||||
// The status fields that describe the upstream. upstreamRef and the counts stay null unless the
|
||||
// upstream is tracked, as they were before upstreamState existed.
|
||||
export function projectUpstreamStatus(status: UpstreamStatus): CheckoutUpstreamFields {
|
||||
if (status.state === "tracked") {
|
||||
return {
|
||||
upstreamRef: status.ref,
|
||||
aheadOfOrigin: status.aheadBehind.ahead,
|
||||
behindOfOrigin: status.aheadBehind.behind,
|
||||
upstreamState: "tracked",
|
||||
};
|
||||
}
|
||||
return {
|
||||
upstreamRef: null,
|
||||
aheadOfOrigin: null,
|
||||
behindOfOrigin: null,
|
||||
upstreamState: status.state,
|
||||
};
|
||||
}
|
||||
|
||||
// The configured upstream ref, whether or not its remote-tracking ref still exists.
|
||||
export function configuredUpstreamRef(status: UpstreamStatus): string | null {
|
||||
return status.state === "tracked" || status.state === "gone" ? status.ref : null;
|
||||
}
|
||||
|
||||
async function getAheadBehindForComparisonRef(
|
||||
@@ -1894,32 +1938,123 @@ async function getAheadBehindForComparisonRef(
|
||||
return { ahead, behind };
|
||||
}
|
||||
|
||||
async function getUpstreamStatus(
|
||||
// The name git stores a branch's settings and ref under. getCurrentBranch returns git's short
|
||||
// spelling of the branch, which gains a "heads/" prefix when another ref, such as a tag, shares
|
||||
// the name. That spelling is right for a revision or a refspec and wrong for these lookups.
|
||||
async function readStoredBranchName(
|
||||
cwd: string,
|
||||
currentBranch: string,
|
||||
context?: CheckoutContext,
|
||||
): Promise<UpstreamStatus | null> {
|
||||
): Promise<string> {
|
||||
const branchRefPrefix = "refs/heads/";
|
||||
if (!currentBranch.startsWith("heads/") && !currentBranch.startsWith(branchRefPrefix)) {
|
||||
return currentBranch;
|
||||
}
|
||||
try {
|
||||
const { stdout } = await getRunGitCommand(context)(["symbolic-ref", "--quiet", "HEAD"], {
|
||||
cwd,
|
||||
envOverlay: READ_ONLY_GIT_ENV,
|
||||
});
|
||||
const headRef = stdout.trim();
|
||||
return headRef.startsWith(branchRefPrefix)
|
||||
? headRef.slice(branchRefPrefix.length)
|
||||
: currentBranch;
|
||||
} catch {
|
||||
return currentBranch;
|
||||
}
|
||||
}
|
||||
|
||||
// What git reports for a branch's upstream: its remote-tracking ref and how the branch tracks it.
|
||||
// Both are blank when git resolves no upstream.
|
||||
interface UpstreamTracking {
|
||||
ref: string;
|
||||
track: string;
|
||||
}
|
||||
|
||||
async function readUpstreamTracking(
|
||||
cwd: string,
|
||||
storedBranchName: string | null,
|
||||
context?: CheckoutContext,
|
||||
): Promise<UpstreamTracking | null> {
|
||||
if (!storedBranchName) {
|
||||
return { ref: "", track: "" };
|
||||
}
|
||||
try {
|
||||
const { stdout } = await getRunGitCommand(context)(
|
||||
[
|
||||
"for-each-ref",
|
||||
"--format=%(upstream)%00%(upstream:track,nobracket)",
|
||||
`refs/heads/${currentBranch}`,
|
||||
`refs/heads/${storedBranchName}`,
|
||||
],
|
||||
{ cwd, envOverlay: READ_ONLY_GIT_ENV, logger: context?.logger },
|
||||
);
|
||||
const [ref = "", track = ""] = stdout.trim().split("\0", 2);
|
||||
if (!ref || track === "gone") {
|
||||
return null;
|
||||
}
|
||||
const ahead = Number.parseInt(track.match(/ahead (\d+)/)?.[1] ?? "0", 10);
|
||||
const behind = Number.parseInt(track.match(/behind (\d+)/)?.[1] ?? "0", 10);
|
||||
return { ref, aheadBehind: { ahead, behind } };
|
||||
return { ref, track };
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function resolveUpstreamStatus(
|
||||
tracking: UpstreamTracking | null,
|
||||
hasConfiguredUpstream: boolean,
|
||||
): UpstreamStatus {
|
||||
if (!tracking) {
|
||||
return { state: "unknown" };
|
||||
}
|
||||
if (!tracking.ref) {
|
||||
return hasConfiguredUpstream ? { state: "unknown" } : { state: "none" };
|
||||
}
|
||||
if (tracking.track === "gone") {
|
||||
return { state: "gone", ref: tracking.ref };
|
||||
}
|
||||
const ahead = Number.parseInt(tracking.track.match(/ahead (\d+)/)?.[1] ?? "0", 10);
|
||||
const behind = Number.parseInt(tracking.track.match(/behind (\d+)/)?.[1] ?? "0", 10);
|
||||
return { state: "tracked", ref: tracking.ref, aheadBehind: { ahead, behind } };
|
||||
}
|
||||
|
||||
// The remote git pushes a branch to: branch.<name>.pushRemote, then remote.pushDefault, then the
|
||||
// branch's own remote, then origin.
|
||||
async function readGitPushRemote(input: {
|
||||
cwd: string;
|
||||
storedBranchName: string;
|
||||
branchRemoteName: string | null;
|
||||
context?: CheckoutContext;
|
||||
}): Promise<string> {
|
||||
const { cwd, storedBranchName, context } = input;
|
||||
const [branchPushRemote, pushDefault] = await Promise.all([
|
||||
getGitConfigValue(cwd, `branch.${storedBranchName}.pushRemote`, context),
|
||||
getGitConfigValue(cwd, "remote.pushDefault", context),
|
||||
]);
|
||||
return branchPushRemote ?? pushDefault ?? input.branchRemoteName ?? "origin";
|
||||
}
|
||||
|
||||
// pushCurrentBranch publishes a branch with no upstream here.
|
||||
const FIRST_PUSH_REMOTE = "origin";
|
||||
|
||||
// Where a first push publishes the branch, when the daemon can confirm git would push it there
|
||||
// too. When git picks another remote, as in a fork setup, this is null so that clients do not
|
||||
// offer a first push that lands in a different repository than `git push` would use.
|
||||
async function readFirstPushRemote(input: {
|
||||
cwd: string;
|
||||
storedBranchName: string | null;
|
||||
branchRemoteName: string | null;
|
||||
hasOrigin: boolean;
|
||||
context?: CheckoutContext;
|
||||
}): Promise<string | null> {
|
||||
const { cwd, storedBranchName, branchRemoteName, context } = input;
|
||||
if (!storedBranchName || !input.hasOrigin) {
|
||||
return null;
|
||||
}
|
||||
const gitPushRemote = await readGitPushRemote({
|
||||
cwd,
|
||||
storedBranchName,
|
||||
branchRemoteName,
|
||||
context,
|
||||
});
|
||||
return gitPushRemote === FIRST_PUSH_REMOTE ? FIRST_PUSH_REMOTE : null;
|
||||
}
|
||||
|
||||
interface CheckoutInspectionContext {
|
||||
worktreeRoot: string;
|
||||
currentBranch: string | null;
|
||||
@@ -2210,24 +2345,28 @@ export async function getCheckoutSnapshotFacts(
|
||||
let branchRemoteName: string | null = null;
|
||||
let branchMergeRef: string | null = null;
|
||||
let branchRemoteUrl: string | null = null;
|
||||
const upstreamStatusPromise = inspected.currentBranch
|
||||
? getUpstreamStatus(cwd, inspected.currentBranch, context)
|
||||
: Promise.resolve(null);
|
||||
if (inspected.currentBranch) {
|
||||
branchRemoteName = await getGitConfigValue(
|
||||
cwd,
|
||||
`branch.${inspected.currentBranch}.remote`,
|
||||
context,
|
||||
);
|
||||
const storedBranchName = inspected.currentBranch
|
||||
? await readStoredBranchName(cwd, inspected.currentBranch, context)
|
||||
: null;
|
||||
const upstreamTrackingPromise = readUpstreamTracking(cwd, storedBranchName, context);
|
||||
if (storedBranchName) {
|
||||
branchRemoteName = await getGitConfigValue(cwd, `branch.${storedBranchName}.remote`, context);
|
||||
if (branchRemoteName) {
|
||||
[branchMergeRef, branchRemoteUrl] = await Promise.all([
|
||||
getGitConfigValue(cwd, `branch.${inspected.currentBranch}.merge`, context),
|
||||
getGitConfigValue(cwd, `branch.${storedBranchName}.merge`, context),
|
||||
branchRemoteName === "origin"
|
||||
? inspected.remoteUrl
|
||||
: resolveGitRemoteUrl({ cwd, remote: branchRemoteName, context }),
|
||||
]);
|
||||
}
|
||||
}
|
||||
const firstPushRemotePromise = readFirstPushRemote({
|
||||
cwd,
|
||||
storedBranchName,
|
||||
branchRemoteName,
|
||||
hasOrigin: inspected.remoteUrl !== null,
|
||||
context,
|
||||
});
|
||||
let pullRequestLookupTarget = await resolveFactsPullRequestLookupTarget({
|
||||
cwd,
|
||||
inspected,
|
||||
@@ -2243,7 +2382,10 @@ export async function getCheckoutSnapshotFacts(
|
||||
pullRequestLookupTarget,
|
||||
context,
|
||||
);
|
||||
const upstreamStatus = await upstreamStatusPromise;
|
||||
const upstreamStatus = resolveUpstreamStatus(
|
||||
await upstreamTrackingPromise,
|
||||
branchRemoteName !== null && branchMergeRef !== null,
|
||||
);
|
||||
|
||||
return {
|
||||
isGit: true,
|
||||
@@ -2260,6 +2402,7 @@ export async function getCheckoutSnapshotFacts(
|
||||
branchRemoteName,
|
||||
branchMergeRef,
|
||||
upstreamStatus,
|
||||
firstPushRemote: await firstPushRemotePromise,
|
||||
pullRequestLookupTarget,
|
||||
};
|
||||
}
|
||||
@@ -2432,14 +2575,11 @@ export async function getCheckoutStatus(
|
||||
baseRef && currentBranch
|
||||
? await getAheadBehind(cwd, baseRef, currentBranch, factsContext)
|
||||
: null;
|
||||
const upstreamStatus = facts.upstreamStatus;
|
||||
// The wire carries the display name: clients label the base with it and send it back to
|
||||
// request diffs and merges. The exact ref stays in worktree.json and in facts, where the
|
||||
// comparisons and actions read it.
|
||||
const displayBaseRef = baseRef ? branchNameFromRef(baseRef) : null;
|
||||
const upstreamRef = upstreamStatus?.ref ?? null;
|
||||
const aheadOfOrigin = upstreamStatus?.aheadBehind.ahead ?? null;
|
||||
const behindOfOrigin = upstreamStatus?.aheadBehind.behind ?? null;
|
||||
const upstream = projectUpstreamStatus(facts.upstreamStatus);
|
||||
|
||||
if (paseoWorktree.isPaseoOwnedWorktree && baseRef) {
|
||||
return {
|
||||
@@ -2452,10 +2592,9 @@ export async function getCheckoutStatus(
|
||||
baseRefExact: baseRef,
|
||||
comparisonBaseRef,
|
||||
aheadBehind,
|
||||
upstreamRef,
|
||||
aheadOfOrigin,
|
||||
behindOfOrigin,
|
||||
...upstream,
|
||||
hasRemote,
|
||||
firstPushRemote: facts.firstPushRemote,
|
||||
remoteUrl,
|
||||
isPaseoOwnedWorktree: true,
|
||||
};
|
||||
@@ -2472,10 +2611,9 @@ export async function getCheckoutStatus(
|
||||
baseRefExact: baseRef,
|
||||
comparisonBaseRef,
|
||||
aheadBehind,
|
||||
upstreamRef,
|
||||
aheadOfOrigin,
|
||||
behindOfOrigin,
|
||||
...upstream,
|
||||
hasRemote,
|
||||
firstPushRemote: facts.firstPushRemote,
|
||||
remoteUrl,
|
||||
isPaseoOwnedWorktree: false,
|
||||
};
|
||||
@@ -3107,7 +3245,7 @@ export async function getCheckoutShortstat(
|
||||
export interface CheckoutRefDerivedState {
|
||||
aheadBehind: AheadBehind | null;
|
||||
diffStat: CheckoutShortstat | null;
|
||||
upstreamStatus: UpstreamStatus | null;
|
||||
upstreamStatus: UpstreamStatus;
|
||||
}
|
||||
|
||||
function normalizeRemoteTrackingRef(ref: string): string {
|
||||
@@ -3150,7 +3288,8 @@ function getCheckoutRefMovement(
|
||||
.filter((ref): ref is string => Boolean(ref))
|
||||
.map(normalizeRemoteTrackingRef)
|
||||
.some((ref) => normalizedMoves.has(ref));
|
||||
const upstreamRef = facts.upstreamStatus?.ref ?? checkoutFactsConfiguredRemoteRef(facts);
|
||||
const upstreamRef =
|
||||
configuredUpstreamRef(facts.upstreamStatus) ?? checkoutFactsConfiguredRemoteRef(facts);
|
||||
const upstreamMoved = upstreamRef
|
||||
? normalizedMoves.has(normalizeRemoteTrackingRef(upstreamRef))
|
||||
: false;
|
||||
@@ -3206,10 +3345,11 @@ export async function getCheckoutRefDerivedState(
|
||||
: await getAheadBehindForComparisonRef(cwd, upstreamRef, currentBranch, context);
|
||||
upstreamStatus = upstreamAheadBehind
|
||||
? {
|
||||
ref: facts.upstreamStatus?.ref ?? `refs/remotes/${normalizedUpstream}`,
|
||||
state: "tracked",
|
||||
ref: configuredUpstreamRef(facts.upstreamStatus) ?? `refs/remotes/${normalizedUpstream}`,
|
||||
aheadBehind: upstreamAheadBehind,
|
||||
}
|
||||
: null;
|
||||
: { state: "unknown" };
|
||||
}
|
||||
|
||||
return { aheadBehind, diffStat, upstreamStatus };
|
||||
@@ -4192,24 +4332,29 @@ export async function pullCurrentBranch(cwd: string, forgeService?: ForgeService
|
||||
}
|
||||
}
|
||||
|
||||
export async function pushCurrentBranch(cwd: string, forgeService?: ForgeService): Promise<void> {
|
||||
export async function pushCurrentBranch(
|
||||
cwd: string,
|
||||
forgeService?: ForgeService,
|
||||
context?: CheckoutContext,
|
||||
): Promise<void> {
|
||||
await requireGitRepo(cwd);
|
||||
const currentBranch = await getCurrentBranch(cwd);
|
||||
if (!currentBranch || currentBranch === "HEAD") {
|
||||
throw new Error("Unable to determine current branch for push");
|
||||
}
|
||||
const configuredPushTarget = await getCurrentBranchConfiguredPushTarget(cwd, currentBranch);
|
||||
const storedBranchName = await readStoredBranchName(cwd, currentBranch, context);
|
||||
const configuredPushTarget = await getCurrentBranchConfiguredPushTarget(cwd, storedBranchName);
|
||||
if (configuredPushTarget) {
|
||||
await runGitCommand(
|
||||
["push", configuredPushTarget.remoteName, `HEAD:refs/heads/${configuredPushTarget.headRef}`],
|
||||
{ cwd, timeout: 120_000 },
|
||||
);
|
||||
await refreshCurrentBranchTrackedRefAfterPush(cwd, currentBranch, configuredPushTarget);
|
||||
await refreshCurrentBranchTrackedRefAfterPush(cwd, storedBranchName, configuredPushTarget);
|
||||
forgeService?.invalidate({ cwd });
|
||||
return;
|
||||
}
|
||||
|
||||
const upstreamTarget = await getCurrentBranchUpstreamPushTarget(cwd, currentBranch);
|
||||
const upstreamTarget = await getCurrentBranchUpstreamPushTarget(cwd, storedBranchName);
|
||||
if (upstreamTarget) {
|
||||
await runGitCommand(
|
||||
["push", "-u", upstreamTarget.remoteName, `HEAD:refs/heads/${upstreamTarget.headRef}`],
|
||||
@@ -4223,10 +4368,44 @@ export async function pushCurrentBranch(cwd: string, forgeService?: ForgeService
|
||||
if (!hasRemote) {
|
||||
throw new Error("Remote 'origin' is not configured.");
|
||||
}
|
||||
await runGitCommand(["push", "-u", "origin", currentBranch], { cwd, timeout: 120_000 });
|
||||
await requireFirstPushAgreesWithGit(cwd, storedBranchName, context);
|
||||
await runGitCommand(["push", "-u", FIRST_PUSH_REMOTE, currentBranch], { cwd, timeout: 120_000 });
|
||||
forgeService?.invalidate({ cwd });
|
||||
}
|
||||
|
||||
// The status a client acted on can be older than the git configuration, so a first push checks
|
||||
// the destination again before it sends anything. Paseo worktrees always publish to origin.
|
||||
async function requireFirstPushAgreesWithGit(
|
||||
cwd: string,
|
||||
storedBranchName: string,
|
||||
context?: CheckoutContext,
|
||||
): Promise<void> {
|
||||
const [branchRemoteName, branchMergeRef] = await Promise.all([
|
||||
getGitConfigValue(cwd, `branch.${storedBranchName}.remote`, context),
|
||||
getGitConfigValue(cwd, `branch.${storedBranchName}.merge`, context),
|
||||
]);
|
||||
// A branch with a configured upstream gets here when that upstream is not a remote branch, as
|
||||
// when it tracks a local branch. That is not a first push, and it goes to origin as before.
|
||||
if (branchRemoteName !== null && branchMergeRef !== null) {
|
||||
return;
|
||||
}
|
||||
const paseoWorktree = await getPaseoWorktreeForCwd(cwd, { context });
|
||||
if (paseoWorktree.isPaseoOwnedWorktree) {
|
||||
return;
|
||||
}
|
||||
const gitPushRemote = await readGitPushRemote({
|
||||
cwd,
|
||||
storedBranchName,
|
||||
branchRemoteName,
|
||||
context,
|
||||
});
|
||||
if (gitPushRemote !== FIRST_PUSH_REMOTE) {
|
||||
throw new Error(
|
||||
`Git is set to push this branch to '${gitPushRemote}', so Push did not publish it to '${FIRST_PUSH_REMOTE}'. Push it from a terminal instead.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function getCurrentBranchConfiguredPushTarget(
|
||||
cwd: string,
|
||||
currentBranch: string,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,7 @@
|
||||
import type { PluginServerContext } from "@getpaseo/plugin/server";
|
||||
import { createHermesProvider } from "./server/provider.js";
|
||||
|
||||
export default function contribute(server: PluginServerContext) {
|
||||
server.registerProvider(createHermesProvider());
|
||||
return () => {};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "id": "hermes-provider", "requirements": { "paseo": ">=0.17.3" } }
|
||||
@@ -0,0 +1,69 @@
|
||||
import type { AcpConfigChange, AcpConfigureContext } from "@getpaseo/plugin/server/acp";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { legacyModes } from "./legacy-modes.js";
|
||||
|
||||
// The modes `hermes acp` (hermes-agent 8da31006f3) offers through `edit_approval_policy`.
|
||||
const POLICY_MODES = [
|
||||
{ id: "ask", label: "Default" },
|
||||
{ id: "workspace_session", label: "Accept Edits" },
|
||||
{ id: "session", label: "Don't Ask" },
|
||||
];
|
||||
|
||||
async function configure(change: AcpConfigChange, modes = POLICY_MODES) {
|
||||
const applied: AcpConfigChange[] = [];
|
||||
const context: AcpConfigureContext = {
|
||||
sessionId: "session-1",
|
||||
config: { read: async () => ({}), set: async () => {} },
|
||||
request: async () => null,
|
||||
catalog: () => ({ models: [], modes }),
|
||||
apply: async (nativeChange) => {
|
||||
applied.push(nativeChange);
|
||||
},
|
||||
};
|
||||
const result = await legacyModes.configure!(change, context);
|
||||
return { result, applied };
|
||||
}
|
||||
|
||||
describe("Hermes modes saved before Hermes was bundled", () => {
|
||||
it.each([
|
||||
["default", "ask"],
|
||||
["accept_edits", "workspace_session"],
|
||||
["dont_ask", "session"],
|
||||
])("applies saved mode %s as policy %s", async (saved, policy) => {
|
||||
expect(await configure({ target: "mode", value: saved })).toEqual({
|
||||
result: "handled",
|
||||
applied: [{ target: "mode", value: policy }],
|
||||
});
|
||||
});
|
||||
|
||||
it("passes current policy modes through", async () => {
|
||||
expect(await configure({ target: "mode", value: "workspace_session" })).toEqual({
|
||||
result: "pass",
|
||||
applied: [],
|
||||
});
|
||||
});
|
||||
|
||||
it("passes a saved mode through when Hermes offers it directly", async () => {
|
||||
const sessionModes = [
|
||||
{ id: "default", label: "Default" },
|
||||
{ id: "accept_edits", label: "Accept Edits" },
|
||||
];
|
||||
expect(await configure({ target: "mode", value: "default" }, sessionModes)).toEqual({
|
||||
result: "pass",
|
||||
applied: [],
|
||||
});
|
||||
});
|
||||
|
||||
it("passes a saved mode through when Hermes no longer offers its policy", async () => {
|
||||
expect(
|
||||
await configure({ target: "mode", value: "default" }, [{ id: "plan", label: "Plan" }]),
|
||||
).toEqual({ result: "pass", applied: [] });
|
||||
});
|
||||
|
||||
it("leaves other settings alone", async () => {
|
||||
expect(await configure({ target: "model", value: "default" })).toEqual({
|
||||
result: "pass",
|
||||
applied: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { AcpTransformer } from "@getpaseo/plugin/server/acp";
|
||||
|
||||
// Hermes offers each edit mode twice: as an ACP session mode and as a value of its
|
||||
// `edit_approval_policy` config option (`acp_adapter/modes.py`). Agents created before Hermes was
|
||||
// bundled saved the session mode ID; this provider uses the config option, as ACP prefers.
|
||||
const POLICY_BY_SESSION_MODE = new Map([
|
||||
["default", "ask"],
|
||||
["accept_edits", "workspace_session"],
|
||||
["dont_ask", "session"],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Applies a saved session mode ID as its edit approval policy. Passes the mode through unchanged
|
||||
* when Hermes still offers it or no longer offers the policy.
|
||||
*/
|
||||
// COMPAT(hermesProvider): added in v0.17.4, remove after 2027-05-23 once legacy agents have resumed.
|
||||
export const legacyModes: AcpTransformer = {
|
||||
async configure(change, { apply, catalog }) {
|
||||
if (change.target !== "mode" || change.value === null) return "pass";
|
||||
const policy = POLICY_BY_SESSION_MODE.get(change.value);
|
||||
if (policy === undefined) return "pass";
|
||||
const { modes } = catalog();
|
||||
if (modes.some((mode) => mode.id === change.value)) return "pass";
|
||||
if (!modes.some((mode) => mode.id === policy)) return "pass";
|
||||
await apply({ target: "mode", value: policy });
|
||||
return "handled";
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import { runAcpProvider } from "@getpaseo/plugin/server/acp";
|
||||
import type { ProviderRegistration } from "@getpaseo/plugin/server/provider";
|
||||
import { legacyModes } from "./legacy-modes.js";
|
||||
import { terminalCommand } from "./terminal-command.js";
|
||||
|
||||
export function createHermesProvider(): ProviderRegistration {
|
||||
return {
|
||||
requiresConfiguration: true,
|
||||
...runAcpProvider({
|
||||
id: "hermes",
|
||||
label: "Hermes",
|
||||
description: "Nous Research self-improving AI agent",
|
||||
icon: "icon.svg",
|
||||
command: ["hermes", "acp"],
|
||||
acpOptions: {
|
||||
autoAcceptMode: {
|
||||
mode: {
|
||||
id: "full-access",
|
||||
label: "Full access",
|
||||
description: "Approve tool requests without asking.",
|
||||
icon: "ShieldOff",
|
||||
colorTier: "dangerous",
|
||||
},
|
||||
nativeMode: "ask",
|
||||
},
|
||||
},
|
||||
transformers: [terminalCommand, legacyModes],
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import type { AcpToolCallSnapshot } from "@getpaseo/plugin/server/acp";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { terminalCommand } from "./terminal-command.js";
|
||||
|
||||
const FULL_COMMAND =
|
||||
'echo "whoami: $(whoami)" && id -u && echo cleaned && ls -la /tmp | head -3 && date +%Y && uname -s';
|
||||
|
||||
function text(value: string): AcpToolCallSnapshot["content"] {
|
||||
return [{ type: "content", content: { type: "text", text: value } }];
|
||||
}
|
||||
|
||||
// Shapes captured from `hermes acp` (hermes-agent 8da31006f3) running its terminal tool.
|
||||
const started: AcpToolCallSnapshot = {
|
||||
id: "call_95ed298464d44b0c9a23d24e72c96afc",
|
||||
title: 'terminal: echo "whoami: $(whoami)" + 5 commands',
|
||||
kind: "execute",
|
||||
status: "pending",
|
||||
input: null,
|
||||
output: null,
|
||||
content: text(`$ ${FULL_COMMAND}`),
|
||||
locations: [],
|
||||
};
|
||||
|
||||
const completed: AcpToolCallSnapshot = {
|
||||
...started,
|
||||
status: "completed",
|
||||
content: text("terminal result\n- **output:** whoami: moboudra\n- **exit_code:** 0"),
|
||||
};
|
||||
|
||||
function present(call: AcpToolCallSnapshot, previous?: AcpToolCallSnapshot) {
|
||||
return terminalCommand.toolCall!(call, { sessionId: "session-1", previous });
|
||||
}
|
||||
|
||||
describe("Hermes terminal calls", () => {
|
||||
it("runs the command from the start text, not the summary title", () => {
|
||||
expect(present(started).input).toEqual({ command: FULL_COMMAND });
|
||||
});
|
||||
|
||||
it("keeps the command once the result replaces the start text", () => {
|
||||
const first = present(started);
|
||||
expect(present(completed, first).input).toEqual({ command: FULL_COMMAND });
|
||||
});
|
||||
|
||||
it("prefers a command Hermes sends as input", () => {
|
||||
const call = { ...started, input: { command: "git status" } };
|
||||
expect(present(call)).toEqual(call);
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ name: "a start text without the prompt", content: text(`Running ${FULL_COMMAND}`) },
|
||||
{ name: "no start text", content: undefined },
|
||||
{ name: "an unexpected content shape", content: { text: `$ ${FULL_COMMAND}` } },
|
||||
])("passes the call through for $name", ({ content }) => {
|
||||
const call = { ...started, content };
|
||||
expect(present(call)).toEqual(call);
|
||||
});
|
||||
|
||||
it("leaves other tools alone", () => {
|
||||
const read = { ...started, kind: "read", content: text("$ not a command") };
|
||||
expect(present(read)).toEqual(read);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { AcpToolCallSnapshot, AcpTransformer } from "@getpaseo/plugin/server/acp";
|
||||
import { z } from "zod";
|
||||
|
||||
const commandInput = z.object({ command: z.string() });
|
||||
const startText = z.tuple([
|
||||
z.object({
|
||||
type: z.literal("content"),
|
||||
content: z.object({ type: z.literal("text"), text: z.string().startsWith("$ ") }),
|
||||
}),
|
||||
]);
|
||||
|
||||
// Hermes titles a terminal call with a summary (`terminal: git status + 2 commands`) and sends the
|
||||
// command only as `$ <command>` text in the call's first update; the completed update replaces that
|
||||
// text with the result. Keeping the command as the call's input lets Paseo's Shell row show it.
|
||||
// When Hermes sends neither shape, the call passes through and the row shows Hermes's title.
|
||||
export const terminalCommand: AcpTransformer = {
|
||||
toolCall(call, { previous }) {
|
||||
if (call.kind !== "execute" || commandInput.safeParse(call.input).success) return call;
|
||||
const command =
|
||||
commandFromStartText(call) ?? commandInput.safeParse(previous?.input).data?.command;
|
||||
if (command === undefined) return call;
|
||||
const input = typeof call.input === "object" && !Array.isArray(call.input) ? call.input : null;
|
||||
return { ...call, input: { ...input, command } };
|
||||
},
|
||||
};
|
||||
|
||||
function commandFromStartText(call: AcpToolCallSnapshot): string | undefined {
|
||||
return startText.safeParse(call.content).data?.[0].content.text.slice("$ ".length);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { z } from "zod";
|
||||
import {
|
||||
toneFromUsedPct,
|
||||
unavailable,
|
||||
windowFromUsedPct,
|
||||
type UsageReport,
|
||||
type UsageWindow,
|
||||
} from "@getpaseo/plugin/server/usage";
|
||||
|
||||
// The endpoint the Console's own Go page reads. It is not publicly documented.
|
||||
const STATUS_URL = "https://opencode.ai/console/api/go/status";
|
||||
const GO_PRODUCTS = new Set(["go", "go-plus", "go-teams"]);
|
||||
export const NO_SUBSCRIPTION = unavailable({
|
||||
kind: "no_quota",
|
||||
detail: "No active OpenCode Go subscription",
|
||||
});
|
||||
|
||||
const amount = z.union([z.string(), z.number()]).transform(Number);
|
||||
const meterSchema = z.object({
|
||||
limitMicroCents: amount,
|
||||
usedMicroCents: amount,
|
||||
resetsAt: z.iso.datetime(),
|
||||
});
|
||||
const statusSchema = z.object({
|
||||
product: z.string().nullish(),
|
||||
// An ended or refunded subscription keeps its product and sends no access.
|
||||
access: z
|
||||
.object({
|
||||
meters: z.object({
|
||||
fiveHour: z.unknown().optional(),
|
||||
week: z.unknown().optional(),
|
||||
month: z.unknown().optional(),
|
||||
}),
|
||||
})
|
||||
.nullish(),
|
||||
});
|
||||
|
||||
const METERS = [
|
||||
["fiveHour", "rolling", "Rolling", ""],
|
||||
["week", "weekly", "Weekly", "wk"],
|
||||
["month", "monthly", "Monthly", "mo"],
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Reads the Go meters the Console shows. A sign-in names its organization; an API key belongs to
|
||||
* one workspace and sends none. Throws on failures that say nothing about the login.
|
||||
*/
|
||||
export async function readConsoleGo(
|
||||
login: { token: string; orgID?: string },
|
||||
fetchApi: typeof fetch,
|
||||
timeoutMs = 15_000,
|
||||
): Promise<UsageReport> {
|
||||
const response = await fetchApi(STATUS_URL, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${login.token}`,
|
||||
Accept: "application/json",
|
||||
...(login.orgID ? { "x-org-id": login.orgID } : {}),
|
||||
},
|
||||
// The token goes to the Console origin only.
|
||||
redirect: "error",
|
||||
signal: AbortSignal.timeout(timeoutMs),
|
||||
});
|
||||
if (response.status === 401 || response.status === 403)
|
||||
return unavailable({ kind: "rejected", status: response.status, refreshedBy: "opencode" });
|
||||
if (!response.ok) throw new Error(`OpenCode Console Go status returned ${response.status}`);
|
||||
const status = statusSchema.parse(await response.json());
|
||||
if (!status.product || !GO_PRODUCTS.has(status.product) || !status.access) return NO_SUBSCRIPTION;
|
||||
const windows = METERS.flatMap(([meter, id, label, shortLabel]): UsageWindow[] => {
|
||||
const parsed = meterSchema.safeParse(status.access?.meters[meter]);
|
||||
if (!parsed.success) return [];
|
||||
const { limitMicroCents: limit, usedMicroCents: used, resetsAt } = parsed.data;
|
||||
if (!(limit > 0) || !(used >= 0)) return [];
|
||||
const usedPct = Math.min(100, (used / limit) * 100);
|
||||
return [
|
||||
windowFromUsedPct({
|
||||
id,
|
||||
label,
|
||||
shortLabel,
|
||||
utilizationPct: usedPct,
|
||||
resetsAt,
|
||||
tone: toneFromUsedPct(usedPct),
|
||||
}),
|
||||
];
|
||||
});
|
||||
if (!windows.length) throw new Error("OpenCode Console Go status has no readable meters");
|
||||
return { status: "available", planLabel: "Go", windows };
|
||||
}
|
||||
@@ -11,19 +11,42 @@ interface Database {
|
||||
interface Sqlite {
|
||||
DatabaseSync: new (path: string, options: { readOnly: boolean }) => Database;
|
||||
}
|
||||
interface DatabaseLogin {
|
||||
key: string | null;
|
||||
}
|
||||
export interface StorePaths {
|
||||
file: string;
|
||||
database: string;
|
||||
}
|
||||
|
||||
/** A credential OpenCode can serve Go with. Anything else on the integration is ignored. */
|
||||
export type GoCredential =
|
||||
| { type: "key"; key: string }
|
||||
| { type: "console"; access: string; expires: number; orgID: string };
|
||||
|
||||
/** The selected credential on each integration that can carry OpenCode Go. */
|
||||
export interface DatabaseLogins {
|
||||
/** OpenCode binds Go to this integration when the Console workspace has Go. */
|
||||
opencode: GoCredential | null;
|
||||
go: GoCredential | null;
|
||||
}
|
||||
|
||||
const CONSOLE_SERVER = "https://opencode.ai/console";
|
||||
const ORGANIZATION_ID = /^(?:org|wrk)_[A-Za-z0-9]+$/;
|
||||
|
||||
const fileSchema = z.object({
|
||||
"opencode-go": z.object({ type: z.literal("api"), key: z.string().min(1) }).optional(),
|
||||
});
|
||||
const rowSchema = z.object({ value: z.string() });
|
||||
const keySchema = z.object({ type: z.literal("key"), key: z.string().min(1) });
|
||||
const metadataSchema = z
|
||||
.object({ server: z.string().optional(), orgID: z.string().optional() })
|
||||
.optional();
|
||||
const credentialSchema = z.discriminatedUnion("type", [
|
||||
z.object({ type: z.literal("key"), key: z.string().min(1), metadata: metadataSchema }),
|
||||
z.object({
|
||||
type: z.literal("oauth"),
|
||||
access: z.string().min(1),
|
||||
expires: z.number(),
|
||||
metadata: metadataSchema,
|
||||
}),
|
||||
]);
|
||||
|
||||
export function defaultStorePaths(env: NodeJS.ProcessEnv = process.env): StorePaths {
|
||||
const dataHome = env.XDG_DATA_HOME || join(env.HOME || homedir(), ".local", "share");
|
||||
@@ -41,7 +64,8 @@ export async function readFileKey(path: string): Promise<string | null> {
|
||||
}
|
||||
}
|
||||
|
||||
export function readDatabaseLogin(path: string): DatabaseLogin | null {
|
||||
/** Null when the path is not an OpenCode v2 credential store. */
|
||||
export function readDatabaseLogins(path: string): DatabaseLogins | null {
|
||||
// Keep the legacy source loadable on Node versions without node:sqlite.
|
||||
const sqlite = z
|
||||
.object({
|
||||
@@ -56,24 +80,43 @@ export function readDatabaseLogin(path: string): DatabaseLogin | null {
|
||||
.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'credential'")
|
||||
.all();
|
||||
if (!tables.length) return null;
|
||||
const [value] = db
|
||||
.prepare(
|
||||
// OpenCode also selects migrated rows with no active flag, ordered by creation time.
|
||||
"SELECT value FROM credential WHERE integration_id = ? ORDER BY active DESC, time_created DESC, id DESC LIMIT 1",
|
||||
)
|
||||
.all("opencode-go");
|
||||
const row = rowSchema.safeParse(value);
|
||||
if (!row.success) return { key: null };
|
||||
let credential: unknown;
|
||||
try {
|
||||
credential = JSON.parse(row.data.value);
|
||||
} catch (error) {
|
||||
if (error instanceof SyntaxError) return { key: null };
|
||||
throw error;
|
||||
}
|
||||
const parsed = keySchema.safeParse(credential);
|
||||
return { key: parsed.success ? parsed.data.key : null };
|
||||
return { opencode: selected(db, "opencode"), go: selected(db, "opencode-go") };
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
}
|
||||
|
||||
function selected(db: Database, integrationID: string): GoCredential | null {
|
||||
const [value] = db
|
||||
.prepare(
|
||||
// OpenCode also selects migrated rows with no active flag, ordered by creation time.
|
||||
"SELECT value FROM credential WHERE integration_id = ? ORDER BY active DESC, time_created DESC, id DESC LIMIT 1",
|
||||
)
|
||||
.all(integrationID);
|
||||
const row = rowSchema.safeParse(value);
|
||||
if (!row.success) return null;
|
||||
let credential: unknown;
|
||||
try {
|
||||
credential = JSON.parse(row.data.value);
|
||||
} catch (error) {
|
||||
if (error instanceof SyntaxError) return null;
|
||||
throw error;
|
||||
}
|
||||
const parsed = credentialSchema.safeParse(credential);
|
||||
if (!parsed.success) return null;
|
||||
const { data } = parsed;
|
||||
// A credential for another Console never goes to opencode.ai.
|
||||
if (consoleServer(data.metadata?.server) !== CONSOLE_SERVER) return null;
|
||||
if (data.type === "key") return { type: "key", key: data.key };
|
||||
const orgID = data.metadata?.orgID;
|
||||
if (integrationID !== "opencode" || !orgID || !ORGANIZATION_ID.test(orgID)) return null;
|
||||
return { type: "console", access: data.access, expires: data.expires, orgID };
|
||||
}
|
||||
|
||||
// OpenCode defaults a missing server to the Console and maps the retired host onto it.
|
||||
function consoleServer(server: string | undefined): string {
|
||||
return (server ?? CONSOLE_SERVER).replace(
|
||||
/^https:\/\/console\.opencode\.ai(?=\/|$)/,
|
||||
CONSOLE_SERVER,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ test("discovery input rejects an explicit API key", () => {
|
||||
expect(() => inputSchema.parse({})).toThrow();
|
||||
});
|
||||
|
||||
const CONSOLE_STATUS_URL = "https://opencode.ai/console/api/go/status";
|
||||
const USAGE_URL = "https://opencode.ai/zen/go/v1/usage";
|
||||
const upstreamResponse = {
|
||||
usage: {
|
||||
rolling: { status: "ok", percent: 21, resetsAt: "2026-09-26T20:00:00.000Z" },
|
||||
@@ -56,7 +58,6 @@ test("uses the active v2 Go key instead of a stale legacy key without writing ei
|
||||
);
|
||||
insert.run("inactive", "opencode-go", JSON.stringify({ type: "key", key: "inactive-key" }), 0, 3);
|
||||
insert.run("active", "opencode-go", JSON.stringify({ type: "key", key: "active-key" }), 1, 1);
|
||||
insert.run("zen", "opencode", JSON.stringify({ type: "key", key: "zen-key" }), 1, 4);
|
||||
db.close();
|
||||
const beforeDatabase = await readFile(databasePath);
|
||||
const beforeFile = await readFile(fixturePath);
|
||||
@@ -175,7 +176,28 @@ test("selects the newest created Go key when no explicit active key exists", asy
|
||||
});
|
||||
|
||||
test.each([
|
||||
["other provider", "opencode", 1, JSON.stringify({ type: "key", key: "zen-key" })],
|
||||
["unrelated provider", "anthropic", 1, JSON.stringify({ type: "key", key: "other-key" })],
|
||||
[
|
||||
"Console sign-in on another server",
|
||||
"opencode",
|
||||
1,
|
||||
JSON.stringify({
|
||||
type: "oauth",
|
||||
access: "staging-token",
|
||||
expires: 0,
|
||||
metadata: { server: "https://staging.example.com/console", orgID: "org_TEST" },
|
||||
}),
|
||||
],
|
||||
[
|
||||
"Console key on another server",
|
||||
"opencode",
|
||||
1,
|
||||
JSON.stringify({
|
||||
type: "key",
|
||||
key: "staging-key",
|
||||
metadata: { server: "https://staging.example.com/console" },
|
||||
}),
|
||||
],
|
||||
["Console OAuth", "opencode-go", 1, JSON.stringify({ type: "oauth", access: "oauth-token" })],
|
||||
["malformed credential", "opencode-go", 1, "invalid JSON"],
|
||||
["empty key", "opencode-go", 1, JSON.stringify({ type: "key", key: "" })],
|
||||
@@ -269,7 +291,8 @@ test("discovers and fetches the default key from read-only auth.json", async ()
|
||||
};
|
||||
const report = await fetchUsage({ store: "file", path }, fetchApi);
|
||||
expect(requests).toEqual([
|
||||
{ url: "https://opencode.ai/zen/go/v1/usage", authorization: "Bearer fixture-key" },
|
||||
{ url: CONSOLE_STATUS_URL, authorization: "Bearer fixture-key" },
|
||||
{ url: USAGE_URL, authorization: "Bearer fixture-key" },
|
||||
]);
|
||||
expect(report.status).toBe("available");
|
||||
expect(report.windows.map((window) => [window.id, window.usedPct, window.resetsAt])).toEqual([
|
||||
@@ -333,3 +356,231 @@ test("keeps the account identity when OpenCode v2 imports the legacy Go login",
|
||||
// Usage settings are saved per account, so the card keeps its visibility and position.
|
||||
expect(migrated!.key).toBe(legacy!.key);
|
||||
});
|
||||
|
||||
const consoleSignIn = (overrides: { expires?: number; server?: string } = {}) =>
|
||||
JSON.stringify({
|
||||
type: "oauth",
|
||||
methodID: "device",
|
||||
access: "console-token",
|
||||
refresh: "console-refresh",
|
||||
expires: overrides.expires ?? Date.now() + 3_600_000,
|
||||
metadata: {
|
||||
...(overrides.server ? { server: overrides.server } : {}),
|
||||
orgID: "org_TESTORG123",
|
||||
orgName: "Team",
|
||||
},
|
||||
});
|
||||
const goStatus = (
|
||||
access: unknown = {
|
||||
meters: {
|
||||
fiveHour: {
|
||||
resetsAt: "2026-08-12T12:00:00.000Z",
|
||||
limitMicroCents: "1000000000",
|
||||
usedMicroCents: "250000000",
|
||||
},
|
||||
week: {
|
||||
resetsAt: "2026-08-19T12:00:00.000Z",
|
||||
limitMicroCents: "2000000000",
|
||||
usedMicroCents: "800000000",
|
||||
},
|
||||
month: {
|
||||
resetsAt: "2026-09-01T00:00:00.000Z",
|
||||
limitMicroCents: "6000000000",
|
||||
usedMicroCents: "3000000000",
|
||||
},
|
||||
},
|
||||
},
|
||||
) => ({ product: "go", access });
|
||||
|
||||
interface Request {
|
||||
url: string;
|
||||
authorization: string | null;
|
||||
orgID: string | null;
|
||||
redirect?: RequestRedirect;
|
||||
}
|
||||
/** Answers each URL and bearer token pair, recording what was asked. */
|
||||
function upstream(answers: Record<string, () => Response>) {
|
||||
const requests: Request[] = [];
|
||||
const fetchApi = async (url: string | URL | Request, init?: RequestInit) => {
|
||||
const headers = new Headers(init?.headers);
|
||||
const authorization = headers.get("Authorization");
|
||||
requests.push({
|
||||
url: String(url),
|
||||
authorization,
|
||||
orgID: headers.get("x-org-id"),
|
||||
...(init?.redirect ? { redirect: init.redirect } : {}),
|
||||
});
|
||||
const answer = answers[`${String(url)} ${authorization}`];
|
||||
return answer ? answer() : new Response(null, { status: 401 });
|
||||
};
|
||||
return { requests, fetchApi: fetchApi as typeof fetch };
|
||||
}
|
||||
async function storeWith(rows: Array<[string, string]>) {
|
||||
const db = await database();
|
||||
const insert = db.prepare(
|
||||
"INSERT INTO credential (id, integration_id, value, active, time_updated) VALUES (?, ?, ?, ?, ?)",
|
||||
);
|
||||
for (const [integration, value] of rows) insert.run(integration, integration, value, 1, 1);
|
||||
db.close();
|
||||
await rm(fixturePath);
|
||||
const [account] = await discover(stores(fixturePath));
|
||||
return inputSchema.parse(account!.input);
|
||||
}
|
||||
|
||||
test("reads Go from the Console sign-in OpenCode serves it with, ahead of the opencode-go key", async () => {
|
||||
const input = await storeWith([
|
||||
["opencode", consoleSignIn()],
|
||||
["opencode-go", JSON.stringify({ type: "key", key: "go-key" })],
|
||||
]);
|
||||
const { requests, fetchApi } = upstream({
|
||||
[`${CONSOLE_STATUS_URL} Bearer console-token`]: () => Response.json(goStatus()),
|
||||
});
|
||||
const report = await fetchUsage(input, fetchApi);
|
||||
expect(requests).toEqual([
|
||||
{
|
||||
url: CONSOLE_STATUS_URL,
|
||||
authorization: "Bearer console-token",
|
||||
orgID: "org_TESTORG123",
|
||||
redirect: "error",
|
||||
},
|
||||
]);
|
||||
expect(report.status === "available" && report.windows.map((w) => [w.id, w.usedPct])).toEqual([
|
||||
["rolling", 25],
|
||||
["weekly", 40],
|
||||
["monthly", 50],
|
||||
]);
|
||||
});
|
||||
|
||||
test("discovers a Console sign-in on its own, including one saved for the retired host", async () => {
|
||||
const input = await storeWith([
|
||||
["opencode", consoleSignIn({ server: "https://console.opencode.ai" })],
|
||||
]);
|
||||
const { fetchApi } = upstream({
|
||||
[`${CONSOLE_STATUS_URL} Bearer console-token`]: () => Response.json(goStatus()),
|
||||
});
|
||||
expect((await fetchUsage(input, fetchApi)).status).toBe("available");
|
||||
});
|
||||
|
||||
test.each([
|
||||
["another product", { product: "zen", access: null }],
|
||||
["an ended subscription", goStatus(null)],
|
||||
])("falls back to the opencode-go key when the sign-in's workspace has %s", async (_, body) => {
|
||||
const input = await storeWith([
|
||||
["opencode", consoleSignIn()],
|
||||
["opencode-go", JSON.stringify({ type: "key", key: "go-key" })],
|
||||
]);
|
||||
const { fetchApi } = upstream({
|
||||
[`${CONSOLE_STATUS_URL} Bearer console-token`]: () => Response.json(body),
|
||||
[`${USAGE_URL} Bearer go-key`]: () => Response.json(upstreamResponse),
|
||||
});
|
||||
const report = await fetchUsage(input, fetchApi);
|
||||
expect(report.status === "available" && report.windows.map((w) => w.usedPct)).toEqual([
|
||||
21, 42, 100,
|
||||
]);
|
||||
});
|
||||
|
||||
test("reports the absent subscription for a Console sign-in without Go", async () => {
|
||||
const input = await storeWith([["opencode", consoleSignIn()]]);
|
||||
const { fetchApi } = upstream({
|
||||
[`${CONSOLE_STATUS_URL} Bearer console-token`]: () => Response.json(goStatus(null)),
|
||||
});
|
||||
expect(await fetchUsage(input, fetchApi)).toEqual({
|
||||
status: "unavailable",
|
||||
problem: { kind: "no_quota", detail: "No active OpenCode Go subscription" },
|
||||
});
|
||||
});
|
||||
|
||||
test("reports an expired sign-in without a request, and keeps it over a rejected fallback key", async () => {
|
||||
const expires = Date.now() - 1000;
|
||||
const alone = await storeWith([["opencode", consoleSignIn({ expires })]]);
|
||||
const { requests, fetchApi } = upstream({});
|
||||
const expired = {
|
||||
status: "unavailable",
|
||||
problem: {
|
||||
kind: "expired",
|
||||
expiresAt: new Date(expires).toISOString(),
|
||||
refreshedBy: "opencode",
|
||||
},
|
||||
};
|
||||
expect(await fetchUsage(alone, fetchApi)).toEqual(expired);
|
||||
expect(requests).toEqual([]);
|
||||
await rm(join(fixtureDirectory, "opencode.db"));
|
||||
await writeFile(fixturePath, "{}");
|
||||
const withKey = await storeWith([
|
||||
["opencode", consoleSignIn({ expires })],
|
||||
["opencode-go", JSON.stringify({ type: "key", key: "expired-go-key" })],
|
||||
]);
|
||||
expect(await fetchUsage(withKey, fetchApi)).toEqual(expired);
|
||||
});
|
||||
|
||||
test("reads Go with a key on the opencode integration and falls back when its workspace lacks Go", async () => {
|
||||
const input = await storeWith([
|
||||
["opencode", JSON.stringify({ type: "key", key: "workspace-key" })],
|
||||
["opencode-go", JSON.stringify({ type: "key", key: "go-key" })],
|
||||
]);
|
||||
const served = upstream({
|
||||
[`${CONSOLE_STATUS_URL} Bearer workspace-key`]: () => Response.json(goStatus()),
|
||||
});
|
||||
const report = await fetchUsage(input, served.fetchApi);
|
||||
expect(report.status).toBe("available");
|
||||
expect(served.requests.map((request) => [request.authorization, request.orgID])).toEqual([
|
||||
["Bearer workspace-key", null],
|
||||
]);
|
||||
const refused = upstream({
|
||||
[`${USAGE_URL} Bearer workspace-key`]: () => new Response(null, { status: 403 }),
|
||||
[`${USAGE_URL} Bearer go-key`]: () => Response.json(upstreamResponse),
|
||||
});
|
||||
expect((await fetchUsage(input, refused.fetchApi)).status).toBe("available");
|
||||
expect(refused.requests.at(-1)).toMatchObject({ url: USAGE_URL, authorization: "Bearer go-key" });
|
||||
});
|
||||
|
||||
test("reports a key on the opencode integration without Go as the absent subscription", async () => {
|
||||
const input = await storeWith([["opencode", JSON.stringify({ type: "key", key: "zen-key" })]]);
|
||||
const { fetchApi } = upstream({
|
||||
[`${USAGE_URL} Bearer zen-key`]: () => new Response(null, { status: 403 }),
|
||||
});
|
||||
expect(await fetchUsage(input, fetchApi)).toEqual({
|
||||
status: "unavailable",
|
||||
problem: { kind: "no_quota", detail: "No active OpenCode Go subscription" },
|
||||
});
|
||||
});
|
||||
|
||||
test("keeps the card on the opencode key through a temporary failure", async () => {
|
||||
const input = await storeWith([
|
||||
["opencode", JSON.stringify({ type: "key", key: "workspace-key" })],
|
||||
["opencode-go", JSON.stringify({ type: "key", key: "go-key" })],
|
||||
]);
|
||||
const { requests, fetchApi } = upstream({
|
||||
[`${USAGE_URL} Bearer workspace-key`]: () => new Response(null, { status: 503 }),
|
||||
});
|
||||
await expect(fetchUsage(input, fetchApi)).rejects.toThrow("returned 503");
|
||||
expect(requests.some((request) => request.authorization === "Bearer go-key")).toBe(false);
|
||||
});
|
||||
|
||||
test("keeps the card on the Console sign-in through a temporary failure", async () => {
|
||||
const input = await storeWith([
|
||||
["opencode", consoleSignIn()],
|
||||
["opencode-go", JSON.stringify({ type: "key", key: "go-key" })],
|
||||
]);
|
||||
const { requests, fetchApi } = upstream({
|
||||
[`${CONSOLE_STATUS_URL} Bearer console-token`]: () => new Response(null, { status: 503 }),
|
||||
[`${USAGE_URL} Bearer go-key`]: () => Response.json(upstreamResponse),
|
||||
});
|
||||
await expect(fetchUsage(input, fetchApi)).rejects.toThrow("returned 503");
|
||||
expect(requests.some((request) => request.authorization === "Bearer go-key")).toBe(false);
|
||||
});
|
||||
|
||||
test("reads a key's usage within the refresh deadline when the Console does not answer", async () => {
|
||||
const fetchApi = (async (url: string | URL | Request, init?: RequestInit) => {
|
||||
if (String(url) === USAGE_URL) return Response.json(upstreamResponse);
|
||||
// The Console holds the request open until the caller gives up on it.
|
||||
return new Promise<Response>((_resolve, reject) => {
|
||||
init?.signal?.addEventListener("abort", () => reject(init.signal?.reason));
|
||||
});
|
||||
}) as typeof fetch;
|
||||
const started = Date.now();
|
||||
const report = await fetchUsage({ store: "file", path: fixturePath }, fetchApi);
|
||||
expect(report.status).toBe("available");
|
||||
// The daemon gives a usage refresh 20 seconds, and the usage API keeps 15 of them.
|
||||
expect(Date.now() - started).toBeLessThan(5_000);
|
||||
}, 20_000);
|
||||
|
||||
@@ -8,7 +8,9 @@ import {
|
||||
type UsageReport,
|
||||
} from "@getpaseo/plugin/server/usage";
|
||||
import type { Input } from "../shared/input.js";
|
||||
import { defaultStorePaths, readDatabaseLogin, readFileKey } from "./stores.js";
|
||||
import { NO_SUBSCRIPTION, readConsoleGo } from "./console.js";
|
||||
import { defaultStorePaths, readDatabaseLogins, readFileKey, type GoCredential } from "./stores.js";
|
||||
|
||||
const windowSchema = z.object({
|
||||
status: z.enum(["ok", "rate-limited"]),
|
||||
percent: z.number().finite(),
|
||||
@@ -22,9 +24,9 @@ export async function discover(paths = defaultStorePaths()): Promise<UsageAccoun
|
||||
// One OpenCode data directory holds one Go login, whichever store it lives in. Usage settings
|
||||
// are saved per account, so a login OpenCode v2 imports keeps the identity it had in auth.json.
|
||||
const key = hashAccountKey(paths.file);
|
||||
const login = readDatabaseLogin(paths.database);
|
||||
if (login) {
|
||||
return login.key
|
||||
const logins = readDatabaseLogins(paths.database);
|
||||
if (logins) {
|
||||
return logins.opencode || logins.go
|
||||
? [
|
||||
{
|
||||
key,
|
||||
@@ -42,13 +44,81 @@ export async function fetchUsage(
|
||||
input: Input,
|
||||
fetchApi: typeof fetch = fetch,
|
||||
): Promise<UsageReport> {
|
||||
const apiKey =
|
||||
input.store === "database" ? readDatabaseLogin(input.path)?.key : await readFileKey(input.path);
|
||||
if (!apiKey) throw new Error("OpenCode Go login store no longer exists");
|
||||
if (input.store === "file") {
|
||||
const key = await readFileKey(input.path);
|
||||
if (!key) throw new Error("OpenCode Go login store no longer exists");
|
||||
return readKey(key, fetchApi);
|
||||
}
|
||||
const logins = readDatabaseLogins(input.path);
|
||||
const only = logins?.opencode ?? logins?.go;
|
||||
if (!logins || !only) throw new Error("OpenCode Go login store no longer exists");
|
||||
if (logins.opencode && logins.go) return readEitherLogin(logins.opencode, logins.go, fetchApi);
|
||||
return readCredential(only, fetchApi, { workspaceKey: only === logins.opencode });
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenCode serves Go with the `opencode` credential whenever that Console workspace has Go, so
|
||||
* the card follows it. The `opencode-go` key serves Go when the Console refuses that credential.
|
||||
* A temporary failure keeps OpenCode on the `opencode` credential, so it throws instead.
|
||||
*/
|
||||
async function readEitherLogin(
|
||||
opencode: GoCredential,
|
||||
go: GoCredential,
|
||||
fetchApi: typeof fetch,
|
||||
): Promise<UsageReport> {
|
||||
if (opencode.type === "console") {
|
||||
const signIn = await readSignIn(opencode, fetchApi);
|
||||
if (signIn.status !== "unavailable") return signIn;
|
||||
const fallback = await readCredential(go, fetchApi);
|
||||
// A connected Console account explains a rejected fallback key better than the key does.
|
||||
return isRejected(fallback) ? signIn : fallback;
|
||||
}
|
||||
const primary = await readCredential(opencode, fetchApi, { workspaceKey: true });
|
||||
return primary.status === "unavailable" ? readCredential(go, fetchApi) : primary;
|
||||
}
|
||||
|
||||
function readCredential(
|
||||
credential: GoCredential,
|
||||
fetchApi: typeof fetch,
|
||||
options: { workspaceKey?: boolean } = {},
|
||||
): Promise<UsageReport> {
|
||||
return credential.type === "console"
|
||||
? readSignIn(credential, fetchApi)
|
||||
: readKey(credential.key, fetchApi, options);
|
||||
}
|
||||
|
||||
async function readSignIn(
|
||||
signIn: Extract<GoCredential, { type: "console" }>,
|
||||
fetchApi: typeof fetch,
|
||||
): Promise<UsageReport> {
|
||||
// OpenCode refreshes the sign-in itself; reading never competes with it.
|
||||
if (signIn.expires > 0 && signIn.expires <= Date.now())
|
||||
return unavailable({
|
||||
kind: "expired",
|
||||
expiresAt: new Date(signIn.expires).toISOString(),
|
||||
refreshedBy: "opencode",
|
||||
});
|
||||
return readConsoleGo({ token: signIn.access, orgID: signIn.orgID }, fetchApi);
|
||||
}
|
||||
|
||||
/**
|
||||
* A key reads the Console meters first, since the usage API floors each percent. Any Console
|
||||
* failure falls through to the usage API, which decides what the key's errors mean. The Console
|
||||
* gets a short budget so the usage API still answers within the daemon's 20 second refresh.
|
||||
*/
|
||||
async function readKey(
|
||||
key: string,
|
||||
fetchApi: typeof fetch,
|
||||
{ workspaceKey = false }: { workspaceKey?: boolean } = {},
|
||||
): Promise<UsageReport> {
|
||||
const fromConsole = await readConsoleGo({ token: key }, fetchApi, 3_000).catch(() => null);
|
||||
if (fromConsole?.status === "available") return fromConsole;
|
||||
const response = await fetchApi("https://opencode.ai/zen/go/v1/usage", {
|
||||
headers: { Authorization: `Bearer ${apiKey}`, Accept: "application/json" },
|
||||
headers: { Authorization: `Bearer ${key}`, Accept: "application/json" },
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
});
|
||||
// The usage API accepts any key of a Console workspace and refuses one without Go.
|
||||
if (response.status === 403 && workspaceKey) return NO_SUBSCRIPTION;
|
||||
if (response.status === 401 || response.status === 403)
|
||||
return unavailable({ kind: "rejected", status: response.status, refreshedBy: "opencode" });
|
||||
if (!response.ok) throw new Error(`OpenCode Go usage API returned ${response.status}`);
|
||||
@@ -72,3 +142,7 @@ export async function fetchUsage(
|
||||
);
|
||||
return { status: "available", planLabel: "Go", windows };
|
||||
}
|
||||
|
||||
function isRejected(report: UsageReport): boolean {
|
||||
return report.status === "unavailable" && report.problem.kind === "rejected";
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.17.3",
|
||||
"version": "0.17.4",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -13,7 +13,7 @@ Everything beyond the [supported providers](/docs/supported-providers) lives und
|
||||
- **Extend** a first-class provider to point at a different API (Z.AI, Alibaba/Qwen, a proxy, a self-hosted endpoint).
|
||||
- **Add profiles**, multiple entries against the same underlying provider with different credentials or curated model lists.
|
||||
- **Override the binary**, run a nightly build, a wrapper script, or a Docker image instead of the installed CLI.
|
||||
- **Add ACP agents**, Gemini CLI, Hermes, or any agent speaking the Agent Client Protocol over stdio.
|
||||
- **Add ACP agents**, Gemini CLI, Qwen Code, or any agent speaking the Agent Client Protocol over stdio.
|
||||
- **Disable** a provider you don't use.
|
||||
|
||||
Run `paseo reload` after editing the file. Provider changes apply to future launches without restarting the daemon.
|
||||
@@ -166,11 +166,6 @@ Any agent that speaks [ACP](https://agentclientprotocol.com) over stdio can be a
|
||||
"extends": "acp",
|
||||
"label": "Google Gemini",
|
||||
"command": ["gemini", "--acp"]
|
||||
},
|
||||
"hermes": {
|
||||
"extends": "acp",
|
||||
"label": "Hermes",
|
||||
"command": ["hermes", "acp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ nav: 自定义 Provider
|
||||
- **扩展**一个一等 Provider,让它指向不同的 API(Z.AI、阿里巴巴/通义千问、代理或自托管端点)。
|
||||
- **添加多个配置**:针对同一个底层 Provider 创建多个条目,使用不同的凭据或精选的模型列表。
|
||||
- **覆盖二进制文件**:运行 nightly 构建、包装脚本或 Docker 镜像,而不是已安装的 CLI。
|
||||
- **添加 ACP Agent**:Gemini CLI、Hermes,或任何通过 stdio 使用 Agent Client Protocol 的 Agent。
|
||||
- **添加 ACP Agent**:Gemini CLI、Qwen Code,或任何通过 stdio 使用 Agent Client Protocol 的 Agent。
|
||||
- **禁用**你不使用的 Provider。
|
||||
|
||||
编辑文件后运行 `paseo reload`。Provider 的修改会应用到之后的启动,无需重启 daemon。
|
||||
@@ -159,11 +159,6 @@ Z.AI 通过兼容 Anthropic 的端点提供 GLM 模型。把 `ANTHROPIC_BASE_URL
|
||||
"extends": "acp",
|
||||
"label": "Google Gemini",
|
||||
"command": ["gemini", "--acp"]
|
||||
},
|
||||
"hermes": {
|
||||
"extends": "acp",
|
||||
"label": "Hermes",
|
||||
"command": ["hermes", "acp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,9 +687,20 @@ export const vendorEdits: AcpTransformer = {
|
||||
};
|
||||
```
|
||||
|
||||
Set `detail` on the returned tool call to supply a Paseo tool card when the ACP kind does not
|
||||
describe the operation. For example, an agent can report a new file as an ACP edit, while the
|
||||
plugin returns a `write` detail with the file path and contents.
|
||||
Paseo builds a standard tool card from each call's ACP `kind`: Shell for `execute`, Read for `read`,
|
||||
Edit for `edit` and `delete`, Search for `search`, and Fetch for `fetch`. The card reads the call's
|
||||
`input` (ACP `rawInput`), `output` (`rawOutput`), `content`, and `locations`. A call of another kind
|
||||
shows its raw input and output, or its text content when the agent sends neither.
|
||||
|
||||
Set `detail` on the returned tool call to replace the standard card. For example, an agent can
|
||||
report a new file as an ACP edit, while the plugin returns a `write` detail with the file path and
|
||||
contents. Return `{ type: "unknown", input, output }` to show the raw values.
|
||||
|
||||
`toolCall` runs on every update of a call, with the updates merged so far. An update that sends
|
||||
`content` replaces the earlier content, as ACP defines. When an agent sends a value only in an
|
||||
early update, read it from `context.previous`, the call as Paseo last presented it. The
|
||||
[Hermes terminal transformer](https://github.com/getpaseo/paseo/blob/main/plugins/hermes-provider/server/terminal-command.ts)
|
||||
keeps the command from Hermes's first update this way.
|
||||
|
||||
Use `sessionOpen` when an ACP agent needs extension metadata on `session/new` or `session/load`.
|
||||
The hook receives the system prompt and the agent capabilities' `_meta` from `initialize`.
|
||||
|
||||
@@ -573,6 +573,12 @@ export const vendorEdits: AcpTransformer = {
|
||||
};
|
||||
```
|
||||
|
||||
Paseo 根据每个调用的 ACP `kind` 生成标准工具卡片:`execute` 显示为 Shell,`read` 显示为 Read,`edit` 和 `delete` 显示为 Edit,`search` 显示为 Search,`fetch` 显示为 Fetch。卡片读取调用的 `input`(ACP `rawInput`)、`output`(`rawOutput`)、`content` 和 `locations`。其他类型的调用显示原始输入和输出;如果 Agent 两者都没有发送,则显示文本内容。
|
||||
|
||||
在返回的工具调用上设置 `detail` 可以替换标准卡片。例如,Agent 可能把新建文件报告为 ACP 编辑,而插件返回带有文件路径和内容的 `write` detail。返回 `{ type: "unknown", input, output }` 可以显示原始值。
|
||||
|
||||
`toolCall` 会在调用的每次更新时运行,参数是到目前为止合并后的调用。按照 ACP 的定义,发送了 `content` 的更新会替换之前的内容。如果 Agent 只在较早的更新中发送某个值,请从 `context.previous` 读取,它是 Paseo 上一次展示的调用。[Hermes 终端转换器](https://github.com/getpaseo/paseo/blob/main/plugins/hermes-provider/server/terminal-command.ts)就是这样保留 Hermes 第一次更新中的命令。
|
||||
|
||||
如果 Agent 只为当前选中的模型列出 `thought_level` 选项,请设置 `acpOptions.perModelThinkingOptions`。目录发现会依次选中每个模型,并为它记录 Agent 列出的思考选项。没有 `thought_level` 选项的模型不会显示思考选择器。
|
||||
|
||||
## 测试与发布 {#test-and-publish}
|
||||
|
||||
@@ -442,7 +442,10 @@ request. The promise returns a JSON value or rejects with the agent's JSON-RPC e
|
||||
|
||||
In `toolCall`, use `context.mcpServerNames` to recognize servers that Paseo supplied when it opened
|
||||
the ACP session. Include an empty-list fallback for older SDK versions or servers configured
|
||||
directly in the agent.
|
||||
directly in the agent. `toolCall.content` holds the call's ACP `content` blocks, and
|
||||
`context.previous` is the call as Paseo last presented it, after every transformer. Both are absent
|
||||
on older SDK versions, and `previous` is absent on a call's first update. See
|
||||
[Adapt an ACP agent](/docs/plugins/providers#adapt-an-acp-agent) for the standard tool cards.
|
||||
|
||||
Use `config(state, context)` to return the configuration snapshot that Paseo displays.
|
||||
Paseo calls this synchronous hook for initial, notification, and committed configuration snapshots.
|
||||
|
||||
@@ -369,7 +369,9 @@ Paseo 刷新 Agent 的方式是关闭它当前的 Provider 会话,再用当前
|
||||
Promise 返回 JSON 值,或以 Agent 的 JSON-RPC 错误拒绝。
|
||||
|
||||
在 `toolCall` 中,通过 `context.mcpServerNames` 识别 Paseo 打开 ACP 会话时提供的服务器。
|
||||
兼容旧版 SDK 或处理直接在 agent 中配置的服务器时,可以回退到空列表。
|
||||
兼容旧版 SDK 或处理直接在 agent 中配置的服务器时,可以回退到空列表。`toolCall.content` 包含调用的 ACP `content` 块,
|
||||
`context.previous` 是 Paseo 上一次展示的调用(经过所有转换器之后)。旧版 SDK 中两者都不存在;调用的第一次更新没有 `previous`。
|
||||
标准工具卡片见[适配 ACP Agent](/zh-CN/docs/plugins/providers#adapt-an-acp-agent)。
|
||||
|
||||
使用 `config(state, context)` 返回 Paseo 显示的配置快照。
|
||||
Paseo 在会话就绪、收到配置通知或提交配置更改时调用此同步钩子。
|
||||
|
||||
@@ -59,7 +59,7 @@ Entries that launch through `npx` or `uvx` need only that tool on your daemon ho
|
||||
- [GLM Agent](https://github.com/stefandevo/glm-acp-agent), Zhipu AI's GLM coding agent.
|
||||
- [goose](https://block.github.io/goose/), Block's local open-source AI agent. Paseo lists models from all providers configured in goose when goose supports model inventory discovery.
|
||||
- [Grok](https://docs.x.ai/build/overview), xAI's Grok Build agentic coding CLI.
|
||||
- [Hermes Agent](https://hermes-agent.nousresearch.com/docs/user-guide/features/acp), Nous Research's self-improving agent.
|
||||
- [Hermes Agent](https://hermes-agent.nousresearch.com/docs/user-guide/features/acp), Nous Research's self-improving agent. Paseo shows the full command of each terminal call.
|
||||
- [Junie](https://junie.jetbrains.com/docs/junie-cli-acp.html), JetBrains' coding agent.
|
||||
- [Kilo Code](https://kilo.ai/docs/code-with-ai/platforms/cli), open-source coding agent.
|
||||
- [Kimi Code CLI](https://github.com/MoonshotAI/kimi-code), Moonshot AI's coding assistant.
|
||||
|
||||
@@ -57,7 +57,7 @@ Paseo 可以运行任何使用 [Agent Client Protocol](https://agentclientprotoc
|
||||
- [GLM Agent](https://github.com/stefandevo/glm-acp-agent):智谱 AI 的 GLM 编程 Agent。
|
||||
- [goose](https://block.github.io/goose/):Block 的本地开源 AI Agent。如果 goose 支持发现模型清单,Paseo 会列出 goose 中所有已配置 Provider 的模型。
|
||||
- [Grok](https://docs.x.ai/build/overview):xAI 的 Grok Build Agent 编程 CLI。
|
||||
- [Hermes Agent](https://hermes-agent.nousresearch.com/docs/user-guide/features/acp):Nous Research 的自我改进型 Agent。
|
||||
- [Hermes Agent](https://hermes-agent.nousresearch.com/docs/user-guide/features/acp):Nous Research 的自我改进型 Agent。Paseo 会显示每次终端调用的完整命令。
|
||||
- [Junie](https://junie.jetbrains.com/docs/junie-cli-acp.html):JetBrains 的编程 Agent。
|
||||
- [Kilo Code](https://kilo.ai/docs/code-with-ai/platforms/cli):开源编程 Agent。
|
||||
- [Kimi Code CLI](https://github.com/MoonshotAI/kimi-code):月之暗面的编程助手。
|
||||
|
||||
Reference in New Issue
Block a user