Compare commits

...
Author SHA1 Message Date
paseo-ai[bot] c539fc1dc6 fix: update lockfile signatures and Nix hash [skip ci] 2026-11-27 18:48:51 +00:00
Mohamed Boudra 1c053e207e feat(desktop): new butterfly app icons on desktop and mobile (#11091)
* feat(desktop): draw the app icons from the new butterfly mark

The desktop and mobile icons still carried the old butterfly, and each
was a hand-exported file. They now come from one script that renders
them from the canonical mark in assets/brand, so a change to the mark
reaches every icon.

The icons are flat. Each platform masks and lights its own icons, and
artwork that arrives already lit ends up lit twice. The lit versions
are kept in assets/brand/app-icons and nothing uses them.

The packaged Mac app now takes its icon from an Icon Composer document
instead of the .icns, so macOS draws the tile, the margin, the lighting
and the dark, tinted and clear variants itself. electron-builder
compiles the document with actool, which needs Xcode 26 or later. The
Nix build has no Xcode and keeps the .icns, and so does the DMG volume
icon, because the .icns actool derives stops at 256 px.

macOS draws a dev build's Dock icon and an .icns exactly as supplied.
Their tile is now 824 of 1024 px with continuous corners, measured from
the icon macOS 27 draws for the document. The old production tile was
88% of the canvas and looked oversized next to other Dock icons.

* test(desktop): put the tunnel heartbeat test on a fake clock

The test ran a 25 ms heartbeat against a 65 ms timeout on the real
clock. A heartbeat tick closes the wire instead of pinging once the
timeout has passed, so when the first tick landed late on a slow
Windows runner the wire closed with no ping sent, and the assertion
that a ping went out failed.

With a fake clock the ticks land at 25, 50 and 75 ms every time: two
pings, then the heartbeat close.
2026-11-28 01:38:26 +07:00
Mohamed Boudra 14734843fd chore(release): reconcile v0.18.1 (#11102) 2026-11-28 01:32:34 +07:00
10a71e6904 Keep a streamed reply whole when a steering message arrives mid-stream (#5267)
* fix(server): keep a streamed assistant message whole across a steer

Steering an agent mid-stream records the user message at the next
timeline seq, between two chunks of the assistant message that is still
streaming. The projection merged assistant chunks only when they were
adjacent, so the interposed user row split one provider message into two
timeline rows at whatever character had arrived, often mid-word.

An assistant message that carries a provider message id now has a
timeline identity, like a tool call does, so its chunks collapse into one
item wherever they land. Chunks without a message id keep the existing
adjacency merge.

* test(server): synchronize the steer regression test on timeline state

Replace the fixed sleeps with polling assertions, and run the coalescer
with a zero window so every chunk flushes on its leading edge.

* fix(server): merge a steered message only across user rows

The identity merge joined every chunk of one provider message into its
first row, whatever rows were recorded between them. Text a provider
wrote after a tool call moved above the tool call, and seeded rows lost
the turn stats on the merged reply.

A chunk now continues the assistant message right before it, or, when
it carries a provider message id, the assistant row before a run of
user rows recorded mid-stream. Any other row in between keeps the
provider's order. The merge carries the stats from the later chunk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(app): keep streamed replies whole across steering messages

---------

Co-authored-by: paseo-bot <paseo-bot@users.noreply.github.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 17:42:54 +00:00
Mohamed Boudra 4810eb2d74 fix(app): keep Command Center result order stable while typing (#11085)
Command Center scored contributions and workspaces with right-edge text-match tiers (TIER_EXACT and TIER_WHOLE_WORD), so rows flipped mid-word whenever a shorter word or title finished on the latest keystroke (for example, typing renam then e flipped Rename workspace and Rename, and typing to jumped Pin to top above Toggle Explorer sidebar). Because CommandCenterInteraction resets active selection to index 0 on every keystroke, Enter executed the wrong action.

Score Command Center matches by left-edge rank only (field start, word start, inside word, scattered) and rank workspaces within the same MatchClass by recency directly instead of raw sub-tiers. Also label the active tab rename action with the existing Rename agent / Rename terminal keys instead of bare Rename.
2026-11-27 23:29:24 +07:00
paseo-bot[bot]andClaude Opus 5.5 79a32f40c6 fix(pi): queue a prompt while Pi runs a turn it started itself (#11077)
Pi starts runs on its own, for example for an extension message or a
background result, and reports them only at agent_start. A prompt sent
in that window had no streamingBehavior, so Pi rejected it with
"Agent is already processing" and the message was lost.

Send prompts with streamingBehavior followUp. Pi queues the prompt into
its running turn, and ignores the option when it is idle.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:14:07 +00:00
a997246655 fix(opencode): clear v2 approvals that OpenCode dropped (#11061)
OpenCode v2 removes a pending approval without a `permission.replied`
event when the tool call that asked is interrupted, and answers a later
reply to it with HTTP 404. Paseo kept its copy, so the card stayed and
every answer failed. A message sent while the card was open failed the
same way, because clearing the card threw the 404.

Reconciling a session now drops approvals OpenCode no longer lists, and
a 404 reply resolves the approval instead of failing.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: rhettjay <67493409+rhettjay@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:00:29 +00:00
Mohamed Boudra 3b8fd4ab3d fix(gitlab): load fork MR pipeline jobs from the pipeline project (#11074)
glab ci get --merge-request fetches the MR from the target repository, reads
head_pipeline.id, and then requests that pipeline from the target repository
instead of head_pipeline.project_id. For fork merge requests whose pipeline runs
in the fork project, GitLab returns 404 Not Found on every PR status poll and
PR-pane pipeline drill-down.

Query the GitLab REST API directly via glab api using head_pipeline.project_id
(falling back to target_project_id, the MR project path, or :fullpath) for both
fetchPipelineChecks and getCheckDetails, matching how gitlab-change-requests.ts
already resolves fork pipelines.
2026-11-27 22:46:07 +07:00
paseo-bot[bot]andClaude Opus 5.5 9416336d73 Reopen an ACP agent whose process exited while it was idle (#11047)
* Reopen an ACP agent whose process exited while it was idle

When a generic ACP agent's process exits between turns, for example after
an external kill -9, every later message failed with "ACP agent
disconnected" until someone reloaded the agent by hand.

startTurn now reports a dead connection as a stale provider session when
the provider can reopen sessions (session/load or session resume). The
prompt path already reloads a stale session from persistence on a new
process and retries the message, as it does for plugin sessions. A
provider that cannot reopen a session keeps the current error, because a
reload would close the agent without a way back.

The exit handler also logs an unexpected exit, with the pid, the exit
code or signal, and whether a turn was running. Before, an exit while
idle left no line in the daemon log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Wait for the daemon to see the ACP exit in the recovery test

On Windows the test saw the killed process gone before the daemon read
the closed pipes, so the next message started a turn on the dead
connection. The test now waits for the daemon's exit warning, and checks
the disconnect text without the signal, which Windows reports as an exit
code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:52:24 +00:00
Matt CowgerandMatt Cowger 5715467245 fix(omp): preserve tool call intent in metadata (#10727)
Carry OMP tool-call `intent` strings in `ToolCallBase.metadata.intent` across live updates (`running`, `completed`, `failed`, `canceled`) and replayed session history, reusing the existing tool-call `metadata` path through the daemon, app stream, replica cache, and client timeline plugins without changing the shared protocol.

Replay reads only string `content.intent` values (ignoring non-string values and never deriving intent from a tool argument named `i`). Updates `docs/plugins.md` and `public-docs/plugins/reference.md`, and retries Windows temp-dir cleanup in `forge-cli-command.test.ts`.

Fixes #10730

Co-authored-by: Matt Cowger <matt@cowger.us>
2026-11-27 21:41:16 +07:00
paseo-bot[bot]andClaude Opus 5.5 8e8b383f4c Let idle cleanup unload an OpenCode chat while another session runs (#11039)
The v2 runtime safety check vetoed collection whenever any session on
the server was active. The shared server stays up after its last lease
goes, so that veto kept every idle chat resident while one unrelated
session worked. Another session's execution now vetoes only when
releasing the lease would stop the server; the chat's own session and
its descendants still veto as before.

Fixes #10305

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:23:13 +00:00
Mohamed Boudra 1fd744795d Add host-wide instructions for metadata generation (#11064)
* feat(settings): add host-wide instructions for metadata generation

Add a single host-level agents.metadataGeneration.instructions field instead of a language-only switch or per-artifact host overrides. It applies across workspace titles, worktree branch names, commit messages, and pull request drafts alongside Paseo's default styles, while letting per-project paseo.json overrides take precedence on conflict.

Gate the UI field on server_info.features.metadataGenerationInstructions so older daemons that drop the field on patch do not show a no-op editor, and split MutableMetadataGenerationConfigPatchSchema without a default providers array so patching instructions never wipes configured providers.

* fix(server): read host metadata instructions through structured-generation config helper
2026-11-27 20:51:24 +07:00
paseo-bot[bot]andClaude Opus 5.5 bec63111f1 test(cli): let lifecycle test daemons bind their own ports (#11054)
The lifecycle tests reserved a free port, released it, and later started
a daemon on it. Another process could bind the port in between, and the
daemon then exited with EADDRINUSE. That failed "raw log following" on
main. Tests that need no fixed port now configure 127.0.0.1:0, so the
daemon allocates the port itself and publishes it.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 12:31:09 +00:00
Mohamed Boudra dbba977ab8 fix(app): eliminate first-open jank in starting ref popover (#11042)
Opening the Starting ref popover in New Workspace for the first time jumped in two steps: the query was disabled until open, buildPickerOptionData rendered a lone [main] row in a 132px frame, and when branch suggestions arrived the popover grew to 400px while pushing main down below newer branches.

Lock the desktop popover height to 400px (and clamp fixed minHeight to availableHeight in buildDesktopFrameStyle so short viewports do not overflow), warm default branch suggestions and forge wording while the trigger is visible on the focused screen, retain same-project results while filtering, and show the searching state instead of a premature single-row placeholder on cold opens.
2026-11-27 19:22:41 +07:00
Mohamed Boudra 29179ba27f fix(server): clear finished terminals when marking a workspace read (#11040)
A terminal that goes from working to idle records finished attention, and the
workspace status rolls it up as attention. The workspace clear-attention
handler only cleared agents, so a workspace kept green by a terminal stayed
green after Mark as read, with no agent inside showing why.

Terminals are matched by the workspace they belong to, not by cwd: a terminal
can run in a different directory than its workspace. Needs-input attention is
left alone, matching how agent permission prompts are handled.
2026-11-27 19:18:37 +07:00
Mohamed Boudra dcdd327cdf fix(app): show composer autocomplete after closing overlays and hide it while submitting (#11041)
* fix(app): restore composer autocomplete after closing web overlays

Closing a web overlay such as the New Workspace branch picker runs useOverlayRegistration's teardown inside a useLayoutEffect cleanup. React 19 runs layout effect cleanups during the mutation commit phase while its DOM event system is disabled, so calling target.focus() synchronously drops focusin. React's SelectEventPlugin then keeps activeElement unset and skips onSelect/onSelectionChange, leaving the composer cursor stuck at 0 so slash and @ autocomplete never open until another event refocuses the textarea.

Defer focus restoration in addWebOverlay via queueMicrotask so focus runs after React finishes its mutation commit, guarded so a newer overlay opened in the same commit is not stolen from. Also hide ComposerAutocompleteBinding while isComposerLocked is true so autocomplete cannot appear over a submitting composer.

* fix(app): preserve focus claimed during overlay close and guard missing DOM

Skip deferred overlay focus restoration when the closing commit moves focus to a new element (such as an autofocused inline input mounted by a menu action like file explorer Rename, New file, or New folder). Also guard typeof document and typeof HTMLElement in the deferred focus-restore helpers so Node unit tests that tear down DOM stubs before microtasks run do not throw.

* fix(app): restore overlay focus during layout phase before passive effects

Deferring focus restoration to a microtask when active flipped true -> false ran after passive useEffect hooks updated, which let HoverCard's focusin listener re-enable and reopen the workspace hover card when closing a sidebar context menu.

Split registration/deactivation from unmount cleanup in useOverlayRegistration so active: true -> false restores focus synchronously inside the layout effect (after React re-enables DOM events and before passive effects run), reserving queueMicrotask for unmount-while-active where no layout setup runs. Also detach the overlay entry before clearing scopeRef so the departing scope is preserved.
2026-11-27 19:18:24 +07:00
139 changed files with 4445 additions and 532 deletions
+1
View File
@@ -15,6 +15,7 @@
"*.lock",
"**/*.gen.ts",
"**/*.gen.tsx",
"**/*.icon/**",
"packages/react-native-enriched-markdown/**"
]
}
+25
View File
@@ -1,5 +1,30 @@
# Changelog
## 0.18.1 - 2026-11-27
- **Host metadata instructions:** Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests. ([#11064](https://github.com/getpaseo/paseo/pull/11064))
- **Enterprise spending usage:** Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times. ([#8976](https://github.com/getpaseo/paseo/pull/8976) by [@mcowger](https://github.com/mcowger), [@JasprW](https://github.com/JasprW))
### Fixed
- Fixed Android agent push notifications arriving minutes late during Doze ([#8501](https://github.com/getpaseo/paseo/pull/8501) by [@truelecter](https://github.com/truelecter))
- Fixed Command Center results reordering mid-word while typing ([#11085](https://github.com/getpaseo/paseo/pull/11085))
- Fixed composer slash and `@` autocomplete stopping after closing a web overlay or opening while a prompt submits ([#11041](https://github.com/getpaseo/paseo/pull/11041))
- Fixed the Starting ref popover in New Workspace jumping in height and shifting rows on first open ([#11042](https://github.com/getpaseo/paseo/pull/11042))
- Fixed the iOS Home Screen web app status bar overlapping focus-mode tabs, the overlay sidebar, and the Mermaid fullscreen viewer on wide layouts ([#9970](https://github.com/getpaseo/paseo/pull/9970) by [@mywaffles](https://github.com/mywaffles))
- Fixed Mark as read on a workspace not clearing finished terminal attention ([#11040](https://github.com/getpaseo/paseo/pull/11040))
- Fixed GitLab merge request checks and pipeline details failing with 404 when the pipeline runs in a fork project ([#11074](https://github.com/getpaseo/paseo/pull/11074))
- Fixed messages sent while Pi runs a turn it started itself failing instead of queuing ([#11077](https://github.com/getpaseo/paseo/pull/11077))
- Fixed OpenCode v2 tool approvals staying stuck after OpenCode already dropped the request ([#11061](https://github.com/getpaseo/paseo/pull/11061) by [@rhettjay](https://github.com/rhettjay))
- Fixed idle cleanup keeping OpenCode v2 chats in memory while another session runs on the shared server ([#11039](https://github.com/getpaseo/paseo/pull/11039))
- Fixed idle ACP agents failing permanently after their process exits instead of reopening on the next message ([#11047](https://github.com/getpaseo/paseo/pull/11047))
- Fixed Kimi usage failing or showing an expired login for global `kimi.ai` accounts ([#8505](https://github.com/getpaseo/paseo/pull/8505) by [@benthecarman](https://github.com/benthecarman))
- Fixed the Z.ai Usage card missing when GLM Agent is signed in via `Z_AI_API_KEY` or its credentials file ([#8376](https://github.com/getpaseo/paseo/pull/8376) by [@Peanut-HZM](https://github.com/Peanut-HZM))
### Plugins
- Added OMP tool-call intent to `item.metadata.intent` for timeline plugins ([#10727](https://github.com/getpaseo/paseo/pull/10727) by [@mcowger](https://github.com/mcowger))
## 0.18.0 - 2026-11-27
- **Remote workspace browser proxy:** Desktop browser tabs in remote workspaces now route through the workspace daemon, so remote `localhost` servers open directly in Paseo. ([#10944](https://github.com/getpaseo/paseo/pull/10944) by [@airon-assustadus](https://github.com/airon-assustadus))
+25
View File
@@ -1,5 +1,30 @@
# Changelog
## 0.18.1 - 2026-11-27
- **主机元数据指令**:设置一次主机级指令,即可统一控制自动生成的工作区标题、分支名、提交信息和 PR 的语言、语气与格式。([#11064](https://github.com/getpaseo/paseo/pull/11064))
- **企业消费用量**:使用情况现已显示 Claude 额外消费用量以及 Codex 个人消费限额和重置时间。([#8976](https://github.com/getpaseo/paseo/pull/8976),贡献者:[@mcowger](https://github.com/mcowger), [@JasprW](https://github.com/JasprW))
### 修复
- 修复 Android 在 Doze 休眠模式下 Agent 推送通知延迟数分钟送达的问题 ([#8501](https://github.com/getpaseo/paseo/pull/8501),贡献者:[@truelecter](https://github.com/truelecter))
- 修复在命令中心输入时结果顺序在单词输入中途跳动的问题 ([#11085](https://github.com/getpaseo/paseo/pull/11085))
- 修复关闭网页浮层后 Composer 的斜杠与 `@` 自动补全失效,以及提交提示词时自动补全弹出的问题 ([#11041](https://github.com/getpaseo/paseo/pull/11041))
- 修复在“新建工作区”中首次打开“起始 ref”浮层时高度跳动和行位偏移的问题 ([#11042](https://github.com/getpaseo/paseo/pull/11042))
- 修复宽屏布局下 iOS 主屏幕网页应用的状态栏遮挡专注模式标签栏、覆盖侧边栏和 Mermaid 全屏查看器的问题 ([#9970](https://github.com/getpaseo/paseo/pull/9970),贡献者:[@mywaffles](https://github.com/mywaffles))
- 修复将工作区标记为已读时未清除已完成终端提醒的问题 ([#11040](https://github.com/getpaseo/paseo/pull/11040))
- 修复 GitLab 合并请求的流水线运行在 fork 项目中时,检查状态和流水线详情返回 404 的问题 ([#11074](https://github.com/getpaseo/paseo/pull/11074))
- 修复 Pi 运行其自行启动的轮次时发送的消息直接失败而不是排队的问题 ([#11077](https://github.com/getpaseo/paseo/pull/11077))
- 修复 OpenCode v2 已丢弃工具审批请求后,审批卡片仍一直卡住的问题 ([#11061](https://github.com/getpaseo/paseo/pull/11061),贡献者:[@rhettjay](https://github.com/rhettjay))
- 修复共享服务器上运行其他会话时,空闲清理不会卸载闲置 OpenCode v2 对话的问题 ([#11039](https://github.com/getpaseo/paseo/pull/11039))
- 修复空闲 ACP Agent 的进程意外退出后永久失败,而不是在下一条消息时重新打开会话的问题 ([#11047](https://github.com/getpaseo/paseo/pull/11047))
- 修复使用全局 `kimi.ai` 账号登录时 Kimi 用量加载失败或显示登录已过期的问题 ([#8505](https://github.com/getpaseo/paseo/pull/8505),贡献者:[@benthecarman](https://github.com/benthecarman))
- 修复通过 `Z_AI_API_KEY` 或凭据文件登录 GLM Agent 时缺少 Z.ai 使用情况卡片的问题 ([#8376](https://github.com/getpaseo/paseo/pull/8376),贡献者:[@Peanut-HZM](https://github.com/Peanut-HZM))
### 插件
- 为时间线插件在 `item.metadata.intent` 中新增 OMP 工具调用意图 ([#10727](https://github.com/getpaseo/paseo/pull/10727),贡献者:[@mcowger](https://github.com/mcowger))
## 0.18.0 - 2026-11-27
- **远程工作区浏览器代理**:远程工作区中的桌面端浏览器标签页现在会通过该工作区的 daemon 转发流量,远程 `localhost` 服务可以直接在 Paseo 中打开。([#10944](https://github.com/getpaseo/paseo/pull/10944),贡献者:[@airon-assustadus](https://github.com/airon-assustadus))
+27 -1
View File
@@ -1,6 +1,6 @@
# Brand assets
Canonical marks, lockups, and wordmark font for **Paseo** and **Paseo Hub**. These are the source assets that will replace the existing icons across the app, desktop client, website, docs, and Hub in follow-up work.
Canonical marks, lockups, and wordmark font for **Paseo** and **Paseo Hub**. These are the source assets for the icons across the app, desktop client, website, docs, and Hub.
## Brand architecture
@@ -37,6 +37,10 @@ All lockups (`lockups/*.svg`) share a `144`-unit height (`140`-unit flower ink h
```text
assets/brand/
build.mjs Regenerates all marks and lockups
build-app-icons.mjs Regenerates the desktop and mobile app icons
app-icons/
paseo-lit.png
paseo-dev-lit.png
fonts/
PlusJakartaSans-SemiBold.ttf
OFL.txt
@@ -61,3 +65,25 @@ assets/brand/
```sh
node assets/brand/build.mjs
```
## App icons
`build-app-icons.mjs` renders every desktop and mobile app icon from `marks/paseo-white.svg`: the white butterfly on a black tile, and a blueprint tile for desktop development builds. Regenerate them after changing the butterfly:
```sh
node assets/brand/build-app-icons.mjs
```
The icons that ship are flat. Each platform masks and lights its own icons, so lit artwork ends up lit twice. `app-icons/` keeps a lit version of the two desktop icons, a baked approximation of macOS Liquid Glass. Nothing uses them.
The packaged Mac app takes its icon from `packages/desktop/assets/icon.icon`, an Icon Composer document the script also writes. macOS draws Liquid Glass on it and derives the dark, tinted, and clear variants. electron-builder compiles the document with `actool`, so packaging the Mac app needs Xcode 26 or later. The Nix build has no Xcode and uses `icon.icns`.
To see what macOS draws from the document without packaging the app, export it with Icon Composer's command line tool on a Mac:
```sh
"/Applications/Xcode.app/Contents/Applications/Icon Composer.app/Contents/Executables/ictool" \
packages/desktop/assets/icon.icon --export-image --output-file icon.png \
--platform macOS --rendition Default --width 1024 --height 1024 --scale 1
```
`--rendition` also takes `Dark`, `TintedLight`, `TintedDark`, `ClearLight`, and `ClearDark`.
Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

+464
View File
@@ -0,0 +1,464 @@
// Generates every Paseo app icon from the canonical butterfly mark.
//
// node assets/brand/build-app-icons.mjs
//
// The artwork is the white butterfly on a black tile. A desktop development build gets the same
// tile drawn as a blueprint, so it is never mistaken for an installed app.
//
// The icons that ship are flat. Each platform masks and lights its own icons, and artwork that
// arrives already lit ends up lit twice. The lit finish is a baked approximation of the Liquid
// Glass material macOS draws for Icon Composer icons. It is written to app-icons/ so it stays
// available, and nothing consumes it.
//
// A packaged Mac app gets its icon from the Icon Composer document in the desktop assets, which
// macOS masks and lights itself. macOS draws a dev build's Dock icon and an .icns exactly as
// supplied, so those carry the system's tile in the artwork. Its geometry is measured from the icon
// macOS 27 draws for that document: the tile covers 824 of the 1024 canvas pixels and its corners
// are continuous curves with a radius of 26.4% of the tile.
//
// sharp is not a declared dependency. It resolves from the workspace root, the way opentype.js
// does for build.mjs.
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import sharp from "sharp";
const brandDir = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(brandDir, "../..");
const brandMarkPath = path.join(brandDir, "marks/paseo-white.svg");
const CANVAS = 1024;
const MACOS_TILE_ON_CANVAS = 824 / CANVAS;
// Windows and Linux have no icon grid, and a tile with the macOS margin looks small next to their
// other icons.
const WINDOWS_LINUX_TILE_ON_CANVAS = 928 / CANVAS;
// Artwork is drawn in the brand mark's own 700-unit box, which the tile fills.
const TILE = 700;
const TILE_RADIUS = 185;
const MARK_INK = 527;
// Scaled down, the mark keeps clear of the tile's corners and covers as much of the tile as the
// glyphs in Apple's icons do.
const MARK_SCALE = 0.9;
const MARK_INK_ON_TILE = (MARK_INK * MARK_SCALE) / TILE;
// Android shows the middle 72 of an adaptive icon's 108 units.
const ANDROID_ADAPTIVE_VISIBLE = 72 / 108;
const NOTIFICATION_MARK_INK = 0.75;
// Apple's continuous corner. Each pair is a distance back along the incoming edge and a distance
// along the outgoing edge, in units of the corner radius.
const CORNER_SEGMENTS = [
["C", [1.08849296, 0], [0.86840694, 0], [0.66993427, 0.065496]],
["L", [0.63149399, 0.074911]],
["C", [0.37282392, 0.16905899], [0.16905899, 0.37282392], [0.074911, 0.63149399]],
["L", [0.065496, 0.66993427]],
["C", [0, 0.86840694], [0, 1.08849296], [0, 1.52866483]],
];
const CORNER_START = [1.52866483, 0];
function continuousSquarePath(inset) {
const near = inset;
const far = TILE - inset;
const radius = TILE_RADIUS - inset;
const corners = [
{ at: [far, near], incoming: [1, 0], outgoing: [0, 1] },
{ at: [far, far], incoming: [0, 1], outgoing: [-1, 0] },
{ at: [near, far], incoming: [-1, 0], outgoing: [0, -1] },
{ at: [near, near], incoming: [0, -1], outgoing: [1, 0] },
];
const commands = corners.map(({ at, incoming, outgoing }, cornerIndex) => {
const point = ([back, along]) =>
[0, 1]
.map((axis) => at[axis] - incoming[axis] * back * radius + outgoing[axis] * along * radius)
.map((value) => Number(value.toFixed(2)))
.join(" ");
const segments = CORNER_SEGMENTS.map(
([command, ...points]) => `${command}${points.map(point).join(" ")}`,
);
return `${cornerIndex === 0 ? "M" : "L"}${point(CORNER_START)}${segments.join("")}`;
});
return `${commands.join("")}Z`;
}
const TILE_SHAPE = `<path d="${continuousSquarePath(0)}" />`;
const FILL_TILE = `<rect width="${TILE}" height="${TILE}" fill="url(#surface)" />`;
const PRODUCTION = {
flat: {
defs: `<linearGradient id="surface"><stop stop-color="#000000" /></linearGradient>`,
surface: FILL_TILE,
},
lit: {
defs: `
<linearGradient id="surface" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#202022" />
<stop offset="1" stop-color="#0E0E10" />
</linearGradient>`,
surface: FILL_TILE,
tileEdge: { color: "#000000", opacity: 0.75 },
markEdge: { color: "#4A5568", opacity: 0.45 },
markShadow: { color: "#000000", opacity: 0.5 },
},
};
const GRID_DIVISIONS = 8;
const GRID_MAJOR_EVERY = 2;
const OUTLINE_INSET = 28;
function gridLines(isIncluded) {
const step = TILE / GRID_DIVISIONS;
const segments = [];
for (let index = 1; index < GRID_DIVISIONS; index += 1) {
if (!isIncluded(index)) continue;
const at = index * step;
segments.push(`M${at} 0V${TILE}`, `M0 ${at}H${TILE}`);
}
return segments.join("");
}
const isMajorLine = (index) => index % GRID_MAJOR_EVERY === 0;
const BLUEPRINT_SHEET = {
defs: `
<linearGradient id="surface" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#05C2FE" />
<stop offset="0.5" stop-color="#0191FD" />
<stop offset="1" stop-color="#026CFA" />
</linearGradient>`,
surface: `
${FILL_TILE}
<g fill="none" stroke="#FFFFFF">
<path d="${gridLines((index) => !isMajorLine(index))}" stroke-opacity="0.16" stroke-width="1.5" />
<path d="${gridLines(isMajorLine)}" stroke-opacity="0.34" stroke-width="2" />
<circle cx="${TILE / 2}" cy="${TILE / 2}" r="${TILE / 2 - OUTLINE_INSET}" stroke-opacity="0.45" stroke-width="2" stroke-dasharray="10 8" />
<path d="${continuousSquarePath(OUTLINE_INSET)}" stroke-opacity="0.34" stroke-width="2" />
</g>`,
};
const BLUEPRINT = {
flat: BLUEPRINT_SHEET,
lit: {
...BLUEPRINT_SHEET,
tileEdge: { color: "#0034B4", opacity: 0.55 },
markEdge: { color: "#1E5FD0", opacity: 0.5 },
markShadow: { color: "#00308F", opacity: 0.4 },
},
};
// The lit finish, tuned against Apple's own renders. The light comes from straight above: a
// layer's upward-facing edge gets a bright highlight, its downward-facing edge a fainter one, and
// its side edges darken.
//
// An edge highlight is the part of the layer that a vertically shifted copy does not cover. A
// vertical blur of the shifted copy makes the highlight brightest at the edge and absent on
// vertical edges. A wider, round blur of the same band dims it where the edge turns away from
// the light, which is what keeps the tile's corners quieter than its top.
function glassFilter({ id, edge, edgeWidth, lightWidth, upperLight, lowerLight, shadow }) {
const light = (name, direction, opacity) => `
<feOffset in="SourceAlpha" dy="${direction * lightWidth}" />
<feGaussianBlur stdDeviation="0 ${lightWidth}" result="${name}Shifted" />
<feComposite in="SourceAlpha" in2="${name}Shifted" operator="out" result="${name}Edge" />
<feOffset in="SourceAlpha" dy="${direction * lightWidth * 2}" result="${name}Far" />
<feComposite in="SourceAlpha" in2="${name}Far" operator="out" />
<feGaussianBlur stdDeviation="${lightWidth * 3}" />
<feComponentTransfer><feFuncA type="gamma" exponent="3" amplitude="65" /></feComponentTransfer>
<feComposite in2="${name}Edge" operator="arithmetic" k1="1" result="${name}Shape" />
<feFlood flood-color="#FFFFFF" flood-opacity="${opacity}" />
<feComposite in2="${name}Shape" operator="in" result="${name}" />`;
const dropShadow = shadow
? `
<feGaussianBlur in="SourceAlpha" stdDeviation="${shadow.blur}" />
<feOffset dy="${shadow.offset}" result="shadowShape" />
<feFlood flood-color="${shadow.color}" flood-opacity="${shadow.opacity}" />
<feComposite in2="shadowShape" operator="in" result="shadow" />`
: "";
return `
<filter id="${id}" x="-20%" y="-20%" width="140%" height="140%" color-interpolation-filters="sRGB">${dropShadow}
<feMorphology in="SourceAlpha" operator="erode" radius="${edgeWidth * 0.6}" />
<feGaussianBlur stdDeviation="${edgeWidth}" result="core" />
<feFlood flood-color="${edge.color}" flood-opacity="${edge.opacity}" />
<feComposite in2="core" operator="out" />
<feComposite in2="SourceAlpha" operator="in" result="edge" />
${light("upper", 1, upperLight)}
${light("lower", -1, lowerLight)}
<feMerge>
${shadow ? '<feMergeNode in="shadow" />' : ""}
<feMergeNode in="SourceGraphic" />
<feMergeNode in="edge" />
<feMergeNode in="upper" />
<feMergeNode in="lower" />
</feMerge>
</filter>`;
}
function litDefs({ tileEdge, markEdge, markShadow }) {
const markBody = `
<linearGradient id="markBody" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#FFFFFF" />
<stop offset="0.4" stop-color="#FFFFFF" />
<stop offset="1" stop-color="#D9DFE9" />
</linearGradient>`;
const tileGlass = glassFilter({
id: "tileGlass",
edge: tileEdge,
edgeWidth: 3,
lightWidth: 3.6,
upperLight: 0.82,
lowerLight: 0.45,
});
const markGlass = glassFilter({
id: "markGlass",
edge: markEdge,
edgeWidth: 1.2,
lightWidth: 1.6,
upperLight: 1,
lowerLight: 0.6,
shadow: { ...markShadow, blur: 9, offset: 8 },
});
return `${markBody}${tileGlass}${markGlass}`;
}
function brandMark(stroke) {
const svg = readFileSync(brandMarkPath, "utf8");
const outline = svg.match(/\bd="([^"]+)"/);
const strokeWidth = svg.match(/\bstroke-width="([^"]+)"/);
if (!outline || !strokeWidth) {
throw new Error(`No stroked mark path in ${brandMarkPath}`);
}
// The path carries its own `fill="none"`: Icon Composer ignores the one on the <svg> element and
// draws a hairline from the end of the stroke back to its start.
return `<path d="${outline[1]}" fill="none" stroke="${stroke}" stroke-width="${strokeWidth[1]}" stroke-linecap="round" stroke-linejoin="round" />`;
}
function scaledAboutCentre(scale, content) {
const centre = TILE / 2;
return `<g transform="translate(${centre} ${centre}) scale(${scale}) translate(${-centre} ${-centre})">${content}</g>`;
}
// A square canvas with the 700-unit artwork box centred on it and covering `boxOnCanvas` of its
// width.
function canvasSvg(boxOnCanvas, content) {
const canvasUnits = TILE / boxOnCanvas;
const origin = (TILE - canvasUnits) / 2;
return [
`<svg width="${CANVAS}" height="${CANVAS}" viewBox="${origin} ${origin} ${canvasUnits} ${canvasUnits}" fill="none" xmlns="http://www.w3.org/2000/svg">`,
content,
"</svg>",
].join("\n");
}
// The tile with the mark on it. A masked tile has the continuous corners cut into the artwork. A
// square tile is for platforms that apply their own mask.
function tileIconSvg({ artwork, finish, tileOnCanvas, corners }) {
const look = artwork[finish];
const isLit = finish === "lit";
const filtered = (id, content) => (isLit ? `<g filter="url(#${id})">${content}</g>` : content);
const tile =
corners === "continuous" ? `<g clip-path="url(#tile)">${look.surface}</g>` : look.surface;
const mark = scaledAboutCentre(MARK_SCALE, brandMark(isLit ? "url(#markBody)" : "#FFFFFF"));
return canvasSvg(
tileOnCanvas,
[
`<defs><clipPath id="tile">${TILE_SHAPE}</clipPath>${look.defs}${isLit ? litDefs(look) : ""}</defs>`,
filtered("tileGlass", tile),
filtered("markGlass", mark),
].join("\n"),
);
}
// The white mark alone on a transparent canvas, its ink covering `inkOnCanvas` of the width.
function markOnlySvg(inkOnCanvas) {
return canvasSvg((inkOnCanvas * TILE) / MARK_INK, brandMark("#FFFFFF"));
}
function rasterizer(svg) {
const source = Buffer.from(svg);
const sized = (size) => sharp(source).resize(size, size);
return {
png: (size) => sized(size).png({ compressionLevel: 9 }).toBuffer(),
opaquePng: (size) => sized(size).removeAlpha().png({ compressionLevel: 9 }).toBuffer(),
rgba: (size) => sized(size).ensureAlpha().raw().toBuffer(),
};
}
// ICO: a directory of PNG-encoded entries. A size byte of 0 means 256.
function encodeIco(entries) {
const header = Buffer.alloc(6);
header.writeUInt16LE(1, 2);
header.writeUInt16LE(entries.length, 4);
let offset = header.length + entries.length * 16;
const directory = entries.map(({ size, png }) => {
const entry = Buffer.alloc(16);
entry.writeUInt8(size % 256, 0);
entry.writeUInt8(size % 256, 1);
entry.writeUInt16LE(1, 4);
entry.writeUInt16LE(32, 6);
entry.writeUInt32LE(png.length, 8);
entry.writeUInt32LE(offset, 12);
offset += png.length;
return entry;
});
return Buffer.concat([header, ...directory, ...entries.map((entry) => entry.png)]);
}
function icnsElement(type, data) {
const header = Buffer.alloc(8);
header.write(type, 0, "latin1");
header.writeUInt32BE(header.length + data.length, 4);
return Buffer.concat([header, data]);
}
// The 16 and 32 pixel ICNS slots predate PNG: three run-length-encoded colour planes plus a
// separate 8-bit alpha mask. A control byte below 128 copies the next (byte + 1) values, so
// literal-only chunks are a valid encoding.
function icnsLegacyElements(colorType, maskType, rgba) {
const pixels = rgba.length / 4;
const chunks = [];
for (let channel = 0; channel < 3; channel += 1) {
for (let start = 0; start < pixels; start += 128) {
const length = Math.min(128, pixels - start);
const chunk = Buffer.alloc(length + 1);
chunk[0] = length - 1;
for (let index = 0; index < length; index += 1) {
chunk[index + 1] = rgba[(start + index) * 4 + channel];
}
chunks.push(chunk);
}
}
const mask = Buffer.alloc(pixels);
for (let index = 0; index < pixels; index += 1) {
mask[index] = rgba[index * 4 + 3];
}
return [icnsElement(colorType, Buffer.concat(chunks)), icnsElement(maskType, mask)];
}
async function encodeIcns(icon) {
const pngSlots = [
["ic07", 128],
["ic08", 256],
["ic09", 512],
["ic10", 1024],
["ic11", 32],
["ic12", 64],
["ic13", 256],
["ic14", 512],
];
const elements = [
...icnsLegacyElements("is32", "s8mk", await icon.rgba(16)),
...icnsLegacyElements("il32", "l8mk", await icon.rgba(32)),
];
for (const [type, size] of pngSlots) {
elements.push(icnsElement(type, await icon.png(size)));
}
const body = Buffer.concat(elements);
const header = Buffer.alloc(8);
header.write("icns", 0, "latin1");
header.writeUInt32BE(header.length + body.length, 4);
return Buffer.concat([header, body]);
}
// The Icon Composer document macOS 26 and later build the app icon from. The canvas is the whole
// tile: macOS adds the mask, the margin, and the lighting. The mark stays opaque so it reads as
// solid white on the black tile.
function iconComposerFiles() {
const layer = "butterfly.svg";
const document = {
fill: { solid: "srgb:0.00000,0.00000,0.00000,1.00000" },
groups: [
{
layers: [{ "image-name": layer, name: "butterfly" }],
shadow: { kind: "neutral", opacity: 0.5 },
translucency: { enabled: false, value: 0.5 },
},
],
"supported-platforms": { squares: ["macOS"] },
};
return [
["icon.json", `${JSON.stringify(document, null, 2)}\n`],
[`Assets/${layer}`, `${markOnlySvg(MARK_INK_ON_TILE)}\n`],
];
}
function write(file, data) {
const target = path.join(repoRoot, file);
mkdirSync(path.dirname(target), { recursive: true });
writeFileSync(target, data);
}
function desktopIcon(artwork, finish, tileOnCanvas) {
return rasterizer(tileIconSvg({ artwork, finish, tileOnCanvas, corners: "continuous" }));
}
async function buildDesktopIcons() {
const production = desktopIcon(PRODUCTION, "flat", WINDOWS_LINUX_TILE_ON_CANVAS);
const assets = "packages/desktop/assets";
const pngFiles = [
["icon.png", 512],
["32x32.png", 32],
["64x64.png", 64],
["128x128.png", 128],
["128x128@2x.png", 256],
];
for (const [file, size] of pngFiles) {
write(`${assets}/${file}`, await production.png(size));
}
const icoEntries = [];
for (const size of [32, 16, 24, 48, 64, 256]) {
icoEntries.push({ size, png: await production.png(size) });
}
write(`${assets}/icon.ico`, encodeIco(icoEntries));
write(
`${assets}/icon.icns`,
await encodeIcns(desktopIcon(PRODUCTION, "flat", MACOS_TILE_ON_CANVAS)),
);
for (const [file, content] of iconComposerFiles()) {
write(`${assets}/icon.icon/${file}`, content);
}
write(
`${assets}/icon-dev.png`,
await desktopIcon(BLUEPRINT, "flat", MACOS_TILE_ON_CANVAS).png(CANVAS),
);
}
async function buildMobileIcons() {
const flat = (corners) =>
rasterizer(tileIconSvg({ artwork: PRODUCTION, finish: "flat", tileOnCanvas: 1, corners }));
// iOS masks these itself, and Expo flattens any transparency in the app icon onto white.
const square = flat("square");
// Shown as supplied, so the corners are part of the artwork.
const masked = flat("continuous");
const adaptiveForeground = rasterizer(markOnlySvg(ANDROID_ADAPTIVE_VISIBLE * MARK_INK_ON_TILE));
const notification = rasterizer(markOnlySvg(NOTIFICATION_MARK_INK));
write("packages/app/assets/images/icon.png", await square.opaquePng(1024));
write("packages/app/public/apple-touch-icon.png", await square.opaquePng(180));
write(
"packages/app/assets/images/android-icon-foreground.png",
await adaptiveForeground.png(1024),
);
write("packages/app/assets/images/notification-icon.png", await notification.png(96));
write("packages/app/assets/images/splash-icon.png", await masked.png(1024));
write("packages/app/public/pwa-icon-192.png", await masked.png(192));
write("packages/app/public/pwa-icon-512.png", await masked.png(512));
write("fastlane/metadata/android/en-US/images/icon.png", await masked.png(512));
}
async function buildLitIcons() {
for (const [file, artwork] of [
["paseo-lit.png", PRODUCTION],
["paseo-dev-lit.png", BLUEPRINT],
]) {
const icon = desktopIcon(artwork, "lit", MACOS_TILE_ON_CANVAS);
write(`assets/brand/app-icons/${file}`, await icon.png(CANVAS));
}
}
await buildDesktopIcons();
await buildMobileIcons();
await buildLitIcons();
+3 -1
View File
@@ -80,7 +80,9 @@ Provider checks follow the signals their runtimes expose:
- Codex queries background terminals for loaded threads, including native children, and protects
pending provider requests. App servers without the terminal-list RPC stay resident.
- OpenCode checks active executions and descendants. V1 checks PTYs; v2 also checks shell and
inbox inventories. The shared server remains leased while a session vetoes collection.
inbox inventories. The shared server remains leased while a session vetoes collection. V2 lets
another session's execution veto only when releasing the lease would stop the server; the shared
server stays up after its last lease goes.
- Pi checks streaming, compaction, pending replies, and adapter-owned operations. Known native
subagent signals also protect their parent through the daemon's subagent store.
- OMP additionally requires `get_state.isSettled: true` and `hasPendingAsyncWork: false`.
+3 -2
View File
@@ -240,7 +240,8 @@ snapshot so a mixed edit can apply its live subset and still name the paths that
// `extends` (one of the built-ins or `"acp"`) and `label`. See `provider-launch-config.ts`.
providers: Record<providerId, ProviderOverride>,
metadataGeneration: {
providers: [{ provider, model?, thinkingOptionId? }]
providers: [{ provider, model?, thinkingOptionId? }],
instructions?: string
}
},
pluginsEnabled: boolean,
@@ -319,7 +320,7 @@ Paseo tools; otherwise the provider policy applies. Provider and global policy a
session is created, resumed, imported, or reloaded, so configuration changes affect the next
session rather than an already-running one.
`agents.metadataGeneration.providers` selects the models for daemon-side metadata tasks: commit messages, PR text, branch names, and generated titles. An empty list is Automatic; a non-empty list is Manual and only those models are tried. See [public-docs/metadata-generation.md](../public-docs/metadata-generation.md#how-a-model-is-chosen).
`agents.metadataGeneration.providers` selects the models for daemon-side metadata tasks: commit messages, PR text, branch names, and generated titles. An empty list is Automatic; a non-empty list is Manual and only those models are tried. `agents.metadataGeneration.instructions` adds host-wide guidance to every metadata generation prompt alongside the built-in or per-project style. See [public-docs/metadata-generation.md](../public-docs/metadata-generation.md#how-a-model-is-chosen).
### Git process limits
+4
View File
@@ -972,6 +972,10 @@ reply text once, forks at its message, and shows its duration and stats. Read th
`getAssistantReply` (`packages/app/src/types/stream.ts`) instead of checking `kind ===
"assistant_message"`.
A provider-only fact about a tool call goes in the item's `metadata`, which transformers already
receive. Do not add a shared tool-call field for it. OMP's intent string is
[`metadata.intent`](../public-docs/plugins/reference.md#timeline-items).
Transformers run synchronously and must be deterministic. When several transformers match, the
first one that returns a result owns that source item. Plugin and registration ordering is stable.
See `plugin-examples/timeline-items` for the complete contract.
+1 -1
View File
@@ -30,7 +30,7 @@ Terminal directory snapshots (`terminalsChanged`) and workspace contribution cha
Each `onChange` delivers both the new snapshot and the `previous` one (`{ state, changedAt }`). The transition flows unchanged up through `TerminalSession.onActivityChange` (as `{ activity, previous }`), the worker protocol's `terminalActivityChange` event, and the manager-level `subscribeTerminalActivity(listener)` stream (`{ terminalId, name, cwd, activity, previous }`).
The daemon consumes these transitions, not snapshots. When a transition moves from `working` to `idle`, the tracker records finished attention, so the terminal shows the same green finished dot as an idle agent that needs review. The websocket layer also fires a "Terminal finished" attention notification. A terminal that exits while still working emits no turn-end notification.
The daemon consumes these transitions, not snapshots. When a transition moves from `working` to `idle`, the tracker records finished attention, so the terminal shows the same green finished dot as an idle agent that needs review. Focusing the terminal tab or using Mark as read on its owning workspace clears finished attention. Mark as read leaves needs-input attention alone, the same way it leaves an agent's pending permission. The websocket layer also fires a "Terminal finished" attention notification. A terminal that exits while still working emits no turn-end notification.
Terminal list visibility is `workspaceId`-scoped: a terminal belongs to the workspace that created it, and same-`cwd` sibling workspaces do not see it in their terminal lists. Terminal status routing starts from that owning workspace, uses the owning workspace's `cwd`, then fans the status bucket out to every active workspace with the same `cwd`.
@@ -0,0 +1,8 @@
- Host metadata instructions: Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests.
- Enterprise spending usage: Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times.
Fixed
- Fixed Android agent push notifications arriving minutes late during Doze
- Fixed Command Center results reordering mid-word while typing
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,8 @@
- Host metadata instructions: Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests.
- Enterprise spending usage: Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times.
Fixed
- Fixed Android agent push notifications arriving minutes late during Doze
- Fixed Command Center results reordering mid-word while typing
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,8 @@
- Host metadata instructions: Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests.
- Enterprise spending usage: Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times.
Fixed
- Fixed Android agent push notifications arriving minutes late during Doze
- Fixed Command Center results reordering mid-word while typing
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,8 @@
- Host metadata instructions: Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests.
- Enterprise spending usage: Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times.
Fixed
- Fixed Android agent push notifications arriving minutes late during Doze
- Fixed Command Center results reordering mid-word while typing
Full notes: https://paseo.sh/changelog
Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

+4 -1
View File
@@ -128,6 +128,8 @@ buildNpmPackage {
cd packages/desktop
# The Nix output is not a distributable DMG, so leave it unsigned and
# disable the hardened runtime that requires a matching signature.
# Compiling the Icon Composer document needs Xcode, which the build
# does not have, so use the prebuilt icns.
CSC_IDENTITY_AUTO_DISCOVERY=false \
npm exec --offline -- electron-builder \
--config electron-builder.yml \
@@ -138,7 +140,8 @@ buildNpmPackage {
--config.buildVersion=${lib.escapeShellArg buildVersion} \
--config.mac.identity=null \
--config.mac.hardenedRuntime=false \
--config.mac.notarize=false
--config.mac.notarize=false \
--config.mac.icon=assets/icon.icns
)
''}
+1 -1
View File
@@ -1 +1 @@
sha256-SZV3WTKLb+JhxWNo/jWyx+2sipzfL93YbbqQSihd3Wo=
sha256-aal9eR571blWuL7CZt1LR+KfA4QPJ0ivVl/GSTWy93o=
+29 -29
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.18.0",
"version": "0.18.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.18.0",
"version": "0.18.1",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -37541,7 +37541,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.18.0",
"version": "0.18.1",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -39694,13 +39694,13 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.18.0",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.18.0",
"@getpaseo/protocol": "0.18.0",
"@getpaseo/server": "0.18.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/server": "0.18.1",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
@@ -39947,11 +39947,11 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.18.0",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/protocol": "0.18.0",
"@getpaseo/relay": "0.18.0",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/relay": "0.18.1",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
@@ -39963,7 +39963,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.18.0",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40206,7 +40206,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.18.0",
"version": "0.18.1",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40252,7 +40252,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.18.0",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/language": "6.12.4",
@@ -40282,7 +40282,7 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.18.0",
"version": "0.18.1",
"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.18.0",
"@getpaseo/protocol": "0.18.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@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.18.0",
"@getpaseo/protocol": "0.18.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"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.18.0",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"semver": "^7.8.5",
@@ -40351,7 +40351,7 @@
}
},
"packages/react-native-enriched-markdown": {
"version": "0.18.0",
"version": "0.18.1",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
@@ -40367,7 +40367,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.18.0",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^2.4.0",
@@ -40589,17 +40589,17 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.18.0",
"version": "0.18.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.18.0",
"@getpaseo/highlight": "0.18.0",
"@getpaseo/plugin": "0.18.0",
"@getpaseo/protocol": "0.18.0",
"@getpaseo/relay": "0.18.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/highlight": "0.18.1",
"@getpaseo/plugin": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/relay": "0.18.1",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/node": "2.1.2",
"@modelcontextprotocol/sdk": "1.29.0",
@@ -41550,7 +41550,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.18.0",
"version": "0.18.1",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
@@ -43161,7 +43161,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.18.0",
"version": "0.18.1",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.18.0",
"version": "0.18.1",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 43 KiB

@@ -2,6 +2,7 @@ import type { Locator } from "@playwright/test";
import { test, expect, type Page } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { daemonWsRoutePattern } from "../support/helpers/daemon-port";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
@@ -142,6 +143,38 @@ test.describe("Command center workspace management", () => {
}
});
test("keeps Rename workspace ahead of Rename agent across renam and rename", async ({ page }) => {
const workspace = await seedMockAgentWorkspace({
repoPrefix: "cc-rename-order-",
title: "Command center rename order",
model: "five-minute-stream",
});
try {
await openAgentRoute(page, workspace);
const panel = await openCommandCenter(page);
const searchInput = panel.getByTestId("command-center-input");
const renameWorkspace = action(panel, "Rename workspace");
const renameAgent = action(panel, "Rename agent");
for (const query of ["renam", "rename"]) {
await searchInput.fill(query);
await expect(renameWorkspace).toBeVisible({ timeout: 15_000 });
await expect(renameAgent).toBeVisible({ timeout: 15_000 });
const workspaceTop = (await renameWorkspace.boundingBox())?.y ?? Number.NaN;
const agentTop = (await renameAgent.boundingBox())?.y ?? Number.NaN;
expect(workspaceTop, query).toBeLessThan(agentTop);
}
await page.keyboard.press("Enter");
await expect(page.getByTestId("workspace-rename-modal-global-input")).toBeFocused({
timeout: 15_000,
});
} finally {
await workspace.cleanup();
}
});
test("copies the workspace path and confirms with a toast", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "cc-copy-path-" });
@@ -12,14 +12,25 @@ import {
import { expectWorkspaceTabVisible, openSessions } from "../support/helpers/archive-tab";
import { daemonWsRoutePattern } from "../support/helpers/daemon-port";
import { getServerId } from "../support/helpers/server-id";
import { switchWorkspaceViaSidebar } from "../support/helpers/workspace-ui";
import {
switchWorkspaceViaSidebar,
waitForSidebarHydration,
} from "../support/helpers/workspace-ui";
import {
closeMobileAgentSidebar,
expectMobileAgentSidebarHidden,
expectMobileAgentSidebarVisible,
openMobileAgentSidebar,
} from "../support/helpers/sidebar";
import { expectNewWorkspaceProjectSelected } from "../support/helpers/new-workspace";
import {
expectNewWorkspaceProjectSelected,
openGlobalNewWorkspaceComposer,
openStartingRefPicker,
selectBranchInPicker,
selectWorkspaceIsolation,
} from "../support/helpers/new-workspace";
import { gotoAppShell } from "../support/helpers/app";
import { seedWorkspace } from "../support/helpers/seed-client";
const TEST_COMMANDS = [
{
@@ -119,11 +130,18 @@ const TEST_COMMANDS_REPLY: ListCommandsReply = { commands: TEST_COMMANDS, error:
async function installListCommandsStub(
page: Page,
reply: () => ListCommandsReply | Promise<ListCommandsReply> = () => TEST_COMMANDS_REPLY,
options?: {
onClientMessage?: (message: string | Buffer, forward: () => void) => void;
},
): Promise<void> {
await page.routeWebSocket(daemonWsRoutePattern(), (ws) => {
const server = ws.connectToServer();
ws.onMessage((message) => {
if (options?.onClientMessage) {
options.onClientMessage(message, () => server.send(message));
return;
}
server.send(message);
});
@@ -169,6 +187,24 @@ async function installListCommandsStub(
});
}
async function holdWorkspaceCreateWithCommandsStub(page: Page): Promise<{ release: () => void }> {
let release: (() => void) | null = null;
await installListCommandsStub(page, undefined, {
onClientMessage(message, forward) {
if (typeof message === "string" && message.includes('"workspace.create.request"')) {
release = forward;
return;
}
forward();
},
});
return {
release: () => {
release?.();
},
};
}
function createHeldReply(): {
reply: () => Promise<ListCommandsReply>;
release: () => void;
@@ -450,6 +486,44 @@ test.describe("Composer autocomplete", () => {
}
});
test("shows autocomplete after closing the New Workspace branch picker and hides it while submitting", async ({
page,
}) => {
const heldCreate = await holdWorkspaceCreateWithCommandsStub(page);
const seeded = await seedWorkspace({ repoPrefix: "autocomplete-branch-picker-" });
try {
await gotoAppShell(page);
await waitForSidebarHydration(page);
await openGlobalNewWorkspaceComposer(page);
const input = composerLocator(page);
await expect(input).toBeEditable({ timeout: 30_000 });
await selectWorkspaceIsolation(page, "worktree");
await expect(page.getByTestId("new-workspace-ref-picker-trigger")).toBeVisible({
timeout: 30_000,
});
await openStartingRefPicker(page);
await selectBranchInPicker(page, "main");
await expect(input).toBeFocused();
await page.keyboard.type("/h");
const popover = page.getByTestId("composer-autocomplete-popover");
await expect(popover.getByText("/help", { exact: true }).first()).toBeVisible({
timeout: 30_000,
});
// Submitting while locked hides the autocomplete popover instead of leaving it over loading.
await page.getByTestId("workspace-create-submit").click();
await expect(input).not.toBeEditable({ timeout: 10_000 });
await expect(popover).toHaveCount(0);
} finally {
heldCreate.release();
await seeded.cleanup();
}
});
test("keeps New workspace off the running-agent command list before a project is chosen", async ({
page,
}) => {
@@ -111,3 +111,102 @@ test("replaces only the first configured metadata model", async ({ page }) => {
}
}
});
test("saves and clears host-wide metadata instructions without overwriting providers", async ({
page,
}, testInfo) => {
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previousConfig = await client.getDaemonConfig();
try {
await client.patchDaemonConfig({
metadataGeneration: {
providers: [{ provider: "mock", model: "ten-second-stream" }],
instructions: "",
},
});
await openMetadataGenerationSettings(page);
const instructionsRow = page.getByTestId("metadata-generation-instructions-row");
await expect(instructionsRow).toBeVisible();
await page.screenshot({
path: testInfo.outputPath("metadata-instructions-tucked-empty.png"),
fullPage: true,
});
await instructionsRow.click();
const instructionsSheet = page.getByTestId("metadata-generation-instructions-sheet");
const instructionsInput = page.getByTestId("metadata-generation-instructions-input");
const saveButton = page.getByTestId("metadata-generation-instructions-save");
await expect(instructionsSheet).toBeVisible();
await expect(saveButton).toBeDisabled();
await page.screenshot({
path: testInfo.outputPath("metadata-instructions-sheet-empty.png"),
fullPage: true,
animations: "disabled",
});
await instructionsInput.fill("Write in Simplified Chinese. Do not use em dashes.");
await expect(saveButton).toBeEnabled();
await saveButton.click();
await expect(instructionsSheet).toHaveCount(0);
await expect
.poll(async () => (await client.getDaemonConfig()).config.metadataGeneration)
.toEqual({
providers: [{ provider: "mock", model: "ten-second-stream" }],
instructions: "Write in Simplified Chinese. Do not use em dashes.",
});
await page.reload();
await expect(
page
.getByTestId("metadata-generation-instructions-row")
.getByText("Write in Simplified Chinese. Do not use em dashes."),
).toBeVisible();
await page.screenshot({
path: testInfo.outputPath("metadata-instructions-tucked-saved.png"),
fullPage: true,
});
// Verify compact layout keeps the tucked row and bottom sheet clean.
await page.setViewportSize({ width: 390, height: 844 });
await expect(page.getByTestId("metadata-generation-instructions-row")).toBeVisible();
await page.screenshot({
path: testInfo.outputPath("metadata-instructions-compact-row.png"),
fullPage: true,
});
await page.getByTestId("metadata-generation-instructions-row").click();
await expect(page.getByTestId("metadata-generation-instructions-input")).toHaveValue(
"Write in Simplified Chinese. Do not use em dashes.",
);
await page.screenshot({
path: testInfo.outputPath("metadata-instructions-compact-sheet.png"),
fullPage: true,
});
await page.getByTestId("metadata-generation-instructions-input").fill("");
await expect(page.getByTestId("metadata-generation-instructions-save")).toBeEnabled();
await page.getByTestId("metadata-generation-instructions-save").click();
await expect(page.getByTestId("metadata-generation-instructions-sheet")).toHaveCount(0);
await expect
.poll(async () => (await client.getDaemonConfig()).config.metadataGeneration)
.toEqual({
providers: [{ provider: "mock", model: "ten-second-stream" }],
});
} finally {
try {
await client.patchDaemonConfig({
metadataGeneration: {
providers: previousConfig.config.metadataGeneration.providers,
instructions: previousConfig.config.metadataGeneration.instructions ?? "",
},
});
} finally {
await client.close().catch(() => undefined);
}
}
});
@@ -6,6 +6,7 @@ import {
openStartingRefPicker,
selectBranchInPicker,
selectWorkspaceIsolation,
watchBrowserBranchSuggestions,
} from "../support/helpers/new-workspace";
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
@@ -16,6 +17,21 @@ const LONG_HOST_NAME =
"development-macbook-pro.local-connected-through-a-very-long-private-hostname";
const LONG_BRANCH_NAME =
"feat/app/add-amoled-theme-with-a-very-long-pull-request-and-branch-description";
const MANY_BRANCHES = Array.from(
{ length: 12 },
(_, index) => `feat/branch-${String(index + 1).padStart(2, "0")}`,
);
interface PopoverFrameSample {
t: number;
opacity: number;
top: number;
left: number;
width: number;
height: number;
rowCount: number;
mainTop: number | null;
}
function measureControlRightEdges(controls: HTMLElement[]) {
const measurements: Array<{ label: string | null; right: number }> = [];
@@ -26,13 +42,69 @@ function measureControlRightEdges(controls: HTMLElement[]) {
return measurements;
}
async function startPopoverFrameSampler(page: import("@playwright/test").Page): Promise<void> {
await page.evaluate(() => {
const win = window as unknown as {
__popoverFrames?: PopoverFrameSample[];
__popoverSamplerStop?: () => void;
};
const samples: PopoverFrameSample[] = [];
const start = performance.now();
let stopped = false;
let rafId = 0;
const tick = () => {
if (stopped) return;
const el = document.querySelector<HTMLElement>('[data-testid="combobox-desktop-container"]');
if (el) {
const style = getComputedStyle(el);
const opacity = Number.parseFloat(style.opacity || "1");
const rect = el.getBoundingClientRect();
const rows = el.querySelectorAll("[data-combobox-option-index]");
const mainEl = el.querySelector<HTMLElement>(
'[data-testid="new-workspace-ref-picker-branch-main"]',
);
samples.push({
t: Math.round(performance.now() - start),
opacity,
top: Math.round(rect.top),
left: Math.round(rect.left),
width: Math.round(rect.width),
height: Math.round(rect.height),
rowCount: rows.length,
mainTop: mainEl ? Math.round(mainEl.getBoundingClientRect().top) : null,
});
}
rafId = requestAnimationFrame(tick);
};
rafId = requestAnimationFrame(tick);
win.__popoverFrames = samples;
win.__popoverSamplerStop = () => {
stopped = true;
cancelAnimationFrame(rafId);
};
});
}
async function stopPopoverFrameSampler(
page: import("@playwright/test").Page,
): Promise<PopoverFrameSample[]> {
return page.evaluate(() => {
const win = window as unknown as {
__popoverFrames?: PopoverFrameSample[];
__popoverSamplerStop?: () => void;
};
win.__popoverSamplerStop?.();
return win.__popoverFrames ?? [];
});
}
test.describe("New workspace metadata row layout", () => {
let workspace: SeededWorkspace;
test.beforeEach(async () => {
workspace = await seedWorkspace({
repoPrefix: "new-workspace-layout-",
repo: { branches: [LONG_BRANCH_NAME] },
repo: { branches: [LONG_BRANCH_NAME, ...MANY_BRANCHES] },
});
});
@@ -84,4 +156,110 @@ test.describe("New workspace metadata row layout", () => {
).toBeLessThanOrEqual(composerRightRail + 1);
}
});
test("starting ref popover holds height and row positions on a cold first open", async ({
page,
}) => {
await page.setViewportSize({ width: 1280, height: 900 });
const branchWatch = await watchBrowserBranchSuggestions(page, { hold: true });
await gotoAppShell(page);
await waitForSidebarHydration(page);
await openNewWorkspaceComposer(page, {
projectKey: workspace.projectKey,
projectDisplayName: workspace.projectDisplayName,
});
await selectWorkspaceIsolation(page, "worktree");
await startPopoverFrameSampler(page);
await openStartingRefPicker(page);
const popover = page.getByTestId("combobox-desktop-container");
await expect(popover).toBeVisible({ timeout: 10_000 });
await branchWatch.waitForResponse();
// Give the loading state several frames to paint before releasing the branch list.
await page.waitForTimeout(120);
const loadingBox = await popover.boundingBox();
expect(loadingBox).not.toBeNull();
branchWatch.release();
await expect(page.getByTestId("new-workspace-ref-picker-branch-feat/branch-12")).toBeVisible({
timeout: 10_000,
});
await page.waitForTimeout(80);
const settledBox = await popover.boundingBox();
expect(settledBox).not.toBeNull();
const samples = await stopPopoverFrameSampler(page);
const visibleSamples = samples.filter((s) => s.opacity > 0.9);
expect(visibleSamples.length).toBeGreaterThan(0);
const heights = visibleSamples.map((s) => s.height);
const tops = visibleSamples.map((s) => s.top);
const mainTops = visibleSamples
.map((s) => s.mainTop)
.filter((value): value is number => value !== null);
expect(
Math.max(...heights) - Math.min(...heights),
`popover height shifted across visible frames: ${JSON.stringify(visibleSamples)}`,
).toBeLessThanOrEqual(1);
expect(
Math.max(...tops) - Math.min(...tops),
`popover top shifted across visible frames: ${JSON.stringify(visibleSamples)}`,
).toBeLessThanOrEqual(1);
expect(
mainTops.length > 0 ? Math.max(...mainTops) - Math.min(...mainTops) : 0,
`main row jumped vertically across visible frames: ${JSON.stringify(visibleSamples)}`,
).toBeLessThanOrEqual(1);
// Switching to Pull requests keeps the same frame height.
await page.getByTestId("new-workspace-ref-picker-tab-pull-requests").click();
await page.waitForTimeout(80);
const prBox = await popover.boundingBox();
expect(prBox).not.toBeNull();
expect(Math.abs(prBox!.height - settledBox!.height)).toBeLessThanOrEqual(1);
});
test("starting ref popover prefetches branches before the first click and clamps to short viewports", async ({
page,
}) => {
await page.setViewportSize({ width: 1280, height: 900 });
const branchWatch = await watchBrowserBranchSuggestions(page, { hold: false });
await gotoAppShell(page);
await waitForSidebarHydration(page);
await openNewWorkspaceComposer(page, {
projectKey: workspace.projectKey,
projectDisplayName: workspace.projectDisplayName,
});
await selectWorkspaceIsolation(page, "worktree");
// Branches must prefetch before the user ever clicks the trigger.
await branchWatch.waitForResponse();
await page.waitForTimeout(100);
await startPopoverFrameSampler(page);
await openStartingRefPicker(page);
await expect(page.getByTestId("new-workspace-ref-picker-branch-feat/branch-12")).toBeVisible({
timeout: 10_000,
});
await page.waitForTimeout(80);
const samples = await stopPopoverFrameSampler(page);
const firstVisible = samples.find((s) => s.opacity > 0.9);
expect(firstVisible).toBeDefined();
expect(firstVisible!.rowCount).toBeGreaterThan(5);
// Close and verify short viewport clamping keeps the popover inside the window.
await page.keyboard.press("Escape");
await page.setViewportSize({ width: 1280, height: 500 });
await openStartingRefPicker(page);
const popover = page.getByTestId("combobox-desktop-container");
await expect(popover).toBeVisible({ timeout: 10_000 });
await page.waitForTimeout(100);
const shortBox = await popover.boundingBox();
expect(shortBox).not.toBeNull();
expect(shortBox!.y + shortBox!.height).toBeLessThanOrEqual(500);
});
});
@@ -739,6 +739,70 @@ export async function delayBrowserWorkspaceCreatedResponse(
};
}
export interface BranchSuggestionsControl {
release(): void;
waitForRequest(): Promise<void>;
waitForResponse(): Promise<void>;
}
/**
* Intercepts `branch_suggestions_request` / `branch_suggestions_response` frames over the daemon
* WebSocket. Pass `hold: true` to keep responses queued until `release()` is called, or `hold: false`
* to observe prefetched responses without delaying them.
*/
export async function watchBrowserBranchSuggestions(
page: Page,
options: { hold: boolean },
): Promise<BranchSuggestionsControl> {
const frames = await loadSessionMessageReaders();
const daemonPortPattern = daemonWsRoutePattern();
const delayedForwards: Array<() => void> = [];
let releaseRequested = !options.hold;
let resolveRequest: (() => void) | null = null;
let resolveResponse: (() => void) | null = null;
const requestSeen = new Promise<void>((resolve) => {
resolveRequest = resolve;
});
const responseSeen = new Promise<void>((resolve) => {
resolveResponse = resolve;
});
await page.routeWebSocket(daemonPortPattern, (ws) => {
const server = ws.connectToServer();
ws.onMessage((message) => {
const sessionMessage = frames.client(message);
if (sessionMessage?.type === "branch_suggestions_request") {
resolveRequest?.();
}
server.send(message);
});
server.onMessage((message) => {
const sessionMessage = frames.server(message);
if (sessionMessage?.type === "branch_suggestions_response") {
resolveResponse?.();
if (!releaseRequested) {
delayedForwards.push(() => ws.send(message));
return;
}
}
ws.send(message);
});
});
return {
release() {
releaseRequested = true;
for (const forward of delayedForwards.splice(0)) {
forward();
}
},
waitForRequest: () => requestSeen,
waitForResponse: () => responseSeen,
};
}
type WorkspaceEntry = Awaited<
ReturnType<NewWorkspaceDaemonClient["fetchWorkspaces"]>
>["entries"][number];
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.18.0",
"version": "0.18.1",
"private": true,
"main": "index.ts",
"scripts": {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 19 KiB

@@ -366,6 +366,111 @@ describe("Command Center relevance ordering", () => {
expect(sectionResultIds(sections)).toEqual(["z-first", "a-second"]);
});
it("does not flip a higher-ranked prefix match when a shorter title completes on the last letter", () => {
const contributions = [
action({
id: "workspace:rename",
group: "workspace",
groupRank: -1,
rank: 21,
title: "Rename workspace",
}),
action({
id: "tab:rename-current",
group: "workspace",
groupRank: -1,
rank: 33,
title: "Rename",
}),
];
for (const query of ["r", "re", "ren", "rena", "renam", "rename"]) {
expect(sectionResultIds(buildContributionSections(contributions, query)), query).toEqual([
"workspace:rename",
"tab:rename-current",
]);
}
});
it("does not let a mid-phrase whole word leapfrog a start-of-title prefix mid-word", () => {
const contributions = [
action({
id: "workspace:pin",
group: "workspace",
groupRank: -1,
rank: 20,
title: "Pin to top",
}),
action({
id: "workspace:toggle-explorer-sidebar",
group: "workspace",
groupRank: -1,
rank: 25,
title: "Toggle Explorer sidebar",
}),
];
for (const query of ["t", "to"]) {
expect(sectionResultIds(buildContributionSections(contributions, query)), query).toEqual([
"workspace:toggle-explorer-sidebar",
"workspace:pin",
]);
}
});
it("keeps start-of-title priority even when the same token also appears as a whole word later", () => {
const contributions = [
action({
id: "later-only",
group: "workspace",
groupRank: -1,
rank: 1,
title: "Pin to top",
}),
action({
id: "starts-with-and-contains",
group: "workspace",
groupRank: -1,
rank: 2,
title: "Toggle to main",
}),
];
for (const query of ["t", "to"]) {
expect(sectionResultIds(buildContributionSections(contributions, query)), query).toEqual([
"starts-with-and-contains",
"later-only",
]);
}
});
it("does not flip word-start matches when one word finishes earlier than another", () => {
const contributions = [
action({
id: "workspace:toggle-explorer-sidebar",
group: "workspace",
groupRank: -1,
rank: 25,
title: "Toggle Explorer sidebar",
}),
action({
id: "tab:open:pull-request:side-pane",
group: "workspace",
groupRank: -1,
rank: 14,
title: "Open Pull request in side pane",
}),
];
// Registry order puts the lower-index item first; neither should jump past the other on "side".
for (const query of ["si", "sid", "side"]) {
expect(sectionResultIds(buildContributionSections(contributions, query)), query).toEqual([
"workspace:toggle-explorer-sidebar",
"tab:open:pull-request:side-pane",
]);
}
});
it("keeps Workspaces below contributions even on a perfect match", () => {
const projection = projectCommandCenterRows(
[
+55 -20
View File
@@ -1,9 +1,8 @@
import {
compareMatchScores,
type MatchClass,
type MatchScore,
scoreTextFields,
scoreMatch,
textFieldsMatchClass,
tokenizeQuery,
} from "@getpaseo/protocol/search/text-match";
import type { CommandCenterContribution } from "./contributions";
import type { CommandCenterListMetrics } from "./list-metrics";
@@ -20,10 +19,26 @@ const VISIBLE_FIELD_RANK = 0;
/** At least one token only matched a hidden keyword. */
const KEYWORD_FIELD_RANK = 1;
/**
* Left-edge match ranks for Command Center scoring, best to worst.
*
* Right-edge promotions (`TIER_EXACT`, `TIER_WHOLE_WORD`) are deliberately excluded here:
* whether a word or title happens to end on the latest keystroke flips row order mid-word as
* the user types (e.g., `"renam"` → `"rename"` jumping a shorter title ahead of `"Rename
* workspace"`, or `"t"` → `"to"` jumping `"Pin to top"` ahead of `"Toggle Explorer sidebar"`).
* Left-edge ranks can only stay the same or worsen as characters are appended to a token, so
* two rows that keep matching at the same left edge never swap places.
*/
const FIELD_START_RANK = 0;
const WORD_START_RANK = 1;
const INSIDE_WORD_RANK = 2;
const SCATTERED_RANK = 3;
export interface CommandCenterScore {
/** VISIBLE_FIELD_RANK or KEYWORD_FIELD_RANK. Compared before match quality. */
fieldRank: number;
match: MatchScore;
/** Sum of per-token left-edge ranks (FIELD_START..SCATTERED). Lower is better. */
matchRank: number;
}
/**
@@ -44,7 +59,7 @@ export function compareCommandCenterScores(
left: CommandCenterScore,
right: CommandCenterScore,
): number {
return left.fieldRank - right.fieldRank || compareMatchScores(left.match, right.match);
return left.fieldRank - right.fieldRank || left.matchRank - right.matchRank;
}
export interface CommandCenterWorkspaceProject {
@@ -148,12 +163,41 @@ export interface CommandCenterSearchFields {
hidden: readonly string[];
}
function scoreTokenInField(token: string, field: string): number | null {
// Check start-of-field first: `scoreMatch` prefers a later whole word (tier 1) over a leading
// prefix (tier 2), which would otherwise demote a field starting with the token when the same
// token also appears as a standalone word later in the field.
if (field.toLowerCase().startsWith(token)) return FIELD_START_RANK;
const score = scoreMatch(token, field);
if (!score) return null;
if (score.tier <= 3) return WORD_START_RANK;
if (score.tier === 4) return INSIDE_WORD_RANK;
return SCATTERED_RANK;
}
function scoreFieldsLeftEdge(tokens: readonly string[], fields: readonly string[]): number | null {
let total = 0;
for (const token of tokens) {
let best: number | null = null;
for (const field of fields) {
const rank = scoreTokenInField(token, field);
if (rank !== null && (best === null || rank < best)) {
best = rank;
if (best === FIELD_START_RANK) break;
}
}
if (best === null) return null;
total += best;
}
return total;
}
/**
* The one definition of "how well did this row match", shared by every scored row kind. Null
* means the row is filtered out, so scoring and filtering are the same pass — a separate boolean
* predicate would throw this result away and force the token scan a second time.
*
* Matching is per-token (`scoreTextFields` splits on whitespace and every token must land in
* Matching is per-token (`tokenizeQuery` splits on whitespace and every token must land in
* some field), so token order does not matter and `lab des` finds "Label as Design". This can
* only ever widen the result set: tokens hold no whitespace, so any token that was found in the
* old space-joined haystack lies entirely within one field and is still found here.
@@ -165,11 +209,12 @@ export function scoreSearchFields(
query: string,
fields: CommandCenterSearchFields,
): CommandCenterScore | null {
const visible = scoreTextFields(query, [...fields.visible]);
if (visible) return { fieldRank: VISIBLE_FIELD_RANK, match: visible };
const tokens = tokenizeQuery(query);
const visible = scoreFieldsLeftEdge(tokens, fields.visible);
if (visible !== null) return { fieldRank: VISIBLE_FIELD_RANK, matchRank: visible };
if (fields.hidden.length === 0) return null;
const match = scoreTextFields(query, [...fields.visible, ...fields.hidden]);
return match ? { fieldRank: KEYWORD_FIELD_RANK, match } : null;
const matchRank = scoreFieldsLeftEdge(tokens, [...fields.visible, ...fields.hidden]);
return matchRank !== null ? { fieldRank: KEYWORD_FIELD_RANK, matchRank } : null;
}
/** How closely the query matched the fields; see `MatchClass`. Null when it does not match. */
@@ -245,16 +290,6 @@ export function compareByRecency(left: CommandCenterRecentRow, right: CommandCen
return (right.activityAt?.getTime() ?? 0) - (left.activityAt?.getTime() ?? 0);
}
/**
* Rank built-in rows by the kind of match they made: which fields matched, then the matcher's
* tier. Offset and spread are deliberately left out. They only say where in the title the word
* happened to sit, so "usage" in "Deliver sidebar usage" and in "expose usage data" would be
* ordered by sentence position. Leaving them out makes those rows equal, and recency decides.
*/
export function compareBuiltInScores(left: CommandCenterScore, right: CommandCenterScore): number {
return left.fieldRank - right.fieldRank || left.match.tier - right.match.tier;
}
/**
* Group contributions into their sections, ranked by the query. `includeQueryOnly` lists the
* contributions that otherwise wait for a query, for a list whose whole job is browsing them.
@@ -49,7 +49,8 @@ function source(gitActions: GitActions): {
previousTab: "Previous tab",
nextTab: "Next tab",
closeCurrentTab: "Close current tab",
renameTab: "Rename",
renameAgent: "Rename agent",
renameTerminal: "Rename terminal",
reloadAgent: "Reload agent",
copyResumeCommand: "Copy resume command",
copyAgentId: "Copy agent id",
@@ -282,6 +283,26 @@ describe("workspace command center contributions", () => {
expect(fixture.dispatched).toEqual([{ id: "workspace.rename", scope: "workspace" }]);
});
it("labels active tab rename by the active tab kind", () => {
const agentFixture = source({ primary: null, secondary: [], menu: [] });
agentFixture.value.activeTabCount = 1;
agentFixture.value.activeTabIndex = 0;
agentFixture.value.activeTabKind = "agent";
const agentRename = buildWorkspaceCommandCenterContributions(agentFixture.value).find(
(item) => item.id === "tab:rename-current",
);
expect(agentRename?.presentation).toMatchObject({ title: "Rename agent" });
const terminalFixture = source({ primary: null, secondary: [], menu: [] });
terminalFixture.value.activeTabCount = 1;
terminalFixture.value.activeTabIndex = 0;
terminalFixture.value.activeTabKind = "terminal";
const terminalRename = buildWorkspaceCommandCenterContributions(terminalFixture.value).find(
(item) => item.id === "tab:rename-current",
);
expect(terminalRename?.presentation).toMatchObject({ title: "Rename terminal" });
});
it("copies the workspace path without going through the dispatcher", () => {
const fixture = source({ primary: null, secondary: [], menu: [] });
const contributions = buildWorkspaceCommandCenterContributions(fixture.value);
@@ -29,7 +29,8 @@ export interface WorkspaceCommandCenterLabels {
previousTab: string;
nextTab: string;
closeCurrentTab: string;
renameTab: string;
renameAgent: string;
renameTerminal: string;
reloadAgent: string;
copyResumeCommand: string;
copyAgentId: string;
@@ -299,7 +300,10 @@ function buildActiveTabContributions(
buildQueryAction(source, {
id: "tab:rename-current",
rank: 33,
title: source.labels.renameTab,
title:
source.activeTabKind === "agent"
? source.labels.renameAgent
: source.labels.renameTerminal,
keywords: ["tab", "rename", "current"],
icon: source.icons.rename,
action: { id: "workspace.tab.rename-current", scope: "workspace" },
@@ -249,7 +249,8 @@ export function useWorkspaceCommandCenterActions(): void {
previousTab: t("settings.shortcuts.help.previousTab"),
nextTab: t("settings.shortcuts.help.nextTab"),
closeCurrentTab: t("settings.shortcuts.help.closeCurrentTab"),
renameTab: t("workspace.tabs.menu.rename"),
renameAgent: t("workspace.tabs.menu.renameAgent"),
renameTerminal: t("workspace.tabs.menu.renameTerminal"),
reloadAgent: t("workspace.tabs.menu.reloadAgent"),
copyResumeCommand: t("workspace.tabs.menu.copyResumeCommand"),
copyAgentId: t("workspace.tabs.menu.copyAgentId"),
@@ -94,7 +94,7 @@ describe("workspace ranking", () => {
expect(ids([text, subject], "42")).toEqual(["payments", "a-text"]);
});
it("orders workspaces in the same match tier by recency", () => {
it("orders workspaces in the same match class by recency at every prefix", () => {
const older = workspace({
id: "older",
title: "Usage hover card",
@@ -105,7 +105,25 @@ describe("workspace ranking", () => {
title: "Deliver sidebar usage",
activityAt: new Date("2026-10-17T00:00:00Z"),
});
expect(ids([older, newer], "usage")).toEqual(["newer", "older"]);
for (const query of ["u", "us", "usa", "usag", "usage"]) {
expect(ids([older, newer], query), query).toEqual(["newer", "older"]);
}
});
it("does not flip a newer workspace below an older exact-title workspace on the final character", () => {
const newer = workspace({
id: "newer",
title: "paseo command center",
activityAt: new Date("2026-10-17T00:00:00Z"),
});
const older = workspace({
id: "older",
title: "paseo",
activityAt: new Date("2026-10-01T00:00:00Z"),
});
for (const query of ["p", "pa", "pas", "pase", "paseo"]) {
expect(ids([newer, older], query), query).toEqual(["newer", "older"]);
}
});
it("lists every workspace most recent first when the query is empty", () => {
@@ -1,7 +1,7 @@
import { compareMatchClasses, type MatchClass } from "@getpaseo/protocol/search/text-match";
import {
compareBuiltInScores,
compareByRecency,
compareCommandCenterScores,
scoreSearchFields,
searchFieldsMatchClass,
type CommandCenterScore,
@@ -69,13 +69,14 @@ function scoreCandidate(query: string, fields: CommandCenterSearchFields): Candi
function compareCandidates(left: Candidate, right: Candidate): number {
return (
compareMatchClasses(left.matchClass, right.matchClass) ||
compareBuiltInScores(left.score, right.score)
compareCommandCenterScores(left.score, right.score)
);
}
/**
* Change-request hits first, host-only matches last; then match class, the workspace's own text
* ahead of an agent, match quality, and recency.
* ahead of an agent, and recency. Positional sub-tiers inside a match class are deliberately
* omitted so workspaces do not flip mid-word as a prefix finishes a word or title.
*/
function compareScoredWorkspaces(left: ScoredWorkspace, right: ScoredWorkspace): number {
if (left.changeRequestHit !== right.changeRequestHit) {
@@ -89,10 +90,6 @@ function compareScoredWorkspaces(left: ScoredWorkspace, right: ScoredWorkspace):
if (classDelta !== 0) return classDelta;
}
if (left.via !== right.via) return left.via - right.via;
if (left.candidate && right.candidate) {
const scoreDelta = compareBuiltInScores(left.candidate.score, right.candidate.score);
if (scoreDelta !== 0) return scoreDelta;
}
return compareByRecency(left.workspace, right.workspace);
}
@@ -70,4 +70,34 @@ describe("buildDesktopFrameStyle", () => {
expect(frameStyle).toMatchObject({ width: 360, minWidth: 360, maxWidth: 360 });
});
it("clamps a fixed height's minHeight and maxHeight to the available viewport height", () => {
const styles = buildDesktopFrameStyle({
desktopMinWidth: 440,
desktopLockWidth: false,
referenceWidth: 120,
desktopFixedHeight: 400,
desktopPositionStyle: { left: 0, top: 0 },
shouldHideDesktopContent: false,
availableHeight: 280,
}) as Array<ViewStyle | null>;
expect(styles[1]).toEqual({ minHeight: 280, maxHeight: 280 });
expect(styles[4]).toBeNull();
});
it("keeps the requested fixed height when viewport space exceeds it", () => {
const styles = buildDesktopFrameStyle({
desktopMinWidth: 440,
desktopLockWidth: false,
referenceWidth: 120,
desktopFixedHeight: 400,
desktopPositionStyle: { left: 0, top: 0 },
shouldHideDesktopContent: false,
availableHeight: 600,
}) as Array<ViewStyle | null>;
expect(styles[1]).toEqual({ minHeight: 400, maxHeight: 400 });
expect(styles[4]).toBeNull();
});
});
@@ -10,6 +10,17 @@ export interface DesktopFrameStyleInput {
availableHeight: number | undefined;
}
function resolveFixedHeight(
desktopFixedHeight: number | undefined,
availableHeight: number | undefined,
): number | null {
if (desktopFixedHeight == null) return null;
if (typeof availableHeight === "number") {
return Math.min(availableHeight, desktopFixedHeight);
}
return desktopFixedHeight;
}
export function buildDesktopFrameStyle(input: DesktopFrameStyleInput): StyleProp<ViewStyle> {
const {
desktopMinWidth,
@@ -20,14 +31,15 @@ export function buildDesktopFrameStyle(input: DesktopFrameStyleInput): StyleProp
shouldHideDesktopContent,
availableHeight,
} = input;
const resolvedFixedHeight = resolveFixedHeight(desktopFixedHeight, availableHeight);
const fixedHeightStyle =
desktopFixedHeight != null
? { minHeight: desktopFixedHeight, maxHeight: desktopFixedHeight }
resolvedFixedHeight != null
? { minHeight: resolvedFixedHeight, maxHeight: resolvedFixedHeight }
: null;
const hiddenStyle = shouldHideDesktopContent ? { opacity: 0 } : null;
const availableHeightStyle =
typeof availableHeight === "number"
? { maxHeight: Math.min(availableHeight, desktopFixedHeight ?? 400) }
resolvedFixedHeight == null && typeof availableHeight === "number"
? { maxHeight: Math.min(availableHeight, 400) }
: null;
const floor = Math.max(desktopMinWidth ?? 0, referenceWidth ?? 200);
const widthStyle = desktopLockWidth
+23 -1
View File
@@ -29,6 +29,10 @@ const FIELD_CHROME = { sm: "chromeSm", md: "chromeMd" } as const satisfies Recor
ControlSize,
string
>;
const FIELD_MULTILINE_CHROME = {
sm: "chromeMultilineSm",
md: "chromeMultilineMd",
} as const satisfies Record<ControlSize, string>;
const FIELD_TEXT = { sm: "inputSm", md: "inputMd" } as const satisfies Record<ControlSize, string>;
interface FieldProps {
@@ -179,6 +183,9 @@ export const FormTextInput = forwardRef<EditingTextInputHandle, FormTextInputPro
const size = sizeProp ?? containedSize ?? "md";
const isDisabled = editable === false;
const chromeSizeStyle = formInputStyles[FIELD_CHROME[size]];
const chromeMultilineStyle = props.multiline
? formInputStyles[FIELD_MULTILINE_CHROME[size]]
: null;
const inputSizeStyle = formInputStyles[FIELD_TEXT[size]];
const splitStyle = useMemo(() => splitFormTextInputStyle(style), [style]);
const setInputRef = useCallback(
@@ -209,6 +216,7 @@ export const FormTextInput = forwardRef<EditingTextInputHandle, FormTextInputPro
({ hovered = false }: PressableStateCallbackType & { hovered?: boolean }) => [
formInputStyles.chrome,
chromeSizeStyle,
chromeMultilineStyle,
leading ? formInputStyles.chromeWithLeading : null,
resolveControlInteractionStyles(
{
@@ -226,7 +234,15 @@ export const FormTextInput = forwardRef<EditingTextInputHandle, FormTextInputPro
invalid ? formInputStyles.controlInvalid : null,
splitStyle.chromeStyle,
],
[chromeSizeStyle, focused, invalid, isDisabled, leading, splitStyle.chromeStyle],
[
chromeMultilineStyle,
chromeSizeStyle,
focused,
invalid,
isDisabled,
leading,
splitStyle.chromeStyle,
],
);
return (
@@ -292,6 +308,12 @@ const formInputStyles = StyleSheet.create((theme) => {
chromeMd: {
...geometry.fieldControlMd,
},
chromeMultilineSm: {
paddingVertical: theme.spacing[2],
},
chromeMultilineMd: {
paddingVertical: theme.spacing[3],
},
controlRest: {
...geometry.controlRest,
},
+1 -1
View File
@@ -2609,7 +2609,7 @@ function ComposerContentImpl({
recall={recall}
inputRef={messageInputRef}
anchorStyle={messageInputContainerStyle}
show={mode.showAutocomplete && !isFullscreen}
show={mode.showAutocomplete && !isFullscreen && !isComposerLocked}
ref={autocompleteRef}
configuration={autocompleteConfiguration}
>
+5 -1
View File
@@ -2568,7 +2568,7 @@ export const ar: TranslationResources = {
metadataGeneration: {
title: "إنشاء البيانات الوصفية",
description:
"اختر النموذج الذي يستخدمه Paseo لعناوين مساحات العمل وأسماء الفروع ورسائل الالتزام ومسودات طلبات السحب",
"اختر النموذج والتعليمات التي يستخدمها Paseo لعناوين مساحات العمل وأسماء الفروع ورسائل الالتزام ومسودات طلبات السحب",
selection: "اختيار النموذج",
automatic: "تلقائي",
preferred: "يدوي",
@@ -2576,6 +2576,10 @@ export const ar: TranslationResources = {
preferredHint: "اختر النموذج الذي يستخدمه Paseo",
model: "النموذج",
modelHint: "يُستخدم هذا النموذج فقط. إذا فشل، لا يجرّب Paseo نموذجًا آخر",
instructions: "التعليمات",
instructionsHint: "تُطبَّق على جميع البيانات الوصفية المنشأة على هذا المضيف",
instructionsPlaceholder:
"مثال: اكتب باللغة العربية. حافظ على أسلوب متسق بين العناوين ورسائل الالتزام. لا تستخدم الشرطات الطويلة.",
docs: "الوثائق",
saveError: "تعذر تحديث إنشاء البيانات الوصفية",
},
+5 -1
View File
@@ -2666,7 +2666,7 @@ export const en = {
metadataGeneration: {
title: "Metadata generation",
description:
"Choose the model Paseo uses for workspace titles, branch names, commit messages, and pull request drafts",
"Choose the model and instructions Paseo uses for workspace titles, branch names, commit messages, and pull request drafts",
selection: "Model selection",
automatic: "Automatic",
preferred: "Manual",
@@ -2674,6 +2674,10 @@ export const en = {
preferredHint: "Choose the model Paseo uses",
model: "Model",
modelHint: "Only this model is used. If it fails, Paseo does not try another model",
instructions: "Instructions",
instructionsHint: "Applied to all generated metadata on this host",
instructionsPlaceholder:
"Example: Write in Simplified Chinese. Keep phrasing consistent across titles and commits. Do not use em dashes.",
docs: "Docs",
saveError: "Unable to update metadata generation",
},
+5 -1
View File
@@ -2590,7 +2590,7 @@ export const es: TranslationResources = {
metadataGeneration: {
title: "Generación de metadatos",
description:
"Elige el modelo que Paseo usa para títulos de espacios de trabajo, nombres de ramas, mensajes de commit y borradores de pull requests",
"Elige el modelo y las instrucciones que Paseo usa para títulos de espacios de trabajo, nombres de ramas, mensajes de commit y borradores de pull requests",
selection: "Selección de modelo",
automatic: "Automática",
preferred: "Manual",
@@ -2598,6 +2598,10 @@ export const es: TranslationResources = {
preferredHint: "Elige el modelo que usa Paseo",
model: "Modelo",
modelHint: "Solo se usa este modelo. Si falla, Paseo no prueba otro modelo",
instructions: "Instrucciones",
instructionsHint: "Se aplican a todos los metadatos generados en este host",
instructionsPlaceholder:
"Ejemplo: Escribe en español. Mantén un estilo coherente entre títulos y commits. No uses rayas largas.",
docs: "Documentación",
saveError: "No se pudo actualizar la generación de metadatos",
},
+5 -1
View File
@@ -2590,7 +2590,7 @@ export const fr: TranslationResources = {
metadataGeneration: {
title: "Génération de métadonnées",
description:
"Choisissez le modèle utilisé par Paseo pour les titres d’espaces de travail, les noms de branches, les messages de commit et les brouillons de pull request",
"Choisissez le modèle et les instructions utilisés par Paseo pour les titres d’espaces de travail, les noms de branches, les messages de commit et les brouillons de pull request",
selection: "Sélection du modèle",
automatic: "Automatique",
preferred: "Manuel",
@@ -2598,6 +2598,10 @@ export const fr: TranslationResources = {
preferredHint: "Choisissez le modèle utilisé par Paseo",
model: "Modèle",
modelHint: "Seul ce modèle est utilisé. S’il échoue, Paseo n’essaie pas d’autre modèle",
instructions: "Instructions",
instructionsHint: "Appliquées à toutes les métadonnées générées sur cet hôte",
instructionsPlaceholder:
"Exemple : Écrire en français. Garder une formulation cohérente entre les titres et les commits. Ne pas utiliser de tirets cadratins.",
docs: "Documentation",
saveError: "Impossible de mettre à jour la génération de métadonnées",
},
+5 -1
View File
@@ -2558,7 +2558,7 @@ export const ja: TranslationResources = {
metadataGeneration: {
title: "メタデータ生成",
description:
"ワークスペースのタイトル、ブランチ名、コミットメッセージ、プルリクエストの下書きに使用するモデルを選択します",
"ワークスペースのタイトル、ブランチ名、コミットメッセージ、プルリクエストの下書きに使用するモデルと指示を選択します",
selection: "モデル選択",
automatic: "自動",
preferred: "手動",
@@ -2566,6 +2566,10 @@ export const ja: TranslationResources = {
preferredHint: "Paseo が使用するモデルを選択します",
model: "モデル",
modelHint: "このモデルのみを使用します。失敗しても、Paseo は別のモデルを試しません",
instructions: "指示",
instructionsHint: "このホストで生成されるすべてのメタデータに適用されます",
instructionsPlaceholder:
"例:日本語で書く。タイトルとコミットメッセージの表現を統一する。全角ダッシュを使わない。",
docs: "ドキュメント",
saveError: "メタデータ生成を更新できません",
},
+5 -1
View File
@@ -2544,7 +2544,7 @@ export const ko: TranslationResources = {
metadataGeneration: {
title: "메타데이터 생성",
description:
"워크스페이스 제목, 브랜치 이름, 커밋 메시지 및 풀 리퀘스트 초안에 사용할 모델을 선택하세요",
"워크스페이스 제목, 브랜치 이름, 커밋 메시지 및 풀 리퀘스트 초안에 사용할 모델과 지침을 선택하세요",
selection: "모델 선택",
automatic: "자동",
preferred: "수동",
@@ -2552,6 +2552,10 @@ export const ko: TranslationResources = {
preferredHint: "Paseo에서 사용할 모델을 선택하세요",
model: "모델",
modelHint: "이 모델만 사용합니다. 실패해도 Paseo는 다른 모델을 시도하지 않습니다",
instructions: "지침",
instructionsHint: "이 호스트에서 생성되는 모든 메타데이터에 적용됩니다",
instructionsPlaceholder:
"예: 한국어로 작성하세요. 제목과 커밋 메시지의 문체를 일관되게 유지하세요. 긴 대시(—)는 사용하지 마세요.",
docs: "문서",
saveError: "메타데이터 생성을 업데이트할 수 없습니다",
},
+5 -1
View File
@@ -2575,7 +2575,7 @@ export const ptBR: TranslationResources = {
metadataGeneration: {
title: "Geração de metadados",
description:
"Escolha o modelo usado pelo Paseo para títulos de espaços de trabalho, nomes de branches, mensagens de commit e rascunhos de pull request",
"Escolha o modelo e as instruções usados pelo Paseo para títulos de espaços de trabalho, nomes de branches, mensagens de commit e rascunhos de pull request",
selection: "Seleção de modelo",
automatic: "Automática",
preferred: "Manual",
@@ -2583,6 +2583,10 @@ export const ptBR: TranslationResources = {
preferredHint: "Escolha o modelo que o Paseo usa",
model: "Modelo",
modelHint: "Somente este modelo é usado. Se ele falhar, o Paseo não tenta outro modelo",
instructions: "Instruções",
instructionsHint: "Aplicadas a todos os metadados gerados neste host",
instructionsPlaceholder:
"Exemplo: Escreva em português. Mantenha o estilo coerente entre títulos e commits. Não use travessões.",
docs: "Documentação",
saveError: "Não foi possível atualizar a geração de metadados",
},
+5 -1
View File
@@ -2575,7 +2575,7 @@ export const ru: TranslationResources = {
metadataGeneration: {
title: "Генерация метаданных",
description:
"Выберите модель, которую Paseo будет использовать для названий рабочих пространств и веток, сообщений коммитов и черновиков PR",
"Выберите модель и инструкции, которые Paseo будет использовать для названий рабочих пространств и веток, сообщений коммитов и черновиков PR",
selection: "Выбор модели",
automatic: "Автоматически",
preferred: "Вручную",
@@ -2584,6 +2584,10 @@ export const ru: TranslationResources = {
model: "Модель",
modelHint:
"Используется только эта модель. Если она не сработает, Paseo не будет пробовать другую модель",
instructions: "Инструкции",
instructionsHint: "Применяются ко всем метаданным, создаваемым на этом хосте",
instructionsPlaceholder:
"Пример: Пиши на русском языке. Сохраняй единый стиль в названиях и коммитах. Не используй длинное тире.",
docs: "Документация",
saveError: "Не удалось обновить настройки генерации метаданных",
},
+5 -1
View File
@@ -2507,7 +2507,7 @@ export const zhCN: TranslationResources = {
plugins: pluginSettings["zh-CN"],
metadataGeneration: {
title: "元数据生成",
description: "选择 Paseo 用于工作区标题、分支名称、提交消息和拉取请求草稿的模型",
description: "选择 Paseo 用于工作区标题、分支名称、提交消息和拉取请求草稿的模型和指令",
selection: "模型选择",
automatic: "自动",
preferred: "手动",
@@ -2515,6 +2515,10 @@ export const zhCN: TranslationResources = {
preferredHint: "选择 Paseo 使用的模型",
model: "模型",
modelHint: "只使用此模型。如果失败,Paseo 不会尝试其他模型",
instructions: "指令",
instructionsHint: "应用于此主机上生成的所有元数据",
instructionsPlaceholder:
"例如:使用简体中文编写。保持标题与提交信息的风格一致。不要使用破折号。",
docs: "文档",
saveError: "无法更新元数据生成设置",
},
@@ -17,7 +17,28 @@ function isFocusTarget(value: unknown): value is FocusTarget {
}
function canRestoreFocusTo(target: FocusTarget): boolean {
return !(target instanceof HTMLElement) || document.contains(target);
if (typeof document === "undefined") return false;
return (
typeof HTMLElement === "undefined" ||
!(target instanceof HTMLElement) ||
document.contains(target)
);
}
function shouldRestoreFocusAfterRemoval(
removedScope: HTMLElement | null,
openerElement: Element | null,
activeAtRemove: Element | null,
): boolean {
if (typeof document === "undefined") return false;
const current = document.activeElement;
if (!current || current === document.body || current === document.documentElement) {
return true;
}
if (removedScope?.contains(current)) {
return true;
}
return openerElement !== null && current === openerElement && activeAtRemove === openerElement;
}
interface WebOverlayEntry {
@@ -26,6 +47,7 @@ interface WebOverlayEntry {
getScope: () => HTMLElement | null;
getKeyHandler: () => WebOverlayKeyHandler;
restoreFocus: FocusTarget | null;
openerElement: Element | null;
manageFocus: boolean;
}
@@ -35,6 +57,7 @@ let webOverlayFocusCheckQueued = false;
interface RemoveWebOverlayOptions {
restoreFocus?: boolean;
deferFocusRestore?: boolean;
}
function getTopWebOverlay(): WebOverlayEntry | undefined {
@@ -165,17 +188,48 @@ function addWebOverlay(entry: WebOverlayEntry): (options?: RemoveWebOverlayOptio
}
});
let removed = false;
let removedScope: HTMLElement | null = null;
let activeAtRemove: Element | null = null;
let topAfterRemove: OverlayEntry | undefined;
return (options) => {
window.cancelAnimationFrame(focusFrame);
remove();
detachWebOverlayListeners();
if (!removed) {
removed = true;
removedScope = entry.getScope();
activeAtRemove = typeof document !== "undefined" ? document.activeElement : null;
remove();
topAfterRemove = overlays.getTop();
detachWebOverlayListeners();
}
if (
entry.manageFocus &&
options?.restoreFocus !== false &&
entry.restoreFocus &&
canRestoreFocusTo(entry.restoreFocus)
!entry.manageFocus ||
options?.restoreFocus === false ||
!entry.restoreFocus ||
!canRestoreFocusTo(entry.restoreFocus)
) {
entry.restoreFocus.focus();
return;
}
const target = entry.restoreFocus;
const restore = () => {
if (
overlays.getTop() === topAfterRemove &&
shouldRestoreFocusAfterRemoval(removedScope, entry.openerElement, activeAtRemove) &&
canRestoreFocusTo(target)
) {
target.focus();
}
};
if (options?.deferFocusRestore) {
// Unmount cleanups run during React's mutation commit phase while its DOM event
// system is disabled, which drops synchronous focusin events (breaking onFocus
// and onSelect on restored text inputs). Defer focus restoration until the commit ends.
queueMicrotask(restore);
} else {
restore();
}
};
}
@@ -199,6 +253,7 @@ export function useOverlayRegistration({
const layerRef = useRef(layer);
const keyHandlerRef = useRef(onKeyDown);
const capturedRestoreFocusRef = useRef<FocusTarget | null>(null);
const capturedOpenerElementRef = useRef<Element | null>(null);
const removeEntryRef = useRef<((options?: RemoveWebOverlayOptions) => void) | null>(null);
const detachedRemoveEntryRef = useRef<((options?: RemoveWebOverlayOptions) => void) | null>(null);
const registeredRef = useRef(false);
@@ -209,12 +264,16 @@ export function useOverlayRegistration({
layerRef.current = layer;
keyHandlerRef.current = onKeyDown;
if (active && !wasActiveRef.current && typeof document !== "undefined") {
const activeElement =
typeof HTMLElement !== "undefined" && document.activeElement instanceof HTMLElement
? document.activeElement
: null;
capturedOpenerElementRef.current = activeElement;
const requestedRestoreTarget = preferredRestoreFocusRef?.current;
if (isFocusTarget(requestedRestoreTarget)) {
capturedRestoreFocusRef.current = requestedRestoreTarget;
} else {
capturedRestoreFocusRef.current =
document.activeElement instanceof HTMLElement ? document.activeElement : null;
capturedRestoreFocusRef.current = activeElement;
}
}
wasActiveRef.current = active;
@@ -224,8 +283,9 @@ export function useOverlayRegistration({
activeRef.current && typeof window !== "undefined" && typeof document !== "undefined";
if (!shouldRegister) {
const shouldRestoreFocus = !activeRef.current;
const removeEntry = removeEntryRef.current ?? detachedRemoveEntryRef.current;
if (registeredRef.current || shouldRestoreFocus) {
removeEntryRef.current?.({ restoreFocus: shouldRestoreFocus });
removeEntry?.({ restoreFocus: shouldRestoreFocus });
}
registeredRef.current = false;
if (shouldRestoreFocus) {
@@ -243,6 +303,7 @@ export function useOverlayRegistration({
getScope: () => scopeRef.current,
getKeyHandler: () => keyHandlerRef.current,
restoreFocus: capturedRestoreFocusRef.current,
openerElement: capturedOpenerElementRef.current,
manageFocus,
};
removeEntryRef.current = addWebOverlay(entry);
@@ -251,16 +312,24 @@ export function useOverlayRegistration({
const setScope = useCallback(
(node: unknown) => {
scopeRef.current =
const nextScope =
typeof HTMLElement !== "undefined" && node instanceof HTMLElement ? node : null;
if (!scopeRef.current && activeRef.current) {
if (!nextScope) {
// Detach from the overlay stack before clearing scopeRef so removeEntry records
// the departing scope. Focus restoration runs in the layout effect when active
// flips false (after React re-enables DOM events and before passive effects run),
// or in unmount cleanup if the host unmounts while active.
const removeEntry = removeEntryRef.current;
removeEntry?.({ restoreFocus: false });
detachedRemoveEntryRef.current = removeEntry;
removeEntryRef.current = null;
registeredRef.current = false;
if (removeEntry) {
removeEntry({ restoreFocus: false });
detachedRemoveEntryRef.current = removeEntry;
removeEntryRef.current = null;
registeredRef.current = false;
}
scopeRef.current = null;
return;
}
scopeRef.current = nextScope;
// Host refs attach before descendant layout effects and autofocus. Register
// here so the previous overlay cannot redirect that pending focus.
syncRegistration();
@@ -268,16 +337,24 @@ export function useOverlayRegistration({
[syncRegistration],
);
// Register and deactivate during the layout phase, when React's DOM event system is
// enabled (so synchronous focus restoration delivers onFocus/onSelect) and before
// passive effects run.
useLayoutEffect(() => {
syncRegistration();
}, [active, syncRegistration]);
// Unmount cleanup runs during React's mutation phase while DOM events are disabled,
// so focus restoration on unmount-while-active defers to a microtask.
useLayoutEffect(() => {
return () => {
const removeEntry = removeEntryRef.current ?? detachedRemoveEntryRef.current;
removeEntry?.();
removeEntry?.({ deferFocusRestore: true });
removeEntryRef.current = null;
detachedRemoveEntryRef.current = null;
registeredRef.current = false;
};
}, [active, syncRegistration]);
}, []);
return setScope;
}
@@ -1,6 +1,6 @@
import { useGlobalOverlayLayer } from "./overlay-root";
import { useOverlayRegistration } from "@/keyboard";
import React, { type RefCallback } from "react";
import React, { useCallback, useEffect, useRef, type RefCallback } from "react";
import { flushSync } from "react-dom";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
@@ -24,6 +24,129 @@ function OverlayHarness({ active, showScope }: { active: boolean; showScope: boo
) : null;
}
function InnerOverlay({
active,
restoreFocusRef,
}: {
active: boolean;
restoreFocusRef?: React.RefObject<unknown>;
}) {
const setScope = useOverlayRegistration({
keys: ["Escape"],
active,
layer: 20,
onKeyDown: () => false,
restoreFocusRef,
});
return active ? (
<div ref={setScope as RefCallback<HTMLDivElement>} tabIndex={-1}>
<input data-testid="overlay-search" />
</div>
) : null;
}
function TextareaOverlayHarness({
open,
mountOverlay = true,
useExplicitRestoreRef,
events,
selections,
}: {
open: boolean;
mountOverlay?: boolean;
useExplicitRestoreRef: boolean;
events: string[];
selections: number[];
}) {
const textareaRef = useRef<HTMLTextAreaElement | null>(null);
const focusHandleRef = useRef<{ focus: () => void }>({
focus: () => textareaRef.current?.focus(),
});
const handleFocus = useCallback(() => {
events.push("focus");
}, [events]);
const handleBlur = useCallback(() => {
events.push("blur");
}, [events]);
const handleSelect = useCallback(
(event: React.SyntheticEvent<HTMLTextAreaElement>) => {
selections.push(event.currentTarget.selectionStart);
},
[selections],
);
return (
<div>
<textarea
ref={textareaRef}
data-testid="restored-textarea"
onFocus={handleFocus}
onBlur={handleBlur}
onSelect={handleSelect}
/>
{mountOverlay ? (
<InnerOverlay
active={open}
restoreFocusRef={useExplicitRestoreRef ? focusHandleRef : undefined}
/>
) : null}
</div>
);
}
function AutofocusReplacementHarness({
open,
showInlineInput,
blurs,
}: {
open: boolean;
showInlineInput: boolean;
blurs: string[];
}) {
const handleBlur = useCallback(() => {
blurs.push("blur");
}, [blurs]);
return (
<div>
<InnerOverlay active={open} />
{showInlineInput ? (
<input autoFocus data-testid="inline-autofocus-input" onBlur={handleBlur} />
) : null}
</div>
);
}
function PassiveFocusOrderHarness({
open,
openedAfterClose,
}: {
open: boolean;
openedAfterClose: string[];
}) {
const triggerRef = useRef<HTMLButtonElement | null>(null);
useEffect(() => {
const trigger = triggerRef.current;
if (!trigger) return;
const onFocusIn = (event: FocusEvent) => {
if (!open && trigger.contains(event.target as Node)) {
openedAfterClose.push("focusin-while-enabled");
}
};
document.addEventListener("focusin", onFocusIn);
return () => {
document.removeEventListener("focusin", onFocusIn);
};
}, [open, openedAfterClose]);
return (
<div>
<button ref={triggerRef} type="button" data-testid="passive-trigger">
Trigger
</button>
<InnerOverlay active={open} restoreFocusRef={triggerRef} />
</div>
);
}
describe("useOverlayRegistration in the browser", () => {
let root: Root;
let container: HTMLDivElement;
@@ -74,6 +197,192 @@ describe("useOverlayRegistration in the browser", () => {
expect(openerFocusCalls).toBe(1);
});
it("delivers React onFocus and onSelect after restoring focus to a textarea", async () => {
const events: string[] = [];
const selections: number[] = [];
// Case 1: explicit restoreFocusRef handle closing via active: true -> false
flushSync(() =>
root.render(
<TextareaOverlayHarness
open={false}
useExplicitRestoreRef
events={events}
selections={selections}
/>,
),
);
const textarea = document.querySelector<HTMLTextAreaElement>(
'[data-testid="restored-textarea"]',
)!;
textarea.focus();
events.length = 0;
selections.length = 0;
flushSync(() =>
root.render(
<TextareaOverlayHarness
open
useExplicitRestoreRef
events={events}
selections={selections}
/>,
),
);
await nextFrame();
document.querySelector<HTMLInputElement>('[data-testid="overlay-search"]')?.focus();
expect(document.activeElement).not.toBe(textarea);
flushSync(() =>
root.render(
<TextareaOverlayHarness
open={false}
useExplicitRestoreRef
events={events}
selections={selections}
/>,
),
);
await nextFrame();
expect(document.activeElement).toBe(textarea);
expect(events).toContain("focus");
textarea.value = "/h";
textarea.setSelectionRange(2, 2);
textarea.dispatchEvent(new KeyboardEvent("keyup", { key: "h", bubbles: true }));
expect(selections).toContain(2);
// Case 2: captured activeElement closing via unmount while active
events.length = 0;
selections.length = 0;
textarea.value = "";
textarea.setSelectionRange(0, 0);
flushSync(() =>
root.render(
<TextareaOverlayHarness
open
mountOverlay
useExplicitRestoreRef={false}
events={events}
selections={selections}
/>,
),
);
await nextFrame();
document.querySelector<HTMLInputElement>('[data-testid="overlay-search"]')?.focus();
expect(document.activeElement).not.toBe(textarea);
flushSync(() =>
root.render(
<TextareaOverlayHarness
open
mountOverlay={false}
useExplicitRestoreRef={false}
events={events}
selections={selections}
/>,
),
);
await nextFrame();
expect(document.activeElement).toBe(textarea);
expect(events).toContain("focus");
textarea.value = "/help";
textarea.setSelectionRange(5, 5);
textarea.dispatchEvent(new KeyboardEvent("keyup", { key: "p", bubbles: true }));
expect(selections).toContain(5);
});
it("does not steal focus when another overlay opens in the same commit", async () => {
function StackedHarness({ which }: { which: "first" | "second" }) {
const firstScope = useOverlayRegistration({
keys: ["Escape"],
active: which === "first",
layer: 20,
onKeyDown: () => false,
});
const secondScope = useOverlayRegistration({
keys: ["Escape"],
active: which === "second",
layer: 30,
onKeyDown: () => false,
});
return (
<div>
{which === "first" ? (
<div ref={firstScope as RefCallback<HTMLDivElement>} tabIndex={-1}>
<input data-testid="first-input" />
</div>
) : (
<div ref={secondScope as RefCallback<HTMLDivElement>} tabIndex={-1}>
<input data-testid="second-input" />
</div>
)}
</div>
);
}
flushSync(() => root.render(<StackedHarness which="first" />));
await nextFrame();
document.querySelector<HTMLInputElement>('[data-testid="first-input"]')?.focus();
flushSync(() => root.render(<StackedHarness which="second" />));
const secondInput = document.querySelector<HTMLInputElement>('[data-testid="second-input"]')!;
secondInput.focus();
await nextFrame();
expect(document.activeElement).toBe(secondInput);
});
it("does not steal focus from an autofocused input mounted in the same commit", async () => {
const blurs: string[] = [];
flushSync(() =>
root.render(<AutofocusReplacementHarness open showInlineInput={false} blurs={blurs} />),
);
await nextFrame();
document.querySelector<HTMLInputElement>('[data-testid="overlay-search"]')?.focus();
expect(document.activeElement).not.toBe(opener);
flushSync(() =>
root.render(<AutofocusReplacementHarness open={false} showInlineInput blurs={blurs} />),
);
await nextFrame();
const inlineInput = document.querySelector<HTMLInputElement>(
'[data-testid="inline-autofocus-input"]',
);
expect(inlineInput).toBeTruthy();
expect(document.activeElement).toBe(inlineInput);
expect(blurs).toEqual([]);
});
it("restores focus during layout effects before passive focusin listeners re-enable", async () => {
const openedAfterClose: string[] = [];
flushSync(() =>
root.render(<PassiveFocusOrderHarness open={false} openedAfterClose={openedAfterClose} />),
);
const trigger = document.querySelector<HTMLButtonElement>('[data-testid="passive-trigger"]')!;
trigger.focus();
openedAfterClose.length = 0;
flushSync(() =>
root.render(<PassiveFocusOrderHarness open openedAfterClose={openedAfterClose} />),
);
await nextFrame();
document.querySelector<HTMLInputElement>('[data-testid="overlay-search"]')?.focus();
expect(document.activeElement).not.toBe(trigger);
flushSync(() =>
root.render(<PassiveFocusOrderHarness open={false} openedAfterClose={openedAfterClose} />),
);
await nextFrame();
expect(document.activeElement).toBe(trigger);
expect(openedAfterClose).toEqual([]);
});
});
describe("hasOpenDomPopover", () => {
@@ -53,6 +53,35 @@ describe("plugin timeline projection", () => {
},
);
it("passes tool-call metadata to timeline transformers", () => {
const source: StreamItem = {
kind: "tool_call",
id: "tool-intent",
timestamp: new Date(0),
payload: {
source: "agent",
data: {
provider: "omp",
callId: "call-1",
name: "bash",
status: "running",
error: null,
detail: { type: "unknown", input: null, output: null },
metadata: { intent: "Inspect files" },
},
},
};
const seen: unknown[] = [];
const transform: TimelineItemTransform = ({ item }) => {
if (item.type === "tool_call") seen.push(item.metadata?.intent);
return undefined;
};
projectPluginTimelineItems([source], transform);
expect(seen).toEqual(["Inspect files"]);
});
it("does not expose mutable tool detail from stream state", () => {
const detail = { type: "read" as const, filePath: "/repo/original.ts" };
const source: StreamItem = {
@@ -1365,6 +1365,7 @@ it("retains semantic agent messages across disk-cache reconstruction", async ()
status: "completed",
error: null,
detail: { type: "plain_text", text: "Done" },
metadata: { intent: "Deliver result" },
agentMessage: {
event: "finished",
sender: { id: "remote::worker", title: "Reviewer" },
+126 -54
View File
@@ -1034,6 +1034,10 @@ export function NewWorkspaceScreen({
useEffect(() => {
const trimmed = pickerSearchQuery.trim();
if (!trimmed) {
setDebouncedPickerSearchQuery("");
return;
}
const timer = setTimeout(() => setDebouncedPickerSearchQuery(trimmed), 180);
return () => clearTimeout(timer);
}, [pickerSearchQuery]);
@@ -1136,8 +1140,6 @@ export function NewWorkspaceScreen({
}, [selectedServerId, t]);
const clientReady = isConnected && Boolean(client);
const hasSelectedSourceDirectory = selectedSourceDirectory !== null;
const pickerQueryEnabled = pickerOpen && clientReady && hasSelectedSourceDirectory;
const { status: checkoutStatus } = useCheckoutStatusQuery({
serverId: selectedServerId,
@@ -1159,56 +1161,27 @@ export function NewWorkspaceScreen({
projectDirectory: selectedSourceDirectory,
});
const branchSuggestionsQuery = useQuery({
queryKey: [
"branch-suggestions",
selectedServerId,
selectedSourceDirectory,
debouncedPickerSearchQuery,
],
queryFn: async () => {
if (!selectedSourceDirectory) {
throw new Error("Choose a project");
}
const connectedClient = withConnectedClient();
return connectedClient.getBranchSuggestions({
cwd: selectedSourceDirectory,
query: debouncedPickerSearchQuery || undefined,
limit: 20,
});
},
enabled: pickerQueryEnabled,
staleTime: 15_000,
});
const changeRequestContext = useChangeRequestContext({
serverId: selectedServerId,
cwd: selectedSourceDirectory,
pickerOpen: pickerQueryEnabled,
selectedItem,
});
const githubPrSearchQuery = useForgeSearchQuery({
const {
branchDetails,
prItems,
changeRequestContext,
isBranchesLoading,
isBranchesFetching,
isPrsFetching,
} = useRefPickerQueries({
client,
clientReady,
serverId: selectedServerId,
cwd: selectedSourceDirectory ?? "",
query: debouncedPickerSearchQuery,
kinds: ["change_request"],
sourceDirectory: selectedSourceDirectory,
pickerOpen,
showRefPicker,
isScreenFocused,
debouncedSearchQuery: debouncedPickerSearchQuery,
supportsForgeSearch,
enabled: pickerQueryEnabled,
selectedItem,
withConnectedClient,
});
const branchDetails = useMemo(
() => normalizeBranchDetails(branchSuggestionsQuery.data),
[branchSuggestionsQuery.data],
);
const forgeSearchAuthenticated =
!githubPrSearchQuery.data || githubPrSearchQuery.data.authState === "authenticated";
const prItems: ForgeSearchItem[] = useMemo(() => {
if (!forgeSearchAuthenticated) return [];
return githubPrSearchQuery.data?.items ?? [];
}, [forgeSearchAuthenticated, githubPrSearchQuery.data?.items]);
const baseItem = useMemo(
() => selectedItem ?? (checkoutStatus ? defaultBasePickerItem(checkoutStatus) : null),
[checkoutStatus, selectedItem],
@@ -1584,11 +1557,6 @@ export function NewWorkspaceScreen({
[composerState, isPending],
);
const pickerEmptyText =
branchSuggestionsQuery.isFetching || githubPrSearchQuery.isFetching
? 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.
@@ -1655,7 +1623,9 @@ export function NewWorkspaceScreen({
selectedOptionId,
onSelect: handleSelectOption,
setSearchQuery: setPickerSearchQuery,
emptyText: pickerEmptyText,
isBranchesLoading,
isBranchesFetching,
isPrsFetching,
showRefPicker,
worktrees: projectWorktrees,
actionFor: refActionFor,
@@ -1912,9 +1882,111 @@ const styles = StyleSheet.create((theme) => ({
},
}));
/**
* The ref picker's branch, change-request, and forge-wording queries. Default branch suggestions
* and forge wording warm while the picker trigger is visible so the first open paints settled;
* change-request search stays gated on opening the picker.
*/
function useRefPickerQueries(input: {
client: ReturnType<typeof useHostRuntimeClient>;
clientReady: boolean;
serverId: string;
sourceDirectory: string | null;
pickerOpen: boolean;
showRefPicker: boolean;
isScreenFocused: boolean;
debouncedSearchQuery: string;
supportsForgeSearch: boolean;
selectedItem: PickerItem | null;
withConnectedClient: () => DaemonClient;
}) {
const {
client,
clientReady,
serverId,
sourceDirectory,
pickerOpen,
showRefPicker,
isScreenFocused,
debouncedSearchQuery,
supportsForgeSearch,
selectedItem,
withConnectedClient,
} = input;
const hasDirectory = sourceDirectory !== null;
const pickerQueryEnabled = pickerOpen && clientReady && hasDirectory;
const warmEnabled = showRefPicker && isScreenFocused && clientReady && hasDirectory;
const branchSuggestionsEnabled =
(pickerOpen || (warmEnabled && debouncedSearchQuery === "")) && clientReady && hasDirectory;
const branchSuggestionsQuery = useQuery({
queryKey: ["branch-suggestions", serverId, sourceDirectory, debouncedSearchQuery],
queryFn: async () => {
if (!sourceDirectory) {
throw new Error("Choose a project");
}
const connectedClient = withConnectedClient();
return connectedClient.getBranchSuggestions({
cwd: sourceDirectory,
query: debouncedSearchQuery || undefined,
limit: 20,
});
},
// Keep the previous result while typing a search query in the same project so rows do not
// blank out mid-search, without carrying branches across project or host switches.
placeholderData: (previousData, previousQuery) => {
const prevKey = previousQuery?.queryKey;
if (Array.isArray(prevKey) && prevKey[1] === serverId && prevKey[2] === sourceDirectory) {
return previousData;
}
return undefined;
},
enabled: branchSuggestionsEnabled,
staleTime: 15_000,
});
const changeRequestContext = useChangeRequestContext({
serverId,
cwd: sourceDirectory,
pickerOpen: pickerQueryEnabled || warmEnabled,
selectedItem,
});
const githubPrSearchQuery = useForgeSearchQuery({
client,
serverId,
cwd: sourceDirectory ?? "",
query: debouncedSearchQuery,
kinds: ["change_request"],
supportsForgeSearch,
enabled: pickerQueryEnabled,
});
const branchDetails = useMemo(
() => normalizeBranchDetails(branchSuggestionsQuery.data),
[branchSuggestionsQuery.data],
);
const forgeSearchAuthenticated =
!githubPrSearchQuery.data || githubPrSearchQuery.data.authState === "authenticated";
const prItems: ForgeSearchItem[] = useMemo(() => {
if (!forgeSearchAuthenticated) return [];
return githubPrSearchQuery.data?.items ?? [];
}, [forgeSearchAuthenticated, githubPrSearchQuery.data?.items]);
return {
branchDetails,
prItems,
changeRequestContext,
isBranchesLoading:
branchSuggestionsQuery.data === undefined && branchSuggestionsQuery.isFetching,
isBranchesFetching: branchSuggestionsQuery.isFetching,
isPrsFetching: githubPrSearchQuery.isFetching,
};
}
/**
* The project's forge names its change requests: pull requests, or merge requests on GitLab.
* The forge is looked up once the ref picker opens or a change request is chosen.
* The forge is looked up while the ref picker is shown or a change request is chosen.
*/
function useChangeRequestContext(input: {
serverId: string;
@@ -109,7 +109,10 @@ export interface NewWorkspaceFormProps {
selectedOptionId: string;
onSelect: (id: string) => void;
setSearchQuery: (query: string) => void;
emptyText: string;
/** True while the initial branch list for this project has not arrived yet. */
isBranchesLoading: boolean;
isBranchesFetching: boolean;
isPrsFetching: boolean;
showRefPicker: boolean;
/** Every git worktree of the project, to say where a branch is already checked out. */
worktrees: readonly CheckoutWorktree[];
@@ -296,10 +299,12 @@ function useRefPicker(base: NewWorkspaceFormProps["base"], isPending: boolean) {
const context = base.changeRequestContext;
const [list, setList] = useState<RefList>("branch");
const action = actionFor[list];
const options = useMemo(
() => refListOptions({ options: allOptions, itemById, selectedOptionId, kind: list, action }),
[action, allOptions, itemById, list, selectedOptionId],
);
const options = useMemo(() => {
// Wait for the initial branch list instead of painting a lone base row at index 0 that
// jumps down the moment newer branches arrive; the trigger already names the current base.
if (list === "branch" && base.isBranchesLoading) return [];
return refListOptions({ options: allOptions, itemById, selectedOptionId, kind: list, action });
}, [action, allOptions, base.isBranchesLoading, itemById, list, selectedOptionId]);
// Opens on the list the current pick is in.
const open = useCallback(() => {
setList(refListOf(selectedItem));
@@ -351,12 +356,17 @@ function useRefPicker(base: NewWorkspaceFormProps["base"], isPending: boolean) {
: t("newWorkspace.refPicker.branch"),
qualifier: undefined,
};
const isCurrentListFetching = list === "github-pr" ? base.isPrsFetching : base.isBranchesFetching;
const emptyText = isCurrentListFetching
? t("newWorkspace.refPicker.searching")
: t("newWorkspace.refPicker.noMatchingRefs");
return {
options,
open,
onSelect,
renderOption,
toolbar,
emptyText,
searchPlaceholder:
list === "github-pr"
? t("newWorkspace.refPicker.searchPullRequests", { context })
@@ -572,9 +582,10 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement
onSearchQueryChange={base.setSearchQuery}
desktopPlacement="bottom-start"
desktopMinWidth={440}
desktopFixedHeight={400}
anchorRef={base.anchorRef}
restoreFocusRef={restoreFocusRef}
emptyText={base.emptyText}
emptyText={refPicker.emptyText}
toolbar={refPicker.toolbar}
renderOption={refPicker.renderOption}
/>
@@ -3,24 +3,179 @@ import { Alert, Text, View } from "react-native";
import { useTranslation } from "react-i18next";
import { StyleSheet } from "react-native-unistyles";
import type { AgentProvider } from "@getpaseo/protocol/agent-types";
import type { MutableDaemonConfigPatch } from "@getpaseo/protocol/messages";
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
import { CombinedModelSelector } from "@/components/combined-model-selector";
import {
SettingsCard,
SettingsDetailRow,
SettingsRow,
SettingsSection,
} from "@/components/settings";
import { Button } from "@/components/ui/button";
import { FormTextInput } from "@/components/ui/form-field";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { SegmentedControl } from "@/components/ui/segmented-control";
import { useDaemonConfig } from "@/hooks/use-daemon-config";
import { useProvidersSnapshot } from "@/hooks/use-providers-snapshot";
import { buildSelectableProviderSelectorProviders } from "@/provider-selection/provider-selection";
import { SettingsSection } from "@/components/settings/headings/settings-section";
import { useHostFeature } from "@/runtime/host-features";
import { settingsStyles } from "@/styles/settings";
const METADATA_GENERATION_DOCS_URL = "https://paseo.sh/docs/metadata-generation";
type SelectionMode = "automatic" | "preferred";
export function MetadataGenerationPage({ serverId }: { serverId: string }) {
function MetadataInstructionsSheet({
initialInstructions,
patchConfig,
onClose,
}: {
initialInstructions: string;
patchConfig: (patch: MutableDaemonConfigPatch) => Promise<unknown>;
onClose: () => void;
}) {
const { t } = useTranslation();
const [draft, setDraft] = useState(initialInstructions);
const [isSaving, setIsSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
const header = useMemo<SheetHeader>(
() => ({
title: t("settings.metadataGeneration.instructions"),
subtitle: (
<Text style={styles.sheetSubtitle}>
{t("settings.metadataGeneration.instructionsHint")}
</Text>
),
}),
[t],
);
const normalizedDraft = draft.trim();
const canSave = normalizedDraft !== initialInstructions && !isSaving;
const handleChangeText = useCallback((nextText: string) => {
setDraft(nextText);
setError(null);
}, []);
const handleClose = useCallback(() => {
if (isSaving) return;
onClose();
}, [isSaving, onClose]);
const handleSave = useCallback(async () => {
setIsSaving(true);
setError(null);
try {
const updated = await patchConfig({
metadataGeneration: { instructions: normalizedDraft },
});
if (!updated) {
throw new Error(t("workspace.terminal.hostDisconnected"));
}
onClose();
} catch (err) {
setError(err instanceof Error ? err.message : String(err));
} finally {
setIsSaving(false);
}
}, [normalizedDraft, onClose, patchConfig, t]);
return (
<AdaptiveModalSheet
header={header}
visible
onClose={handleClose}
testID="metadata-generation-instructions-sheet"
desktopMaxWidth={560}
>
<FormTextInput
initialValue={initialInstructions}
onChangeText={handleChangeText}
placeholder={t("settings.metadataGeneration.instructionsPlaceholder")}
accessibilityLabel={t("settings.metadataGeneration.instructions")}
multiline
numberOfLines={4}
textAlignVertical="top"
autoFocus
editable={!isSaving}
invalid={error !== null}
style={styles.instructionsInput}
testID="metadata-generation-instructions-input"
/>
{error ? (
<Text
accessibilityRole="alert"
style={settingsStyles.rowError}
testID="metadata-generation-instructions-error"
>
{error}
</Text>
) : null}
<View style={styles.sheetActions}>
<Button variant="ghost" onPress={handleClose} disabled={isSaving}>
{t("common.actions.cancel")}
</Button>
<Button
variant="default"
onPress={handleSave}
disabled={!canSave}
loading={isSaving}
testID="metadata-generation-instructions-save"
>
{t("common.actions.save")}
</Button>
</View>
</AdaptiveModalSheet>
);
}
function MetadataInstructionsRow({
savedInstructions,
patchConfig,
}: {
savedInstructions: string;
patchConfig: (patch: MutableDaemonConfigPatch) => Promise<unknown>;
}) {
const { t } = useTranslation();
const [isEditing, setIsEditing] = useState(false);
const summary = savedInstructions ? savedInstructions.replace(/\s+/g, " ") : undefined;
const handleOpen = useCallback(() => setIsEditing(true), []);
const handleClose = useCallback(() => setIsEditing(false), []);
return (
<>
<SettingsDetailRow
label={t("settings.metadataGeneration.instructions")}
hint={t("settings.metadataGeneration.instructionsHint")}
summary={summary}
onPress={handleOpen}
testID="metadata-generation-instructions-row"
/>
{isEditing ? (
<MetadataInstructionsSheet
initialInstructions={savedInstructions}
patchConfig={patchConfig}
onClose={handleClose}
/>
) : null}
</>
);
}
function MetadataModelSelectionRows({
serverId,
configuredProviders,
patchConfig,
}: {
serverId: string;
configuredProviders: Array<{ provider: string; model?: string; thinkingOptionId?: string }>;
patchConfig: (patch: MutableDaemonConfigPatch) => Promise<unknown>;
}) {
const { t } = useTranslation();
const { config, isLoading: isConfigLoading, patchConfig } = useDaemonConfig(serverId);
const snapshot = useProvidersSnapshot(serverId);
const configuredProviders = config?.metadataGeneration.providers;
const configuredProvider = configuredProviders?.[0] ?? null;
const configuredProvider = configuredProviders[0] ?? null;
const providers = useMemo(
() =>
buildSelectableProviderSelectorProviders(snapshot.entries, {
@@ -78,7 +233,7 @@ export function MetadataGenerationPage({ serverId }: { serverId: string }) {
setDraftMode("preferred");
void saveProviders([
{ provider, ...(model ? { model } : {}) },
...(configuredProviders?.slice(1) ?? []),
...configuredProviders.slice(1),
]);
},
[configuredProviders, saveProviders],
@@ -91,6 +246,56 @@ export function MetadataGenerationPage({ serverId }: { serverId: string }) {
(provider: AgentProvider) => snapshot.refresh([provider]),
[snapshot],
);
return (
<>
<SettingsRow
label={t("settings.metadataGeneration.selection")}
hint={
mode === "automatic"
? t("settings.metadataGeneration.automaticHint")
: t("settings.metadataGeneration.preferredHint")
}
>
<SegmentedControl
options={modeOptions}
value={mode}
onValueChange={handleModeChange}
testID="metadata-generation-mode"
/>
</SettingsRow>
{mode === "preferred" ? (
<View style={settingsStyles.rowBorder}>
<SettingsRow
label={t("settings.metadataGeneration.model")}
hint={t("settings.metadataGeneration.modelHint")}
>
<CombinedModelSelector
providers={providers}
selectedProvider={configuredProvider?.provider ?? ""}
selectedModel={configuredProvider?.model ?? ""}
onSelect={handleModelSelect}
isLoading={snapshot.isLoading || snapshot.isFetching}
onOpen={handleSelectorOpen}
onRetryProvider={handleRetryProvider}
isRetryingProvider={snapshot.isRefreshing}
disabled={isSaving}
serverId={serverId}
desktopPlacement="bottom-start"
desktopMinWidth={360}
/>
</SettingsRow>
</View>
) : null}
</>
);
}
export function MetadataGenerationPage({ serverId }: { serverId: string }) {
const { t } = useTranslation();
const { config, isLoading: isConfigLoading, patchConfig } = useDaemonConfig(serverId);
// COMPAT(metadataGenerationInstructions): added in v0.18.0, remove gate after 2027-06-01.
const supportsInstructions = useHostFeature(serverId, "metadataGenerationInstructions");
const docsLink = useMemo(
() => ({ href: METADATA_GENERATION_DOCS_URL, label: t("settings.metadataGeneration.docs") }),
[t],
@@ -111,50 +316,20 @@ export function MetadataGenerationPage({ serverId }: { serverId: string }) {
link={docsLink}
testID="metadata-generation-settings"
>
<View style={settingsStyles.card}>
<View style={settingsStyles.row}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>
{t("settings.metadataGeneration.selection")}
</Text>
<Text style={settingsStyles.rowHint}>
{mode === "automatic"
? t("settings.metadataGeneration.automaticHint")
: t("settings.metadataGeneration.preferredHint")}
</Text>
</View>
<SegmentedControl
options={modeOptions}
value={mode}
onValueChange={handleModeChange}
testID="metadata-generation-mode"
<SettingsCard>
<MetadataModelSelectionRows
serverId={serverId}
configuredProviders={config.metadataGeneration.providers}
patchConfig={patchConfig}
/>
{supportsInstructions ? (
<MetadataInstructionsRow
key={serverId}
savedInstructions={config.metadataGeneration.instructions ?? ""}
patchConfig={patchConfig}
/>
</View>
{mode === "preferred" ? (
<View style={[settingsStyles.row, settingsStyles.rowBorder]}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{t("settings.metadataGeneration.model")}</Text>
<Text style={settingsStyles.rowHint}>
{t("settings.metadataGeneration.modelHint")}
</Text>
</View>
<CombinedModelSelector
providers={providers}
selectedProvider={configuredProvider?.provider ?? ""}
selectedModel={configuredProvider?.model ?? ""}
onSelect={handleModelSelect}
isLoading={snapshot.isLoading || snapshot.isFetching}
onOpen={handleSelectorOpen}
onRetryProvider={handleRetryProvider}
isRetryingProvider={snapshot.isRefreshing}
disabled={isSaving}
serverId={serverId}
desktopPlacement="bottom-start"
desktopMinWidth={360}
/>
</View>
) : null}
</View>
</SettingsCard>
</SettingsSection>
);
}
@@ -168,4 +343,16 @@ const styles = StyleSheet.create((theme) => ({
spinnerColor: {
color: theme.colors.foregroundMuted,
},
sheetSubtitle: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.sm,
},
instructionsInput: {
minHeight: 112,
},
sheetActions: {
flexDirection: "row",
justifyContent: "flex-end",
gap: theme.spacing[2],
},
}));
@@ -196,6 +196,18 @@ function makeStreamReducerEvent(
};
}
function receiveSteer() {
return processAgentStreamEvents({
events: [
makeStreamReducerEvent(makeAssistantTimelineEvent("with the uncommit", "m1"), 2),
makeStreamReducerEvent(makeTimelineEvent("keep going", "user_message"), 3),
],
currentTail: [],
currentHead: [],
currentCursor: { epoch: "epoch-1", startSeq: 1, endSeq: 1 },
});
}
function makeAssistantItem(
text: string,
id = `assistant-${text.length}`,
@@ -1780,6 +1792,52 @@ describe("processTimelineResponse", () => {
]);
});
it.each([
{ source: "live prefix", text: "with the uncommit", seq: 2 },
{ source: "earlier projected page", text: "with the uncommitted changes.", seq: 4 },
])("reuses the assistant row from the $source across a steer", ({ text, seq }) => {
const live = receiveSteer();
const result = processTimelineResponse({
...baseTimelineInput,
currentTail: [
{
...makeAssistantItem(text, "m1"),
messageId: "m1",
timelineCursor: { epoch: "epoch-1", seq },
},
...live.tail.slice(1),
],
currentHead: live.head,
currentCursor: live.cursor ?? undefined,
payload: {
...baseTimelineInput.payload,
direction: "after",
epoch: "epoch-1",
startCursor: { seq: 4 },
endCursor: { seq: 4 },
entries: [
{
...makeTimelineEntry(2, "with the uncommitted changes.", "assistant_message", 4),
sourceSeqRanges: [
{ startSeq: 2, endSeq: 2 },
{ startSeq: 4, endSeq: 4 },
],
item: {
type: "assistant_message",
text: "with the uncommitted changes.",
messageId: "m1",
},
},
],
},
});
expect([...result.tail, ...result.head]).toMatchObject([
{ kind: "assistant_message", text: "with the uncommitted changes.", messageId: "m1" },
{ kind: "user_message", text: "keep going" },
]);
});
it("keeps a tail submitted prompt before a reconciled live assistant head", () => {
const prompt = makeSubmittedUserMessage("new prompt", "submitted-new-prompt");
@@ -3977,6 +4035,22 @@ describe("processAgentStreamEvent", () => {
});
describe("processAgentStreamEvents", () => {
it("keeps a live reply in one row across a steer", () => {
const live = receiveSteer();
const result = processAgentStreamEvents({
events: [makeStreamReducerEvent(makeAssistantTimelineEvent("ted changes.", "m1"), 4)],
currentTail: live.tail,
currentHead: live.head,
currentCursor: live.cursor ?? undefined,
});
expect(result.tail).toEqual([]);
expect(result.head).toMatchObject([
{ kind: "assistant_message", text: "with the uncommitted changes.", messageId: "m1" },
{ kind: "user_message", text: "keep going" },
]);
});
it("coalesces contiguous assistant stream events into one head update and final cursor", () => {
const result = processAgentStreamEvents({
events: [
@@ -791,21 +791,38 @@ function reconcileOverlappingProjectedAssistant(params: {
epoch: string;
currentEndSeq: number;
}): { tail: StreamItem[]; head: StreamItem[]; reconciled: boolean } {
const { unit } = params;
if (
unit.event.type !== "timeline" ||
unit.event.item.type !== "assistant_message" ||
!unit.sourceSeqRanges.some(
(range) => range.startSeq <= params.currentEndSeq && range.endSeq > params.currentEndSeq,
)
) {
return { tail: params.tail, head: params.head, reconciled: false };
const { unit, currentEndSeq, epoch } = params;
const unchanged = { tail: params.tail, head: params.head, reconciled: false };
if (unit.event.type !== "timeline" || unit.event.item.type !== "assistant_message") {
return unchanged;
}
const projectedText = unit.event.item.text;
const projectedMessageId = unit.event.item.messageId;
const crossesCursor = unit.sourceSeqRanges.some(
(range) => range.startSeq <= currentEndSeq && range.endSeq > currentEndSeq,
);
// A steer occupies the gap between source ranges. Match that projected reply
// by its source positions because a tool call can split rows with the same id.
const coversItem = (item: AssistantMessageItem) => {
const cursor = item.timelineCursor;
return (
cursor?.epoch === epoch &&
unit.sourceSeqRanges.some(
(range) => range.startSeq <= cursor.seq && cursor.seq <= range.endSeq,
)
);
};
const bridgesSteer =
unit.sourceSeqRanges.length > 1 &&
projectedMessageId !== undefined &&
unit.seqEnd > currentEndSeq &&
unit.sourceSeqRanges.some((range) => range.endSeq <= currentEndSeq);
if (!crossesCursor && !bridgesSteer) return unchanged;
const matches = (item: StreamItem) => {
if (item.kind !== "assistant_message") return false;
if (bridgesSteer) return item.messageId === projectedMessageId && coversItem(item);
if (projectedMessageId && item.messageId) return item.messageId === projectedMessageId;
return projectedText.startsWith(item.text);
};
@@ -817,15 +834,13 @@ function reconcileOverlappingProjectedAssistant(params: {
const headMatch = findMatch(params.head);
const tailMatch = findMatch(params.tail);
const match = headMatch ?? tailMatch;
if (!match) {
return { tail: params.tail, head: params.head, reconciled: false };
}
// Keep a cached reply before the steer even if a live suffix also exists.
const match = bridgesSteer ? (tailMatch ?? headMatch) : (headMatch ?? tailMatch);
if (!match) return unchanged;
const messageId = projectedMessageId ?? match.current.messageId;
const replacement: AssistantMessageItem = {
kind: "assistant_message",
id: match.current.id,
...match.current,
...(messageId !== undefined ? { messageId } : {}),
text: projectedText,
timestamp: unit.timestamp,
@@ -837,21 +852,26 @@ function reconcileOverlappingProjectedAssistant(params: {
return next;
};
const removeMatch = (items: StreamItem[], index: number) => [
...items.slice(0, index),
...items.slice(index + 1),
];
if (bridgesSteer && tailMatch) {
return {
tail: replaceMatch(params.tail, tailMatch.index),
head: headMatch ? removeMatch(params.head, headMatch.index) : params.head,
reconciled: true,
};
}
if (headMatch) {
const tailCursor = tailMatch?.current.timelineCursor;
const replacesCachedPrefix =
tailMatch !== null &&
tailCursor?.epoch === params.epoch &&
unit.sourceSeqRanges.some(
(range) => range.startSeq <= tailCursor.seq && tailCursor.seq <= range.endSeq,
);
return {
// Live chunks can arrive before catch-up while their cached prefix is still painted.
// The projected reply owns both copies; keeping the prefix would duplicate it and
// cause completion to discard the updated head as an already-committed item.
tail: replacesCachedPrefix
? [...params.tail.slice(0, tailMatch.index), ...params.tail.slice(tailMatch.index + 1)]
: params.tail,
tail:
tailMatch && coversItem(tailMatch.current)
? removeMatch(params.tail, tailMatch.index)
: params.tail,
head: replaceMatch(params.head, headMatch.index),
reconciled: true,
};
+31
View File
@@ -631,6 +631,37 @@ describe("stream reducer tool call idempotency", () => {
});
describe("stream reducer canonical tool calls", () => {
it("keeps metadata.intent across lifecycle updates that omit it", () => {
const base = { provider: "codex" as const, callId: "call-intent", name: "shell" };
const state = hydrateStreamState([
{
event: canonicalToolTimeline({
...base,
status: "running",
metadata: { intent: "Inspect" },
}),
timestamp: new Date(0),
},
{
event: canonicalToolTimeline({ ...base, status: "running" }),
timestamp: new Date(1),
},
{
event: canonicalToolTimeline({
...base,
status: "completed",
metadata: { exitReason: "done" },
}),
timestamp: new Date(2),
},
]);
expect(findToolByCallId(state, base.callId)?.payload.data.metadata).toEqual({
intent: "Inspect",
exitReason: "done",
});
});
it("keeps repeated call ids in different turns as distinct timeline rows", () => {
const callId = "tool-reused-across-turns";
const state = hydrateStreamState([
+66 -43
View File
@@ -959,6 +959,24 @@ function appendUserMessage(
return upsertUserMessage(state, nextItem);
}
function findSteeredAssistantIndex(
items: StreamItem[],
messageId: string,
turnId: string | undefined,
): number {
let index = items.length - 1;
while (items[index]?.kind === "user_message") {
index -= 1;
}
const candidate = items[index];
return index < items.length - 1 &&
candidate?.kind === "assistant_message" &&
candidate.messageId === messageId &&
candidate.turnId === turnId
? index
: -1;
}
function appendAssistantMessage(
state: StreamItem[],
text: string,
@@ -967,43 +985,41 @@ function appendAssistantMessage(
messageId?: string,
reservedItemIds?: ReadonlySet<string>,
timelineCursor?: TimelinePosition,
turnId?: string,
): StreamItem[] {
const { chunk, hasContent } = normalizeChunk(text);
if (!chunk) {
return state;
}
const last = state[state.length - 1];
const shouldAppendToLast =
last &&
last.kind === "assistant_message" &&
(messageId === undefined || last.messageId === messageId);
if (shouldAppendToLast) {
const updated: AssistantMessageItem = {
...last,
text: `${last.text}${chunk}`,
timestamp,
...(timelineCursor ? { timelineCursor } : {}),
};
return [...state.slice(0, -1), updated];
const lastIndex = state.length - 1;
const last = state[lastIndex];
let index = -1;
if (
last?.kind === "assistant_message" &&
(messageId === undefined || last.messageId === messageId)
) {
index = lastIndex;
} else if (source === "live") {
if (messageId !== undefined) {
index = findSteeredAssistantIndex(state, messageId, turnId);
} else if (
last?.kind === "user_message" &&
state[lastIndex - 1]?.kind === "assistant_message"
) {
index = lastIndex - 1;
}
}
// A submitted user row can follow the streaming assistant during interrupt.
// In that case, look one row further back for the assistant to extend.
const secondLast = state[state.length - 2];
if (
source === "live" &&
last?.kind === "user_message" &&
secondLast?.kind === "assistant_message" &&
(messageId === undefined || secondLast.messageId === messageId)
) {
const previous = state[index];
if (previous?.kind === "assistant_message") {
const updated: AssistantMessageItem = {
...secondLast,
text: `${secondLast.text}${chunk}`,
...previous,
text: `${previous.text}${chunk}`,
timestamp,
...(timelineCursor ? { timelineCursor } : {}),
};
return [...state.slice(0, -2), updated, last];
return [...state.slice(0, index), updated, ...state.slice(index + 1)];
}
if (!hasContent) {
@@ -1573,6 +1589,7 @@ function reduceTimelineEvent(
item.messageId,
reservedItemIds,
timelineCursor,
event.turnId,
);
case "reasoning":
return appendThought(state, item.text, timestamp, timelineCursor, event.turnId);
@@ -1810,23 +1827,27 @@ function getActiveAssistantHeadIndex(head: StreamItem[]): number {
return -1;
}
function getTailAssistantToResume(params: {
function getTailAssistantResumeIndex(params: {
incomingKind: StreamItem["kind"] | null;
event: AgentStreamEventPayload;
nextHead: StreamItem[];
tailAssistant: StreamItem | undefined;
}): AssistantMessageItem | null {
if (params.incomingKind !== "assistant_message" || params.nextHead.length !== 0) {
return null;
tail: StreamItem[];
source: StreamUpdateSource;
}): number {
const { incomingKind, event, nextHead, tail, source } = params;
if (incomingKind !== "assistant_message" || nextHead.length !== 0) return -1;
const messageId = getIncomingAssistantMessageId(event);
const last = tail.at(-1);
if (
last?.kind === "assistant_message" &&
(messageId === undefined || last.messageId === messageId)
) {
return tail.length - 1;
}
if (params.tailAssistant?.kind !== "assistant_message") {
return null;
}
const incomingMessageId = getIncomingAssistantMessageId(params.event);
if (incomingMessageId !== undefined && params.tailAssistant.messageId !== incomingMessageId) {
return null;
}
return params.tailAssistant;
return source === "live" && event.type === "timeline" && messageId !== undefined
? findSteeredAssistantIndex(tail, messageId, event.turnId)
: -1;
}
/**
@@ -2055,15 +2076,17 @@ export function applyStreamEvent(params: {
flushHead();
}
const tailAssistant = getTailAssistantToResume({
const resumeIndex = getTailAssistantResumeIndex({
incomingKind,
event,
nextHead,
tailAssistant: nextTail.at(-1),
tail: nextTail,
source,
});
if (tailAssistant) {
nextTail = nextTail.slice(0, -1);
nextHead = [tailAssistant];
if (resumeIndex >= 0) {
// Move any steers with the reply so the reply stays above them as it streams.
nextHead = nextTail.slice(resumeIndex);
nextTail = nextTail.slice(0, resumeIndex);
changedTail = true;
changedHead = true;
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/cli",
"version": "0.18.0",
"version": "0.18.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.18.0",
"@getpaseo/protocol": "0.18.0",
"@getpaseo/server": "0.18.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/server": "0.18.1",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
@@ -22,6 +22,10 @@ async function port() {
return value;
}
// Port zero lets the daemon bind its own port, with no gap for another
// process to take a reserved one. Use it when the test needs no fixed port.
const ownPort = "127.0.0.1:0";
async function fixture() {
const root = await mkdtemp(path.join(tmpdir(), "paseo lifecycle "));
const env = {
@@ -201,7 +205,7 @@ test("local status uses the credential and reports the server id of a password-p
const f = await fixture();
const home = f.homes[0]!;
try {
await f.configure(home, `127.0.0.1:${await port()}`);
await f.configure(home, ownPort);
const configPath = path.join(home, "config.json");
const config = JSON.parse(await readFile(configPath, "utf8"));
config.daemon.auth = { password: await hashDaemonPassword("secret") };
@@ -415,7 +419,7 @@ test("empty explicit selectors never select the ambient daemon or create local s
const f = await fixture();
const home = f.homes[0]!;
try {
await f.configure(home, `127.0.0.1:${await port()}`);
await f.configure(home, ownPort);
await f.ok(["start", "--home", home]);
const before = await f.liveStatus(home);
for (const args of [
@@ -489,8 +493,8 @@ test("raw log following subscribes to a stored agent that exists only in B", asy
const [a, b] = f.homes as [string, string];
let follower: ReturnType<typeof spawn> | undefined;
try {
await f.configure(a, `127.0.0.1:${await port()}`);
await f.configure(b, `127.0.0.1:${await port()}`);
await f.configure(a, ownPort);
await f.configure(b, ownPort);
const agentId = "4de8b157-7614-4c38-b189-e50e57fb9498";
const now = new Date().toISOString();
await mkdir(path.join(b, "agents"));
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/client",
"version": "0.18.0",
"version": "0.18.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.18.0",
"@getpaseo/relay": "0.18.0",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/relay": "0.18.1",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.9 KiB

@@ -0,0 +1,28 @@
{
"fill": {
"solid": "srgb:0.00000,0.00000,0.00000,1.00000"
},
"groups": [
{
"layers": [
{
"image-name": "butterfly.svg",
"name": "butterfly"
}
],
"shadow": {
"kind": "neutral",
"opacity": 0.5
},
"translucency": {
"enabled": false,
"value": 0.5
}
}
],
"supported-platforms": {
"squares": [
"macOS"
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 18 KiB

+5 -1
View File
@@ -43,7 +43,8 @@ mac:
artifactName: "Paseo-${version}-${arch}.${ext}"
minimumSystemVersion: "13.0.0"
category: public.app-category.developer-tools
icon: assets/icon.icns
# An Icon Composer document, compiled by Xcode's actool (26 or later) at build time.
icon: assets/icon.icon
hardenedRuntime: true
notarize: true
entitlements: build/entitlements.mac.plist
@@ -56,6 +57,9 @@ mac:
target:
- dmg
- zip
dmg:
# actool also derives an .icns from the document, but only up to 256 px.
icon: assets/icon.icns
linux:
category: Development
icon: assets
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/desktop",
"version": "0.18.0",
"version": "0.18.1",
"private": true,
"description": "Paseo desktop app (Electron wrapper)",
"homepage": "https://paseo.sh",
@@ -1,5 +1,5 @@
import { Duplex, PassThrough } from "node:stream";
import { describe, expect, test } from "vitest";
import { describe, expect, test, vi } from "vitest";
import {
decodeNetworkTunnelFrame,
encodeNetworkTunnelFrame,
@@ -278,20 +278,30 @@ describe("TunnelMuxClient", () => {
});
test("sends heartbeat pings and closes a silent half-open wire after heartbeatTimeoutMs", async () => {
const fake = createFakeWire();
const mux = new TunnelMuxClient(fake.wire, {
heartbeatIntervalMs: 25,
heartbeatTimeoutMs: 65,
});
// The clock is faked: on a slow machine the first real interval tick can land after the
// timeout, and then the wire closes before any ping goes out.
vi.useFakeTimers();
try {
const fake = createFakeWire();
const mux = new TunnelMuxClient(fake.wire, {
heartbeatIntervalMs: 25,
heartbeatTimeoutMs: 65,
});
let closeErr: Error | undefined;
mux.onClose((err) => {
closeErr = err;
});
const closed = new Promise<Error | undefined>((resolve) => {
mux.onClose((err) => resolve(err));
});
await vi.advanceTimersByTimeAsync(50);
expect(fake.sentFrames.filter((f) => f.type === "ping")).toHaveLength(2);
expect(mux.isClosed()).toBe(false);
const closeErr = await closed;
expect(mux.isClosed()).toBe(true);
expect(fake.sentFrames.some((f) => f.type === "ping")).toBe(true);
expect(closeErr?.message).toMatch(/heartbeat/i);
await vi.advanceTimersByTimeAsync(25);
expect(mux.isClosed()).toBe(true);
expect(closeErr?.message).toMatch(/heartbeat/i);
} finally {
vi.useRealTimers();
}
});
test("closes an unresponsive wire when openStream times out with zero inbound frames", async () => {
@@ -4,7 +4,8 @@ import path from "node:path";
import { promisify } from "node:util";
const execFileAsync = promisify(execFile);
const STAMP_CACHE_VERSION = "v2";
// Stamped icons are cached under this version. Bump it when the stamp or the base icon art changes.
const STAMP_CACHE_VERSION = "v3";
export const MONOSPACE_FONT_CANDIDATES = [
"Menlo-Bold",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/expo-two-way-audio",
"version": "0.18.0",
"version": "0.18.1",
"description": "Native module for two way audio streaming",
"keywords": [
"ExpoTwoWayAudio",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/highlight",
"version": "0.18.0",
"version": "0.18.1",
"license": "Apache-2.0",
"files": [
"dist",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/plugin",
"version": "0.18.0",
"version": "0.18.1",
"description": "Paseo plugin SDK package",
"license": "Apache-2.0",
"files": [
@@ -83,8 +83,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.18.0",
"@getpaseo/protocol": "0.18.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -94,8 +94,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.18.0",
"@getpaseo/protocol": "0.18.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.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.18.0",
"version": "0.18.1",
"description": "Paseo shared protocol schemas and wire types",
"license": "Apache-2.0",
"files": [
+13 -1
View File
@@ -204,6 +204,16 @@ const MutableStructuredGenerationProviderSchema = z
const MutableMetadataGenerationConfigSchema = z
.object({
providers: z.array(MutableStructuredGenerationProviderSchema).default([]),
// COMPAT(metadataGenerationInstructions): added in v0.18.0, keep optional while older daemons omit it.
instructions: z.string().optional(),
})
.passthrough();
const MutableMetadataGenerationConfigPatchSchema = z
.object({
providers: z.array(MutableStructuredGenerationProviderSchema).optional(),
// COMPAT(metadataGenerationInstructions): added in v0.18.0, keep optional while older daemons omit it.
instructions: z.string().optional(),
})
.passthrough();
@@ -282,7 +292,7 @@ export const MutableDaemonConfigPatchSchema = z
.record(z.string(), MutableDaemonProviderConfigSchema.partial().passthrough())
.optional(),
removeProviders: z.array(z.string().min(1)).optional(),
metadataGeneration: MutableMetadataGenerationConfigSchema.partial().optional(),
metadataGeneration: MutableMetadataGenerationConfigPatchSchema.optional(),
autoArchiveAfterMerge: z.boolean().optional(),
enableTerminalAgentHooks: z.boolean().optional(),
idleRuntimeCleanup: z.boolean().optional(),
@@ -4116,6 +4126,8 @@ export const ServerInfoStatusPayloadSchema = z
idleRuntimeCleanupSetting: z.boolean().optional(),
// COMPAT(restartRecovery): added in v0.14.0, remove gate after 2027-04-28.
resumeOnStartupSetting: z.boolean().optional(),
// COMPAT(metadataGenerationInstructions): added in v0.18.0, remove gate after 2027-06-01.
metadataGenerationInstructions: z.boolean().optional(),
// COMPAT(terminalRestoreModes): added in v0.1.81, remove gate after 2026-11-23.
"terminal-restore-modes": z.boolean().optional(),
// COMPAT(terminalInputModeReplay): added in v0.2.6, remove gate after 2027-02-02.
@@ -1,6 +1,6 @@
{
"name": "react-native-enriched-markdown",
"version": "0.18.0",
"version": "0.18.1",
"private": true,
"description": "Markdown-based Rich Text solution for React Native",
"main": "./lib/module/index",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/relay",
"version": "0.18.0",
"version": "0.18.1",
"description": "Paseo relay for bridging daemon and client connections",
"license": "Apache-2.0",
"files": [
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/server",
"version": "0.18.0",
"version": "0.18.1",
"description": "Paseo backend server",
"license": "Apache-2.0",
"files": [
@@ -90,7 +90,7 @@
"speech:transcribe:local": "tsx scripts/transcribe-local-wav.ts",
"test": "npm run test:unit && npm run test:integration",
"test:unit": "vitest run --fileParallelism --exclude \"**/*.e2e.test.ts\"",
"test:integration": "vitest run --fileParallelism --maxWorkers=3 src/server/git-filename-diffs.e2e.test.ts src/server/daemon-e2e/checkout-diff-content.e2e.test.ts src/server/daemon-e2e/create-agent-mode.e2e.test.ts src/server/daemon-e2e/filesystem.e2e.test.ts src/server/daemon-e2e/file-download.e2e.test.ts src/server/daemon-e2e/cli-logs-follow.e2e.test.ts src/server/creation/creation.e2e.test.ts src/server/daemon-e2e/creation-status.e2e.test.ts src/server/daemon-e2e/persisted-creation-caller.e2e.test.ts src/server/daemon-e2e/terminal-workspace-sdk.e2e.test.ts src/server/daemon-e2e/terminal-worker-lifecycle.e2e.test.ts src/server/workspace-create-worktree-source.e2e.test.ts src/server/daemon-e2e/models.e2e.test.ts src/server/daemon-e2e/live-preferences.e2e.test.ts src/server/daemon-e2e/oversized-message.e2e.test.ts src/server/agent/model-catalog.e2e.test.ts src/server/plugins/plugin-paseo-api.e2e.test.ts src/server/plugins/usage-sources.e2e.test.ts src/server/plugins/lifecycle.e2e.test.ts src/server/plugins/agent-configuration.e2e.test.ts src/server/plugins/worktree-manager.e2e.test.ts src/server/connected-hosts/hosts.e2e.test.ts src/server/owned-subscriptions.e2e.test.ts && vitest run --fileParallelism --maxWorkers=3 src/server/agent/providers/omp/history.e2e.test.ts src/server/daemon-e2e/git-operations.e2e.test.ts src/server/session.create-agent-worktree-autoarchive.e2e.test.ts src/server/agent/providers/opencode-bridge.local.e2e.test.ts src/server/daemon-e2e/relay-transport.e2e.test.ts src/server/agent/agent-mcp.e2e.test.ts src/server/plugins/agent-tools.e2e.test.ts -t \"agent MCP protocol negotiation|merges into|creates a worktree and auto-archives both|versioned runtime|oversized attachments|connected hosts|password-protected daemon refuses|replays selected OMP history|changes the launch wrap\"",
"test:integration": "vitest run --fileParallelism --maxWorkers=3 src/server/git-filename-diffs.e2e.test.ts src/server/daemon-e2e/checkout-diff-content.e2e.test.ts src/server/daemon-e2e/create-agent-mode.e2e.test.ts src/server/daemon-e2e/filesystem.e2e.test.ts src/server/daemon-e2e/file-download.e2e.test.ts src/server/daemon-e2e/cli-logs-follow.e2e.test.ts src/server/creation/creation.e2e.test.ts src/server/daemon-e2e/creation-status.e2e.test.ts src/server/daemon-e2e/persisted-creation-caller.e2e.test.ts src/server/daemon-e2e/terminal-workspace-sdk.e2e.test.ts src/server/daemon-e2e/terminal-worker-lifecycle.e2e.test.ts src/server/workspace-create-worktree-source.e2e.test.ts src/server/daemon-e2e/models.e2e.test.ts src/server/daemon-e2e/acp-child-exit-recovery.e2e.test.ts src/server/daemon-e2e/live-preferences.e2e.test.ts src/server/daemon-e2e/oversized-message.e2e.test.ts src/server/agent/model-catalog.e2e.test.ts src/server/plugins/plugin-paseo-api.e2e.test.ts src/server/plugins/usage-sources.e2e.test.ts src/server/plugins/lifecycle.e2e.test.ts src/server/plugins/agent-configuration.e2e.test.ts src/server/plugins/worktree-manager.e2e.test.ts src/server/connected-hosts/hosts.e2e.test.ts src/server/owned-subscriptions.e2e.test.ts && vitest run --fileParallelism --maxWorkers=3 src/server/agent/providers/omp/history.e2e.test.ts src/server/daemon-e2e/git-operations.e2e.test.ts src/server/session.create-agent-worktree-autoarchive.e2e.test.ts src/server/agent/providers/opencode-bridge.local.e2e.test.ts src/server/daemon-e2e/relay-transport.e2e.test.ts src/server/agent/agent-mcp.e2e.test.ts src/server/plugins/agent-tools.e2e.test.ts -t \"agent MCP protocol negotiation|merges into|creates a worktree and auto-archives both|versioned runtime|oversized attachments|connected hosts|password-protected daemon refuses|replays selected OMP history|changes the launch wrap\"",
"test:hub-cli-contract": "vitest run --maxWorkers=1 src/server/hub/hub-cli-contract.test.ts",
"test:integration:all": "npm run test:e2e",
"test:integration:real": "vitest run real.e2e.test.ts",
@@ -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.18.0",
"@getpaseo/highlight": "0.18.0",
"@getpaseo/plugin": "0.18.0",
"@getpaseo/protocol": "0.18.0",
"@getpaseo/relay": "0.18.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/highlight": "0.18.1",
"@getpaseo/plugin": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/relay": "0.18.1",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/node": "2.1.2",
"@modelcontextprotocol/sdk": "1.29.0",
@@ -1481,6 +1481,74 @@ test("a steer the provider names without echoing it can be rewound to", async ()
}
});
test("keeps one assistant message whole when a steer lands between its chunks", async () => {
const session = new SteeringTestSession({ provider: "codex", cwd: process.cwd() });
const workdir = mkdtempSync(join(tmpdir(), "agent-manager-steer-split-"));
const manager = new AgentManager({
clients: {
codex: new (class extends TestAgentClient {
override async createSession(): Promise<AgentSession> {
return session;
}
})(),
},
// Zero window: every streamed chunk flushes on the coalescer's leading edge,
// so the timeline reaches its next state without waiting on a timer.
agentStreamCoalesceWindowMs: 0,
logger,
});
let agentId: string | null = null;
try {
const agent = await manager.createAgent({ provider: "codex", cwd: workdir }, undefined, {
workspaceId: undefined,
});
agentId = agent.id;
const run = manager.streamAgent(agent.id, "initial");
void (async () => {
for await (const _event of run) {
}
})();
await manager.waitForAgentRunStart(agent.id);
const conversation = () =>
manager
.fetchTimeline(agent.id, { limit: 0 })
.rows.filter(
(row) => row.item.type === "assistant_message" || row.item.type === "user_message",
)
.map((row) => row.item);
session.pushEvent({
type: "timeline",
provider: "codex",
turnId: "active-turn-1",
item: { type: "assistant_message", text: "with the uncommit", messageId: "msg-1" },
});
await expect
.poll(conversation)
.toMatchObject([
{ type: "assistant_message", text: "with the uncommit", messageId: "msg-1" },
]);
await expect(
manager.steerAgentRun(agent.id, "keep going", { clientMessageId: "keep-going-client" }),
).resolves.toEqual({ status: "accepted" });
session.pushEvent({
type: "timeline",
provider: "codex",
turnId: "active-turn-1",
item: { type: "assistant_message", text: "ted changes.", messageId: "msg-1" },
});
await expect.poll(conversation).toMatchObject([
{ type: "assistant_message", text: "with the uncommitted changes.", messageId: "msg-1" },
{ type: "user_message", text: "keep going" },
]);
} finally {
if (agentId) await manager.closeAgent(agentId).catch(() => undefined);
rmSync(workdir, { recursive: true, force: true });
}
});
test("orders a concurrent replacement after a pending accepted steer", async () => {
const entered = deferred<void>();
const release = deferred<void>();
@@ -7,6 +7,62 @@ import type { AgentTimelineItem } from "./agent-sdk-types.js";
import { InMemoryAgentTimelineStore } from "./agent-timeline-store.js";
describe("InMemoryAgentTimelineStore", () => {
it("keeps a streaming assistant message whole when a steering prompt is recorded mid-stream", () => {
const store = new InMemoryAgentTimelineStore();
store.initialize("agent-1");
store.append("agent-1", {
type: "assistant_message",
text: "with the uncommit",
messageId: "msg-1",
});
store.append("agent-1", { type: "user_message", text: "keep going" });
store.append("agent-1", {
type: "assistant_message",
text: "ted changes.",
messageId: "msg-1",
});
expect(store.getItems("agent-1")).toEqual([
{ type: "assistant_message", text: "with the uncommitted changes.", messageId: "msg-1" },
{ type: "user_message", text: "keep going" },
]);
});
it("keeps text written after a tool call below it when both share a message id", () => {
const store = new InMemoryAgentTimelineStore();
store.initialize("agent-1");
store.append("agent-1", { type: "assistant_message", text: "Let me check.", messageId: "m1" });
store.append("agent-1", {
type: "tool_call",
callId: "c1",
name: "shell",
status: "completed",
detail: { type: "unknown", input: null, output: null },
error: null,
});
store.append("agent-1", { type: "assistant_message", text: "Found it.", messageId: "m1" });
expect(store.getItems("agent-1").map((item) => item.type)).toEqual([
"assistant_message",
"tool_call",
"assistant_message",
]);
});
it("keeps chunks without a message id apart when a user message is recorded between them", () => {
const store = new InMemoryAgentTimelineStore();
store.initialize("agent-1");
store.append("agent-1", { type: "assistant_message", text: "First." });
store.append("agent-1", { type: "user_message", text: "keep going" });
store.append("agent-1", { type: "assistant_message", text: "Second." });
expect(store.getItems("agent-1")).toEqual([
{ type: "assistant_message", text: "First." },
{ type: "user_message", text: "keep going" },
{ type: "assistant_message", text: "Second." },
]);
});
it("resets stale forward cursors to complete available turns", () => {
const store = new InMemoryAgentTimelineStore();
store.initialize("agent", { epoch: "current" });
@@ -360,6 +416,34 @@ describe("turn metrics", () => {
expect(rows[1]).toMatchObject({ item: { text: "Done" }, turnMetrics: metrics });
});
it("keeps the stats on a steered message whose chunks carry a message id", () => {
const store = new InMemoryAgentTimelineStore();
const at = "2026-11-22T00:00:00.000Z";
store.initialize("a", {
rows: [
{ seq: 1, timestamp: at, item: { type: "user_message", text: "go" } },
{ seq: 2, timestamp: at, item: { type: "assistant_message", text: "Do", messageId: "m1" } },
{ seq: 3, timestamp: at, item: { type: "assistant_message", text: "n", messageId: "m1" } },
{ seq: 4, timestamp: at, item: { type: "user_message", text: "keep going" } },
{
seq: 5,
timestamp: at,
item: { type: "assistant_message", text: "e", messageId: "m1" },
turnMetrics: metrics,
},
],
});
const rows = store.fetch("a").rows;
expect(rows.map((row) => row.item)).toEqual([
{ type: "user_message", text: "go" },
{ type: "assistant_message", text: "Done", messageId: "m1" },
{ type: "user_message", text: "keep going" },
]);
expect(rows[1]).toMatchObject({ turnMetrics: metrics });
});
it("keeps the stats on a tool card whose updates the projection merges", () => {
const store = new InMemoryAgentTimelineStore();
const at = "2026-11-22T00:00:00.000Z";
@@ -120,6 +120,7 @@ import {
resolveDefaultAgentCreateConfig,
} from "../create-agent-mode.js";
import { importSessionFromPersistence } from "../provider-session-import.js";
import { StaleProviderSessionError } from "../stale-provider-session-error.js";
import {
checkProviderLaunchAvailable,
createProviderEnv,
@@ -2240,6 +2241,12 @@ export class ACPAgentSession implements AgentSession, ACPClient {
this.settleCommandsReady();
}
private canResumeSession(): boolean {
return Boolean(
this.agentCapabilities?.loadSession || this.agentCapabilities?.sessionCapabilities?.resume,
);
}
private async closeAfterInitializationFailure(error: unknown): Promise<never> {
try {
await this.close();
@@ -2280,7 +2287,12 @@ export class ACPAgentSession implements AgentSession, ACPClient {
throw new Error(`${this.provider} session is not initialized`);
}
if (this.connection.signal.aborted) {
throw new Error(describeACPDisconnect(this.child));
const disconnect = describeACPDisconnect(this.child);
// The caller reopens a resumable session from persistence, on a new process.
if (this.canResumeSession()) {
throw new StaleProviderSessionError(this.sessionId, `after ${disconnect}`);
}
throw new Error(disconnect);
}
if (this.activeForegroundTurnId) {
throw new Error("A foreground turn is already active");
@@ -3323,6 +3335,10 @@ export class ACPAgentSession implements AgentSession, ACPClient {
if (this.closed || this.historyRuntimeReleased) {
return;
}
this.logger.warn(
{ pid: child.pid, code, signal, idle: !this.activeForegroundTurnId },
"ACP agent process exited unexpectedly",
);
if (this.activeForegroundTurnId) {
this.synthesizeCanceledToolCalls();
this.finishTurn({
@@ -981,6 +981,84 @@ describe("OMP agent client and session", () => {
]);
});
test("preserves tool intent across live updates and completion", async () => {
const omp = new OmpHarness();
await omp.start();
omp.emit(
OmpRuntimeEventSchema.parse({
type: "tool_execution_start",
toolCallId: "intent-call",
toolName: "bash",
args: { command: "echo hello" },
intent: "Inspect output",
}),
);
omp.emit({
type: "tool_execution_update",
toolCallId: "intent-call",
toolName: "bash",
partialResult: { output: "hello" },
});
omp.emit({
type: "tool_execution_end",
toolCallId: "intent-call",
toolName: "bash",
result: { output: "hello" },
});
expect(omp.timeline().filter((item) => item.type === "tool_call")).toMatchObject([
{ status: "running", metadata: { intent: "Inspect output" } },
{ status: "running", metadata: { intent: "Inspect output" } },
{ status: "completed", metadata: { intent: "Inspect output" } },
]);
});
test("does not treat a live tool argument named i as intent", async () => {
const omp = new OmpHarness();
await omp.start();
omp.emit(
OmpRuntimeEventSchema.parse({
type: "tool_execution_start",
toolCallId: "ordinary-i",
toolName: "bash",
args: { command: "echo hello", i: "ordinary input" },
}),
);
expect(omp.timeline().find((item) => item.type === "tool_call")).not.toHaveProperty("metadata");
});
test.each([
{ outcome: "failed", isError: true },
{ outcome: "canceled", isError: false },
])("keeps tool intent on a $outcome live tool call", async ({ outcome, isError }) => {
const omp = new OmpHarness();
await omp.start();
await omp.startTurn("run it");
omp.emit({ type: "agent_start" });
omp.emit({
type: "tool_execution_start",
toolCallId: "intent-call",
toolName: "bash",
args: { command: "sleep 10" },
intent: "Wait for output",
});
if (isError) {
omp.emit({
type: "tool_execution_end",
toolCallId: "intent-call",
toolName: "bash",
result: { output: "boom" },
isError,
});
} else {
await omp.interrupt();
}
expect(omp.timeline().findLast((item) => item.type === "tool_call")).toMatchObject({
status: outcome,
metadata: { intent: "Wait for output" },
});
});
test("shows a concise error for a failed tool while keeping shell output", async () => {
const omp = new OmpHarness();
await omp.start();
@@ -95,6 +95,7 @@ import type {
} from "./rpc-types.js";
import {
parseToolArgs,
withOmpToolIntent,
parseToolResult,
toolFailureMessage,
isOmpToolFailure,
@@ -1946,7 +1947,7 @@ export class OmpAgentSession implements AgentSession {
return;
case "tool_execution_start": {
this.turnMeter.toolStarted(event.toolCallId, Date.now());
const toolCall = parseToolArgs(event.toolName, event.args);
const toolCall = parseToolArgs(event.toolName, event.args, event.intent);
this.activeToolCalls.set(event.toolCallId, toolCall);
this.questionUi.start(event.toolName, event.args);
this.emitToolCallEvent(event.toolCallId, toolCall, "running", null, null);
@@ -2223,7 +2224,7 @@ export class OmpAgentSession implements AgentSession {
type: "timeline",
provider: this.provider,
turnId,
item,
item: withOmpToolIntent(item, toolCall),
});
return true;
}
@@ -62,6 +62,70 @@ describe("OMP history mapper", () => {
);
});
test("replays stored intent on historical tool starts and results", async () => {
const events = await collectHistory([
{
role: "assistant",
content: [
{
type: "toolCall",
id: "intent-1",
name: "read",
arguments: { path: "file", i: "Inspect file." },
intent: "Inspect file",
},
{
type: "toolCall",
id: "intent-2",
name: "bash",
arguments: { command: "false" },
intent: "Check failure",
},
],
},
{
role: "toolResult",
toolCallId: "intent-1",
toolName: "read",
content: [{ type: "text", text: "contents" }],
},
{
role: "toolResult",
toolCallId: "intent-2",
toolName: "bash",
content: [{ type: "text", text: "failed" }],
isError: true,
},
]);
expect(events.map((event) => event.item)).toMatchObject([
{ callId: "intent-1", status: "running", metadata: { intent: "Inspect file" } },
{ callId: "intent-2", status: "running", metadata: { intent: "Check failure" } },
{ callId: "intent-1", status: "completed", metadata: { intent: "Inspect file" } },
{ callId: "intent-2", status: "failed", metadata: { intent: "Check failure" } },
]);
});
test("does not replay a tool argument named i as intent", async () => {
const events = await collectHistory([
{
role: "assistant",
content: [
{ type: "toolCall", id: "own-i", name: "search", arguments: { i: "ordinary input" } },
],
},
{
role: "toolResult",
toolCallId: "own-i",
toolName: "search",
content: [{ type: "text", text: "found" }],
},
]);
expect(events).toHaveLength(2);
for (const event of events) {
expect(event.item).not.toHaveProperty("metadata");
}
});
test("replays a web search details error as failed when OMP sets isError false", async () => {
const events = await collectHistory([
{
@@ -162,6 +226,61 @@ describe("OMP history mapper", () => {
});
});
test("ignores non-string persisted tool intents during journal replay", async () => {
const dir = await mkdtemp(join(tmpdir(), "omp-intent-history-"));
try {
const sessionFile = join(dir, "session.jsonl");
await writeFile(
sessionFile,
[
{ type: "session", id: "root" },
{
type: "message",
id: "assistant",
parentId: "root",
message: {
role: "assistant",
content: [
{
type: "toolCall",
id: "valid",
name: "read",
arguments: { path: "file" },
intent: "Read file",
},
{
type: "toolCall",
id: "number",
name: "read",
arguments: { path: "file" },
intent: 42,
},
{
type: "toolCall",
id: "object",
name: "read",
arguments: { path: "file" },
intent: { text: "invalid" },
},
],
},
},
]
.map((entry) => JSON.stringify(entry))
.join("\n"),
);
const items: AgentStreamEvent["item"][] = [];
for await (const event of streamOmpHistory({ sessionFile, provider: "omp" }))
items.push(event.item);
expect(items).toHaveLength(3);
expect(items[0]).toMatchObject({ callId: "valid", metadata: { intent: "Read file" } });
expect(items[1]).not.toHaveProperty("metadata");
expect(items[2]).not.toHaveProperty("metadata");
} finally {
await rm(dir, { recursive: true, force: true });
}
});
test("restores blocked and abandoned todo state from a session file", async () => {
const dir = mkdtempSync(join(tmpdir(), "omp-todo-state-history-"));
const sessionFile = join(dir, "session.jsonl");
@@ -1,5 +1,9 @@
import { mapCustomMessageToToolCall } from "../custom-message.js";
import type { AgentStreamEvent, AgentTimelineItem, ToolCallDetail } from "../../agent-sdk-types.js";
import type {
AgentStreamEvent,
ToolCallDetail,
ToolCallTimelineItem,
} from "../../agent-sdk-types.js";
import type { OmpAgentMessage, OmpImageContent, OmpTextContent } from "./rpc-types.js";
import type { OmpBridgedToolIdentity } from "./mcp-bridge.js";
import {
@@ -14,6 +18,7 @@ import {
resolveToolCallName,
toolFailureMessage,
isOmpToolFailure,
withOmpToolIntent,
type OmpToolResult,
type OmpTrackedToolCall,
} from "./tool-call-detail.js";
@@ -186,7 +191,7 @@ export class OmpHistoryMapper {
continue;
}
if (content.type === "toolCall") {
const tracked = parseToolArgs(content.name, content.arguments);
const tracked = parseToolArgs(content.name, content.arguments, content.intent);
this.pendingToolCalls.set(content.id, tracked);
const detail = this.mapToolDetail(content.id, tracked, null);
if (!detail) {
@@ -195,14 +200,17 @@ export class OmpHistoryMapper {
events.push({
type: "timeline",
provider: this.provider,
item: {
type: "tool_call",
callId: this.resolveToolCallId(content.id, tracked),
name: this.toolName(tracked, null),
status: "running",
detail,
error: null,
},
item: withOmpToolIntent(
{
type: "tool_call",
callId: this.resolveToolCallId(content.id, tracked),
name: this.toolName(tracked, null),
status: "running",
detail,
error: null,
},
tracked,
),
});
}
}
@@ -223,13 +231,16 @@ export class OmpHistoryMapper {
return {
type: "timeline",
provider: this.provider,
item: toToolResultTimelineItem({
callId: this.resolveToolCallId(message.toolCallId, tracked),
name: this.toolName(tracked, result),
isError: isOmpToolFailure(tracked, result, Boolean(message.isError)),
detail,
errorText: toolFailureMessage(result),
}),
item: withOmpToolIntent(
toToolResultTimelineItem({
callId: this.resolveToolCallId(message.toolCallId, tracked),
name: this.toolName(tracked, result),
isError: isOmpToolFailure(tracked, result, Boolean(message.isError)),
detail,
errorText: toolFailureMessage(result),
}),
tracked,
),
};
}
@@ -300,7 +311,7 @@ function toToolResultTimelineItem(input: {
isError: boolean;
detail: ToolCallDetail;
errorText: string;
}): AgentTimelineItem {
}): ToolCallTimelineItem {
if (input.isError) {
return {
type: "tool_call",
@@ -26,6 +26,7 @@ export const OmpToolCallContentSchema = z
id: z.string(),
name: z.string(),
arguments: z.unknown(),
intent: z.string().optional(),
})
.passthrough();
@@ -323,6 +324,7 @@ export const OmpAgentSessionEventSchema = z.discriminatedUnion("type", [
toolCallId: z.string(),
toolName: z.string(),
args: z.unknown(),
intent: z.string().optional(),
})
.passthrough(),
z
@@ -1,6 +1,6 @@
import { z } from "zod";
import type { ToolCallDetail } from "../../agent-sdk-types.js";
import type { ToolCallDetail, ToolCallTimelineItem } from "../../agent-sdk-types.js";
import { omitNullArgs } from "../tool-call-args.js";
interface BashToolInput {
@@ -129,7 +129,7 @@ interface OmpUnknownToolCall {
args: unknown;
}
export type OmpTrackedToolCall =
export type OmpTrackedToolCall = (
| OmpBashToolCall
| OmpReadToolCall
| OmpEditToolCall
@@ -137,7 +137,8 @@ export type OmpTrackedToolCall =
| OmpFindToolCall
| OmpGrepToolCall
| OmpLsToolCall
| OmpUnknownToolCall;
| OmpUnknownToolCall
) & { intent?: string };
interface ToolCallOutputSummary {
output?: string;
@@ -319,7 +320,29 @@ export function isOmpToolFailure(
);
}
export function parseToolArgs(toolName: string, rawArgs: unknown): OmpTrackedToolCall {
/**
* `intent` is the harness-level value OMP reports beside the arguments. Never derive it from
* `rawArgs.i`: OMP copies its own `i` into `intent`, and any other `i` belongs to the tool.
*/
export function parseToolArgs(
toolName: string,
rawArgs: unknown,
intent?: unknown,
): OmpTrackedToolCall {
const toolCall = parseToolArgsByName(toolName, rawArgs);
// Replayed session files are unvalidated, so a non-string intent is dropped here.
return typeof intent === "string" ? { ...toolCall, intent } : toolCall;
}
export function withOmpToolIntent(
item: ToolCallTimelineItem,
toolCall: OmpTrackedToolCall,
): ToolCallTimelineItem {
if (toolCall.intent === undefined) return item;
return { ...item, metadata: { ...item.metadata, intent: toolCall.intent } };
}
function parseToolArgsByName(toolName: string, rawArgs: unknown): OmpTrackedToolCall {
if (toolName === "edit") {
return parseEditToolArgs(rawArgs);
}
@@ -0,0 +1,90 @@
import { mkdir, mkdtemp, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, expect, test } from "vitest";
import { createTestLogger } from "../../../test-utils/test-logger.js";
import type { AgentSession } from "../agent-sdk-types.js";
import { OpenCodeV2AgentClient } from "./opencode/v2/agent.js";
import {
OPENCODE_V2_COMMAND,
SCRIPTED_MODEL,
ScriptedOpenCodeService,
scriptedCall,
} from "./opencode/test-utils/v2-scripted-server.js";
interface Fixture {
root: string;
service: ScriptedOpenCodeService;
client: OpenCodeV2AgentClient;
}
let fixture: Fixture | undefined;
beforeEach(async () => {
const root = await mkdtemp(path.join(os.tmpdir(), "paseo-opencode-v2-pending-approval-"));
const service = await ScriptedOpenCodeService.start();
const client = new OpenCodeV2AgentClient({
logger: createTestLogger(),
settings: {
command: { mode: "replace", argv: [OPENCODE_V2_COMMAND] },
env: service.ownedEnvironment,
},
});
fixture = { root, service, client };
}, 60_000);
afterEach(async () => {
if (!fixture) return;
await fixture.client.shutdown();
await fixture.service.stop();
await rm(fixture.root, { recursive: true, force: true });
fixture = undefined;
}, 60_000);
/** Starts a shell call that OpenCode holds for approval, and waits until Paseo lists it. */
async function startApprovalTurn(): Promise<{
session: AgentSession;
turnId: string;
requestId: string;
}> {
const project = path.join(fixture!.root, "project");
await mkdir(project, { recursive: true });
const session = await fixture!.client.createSession(
{
provider: "opencode",
cwd: project,
model: SCRIPTED_MODEL,
providerOptions: { permission: { bash: "ask" } },
},
undefined,
{ persistSession: false },
);
const { turnId } = await session.startTurn(
scriptedCall("shell", { command: "printf PASEO_PROBE", description: "Probe" }),
);
await expect.poll(() => session.getPendingPermissions().length, { timeout: 30_000 }).toBe(1);
return { session, turnId, requestId: session.getPendingPermissions()[0].id };
}
test("a message sent while an approval is open clears the approval", async () => {
const { session, turnId } = await startApprovalTurn();
await expect(
session.steerActiveTurn!("Never mind, reply OK.", {
expectedTurnId: turnId,
clearPendingPermissions: true,
}),
).resolves.toEqual({ status: "accepted" });
expect(session.getPendingPermissions()).toEqual([]);
}, 120_000);
// OpenCode drops the approval of an interrupted tool call without a reply event.
test("stopping while an approval is open clears the approval", async () => {
const { session, requestId } = await startApprovalTurn();
await session.interrupt();
await expect.poll(() => session.getPendingPermissions(), { timeout: 10_000 }).toEqual([]);
// A client that still shows the card can answer it without an error.
await expect(session.respondToPermission(requestId, { behavior: "deny" })).resolves.toBe(
undefined,
);
}, 120_000);
@@ -14,3 +14,9 @@ export class OpenCodeHttpError extends Error {
);
}
}
/** True when OpenCode answered 404, directly or as the cause of the client's transport error. */
export function isOpenCodeNotFound(error: unknown): boolean {
const failure = error instanceof OpenCodeHttpError ? error : (error as Error | null)?.cause;
return failure instanceof OpenCodeHttpError && failure.status === 404;
}

Some files were not shown because too many files have changed in this diff Show More