Compare commits

..
Author SHA1 Message Date
Mohamed Boudra 6c89950b2e chore(release): cut 0.17.0-beta.1 2026-11-19 14:48:37 +01:00
Mohamed Boudra fbbfcf42bc docs(changelog): prepare 0.17.0 beta 2026-11-19 14:43:29 +01:00
23 changed files with 229 additions and 1241 deletions
+52
View File
@@ -1,5 +1,57 @@
# Changelog
## 0.17.0-beta.1 - 2026-11-19
- **Use existing worktrees:** Start a workspace in a worktree you already have, or create one from any branch or pull request. ([#10190](https://github.com/getpaseo/paseo/pull/10190))
- **Antigravity approvals and history:** Pick a permission mode, answer tool approvals, import CLI sessions and see your history when you reopen a chat. ([#10193](https://github.com/getpaseo/paseo/pull/10193))
- **Watch pull requests:** Agents can watch a GitHub PR and get notified when checks, reviews or comments change. ([#10148](https://github.com/getpaseo/paseo/pull/10148))
- **Heartbeats in Background work:** See and stop an agent's heartbeats next to its background tasks. ([#10097](https://github.com/getpaseo/paseo/pull/10097), [#10216](https://github.com/getpaseo/paseo/pull/10216))
- **Agent messages wait their turn:** Reports and notifications from other agents arrive when the current turn ends instead of interrupting it. ([#9757](https://github.com/getpaseo/paseo/pull/9757))
- **Plugin agent instructions:** Plugins can add their own instructions to agents. ([#9781](https://github.com/getpaseo/paseo/pull/9781))
### Added
- Added shortcuts to open the model picker and cycle thinking levels with Cmd/Ctrl+/ and Cmd/Ctrl+Shift+/ ([#10147](https://github.com/getpaseo/paseo/pull/10147))
- Added agent settings to Command Center search before the first message ([#10182](https://github.com/getpaseo/paseo/pull/10182) by [@cleiter](https://github.com/cleiter))
- Added Rewind to Command Center for the latest turn ([#10144](https://github.com/getpaseo/paseo/pull/10144))
- Added a separate Ultracode toggle for eligible Claude models ([#10150](https://github.com/getpaseo/paseo/pull/10150) by [@fivetaku](https://github.com/fivetaku))
- Added Flex speed for Codex ([#9809](https://github.com/getpaseo/paseo/pull/9809) by [@qjqqyy](https://github.com/qjqqyy))
- Added syntax highlighting for shell scripts and Dockerfiles ([#10178](https://github.com/getpaseo/paseo/pull/10178))
- Added labels and workspace IDs to `paseo ls --json` ([#10076](https://github.com/getpaseo/paseo/pull/10076))
### Changed
- Changed `browser_new_tab` to ask agents to choose a Desktop when several are connected ([#10189](https://github.com/getpaseo/paseo/pull/10189))
- Changed workspace Git status to reuse its snapshot after a short reconnect when the checkout has not changed ([#10142](https://github.com/getpaseo/paseo/pull/10142) by [@VladimirGVP](https://github.com/VladimirGVP))
- Changed workspace navigation to acknowledge taps promptly and initially load fewer offscreen chat rows on mobile ([#9887](https://github.com/getpaseo/paseo/pull/9887))
- Changed worktree teardown to stop after one minute by default and keep the worktree; set `worktree.teardownTimeoutMs` in `paseo.json` for longer commands ([#9852](https://github.com/getpaseo/paseo/pull/9852) by [@ragokan](https://github.com/ragokan))
### Fixed
- Fixed Collapse turns hiding a finished OMP or Pi reply when an idle provider notice appears ([#10135](https://github.com/getpaseo/paseo/pull/10135))
- Fixed repeated finish notifications while an agent responds to background tasks and its earlier finish is unread ([#10200](https://github.com/getpaseo/paseo/pull/10200))
- Fixed an empty chat losing the prompt and start of a reply after reconnecting mid-reply ([#9723](https://github.com/getpaseo/paseo/pull/9723) by [@ragokan](https://github.com/ragokan))
- Fixed changes between Claude thinking levels stopping its background work ([#10008](https://github.com/getpaseo/paseo/pull/10008) by [@gilad-rubin](https://github.com/gilad-rubin))
- Fixed OpenCode turns staying running after a shared OpenCode service stops ([#10187](https://github.com/getpaseo/paseo/pull/10187))
- Fixed OMP denying an approved tool call when session or grant choices were offered ([#10126](https://github.com/getpaseo/paseo/pull/10126) by [@dsingal0](https://github.com/dsingal0))
- Fixed Changes failing to open when Git metadata watching reaches its limit ([#10188](https://github.com/getpaseo/paseo/pull/10188))
- Fixed copying selected reply text into plain-text targets with unwanted Markdown syntax ([#10079](https://github.com/getpaseo/paseo/pull/10079) by [@danberindei](https://github.com/danberindei))
- Fixed file views losing their scroll position when switching Preview and Source, except HTML previews on iOS ([#10195](https://github.com/getpaseo/paseo/pull/10195) by [@apple-ouyang](https://github.com/apple-ouyang))
- Fixed file tabs in split panes showing or focusing the wrong file ([#9888](https://github.com/getpaseo/paseo/pull/9888) by [@KosmoCHE](https://github.com/KosmoCHE))
- Fixed touch-screen submenus closing as soon as they open ([#10175](https://github.com/getpaseo/paseo/pull/10175) by [@christiantwu](https://github.com/christiantwu))
- Fixed dictation failing after another chat that used the microphone closes ([#10185](https://github.com/getpaseo/paseo/pull/10185) by [@Brandon168](https://github.com/Brandon168))
- Fixed composer taps being lost on Android after zooming a chat image ([#10057](https://github.com/getpaseo/paseo/pull/10057))
- Fixed clipped text on Samsung DeX ([#9995](https://github.com/getpaseo/paseo/pull/9995) by [@easyhunjune](https://github.com/easyhunjune))
- Fixed workspace images in chat failing to load after a slow host connection ([#10111](https://github.com/getpaseo/paseo/pull/10111) by [@ragokan](https://github.com/ragokan))
- Fixed desktop browser screenshots returning fully transparent images ([#9807](https://github.com/getpaseo/paseo/pull/9807) by [@monarchmaisuriya](https://github.com/monarchmaisuriya))
- Fixed Mermaid flowcharts with `@` in labels showing source instead of the diagram ([#10165](https://github.com/getpaseo/paseo/pull/10165) by [@monarchmaisuriya](https://github.com/monarchmaisuriya))
- Fixed hidden background workspaces triggering the dock badge and favicon ([#9983](https://github.com/getpaseo/paseo/pull/9983))
- Fixed desktop sidebar navigation crowding out workspaces ([#9903](https://github.com/getpaseo/paseo/pull/9903) by [@pentatonic-alex](https://github.com/pentatonic-alex))
- Fixed plugin agents failing to reopen after their provider closes the session ([#10153](https://github.com/getpaseo/paseo/pull/10153))
- Fixed plugin screens and settings failing to use plugin state hooks ([#10049](https://github.com/getpaseo/paseo/pull/10049))
- Fixed a Codex message stopped before its turn starts showing an error instead of canceled ([#9931](https://github.com/getpaseo/paseo/pull/9931) by [@3ae3ae](https://github.com/3ae3ae))
- Fixed historical closed PR badges appearing on a repository's default branch ([#10053](https://github.com/getpaseo/paseo/pull/10053))
## 0.16.2 - 2026-11-18
### Fixed
+52
View File
@@ -1,5 +1,57 @@
# Changelog
## 0.17.0-beta.1 - 2026-11-19
- **使用现有 worktree**:在已有的 worktree 中启动工作区,或从任意分支或 PR 创建 worktree。([#10190](https://github.com/getpaseo/paseo/pull/10190))
- **Antigravity 审批和历史记录**:选择权限模式、回复工具审批、导入 CLI 会话,并在重新打开对话时查看历史记录。([#10193](https://github.com/getpaseo/paseo/pull/10193))
- **监视 PR**:Agent 可以监视 GitHub PR,在检查、审查或评论有变化时收到通知。([#10148](https://github.com/getpaseo/paseo/pull/10148))
- **在后台任务中查看 heartbeat**:在 Agent 的后台任务旁查看和停止 heartbeat。([#10097](https://github.com/getpaseo/paseo/pull/10097), [#10216](https://github.com/getpaseo/paseo/pull/10216))
- **Agent 消息排队等待**:其他 Agent 的报告和通知会在当前轮次结束后到达,不会打断当前轮次。([#9757](https://github.com/getpaseo/paseo/pull/9757))
- **插件 Agent 指令**:插件可以向 Agent 添加自己的指令。([#9781](https://github.com/getpaseo/paseo/pull/9781))
### 新增
- 新增 Cmd/Ctrl+/ 和 Cmd/Ctrl+Shift+/ 快捷键,用于打开模型选择器和切换思考级别 ([#10147](https://github.com/getpaseo/paseo/pull/10147))
- 新增在发送第一条消息前通过命令中心搜索 Agent 设置 ([#10182](https://github.com/getpaseo/paseo/pull/10182),贡献者:[@cleiter](https://github.com/cleiter))
- 新增在命令中心回退最近轮次的操作 ([#10144](https://github.com/getpaseo/paseo/pull/10144))
- 新增符合条件的 Claude 模型的独立 Ultracode 开关 ([#10150](https://github.com/getpaseo/paseo/pull/10150),贡献者:[@fivetaku](https://github.com/fivetaku))
- 新增 Codex Flex 速度选项 ([#9809](https://github.com/getpaseo/paseo/pull/9809),贡献者:[@qjqqyy](https://github.com/qjqqyy))
- 新增 shell 脚本和 Dockerfile 的语法高亮 ([#10178](https://github.com/getpaseo/paseo/pull/10178))
- 新增 `paseo ls --json` 输出的标签和工作区 ID ([#10076](https://github.com/getpaseo/paseo/pull/10076))
### 变更
- 连接多个 Desktop 时,`browser_new_tab` 会让 Agent 选择打开标签页的 Desktop ([#10189](https://github.com/getpaseo/paseo/pull/10189))
- 工作区 Git 状态在短暂重连且检出的内容未更改时复用之前的快照 ([#10142](https://github.com/getpaseo/paseo/pull/10142),贡献者:[@VladimirGVP](https://github.com/VladimirGVP))
- 工作区导航会立即响应点击,并在手机端初始加载时减少屏幕外的对话行数 ([#9887](https://github.com/getpaseo/paseo/pull/9887))
- worktree 清理命令默认在一分钟后停止并保留 worktree;如需更长时间,可在 `paseo.json` 中设置 `worktree.teardownTimeoutMs` ([#9852](https://github.com/getpaseo/paseo/pull/9852),贡献者:[@ragokan](https://github.com/ragokan))
### 修复
- 修复启用“折叠轮次”时,空闲的 Provider 通知导致已完成的 OMP 或 Pi 回复被隐藏的问题 ([#10135](https://github.com/getpaseo/paseo/pull/10135))
- 修复 Agent 响应后台任务时,在之前的完成状态未读的情况下重复发送完成通知的问题 ([#10200](https://github.com/getpaseo/paseo/pull/10200))
- 修复空对话在回复中途重连后丢失提示词和回复开头的问题 ([#9723](https://github.com/getpaseo/paseo/pull/9723),贡献者:[@ragokan](https://github.com/ragokan))
- 修复切换 Claude 思考级别时停止后台任务的问题 ([#10008](https://github.com/getpaseo/paseo/pull/10008),贡献者:[@gilad-rubin](https://github.com/gilad-rubin))
- 修复共享 OpenCode 服务停止后轮次一直显示为运行中的问题 ([#10187](https://github.com/getpaseo/paseo/pull/10187))
- 修复 OMP 提供会话或授权选项时拒绝已批准工具调用的问题 ([#10126](https://github.com/getpaseo/paseo/pull/10126),贡献者:[@dsingal0](https://github.com/dsingal0))
- 修复 Git 元数据监听达到上限时无法打开“更改”的问题 ([#10188](https://github.com/getpaseo/paseo/pull/10188))
- 修复将选中的回复复制到纯文本目标时出现多余 Markdown 语法的问题 ([#10079](https://github.com/getpaseo/paseo/pull/10079),贡献者:[@danberindei](https://github.com/danberindei))
- 修复在预览和源码之间切换时文件视图丢失滚动位置的问题,iOS 的 HTML 预览除外 ([#10195](https://github.com/getpaseo/paseo/pull/10195),贡献者:[@apple-ouyang](https://github.com/apple-ouyang))
- 修复拆分窗格中的文件标签页显示或聚焦错误文件的问题 ([#9888](https://github.com/getpaseo/paseo/pull/9888),贡献者:[@KosmoCHE](https://github.com/KosmoCHE))
- 修复触摸屏上的子菜单打开后立即关闭的问题 ([#10175](https://github.com/getpaseo/paseo/pull/10175),贡献者:[@christiantwu](https://github.com/christiantwu))
- 修复关闭另一个使用过麦克风的对话后无法听写的问题 ([#10185](https://github.com/getpaseo/paseo/pull/10185),贡献者:[@Brandon168](https://github.com/Brandon168))
- 修复 Android 缩放对话图片后 Composer 点击失效的问题 ([#10057](https://github.com/getpaseo/paseo/pull/10057))
- 修复 Samsung DeX 上的文字被裁剪的问题 ([#9995](https://github.com/getpaseo/paseo/pull/9995),贡献者:[@easyhunjune](https://github.com/easyhunjune))
- 修复主机连接缓慢后对话中的工作区图片无法加载的问题 ([#10111](https://github.com/getpaseo/paseo/pull/10111),贡献者:[@ragokan](https://github.com/ragokan))
- 修复桌面浏览器截图返回全透明图片的问题 ([#9807](https://github.com/getpaseo/paseo/pull/9807),贡献者:[@monarchmaisuriya](https://github.com/monarchmaisuriya))
- 修复 Mermaid 流程图标签含有 `@` 时显示源码而非图表的问题 ([#10165](https://github.com/getpaseo/paseo/pull/10165),贡献者:[@monarchmaisuriya](https://github.com/monarchmaisuriya))
- 修复隐藏的后台工作区触发程序坞徽标和网站图标状态的问题 ([#9983](https://github.com/getpaseo/paseo/pull/9983))
- 修复桌面侧边栏导航占满工作区列表空间的问题 ([#9903](https://github.com/getpaseo/paseo/pull/9903),贡献者:[@pentatonic-alex](https://github.com/pentatonic-alex))
- 修复 Provider 关闭会话后插件 Agent 无法重新打开的问题 ([#10153](https://github.com/getpaseo/paseo/pull/10153))
- 修复插件页面和设置无法使用插件状态钩子的问题 ([#10049](https://github.com/getpaseo/paseo/pull/10049))
- 修复 Codex 消息在轮次开始前停止时显示错误而非已取消的问题 ([#9931](https://github.com/getpaseo/paseo/pull/9931),贡献者:[@3ae3ae](https://github.com/3ae3ae))
- 修复仓库默认分支显示历史已关闭 PR 徽标的问题 ([#10053](https://github.com/getpaseo/paseo/pull/10053))
## 0.16.2 - 2026-11-18
### 修复
+28 -28
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -37468,7 +37468,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -39637,13 +39637,13 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "Apache-2.0",
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.16.2",
"@getpaseo/protocol": "0.16.2",
"@getpaseo/server": "0.16.2",
"@getpaseo/client": "0.17.0-beta.1",
"@getpaseo/protocol": "0.17.0-beta.1",
"@getpaseo/server": "0.17.0-beta.1",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
@@ -39890,11 +39890,11 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/protocol": "0.16.2",
"@getpaseo/relay": "0.16.2",
"@getpaseo/protocol": "0.17.0-beta.1",
"@getpaseo/relay": "0.17.0-beta.1",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
@@ -39906,7 +39906,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40149,7 +40149,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40195,7 +40195,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/language": "6.12.4",
@@ -40225,7 +40225,7 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^1.4.0",
@@ -40233,8 +40233,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.16.2",
"@getpaseo/protocol": "0.16.2",
"@getpaseo/client": "0.17.0-beta.1",
"@getpaseo/protocol": "0.17.0-beta.1",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -40244,8 +40244,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.16.2",
"@getpaseo/protocol": "0.16.2",
"@getpaseo/client": "0.17.0-beta.1",
"@getpaseo/protocol": "0.17.0-beta.1",
"react": ">=19.1.0 <20",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
@@ -40267,7 +40267,7 @@
},
"packages/protocol": {
"name": "@getpaseo/protocol",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "Apache-2.0",
"dependencies": {
"semver": "^7.8.5",
@@ -40295,7 +40295,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^2.4.0",
@@ -40517,17 +40517,17 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"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.16.2",
"@getpaseo/highlight": "0.16.2",
"@getpaseo/plugin": "0.16.2",
"@getpaseo/protocol": "0.16.2",
"@getpaseo/relay": "0.16.2",
"@getpaseo/client": "0.17.0-beta.1",
"@getpaseo/highlight": "0.17.0-beta.1",
"@getpaseo/plugin": "0.17.0-beta.1",
"@getpaseo/protocol": "0.17.0-beta.1",
"@getpaseo/relay": "0.17.0-beta.1",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/sdk": "1.29.0",
"@opencode-ai/sdk": "1.14.46",
@@ -41474,7 +41474,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
@@ -43084,7 +43084,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
@@ -503,35 +503,6 @@ test.describe("terminal history with a finger", () => {
await expectMouseWheelScrollsHistory(page);
});
test("finger scrolling leaves the keyboard closed and a tap focuses input", async ({ page }) => {
await openPhoneTerminalHistory(page);
await input(page).evaluate((element) => element.blur());
await expect(input(page)).not.toBeFocused();
await expectSingleFingerScroll(page, 24);
await expect(input(page)).not.toBeFocused();
await expectSingleFingerScroll(page, 1);
await expect(input(page)).not.toBeFocused();
await tapTerminalScreen(page);
await expect(input(page)).toBeFocused();
// Android's Back button hides the IME without blurring this input.
await expectSingleFingerScroll(page, 24);
await expect(input(page)).not.toBeFocused();
await terminalScreen(page).click();
await expect(input(page)).toBeFocused();
});
test("finger scrolling keeps an open keyboard open", async ({ page }) => {
await openPhoneTerminalHistory(page);
await tapTerminalScreen(page);
await expect(input(page)).toBeFocused();
await showSoftwareKeyboard(page);
await expectSingleFingerScroll(page, 24);
await expect(input(page)).toBeFocused();
});
for (const mode of ["alternate", "mouse"] as const) {
test(`preserves finger navigation in ${mode} input mode`, async ({ page }) => {
await openPhoneInputCapture(page, mode);
@@ -560,32 +531,6 @@ async function openPhoneTerminalHistory(page: Page) {
});
await openPhoneTerminal(page);
await expect.poll(() => getTerminalBufferText(page)).toContain("HISTORY_150");
await expect
.poll(() => page.evaluate(() => window.__paseoTerminal!.buffer.active.baseY))
.toBeGreaterThan(0);
await page.evaluate(() => window.__paseoTerminal!.scrollToBottom());
await expect.poll(() => viewport(page)).toBeGreaterThan(0);
}
function terminalScreen(page: Page) {
return page.getByTestId("terminal-surface").filter({ visible: true }).locator(".xterm-screen");
}
async function tapTerminalScreen(page: Page) {
const box = await terminalScreen(page).boundingBox();
expect(box).not.toBeNull();
await page.touchscreen.tap(box!.x + box!.width / 2, box!.y + box!.height / 3);
}
// Playwright cannot show a software keyboard. A phone browser keeps the layout
// viewport and shortens the visual viewport by the keyboard height.
async function showSoftwareKeyboard(page: Page) {
await page.evaluate(() => {
Object.defineProperty(window.visualViewport!, "height", {
configurable: true,
get: () => window.innerHeight - 300,
});
});
}
async function openPhoneInputCapture(page: Page, mode: "alternate" | "mouse") {
@@ -625,20 +570,6 @@ async function openPhoneTerminal(page: Page) {
await page.getByTestId(`sidebar-workspace-row-${getServerId()}:${harness.workspaceId}`).click();
await expect(page.getByRole("textbox", { name: "Terminal input" })).toBeVisible();
await expect(page.getByTestId("terminal-surface").filter({ visible: true })).toBeVisible();
// The terminal stays mounted while the sidebar's closing backdrop still intercepts input.
await expect
.poll(() =>
page
.getByTestId("terminal-surface")
.filter({ visible: true })
.evaluate((root) => {
const box = root.querySelector(".xterm-screen")!.getBoundingClientRect();
return root.contains(
document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 3),
);
}),
)
.toBe(true);
}
async function expectMouseWheelScrollsHistory(page: Page) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"private": true,
"main": "index.ts",
"scripts": {
@@ -13,7 +13,6 @@ import {
useRef,
type CSSProperties,
type MouseEvent as ReactMouseEvent,
type PointerEvent as ReactPointerEvent,
type Ref,
} from "react";
import type { DOMProps } from "expo/dom";
@@ -64,22 +63,6 @@ const HOST_DIV_STYLE: CSSProperties = {
paddingRight: 0,
};
interface TerminalTouchFocus {
pointerId: number;
x: number;
y: number;
}
// A phone browser shortens the visual viewport, not the layout viewport, for its keyboard.
const SOFTWARE_KEYBOARD_MIN_HEIGHT_PX = 100;
function isSoftwareKeyboardShown(): boolean {
const viewport = window.visualViewport;
if (!viewport) return false;
const visibleHeight = viewport.height * viewport.scale;
return window.innerHeight - visibleHeight > SOFTWARE_KEYBOARD_MIN_HEIGHT_PX;
}
function buildXtermThemeKey(theme: ITheme): string {
const values: Array<string> = [
theme.background,
@@ -570,48 +553,10 @@ export default function TerminalEmulator({
});
}, []);
const touchFocusRef = useRef<TerminalTouchFocus | null>(null);
const handleRootPointerDown = useCallback(
(event: ReactPointerEvent) => {
onFocus?.();
touchFocusRef.current = null;
if (event.pointerType !== "touch") {
runtimeRef.current?.focus();
return;
}
// Focusing before a touch becomes a tap opens the keyboard during a scroll.
if (event.isPrimary) {
touchFocusRef.current = {
pointerId: event.pointerId,
x: event.clientX,
y: event.clientY,
};
}
},
[onFocus],
);
const handleRootPointerMove = useCallback((event: ReactPointerEvent) => {
const touch = touchFocusRef.current;
if (touch?.pointerId !== event.pointerId) return;
if (Math.hypot(event.clientX - touch.x, event.clientY - touch.y) > 8) {
touchFocusRef.current = null;
// Android Back hides the keyboard but leaves the input focused, and a drag
// on a focused input reopens it. An open keyboard stays open while scrolling.
if (!isSoftwareKeyboardShown()) runtimeRef.current?.blur();
}
}, []);
const handleRootPointerUp = useCallback((event: ReactPointerEvent) => {
const touch = touchFocusRef.current;
touchFocusRef.current = null;
if (touch?.pointerId === event.pointerId) runtimeRef.current?.focus();
}, []);
const handleRootPointerCancel = useCallback(() => {
touchFocusRef.current = null;
}, []);
const handleRootPointerDown = useCallback(() => {
onFocus?.();
runtimeRef.current?.focus();
}, [onFocus]);
const handleRootContextMenu = useCallback(
(event: ReactMouseEvent) => {
@@ -643,9 +588,6 @@ export default function TerminalEmulator({
data-terminal-scrollbar-root="true"
style={rootDivStyle}
onPointerDown={handleRootPointerDown}
onPointerMove={handleRootPointerMove}
onPointerUp={handleRootPointerUp}
onPointerCancel={handleRootPointerCancel}
onContextMenu={handleRootContextMenu}
>
<div ref={hostRef} style={HOST_DIV_STYLE} />
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/cli",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"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.16.2",
"@getpaseo/protocol": "0.16.2",
"@getpaseo/server": "0.16.2",
"@getpaseo/client": "0.17.0-beta.1",
"@getpaseo/protocol": "0.17.0-beta.1",
"@getpaseo/server": "0.17.0-beta.1",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/client",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"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.16.2",
"@getpaseo/relay": "0.16.2",
"@getpaseo/protocol": "0.17.0-beta.1",
"@getpaseo/relay": "0.17.0-beta.1",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/desktop",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"private": true,
"description": "Paseo desktop app (Electron wrapper)",
"homepage": "https://paseo.sh",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/expo-two-way-audio",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"description": "Native module for two way audio streaming",
"keywords": [
"ExpoTwoWayAudio",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/highlight",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"license": "Apache-2.0",
"files": [
"dist",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/plugin",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"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.16.2",
"@getpaseo/protocol": "0.16.2",
"@getpaseo/client": "0.17.0-beta.1",
"@getpaseo/protocol": "0.17.0-beta.1",
"@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.16.2",
"@getpaseo/protocol": "0.16.2",
"@getpaseo/client": "0.17.0-beta.1",
"@getpaseo/protocol": "0.17.0-beta.1",
"react": ">=19.1.0 <20",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/protocol",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"description": "Paseo shared protocol schemas and wire types",
"license": "Apache-2.0",
"files": [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/relay",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"description": "Paseo relay for bridging daemon and client connections",
"license": "Apache-2.0",
"files": [
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/server",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"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.16.2",
"@getpaseo/highlight": "0.16.2",
"@getpaseo/plugin": "0.16.2",
"@getpaseo/protocol": "0.16.2",
"@getpaseo/relay": "0.16.2",
"@getpaseo/client": "0.17.0-beta.1",
"@getpaseo/highlight": "0.17.0-beta.1",
"@getpaseo/plugin": "0.17.0-beta.1",
"@getpaseo/protocol": "0.17.0-beta.1",
"@getpaseo/relay": "0.17.0-beta.1",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/sdk": "1.29.0",
"@opencode-ai/sdk": "1.14.46",
@@ -64,7 +64,6 @@ import {
mapCodexToolCallEnvelope,
mapCodexToolCallFromThreadItem,
normalizeCommandExecutionCommand,
normalizeCollabAgentChildStatus,
splitCodexMcpToolResultImages,
} from "./codex/tool-call-mapper.js";
import { normalizeCodexFilePath } from "./codex/tool-call-detail-parser.js";
@@ -104,7 +103,6 @@ import { codexAppServerStartup } from "./codex/app-server-startup.js";
import { type CodexUserMessageTurnIndex, revertCodexConversation } from "./codex/rewind.js";
import {
type CodexHistoryRow,
type CodexHistoryStatus,
CodexThreadHistoryTooLargeError,
readCodexThreadHistory,
} from "./codex/thread-history.js";
@@ -559,14 +557,12 @@ interface CodexThreadHistory {
interface PersistedSubAgentRoute {
childThreadId: string;
entry: PersistedTimelineEntry;
legacyCollaboration: boolean;
toolCall: ToolCallTimelineItem;
}
interface CodexThreadHistoryProjection {
timeline: PersistedTimelineEntry[];
subAgentRoutes: PersistedSubAgentRoute[];
status: CodexHistoryStatus | null;
}
function mergeCodexConfiguredDefaults(
@@ -1980,94 +1976,6 @@ function readCodexSubAgentActivity(item: unknown): CodexSubAgentActivity | null
};
}
interface CodexCollabAgentUpdate {
threadId: string;
status: ToolCallTimelineItem["status"];
preservesTerminal: boolean;
}
type CodexCollabAgentControl =
| { kind: "submission"; childThreadIds: string[] }
| { kind: "outcome"; childThreadIds: string[]; updates: CodexCollabAgentUpdate[] };
interface HistoricalCodexSubAgent {
timelineIndex: number;
pendingFollowUp: boolean;
legacyCollaboration: boolean;
}
function readCodexCollabAgentControl(item: unknown): CodexCollabAgentControl | null {
const record = toObjectRecord(item);
if (
!record ||
normalizeCodexThreadItemType(typeof record.type === "string" ? record.type : undefined) !==
"collabAgentToolCall" ||
record.tool === "spawnAgent"
) {
return null;
}
const tool = typeof record.tool === "string" ? record.tool : undefined;
const receivers = Array.isArray(record.receiverThreadIds)
? record.receiverThreadIds.filter((id): id is string => typeof id === "string")
: [];
if (tool === "sendInput") {
return record.status === "completed" && record.error == null
? { kind: "submission", childThreadIds: receivers }
: null;
}
if (tool !== "wait" && tool !== "closeAgent") return null;
const outcomeStates = toObjectRecord(record.agentsStates);
const updates = Object.entries(outcomeStates ?? {}).flatMap(
([threadId, value]): CodexCollabAgentUpdate[] => {
const state = toObjectRecord(value);
if (typeof state?.status !== "string") return [];
// Unlike a spawn snapshot, a control result can report the child's final error.
const status = normalizeCollabAgentChildStatus(state.status, tool);
return [
{
threadId,
status,
preservesTerminal: state.status === "shutdown" || record.tool === "closeAgent",
},
];
},
);
return {
kind: "outcome",
childThreadIds: [...new Set([...receivers, ...updates.map((update) => update.threadId)])],
updates,
};
}
function resolveCodexCollabAgentUpdate(
previous: ToolCallTimelineItem["status"],
update: CodexCollabAgentUpdate,
): ToolCallTimelineItem["status"] {
if (
isTerminalSubAgentStatus(previous) &&
(update.preservesTerminal || update.status === "running")
) {
return previous;
}
return update.status;
}
function restoreCollabAgentCallFromChildHistory(
state: CodexSubAgentCallState,
recorded: ToolCallTimelineItem,
status: CodexHistoryStatus | null,
): void {
// A live event received during the read is newer than the history snapshot.
if (state.toolCall !== recorded || status === null) return;
// A stored child turn can predate a terminal parent outcome, such as a close.
// A currently active child is direct evidence that it is working again.
if (status !== "running" && isTerminalSubAgentStatus(recorded.status)) return;
state.toolCall =
status === "failed"
? { ...recorded, status, error: { message: "Sub-agent failed" } }
: { ...recorded, status, error: null };
}
function shouldIgnoreMirroredLifecycleItem(source: "item" | "codex_event", item: unknown): boolean {
return source === "codex_event" && !readCodexSubAgentActivity(item);
}
@@ -2108,7 +2016,7 @@ function updateHistoricalSubAgentActivity(
};
}
function readCodexSpawnedSubAgentThreadIds(item: unknown): string[] {
function readCodexHistoricalSubAgentThreadIds(item: unknown): string[] {
const activity = readCodexSubAgentActivity(item);
if (activity) {
return activity.kind === "started" ? [activity.agentThreadId] : [];
@@ -2271,95 +2179,46 @@ async function threadItemToTimelineEntries(
return [timelineItem, ...(await mcpToolResultImagesToTimeline(item))];
}
function updateHistoricalCollabAgentCalls(
timeline: PersistedTimelineEntry[],
subAgentsByThreadId: Map<string, HistoricalCodexSubAgent>,
item: unknown,
): boolean {
const control = readCodexCollabAgentControl(item);
if (!control) return false;
if (control.kind === "submission") {
for (const threadId of control.childThreadIds) {
const child = subAgentsByThreadId.get(threadId);
if (child) child.pendingFollowUp = true;
}
return false;
}
for (const update of control.updates) {
const child = subAgentsByThreadId.get(update.threadId);
const existing = child === undefined ? undefined : timeline[child.timelineIndex];
if (!child || existing?.item.type !== "tool_call") continue;
const status = child.pendingFollowUp
? update.status
: resolveCodexCollabAgentUpdate(existing.item.status, update);
child.pendingFollowUp = false;
const toolCall: ToolCallTimelineItem =
status === "failed"
? { ...existing.item, status, error: { message: "Sub-agent failed" } }
: { ...existing.item, status, error: null };
timeline[child.timelineIndex] = { ...existing, item: toolCall };
}
return (
control.childThreadIds.length > 0 &&
control.childThreadIds.every((id) => subAgentsByThreadId.has(id))
);
}
async function loadCodexThreadHistoryTimeline(params: {
client: CodexAppServerClientLike;
threadId: string;
cwd: string | null;
readLatestTurn?: boolean;
}): Promise<CodexThreadHistoryProjection> {
const timeline: PersistedTimelineEntry[] = [];
const subAgentsByThreadId = new Map<string, HistoricalCodexSubAgent>();
let status: CodexHistoryStatus | null = null;
const subAgentTimelineIndexByThreadId = new Map<string, number>();
try {
const history = await readCodexThreadHistory(params.client, params.threadId, {
readLatestTurn: params.readLatestTurn,
});
status = history.status;
await projectCodexThreadHistory(
{ cwd: params.cwd, rows: history.rows },
{
timeline,
subAgentsByThreadId,
},
);
await projectCodexThreadHistory(params, { timeline, subAgentTimelineIndexByThreadId });
} catch (error) {
if (!(error instanceof CodexThreadHistoryTooLargeError)) throw error;
// The session stays usable; the row says why the history stops here.
timeline.push({ item: { type: "notification", level: "warning", message: error.message } });
}
const subAgentRoutes = Array.from(subAgentsByThreadId.entries()).flatMap(
([childThreadId, child]): PersistedSubAgentRoute[] => {
const entry = timeline[child.timelineIndex];
return entry?.item.type === "tool_call" && entry.item.detail.type === "sub_agent"
? [{ childThreadId, entry, legacyCollaboration: child.legacyCollaboration }]
const subAgentRoutes = Array.from(subAgentTimelineIndexByThreadId.entries()).flatMap(
([childThreadId, timelineIndex]): PersistedSubAgentRoute[] => {
const item = timeline[timelineIndex]?.item;
return item?.type === "tool_call" && item.detail.type === "sub_agent"
? [{ childThreadId, toolCall: item }]
: [];
},
);
return { timeline, subAgentRoutes, status };
return { timeline, subAgentRoutes };
}
async function projectCodexThreadHistory(
params: { rows: Iterable<CodexHistoryRow> | AsyncIterable<CodexHistoryRow>; cwd: string | null },
params: { client: CodexAppServerClientLike; threadId: string; cwd: string | null },
projection: {
timeline: PersistedTimelineEntry[];
subAgentsByThreadId: Map<string, HistoricalCodexSubAgent>;
subAgentTimelineIndexByThreadId: Map<string, number>;
},
): Promise<void> {
const { timeline, subAgentsByThreadId } = projection;
for await (const row of params.rows) {
const { timeline, subAgentTimelineIndexByThreadId } = projection;
for await (const row of readCodexThreadHistory(params.client, params.threadId)) {
const { item } = row;
if (updateHistoricalCollabAgentCalls(timeline, subAgentsByThreadId, item)) {
continue;
}
const historicalSubAgentActivity = readCodexSubAgentActivity(item);
if (historicalSubAgentActivity) {
const existingIndex = subAgentsByThreadId.get(
const existingIndex = subAgentTimelineIndexByThreadId.get(
historicalSubAgentActivity.agentThreadId,
)?.timelineIndex;
);
if (existingIndex !== undefined) {
const activityTimelineItem = await threadItemToTimeline(item, { cwd: params.cwd });
updateHistoricalSubAgentActivity(
@@ -2389,12 +2248,8 @@ async function projectCodexThreadHistory(
? { providerTurnId: row.turnId }
: {}),
});
for (const childThreadId of readCodexSpawnedSubAgentThreadIds(item)) {
subAgentsByThreadId.set(childThreadId, {
timelineIndex: timeline.length - 1,
pendingFollowUp: false,
legacyCollaboration: historicalSubAgentActivity === null,
});
for (const childThreadId of readCodexHistoricalSubAgentThreadIds(item)) {
subAgentTimelineIndexByThreadId.set(childThreadId, timeline.length - 1);
}
}
}
@@ -4444,46 +4299,31 @@ export class CodexAppServerAgentSession implements AgentSession {
parentSubagentId: null as string | null,
}));
const visitedThreadIds = new Set(this.currentThreadId ? [this.currentThreadId] : []);
const replayed: {
route: PersistedSubAgentRoute;
state: CodexSubAgentCallState;
timeline: readonly PersistedTimelineEntry[];
}[] = [];
while (queue.length > 0 && visitedThreadIds.size < 100) {
const next = queue.shift();
if (!next || visitedThreadIds.has(next.route.childThreadId)) {
continue;
}
visitedThreadIds.add(next.route.childThreadId);
const toolCall = next.route.entry.item;
if (toolCall.type !== "tool_call") continue;
this.registerSubAgentToolCall({
timelineItem: toolCall,
timelineItem: next.route.toolCall,
rawItem: { agentThreadId: next.route.childThreadId },
childThreadIds: [next.route.childThreadId],
parentCallId: next.parentCallId,
parentSubagentId: next.parentSubagentId,
deferUpsert: true,
});
const state = this.subAgentCallsByCallId.get(toolCall.callId);
if (!state?.childThreadIds.has(next.route.childThreadId)) continue;
let timeline: readonly PersistedTimelineEntry[] = [];
try {
const childHistory = await loadCodexThreadHistoryTimeline({
client,
threadId: next.route.childThreadId,
cwd: this.config.cwd ?? null,
readLatestTurn:
next.route.legacyCollaboration && !isTerminalSubAgentStatus(toolCall.status),
});
if (next.route.legacyCollaboration) {
restoreCollabAgentCallFromChildHistory(state, toolCall, childHistory.status);
for (const entry of childHistory.timeline) {
this.emitProviderSubagentTimeline(next.route.childThreadId, entry.item, entry.timestamp);
}
timeline = childHistory.timeline;
for (const route of childHistory.subAgentRoutes) {
queue.push({
route,
parentCallId: toolCall.callId,
parentCallId: next.route.toolCall.callId,
parentSubagentId: next.route.childThreadId,
});
}
@@ -4493,17 +4333,6 @@ export class CodexAppServerAgentSession implements AgentSession {
"Failed to load persisted Codex child history",
);
}
replayed.push({ route: next.route, state, timeline });
}
// Settle nested cards before emitting the parent timelines that contain them.
for (const { route, state } of replayed) {
if (route.legacyCollaboration) route.entry.item = state.toolCall;
}
for (const { route, state, timeline } of replayed) {
this.emitProviderSubagentUpsert(route.childThreadId, state, state.toolCall.status);
for (const entry of timeline) {
this.emitProviderSubagentTimeline(route.childThreadId, entry.item, entry.timestamp);
}
}
}
@@ -6406,10 +6235,8 @@ export class CodexAppServerAgentSession implements AgentSession {
private registerSubAgentToolCall(params: {
timelineItem: ToolCallTimelineItem;
rawItem: { [key: string]: unknown };
childThreadIds: readonly string[];
parentCallId: string | null;
parentSubagentId: string | null;
deferUpsert?: boolean;
}): string[] {
const { timelineItem, rawItem, parentCallId, parentSubagentId } = params;
if (timelineItem.detail.type !== "sub_agent") {
@@ -6439,9 +6266,16 @@ export class CodexAppServerAgentSession implements AgentSession {
}
this.subAgentCallsByCallId.set(timelineItem.callId, state);
const childThreadIds = Array.from(new Set(params.childThreadIds)).filter(
(threadId) => threadId !== this.currentThreadId,
);
const receiverThreadIds = Array.isArray(rawItem.receiverThreadIds)
? rawItem.receiverThreadIds.filter((value): value is string => typeof value === "string")
: [];
const agentThreadId =
typeof rawItem.agentThreadId === "string" && rawItem.agentThreadId.length > 0
? rawItem.agentThreadId
: null;
const childThreadIds = Array.from(
new Set(agentThreadId ? [...receiverThreadIds, agentThreadId] : receiverThreadIds),
).filter((threadId) => threadId !== this.currentThreadId);
for (const receiverThreadId of childThreadIds) {
const owningCallId = this.subAgentCallIdByChildThreadId.get(receiverThreadId);
if (owningCallId && owningCallId !== timelineItem.callId) {
@@ -6449,43 +6283,12 @@ export class CodexAppServerAgentSession implements AgentSession {
}
this.subAgentCallIdByChildThreadId.set(receiverThreadId, timelineItem.callId);
state.childThreadIds.add(receiverThreadId);
if (!params.deferUpsert) {
this.emitProviderSubagentUpsert(receiverThreadId, state, timelineItem.status);
}
this.emitProviderSubagentUpsert(receiverThreadId, state, timelineItem.status);
}
return childThreadIds;
}
private handleRegisteredCollabAgentControl(
rawItem: { [key: string]: unknown },
control: CodexCollabAgentControl,
): boolean {
if (control.kind === "submission") return false;
for (const update of control.updates) {
const callId = this.subAgentCallIdByChildThreadId.get(update.threadId);
if (!callId) continue;
const state = this.subAgentCallsByCallId.get(callId);
if (!state) continue;
const status = resolveCodexCollabAgentUpdate(state.toolCall.status, update);
if (status !== state.toolCall.status) {
this.emitSubAgentActivityUpdate(callId, status);
}
}
// A control rendered at start must also render its completion, even if
// Codex's final result lists fewer receivers than its started record.
const hasOwnCard = typeof rawItem.id === "string" && this.subAgentCallsByCallId.has(rawItem.id);
return (
!hasOwnCard &&
control.childThreadIds.length > 0 &&
control.childThreadIds.every((id) => this.subAgentCallIdByChildThreadId.has(id))
);
}
private handleRegisteredSubAgentActivity(rawItem: { [key: string]: unknown }): boolean {
const control = readCodexCollabAgentControl(rawItem);
if (control) {
return this.handleRegisteredCollabAgentControl(rawItem, control);
}
const activity = readCodexSubAgentActivity(rawItem);
if (!activity) {
return false;
@@ -7425,7 +7228,6 @@ export class CodexAppServerAgentSession implements AgentSession {
? this.registerSubAgentToolCall({
timelineItem,
rawItem: parsed.item,
childThreadIds: readCodexSpawnedSubAgentThreadIds(parsed.item),
parentCallId: childSubAgentCallId,
parentSubagentId: resolveCodexParentSubagentId(childSubAgentCallId, parsed.threadId),
})
@@ -7599,7 +7401,6 @@ export class CodexAppServerAgentSession implements AgentSession {
const registeredChildThreadIds = this.registerSubAgentToolCall({
timelineItem,
rawItem: parsed.item,
childThreadIds: readCodexSpawnedSubAgentThreadIds(parsed.item),
parentCallId: childSubAgentCallId,
parentSubagentId: resolveCodexParentSubagentId(childSubAgentCallId, parsed.threadId),
});
@@ -1,692 +0,0 @@
import { describe, expect, test, vi } from "vitest";
import { CodexAppServerAgentSession } from "../codex-app-server-agent.js";
import { createTestLogger } from "../../../../test-utils/test-logger.js";
import { createFakeCodexAppServer } from "./test-utils/fake-app-server.js";
function collab(tool: string, states: Record<string, string>, id = tool) {
return {
type: "collabAgentToolCall",
id,
tool,
status: "completed",
prompt: tool === "spawnAgent" ? "Reply with a short result." : null,
receiverThreadIds: Object.keys(states),
agentsStates: Object.fromEntries(
Object.entries(states).map(([threadId, status]) => [threadId, { status }]),
),
};
}
interface ChildHistory {
status?: { type: string };
turns: { status: string; items?: unknown[] }[];
historyMode?: "paginated";
turnProbe?: "supported" | "unsupported";
}
async function replay(items: unknown[], children: Record<string, ChildHistory> = {}) {
const appServer = createFakeCodexAppServer({
"thread/read": (params) => {
const { threadId, includeTurns } = params as { threadId: string; includeTurns: boolean };
const child = children[threadId];
const turns = threadId === "parent" ? [{ items }] : (child?.turns ?? []);
return {
thread: {
status: child?.status,
historyMode: child?.historyMode,
turns: includeTurns ? turns : [],
},
};
},
"thread/items/list": () => ({ data: [], nextCursor: null }),
"thread/turns/list": (params) => {
const child = children[(params as { threadId: string }).threadId];
if (child?.turnProbe !== "supported") throw new Error("method not supported");
return { data: child.turns.slice(-1) };
},
});
const session = new CodexAppServerAgentSession(
{ provider: "codex", cwd: process.cwd(), modeId: "full-access" },
{ sessionId: "parent" },
createTestLogger(),
async () => appServer.child,
{},
false,
false,
false,
undefined,
"history",
);
try {
await session.connect();
const history = await Array.fromAsync(session.streamHistory());
for (const [threadId, child] of Object.entries(children)) {
// Status is recovered from the history we already read for this child.
expect(
appServer
.requests()
.flatMap(({ method, params }) =>
method === "thread/read" && (params as { threadId: string }).threadId === threadId
? [(params as { includeTurns: boolean }).includeTurns]
: [],
),
).toEqual(child.historyMode === "paginated" ? [false] : [false, true]);
expect(
appServer
.requests()
.filter(
({ method, params }) =>
method === "thread/turns/list" &&
(params as { threadId: string }).threadId === threadId,
),
).toMatchObject(
child.turnProbe
? [{ params: { threadId, limit: 1, itemsView: "notLoaded", sortDirection: "desc" } }]
: [],
);
}
return history;
} finally {
await session.close();
appServer.assertNoErrors();
}
}
describe("Codex collaboration history", () => {
test.each([
{ turn: "completed", expected: "completed" },
{ turn: "failed", expected: "failed" },
{ turn: "interrupted", expected: "canceled" },
])(
"recovers a $turn child even when the parent did not wait or close it",
async ({ turn, expected }) => {
const history = await replay(
[collab("spawnAgent", { first: "pendingInit" }, "spawn-first")],
{
first: {
status: { type: "notLoaded" },
turns: [{ status: "completed" }, { status: turn }],
},
},
);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [event.event.status]
: [],
),
).toEqual([expected]);
expect(
history.flatMap((event) =>
event.type === "timeline" && event.item.type === "tool_call" ? [event.item.status] : [],
),
).toEqual([expected]);
},
);
test("keeps a live child running when the rewound parent only has its earlier wait", async () => {
const history = await replay(
[
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("wait", { first: "completed" }),
],
{ first: { status: { type: "active" }, turns: [{ status: "completed" }] } },
);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [event.event.status]
: [],
),
).toEqual(["running"]);
expect(
history.flatMap((event) =>
event.type === "timeline" && event.item.type === "tool_call" ? [event.item.status] : [],
),
).toEqual(["running"]);
});
test("keeps a live completion received while the child history is loading", async () => {
const reading = Promise.withResolvers<void>();
const childReply = Promise.withResolvers<unknown>();
const appServer = createFakeCodexAppServer({
"thread/read": (params) => {
const { threadId, includeTurns } = params as { threadId: string; includeTurns: boolean };
if (!includeTurns) return { thread: {} };
if (threadId === "parent") {
return {
thread: {
turns: [{ items: [collab("spawnAgent", { first: "pendingInit" }, "spawn-first")] }],
},
};
}
reading.resolve();
return childReply.promise;
},
});
const session = new CodexAppServerAgentSession(
{ provider: "codex", cwd: process.cwd(), modeId: "full-access" },
{ sessionId: "parent" },
createTestLogger(),
async () => appServer.child,
);
const completed = Promise.withResolvers<void>();
session.subscribe((event) => {
if (
event.type === "timeline" &&
event.item.type === "tool_call" &&
event.item.callId === "spawn-first" &&
event.item.status === "completed"
) {
completed.resolve();
}
});
try {
await session.connect();
const restoring = Array.fromAsync(session.streamHistory());
await reading.promise;
appServer.completeTurn({ threadId: "first" });
await completed.promise;
childReply.resolve({ thread: { status: { type: "active" }, turns: [] } });
const history = await restoring;
expect(
history
.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [event.event.status]
: [],
)
.at(-1),
).toBe("completed");
expect(history.filter((event) => event.type === "timeline")).toMatchObject([
{ item: { callId: "spawn-first", status: "completed" } },
]);
} finally {
await session.close();
appServer.assertNoErrors();
}
});
test("does not let an older child turn override an explicit close", async () => {
const history = await replay(
[
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("closeAgent", { first: "running" }),
],
{ first: { status: { type: "notLoaded" }, turns: [{ status: "completed" }] } },
);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [event.event.status]
: [],
),
).toEqual(["canceled"]);
});
test("reads one turn without items for an unresolved paginated child", async () => {
const history = await replay(
[
collab("spawnAgent", { migrated: "pendingInit" }, "spawn-migrated"),
collab("spawnAgent", { settled: "pendingInit" }, "spawn-settled"),
collab("wait", { settled: "completed" }),
collab("spawnAgent", { unsupported: "pendingInit" }, "spawn-unsupported"),
],
{
migrated: {
historyMode: "paginated",
turns: [{ status: "failed" }],
turnProbe: "supported",
},
settled: { historyMode: "paginated", turns: [{ status: "completed" }] },
unsupported: { historyMode: "paginated", turns: [], turnProbe: "unsupported" },
},
);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [[event.event.id, event.event.status]]
: [],
),
).toEqual([
["migrated", "failed"],
["settled", "completed"],
["unsupported", "running"],
]);
});
test("settles a nested child's own card and descriptor", async () => {
const history = await replay([collab("spawnAgent", { first: "pendingInit" }, "spawn-first")], {
first: {
turns: [
{
status: "completed",
items: [collab("spawnAgent", { nested: "pendingInit" }, "spawn-nested")],
},
],
},
nested: { turns: [{ status: "interrupted" }] },
});
expect(history.filter((event) => event.type === "provider_subagent")).toMatchObject([
{ event: { type: "upsert", id: "first", status: "completed" } },
{
event: {
type: "timeline",
id: "first",
item: { callId: "spawn-nested", status: "canceled" },
},
},
{ event: { type: "upsert", id: "nested", parentSubagentId: "first", status: "canceled" } },
]);
});
test("restores completed children from nullable wait and close results", async () => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("spawnAgent", { second: "pendingInit" }, "spawn-second"),
collab("wait", { first: "completed" }, "wait-first"),
collab("wait", { second: "completed" }, "wait-second"),
collab("closeAgent", { first: "completed" }, "close-first"),
collab("closeAgent", { second: "completed" }, "close-second"),
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [{ id: event.event.id, status: event.event.status }]
: [],
),
).toEqual([
{ id: "first", status: "completed" },
{ id: "second", status: "completed" },
]);
});
test.each(["completed", "interrupted", "running"])(
"keeps follow-up instructions in replay without applying the %s submission snapshot",
async (submissionStatus) => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("wait", { first: "completed" }),
{ ...collab("sendInput", { first: submissionStatus }), prompt: "Now add tests" },
]);
expect(
history.flatMap((event) =>
event.type === "timeline" && event.item.type === "tool_call"
? [{ id: event.item.callId, status: event.item.status, detail: event.item.detail }]
: [],
),
).toEqual([
{ id: "spawn-first", status: "completed", detail: expect.anything() },
{
id: "sendInput",
status: "completed",
detail: expect.objectContaining({ description: "Now add tests" }),
},
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [{ id: event.event.id, status: event.event.status }]
: [],
),
).toEqual([{ id: "first", status: "completed" }]);
},
);
test.each([
["completed", "closeAgent", "errored", "failed"],
["errored", "closeAgent", "completed", "completed"],
["completed", "wait", "running", "running"],
["completed", "closeAgent", "running", "canceled"],
])(
"replaces the earlier %s outcome after a follow-up and %s result %s",
async (initialStatus, tool, resultStatus, expected) => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("spawnAgent", { second: "pendingInit" }, "spawn-second"),
{
...collab("wait", { first: initialStatus, second: "completed" }),
status: initialStatus === "errored" ? "failed" : "completed",
},
{ ...collab("sendInput", { first: "running" }), prompt: "Do more work" },
{
...collab(tool, { first: resultStatus }),
status: resultStatus === "errored" ? "failed" : "completed",
},
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [{ id: event.event.id, status: event.event.status }]
: [],
),
).toEqual([
{ id: "first", status: expected },
{ id: "second", status: "completed" },
]);
expect(
history.flatMap((event) =>
event.type === "timeline" &&
event.item.type === "tool_call" &&
event.item.callId === "spawn-first"
? [event.item.status]
: [],
),
).toEqual([expected]);
},
);
test("keeps the prior outcome when a follow-up submission fails", async () => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("wait", { first: "completed" }),
{ ...collab("sendInput", { first: "running" }), status: "failed", prompt: "Do more work" },
collab("wait", { first: "running" }, "stale-wait"),
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [event.event.status]
: [],
),
).toEqual(["completed"]);
});
test("settles a close card without a registered spawn", async () => {
const history = await replay([collab("closeAgent", { external: "running" })]);
expect(
history.flatMap((event) =>
event.type === "timeline" && event.item.type === "tool_call"
? [{ id: event.item.callId, status: event.item.status }]
: [],
),
).toEqual([{ id: "closeAgent", status: "canceled" }]);
});
test.each(["notFound", "errored"])(
"preserves completion and shows a failed resume reporting %s",
async (status) => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("wait", { first: "completed" }),
collab("closeAgent", { first: "completed" }),
{ ...collab("resumeAgent", { first: status }), status: "failed" },
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [event.event.status]
: [],
),
).toEqual(["completed"]);
expect(
history.flatMap((event) =>
event.type === "timeline" && event.item.type === "tool_call"
? [{ id: event.item.callId, status: event.item.status }]
: [],
),
).toEqual([
{ id: "spawn-first", status: "completed" },
{ id: "resumeAgent", status: "failed" },
]);
},
);
test("stops counting a child closed while running", async () => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("closeAgent", { first: "running" }),
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [{ id: event.event.id, status: event.event.status }]
: [],
),
).toEqual([{ id: "first", status: "canceled" }]);
});
test.each(["wait", "closeAgent"])(
"restores an errored child as failed after %s",
async (tool) => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
{ ...collab(tool, { first: "errored" }), status: "failed" },
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [{ id: event.event.id, status: event.event.status }]
: [],
),
).toEqual([{ id: "first", status: "failed" }]);
expect(
history.flatMap((event) =>
event.type === "timeline" && event.item.type === "tool_call"
? [{ id: event.item.callId, status: event.item.status, error: event.item.error }]
: [],
),
).toEqual([{ id: "spawn-first", status: "failed", error: { message: "Sub-agent failed" } }]);
},
);
test.each(["wait", "closeAgent"])(
"settles a live errored child as failed after %s",
async (tool) => {
const appServer = createFakeCodexAppServer();
const session = new CodexAppServerAgentSession(
{ provider: "codex", cwd: process.cwd(), modeId: "full-access" },
null,
createTestLogger(),
async () => appServer.child,
);
const statuses = new Map<string, string>();
const cards = new Map<string, { status: string; error: unknown }>();
session.subscribe((event) => {
if (event.type === "provider_subagent" && event.event.type === "upsert") {
statuses.set(event.event.id, event.event.status);
}
if (event.type === "timeline" && event.item.type === "tool_call") {
cards.set(event.item.callId, { status: event.item.status, error: event.item.error });
}
});
function notify(method: string, item: ReturnType<typeof collab>) {
appServer.child.stdout.write(
`${JSON.stringify({ method, params: { threadId: "thread-1", item } })}\n`,
);
}
try {
const result = session.run("Delegate the work.");
await appServer.waitForTurnStart();
notify("item/completed", collab("spawnAgent", { first: "pendingInit" }, "spawn-first"));
notify("item/started", {
...collab(tool, { first: "errored" }),
status: "inProgress",
agentsStates: {},
});
notify("item/completed", { ...collab(tool, { first: "errored" }), status: "failed" });
appServer.completeTurn();
await result;
expect([...statuses]).toEqual([["first", "failed"]]);
expect([...cards]).toEqual([
["spawn-first", { status: "failed", error: { message: "Sub-agent failed" } }],
]);
} finally {
await session.close();
appServer.assertNoErrors();
}
},
);
test("preserves completion when a close carries an older running snapshot", async () => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("wait", { first: "completed" }),
collab("closeAgent", { first: "running" }),
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [{ id: event.event.id, status: event.event.status }]
: [],
),
).toEqual([{ id: "first", status: "completed" }]);
});
test.each([
["shutdown", "canceled"],
["notFound", "failed"],
])("restores a %s child as %s and preserves its running sibling", async (status, expected) => {
const history = await replay([
collab("spawnAgent", { first: "pendingInit" }, "spawn-first"),
collab("spawnAgent", { second: "pendingInit" }, "spawn-second"),
collab("closeAgent", { first: status }),
]);
expect(
history.flatMap((event) =>
event.type === "provider_subagent" && event.event.type === "upsert"
? [{ id: event.event.id, status: event.event.status }]
: [],
),
).toEqual([
{ id: "first", status: expected },
{ id: "second", status: "running" },
]);
});
test("settles a rendered live wait when its completion lists only the finished receiver", async () => {
const appServer = createFakeCodexAppServer();
const session = new CodexAppServerAgentSession(
{ provider: "codex", cwd: process.cwd(), modeId: "full-access" },
null,
createTestLogger(),
async () => appServer.child,
);
const cards = new Map<string, string>();
const statuses = new Map<string, string>();
session.subscribe((event) => {
if (event.type === "timeline" && event.item.type === "tool_call") {
cards.set(event.item.callId, event.item.status);
}
if (event.type === "provider_subagent" && event.event.type === "upsert") {
statuses.set(event.event.id, event.event.status);
}
});
function notify(method: string, item: ReturnType<typeof collab>) {
appServer.child.stdout.write(
`${JSON.stringify({ method, params: { threadId: "thread-1", item } })}\n`,
);
}
try {
const result = session.run("Wait for the children.");
await appServer.waitForTurnStart();
notify("item/completed", collab("spawnAgent", { first: "pendingInit" }, "spawn-first"));
notify("item/started", {
...collab("wait", { first: "running", second: "running" }, "mixed-wait"),
status: "inProgress",
agentsStates: {},
});
await vi.waitFor(() => expect(cards.get("mixed-wait")).toBe("running"));
notify("item/completed", collab("wait", { first: "completed" }, "mixed-wait"));
notify("item/completed", collab("wait", { second: "completed" }, "wait-second"));
appServer.completeTurn();
await result;
expect([...statuses]).toEqual([["first", "completed"]]);
expect([...cards]).toEqual([
["spawn-first", "completed"],
["mixed-wait", "completed"],
["wait-second", "completed"],
]);
} finally {
await session.close();
appServer.assertNoErrors();
}
});
test.each(["completed", "interrupted", "running"])(
"keeps a live follow-up running despite a late %s sendInput snapshot",
async (submissionStatus) => {
const appServer = createFakeCodexAppServer();
const session = new CodexAppServerAgentSession(
{ provider: "codex", cwd: process.cwd(), modeId: "full-access" },
null,
createTestLogger(),
async () => appServer.child,
);
const statuses = new Map<string, string>();
const timelineCards = new Map<string, { status: string; detail: unknown }>();
let parentMessage = "";
session.subscribe((event) => {
if (event.type === "provider_subagent" && event.event.type === "upsert") {
statuses.set(event.event.id, event.event.status);
}
if (event.type === "timeline" && event.item.type === "tool_call") {
timelineCards.set(event.item.callId, {
status: event.item.status,
detail: event.item.detail,
});
}
if (event.type === "timeline" && event.item.type === "assistant_message") {
parentMessage = event.item.text;
}
});
function complete(tool: string, states: Record<string, string>, id = tool) {
const item = {
...collab(tool, states, id),
...(tool === "sendInput" ? { prompt: "Now add tests" } : {}),
};
if (tool !== "spawnAgent") {
appServer.child.stdout.write(
`${JSON.stringify({
method: "item/started",
params: {
threadId: "thread-1",
item: { ...item, status: "inProgress", agentsStates: {} },
},
})}\n`,
);
}
appServer.child.stdout.write(
`${JSON.stringify({
method: "item/completed",
params: { threadId: "thread-1", item },
})}\n`,
);
}
try {
const result = session.run("Delegate the work.");
await appServer.waitForTurnStart();
complete("spawnAgent", { first: "pendingInit" }, "spawn-first");
complete("spawnAgent", { second: "pendingInit" }, "spawn-second");
complete("wait", { first: "completed", second: "running" });
await vi.waitFor(() => {
expect(statuses.get("first")).toBe("completed");
expect(statuses.get("second")).toBe("running");
});
complete("closeAgent", { first: "shutdown" });
complete("wait", { first: "running" }, "stale-wait");
appServer.says({ threadId: "thread-1", text: "Still waiting." });
appServer.completeTurn();
await result;
expect(statuses.get("first")).toBe("completed");
appServer.startsTurn({ threadId: "first", turnId: "follow-up" });
await vi.waitFor(() => expect(statuses.get("first")).toBe("running"));
complete("sendInput", { first: submissionStatus });
appServer.says({ threadId: "thread-1", text: "Follow-up submitted." });
await vi.waitFor(() => expect(parentMessage).toBe("Follow-up submitted."));
expect(statuses.get("first")).toBe("running");
expect([...timelineCards.keys()]).toEqual(["spawn-first", "spawn-second", "sendInput"]);
expect(timelineCards.get("sendInput")).toEqual({
status: "completed",
detail: expect.objectContaining({ description: "Now add tests" }),
});
// Only the child's completion settles the follow-up.
appServer.completeTurn({ threadId: "first" });
await vi.waitFor(() => expect(statuses.get("first")).toBe("completed"));
} finally {
await session.close();
appServer.assertNoErrors();
}
},
);
});
@@ -10,7 +10,6 @@ export interface CodexThreadHistoryClient {
}
export type CodexThreadHistoryMode = "legacy" | "paginated";
export type CodexHistoryStatus = "running" | "completed" | "failed" | "canceled";
export interface CodexHistoryRow {
item: unknown;
@@ -20,11 +19,6 @@ export interface CodexHistoryRow {
completedAt: unknown;
}
interface CodexThreadHistoryRead {
rows: Iterable<CodexHistoryRow> | AsyncIterable<CodexHistoryRow>;
status: CodexHistoryStatus | null;
}
/** A history reply over the line cap; the rows before it were already read. */
export class CodexThreadHistoryTooLargeError extends Error {
constructor(message: string) {
@@ -35,22 +29,7 @@ export class CodexThreadHistoryTooLargeError extends Error {
const CodexThreadMetadataSchema = z
.object({
thread: z
.object({
historyMode: z.enum(["legacy", "paginated"]).optional(),
status: z.unknown().optional(),
})
.passthrough(),
})
.passthrough();
const CodexLegacyTurnSchema = z
.object({
id: z.string().optional(),
startedAt: z.unknown().optional(),
completedAt: z.unknown().optional(),
status: z.unknown().optional(),
items: z.array(z.unknown()).default([]),
thread: z.object({ historyMode: z.enum(["legacy", "paginated"]).optional() }).passthrough(),
})
.passthrough();
@@ -58,8 +37,18 @@ const CodexLegacyThreadReadSchema = z
.object({
thread: z
.object({
status: z.unknown().optional(),
turns: z.array(CodexLegacyTurnSchema).default([]),
turns: z
.array(
z
.object({
id: z.string().optional(),
startedAt: z.unknown().optional(),
completedAt: z.unknown().optional(),
items: z.array(z.unknown()).default([]),
})
.passthrough(),
)
.default([]),
})
.passthrough()
.default({ turns: [] }),
@@ -82,48 +71,15 @@ const CodexItemsPageSchema = z
})
.passthrough();
const CodexLatestTurnPageSchema = z.object({
data: z.array(z.object({ status: z.unknown().optional() })),
});
/** Codex builds before 0.143 report no history mode; their threads are legacy. */
export async function readCodexThreadHistoryMode(
client: CodexThreadHistoryClient,
threadId: string,
): Promise<CodexThreadHistoryMode> {
return (await readThreadMetadata(client, threadId)).historyMode ?? "legacy";
}
async function readThreadMetadata(client: CodexThreadHistoryClient, threadId: string) {
return CodexThreadMetadataSchema.parse(
const response = CodexThreadMetadataSchema.parse(
await client.request("thread/read", { threadId, includeTurns: false }),
).thread;
}
function readHistoryStatus(
threadStatus: unknown,
latestTurnStatus?: unknown,
): CodexHistoryStatus | null {
if (
typeof threadStatus === "object" &&
threadStatus !== null &&
"type" in threadStatus &&
threadStatus.type === "active"
) {
return "running";
}
// An unloaded thread can contain an unfinished rollout. Only the runtime
// status proves that it is still working.
switch (latestTurnStatus) {
case "completed":
return "completed";
case "failed":
return "failed";
case "interrupted":
return "canceled";
default:
return null;
}
);
return response.thread.historyMode ?? "legacy";
}
/**
@@ -131,20 +87,21 @@ function readHistoryStatus(
* pages; a legacy thread arrives in one `thread/read` reply, as Codex offers
* no pages for it.
*/
export async function readCodexThreadHistory(
export async function* readCodexThreadHistory(
client: CodexThreadHistoryClient,
threadId: string,
options?: { readLatestTurn?: boolean },
): Promise<CodexThreadHistoryRead> {
const metadata = await readThreadMetadata(client, threadId);
if (metadata.historyMode === "paginated") {
const active = readHistoryStatus(metadata.status);
return {
rows: readPaginatedHistory(client, threadId),
status:
active ?? (options?.readLatestTurn ? await readLatestTurnStatus(client, threadId) : null),
};
): AsyncGenerator<CodexHistoryRow> {
if ((await readCodexThreadHistoryMode(client, threadId)) === "paginated") {
yield* readPaginatedHistory(client, threadId);
} else {
yield* readLegacyHistory(client, threadId);
}
}
async function* readLegacyHistory(
client: CodexThreadHistoryClient,
threadId: string,
): AsyncGenerator<CodexHistoryRow> {
const response = await requestHistory(
client,
"thread/read",
@@ -154,37 +111,7 @@ export async function readCodexThreadHistory(
`run \`codex migrate-rollouts --apply --thread ${threadId}\` (Codex 0.148 or newer), ` +
`then unarchive the agent.`,
);
const { thread } = CodexLegacyThreadReadSchema.parse(response);
return {
rows: readLegacyRows(thread.turns),
status: readHistoryStatus(thread.status, thread.turns.at(-1)?.status),
};
}
async function readLatestTurnStatus(
client: CodexThreadHistoryClient,
threadId: string,
): Promise<CodexHistoryStatus | null> {
try {
const response = await client.request("thread/turns/list", {
threadId,
limit: 1,
sortDirection: "desc",
itemsView: "notLoaded",
});
const page = CodexLatestTurnPageSchema.parse(response);
return readHistoryStatus(undefined, page.data[0]?.status);
} catch {
// Older Codex builds and stores can reject this optional probe. The
// recorded parent outcome and the child's timeline still load normally.
return null;
}
}
function* readLegacyRows(
turns: z.infer<typeof CodexLegacyTurnSchema>[],
): Generator<CodexHistoryRow> {
for (const turn of turns) {
for (const turn of CodexLegacyThreadReadSchema.parse(response).thread.turns) {
for (const item of turn.items) {
yield { item, turnId: turn.id, startedAt: turn.startedAt, completedAt: turn.completedAt };
}
@@ -213,20 +213,6 @@ describe("codex tool-call mapper", () => {
});
});
it("accepts a nullable prompt in completed collaboration control items", () => {
expect(
mapCodexToolCallFromThreadItem({
type: "collabAgentToolCall",
id: "wait-child",
tool: "wait",
prompt: null,
status: "completed",
receiverThreadIds: ["child"],
agentsStates: { child: { status: "completed" } },
}),
).toMatchObject({ callId: "wait-child", status: "completed" });
});
it("maps collabAgentToolCall into canonical sub-agent detail", () => {
const item = mapCodexToolCallFromThreadItem({
type: "collabAgentToolCall",
@@ -187,7 +187,7 @@ const CodexCollabAgentToolCallItemSchema = z
id: z.string().min(1),
status: z.string().optional(),
error: z.unknown().optional(),
prompt: z.string().nullish(),
prompt: z.string().optional(),
tool: z.string().optional(),
receiverThreadIds: z.array(z.string()).optional(),
agentsStates: z.record(z.string(), z.unknown()).optional(),
@@ -546,18 +546,12 @@ function readStatus(value: unknown): string | undefined {
return typeof value.status === "string" ? value.status : undefined;
}
export function normalizeCollabAgentChildStatus(
status: string,
tool?: string,
): ToolCallTimelineItem["status"] {
function normalizeCollabAgentChildStatus(status: string): ToolCallTimelineItem["status"] {
const normalized = status.trim().toLowerCase();
switch (normalized) {
case "error":
case "errored":
return tool === "wait" || tool === "closeAgent" ? "failed" : "running";
case "running":
case "pendinginit":
return tool === "closeAgent" ? "canceled" : "running";
return "running";
case "shutdown":
return "canceled";
case "notfound":
@@ -579,15 +573,10 @@ function resolveCollabAgentStatus(
return "failed";
}
// Sending input completes the submission, not the child's new turn.
if (item.tool === "sendInput") {
return parentStatus;
}
const childStatuses = Object.values(item.agentsStates ?? {})
.map(readStatus)
.filter((status): status is string => typeof status === "string" && status.trim().length > 0)
.map((status) => normalizeCollabAgentChildStatus(status, item.tool));
.map(normalizeCollabAgentChildStatus);
if (childStatuses.some((status) => status === "failed")) {
return "failed";
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/website",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"private": true,
"type": "module",
"scripts": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/builtin-plugins",
"version": "0.16.2",
"version": "0.17.0-beta.1",
"private": true,
"type": "module",
"scripts": {