Compare commits

...
Author SHA1 Message Date
Mohamed Boudra 5bc78b951b fix(diff): align untracked patches and comparison modes
Read untracked bodies with --no-textconv so they follow the same patch
rules as tracked bodies. Include the comparison-side mode in worktree
identity so a base file type change cannot keep stale hunks. Use object
parameters for the identity inputs.
2026-11-13 11:12:24 +01:00
Mohamed Boudra e2f31e5db2 fix(diff): identify worktree files by content
Stat-only identity changes re-sent unchanged diff bodies after a touch or
git add. Worktree tracked and untracked files now share one content identity
built from the comparison-side blob, working-tree content, and Git
interpretation. Stat metadata no longer forces body delivery, while real
content changes still change the identity.

Closes #9563
2026-11-13 11:00:23 +01:00
Mohamed BoudraandJacek Tomaszewski af6ca46ae3 fix(plugin)!: drop the always-empty timeline from agent.turn.after (#9573)
agent.turn.after no longer declares timeline; plugins read the turn with
timeline.refetch({ direction: "tail", limit: 1, wholeTurns: true }) filtered by event.turnId.
Plugins built against the old SDK keep receiving timeline: [] behind COMPAT(pluginTurnTimeline).

Closes #9315

Co-authored-by: Jacek Tomaszewski <jacek@fullstack.house>
2026-11-13 15:22:53 +07:00
Mohamed Boudra 8dc979ec2f Shift+Tab in the iPad composer no longer inserts a tab (#9561)
* Shift+Tab in the iPad composer no longer inserts a tab

On iPad with a hardware keyboard, Shift+Tab in the composer cycled the
agent mode and the composer also inserted a tab. The native window
reports presses to JavaScript after the text control has handled them,
so the shortcut pipeline cannot prevent the default.

The hardware keyboard source now claims, up front, the Shift and Option
shortcuts whose binding is active in the current focus scope, and
recomputes the claims when the focus surface or command center changes.
iOS registers them as key commands so the text control never sees them.
The window still emits the press, so the shortcut runs once.

Closes #9468

* Claim every step of a rebound chord shortcut

A binding rebound to a chord such as Mod+J Shift+Tab only claimed its
first step, so finishing the chord in the iPad composer still typed a tab.

* Claim only the first step of a chord shortcut

Claiming every step of a chord held keys like Shift+A for as long as the
chord's binding was active, so the composer could no longer type a
capital A. A later step is a shortcut only while its chord is in progress.

* Expect no Option claims now that iPad tab switching uses Cmd+Shift

Main moved tab switching on Apple platforms with desktop bindings to
Cmd+Shift+[ / ], which text controls do not type, so the default claims
are only Shift+Tab while the composer is focused.
2026-11-13 14:12:01 +07:00
Papa Goose 70aeb7b45b fix(pi,omp): treat null optional tool arguments as omitted (#9506)
Models commonly send null for optional tool arguments, such as read offset/limit
(captured in #7011) and bash timeout. Pi and OMP treat null as omitted, but the
Paseo mappers rejected it, so these calls fell back to unknown tool cards that
show raw JSON input and output instead of Read/Shell cards.
2026-11-13 07:00:29 +00:00
Mohamed Boudra 8b3b2a9ea3 Stop re-sending unchanged Changes snapshots to apps older than 0.16 (#9562)
* fix(server): stop re-sending unchanged Changes snapshots to pre-0.16 apps

The shared diff engine commits a revision for every observed input change:
ignored-file writes, same-content saves, mtime touches, index rewrites, and
ref moves that only change the resolved SHAs. Binary-stream clients absorb
those cheaply by reusing unchanged file objects. The legacy adapter turned
each revision into a full JSON snapshot, so old apps were re-sent the whole
diff (5 MB+ on large checkouts) whenever the repository was touched.

The adapter now sends a snapshot only when it differs from the last one it
sent to that subscriber, as 0.15 did. The check lives here, not in the
engine, because the JSON snapshot drops the resolved SHAs: a commit that
moves HEAD in All mode is a real revision for new clients and a no-op for
old ones.

* test(server): wait for the revision end before asserting no legacy push
2026-11-13 13:09:38 +07:00
b6952995be feat(app): use Cmd+Shift+[ / ] for previous/next tab on macOS desktop (#7692)
* feat(app): use Cmd+Shift+[ / ] for previous/next tab on macOS desktop

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

* fix(app): drop Alt+Shift tab navigation on macOS desktop

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

* test(app): cover previous/next tab shortcuts on web and macOS desktop

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

* fix(app): adopt desktopBindings condition for tab navigation shortcuts

Main renamed the binding condition `desktop` to `desktopBindings` and the
test context `isDesktop` to `usesDesktopBindings` (#8625). Rebase the
Cmd+Shift+[ / ] tab shortcuts onto that vocabulary.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-11-13 12:40:17 +07:00
paseo-bot[bot]andRyan Swift c558af91eb fix(usage): show Copilot premium request quota (#8489)
The usage source discarded quota snapshots, leaving the card with only a
plan and reset date. Publish finite premium usage through the existing
window interface and retain its remaining request count.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Ryan Swift <ryan@mlh.io>
2026-11-13 12:13:38 +07:00
Mohamed Boudra 7791dcee3b Docs: document the public iOS TestFlight beta on the Updates page (#9553)
* Document the public iOS TestFlight beta and how to get betas on every platform

* Show the TestFlight beta on the download page's Beta view
2026-11-13 11:20:12 +07:00
e532a24327 fix(server): start cross-host children in their caller's mode (#9512)
When an agent creates a child on another connected host without passing
settings.modeId, the destination cannot see the caller, so the child fell
back to the provider default instead of inheriting the caller's mode the
way a same-host child does. A bypass caller's remote child then asked for
approval on every tool call.

Resolve the mode on the sending host before routing, as background
already is: an omitted mode with a same-provider caller forwards the
caller's current mode. Explicit modes still win, and cross-provider or
caller-less creates still leave the mode to the destination.

Co-authored-by: Orcun Simsek <1612171+ortschun@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 03:57:45 +00:00
paseo-bot[bot] 1aba2a5f23 Measure composer pills after the compact layout replaces them (#9546)
Resizing to a compact width mounts a new composer, so boundingBox() on a
pill could resolve the wide layout's element and return null once it
unmounted. Wait for the compact header, then poll each pill's width.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-13 03:42:48 +00:00
aead84bf0f Interrupting sends no longer fail with "already has an active run" (#9537)
* Interrupting sends no longer fail with "already has an active run"

Two sends that interrupt the same running agent raced: the first left the
foreground lane after cancelling and before reserving its new run, so the
second send's cancel ran in that gap, saw the agent still marked running,
and tracked a phantom run that made the first send's start throw.

Replacements now queue per agent in arrival order, and each cancels and
reserves its run inside one foreground mutation. A replacement that finds a
run still starting waits for it outside the lane, so Stop still reaches it.

Co-authored-by: Michael Wu <421504+michaelmwu@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Interrupting sends still recover an agent whose turn never starts

A replacement now waits for a starting run only up to the rescue
timeout, then cancels it the way main did, so sending another message
still unsticks an agent whose provider never acknowledges a start.

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

* A queued replacement acts on the agent as it is when it gets the lane

Resolve the managed agent inside the foreground mutation instead of
before queueing, so a session reload while the send waits cannot leave
it writing state to, or checking steer ownership against, the old agent.

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: Michael Wu <421504+michaelmwu@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 03:09:32 +00:00
paseo-bot[bot] 7980ad008b Keep keystrokes typed while a terminal restores its screen (#9533)
* fix(app): keep keystrokes typed while a terminal restores its screen

When a terminal re-attaches, for example after the host reconnects, the
browser terminal replays the screen snapshot and ignores everything xterm
emits until the replay is parsed, so replies to queries in the restored
output don't reach the shell. That also threw away what the user typed
during the replay: the first characters typed right after a reconnect
were lost.

xterm emits both through the same callback. Replies only come out of
parsing a write, so data emitted while a keyboard, input or paste event
is dispatching on the terminal is the user's, and it now goes through.

* fix(app): keep pastes suppressed while a terminal restores its screen

Until the replayed snapshot restores bracketed paste mode, a multi-line
paste would reach the shell unbracketed and run line by line. Pastes
during a replay are dropped as before; only typed input goes through.

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-13 03:01:35 +00:00
7c35ad90b9 Start an edited agent draft after its first start failed (#9534)
* test(app): reproduce edited draft retries after a failed agent start

Resubmitting an agent draft after its start failed reuses the draft ID as
the creation key with different inputs, and the daemon rejects it with
agent_request_key_conflict (or workspace_request_key_conflict from New
workspace).

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

* fix(app): start an edited agent draft after its first start failed

The draft sent its draft ID as the creation key on every submit. After a
failed start the daemon keeps that key's request, so resubmitting an edited
draft was rejected with agent_request_key_conflict. The key now names the
draft's exact request: a retry resumes it, an edit starts a new one.

A retry after New workspace's agent failed to start creates the agent in
the workspace that is already ready, instead of replaying workspace
provisioning with a different agent.

Co-authored-by: michaelmwu <421504+michaelmwu@users.noreply.github.com>
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>
Co-authored-by: michaelmwu <421504+michaelmwu@users.noreply.github.com>
2026-11-13 02:05:34 +00:00
9eccb4722b Model picker profile buttons respond to taps on Android tablets (#9526)
* fix(app): keep the model picker's profile action tappable on Android

On Android tablets the model list scrolls inside an independent viewport whose native scroll gesture cancels a plain Pressable's touches. Rows use the gesture-aware pressable; the profile + and the Profiles pencil were left as plain Pressables. Route both through the same gesture path.

* test(app): cover the tablet model row's profile action on Android

Adds an agent-device journey that taps a model row's `+` in the New
workspace picker on an Android tablet and waits for the seeded profile
form. It fails on main, where the tap is swallowed, and passes with the
gesture-aware profile action.

Co-authored-by: moevis <moevery@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(app): make the tablet profile journey follow the documented setup

The journey now starts from a remembered model like its sibling, so it
runs after model-tablet.android.ad, and asserts that closing the profile
form leaves the remembered model selected, so a tap on `+` that also
selected the row fails it.

Co-authored-by: moevis <moevery@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(app): keep the no-profiles requirement for the tablet profile journey

With a saved profile the picker opens on its root view, which has no
Back, so the journey needs a host with no agent profiles.

Co-authored-by: moevis <moevery@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(app): hide the model row's profile action through its style

IconActionButton took a pointerEvents prop that only its web branch
applied, so a native caller hiding the action would get an invisible
button that still took taps. The hidden style now carries
pointerEvents: "none", which every pressable branch already applies,
and the prop is gone. The web journey checks the plus ignores taps
until its row is hovered.

Co-authored-by: moevis <moevery@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: moevis <moevery@gmail.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-13 01:00:22 +00:00
LiebeLee 536846eb60 fix(omp): persist the resumed session identity when importing (#8854)
OMP import listings return a session file path, and the import helper stored
that path as both sessionId and nativeHandle. Records then carried a path in
sessionId while runtimeInfo carried the real id, which breaks identity-based
lookups and makes a later import of the same file look unrelated.

Prefer the resumed session's own describePersistence() identity and keep the
listed handle as nativeHandle, merging metadata so provider-specific fields
survive.
2026-11-13 00:02:23 +00:00
cc16ac6ac4 fix(app): keep line breaks when copying a selection that crosses part of a code block (#9515)
* Preserve partial code blocks in assistant selection copy

* test(app): cover partial code copies in the real assistant selection journey

Copying from a paragraph into part of a highlighted code block, or from
partway through a block out to the next paragraph, now has browser
journey coverage. On main both copies join the code lines into one line
and drop the fence.

Co-authored-by: Michael Wu <michaelmwu@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(app): keep indented code lines inside a copied list item

Copying a list item that holds a code block indented only the code lines
that start with a non-space character, so an indented line fell outside
the item and broke the fence. Indent every non-empty line of the item.

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

---------

Co-authored-by: Michael Wu <michaelmwu@gmail.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-12 21:52:13 +00:00
paseo-bot[bot] fd9aebd622 fix(app): close a bottom sheet hidden before it finished opening (#9519)
A sheet hidden right after it was presented, such as the context usage
sheet when a plugin focuses the composer, could stay open. The dismiss
reached the sheet before it had measured its layout, and the library
drops a close it cannot position yet. The sheet then finished opening,
and the visibility tracker took that as presented while its owner
wanted it hidden.

The tracker now dismisses again when a sheet reports an open position
while its owner wants it hidden.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-12 21:49:05 +00:00
RockandClaude Opus 5.5 21709812bb fix(codex): retry an oversized history page with smaller pages (#9432)
thread/items/list asks for 100 items a page. On image-heavy threads a page
can exceed the app-server's line cap, and the history stopped at the first
such page with a "too large to load" warning, dropping every later item
even when each one fits. The reader now halves the page and retries the
same cursor, and shows the warning only when a single item cannot fit.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:02:10 +00:00
d426088c3f Stop agent updates re-rendering the workspace screen, favicon, and command center (#9497)
* Stop hidden surfaces rebuilding the agent directory on every update

The favicon is mounted at the root of every web and Electron session, and it
derived the whole aggregated agent list to answer three questions: is any agent
running, does any want attention, does any need input. The aggregated list
allocates a projection per agent, deep-compares it, sorts the whole host and
rebuilds its identity cache, and useAggregatedAgents re-ran all of that on
every agent update on any host. The dock badge did the same for workspaces: it
materialised every workspace status and deep-compared the array for a number.

Both now read a scalar selector: selectFaviconStatus walks the agent maps and
returns one of three strings, and selectMacDockBadgeCount counts actionable
workspaces without building a list. A store write that leaves those values
alone no longer re-renders the root component.

useAggregatedAgents also treated `demand` as "hold the directory subscription"
but still subscribed to every host's agent map, so the closed command center
(useAggregatedAgents({ demand: open })) rebuilt the full list on every update
too. With demand false the hook now returns a stable empty result and stays off
the maps.

Measured on the many-agent-tabs harness (5 tabs, 20 s windows, agent_update
churn from a background host): the root favicon component rendered 1554 times
in 20 s before this change and 1 time after.

* Complete the host runtime mock in the favicon test

* Keep the profiling harness out of the fix

The harness scans every process environment to find the daemon. Whether
Paseo carries a renderer CPU harness, and how it samples processes, is a
separate decision from the rendering fix.

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

* Stop re-rendering the workspace screen on unrelated agent updates

useOpenAgentTabLabels subscribed the workspace screen to the host's whole
agent map. Every agent update on the host replaces that map, so each
update re-rendered the open workspace screen, its split panes and tab
menus. Subscribe only to the agents that have open tabs.

Co-authored-by: jl97mcad <56251999+jl97mcad@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test render isolation through pure selectors and the browser

Replace the JSDOM hook tests and module mocks with pure selector tests
and a browser test that updates an agent in another workspace and checks
the open workspace screen does not re-render. Memoize the favicon and
dock badge selectors on the session maps they read, so unrelated store
writes skip the scan, and pass directory demand as an object.

Co-authored-by: jl97mcad <56251999+jl97mcad@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: jl97mcad <56251999+jl97mcad@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-12 19:04:24 +00:00
Don Phillips b5c25e5c10 fix(opencode): discover V2 tools from bound session catalogs (#9426)
Fetch tool definitions for the bound session instead of the global manifest so plugin-contributed tools can be registered and invoked. Preserve global discovery for legacy callers and existing session filtering and execution authorization.

Cover session-only tool discovery, invocation, child inheritance, disabled and unrelated sessions, unbinding, and plugin reload.
2026-11-12 17:56:32 +00:00
paseo-bot[bot]andFluidXin 525ee7f222 fix(app): keep Mermaid chart axes from overlapping and clipping (#9483)
* fix(app): render Mermaid diagrams in an unscaled offscreen staging container

* fix(app): keep gantt charts at a fixed width in the Mermaid staging container

Rendering into the oversized staging container gave gantt charts its
16384px width, because Mermaid sizes a gantt chart from the element it
renders in. The host then fit that width into the message column and the
chart drew a few pixels tall. Give gantt charts the 1200px width Mermaid
uses when there is no container width, so they report the same size
whatever frame the host gives the runtime.

Co-authored-by: FluidXin <266379324+FluidXin@users.noreply.github.com>

* fix(app): keep gantt charts as wide as the Mermaid frame

Pinning gantt charts to 1200px shrank them on iOS and Android, where the
measuring frame is as wide as the message column and gantt charts used
to fill it. Use the frame's own width instead, which is what Mermaid
read from the page before rendering moved into the staging container.

Co-authored-by: FluidXin <266379324+FluidXin@users.noreply.github.com>

---------

Co-authored-by: FluidXin <266379324+FluidXin@users.noreply.github.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-12 17:11:35 +00:00
paseo-bot[bot]andPhieu Dinh 065c487a90 fix(server): keep workspace scripts when paseo.json checks are slow (#9477)
* fix(server): answer workspace listings from the last paseo.json snapshot

Every workspace listing and update builds a descriptor per workspace, and each descriptor read that workspace's paseo.json through a stat inside the daemon-wide two-slot pool, with a 5 s timeout that counted the queue wait. With many workspaces and a few clients listing, the last workspaces timed out, dropped their scripts, and the timed-out reads still ran, so other requests waited minutes.

The projection path now answers from the last snapshot and re-checks it behind the caller once it is 2 s old (a clock stepped backwards counts as stale). Edits, worktree setup and metadata prompts keep the fresh read. The snapshot cap rises to 1024 roots so a listing over more roots than the cap does not evict the next root it needs.

* fix(server): check paseo.json on every listing, answer the last config only when the check is late

Answering listings from the snapshot showed the previous scripts on the
first listing after an external edit to paseo.json, such as a branch
switch or an agent editing the file, and nothing re-sent the update
once the background check saw the change. A file that stopped being
admissible also kept its old scripts indefinitely.

Listings and script status now check paseo.json as before. When the
check does not finish within the 5 s budget, they answer the last
config read for that root instead of no scripts. Edits and execution
keep failing on a late check.

Co-authored-by: Phieu Dinh <phieu@fiu.one>

* fix(server): keep the saved paseo.json as the last known config after an in-app save

Saving through the project config editor dropped the snapshot, so a
late check on the next listing showed no scripts for that workspace.
The save now records the config it wrote.

* fix(server): record the saved paseo.json without another filesystem read

Re-reading the file after the rename made a completed save wait on an
unbudgeted read. The save now records the config and file stats it
already has.

---------

Co-authored-by: Phieu Dinh <phieu@fiu.one>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-12 16:04:52 +00:00
paseo-bot[bot]andTianyu Yang 4df5307eaa fix: keep failed ACP tools valid in conversation history (#9467)
Co-authored-by: Tianyu Yang <yangtianyu.cl@bytedance.com>
2026-11-12 15:14:46 +00:00
paseo-bot[bot] aa7cabb455 test(app): cover composer recall in one journey (#9409)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-12 15:08:41 +00:00
paseo-bot[bot]andmoevis 9e607a3aa3 fix(app): restore physical arrow keys in Android terminals (#9407)
* fix(app): send hardware arrow keys to the terminal on Android

TextInput.onKeyPress is built from the IME input connection, so physical arrows never reach it and fell through to the hidden input as caret movement. The hardware module now claims arrows while the terminal input (nativeID) has focus, and the input forwards them to the PTY with their modifiers.

* test(app): guard Android terminal hardware arrow delivery

Exercise physical arrow ownership through a real Android window and editable, including repeats, modifiers and ordinary text-field editing. The terminal case fails on main because Left moves the hidden caret; the following typed character is then discarded as a replacement.

Co-authored-by: moevis <moevery@gmail.com>

---------

Co-authored-by: moevis <moevery@gmail.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-12 14:09:19 +00:00
paseo-ai[bot] 68818067f2 fix: update lockfile signatures and Nix hash [skip ci] 2026-11-11 18:49:19 +00:00
Mohamed Boudra 2240d4effe chore(release): reconcile 0.16.0-beta.2 into main (#9422)
* docs(changelog): describe 0.16.0-beta.2

Folds the nine user-facing changes merged since beta.1 into the series entry and renames its heading. Highlights are unchanged.

* chore(release): cut 0.16.0-beta.2
2026-11-12 01:40:42 +07:00
MyasukaandTianyu Yang 18c002cbf2 fix: forward ACP prompt response token usage (#9396)
* fix: forward ACP prompt response token usage

* test: assert complete ACP usage snapshots

---------

Co-authored-by: Tianyu Yang <yangtianyu.cl@bytedance.com>
2026-11-11 14:06:49 +00:00
paseo-bot[bot] 47a7463182 test(app): cover email composer formats in one journey (#9398)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-11 12:42:00 +00:00
xxachangxx a4878656e2 fix(pi): track resumed pi-subagents runs and transcripts (#9261)
* 修复 Pi 恢复子任务的状态和对话跟踪

关联 #9200。

改动:
- 仅在 action:resume 确认成功启动新的 single async run 后登记独立子任务条目,按新 run ID 和 asyncDir 跟踪状态,拒绝失败及管理调用产生的假条目。
- 将对话去重从文件级调整为子任务条目与文件组合,支持恢复运行复用 session JSONL,避免旧通知结束新运行。
- 扩展原适配器回归测试,并附脱敏的命令输出、真实工具结果和 macOS Electron 截图,未改 UI、协议或共享生命周期。

实际验证:
- 原适配器下恢复条目回归为 RED;恢复旧文件级去重后共享对话回归为 RED。
- 基线 d46ee6558c 上 npm run build:server、npm run format、npm run typecheck、npm run lint、git diff --check 均成功。
- 在 packages/server 执行 npx vitest run src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts --bail=1,21/21 通过。
- 已在此前 0.15.3 开发版中,通过真实 macOS Electron、Pi 1.5.0、pi-subagents 0.86.0 验证 A→B→C 恢复、运行条目和对话、完成状态、归档保留运行任务、失败恢复不产生假条目;普通启动走 CLI/API,恢复通过真实 composer。截图不是 0.15.4 发布包验收。
- 同步后适配器与测试文件字节和第三方锁定依赖均未变,复用独立代码评审与上述桌面证据。公开材料已做隐私扫描。
- 未执行全量测试(仓库禁止本地全量执行)、CI、其他平台或发布安装包验证;短暂重复 Shell 文案原因未定位,不宣称本次修复。

回滚:
- 本提交仍为 HEAD 时执行 git revert HEAD;否则先用 git log --oneline --grep='修复 Pi 恢复子任务的状态和对话跟踪' 确认本提交哈希,再 git revert <确认的哈希>,不要重置或覆盖其他修改。
- 回滚后重跑该适配器测试并执行 npm run build:server;若需要部署回滚产物,另行安排服务切换,禁止未经授权重启正在使用的 Paseo daemon。
- 本提交仅改源码、测试和 QA 证据,无数据迁移;回滚不应删除已有 Pi 会话或异步目录。独立 QA 服务不由本提交启停。

* 补强 Pi 恢复对话的新消息与实时回放断言

回应 PR #9261 的 Greptile P2 评论 discussion_r4521416122。

改动:
- 只修改 pi-subagents/index.test.ts,按子任务 ID 提取 assistant_message 文本,精确检查 C 的历史与本轮内容。
- 观察 C reader 初始读取后再追加消息,在写入终态前验证新消息实时到达且 C 仍运行,避免只靠完成时刷新通过。
- 回放精确校验三条预期消息、顺序与 resume-c 归属,保留旧通知隔离、完成状态和 bg_wait 断言。
- 不修改生产实现、历史 QA 证据或普通启动行为。

实际验证:
- 临时在测试观察回调中丢弃 C 本轮消息:定向测试 exit 1,只有 Attempt b 的历史不能通过初始断言。
- 临时只丢弃 C 后追加消息:定向测试 exit 1,缺少 Attempt c follow-up 的断言在写入完成状态前失败。
- 两次故障注入已移除;最终在 packages/server 执行 npx vitest run src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts --bail=1,21/21 通过。
- npm run format、npm run typecheck、npm run lint 和 git diff --check 均通过;全仓 lint 为 0 warnings / 0 errors。
- LSP 推断项目模式仅报告未修改旧测试行的两处 results 类型警告;项目正式 typecheck 通过。
- 未运行全量测试、远端 CI 或重复桌面验收。本次只有测试变更,复用原产品评审和真实桌面验证,不将临时故障注入当作生产缺陷。

回滚:
- 本提交仍为 HEAD 时执行 git revert HEAD;否则用 git log --oneline --grep='补强 Pi 恢复对话的新消息与实时回放断言' 确认哈希后 git revert <该哈希>。
- 回滚后重跑上述适配器测试;这只撤销测试增强,不应回滚先前 #9200 产品修复,也无需重启 daemon 或删除任何会话数据。
2026-11-11 12:01:35 +00:00
paseo-bot[bot]andwhatamelon aade09d056 Show Codex reconnects and warnings without false recovery on child completion (#9370)
Show Codex reconnect attempts and distinct warnings through existing timeline rows. Keep interrupted root retries running through child activity and settle them on recovery, turn end, session close, or process exit.

Closes #9236

Co-authored-by: whatamelon <39753493+whatamelon@users.noreply.github.com>
2026-11-11 10:10:32 +00:00
paseo-bot[bot] a29e06bf1b test(app): cover terminal context actions in one journey (#9371)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-11 09:34:22 +00:00
Mohamed Boudra a886bfbcdd Give plugins an agent's background work count and a background flag on hooks (#9362)
* feat(plugins): give plugins the agent's sidebar indicator and background flag

Plugin UI re-derived agent state from status and attention fields and could
not see background work, so it showed agents as done while a shell they left
running was still live. Agent snapshots now carry the sidebar's own bucket as
indicator/indicatorLabel, computed by the same function the sidebar uses so
the two cannot drift.

Lifecycle hooks and the agent.open.before request now carry `background`, so a
hook can skip a hidden helper agent without a lookup. A hook cannot change it;
an omitted value means unchanged, like metadata.

`finished` attention still means the turn finished; background work is the
indicator's concern.

* fix(plugins): keep session-open hooks that omit background typechecking

A hook that returns its own object instead of spreading the request has no
background field; the result type now treats it as optional, like metadata,
matching the runtime where an omitted value means unchanged.

* refactor(plugins): give agent snapshots the background work count instead of an indicator

* fix(plugins): keep legacy session-open hooks that omit background typechecking
2026-11-11 15:10:13 +07:00
paseo-bot[bot] 88b46c6781 test(app): cover collapsed pin shortcuts in one journey (#9366)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-11 06:33:29 +00:00
ee6a2bba77 fix(server): report and remove a plugin the runtime terminated (#9285)
When a plugin sent an invalid IPC message, the runtime terminated it by disconnecting the IPC
channel and then killing the process. Node never emits "close" for a child whose channel the
parent disconnected, and "close" is where the runtime handles an exited plugin, so the process
died but the plugin stayed in the catalog, its session stayed open, nothing reported the exit,
and calls to it failed with "does not contribute RPC" instead of "Plugin is not available".

terminatePluginChild() now only kills the process; the channel closes with it, and "close"
fires as for any other exit.

Co-authored-by: Brandon Elliott <923787+Brandon168@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 05:53:39 +00:00
Mohamed Boudra 83f4ef9909 Restore a workspace's agents when unarchiving it (#9210)
* refactor(server): share one timestamp across workspace archive

* fix(server): restore workspace agents when unarchiving workspace

* fix(server): persist workspace recovery before restoring agents

Remove unused undo-list tracking and pass named restore requests. A failed workspace record write leaves its agents archived for retry.
2026-11-11 10:41:14 +07:00
paseo-bot[bot] a99f18b405 Wait for hydrated pages in the plugin navigation test (#9359)
* test(website): trace intermittent author navigation

* test(website): wait for hydrated plugin navigation pages

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-11 03:37:26 +00:00
Mohamed Boudra 6e5742fbc6 Rename sidebar workspaces in place on wide web layouts (#9280)
* feat(app): rename sidebar workspaces in place on wide web layouts

At lg and up on web, Rename from a sidebar row's kebab or context menu turns
the title into an input instead of opening the modal. The input fills a box
exactly one title line tall and its focus outline paints outside that box, so
the row never moves. Enter or blur saves, Escape discards. Narrower and native
layouts keep the modal; the native-wide device flows drive it.

The field stays on screen, read-only, holding the submitted title until the
renamed workspace arrives. The daemon answers workspace.title.set before it
pushes the workspace update, and queues that update behind any in-flight ones
for the workspace, so closing on the answer would show the old title.

While editing, the row detaches its press, drag and context-menu handlers
rather than becoming disabled: a disabled row sets aria-disabled, which makes
the input inside it read as disabled. A ContextMenuTrigger with its menu off
now leaves the browser's own menu alone, so copy and paste work in the field.

The rename modal moves into the new workspace-rename module, and the unused
sidebar-workspace-row.tsx is removed.

* fix(app): keep a title renamed elsewhere when an untouched inline rename closes

The unchanged check compared the field's text against the workspace's live title, while the
field keeps the text it opened with. A rename from another client during an untouched edit
made closing the field send the old title back. The inline session now owns its starting
text for both the field and the unchanged check.

* fix(app): hold a saved inline title against the title it replaced

The field closed once the row's title moved off the one editing started from. When another
client renamed the workspace while the field was open, that title had already moved, so a
save closed the field on the daemon's answer and showed the other client's title until the
saved one arrived. The session now records the title at submit and waits for it to change.

* fix(app): close an inline rename that submits the row's current title

Saving the title another client had just set left the row's title where it was, so the
saved phase waited forever with the field read-only and the row's press and menu handlers
off. A submit matching the current title now closes without a request.

* fix(app): finish an inline rename when the row shows the accepted title

The saved phase treated any title change as confirmation of this save. A rename from
another client delivered before ours closed the field early and showed that title, and
saving a title the row already had never changed it, leaving the field read-only and the
row's handlers off. The daemon's response carries the accepted title; the field now closes
once the row shows it. That rule also covers a submit matching the current title, so the
special-case comparison for it is gone.

* fix(app): close an inline rename that a later rename supersedes

The daemon builds each workspace update from its latest record, so a rename committed after
ours was accepted can be published in its place and ours never appears. Waiting for the
accepted title then left the field read-only and the row's handlers off. The saved phase now
ends on the first title change the row renders after the answer, or on the accepted title
if it is already showing. The session tracks the row's title while saving so a rename
delivered before the answer does not count.
2026-11-11 10:36:27 +07:00
Mohamed Boudra 97d39a0158 docs(release): say how changelog highlights are ranked
The highlight order of 0.16.0-beta.1 was wrong twice: first in the order the pull requests were collected, then with the maintainer's four named items on top in the order they were typed, which pushed Background tasks to fifth. The doc only said "biggest first", so there was no test to apply.

Changelog ordering now owns the ranking: reach and frequency, four groups, and what to do with a maintainer correction. The entry puts Background tasks back at the top; no wording changes.
2026-11-11 03:03:46 +01:00
Mohamed Boudra 8b8957ab77 docs(changelog): lead the 0.16.0-beta.1 highlights with the plugin sidebar and composer
The highlights shipped in the order they were collected, which put the plugin sidebar and composer sixth and seventh. Lines are moved whole; no wording changes. The release doc now says how to rank highlights.
2026-11-11 02:48:51 +01:00
Mohamed Boudra 603ee5ced1 fix(app): paint a long user message collapsed from its first frame (#9302)
MessagePreview learned it overflowed from onLayout, which arrives after
the mount has painted on web and Fabric. Every mount (opening the chat,
a prompt arriving, a row the list mounts again) painted the text hard-cut
with no fade or Show more, then grew the row by the control a frame later.
The expanded choice also lived in the row and reset with each remount.

Measure the body in a layout effect so the first commit carries the
control, and keep the expanded choice in a per-agent store the timeline
provides, as tool calls already do.
2026-11-11 08:25:55 +07:00
Mohamed Boudra de1b85ecfb Fix nested-button errors when hovering tool-call file actions (#9306)
* fix(app): keep tool badge file actions separate from disclosure buttons

Render the disclosure and open-file actions as sibling buttons so hovering a file-bearing badge does not produce invalid nested HTML buttons. Preserve independent mouse and keyboard activation.

* fix(app): preserve the full tool badge disclosure hit area
2026-11-11 08:24:49 +07:00
paseo-bot[bot] 33c818cc6b test(app): wait for sidebar context menu placement (#9351)
The measuring surface is visible before layout replaces it with the positioned menu. Retry the original geometry assertions across that replacement instead of measuring it once.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-11 00:39:48 +00:00
paseo-bot[bot] de67a7370c Keep HTTP Git fixtures from invoking ambient credential helpers (#9330)
* test(diff): diagnose changing Git interpretation on Windows

* test(plugins): isolate HTTP fixtures from credential helpers

* test(plugins): verify the credential sentinel and bound setup

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-10 21:55:31 +00:00
paseo-bot[bot] f684804821 test(plugins): isolate update recovery from fixture setup (#9304)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-10 15:02:05 +00:00
paseo-ai[bot] e7432cb2a5 fix: update lockfile signatures and Nix hash [skip ci] 2026-11-10 12:29:55 +00:00
Mohamed Boudra 4aeace7a17 chore(release): reconcile 0.16.0-beta.1 into main (#9301)
Brings the version shipped in v0.16.0-beta.1 into main: workspace versions and internal dependency ranges, exactly as tagged. The changelog entries on main already match the tag.
2026-11-10 19:20:29 +07:00
Mohamed Boudra 79b9e7447b test(app): check unanswered freshness when reopening cached history (#9296)
Foreground checks intentionally stay silent since #9242. Exercise the opening check instead, waiting for a durable cursor before reload so cached messages remain readable while the daemon answer is held.
2026-11-10 18:14:19 +07:00
Mohamed Boudra c91948048b Lead each release with highlights in What's new, the website changelog and release notes (#9281)
Every release entry in CHANGELOG.md now leads with highlights: an unheaded
list above the first `###`. The app's What's new sheet, the website
changelog and the GitHub release body show the highlights and fold the
sections, the full record, behind one control. An entry without highlights
keeps its sections in view. docs/release.md carries the writing rules.

Installed apps fetch CHANGELOG.md from main and parse it with the parser
they shipped with, so the two heading rules are a compatibility surface:
`##` starts a release, `###` starts a section, and headings inside fenced
code are text. The app, website and release-script parsers now split an
entry the same way and each runs the shared cases in
scripts/test-support/changelog-structure.json. The release-script tests,
which no CI job ran before, are part of "Validate CI contracts".

Adds the 0.16.0-beta.1 entry (en and zh-CN) ahead of the release.
2026-11-10 17:44:57 +07:00
paseo-bot[bot] 63ea3e5561 test(plugins): isolate failed-update assertions from fixture setup (#9275)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-10 09:02:08 +00:00
Mohamed Boudra 4c9c59ea2b Let plugins put the cursor in any agent's composer (#9207)
* feat(plugins): let a plugin put the cursor in any agent's composer

A pill could insert text but left the cursor elsewhere, so the user had
to click the composer before typing. Plugins can address any agent's
composer, and an author cannot know where the user is, so focus() owns
revealing the agent as well as focusing it.

A running agent's composer holds one pending request and navigates to
the agent, completing when an input that can take the keyboard attaches.
Drafts and the New workspace composer have nothing to navigate to and
must not pull the user back, so they reject when off screen.

* fix(app): stop treating a covered New workspace composer as on screen

The screen passed isPaneFocused={true}, so with Settings pushed over it
the input still counted as revealed. focus() on a held composer resolved
on native with no visible cursor, and rejected with the wrong error on web.
The screen now reports its real route focus.

* fix(app): reach a compact subagent's composer and keep a focus selection

A compact sheet has no composer, so focus() on a subagent without a tab
opened a read-only sheet and timed out. It now promotes the sheet to a
tab, the same path as Open as tab.

A pending focus ran inside the effect that attached the input, before a
later effect in that commit applied a prompt set alongside it, so its
selection was clamped against the old text. It now runs after the commit.

* fix(app): show a compact subagent's tab when focus promotes its sheet

navigateToAgent stops at the sheet, so nothing closed an Explorer panel
covering the promoted tab and focus() timed out. The promoted tab now
goes through the same reveal as any other navigated tab.

* fix(app): open focus targets as tabs and focus Explorer composers on compact

Promoting a sheet after navigating could not reach an open deferred
until the workspace loaded, so the request now asks for a tab up front
with asTab, which travels with the deferred open. That removes the
post-navigation promotion.

A compact composer counted as covered whenever the panel target was not
the agent panel, so one hosted in the Explorer could never take focus.
Coverage now follows the composer's own host.

* fix(app): judge compact composer coverage by where it is hosted

The Explorer dock always reported its pane as focused, so a workspace sheet
over an Explorer composer still counted as on screen and focus() put the
cursor behind the sheet. It now suspends pane focus like the main panes do.

A composer on a screen with no panes counted as a main pane, so an Explorer
selection left over from the workspace marked New workspace as covered and
focus() rejected on a visible input. Only the agent list can cover those
screens, because the Explorer lives in the workspace.

* fix(app): close the composer's own sheets and menus when a plugin focuses it

focus() judged a composer on screen by its pane and panel alone, so a sheet
or menu the composer opened over itself, like the compact controls sheet
that hosts plugin Actions or a Subagents track page, stayed up while the
cursor went behind it. Navigation cannot close those, so focus() now closes
them itself.

Sheets and menus register with the nearest OverlayDismissalScope while open.
The composer opens one, and the agent panel opens one around its whole chat
because the tracks render outside the composer; a nested scope joins the
enclosing one.

* fix(app): close a composer's open picker when a plugin focuses it

The thinking, provider-option and plugin selectors render Combobox, which
never joined the composer's overlay dismissal scope. focus() left the
picker open, resolved on the textarea's brief focus, and the picker's
focus enforcement then took the cursor back. Combobox now registers its
close while open, like sheets and menus.

* fix(app): close a composer's modals before focus places the cursor

An image preview opened from the composer stayed over it after focus()
succeeded: the shared Modal never joined the overlay dismissal scope.
Modal now registers its onRequestClose while visible. Closing it then
exposed a second race: a web modal hands focus back to the button that
opened it in the commit that removes it, after the cursor was placed.
Dismissal now resolves once every closed overlay has unregistered, and
the composer places the cursor after that, waiting at most 1s so a
plugin modal that refuses to close cannot hold the promise forever.

A focus request replaced by a newer one resolved immediately, even when
the composer never came on screen. It now settles with the newer one.

* fix(app): close every composer sheet on focus and keep the latest request

The context usage sheet opens through the bottom sheet visibility hook
directly, so it stayed over the composer after focus(). Registration
moves to that hook, which every controlled bottom sheet uses;
AdaptiveModalSheet registers only its desktop dialog.

Two focus() calls in one turn overwrote each other's wait for an
overlay to close, so the older one resumed a second later and put its
selection back. Callers now share each overlay's close, and the latest
request places the cursor while earlier ones settle with it.

On native, focus() reported success when the input refused focus, as a
non-editable input does during dictation. It now checks isFocused().

* fix(app): let a focus call made while the input attaches decide the selection

A queued focus was dispatched in a microtask after the input attached, so a
focus() made in between (from a mounting item, for example) was overwritten
by the older selection. Each call now carries its sequence number; a queued
request that is no longer the latest settles with the newer one instead of
placing the cursor.

* fix(app): close a workspace sheet that focus dismisses before it animates open

A bottom sheet modal that unmounts after presenting but before its first
animation is still INITIAL, and the library's portal unmount returned early
for that status. Its portal stayed on the host and kept sliding open with no
owner, so composer.focus() removed the sheet from the workspace but left it
covering the input. The patch unmounts the portal in that case.

The compact Explorer focus test also waits for the phone layout before
focusing, since focus otherwise resolved against the wide layout.
2026-11-10 14:22:44 +07:00
Mohamed Boudra d46ee6558c Keep popovers above their trigger off it when their content grows (#9247)
* fix(app): keep popovers above their trigger off it when content grows

Tooltips and menu popovers placed above their trigger were positioned by
their top edge. When their content grew after they painted, the new height
painted first at the old top, extending down over the trigger, and the
correction waited for onLayout and a second placement commit. Native
delivers those after the frame, so the grown card covered the trigger for
about 150 ms on Android; web commits both in one task and hid it.

A surface above its trigger is now held by its bottom edge: it sits on the
bottom of a holder that ends at that edge, so layout keeps the edge in
place however the content changes.

* fix(app): let presses outside a popover reach its backdrop on web

The holder that keeps a popover's edge in place set pointerEvents
"box-none" as an inline style. react-native-web only polyfills box-none
for compiled styles, so the browser received an invalid value, fell back
to auto, and the full-width holder swallowed clicks meant for the menu
backdrop. Clicking outside an open menu no longer closed it.

Set box-none through the pointerEvents prop, as the rest of the app does.
2026-11-10 11:05:35 +07:00
Mohamed Boudra abcccce846 Show a streamed tool call's final title and icon from its first frame (#9248)
* fix(server): give streamed tool calls their final title from the first frame

Claude opens a tool_use block with `input: {}` and OpenCode reports a
pending part with `input: {}` before the arguments arrive. The shared
detail primitives rejected the empty input, so the first row carried an
`unknown` detail and rendered the raw tool name with a wrench icon
("Bash"), then switched to "Shell" and the terminal icon once the command
arrived. Grep/Glob, WebFetch and MultiEdit flipped the same way, and
WebFetch flipped again while only `url` had streamed.

A known tool with no arguments and no output now yields its canonical
detail with empty fields. The app already reads empty read/edit/write/
search/fetch fields as loading details; a shell with no command and no
output now reads as loading too, instead of opening an empty sheet.

* fix(server): keep a tool call's title while optional arguments arrive first

Claude writes a tool's arguments in whatever order the model chooses, so a Bash
call can stream `{description}` before `command`. That partial input failed the
Bash schema and the row fell back to "Bash" with the wrench icon until the
command arrived.

Parsing now retries a call without output as having no arguments when its
input does not yet satisfy its tool's schema. This happens once, over the whole
branch set, so tools with several input shapes (OpenCode apply_patch) still
reach the branch their complete input matches.
2026-11-10 11:05:31 +07:00
Mohamed Boudra 48a1497fc0 Load the Changes diff quickly while the daemon reconciles worktrees (#9243)
* fix(server): keep cold diffs out from behind background git fan-out

Add a background lane to the git process scheduler and run reconciliation
checkout reads, observation-driven workspace refreshes and background fetches
in it. Bound reconciliation checkout reads to four at a time. Stop the Linux
file observer's startup scan from reporting existing files as creates, which
made every cold diff compute and discard its first revision.

* fix(server): pick the git job when its start token fires

Background jobs that already reserved a start-rate token no longer start
ahead of normal work submitted after them.

* fix(server): re-read the working tree once its watcher covers it

The Linux observer no longer reports pre-existing files at startup, so an
edit made between a workspace's first snapshot and its watcher subscribing
reached no consumer. WorkspaceGit now runs one background working-tree read
once observation setup completes with a live watcher.

Demand refreshes keep the caller's Git lane instead of forcing normal, so
user actions running at high priority are not demoted.

Scope the populated-tree observer test to Linux (FSEvents replays recent
writes) and update the observer benchmark test, which expected the removed
startup batch.

* fix(server): re-read checkout metadata once observation covers it

A branch switch made before the Git metadata watcher subscribed left the
cached branch stale. The post-coverage read now refreshes structure as well
as the working tree, matching the refresh the Linux startup events used to
trigger.
2026-11-10 10:21:13 +07:00
Mohamed Boudra 2e1747a145 fix(app): keep the Changes diff on screen when its panel reopens (#9241)
Hiding the Changes panel releases its diff subscription. Reopening it starts a
new stream, and since #8907 a new stream first publishes a loading snapshot
(entries, no bodies) before its first revision commits. That snapshot replaced
the settled diff in the query cache, so the panel showed the full loading
spinner for about a second and then repainted the same diff.

A loading snapshot now only counts on the first load. Once a diff has settled,
shareCheckoutDiff keeps it until the new stream's ready revision lands, which
replaces it in one step when the content changed.
2026-11-10 09:49:11 +07:00
Mohamed Boudra 4181f8d738 fix(app): show loaded usage in the context popover's first frame (#9212)
The agent's usage query used gcTime 0, so every close dropped its reports
and every open started from the loading state. The drop existed because an
agent resumed under another login keeps its ID. The daemon now projects an
opaque usageScopeKey that follows the harness session and model, the query
key includes it, and reports are retained for as long as the scope holds.

Hover cards placed above their trigger now hold their bottom edge. Anchored
by top, a card that grew painted past the trigger until onLayout corrected
it on a later frame.
2026-11-10 09:49:07 +07:00
Mohamed Boudra 11d7267e33 fix(app): keep Updating messages hidden while an unchanged chat is checked on resume (#9242)
Every freshness check escalated to "pending" once FRESHNESS_CHECK_QUIET_MS
(500 ms) passed without an answer, so any round trip slower than that
flashed Updating messages for an idle chat the daemon then called current.
On Android that fired on a sub-second app switch over a slower link, and
after a reconnect it replaced Reconnecting to host with a second toast.

Each check now records why it was asked. Only opening a chat escalates
after the quiet period. A reconnect stays "reattaching" (Reconnecting to
host) until the answer. A foreground resume on a socket that stayed
connected stays silent: the chat never left its subscription, and a socket
that died without closing fails the foreground liveness probe and becomes
a reconnect. A "behind" answer still shows Updating messages until the
fetch lands.
2026-11-10 09:28:55 +07:00
Mohamed Boudra 82687ec95b Keep plugin composer items in the toolbar when they fit (#9209)
* fix(app): keep plugin composer items in the toolbar when they fit

The density budget guessed a plugin item's width from a fixed label and
counted every registered item, so an icon toggle or an item rendering
nothing pushed the toolbar into its overflow state with room to spare.
An item is an arbitrary component, so its width is only known by
rendering it. Measure the toolbar form in an always-mounted slot; the
width never depends on the density it decides, so moving items to the
overflow cannot flip the answer.

Sheet rows truncated short values such as "Full access" because the
value's 45% cap resolved against a content-width row. Fill the row so
the cap resolves against the sheet's width.

* fix(app): close a plugin picker when its trigger moves to the overflow

The measuring slot keeps toolbar plugin items mounted, so a picker that
was open when the toolbar condensed lost its trigger but kept its popup,
which portals to the overlay root. Mark the slot's items inactive while
they are out of the row, the contract retained panels already use to
close their popups.

* test(app): allow the Updating messages toast when the daemon answers slowly

A freshness check unanswered after 500ms reports Updating messages by
design, but the resume spec asserted no toast regardless of how long
the daemon took. On a loaded runner a cold reload's answer took 512ms,
so the toast was correct and the spec failed. Assert no toast only when
the answer came back promptly, using answer times the gate records.

* test(app): check the Updating messages toast the same way on every run

The previous repair skipped the no-toast assertion whenever the daemon
took 300ms or more to answer, so a slow run proved nothing. The toast is
correct once a check has gone unanswered for the quiet window, so the
spec now always asserts that the toast did not appear sooner than that
after the question was sent, timed in the page. The delayed-answer path
gets its own test that holds the daemon's answer.
2026-11-10 09:08:11 +07:00
Mohamed Boudra 9442b5a1b4 chore(release): reconcile 0.15.4 into main (#9240) 2026-11-10 08:50:23 +07:00
Mohamed Boudra 6cfe903127 Lay composer toolbar controls out at their full highlight on touch (#9238)
Touch-sized, each toolbar control now lays out at its whole highlight with no gap, so neighbouring highlights touch instead of hanging into gaps through negative margins. The row's overhang puts the attach glyph and a leading label on the composer's rail, and the trailing disc keeps a small clearance from its neighbour.
2026-11-10 08:33:58 +07:00
f9779a14a5 feat(claude): add Fable 5.2 and Mythos 5.2 to the model catalog (#9233)
Adds Claude Fable 5.2 and Mythos 5.2, available from Claude Code 2.1.321, and defaults both to medium effort to match Claude Code.

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
Co-authored-by: gudcks <84506708+gudcks@users.noreply.github.com>
2026-11-10 01:09:47 +00:00
353 changed files with 12571 additions and 2781 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ jobs:
filters: .github/ci-paths.yml
- name: Validate CI contracts
run: node --test scripts/ci-workflow.test.mjs scripts/daemon-launch-contract.test.mjs scripts/sync-fdroid-changelogs.test.mjs scripts/upload-release-assets.test.mjs
run: node --test scripts/ci-workflow.test.mjs scripts/daemon-launch-contract.test.mjs scripts/changelog-utils.test.mjs scripts/sync-fdroid-changelogs.test.mjs scripts/sync-release-notes-from-changelog.test.mjs scripts/upload-release-assets.test.mjs
quality:
name: quality
+144
View File
@@ -1,5 +1,149 @@
# Changelog
## 0.16.0-beta.2 - 2026-11-11
- **Background tasks:** Paseo now shows the background tasks an agent is running, such as shells and monitors, above the composer, with a Stop button for each. Works with Claude Code, Codex and OpenCode v2. ([#6220](https://github.com/getpaseo/paseo/pull/6220), [#9162](https://github.com/getpaseo/paseo/pull/9162) by [@fxlelouarn](https://github.com/fxlelouarn))
- **Plugin sidebar views:** A plugin can replace the sidebar's content with its own layout of workspaces, agents, projects and terminals across every connected host. Pick the view per device under Settings → Sidebar; Paseo's sidebar header and footer stay in place. ([#8906](https://github.com/getpaseo/paseo/pull/8906))
- **Plugin composer controls:** Plugins can add their own controls to the composer, and read and set its prompt, attachments, provider, model, mode and thinking. They can also put the cursor in any agent's composer, add items to New workspace, and store their own metadata on agents and workspaces. ([#8744](https://github.com/getpaseo/paseo/pull/8744), [#9209](https://github.com/getpaseo/paseo/pull/9209), [#9207](https://github.com/getpaseo/paseo/pull/9207))
- **Faster diff loading:** Opening Changes shows the file tree right away while file contents load. Large diffs arrive in batches, so the rest of the app keeps responding while they load, and diffs take priority over the daemon's background worktree scans. ([#8907](https://github.com/getpaseo/paseo/pull/8907), [#9241](https://github.com/getpaseo/paseo/pull/9241), [#9243](https://github.com/getpaseo/paseo/pull/9243))
- **Polish:** The chat stays still when a turn ends, and returning to a chat that has not changed shows it as it is with no refresh. Tool rows show their final title and icon from the first frame, the context window popover opens with usage already loaded, and sidebar hover cards open one at a time. ([#8944](https://github.com/getpaseo/paseo/pull/8944), [#9175](https://github.com/getpaseo/paseo/pull/9175), [#9242](https://github.com/getpaseo/paseo/pull/9242), [#9248](https://github.com/getpaseo/paseo/pull/9248), [#9212](https://github.com/getpaseo/paseo/pull/9212), [#9071](https://github.com/getpaseo/paseo/pull/9071))
- **Rebuilt mobile chat timeline:** The chat timeline on iOS and Android was rebuilt. Expanding or collapsing a turn summary, todo card or tool-call group keeps the line you tapped in place, and on Android so do Show more, Show less and plan cards. ([#8717](https://github.com/getpaseo/paseo/pull/8717), [#9085](https://github.com/getpaseo/paseo/pull/9085))
- **Keyboard shortcuts on mobile:** With a keyboard connected, iPad and Android now run the same shortcuts as desktop, including your custom bindings. Shortcut hints and Settings → Shortcuts appear when a keyboard is detected. Shortcuts also work in narrow desktop and browser windows. ([#8625](https://github.com/getpaseo/paseo/pull/8625) by [@jeroenfrenken](https://github.com/jeroenfrenken), [@lstroud](https://github.com/lstroud))
- **Touch-sized tablet controls:** On iPad and other touch-screen devices, the wide layout now has touch-sized buttons, rows and bars. The composer toolbar folds its controls into the model menu when space runs out, and swiping right on the workspace reveals a collapsed sidebar as an overlay. ([#8748](https://github.com/getpaseo/paseo/pull/8748), [#8885](https://github.com/getpaseo/paseo/pull/8885), [#8891](https://github.com/getpaseo/paseo/pull/8891), [#8909](https://github.com/getpaseo/paseo/pull/8909), [#9151](https://github.com/getpaseo/paseo/pull/9151), [#9238](https://github.com/getpaseo/paseo/pull/9238), [#8739](https://github.com/getpaseo/paseo/pull/8739) by [@zeyugao](https://github.com/zeyugao))
- **Undo workspace archive:** Archiving a workspace in the app now shows a "Workspace archived" toast for six seconds. Undo, or Cmd/Ctrl+Z, restores the workspace with its tabs and agents. On desktop, sidebar workspace rows also get an archive button on hover. ([#8904](https://github.com/getpaseo/paseo/pull/8904), [#9104](https://github.com/getpaseo/paseo/pull/9104))
- **Fewer reconnects on return:** Returning to the app keeps a working connection, including one in the middle of a large response, and reconnects once when it has to. On a host with several saved connections, Paseo stays on the one that works. ([#8651](https://github.com/getpaseo/paseo/pull/8651), [#9086](https://github.com/getpaseo/paseo/pull/9086), [#8855](https://github.com/getpaseo/paseo/pull/8855), [#9116](https://github.com/getpaseo/paseo/pull/9116))
### Added
- Added a Change base picker in Changes for worktree workspaces, so diffs, the commit list and Git actions can use another branch ([#8642](https://github.com/getpaseo/paseo/pull/8642), [#8934](https://github.com/getpaseo/paseo/pull/8934) by [@Myasuka](https://github.com/Myasuka))
- Added links for issue and pull request references such as `#123` and `owner/repo#123` in agent replies, plans, the pull request panel and file previews, for GitHub, GitLab, Gitea, Forgejo and Codeberg ([#8636](https://github.com/getpaseo/paseo/pull/8636))
- Added iPhone Duo layout support: workspace actions sit in the system vertical bar, and the sidebar and workspace split on either side of the fold ([#8741](https://github.com/getpaseo/paseo/pull/8741), [#8901](https://github.com/getpaseo/paseo/pull/8901) by [@zeyugao](https://github.com/zeyugao))
- Added fx as a provider you can add from the provider catalog in Settings → Hosts → Providers ([#9160](https://github.com/getpaseo/paseo/pull/9160))
- Added background agents: an agent or plugin can create a helper with `background: true` that opens no tab, sends no notification and stays out of the sidebar and default agent lists ([#8683](https://github.com/getpaseo/paseo/pull/8683))
- Added syntax highlighting for Terraform and HCL files (`.tf`, `.tfvars`, `.hcl`) ([#9106](https://github.com/getpaseo/paseo/pull/9106))
- Added `PASEO_WORKSPACE_ID` to each agent's environment so an agent can identify, rename or archive its own workspace ([#8939](https://github.com/getpaseo/paseo/pull/8939) by [@DTTerastar](https://github.com/DTTerastar))
### Changed
- Changed opening a workspace to restore the tab you left instead of jumping to the agent that needs attention ([#8935](https://github.com/getpaseo/paseo/pull/8935))
- Changed question cards so picking an option no longer advances automatically; continue with Next or Submit ([#8525](https://github.com/getpaseo/paseo/pull/8525))
- Changed the slash command menu to show loading and error states with Retry, and to stop selecting `/exit` by default ([#8905](https://github.com/getpaseo/paseo/pull/8905))
- Changed the workspace header and tabs to switch to compact controls when Explorer or a split pane narrows the workspace ([#8740](https://github.com/getpaseo/paseo/pull/8740), [#9088](https://github.com/getpaseo/paseo/pull/9088) by [@zeyugao](https://github.com/zeyugao))
- Changed sending a message to a Pi agent whose process has exited to fail immediately with an instruction to reload the agent ([#8718](https://github.com/getpaseo/paseo/pull/8718))
- Changed Rename workspace in the sidebar on desktop and wide web layouts to edit the title in place instead of opening a dialog ([#9280](https://github.com/getpaseo/paseo/pull/9280))
- Changed What's new and the website changelog to show a release's highlights first, with the full list behind Show all changes ([#9281](https://github.com/getpaseo/paseo/pull/9281))
### Fixed
- Fixed the working indicator disappearing when returning to a chat whose agent finished while you were away ([#9170](https://github.com/getpaseo/paseo/pull/9170))
- Fixed chats with short collapsed turns opening with empty space until you scrolled ([#8358](https://github.com/getpaseo/paseo/pull/8358), [#9083](https://github.com/getpaseo/paseo/pull/9083))
- Fixed Collapse turns hiding an earlier reply inside a later turn's summary line after an idle Claude, Codex or OpenCode agent was resumed ([#9098](https://github.com/getpaseo/paseo/pull/9098))
- Fixed the missing space between a prompt and the reply or collapsed-turn summary line below it ([#9009](https://github.com/getpaseo/paseo/pull/9009))
- Fixed a long user message showing without its fade and Show more for one frame when a chat opened ([#9302](https://github.com/getpaseo/paseo/pull/9302))
- Fixed Markdown tables showing as literal pipes when written directly below a paragraph with no blank line ([#8485](https://github.com/getpaseo/paseo/pull/8485) by [@ragokan](https://github.com/ragokan), [@suk-6](https://github.com/suk-6), [@thsrite](https://github.com/thsrite))
- Fixed linked badge images that share a line with text rendering as full-width blocks on web and desktop ([#8530](https://github.com/getpaseo/paseo/pull/8530))
- Fixed View diagram opening fullscreen instead of returning to the inline Mermaid diagram after View source ([#8932](https://github.com/getpaseo/paseo/pull/8932) by [@luoph](https://github.com/luoph))
- Fixed mouse-wheel scrolling running in the opposite direction in chats on Android ([#8693](https://github.com/getpaseo/paseo/pull/8693) by [@sjeon87](https://github.com/sjeon87))
- Fixed unsent composer text and attachments being deleted when an agent tab was closed ([#9079](https://github.com/getpaseo/paseo/pull/9079))
- Fixed pasting text with hyperlinks into the composer dropping the link URLs; links now paste as Markdown ([#8972](https://github.com/getpaseo/paseo/pull/8972))
- Fixed the composer losing focus after clicking Send with a mouse ([#9015](https://github.com/getpaseo/paseo/pull/9015))
- Fixed the composer resting 50pt above the bottom edge on iPhone ([#8823](https://github.com/getpaseo/paseo/pull/8823) by [@zeyugao](https://github.com/zeyugao))
- Fixed Add host sending you to Settings from the sidebar and New workspace ([#8512](https://github.com/getpaseo/paseo/pull/8512))
- Fixed a failed agent's red dot and Failed grouping staying in the sidebar after opening the agent or choosing Mark as read ([#8831](https://github.com/getpaseo/paseo/pull/8831))
- Fixed a workspace's unread indicator staying on after it was cleared while the agent's runtime was closed ([#9087](https://github.com/getpaseo/paseo/pull/9087))
- Fixed unarchiving a workspace not restoring the agents that were archived with it ([#9210](https://github.com/getpaseo/paseo/pull/9210))
- Fixed the context window popover closing by itself whenever the chat scrolled during a streaming reply ([#8742](https://github.com/getpaseo/paseo/pull/8742) by [@3ae3ae](https://github.com/3ae3ae))
- Fixed the sidebar usage summary updating only when Usage was opened ([#7806](https://github.com/getpaseo/paseo/pull/7806) by [@ragokan](https://github.com/ragokan))
- Fixed tooltips and menus above their trigger briefly covering it on Android when their content grew after opening ([#9247](https://github.com/getpaseo/paseo/pull/9247))
- Fixed History showing "Could not load history" after reloading the web app on the History screen ([#9029](https://github.com/getpaseo/paseo/pull/9029))
- Fixed section links in an HTML file preview replacing the preview with the Paseo app instead of scrolling within the file ([#8559](https://github.com/getpaseo/paseo/pull/8559) by [@3ae3ae](https://github.com/3ae3ae))
- Fixed Files Refresh leaving a newly created file hidden when its folder was collapsed during the refresh ([#8582](https://github.com/getpaseo/paseo/pull/8582) by [@hadan8977](https://github.com/hadan8977))
- Fixed the branch switcher showing "No branches found" while branches are still loading or after the request fails ([#8938](https://github.com/getpaseo/paseo/pull/8938))
- Fixed commit history showing a doubled slash, no rename status and no diff for a file moved up a directory ([#8509](https://github.com/getpaseo/paseo/pull/8509) by [@hadan8977](https://github.com/hadan8977))
- Fixed a merged pull request disappearing from its workspace when the checkout was behind the pull request's head
- Fixed workspace Git watchers staying in fallback polling after a watcher setup timeout
- Fixed abandoned connections staying open for up to 45 seconds after the web or desktop app reconnected ([#9067](https://github.com/getpaseo/paseo/pull/9067))
- Fixed a connection routed through another host closing with "The receiving client cannot keep up with host output" while fetching a very large timeline ([#9109](https://github.com/getpaseo/paseo/pull/9109))
- Fixed a connected host staying in error after it was updated to a supported version ([#8423](https://github.com/getpaseo/paseo/pull/8423) by [@DAnaeto](https://github.com/DAnaeto))
- Fixed handshake retries and a once-per-second `relay_e2ee_channel_error` warning continuing after a connection attempt to an unreachable host had timed out ([#9025](https://github.com/getpaseo/paseo/pull/9025), [#9038](https://github.com/getpaseo/paseo/pull/9038))
- Fixed app diagnostics reporting `Last online: never` for a host that had connected and then disconnected ([#9054](https://github.com/getpaseo/paseo/pull/9054), [#9058](https://github.com/getpaseo/paseo/pull/9058))
- Fixed shell commands started by a Codex turn continuing to run after the turn is stopped or interrupted ([#7525](https://github.com/getpaseo/paseo/pull/7525) by [@thomasvan](https://github.com/thomasvan))
- Fixed Claude turns that stop on an API error, such as a session limit or an invalid API key, being reported as completed instead of failed ([#8480](https://github.com/getpaseo/paseo/pull/8480) by [@RRD-dev](https://github.com/RRD-dev), [@luoph](https://github.com/luoph))
- Fixed Claude processes staying in memory until the daemon restarted when an idle chat was reopened without sending a prompt ([#9019](https://github.com/getpaseo/paseo/pull/9019) by [@Brandon168](https://github.com/Brandon168))
- Fixed Claude agents not resuming after a graceful daemon stop or restart when agent recovery is turned on ([#8686](https://github.com/getpaseo/paseo/pull/8686) by [@babo-jeonguk](https://github.com/babo-jeonguk))
- Fixed the effort control missing in the composer for Claude models that come from Claude's `settings.json` ([#8699](https://github.com/getpaseo/paseo/pull/8699) by [@ragokan](https://github.com/ragokan), [@yahao123](https://github.com/yahao123))
- Fixed importing a Claude session failing with `Invalid string length` when its transcript is very large ([#8457](https://github.com/getpaseo/paseo/pull/8457) by [@qwist1233-cpu](https://github.com/qwist1233-cpu))
- Fixed Claude turns that end at the maximum-turn limit losing their final token counts and cost ([#8519](https://github.com/getpaseo/paseo/pull/8519))
- Fixed Codex "Apply file changes" approvals showing no file name or diff before you accept ([#8585](https://github.com/getpaseo/paseo/pull/8585) by [@ragokan](https://github.com/ragokan))
- Fixed the timeline showing only the first file's diff when Codex edits several files in one patch ([#8613](https://github.com/getpaseo/paseo/pull/8613) by [@ragokan](https://github.com/ragokan))
- Fixed Codex session discovery and startup intermittently failing with a SQLite initialization error when several Codex operations start at once ([#9008](https://github.com/getpaseo/paseo/pull/9008) by [@colonelpanic8](https://github.com/colonelpanic8), [@michaelmwu](https://github.com/michaelmwu))
- Fixed Codex reconnect attempts and warnings not appearing in the timeline ([#9370](https://github.com/getpaseo/paseo/pull/9370) by [@whatamelon](https://github.com/whatamelon))
- Fixed OpenCode conversations that were mid-turn during a daemon restart showing idle and ignoring Stop ([#8698](https://github.com/getpaseo/paseo/pull/8698))
- Fixed OpenCode being told you declined a tool call when you sent a message while its approval was pending ([#8477](https://github.com/getpaseo/paseo/pull/8477))
- Fixed reopened Pi conversations missing the messages from before a context compaction ([#8523](https://github.com/getpaseo/paseo/pull/8523))
- Fixed archived Pi chats failing to open with `spawn pi ENOENT` after their working folder was removed ([#8442](https://github.com/getpaseo/paseo/pull/8442) by [@DAnaeto](https://github.com/DAnaeto))
- Fixed reading an archived Pi chat leaving a Pi process running when idle runtime cleanup is disabled ([#8554](https://github.com/getpaseo/paseo/pull/8554) by [@rylwin](https://github.com/rylwin))
- Fixed resumed pi-subagents runs missing from the Subagents track ([#9261](https://github.com/getpaseo/paseo/pull/9261) by [@xxachangxx](https://github.com/xxachangxx))
- Fixed a prompt sent to an ACP agent whose process has exited staying in running forever instead of failing with an error ([#8406](https://github.com/getpaseo/paseo/pull/8406) by [@DAnaeto](https://github.com/DAnaeto))
- Fixed an ACP agent staying stuck on "waiting for permission" after it abandoned an approval request and ended its turn ([#8548](https://github.com/getpaseo/paseo/pull/8548) by [@3ae3ae](https://github.com/3ae3ae))
- Fixed changing the mode of an ACP agent failing with `invalid_params` after the agent sends a config update ([#8912](https://github.com/getpaseo/paseo/pull/8912) by [@a-sh](https://github.com/a-sh))
- Fixed Paseo showing and saving an unavailable model after selecting it on a running ACP agent ([#8957](https://github.com/getpaseo/paseo/pull/8957))
- Fixed importing a session switching it from its own model to the provider's default model ([#8948](https://github.com/getpaseo/paseo/pull/8948))
- Fixed a message from another agent cancelling the recipient's pending question or approval before you could answer it ([#8453](https://github.com/getpaseo/paseo/pull/8453) by [@DAnaeto](https://github.com/DAnaeto))
- Fixed an agent never being notified of completion after sending a prompt to a closed or archived agent on a connected host ([#8575](https://github.com/getpaseo/paseo/pull/8575))
- Fixed creating a child agent failing with "Caller agent not found" after a daemon restart until the parent chat had been opened ([#8714](https://github.com/getpaseo/paseo/pull/8714))
- Fixed an agent still showing as failed after it resumed from a provider error and completed its next turn ([#8083](https://github.com/getpaseo/paseo/pull/8083) by [@luoph](https://github.com/luoph))
- Fixed a detached subagent still showing under its archived parent until refresh ([#8903](https://github.com/getpaseo/paseo/pull/8903) by [@luoph](https://github.com/luoph))
- Fixed opening an agent failing with "Working directory does not exist" instead of showing its saved conversation ([#8737](https://github.com/getpaseo/paseo/pull/8737))
- Fixed the daemon re-reading all archived agent and workspace history on every workspace update ([#8735](https://github.com/getpaseo/paseo/pull/8735))
- Fixed the daemon repeatedly running Git commands in a workspace folder that was deleted while its file watcher was in fallback polling ([#8462](https://github.com/getpaseo/paseo/pull/8462) by [@DAnaeto](https://github.com/DAnaeto))
- Fixed workspace service connections staying open after the browser tab closes or reloads ([#8421](https://github.com/getpaseo/paseo/pull/8421) by [@DAnaeto](https://github.com/DAnaeto))
- Fixed the daemon web UI answering missing `/.well-known/*` requests with the app page instead of a 404 ([#8622](https://github.com/getpaseo/paseo/pull/8622) by [@HomicideZero](https://github.com/HomicideZero))
- Fixed schedules accepting cron steps after a single number, such as `0/15 * * * *`, and running them hourly; they are now rejected ([#8607](https://github.com/getpaseo/paseo/pull/8607) by [@Mar-garet](https://github.com/Mar-garet))
- Fixed cron schedules that set both day-of-month and day-of-week running only when both matched instead of when either matches ([#8611](https://github.com/getpaseo/paseo/pull/8611) by [@Mar-garet](https://github.com/Mar-garet))
- Fixed `paseo logs --json` printing the plain-text transcript instead of JSON ([#8589](https://github.com/getpaseo/paseo/pull/8589) by [@hadan8977](https://github.com/hadan8977))
- Fixed the `create_agent` tool not telling agents that creating an agent on another provider needs a mode ([#8483](https://github.com/getpaseo/paseo/pull/8483) by [@guerinnoah](https://github.com/guerinnoah))
- Fixed terminals failing to open on Windows machines where Windows PowerShell cannot run `Get-CimInstance` ([#8818](https://github.com/getpaseo/paseo/pull/8818))
- Fixed the terminal typing its version reply into the shell when a program queries the terminal version ([#8419](https://github.com/getpaseo/paseo/pull/8419) by [@DAnaeto](https://github.com/DAnaeto))
- Fixed a finger drag in the web terminal scrolling history about twice as far as the drag ([#8776](https://github.com/getpaseo/paseo/pull/8776) by [@sinomoe](https://github.com/sinomoe))
- Fixed mouse scrolling in terminal programs such as Copilot CLI stopping after switching away from the terminal and back ([#9004](https://github.com/getpaseo/paseo/pull/9004) by [@imink](https://github.com/imink))
- Fixed dropping several files onto a remote terminal pasting their paths with no space between them ([#8946](https://github.com/getpaseo/paseo/pull/8946) by [@sebastianarena](https://github.com/sebastianarena))
- Fixed the `browser_fill` tool reporting success without updating React-controlled inputs and textareas ([#9022](https://github.com/getpaseo/paseo/pull/9022))
- Fixed `browser_evaluate` failing on pages whose Content Security Policy omits `unsafe-eval` ([#8973](https://github.com/getpaseo/paseo/pull/8973) by [@amustapha](https://github.com/amustapha))
- Fixed `browser_logs` omitting the HTTP status of each network request ([#8956](https://github.com/getpaseo/paseo/pull/8956) by [@amustapha](https://github.com/amustapha))
### Plugins
- Added plugin subscriptions, which stream live events from the daemon to a plugin's panels, and binary (`Uint8Array`) payloads for plugin RPCs and events ([#8527](https://github.com/getpaseo/paseo/pull/8527))
- Added an agent's background task count (`backgroundWork.count`) and `background` flag to plugin agent snapshots, and a `background` flag to agent hooks ([#9362](https://github.com/getpaseo/paseo/pull/9362))
- Changed Settings → Plugins to open a plugin's settings from a cog button, with a tab per settings screen ([#8675](https://github.com/getpaseo/paseo/pull/8675))
- Added an upward chevron to plugin composer pills that open a menu or popover ([#8673](https://github.com/getpaseo/paseo/pull/8673))
- Changed daemon startup to launch configured plugins concurrently instead of one after another ([#8427](https://github.com/getpaseo/paseo/pull/8427) by [@DAnaeto](https://github.com/DAnaeto))
- Fixed registry plugin installs failing with "npm artifact changed since review" when the host's npm uses a registry mirror ([#8756](https://github.com/getpaseo/paseo/pull/8756) by [@tlipoca9](https://github.com/tlipoca9))
- Fixed a plugin the daemon terminated for an invalid message staying listed with no exit reported ([#9285](https://github.com/getpaseo/paseo/pull/9285) by [@Brandon168](https://github.com/Brandon168))
- Fixed ACP provider plugins dropping the token usage an agent reports in its prompt response ([#9396](https://github.com/getpaseo/paseo/pull/9396) by [@Myasuka](https://github.com/Myasuka))
- Fixed the published `@getpaseo/*` npm packages declaring no license; they now declare Apache-2.0 ([#7816](https://github.com/getpaseo/paseo/pull/7816) by [@mdlawson](https://github.com/mdlawson), [@ragokan](https://github.com/ragokan))
- Fixed forking from an earlier reply failing with "This checkpoint changed after it was created" after a plugin updated one of its timeline cards ([#8746](https://github.com/getpaseo/paseo/pull/8746) by [@monarchmaisuriya](https://github.com/monarchmaisuriya))
- Fixed Collapse turns leaving a turn open, or folding to an earlier reply, when a plugin renders the final reply ([#8811](https://github.com/getpaseo/paseo/pull/8811) by [@geoqiao](https://github.com/geoqiao))
- Fixed plugin screens showing "This plugin surface is unavailable" while the plugin catalog is still loading after an app reload ([#8123](https://github.com/getpaseo/paseo/pull/8123) by [@vs-tahir](https://github.com/vs-tahir))
- Fixed the Workspaces list being pushed out of the mobile sidebar on short screens when plugins add many navigation items ([#8727](https://github.com/getpaseo/paseo/pull/8727) by [@jaredwang](https://github.com/jaredwang))
- Fixed timeline plugins not receiving the sender, event and original text on agent-message tool calls ([#8492](https://github.com/getpaseo/paseo/pull/8492) by [@RRD-dev](https://github.com/RRD-dev), [@luoph](https://github.com/luoph))
- Fixed plugin RPCs failing when their input or output schema uses a transform ([#8550](https://github.com/getpaseo/paseo/pull/8550))
### Notes
- Background tasks, the Change base picker, archive undo, background agents, plugin subscriptions and fx need both the host and the app on this version
## 0.15.4 - 2026-11-10
### Added
- Added Claude Fable 5.2 and Mythos 5.2 with medium default effort ([#9233](https://github.com/getpaseo/paseo/pull/9233) by [@gengjiawen](https://github.com/gengjiawen), [@gudcks](https://github.com/gudcks))
### Notes
- Both models require Claude Code 2.1.321 or newer; Mythos 5.2 appears only when Claude Code advertises access
## 0.15.3 - 2026-11-06
### Fixed
+144
View File
@@ -1,5 +1,149 @@
# Changelog
## 0.16.0-beta.2 - 2026-11-11
- **后台任务**:Paseo 现在会在 Composer 上方显示 Agent 正在运行的后台任务,例如 shell 和监视器,每项都带“停止”按钮。支持 Claude Code、Codex 和 OpenCode v2。 ([#6220](https://github.com/getpaseo/paseo/pull/6220), [#9162](https://github.com/getpaseo/paseo/pull/9162),贡献者:[@fxlelouarn](https://github.com/fxlelouarn))
- **插件侧边栏视图**:插件可以用自己的布局替换侧边栏内容,展示所有已连接主机上的工作区、Agent、项目和终端。在“设置 → 侧边栏”中为每台设备选择视图;Paseo 的侧边栏页眉和页脚保持不变。 ([#8906](https://github.com/getpaseo/paseo/pull/8906))
- **插件 Composer 控件**:插件可以向 Composer 添加自己的控件,并读取和设置其中的提示词、附件、Provider、模型、模式和思考强度。插件还可以把光标放到任意 Agent 的 Composer 中、向“新建工作区”添加条目,并在 Agent 和工作区上保存自己的元数据。 ([#8744](https://github.com/getpaseo/paseo/pull/8744), [#9209](https://github.com/getpaseo/paseo/pull/9209), [#9207](https://github.com/getpaseo/paseo/pull/9207))
- **更快的 diff 加载**:打开“更改”时会立即显示文件树,文件内容随后加载。大型 diff 分批到达,加载期间应用的其他部分照常响应,并且 diff 优先于 daemon 的后台 worktree 扫描。 ([#8907](https://github.com/getpaseo/paseo/pull/8907), [#9241](https://github.com/getpaseo/paseo/pull/9241), [#9243](https://github.com/getpaseo/paseo/pull/9243))
- **细节打磨**:一轮对话结束时聊天保持不动,返回没有变化的聊天时直接显示原样,无需刷新。工具行从第一帧起就显示最终标题和图标,上下文窗口浮层打开时用量已加载完成,侧边栏悬停卡片一次只打开一个。 ([#8944](https://github.com/getpaseo/paseo/pull/8944), [#9175](https://github.com/getpaseo/paseo/pull/9175), [#9242](https://github.com/getpaseo/paseo/pull/9242), [#9248](https://github.com/getpaseo/paseo/pull/9248), [#9212](https://github.com/getpaseo/paseo/pull/9212), [#9071](https://github.com/getpaseo/paseo/pull/9071))
- **重建移动端聊天时间线**:iOS 和 Android 上的聊天时间线已重建。展开或折叠轮次摘要、待办卡片或工具调用组时,你点按的那一行保持原位;在 Android 上,“显示更多”“收起”和计划卡片也是如此。 ([#8717](https://github.com/getpaseo/paseo/pull/8717), [#9085](https://github.com/getpaseo/paseo/pull/9085))
- **移动端键盘快捷键**:连接键盘后,iPad 和 Android 现在可使用与桌面端相同的快捷键,包括你自定义的绑定。检测到键盘时会显示快捷键提示和“设置 → 快捷键”。在较窄的桌面端和浏览器窗口中快捷键同样可用。 ([#8625](https://github.com/getpaseo/paseo/pull/8625),贡献者:[@jeroenfrenken](https://github.com/jeroenfrenken)、[@lstroud](https://github.com/lstroud))
- **适合触控的平板控件**:在 iPad 和其他触屏设备上,宽屏布局现在使用适合触控尺寸的按钮、行和栏。Composer 工具栏在空间不足时会把控件收进模型菜单;在工作区上向右滑动,可将已折叠的侧边栏以浮层方式显示。 ([#8748](https://github.com/getpaseo/paseo/pull/8748), [#8885](https://github.com/getpaseo/paseo/pull/8885), [#8891](https://github.com/getpaseo/paseo/pull/8891), [#8909](https://github.com/getpaseo/paseo/pull/8909), [#9151](https://github.com/getpaseo/paseo/pull/9151), [#9238](https://github.com/getpaseo/paseo/pull/9238), [#8739](https://github.com/getpaseo/paseo/pull/8739),贡献者:[@zeyugao](https://github.com/zeyugao))
- **撤销工作区归档**:在应用中归档工作区时,现在会显示“Workspace 已归档”提示,持续六秒。点击“撤销”或按 Cmd/Ctrl+Z 可恢复该工作区及其标签页和 Agent。在桌面端,侧边栏的工作区行在悬停时还会显示归档按钮。 ([#8904](https://github.com/getpaseo/paseo/pull/8904), [#9104](https://github.com/getpaseo/paseo/pull/9104))
- **返回时更少重连**:返回应用时会保留仍可用的连接,包括正在传输大型响应的连接,只在必要时重连一次。主机保存了多个连接时,Paseo 会留在可用的那个连接上。 ([#8651](https://github.com/getpaseo/paseo/pull/8651), [#9086](https://github.com/getpaseo/paseo/pull/9086), [#8855](https://github.com/getpaseo/paseo/pull/8855), [#9116](https://github.com/getpaseo/paseo/pull/9116))
### 新增
- 在“更改”中为 worktree 工作区新增基准分支选择器(Change base),diff、提交列表和 Git 操作可改用其他分支 ([#8642](https://github.com/getpaseo/paseo/pull/8642), [#8934](https://github.com/getpaseo/paseo/pull/8934),贡献者:[@Myasuka](https://github.com/Myasuka))
- 新增 Issue 和 PR 引用链接:Agent 回复、计划、PR 面板和文件预览中的 `#123`、`owner/repo#123` 等引用会链接到 GitHub、GitLab、Gitea、Forgejo 或 Codeberg ([#8636](https://github.com/getpaseo/paseo/pull/8636))
- 新增 iPhone Duo 布局支持:工作区操作位于系统竖向栏中,侧边栏和工作区分列折痕两侧 ([#8741](https://github.com/getpaseo/paseo/pull/8741), [#8901](https://github.com/getpaseo/paseo/pull/8901),贡献者:[@zeyugao](https://github.com/zeyugao))
- 新增 fx Provider,可在“设置 → Hosts → 提供方”的 Provider 目录中添加 ([#9160](https://github.com/getpaseo/paseo/pull/9160))
- 新增后台 Agent:Agent 或插件可通过 `background: true` 创建辅助 Agent,它不打开标签页、不发送通知,也不出现在侧边栏和默认 Agent 列表中 ([#8683](https://github.com/getpaseo/paseo/pull/8683))
- 新增 Terraform 和 HCL 文件(`.tf`、`.tfvars`、`.hcl`)的语法高亮 ([#9106](https://github.com/getpaseo/paseo/pull/9106))
- 在每个 Agent 的环境中新增 `PASEO_WORKSPACE_ID`,Agent 可据此识别、重命名或归档自己的工作区 ([#8939](https://github.com/getpaseo/paseo/pull/8939),贡献者:[@DTTerastar](https://github.com/DTTerastar))
### 变更
- 打开工作区时恢复你离开时的标签页,不再跳转到需要关注的 Agent ([#8935](https://github.com/getpaseo/paseo/pull/8935))
- 问题卡片中选择选项后不再自动前进;请用“下一步”或“提交”继续 ([#8525](https://github.com/getpaseo/paseo/pull/8525))
- 斜杠命令菜单现在显示加载和错误状态并提供“重试”,且不再默认选中 `/exit` ([#8905](https://github.com/getpaseo/paseo/pull/8905))
- 文件浏览器(Explorer)或分屏使工作区变窄时,工作区页眉和标签页改用紧凑控件 ([#8740](https://github.com/getpaseo/paseo/pull/8740), [#9088](https://github.com/getpaseo/paseo/pull/9088),贡献者:[@zeyugao](https://github.com/zeyugao))
- 向进程已退出的 Pi Agent 发送消息时立即失败,并提示重新加载该 Agent ([#8718](https://github.com/getpaseo/paseo/pull/8718))
- 在桌面端和宽屏网页布局中,侧边栏的“重命名 workspace”改为在原处编辑标题,不再打开对话框 ([#9280](https://github.com/getpaseo/paseo/pull/9280))
- “更新内容”和网站更新日志改为先显示每个版本的亮点,完整列表收在“显示全部变更”之后 ([#9281](https://github.com/getpaseo/paseo/pull/9281))
### 修复
- 修复 Agent 在你离开期间完成后,返回聊天时工作指示器消失的问题 ([#9170](https://github.com/getpaseo/paseo/pull/9170))
- 修复包含较短折叠轮次的聊天打开时留有空白、需滚动后才填满的问题 ([#8358](https://github.com/getpaseo/paseo/pull/8358), [#9083](https://github.com/getpaseo/paseo/pull/9083))
- 修复空闲的 Claude、Codex 或 OpenCode Agent 恢复后,“折叠轮次”把较早的回复藏进后一轮摘要行的问题 ([#9098](https://github.com/getpaseo/paseo/pull/9098))
- 修复提示词与其下方的回复或折叠轮次摘要行之间缺少间距的问题 ([#9009](https://github.com/getpaseo/paseo/pull/9009))
- 修复聊天打开时,较长的用户消息有一帧不显示渐隐效果和“展开”的问题 ([#9302](https://github.com/getpaseo/paseo/pull/9302))
- 修复紧跟在段落之后、中间没有空行的 Markdown 表格显示为原始竖线的问题 ([#8485](https://github.com/getpaseo/paseo/pull/8485),贡献者:[@ragokan](https://github.com/ragokan)、[@suk-6](https://github.com/suk-6)、[@thsrite](https://github.com/thsrite))
- 修复网页版和桌面端中与文字同行的带链接徽章图片被渲染成整行宽度的问题 ([#8530](https://github.com/getpaseo/paseo/pull/8530))
- 修复“查看源码”后点击“查看图表”会打开全屏、而不是回到内联 Mermaid 图表的问题 ([#8932](https://github.com/getpaseo/paseo/pull/8932),贡献者:[@luoph](https://github.com/luoph))
- 修复 Android 上聊天中鼠标滚轮滚动方向相反的问题 ([#8693](https://github.com/getpaseo/paseo/pull/8693),贡献者:[@sjeon87](https://github.com/sjeon87))
- 修复关闭 Agent 标签页时未发送的 Composer 文本和附件被删除的问题 ([#9079](https://github.com/getpaseo/paseo/pull/9079))
- 修复向 Composer 粘贴带超链接的文本时丢失链接地址的问题;链接现在以 Markdown 形式粘贴 ([#8972](https://github.com/getpaseo/paseo/pull/8972))
- 修复用鼠标点击“发送”后 Composer 失去焦点的问题 ([#9015](https://github.com/getpaseo/paseo/pull/9015))
- 修复 iPhone 上 Composer 停在距底部边缘 50pt 处的问题 ([#8823](https://github.com/getpaseo/paseo/pull/8823),贡献者:[@zeyugao](https://github.com/zeyugao))
- 修复从侧边栏和“新建工作区”点击“添加主机”会跳转到“设置”的问题 ([#8512](https://github.com/getpaseo/paseo/pull/8512))
- 修复打开失败的 Agent 或选择 Mark as read 后,其红点和“失败”分组仍留在侧边栏的问题 ([#8831](https://github.com/getpaseo/paseo/pull/8831))
- 修复在 Agent 运行时已关闭的情况下清除未读后,工作区的未读指示仍然亮着的问题 ([#9087](https://github.com/getpaseo/paseo/pull/9087))
- 修复取消归档工作区时未恢复随之归档的 Agent 的问题 ([#9210](https://github.com/getpaseo/paseo/pull/9210))
- 修复流式回复期间聊天一滚动上下文窗口浮层就自行关闭的问题 ([#8742](https://github.com/getpaseo/paseo/pull/8742),贡献者:[@3ae3ae](https://github.com/3ae3ae))
- 修复侧边栏用量摘要只在打开“使用情况”时才更新的问题 ([#7806](https://github.com/getpaseo/paseo/pull/7806),贡献者:[@ragokan](https://github.com/ragokan))
- 修复 Android 上位于触发元素上方的提示和菜单在打开后内容变多时短暂盖住触发元素的问题 ([#9247](https://github.com/getpaseo/paseo/pull/9247))
- 修复在“历史”页面刷新网页版后显示“无法加载历史”的问题 ([#9029](https://github.com/getpaseo/paseo/pull/9029))
- 修复 HTML 文件预览中的章节链接把预览替换成 Paseo 应用、而不是在文件内滚动的问题 ([#8559](https://github.com/getpaseo/paseo/pull/8559),贡献者:[@3ae3ae](https://github.com/3ae3ae))
- 修复“文件”刷新期间文件夹处于折叠状态时,新建的文件一直不显示的问题 ([#8582](https://github.com/getpaseo/paseo/pull/8582),贡献者:[@hadan8977](https://github.com/hadan8977))
- 修复分支仍在加载或请求失败时,分支切换器显示“没有找到分支。”的问题 ([#8938](https://github.com/getpaseo/paseo/pull/8938))
- 修复文件被移到上一级目录时,提交历史显示双斜杠、没有重命名状态也没有 diff 的问题 ([#8509](https://github.com/getpaseo/paseo/pull/8509),贡献者:[@hadan8977](https://github.com/hadan8977))
- 修复检出落后于 PR 头部时,已合并的 PR 从其工作区中消失的问题
- 修复工作区 Git 监视器在设置超时后一直停留在回退轮询的问题
- 修复网页版或桌面端重连后,被放弃的连接最多保持打开 45 秒的问题 ([#9067](https://github.com/getpaseo/paseo/pull/9067))
- 修复通过另一台主机路由的连接在获取超大时间线时以“The receiving client cannot keep up with host output”关闭的问题 ([#9109](https://github.com/getpaseo/paseo/pull/9109))
- 修复已连接的主机在更新到受支持的版本后仍停留在错误状态的问题 ([#8423](https://github.com/getpaseo/paseo/pull/8423),贡献者:[@DAnaeto](https://github.com/DAnaeto))
- 修复连接不可达主机的尝试超时后,握手重试和每秒一次的 `relay_e2ee_channel_error` 警告仍在继续的问题 ([#9025](https://github.com/getpaseo/paseo/pull/9025), [#9038](https://github.com/getpaseo/paseo/pull/9038))
- 修复应用诊断对曾经连接后又断开的主机报告 `Last online: never` 的问题 ([#9054](https://github.com/getpaseo/paseo/pull/9054), [#9058](https://github.com/getpaseo/paseo/pull/9058))
- 修复 Codex 轮次被停止或中断后,该轮次启动的 shell 命令仍继续运行的问题 ([#7525](https://github.com/getpaseo/paseo/pull/7525),贡献者:[@thomasvan](https://github.com/thomasvan))
- 修复因 API 错误(例如会话限额或 API key 无效)而停止的 Claude 轮次被报告为已完成而非失败的问题 ([#8480](https://github.com/getpaseo/paseo/pull/8480),贡献者:[@RRD-dev](https://github.com/RRD-dev)、[@luoph](https://github.com/luoph))
- 修复重新打开空闲聊天但未发送提示词时,Claude 进程一直留在内存中直到 daemon 重启的问题 ([#9019](https://github.com/getpaseo/paseo/pull/9019),贡献者:[@Brandon168](https://github.com/Brandon168))
- 修复开启 Agent 恢复后,daemon 正常停止或重启时 Claude Agent 不恢复的问题 ([#8686](https://github.com/getpaseo/paseo/pull/8686),贡献者:[@babo-jeonguk](https://github.com/babo-jeonguk))
- 修复来自 Claude `settings.json` 的 Claude 模型在 Composer 中缺少推理强度控件的问题 ([#8699](https://github.com/getpaseo/paseo/pull/8699),贡献者:[@ragokan](https://github.com/ragokan)、[@yahao123](https://github.com/yahao123))
- 修复对话记录非常大时导入 Claude 会话因 `Invalid string length` 失败的问题 ([#8457](https://github.com/getpaseo/paseo/pull/8457),贡献者:[@qwist1233-cpu](https://github.com/qwist1233-cpu))
- 修复在最大轮次限制处结束的 Claude 轮次丢失最终 token 数和费用的问题 ([#8519](https://github.com/getpaseo/paseo/pull/8519))
- 修复 Codex 的“Apply file changes”审批在你接受之前不显示文件名和 diff 的问题 ([#8585](https://github.com/getpaseo/paseo/pull/8585),贡献者:[@ragokan](https://github.com/ragokan))
- 修复 Codex 在一个补丁中编辑多个文件时,时间线只显示第一个文件的 diff 的问题 ([#8613](https://github.com/getpaseo/paseo/pull/8613),贡献者:[@ragokan](https://github.com/ragokan))
- 修复多个 Codex 操作同时启动时,Codex 会话发现和启动偶发 SQLite 初始化错误的问题 ([#9008](https://github.com/getpaseo/paseo/pull/9008),贡献者:[@colonelpanic8](https://github.com/colonelpanic8)、[@michaelmwu](https://github.com/michaelmwu))
- 修复 Codex 的重连尝试和警告未显示在时间线中的问题 ([#9370](https://github.com/getpaseo/paseo/pull/9370),贡献者:[@whatamelon](https://github.com/whatamelon))
- 修复 daemon 重启时正处于轮次中的 OpenCode 对话显示为空闲并忽略“停止”的问题 ([#8698](https://github.com/getpaseo/paseo/pull/8698))
- 修复审批待处理期间你发送消息时,OpenCode 被告知你拒绝了工具调用的问题 ([#8477](https://github.com/getpaseo/paseo/pull/8477))
- 修复重新打开的 Pi 对话缺少上下文压缩之前的消息的问题 ([#8523](https://github.com/getpaseo/paseo/pull/8523))
- 修复工作文件夹被移除后,已归档的 Pi 聊天因 `spawn pi ENOENT` 无法打开的问题 ([#8442](https://github.com/getpaseo/paseo/pull/8442),贡献者:[@DAnaeto](https://github.com/DAnaeto))
- 修复关闭空闲运行时清理的情况下,读取已归档的 Pi 聊天会遗留一个 Pi 进程的问题 ([#8554](https://github.com/getpaseo/paseo/pull/8554),贡献者:[@rylwin](https://github.com/rylwin))
- 修复恢复的 pi-subagents 运行未出现在 Subagent 栏中的问题 ([#9261](https://github.com/getpaseo/paseo/pull/9261),贡献者:[@xxachangxx](https://github.com/xxachangxx))
- 修复向进程已退出的 ACP Agent 发送提示词后一直停留在运行中、而不是报错失败的问题 ([#8406](https://github.com/getpaseo/paseo/pull/8406),贡献者:[@DAnaeto](https://github.com/DAnaeto))
- 修复 ACP Agent 放弃审批请求并结束轮次后一直卡在“waiting for permission”的问题 ([#8548](https://github.com/getpaseo/paseo/pull/8548),贡献者:[@3ae3ae](https://github.com/3ae3ae))
- 修复 ACP Agent 发送配置更新后,更改其模式因 `invalid_params` 失败的问题 ([#8912](https://github.com/getpaseo/paseo/pull/8912),贡献者:[@a-sh](https://github.com/a-sh))
- 修复在运行中的 ACP Agent 上选择不可用的模型后,Paseo 仍显示并保存该模型的问题 ([#8957](https://github.com/getpaseo/paseo/pull/8957))
- 修复导入会话时把它从自身的模型切换为 Provider 默认模型的问题 ([#8948](https://github.com/getpaseo/paseo/pull/8948))
- 修复来自其他 Agent 的消息在你作答之前取消接收方待处理的提问或审批的问题 ([#8453](https://github.com/getpaseo/paseo/pull/8453),贡献者:[@DAnaeto](https://github.com/DAnaeto))
- 修复向已连接主机上已关闭或已归档的 Agent 发送提示词后,发送方 Agent 一直收不到完成通知的问题 ([#8575](https://github.com/getpaseo/paseo/pull/8575))
- 修复 daemon 重启后,在打开父聊天之前创建子 Agent 因“Caller agent not found”失败的问题 ([#8714](https://github.com/getpaseo/paseo/pull/8714))
- 修复 Agent 从 Provider 错误中恢复并完成下一轮次后仍显示为失败的问题 ([#8083](https://github.com/getpaseo/paseo/pull/8083),贡献者:[@luoph](https://github.com/luoph))
- 修复已分离的子 Agent 在刷新之前仍显示在其已归档的父 Agent 之下的问题 ([#8903](https://github.com/getpaseo/paseo/pull/8903),贡献者:[@luoph](https://github.com/luoph))
- 修复打开 Agent 时因“Working directory does not exist”失败、而不是显示其已保存对话的问题 ([#8737](https://github.com/getpaseo/paseo/pull/8737))
- 修复 daemon 在每次工作区更新时重新读取全部已归档 Agent 和工作区历史的问题 ([#8735](https://github.com/getpaseo/paseo/pull/8735))
- 修复工作区文件夹在其文件监视器处于回退轮询期间被删除后,daemon 仍反复在其中运行 Git 命令的问题 ([#8462](https://github.com/getpaseo/paseo/pull/8462),贡献者:[@DAnaeto](https://github.com/DAnaeto))
- 修复浏览器标签页关闭或刷新后,工作区服务连接仍保持打开的问题 ([#8421](https://github.com/getpaseo/paseo/pull/8421),贡献者:[@DAnaeto](https://github.com/DAnaeto))
- 修复 daemon 网页界面对不存在的 `/.well-known/*` 请求返回应用页面而非 404 的问题 ([#8622](https://github.com/getpaseo/paseo/pull/8622),贡献者:[@HomicideZero](https://github.com/HomicideZero))
- 修复定时任务接受单个数字后的 cron 步长(例如 `0/15 * * * *`)并按每小时运行的问题;现在会拒绝这类表达式 ([#8607](https://github.com/getpaseo/paseo/pull/8607),贡献者:[@Mar-garet](https://github.com/Mar-garet))
- 修复同时设置了日期和星期的 cron 定时任务只在两者都匹配时运行、而不是任一匹配即运行的问题 ([#8611](https://github.com/getpaseo/paseo/pull/8611),贡献者:[@Mar-garet](https://github.com/Mar-garet))
- 修复 `paseo logs --json` 输出纯文本对话记录而非 JSON 的问题 ([#8589](https://github.com/getpaseo/paseo/pull/8589),贡献者:[@hadan8977](https://github.com/hadan8977))
- 修复 `create_agent` 工具没有告知 Agent 在其他 Provider 上创建 Agent 需要指定模式的问题 ([#8483](https://github.com/getpaseo/paseo/pull/8483),贡献者:[@guerinnoah](https://github.com/guerinnoah))
- 修复在 Windows PowerShell 无法运行 `Get-CimInstance` 的 Windows 机器上终端无法打开的问题 ([#8818](https://github.com/getpaseo/paseo/pull/8818))
- 修复程序查询终端版本时,终端把版本应答输入到 shell 中的问题 ([#8419](https://github.com/getpaseo/paseo/pull/8419),贡献者:[@DAnaeto](https://github.com/DAnaeto))
- 修复在网页版终端中用手指拖动时,历史滚动距离约为拖动距离两倍的问题 ([#8776](https://github.com/getpaseo/paseo/pull/8776),贡献者:[@sinomoe](https://github.com/sinomoe))
- 修复切换离开终端再返回后,Copilot CLI 等终端程序中的鼠标滚动失效的问题 ([#9004](https://github.com/getpaseo/paseo/pull/9004),贡献者:[@imink](https://github.com/imink))
- 修复向远程终端拖入多个文件时,粘贴的路径之间没有空格的问题 ([#8946](https://github.com/getpaseo/paseo/pull/8946),贡献者:[@sebastianarena](https://github.com/sebastianarena))
- 修复 `browser_fill` 工具在未更新 React 受控输入框和文本域的情况下报告成功的问题 ([#9022](https://github.com/getpaseo/paseo/pull/9022))
- 修复 `browser_evaluate` 在内容安全策略未包含 `unsafe-eval` 的页面上失败的问题 ([#8973](https://github.com/getpaseo/paseo/pull/8973),贡献者:[@amustapha](https://github.com/amustapha))
- 修复 `browser_logs` 缺少每个网络请求的 HTTP 状态的问题 ([#8956](https://github.com/getpaseo/paseo/pull/8956),贡献者:[@amustapha](https://github.com/amustapha))
### 插件
- 新增插件订阅,可将 daemon 的实时事件流式推送到插件面板;插件 RPC 和事件支持二进制(`Uint8Array`)负载 ([#8527](https://github.com/getpaseo/paseo/pull/8527))
- 插件的 Agent 快照新增后台任务数量(`backgroundWork.count`)和 `background` 标记,Agent 钩子新增 `background` 标记 ([#9362](https://github.com/getpaseo/paseo/pull/9362))
- “设置 → 插件”改为通过齿轮按钮打开插件设置,每个设置页面对应一个标签页 ([#8675](https://github.com/getpaseo/paseo/pull/8675))
- 为会打开菜单或浮层的插件 Composer 胶囊按钮新增向上的箭头 ([#8673](https://github.com/getpaseo/paseo/pull/8673))
- daemon 启动时改为并发启动已配置的插件,不再逐个启动 ([#8427](https://github.com/getpaseo/paseo/pull/8427),贡献者:[@DAnaeto](https://github.com/DAnaeto))
- 修复主机的 npm 使用镜像源时,从插件库安装插件因“npm artifact changed since review”失败的问题 ([#8756](https://github.com/getpaseo/paseo/pull/8756),贡献者:[@tlipoca9](https://github.com/tlipoca9))
- 修复 daemon 因无效消息终止插件后,该插件仍留在列表中且未报告退出的问题 ([#9285](https://github.com/getpaseo/paseo/pull/9285),贡献者:[@Brandon168](https://github.com/Brandon168))
- 修复 ACP Provider 插件丢弃 Agent 在提示词响应中报告的 token 用量的问题 ([#9396](https://github.com/getpaseo/paseo/pull/9396),贡献者:[@Myasuka](https://github.com/Myasuka))
- 修复已发布的 `@getpaseo/*` npm 包未声明许可证的问题;现在声明为 Apache-2.0 ([#7816](https://github.com/getpaseo/paseo/pull/7816),贡献者:[@mdlawson](https://github.com/mdlawson)、[@ragokan](https://github.com/ragokan))
- 修复插件更新了自己的某张时间线卡片后,从较早的回复分叉因“This checkpoint changed after it was created”失败的问题 ([#8746](https://github.com/getpaseo/paseo/pull/8746),贡献者:[@monarchmaisuriya](https://github.com/monarchmaisuriya))
- 修复由插件渲染最终回复时,“折叠轮次”让轮次保持展开或折叠到较早回复的问题 ([#8811](https://github.com/getpaseo/paseo/pull/8811),贡献者:[@geoqiao](https://github.com/geoqiao))
- 修复应用刷新后插件目录仍在加载时,插件页面显示“This plugin surface is unavailable”的问题 ([#8123](https://github.com/getpaseo/paseo/pull/8123),贡献者:[@vs-tahir](https://github.com/vs-tahir))
- 修复插件添加了许多导航项时,矮屏上的工作区列表被挤出移动端侧边栏的问题 ([#8727](https://github.com/getpaseo/paseo/pull/8727),贡献者:[@jaredwang](https://github.com/jaredwang))
- 修复时间线插件在 Agent 消息工具调用上收不到发送方、事件和原始文本的问题 ([#8492](https://github.com/getpaseo/paseo/pull/8492),贡献者:[@RRD-dev](https://github.com/RRD-dev)、[@luoph](https://github.com/luoph))
- 修复输入或输出 schema 使用 transform 时插件 RPC 失败的问题 ([#8550](https://github.com/getpaseo/paseo/pull/8550))
### 说明
- 后台任务、基准分支选择器、归档撤销、后台 Agent、插件订阅和 fx 需要主机和应用都更新到此版本
## 0.15.4 - 2026-11-10
### 新增
- 新增 Claude Fable 5.2 和 Mythos 5.2,默认推理强度为 medium ([#9233](https://github.com/getpaseo/paseo/pull/9233),贡献者:[@gengjiawen](https://github.com/gengjiawen)、[@gudcks](https://github.com/gudcks))
### 说明
- 两个模型均需 Claude Code 2.1.321 或更高版本;仅在 Claude Code 提供访问权限时显示 Mythos 5.2
## 0.15.3 - 2026-11-06
### 修复
+7 -4
View File
@@ -257,7 +257,7 @@ Workspace archive is a separate lifecycle. Archiving or removing a worktree can
agent record without setting the agent's `archivedAt`, while its `workspaceId` still points at the
archived workspace. History navigation must not infer workspace lifecycle from `agent.archivedAt`
or mutate either lifecycle. The workspace route asks the daemon for authoritative recovery state;
only the route's explicit Unarchive or Restore action changes the archived workspace.
the route exposes explicit Unarchive and Restore actions.
Workspace archive is undoable from the archived toast, or with Cmd/Ctrl+Z, while the toast is up.
The daemon runs one archive lane per workspace, shared by every connection
@@ -281,9 +281,12 @@ does not flip it back. Tabs and layout are purged only once the undo window clos
archive committed.
History navigation opens the selected agent without changing either archive state. Workspace
**Restore** recovers only the workspace; the selected archived agent stays open with its callout.
The agent's **Unarchive** runs the provider's native unarchive hook before interactive resume and
history hydration. Other archived agents stay archived.
**Unarchive**, **Restore**, Undo, and reopening the directory recover the agents closed by that
workspace archive, including
after a daemon restart or after the toast expires. Agents archived individually beforehand stay
archived. A failed worktree recreation leaves the workspace and its agents archived for retry.
Each recovered agent runs the provider's native unarchive hook before interactive resume and
history hydration.
Opening an agent is a navigation choice, independent of whether its details are cached. The
layout retains that choice across reload while the panel fetches the agent from the daemon.
+13
View File
@@ -39,6 +39,19 @@ The trigger can only stay put when the list has scroll room for the change. When
content fits the viewport, or a collapse at the end would need an offset past the end, the list
ends at its end and the trigger moves by the difference.
## State that survives a remount
The list mounts a row again whenever it opens the chat, brings a web row back into the history
window, or reassigns a native row's LegendList container. State held in the row resets each time.
Keep a disclosure's open state in the per-agent store the timeline provides, keyed by item id:
`ToolCallExpansionContext` for tool calls, `UserMessageExpansionContext` for long user messages.
Decide a row's first painted shape in the commit that mounts it. `MessagePreview` measures its body
in a layout effect, which commits before paint on web and Fabric. `onLayout` lands after the first
frame: a long message measured there paints capped with no fade or show more, then grows by the
control's height a frame later. `onLayout` still tracks later size changes. A zero height comes from
a hidden panel and is ignored.
## Web
`holdRow` pins the row's trigger edge in the reading anchor and runs `apply`; the next reading
+9
View File
@@ -112,6 +112,15 @@ need an artifact. `android:clear` removes the generated Android project.
Run `npm run test:android --workspace=@getpaseo/app` explicitly with a local Android toolchain to prebuild Android and run native module unit tests. Ordinary CI does not prebuild Android or run these tests.
With an emulator or device connected, run the hardware keyboard's window-dispatch regression tests
from `packages/app/android`:
```bash
./gradlew :paseo-hardware-keyboard:connectedDebugAndroidTest --no-daemon --max-workers=2 -Dorg.gradle.parallel=false
```
These check terminal arrow ownership, held-key repeats and modifiers, and ordinary text-field editing.
### Diagnostic logs without ADB
In a dogfood build, open Android's Files app → Downloads → **Paseo diagnostics** and share all
+8
View File
@@ -340,6 +340,14 @@ the number of Git processes that have started but not exited. Every Git command
including initial workspace reads, filesystem-triggered refreshes, background checks, and explicit
requests.
Commands wait in one of three lanes, drained in order: `high` (worktree creation and archive),
`normal` (everything a caller waits for, including diffs and explicit refreshes), and `background`
(workspace reconciliation, refreshes triggered by watchers, polls and fetches, and the fetches
themselves). Daemon-initiated fan-out must run in the background lane: one rescan over ~90 worktrees
queues over 1,000 commands, and in the normal lane every command a cold diff runs waited behind
them. Set the lane on the runner with `createRunGitCommand(provenance, { priority })`, or around a
whole operation with `runWithGitCommandPriority`.
Environment variables override `config.json`:
| Environment variable | Setting |
+3 -3
View File
@@ -70,9 +70,9 @@ the sidebar. Apply it as `backgroundColor`; setting `opacity` on the control als
Controls come in two sizes, defined once in `control-geometry.ts`. The default is the right size almost everywhere — pages, dialogs, forms, settings rows, the setup flow — so don't pass a size. It is 32px tall where a pointer drives it and 44px where controls are touch-sized, so every touch control meets the iOS HIG's 44pt hit region. `sm` is 28px pointer and 32px touch, with `fontSize.sm` labels, and is for tight chrome only: toolbars, nested settings rows, dense inline row actions. A `size="sm"` on an ordinary page or dialog is wrong, and so is choosing a size from `useIsCompactFormFactor()`.
Dense toolbar rows, such as the composer's, are the exception to the 44pt control. Touch-sized the row is 44pt tall and each control is a 36pt circle (`TOOLBAR_DISC_SIZE`): send and stop fill it, and every other control's pressed highlight fills it, so every highlight is the same fully rounded shape. Labelled pickers are 36pt pills. A control lays out at the width of what it paints (`toolbarSlot`, `toolbarContentSlot`) and its circle reaches into the gaps, so `TOOLBAR_CONTROL_GAP`, 20pt, is the visible space between glyphs. Toolbar glyphs match the header icons: 20pt, the app's 1.5px stroke, resting at `foreground` (`toolbarGlyphsFor`). The context ring is 18pt with a 2px stroke (`TOOLBAR_RINGS`): a circle fills its box where an outline glyph does not, and a thin circle reads lighter than a glyph at the same stroke. A disc's solid glyph, such as the stop square, stays at the `md` size (`TOOLBAR_DISC_GLYPH_SIZES`). Pointer-sized toolbars keep 28px controls, a 4px gap, and a 16pt muted glyph that brightens on hover.
Dense toolbar rows, such as the composer's, are the exception to the 44pt control. Touch-sized the row is 44pt tall and each control is a 36pt circle (`TOOLBAR_DISC_SIZE`): send and stop fill it, and every other control's pressed highlight fills it, so every highlight is the same fully rounded shape. Labelled pickers are 36pt pills. A control lays out at its full highlight (`toolbarSlot`, `toolbarContentSlot`) with no gap between controls (`TOOLBAR_CONTROL_GAP`), so neighbouring highlights touch and never overlap. Toolbar glyphs match the header icons: 20pt, the app's 1.5px stroke, resting at `foreground` (`toolbarGlyphsFor`). The context ring is 18pt with a 2px stroke (`TOOLBAR_RINGS`): a circle fills its box where an outline glyph does not, and a thin circle reads lighter than a glyph at the same stroke. A disc's solid glyph, such as the stop square, stays at the `md` size (`TOOLBAR_DISC_GLYPH_SIZES`). Pointer-sized toolbars keep 28px controls, a 4px gap, and a 16pt muted glyph that brightens on hover.
In the composer, the first glyph's ink starts on the text column's edge, and the trailing control is always a disc, so the row does not shift as it changes between voice mode, send and stop. The disc nests into the corner, as far from the right edge as from the bottom, and touch-sized the composer's corner radius is concentric with it (`packages/app/src/composer/input/toolbar-rails.ts`).
In the composer, the first glyph's ink starts on the text column's edge, and the trailing control is always a disc, so the row does not shift as it changes between voice mode, send and stop. The disc nests into the corner, as far from the right edge as from the bottom, and touch-sized the composer's corner radius is concentric with it (`packages/app/src/composer/input/toolbar-rails.ts`). Touch-sized the disc keeps a 6pt clearance from its neighbour, because it is always painted and a pressed neighbour would merge with it. The attach button sits 2pt closer to the picker than its highlight would put it: the plus is all thin arms, so the full gap reads wide. That offset is set by eye.
One gate, `resolveControlSizing`, picks touch or pointer sizing: touch when the layout is compact or the device has a touch screen. An iPad with the sidebar docked is wide and touch-sized; a desktop is pointer-sized; a phone is both compact and touch. The touch-screen fact is read once at startup (`hasTouchScreen` in `hooks/use-fine-pointer.ts`), so attaching a mouse or keyboard to a tablet never shrinks its controls. Stylesheets take sizes from `bySizing({ touch, pointer })`, which resolves to a breakpoint value, so a caller never sees which sizing it got. Rows, icon buttons and icon slots take theirs from `styles/density.ts`, which uses the same gate. An `{ xs, md }` literal for a hit target or glyph is wrong: on an iPad it yields the pointer size.
@@ -144,7 +144,7 @@ Things align to their glyphs, not to their boxes. A row's leading icon, its titl
Pick the rails from the content, then hold them. A settings card establishes a leading rail at the icon's left edge and a trailing rail at the last glyph's right edge; every row in that card uses the same two. A row whose icon is absent still starts its title on the leading rail. Indentation is a new rail, not an arbitrary offset.
The pressable is bigger than the glyph, and that is fine. Hit areas grow outward from the aligned content — they never move it. A button that looks two pixels off because its padding is asymmetric is misaligned even though its box is correct. The composer toolbar is the worked example: its outermost ink, the attach `+` on the left and the trailing glyph or send/stop disc on the right, sits on the text column's edges, and the 44pt touch slots overhang into the composer padding by each end control's ink inset (`composerToolbarOverhang`).
The pressable is bigger than the glyph, and that is fine. Hit areas grow outward from the aligned content — they never move it. A button that looks two pixels off because its padding is asymmetric is misaligned even though its box is correct. The composer toolbar is the worked example: its outermost ink, the attach `+` on the left and the trailing glyph or send/stop disc on the right, sits on the text column's edges, and touch-sized the end highlights overhang into the composer padding by each end control's ink inset (`composerToolbarOverhang`).
Optical alignment beats arithmetic when a glyph disagrees with its bounding box. Icons with visual weight on one side, chevrons, and single-character labels usually need a small nudge to look centered. Trust the eye, then leave a comment saying the offset is optical.
+1 -1
View File
@@ -8,7 +8,7 @@ Closing an observation must remain safe after its root is renamed or removed. Wo
`unsubscribe()` is an awaited barrier. Once it resolves, no scan, reconciliation, queued event, native handle, or callback may remain. `updateIgnore()` is the equivalent barrier for excluded paths: events queued below a newly excluded root cannot be delivered after it resolves. Treat path disappearance while scanning, attaching, or receiving a watcher error as rename/archive churn. Surface permission and resource errors so WorkspaceGit can enter bounded polling.
Linux topology repair is trailing-debounced and scoped to the renamed path. A file rename needs one classification stat; a new or moved directory scans only its subtree. Full-tree scans are reserved for startup and ignore-set replacement. The initial Linux scan conservatively emits existing files discovered before their directory watcher was installed; WorkspaceGit batches these into one refresh. Benchmark this startup cost with pre-populated trees.
Linux topology repair is trailing-debounced and scoped to the renamed path. A file rename needs one classification stat; a new or moved directory scans only its subtree. Full-tree scans are reserved for startup and ignore-set replacement. A subscription reports changes after `subscribe()` resolves, not the files that already existed. macOS FSEvents can still replay writes made moments before the stream started. Consumers read their initial state after `subscribe()` resolves; WorkspaceGit re-reads its checkout once observation setup completes, because its first refresh runs in parallel with setup. The Linux startup scan therefore emits nothing; only a scoped reconciliation of new topology reports files found before their directory's watcher was installed. Startup creates made every cold diff compute and discard a first revision. Benchmark startup cost with pre-populated trees.
Windows and macOS use one native recursive watcher plus an ignored-pruned, directory-indexed inventory. Native events deliver immediately. Named events trigger serialized shallow scans of their parent directories; known directory events also reconcile that subtree. This recovers concrete create and delete paths omitted by coalescing without walking the whole root for each edit. Classification is admission-controlled to 32 concurrent `fs.stat` calls, since `fs.stat` runs on the libuv threadpool the whole daemon shares. Startup and exclusion changes use an awaited full inventory barrier. Activity arms a full safety audit 30 seconds after it settles, with a 30-second minimum interval and a five-minute starvation bound; pathless native events also trigger an immediate shallow root scan. Observation fails into polling rather than retaining more than 250,000 file and directory entries per root. A repository that large is also expensive to poll, so degraded polling doubles its gap from 5 seconds to a 60-second ceiling while the workspace snapshot comes back unchanged, and resets to 5 seconds on the first change. Explicit reads still force a refresh; the ceiling only bounds how long an edit made outside Paseo stays undiscovered.
+7
View File
@@ -446,6 +446,13 @@ Before you write a new one, ask:
positioning (`bottom: windowHeight - anchor.y + gap`) and skip the
`contentSize` round-trip entirely. **But only if the height is genuinely
bounded**. Verify before you commit.
6. **Can the content change size after the panel paints, and does the panel
sit above its anchor?** Hold it by its bottom edge with `holdSurfaceEdge`
and `surfaceFrameStyles` from `components/ui/anchor.ts`. Native delivers
`onLayout` after the frame that shows the new size, so a panel placed by
`top` paints over its anchor until the next placement lands, about 150 ms
on Android. Web hides this because React commits the resize and the
re-placement in one task.
Then copy the closest canonical file and trim.
+15 -3
View File
@@ -20,9 +20,16 @@ settings the native composer does not implement.
## Native sources
Use the iOS window press stream for hardware keys. `UIKeyCommand` only takes keys
that must bypass the focused text control: composer Return and the top overlay's
Enter and arrows. Keep the stream as the sole shortcut emitter: a command-owned
Use the iOS window press stream for hardware keys. The stream reaches JavaScript
after the focused text control has already handled the press, so the pipeline's
`preventDefault` cannot stop a key from typing. A key the text control would type
must be claimed up front. `UIKeyCommand` takes only those keys: composer Return, the
top overlay's Enter and arrows, and the Shift or Option shortcuts whose binding is
active in the current focus scope, such as Shift+Tab in the composer.
`sources/native.ts` computes the claims from the published bindings and recomputes
them when the focus scope changes. Cmd and Ctrl combos are never claimed, because
text controls do not type them. Android takes no claims: a focused `EditText`
types nothing for these combos. Keep the stream as the sole shortcut emitter: a command-owned
press is still observed by the window.
The source spike used an iPad Pro 11-inch (M4) simulator on iOS 18.6 with a
@@ -85,6 +92,11 @@ Escape interrupts an agent only in the message input or an unclaimed surface.
A focused terminal excludes that binding. The source leaves terminal Escape alone;
terminal Escape/Ctrl forwarding is a separate feature.
Terminal arrows never pass through the shortcut pipeline. The Android hardware
module claims them while the terminal's hidden input (`nativeID`) owns the focus.
`TextInput.onKeyPress` only sees IME keys, and an arrow that falls through moves
the hidden caret and desyncs the next text change, so the pipeline cannot own them.
## Keys shared with text editing
A binding on a key the platform already uses for editing, such as Cmd/Ctrl+Z for
+23
View File
@@ -712,6 +712,29 @@ implementations provide it:
in `composer/session.tsx`: `Composer` provides `ComposerInput` (prompt, attachments),
`DraftAgentControls` provides `ComposerAgent` (settings), and the adapter enforces the lock.
`focus` differs per implementation on purpose. A running agent's model reveals the agent with
`navigateToAgent` when `ComposerInput.isRevealed()` is false, and holds one pending request until an
input that is revealed attaches. `isRevealed` is stricter than `isLive`: a compact overlay panel and
an unfocused pane leave the input live but unable to take the keyboard, so the agent is revealed
first, which also moves pane focus. `Composer` makes `revealed` part of `ComposerInput`, so a change
re-runs `attachInput`, which is what tells the pending request the input is on screen. The draft
half has nothing to navigate to and does not pull the user back to a draft they left, so it rejects
when not revealed. Sheets, menus, pickers and modals the composer opens over itself do not count
against `revealed`: `takeInputFocus` closes them through the `OverlayDismissalScope` in
`components/ui/overlay-dismissal.tsx`, and places the cursor only after the commit that removes
them. A web modal hands focus back to the button that opened it in that commit, so placing the
cursor earlier loses it. The overlay primitives register while open: every controlled bottom
sheet through `useIsolatedBottomSheetVisibility`, `AdaptiveModalSheet`'s desktop dialog, `MenuRoot`,
`Combobox`, and `Modal` through its `onRequestClose`. Their close must close; a surface built on none
of them must call `useDismissibleOverlay`. Overlapping requests share each overlay's close, and the
latest request places the cursor while the earlier ones settle with it. A native input reports
focus synchronously and refuses it while not editable, such as during dictation, so the native
branch checks `isFocused()` instead of trusting the call. The agent panel opens the scope around its whole chat
because the tracks above the composer render outside `Composer`, and the composer's own scope
joins it. `toPluginComposer` clears the Command Center's focus restore, which would
otherwise take the cursor back when the Command Center closes. Native `focus` opens the keyboard, so
the app's web-only `focusInput` stays separate and plugins go through `takeInputFocus`.
`ComposerAgent` stays for the built-in controls. Add a capability to the `ComposerModel`, both
implementations and `toPluginComposer`; never branch on `context` in the host.
+10 -1
View File
@@ -150,6 +150,15 @@ Pi import discovery reads Pi's persisted JSONL session files because Pi RPC does
OMP is a first-class built-in provider, disabled by default. Its launch contract, typed runtime, agent/session behavior, history, permissions, imports, and test fake live under `providers/omp/`; only the provider-neutral JSONL child-process transport is shared with Pi. It launches `omp --mode rpc-ui`, uses OMP's `get_available_commands` RPC for slash-command discovery, bridges OMP `rpc-ui` approval dialogs into Paseo permissions, and imports terminal-started sessions from `~/.omp/agent/sessions` when enabled.
OMP rewind is a branch, not an edit: `branch` writes a new session file whose header names the
previous file as `parentSession` and leaves that previous file untouched. A rewind chain therefore
adds one file to `~/.omp/agent/sessions` per step, and `omp --resume` lists all of them. The
previous file also keeps whatever head it had recorded, which can be an older branch than the one
the user last saw. Treat the provider session file selected by OMP as the authority; do not assume
the newest file or the newest message wins. Import listings hand back a file path, so persist the
resumed session's own identity (`sessionId`) with that path as `nativeHandle`, not the listed
handle as both.
OMP supports native Paseo host tools. The adapter registers the full caller-scoped Paseo tool catalog directly with OMP, matching providers such as Claude that expose the full catalog through MCP. Serialize every OMP host definition with `loadMode: "essential"` so `create_agent`, `send_agent_prompt`, `wait_for_agent`, and related tools remain direct calls; omitting the field makes OMP mount non-built-in names under `xd://` instead. OMP's provider-managed task subagents are surfaced as Paseo subagents through `child_session` imports; the parent keeps the subagents track while the child runtime stays owned by OMP. Custom OMP profiles should extend `omp`; other Pi-compatible forks can still extend `pi`, override `command`, and set `params.sessionDir` to their JSONL session directory.
Pi RPC extension UI dialog requests (`select`, `input`, `editor`, `confirm`) are bridged into Paseo question permissions and answered with `extension_ui_response`. Pi extensions such as `ask_user` may chain dialogs: for example, a `select` can be followed by an optional-comment `input`. When an `ask_user` tool call declares `allowComment: true`, Paseo presents the selection and optional comment as one question permission, answers Pi's initial `select` immediately, then auto-answers the follow-up optional `input` with the comment the user already supplied (or an empty string). Preserve placeholders and optional/skip semantics for standalone optional inputs so the app can still distinguish "skip this optional input" from "cancel the whole dialog." Fire-and-forget extension UI requests such as notifications are intentionally ignored by the provider adapter unless Paseo grows first-class UI for them.
@@ -160,7 +169,7 @@ Use OpenCode v2 execution events to trigger turn completion, with active-state a
V2.0.4 also removed the activation endpoint that gated a cold location, and a cold location registers its config-derived commands, skills, and providers asynchronously. Wait until `plugin.list` returns a populated inventory before reading the catalog or commands; an empty inventory means the location is still warming. Fail when the readiness deadline expires, including when an inventory request stalls.
Paseo installs its OpenCode tool bridge through `OPENCODE_CONFIG_CONTENT`. V1 accepts a plugin file; v2 silently skips configured files and requires a package directory with a server entry point. Both versions use the daemon's private loopback bridge for caller-scoped tools. The global manifest must use agent-scoped schemas before a session is bound, because every bridge call executes in an agent session. Bridge context lives only in daemon memory and is removed when the Paseo session closes. The content-addressed plugin artifacts contain no session data or secrets. V2 also needs this plugin when native Paseo tools are disabled: its prompt API has no structured-output format, so the plugin supplies a schema-validated final-answer tool.
Paseo installs its OpenCode tool bridge through `OPENCODE_CONFIG_CONTENT`. V1 accepts a plugin file; v2 silently skips configured files and requires a package directory with a server entry point. Both versions use the daemon's private loopback bridge for caller-scoped tools. The global manifest must use agent-scoped schemas before a session is bound, because every bridge call executes in an agent session. V2 discovers definitions from each bound session's catalog: plugin-contributed tools can be absent from the global manifest, and an allowlist cannot register a missing definition. Registration is location-wide, so session filtering and caller-scoped execution must remain in place. Bridge context lives only in daemon memory and is removed when the Paseo session closes. The content-addressed plugin artifacts contain no session data or secrets. V2 also needs this plugin when native Paseo tools are disabled: its prompt API has no structured-output format, so the plugin supplies a schema-validated final-answer tool.
An agent with custom environment variables or user-configured MCP servers gets a dedicated OpenCode server. V2 supports session environment, but its MCP configuration remains location-scoped, so separate servers still prevent one agent from changing another agent's MCP setup. Configure custom MCP with `mcp.add`; do not follow it with `mcp.connect`, which only toggles config-backed servers.
@@ -0,0 +1,67 @@
# Pi resumed subagents — #9200
## Scope and provenance
An AI agent ran this QA through Playwright/CDP attached to the **real macOS Electron renderer**, using an isolated desktop-managed daemon. The user authorized the run; this is not a claim that the user personally operated the UI. No production daemon, installed package, or daily host configuration was changed.
Desktop evidence was captured on the modified **0.15.3 development checkout** at base `e260f93cc7b6098f6b175bd0e5c7eb24d3f03cf4`, with Electron 44.2.0, Pi 1.5.0, and installed pi-subagents 0.86.0. The final branch was subsequently fast-forwarded to `d46ee6558c043f9fb377d20f05ff662ce27a31f6` (0.15.4). The adapter and test file stayed byte-for-byte identical. The lockfile changes only workspace version references; third-party dependency entries did not change. Server declarations were rebuilt and the checks below passed on the final base. **These screenshots are not a 0.15.4 release-package test.**
## Before and automated checks
Issue #9200 reports ordinary async spawn appearing in the track while successive successful resumes disappear. The original adapter rejects any `action` and requires top-level `agent`/`task`, which a resume does not supply. A separate file-only transcript deduplication also prevents a new attempt row from following Pi's reused session file.
[Captured command output](validation.txt) contains:
- RED on the original adapter: a successful resume returns no descriptor instead of a running row.
- RED on the intermediate implementation with old file-only deduplication: the next resumed row gets no transcript.
- Final **21/21** tests passing, including consecutive resumes with a real shared temporary JSONL, polling, notice/replay routing, late old-notice isolation, `bg_wait`, failed/management calls, missing launch identity, and the task alias. Existing spawn fixtures still pass.
- Full `npm run format`, `npm run typecheck`, `npm run lint`, and `git diff --check` passing after the base update.
Only the specific adapter test file was run, not the full suite. CI has not been run. There is no old-desktop before screenshot; the reported failure and the two actual RED runs are the before evidence.
## Real desktop steps and observations
1. Built server/app dependencies and launched the existing desktop dev runner with a separate home, Electron userData, Pi configuration/session directory, and async root. The final endpoints were loopback-only: daemon 6768, Metro 8082, and CDP 9223. The renderer's desktop bridge confirmed its own managed daemon/home/server identity. Only the existing pi-subagents extension and a marker-only test agent were enabled; child tasks used `sleep`/`printf`, not workspace edits.
2. Created a Pi parent through the normal Paseo **CLI/API**, asking it to call `subagent({agent:"qa-marker", task, async:true})`. This produced A. The model first enabled the subagent tool, then performed the ordinary spawn. This step was not submitted through the composer.
3. Used the real Electron **composer** to ask Pi for `subagent({action:"resume", id:A, message})`, then resumed B the same way to produce C. No top-level `agent`, `task`, or `async` was supplied to these resume calls. All three finished with their requested markers.
4. Opened the provider-owned track while C ran: it showed `1 working`, the follow-up description, and `qa-marker`. Opening that row showed the reused child conversation and the current Shell call. Each resume had a new run/async directory, while all attempts reused the same session JSONL.
5. While C was still running, clicked **Archive finished subagents**. Completed A/B rows disappeared, while C remained visible as `1 working`.
6. Submitted a nonexistent resume ID through the composer. Pi returned an error and the parent reported “not found”; no new row or async run appeared.
7. The first B screenshot was taken after B finished because screenshot capture waited for fonts. It is not offered as running-state proof. A supplementary real resume from A, B_OBSERVE, was captured as `1 working` and opened successfully. It also finished. The final track contained exactly the four successful runs, not a fifth phantom from the failed resume.
The [selected real tool arguments/results, final statuses, and four completion notices](desktop-observations.json) preserve the test UUIDs. B's `revivedFrom` is A; C's is B. This file contains selected fields from persisted Pi entries/status files, not synthesized launch details. The [dialogue DOM excerpt](dialogue-excerpt.txt) records opening a resumed child. Test-root paths are replaced with `<QA_ROOT>` and the encoded workspace directory with `<QA_WORKSPACE>`; no auth or models configuration is included.
### Screenshots
Unmodified captures, except for the explicitly described dialogue crop. They contain only isolated test prompts, test UUIDs, and app UI; no account, credentials, or user-home paths.
**C running in the native provider-owned track:**
![C running](c-running.png)
**After archiving finished rows, C remains running:**
![Archive keeps running C](archive-keeps-running.png)
**Opened C conversation, current Shell call and parent link:** this is an unaltered crop of the bottom 880×245 pixels of the real child-pane capture, omitting the long temporary session path above it. No state was redrawn.
![C child conversation crop](c-dialogue-crop.png)
**Final four completed rows, with the failed resume reported above:**
![Completed rows and failed resume](completed-and-failed-resume.png)
## Coverage and limits
| Surface | Tested |
| ---------------------------------- | ------------------------------------------------------------------------- |
| macOS Electron development desktop | Yes — real renderer, composer, track, child pane, archive-finished action |
| Pi RPC / Paseo WebSocket / daemon | Yes — real provider calls and persisted tool results/notices |
| Standalone browser web | No |
| iOS / Android | No |
| Windows / Linux desktop | No |
| Packaged release / CI | No |
Each resumed attempt intentionally gets its own row and reads the whole reused child transcript, including earlier history; it does not slice history by attempt. Old-notice isolation is also covered by the automated regression and the earlier real-notice host replay, rather than forcing a delayed notification in the desktop run.
Short-lived duplicate Shell text was observed in the streaming child pane; its cause was not established and it is not claimed fixed here. The earlier direct-SDK smoke's turn-end persistence error did not recur through this normal RPC run. All four test runners exited, the parent settled idle, and the temporary workspace stayed empty. No claims are made about old workflow issues or daemon-restart global adoption.
Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

@@ -0,0 +1,157 @@
{
"capture": "Selected fields from actual Pi session entries and final status files; omitted unrelated metadata. Test UUIDs unchanged; all test-root absolute paths replaced with <QA_ROOT>.",
"calls": [
{
"timestamp": "2026-11-10T04:08:31.691Z",
"toolCallId": "call_dab88a12b4db419586ac9d0eab565ca8|fc_0e57afa06f701795016af298be50c487d0844c674c8a61fa94",
"arguments": {
"agent": "qa-marker",
"task": "Run sleep 18 then printf PASEO_DESKTOP_A; do not read or write any files",
"async": true
}
},
{
"timestamp": "2026-11-10T04:08:32.010Z",
"toolCallId": "call_dab88a12b4db419586ac9d0eab565ca8|fc_0e57afa06f701795016af298be50c487d0844c674c8a61fa94",
"isError": false,
"details": {
"mode": "single",
"runId": "832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122",
"asyncId": "832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122",
"asyncDir": "<QA_ROOT>/async/async-subagent-runs/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122",
"results": []
}
},
{
"timestamp": "2026-11-10T04:10:22.901Z",
"toolCallId": "call_b636f1714b83481ba5b4ab0aee32b239|fc_0e57afa06f701795016af2992d215087d099231229062fa446",
"arguments": {
"action": "resume",
"id": "832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122",
"message": "Run sleep 18 then printf PASEO_DESKTOP_B; do not read or write files"
}
},
{
"timestamp": "2026-11-10T04:10:23.219Z",
"toolCallId": "call_b636f1714b83481ba5b4ab0aee32b239|fc_0e57afa06f701795016af2992d215087d099231229062fa446",
"isError": false,
"details": {
"mode": "single",
"runId": "8ca757d4-7514-4e87-8eeb-af52e2228ccb",
"asyncId": "8ca757d4-7514-4e87-8eeb-af52e2228ccb",
"asyncDir": "<QA_ROOT>/async/async-subagent-runs/8ca757d4-7514-4e87-8eeb-af52e2228ccb",
"results": []
}
},
{
"timestamp": "2026-11-10T04:13:36.923Z",
"toolCallId": "call_8e4ef481e0964e25bbdad4defe620e12|fc_0e57afa06f701795016af299ef47c887d0ac84e70bd50ffc5a",
"arguments": {
"action": "resume",
"id": "8ca757d4-7514-4e87-8eeb-af52e2228ccb",
"message": "Run bash sleep 45 then printf PASEO_DESKTOP_C; do not read or write files"
}
},
{
"timestamp": "2026-11-10T04:13:37.597Z",
"toolCallId": "call_8e4ef481e0964e25bbdad4defe620e12|fc_0e57afa06f701795016af299ef47c887d0ac84e70bd50ffc5a",
"isError": false,
"details": {
"mode": "single",
"runId": "f41865ed-0e62-44b5-a825-27ac4f0aa596",
"asyncId": "f41865ed-0e62-44b5-a825-27ac4f0aa596",
"asyncDir": "<QA_ROOT>/async/async-subagent-runs/f41865ed-0e62-44b5-a825-27ac4f0aa596",
"results": []
}
},
{
"timestamp": "2026-11-10T04:16:53.099Z",
"toolCallId": "call_60e8fa68de0b436fad2aaf8cc391dae2|fc_0e57afa06f701795016af29ab2b1b487d09020677eaaf9086e",
"arguments": {
"action": "resume",
"id": "00000000-0000-0000-0000-000000000000",
"message": "Output PASEO_INVALID"
}
},
{
"timestamp": "2026-11-10T04:16:53.109Z",
"toolCallId": "call_60e8fa68de0b436fad2aaf8cc391dae2|fc_0e57afa06f701795016af29ab2b1b487d09020677eaaf9086e",
"isError": true,
"details": {},
"content": [
{
"type": "text",
"text": "Async run not found for '00000000-0000-0000-0000-000000000000'."
}
]
},
{
"timestamp": "2026-11-10T04:17:07.330Z",
"toolCallId": "call_e6eb985f16b24308be82922d6a1d7a57|fc_0e57afa06f701795016af29ac17d5c87d0b79c8763512f43da",
"arguments": {
"action": "resume",
"id": "832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122",
"message": "Run bash sleep 45 then printf PASEO_DESKTOP_B_OBSERVE; do not read or write files"
}
},
{
"timestamp": "2026-11-10T04:17:07.668Z",
"toolCallId": "call_e6eb985f16b24308be82922d6a1d7a57|fc_0e57afa06f701795016af29ac17d5c87d0b79c8763512f43da",
"isError": false,
"details": {
"mode": "single",
"runId": "01ac3b2e-2ed6-472d-8438-4dfb91ea62f7",
"asyncId": "01ac3b2e-2ed6-472d-8438-4dfb91ea62f7",
"asyncDir": "<QA_ROOT>/async/async-subagent-runs/01ac3b2e-2ed6-472d-8438-4dfb91ea62f7",
"results": []
}
}
],
"finalStatuses": [
{
"runId": "01ac3b2e-2ed6-472d-8438-4dfb91ea62f7",
"state": "complete",
"revivedFrom": "832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122",
"sessionFile": "<QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl"
},
{
"runId": "832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122",
"state": "complete",
"sessionFile": "<QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl"
},
{
"runId": "8ca757d4-7514-4e87-8eeb-af52e2228ccb",
"state": "complete",
"revivedFrom": "832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122",
"sessionFile": "<QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl"
},
{
"runId": "f41865ed-0e62-44b5-a825-27ac4f0aa596",
"state": "complete",
"revivedFrom": "8ca757d4-7514-4e87-8eeb-af52e2228ccb",
"sessionFile": "<QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl"
}
],
"completionNotices": [
{
"timestamp": "2026-11-10T04:09:07.245Z",
"customType": "subagent-notify",
"content": "Background task completed: **qa-marker**\n\nqa-marker:\nPASEO_DESKTOP_A\n\nRetention-managed async directory: <QA_ROOT>/async/async-subagent-runs/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122\n\nSession file: <QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl\n\nParent action: Read the saved results above and resume the already-authorized parent task, or report completion. If approval is required, explicitly ask the user. Do not silently yield, rerun completed work, or infer new authorization."
},
{
"timestamp": "2026-11-10T04:10:53.423Z",
"customType": "subagent-notify",
"content": "Background task completed: **qa-marker**\n\nqa-marker:\nPASEO_DESKTOP_B\n\nRetention-managed async directory: <QA_ROOT>/async/async-subagent-runs/8ca757d4-7514-4e87-8eeb-af52e2228ccb\n\nSession file: <QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl\n\nParent action: Read the saved results above and resume the already-authorized parent task, or report completion. If approval is required, explicitly ask the user. Do not silently yield, rerun completed work, or infer new authorization."
},
{
"timestamp": "2026-11-10T04:14:37.834Z",
"customType": "subagent-notify",
"content": "Background task completed: **qa-marker**\n\nqa-marker:\nPASEO_DESKTOP_C\n\nRetention-managed async directory: <QA_ROOT>/async/async-subagent-runs/f41865ed-0e62-44b5-a825-27ac4f0aa596\n\nSession file: <QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl\n\nParent action: Read the saved results above and resume the already-authorized parent task, or report completion. If approval is required, explicitly ask the user. Do not silently yield, rerun completed work, or infer new authorization."
},
{
"timestamp": "2026-11-10T04:17:37.887Z",
"customType": "subagent-notify",
"content": "Background task completed: **qa-marker**\n\nqa-marker:\nPASEO_DESKTOP_B_OBSERVE\n\nRetention-managed async directory: <QA_ROOT>/async/async-subagent-runs/01ac3b2e-2ed6-472d-8438-4dfb91ea62f7\n\nSession file: <QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl\n\nParent action: Read the saved results above and resume the already-authorized parent task, or report completion. If approval is required, explicitly ask the user. Do not silently yield, rerun completed work, or infer new authorization."
}
]
}
@@ -0,0 +1,17 @@
Excerpt of actual Electron renderer DOM captured after opening the resumed child.
Test-root paths replaced with <QA_ROOT>; unrelated earlier history omitted.
Task: You are reviving a previous subagent conversation.
Original run: 832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122
Original agent: qa-marker
Original session file: <QA_ROOT>/pi/sessions/<QA_WORKSPACE>/2026-11-10T04-08-20-423Z_01a1c3a4-80c7-75ad-8526-1844853a0f02/832f02f3-3cf9-4f7b-a8f2-b6cc06c5e122/run-0/session.jsonl
Use the stored session context as background. Answer the orchestrator's follow-up below. Do not assume the original child session is still running.
Follow-up:
Run bash sleep 45 then printf PASEO_DESKTOP_B_OBSERVE; do not read or write files
Show more
12:17 PM
QA #9200 — Pi resume A→B→C
Open parent
@@ -0,0 +1,196 @@
Captured command output. Only private absolute paths are replaced with <REPO_ROOT>/<USER_HOME>.
RED runs are intentional regression failures, not final failures.
=== Before fix: resume arguments rejected (expected RED, exit 1) ===
$ cd packages/server && npx vitest run src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts --bail=1
RUN v4.1.6 <REPO_ROOT>/packages/server
stdout | src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts
[dotenv@17.3.1] injecting env (0) from .env.test -- tip: ⚙️ suppress all logs with { quiet: true }
[dotenv@17.3.1] injecting env (0) from ../.env -- tip: ⚙️ suppress all logs with { quiet: true }
❯ src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts (10 tests | 1 failed) 7ms
× registers a successful resume as a new async attempt without spawn arguments 6ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts > pi-subagents adapter > registers a successful resume as a new async attempt without spawn arguments
AssertionError: expected undefined to deeply equal [ { type: 'upsert', …(5) } ]
- Expected:
[
{
"description": "Continue",
"id": "resume-b",
"status": "running",
"title": "Subagent",
"toolCallId": "resume-b",
"type": "upsert",
},
]
+ Received:
undefined
❯ src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts:66:32
64| },
65| });
66| expect(resumed?.subagents).toEqual([
| ^
67| {
68| type: "upsert",
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests 1 failed (10)
Start at 21:05:21
Duration 474ms (transform 245ms, setup 31ms, import 328ms, tests 7ms, environment 0ms)
=== Intermediate implementation: old file-only transcript deduplication (expected RED, exit 1) ===
$ cd packages/server && npx vitest run src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts --bail=1
RUN v4.1.6 <REPO_ROOT>/packages/server
stdout | src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts
[dotenv@17.3.1] injecting env (0) from .env.test -- tip: ⚡️ secrets for agents: https://dotenvx.com/as2
[dotenv@17.3.1] injecting env (0) from ../.env -- tip: ⚙️ override existing env vars with { override: true }
❯ src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts (16 tests | 1 failed) 1329ms
× follows consecutive resumed attempts and keeps stale notices on their own rows 1320ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts > pi-subagents adapter > follows consecutive resumed attempts and keeps stale notices on their own rows
AssertionError: expected false to be true // Object.is equality
- Expected
+ Received
- true
+ false
❯ src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts:155:78
153| ]);
154| replay.mapToolCall(call);
155| await expect.poll(() => hasChildTimeline(received, `resume-${r…
| ^
156| }
157| const oldNotice = {
Caused by: Error: Matcher did not succeed in time.
❯ src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts:155:9
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests 1 failed | 6 passed (16)
Start at 21:09:04
Duration 1.85s (transform 247ms, setup 24ms, import 389ms, tests 1.33s, environment 0ms)
=== Final baseline d46ee655: GREEN, exit 0 ===
$ cd packages/server && npx vitest run src/server/agent/providers/pi/extensions/pi-subagents/index.test.ts --bail=1
RUN v4.1.6 <REPO_ROOT>/packages/server
Test Files 1 passed (1)
Tests 21 passed (21)
Start at 13:07:04
Duration 1.97s (transform 256ms, setup 26ms, import 355ms, tests 1.45s, environment 0ms)
=== Final typecheck, exit 0 ===
$ npm run typecheck
> paseo@0.15.4 typecheck
> npm run typecheck --workspaces --if-present
> @getpaseo/builtin-plugins@0.15.4 typecheck
> tsgo -p tsconfig.json --noEmit
> @getpaseo/expo-two-way-audio@0.15.4 typecheck
> tsgo --noEmit
> @getpaseo/highlight@0.15.4 typecheck
> tsgo --noEmit
> @getpaseo/plugin@0.15.4 typecheck
> tsgo --noEmit && npm run typecheck:examples
> @getpaseo/plugin@0.15.4 typecheck:examples
> npm --prefix ../../plugin-examples/markdown-panel install --ignore-scripts --no-audit --no-fund && tsgo -p tsconfig.examples.json --noEmit
up to date in 433ms
> @getpaseo/protocol@0.15.4 pretypecheck
> npm run generate:validators
> @getpaseo/protocol@0.15.4 generate:validators
> node scripts/generate-validation-aot.mjs
generated src/generated/validation/ws-outbound.aot.ts: envelope + 250 session message validators
> @getpaseo/protocol@0.15.4 typecheck
> tsgo --noEmit
> @getpaseo/client@0.15.4 typecheck
> tsgo --noEmit
> @getpaseo/server@0.15.4 typecheck
> tsgo -p tsconfig.server.typecheck.json --noEmit
> @getpaseo/app@0.15.4 typecheck
> tsgo --noEmit
> @getpaseo/relay@0.15.4 typecheck
> tsgo --noEmit
> @getpaseo/website@0.15.4 typecheck
> tsgo --noEmit
> @getpaseo/desktop@0.15.4 typecheck
> tsgo --noEmit -p tsconfig.json
> @getpaseo/cli@0.15.4 typecheck
> tsgo --noEmit
=== Final lint, exit 0 ===
$ npm run lint
> paseo@0.15.4 lint
> oxlint
Found 0 warnings and 0 errors.
Finished in 2.3s on 5442 files with 177 rules using 12 threads.
=== Final full formatter, exit 0; no unrelated changes ===
$ npm run format
> paseo@0.15.4 format
> oxfmt .
Finished in 2684ms on 5928 files using 12 threads.
$ git diff --check
(exit 0; no output)
+82 -5
View File
@@ -248,6 +248,7 @@ npm run release:promote # Promote X.Y.Z-beta.N to stable X.Y.Z
- Beta tags are published GitHub prereleases like `v0.1.41-beta.1`
- Betas publish npm packages with `--tag beta`, so `npm install @getpaseo/cli@beta` opts in while plain `npm install @getpaseo/cli` stays on `latest`
- The user-facing beta instructions, including the public TestFlight join link for the `Paseo Beta` group, live in `public-docs/updates.md` and its `zh-CN` pair. Update them when a beta path is added or removed.
- Betas publish desktop assets and APKs for testing. They also build iOS, upload it to TestFlight, add it to the `Paseo Beta` external group, and submit it for Beta App Review. They do not submit mobile builds to the production stores.
- `release:promote` creates a fresh stable tag like `v0.1.41`; the final release never reuses the beta tag
- Desktop assets now come from the Electron package at `packages/desktop`
@@ -488,7 +489,7 @@ The GitHub Release body is populated automatically by the `Release Notes Sync` w
- The website download page defaults to GitHub's latest published **stable** release.
- A published beta prerelease is offered behind the Stable/Beta switch on `/download` (`?channel=beta`), never as the default. The switch only appears while the newest prerelease leads stable on its core version, so promoting `X.Y.Z-beta.N` to `X.Y.Z` retires the beta channel from the page until the next beta line opens.
- Homebrew, the Play Store, the App Store, and `app.paseo.sh` have no beta. The Beta view drops those rows, and the whole Web section, rather than showing an inert "stable only" placeholder. When a surface gains a beta path — say a public TestFlight link — add its row back in `packages/website/src/routes/download.tsx`.
- Homebrew, the Play Store, and `app.paseo.sh` have no beta. The Beta view drops those rows, and the whole Web section, rather than showing an inert "stable only" placeholder. The iOS row swaps the App Store pill for the public TestFlight link (`testFlightBetaUrl` in `packages/website/src/downloads.tsx`). When another surface gains a beta path, add its row back in `packages/website/src/routes/{-$locale}/download.tsx`.
- The default download target only moves when you publish the final stable release tag like `v0.1.41`.
- The public `/changelog` page renders `CHANGELOG.md` as-is, so the in-flight `-beta.N` entry shows there once it lands on `main` — that's intended, it's where beta users check what's coming. Only the **default download target** stays pinned to the latest stable; the download links read GitHub's releases API, not the changelog, so a `-beta.N` heading on top never affects them.
- The download page's "What's new" link deep-links the **minor group** anchor (`/changelog#release-0.3`), not the exact entry: the beta entry is renamed on each beta and on promotion, so the minor group remains the durable target. A version with no entry in the bundled changelog — a tag whose changelog commit hasn't redeployed the site yet — links the plain `/changelog` instead of a dead anchor.
@@ -594,7 +595,7 @@ Release notes depend on the changelog heading format. The heading **must** be st
No prefix (`v`), no extra text. `Release Notes Sync` matches the `## X.Y.Z` (or `## X.Y.Z-beta.N`) line for the pushed tag to extract the version. A malformed heading breaks the release-notes sync for that tag.
`CHANGELOG.md` on `main` is also what the app's **What's new** sheet fetches and renders, so the file is a shipped product surface, not just a release input. `##` starts a release and `###` starts a section; the app reads section titles from the document, so renaming or adding one needs no app change. Everything under a section is rendered as Markdown: prose, lists, links, inline code, fenced code, block quotes, tables, and images. Raw HTML does not render — the shared Markdown parser runs with `html: false`, so a `<video>`, `<iframe>` or `<embed>` tag reaches the reader as visible markup. Keep media out of the changelog, or link to it. A GitHub callout renders as a block quote with its `[!NOTE]` marker still in the text. A release entry is what a user reads on a phone the moment they are offered the update — write it for them.
`CHANGELOG.md` on `main` is also what the app's **What's new** sheet fetches and renders, so the file is a shipped product surface, not just a release input. `##` starts a release and `###` starts a section; the app reads section titles from the document, so renaming or adding one needs no app change. Content between the release heading and the first `###` is the release's [highlights](#changelog-highlights). The What's new sheet, the website changelog and the GitHub release body show the highlights and keep the sections collapsed behind one control: Show all changes in the app and on the website, and an All changes `<details>` block that `Release Notes Sync` writes into the release body, so the file itself never needs HTML. A release with nothing before its first `###` shows its sections. Older entries that open with summary paragraphs are treated as highlights. The app, the website and the release scripts each parse the file with their own code, and installed apps keep the parser they shipped with, so those two heading rules are fixed: new kinds of content go inside the highlights or a section as Markdown, never behind a new heading level or marker. `scripts/test-support/changelog-structure.json` holds the cases all three parsers are tested against; change a structure rule there first. Everything under a section is rendered as Markdown: prose, lists, links, inline code, fenced code, block quotes, tables, and images. Raw HTML does not render — the shared Markdown parser runs with `html: false`, so a `<video>`, `<iframe>` or `<embed>` tag reaches the reader as visible markup. Keep media out of the changelog, or link to it. A GitHub callout renders as a block quote with its `[!NOTE]` marker still in the text. A release entry is what a user reads on a phone the moment they are offered the update — write it for them.
## Changelog policy
@@ -613,7 +614,7 @@ Older prerelease bodies on GitHub keep the notes they were synced with; `Release
- The release agent writes the Chinese entry in the changelog commit, after the English entry is approved. Every beta that rewrites the English entry rewrites the Chinese one too, and promotion renames both. `packages/website/e2e/i18n.spec.ts` fails CI on the release commit when any entry has no current translation.
- A translated entry uses the English heading unchanged: `## X.Y.Z - YYYY-MM-DD`. The website uses it only while the version and date both match the English entry. Otherwise it shows that release whole in English under a notice. Delete Chinese entries whose English entry was renamed.
- Keep the English sections, bullets and links one to one. Section titles: Added 新增, Improved 改进, Changed 变更, Fixed 修复, Security 安全, Breaking 破坏性变更, Plugins 插件, Notes 说明. Wording follows [website-i18n.md](website-i18n.md#chinese-style).
- Keep the English highlights, sections, bullets and links one to one. Section titles: Added 新增, Improved 改进, Changed 变更, Fixed 修复, Security 安全, Breaking 破坏性变更, Plugins 插件, Notes 说明. Wording follows [website-i18n.md](website-i18n.md#chinese-style).
## Changelog ownership
@@ -656,7 +657,7 @@ claims a general improvement, rewrite it with the concrete change.
## Changelog conciseness
Every bullet must be scannable at a glance. The changelog is not release documentation — it's a list.
Every section bullet must be scannable at a glance. The changelog is not release documentation — it's a list. [Highlights](#changelog-highlights) get more room; every other bullet follows these limits.
- **One sentence per bullet, max.** If a bullet contains two sentences, the second one is doing work that belongs in product docs, not the changelog. Cut it.
- **No trailing periods.** Bullets are list items, not prose. Drop the period at the end of every bullet, including the period inside any bolded lead-in. `**Configurable terminal scrollback**` not `**Configurable terminal scrollback.**`.
@@ -666,6 +667,57 @@ Every bullet must be scannable at a glance. The changelog is not release documen
- **Stop after identifying the change.** Do not explain LAN/WAN topology, TLS handshakes, IPC, or other architecture in a changelog bullet. Put necessary background in product docs.
- **Attribution follows the split.** When you split a dense bullet, move each PR/author to the bullet it belongs to. Never duplicate the same PR across multiple bullets.
## Changelog highlights
Every release entry leads with highlights: the changes a user would name first when asked what is
new. They are a list above the first `###` section, ranked as
[Changelog ordering](#changelog-ordering) describes. The sections below are the full record; a
reader who stops after the highlights should have missed nothing they would ask about.
```markdown
## 0.16.0 - 2026-11-20
- **Undo workspace archive:** Archiving a workspace in the app now shows a "Workspace archived" toast for six seconds. Undo, or Cmd/Ctrl+Z, restores the workspace with its tabs and agents. ([#8904](https://github.com/getpaseo/paseo/pull/8904))
### Added
```
- **The lead-in names what is new in four words at most.** Bold it, colon inside the bold. A reader
who sees only the bold words should know what this release added or changed. A category lead-in
such as `**Polish:**` gathers several related changes.
- **The lead-in is not a place or something Paseo already had.** A device, screen or area names
where the change landed. A feature name that was true of the last release hides the news: Paseo
already had keyboard shortcuts, so the lead-in says they now work on mobile.
- **The first sentence says the plain thing.** Write what a user would tell a friend: Paseo now
shows the background tasks an agent is running. Leave out the conditions and mechanics that make
it true.
- **Describe the new behavior, not the old one.** Say what is faster or better now, and do not
dwell on how slow or broken it was before. A number is welcome as a short aside after the new
behavior is stated: seconds, a percentage, a multiple.
- **Do not list what a sentence already covers.** After "the same shortcuts as desktop", naming
five of them adds nothing. Keep a list only when it sets the scope, such as the providers a
feature works with.
- **The description runs one to three sentences.** Sentences end with periods, and the attribution
follows the last one. [Changelog wording](#changelog-wording) applies in full.
- **A highlight replaces the section bullets it covers.** A PR appears once in an entry, so its
attribution moves to the highlight.
- **A highlight is something a user would name.** Everything else stays a section bullet. A patch
release still has one: the change it ships for.
- **Fixes are routine and stay in `### Fixed`.** Do not add a summary of fixes. A fix, or a group
of related fixes, becomes a highlight only when it passes the same test as a feature, and then
it is written as what works now: `**Fewer reconnects on return:**`.
| Avoid | Write |
| ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| `**iPad and touch screens:**` | `**Touch-sized tablet controls:**` |
| `**Hardware keyboard shortcuts:**` | `**Keyboard shortcuts on mobile:**` |
| When an agent ends its turn while shells it started are still running, a pill lists them | Paseo now shows the background tasks an agent is running |
| A diff no longer waits 4 to 40 seconds behind worktree scans | Opening Changes shows the file tree right away, and diffs load about 6 times sooner on hosts with many worktrees |
| The same shortcuts as desktop: command center, file picker, new workspace, workspace jumps | The same shortcuts as desktop, including your custom bindings |
Before showing a draft, read only the bold lead-ins top to bottom. Each one must answer "what is
new?" without its description, and each must outrank the one below it.
## Changelog attribution
Every changelog bullet must credit contributors and link to the PR(s) that delivered the change. This is not one-PR-per-line — a single bullet describes a user-facing change and may reference multiple PRs.
@@ -697,7 +749,32 @@ Rules:
## Changelog ordering
Entries within each section (Added, Improved, Fixed) are ordered by user impact:
Rank highlights by how much of a user's day the change touches: how many users get it, and how
often they meet it. Put every highlight in one of four groups, then order each group by the same
question.
1. **New capabilities.** Something a user could not see or do in the last release:
`Background tasks`, `Plugin sidebar views`.
2. **Everyday things that got better.** Speed, steadiness and polish in what users already do
every session: `Faster diff loading`, `Polish`.
3. **Changes for part of the audience.** They need a particular device, provider or setup:
`Keyboard shortcuts on mobile`, `Touch-sized tablet controls`.
4. **Small conveniences and highlighted fixes.** A user is glad to find them and would not update
for them: `Undo workspace archive`, `Fewer reconnects on return`. Fixes are routine, so one
that earned a highlight still follows everything new or improved.
- **Reach decides before kind.** A new capability that needs a hardware keyboard is in group 3.
- **Rank the whole list in one pass.** The order you collected the pull requests in, the alphabet
and the order of the sections below are not rankings.
- **Show the groups with the draft.** List each highlight under its group when you ask for
approval, so the maintainer corrects the test and not one position.
- **A maintainer's note that a change is big moves that change up.** It does not rank the changes
it names against each other, and it does not lower the ones it leaves out.
- **A correction to one highlight is a correction to the test.** Work out which group or question
you got wrong, rank every highlight again, and then edit the file. Moving only the named item
leaves the same mistake in the others.
Bullets within each section (Added, Changed, Fixed) follow this order:
1. **User-facing features and changes first** — things users will notice, want to try, or that change their workflow.
2. **Quality-of-life improvements** — polish, performance, smoother interactions.
+7 -5
View File
@@ -117,11 +117,13 @@ agent, so an agent the daemon has not loaded answers `behind` and resumes in tha
Cached history remains readable during recovery. The chat shows Reconnecting to host while the host
is offline and until a reconnected chat's check answers, so an unchanged chat never shows a second
toast. A check on cached content shows nothing. Updating messages appears for a chat that is behind,
until the fetch completes, and for a check still unanswered `FRESHNESS_CHECK_QUIET_MS` after it was
sent. That delay measures the daemon, so it starts at the request: on a cold start the cache read
alone can take longer. Socket connectivity alone cannot certify that the displayed conversation is
current. The timeline owner publishes freshness; the view renders it without a toast timer or a
toast. Returning from background on a socket that stayed connected shows nothing until the check
answers: the chat stayed subscribed, so a slow answer is no reason to doubt it, and a socket that
died without closing fails the foreground liveness probe and becomes a reconnect. Updating messages
appears for a chat that is behind, until the fetch completes, and for an opened chat whose check is
still unanswered `FRESHNESS_CHECK_QUIET_MS` after it was sent. That delay measures the daemon, so it
starts at the request: on a cold start the cache read alone can take longer. Socket connectivity
alone cannot certify that the displayed conversation is current. The timeline owner publishes freshness; the view renders it without a toast timer or a
separate resume workflow.
The turn footer in a chat follows its messages, not the agent status. Turn activity comes from the
@@ -0,0 +1,7 @@
Added
- Added Claude Fable 5.2 and Mythos 5.2 with medium default effort
Notes
- Both models require Claude Code 2.1.321 or newer; Mythos 5.2 appears only when Claude Code advertises access
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,7 @@
Added
- Added Claude Fable 5.2 and Mythos 5.2 with medium default effort
Notes
- Both models require Claude Code 2.1.321 or newer; Mythos 5.2 appears only when Claude Code advertises access
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,7 @@
Added
- Added Claude Fable 5.2 and Mythos 5.2 with medium default effort
Notes
- Both models require Claude Code 2.1.321 or newer; Mythos 5.2 appears only when Claude Code advertises access
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,7 @@
Added
- Added Claude Fable 5.2 and Mythos 5.2 with medium default effort
Notes
- Both models require Claude Code 2.1.321 or newer; Mythos 5.2 appears only when Claude Code advertises access
Full notes: https://paseo.sh/changelog
+1 -1
View File
@@ -1 +1 @@
sha256-vwivjBU5VFpM9VD7Wx4IKHN6xEVlg/KBMJCCMuA1JEw=
sha256-e6BNeOJvy1uyDe/XW9hdr7NBgJ+t9tlNum5oLNefREI=
+28 -28
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -37468,7 +37468,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -39637,13 +39637,13 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "Apache-2.0",
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.15.3",
"@getpaseo/protocol": "0.15.3",
"@getpaseo/server": "0.15.3",
"@getpaseo/client": "0.16.0-beta.2",
"@getpaseo/protocol": "0.16.0-beta.2",
"@getpaseo/server": "0.16.0-beta.2",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
@@ -39890,11 +39890,11 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/protocol": "0.15.3",
"@getpaseo/relay": "0.15.3",
"@getpaseo/protocol": "0.16.0-beta.2",
"@getpaseo/relay": "0.16.0-beta.2",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
@@ -39906,7 +39906,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40149,7 +40149,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40195,7 +40195,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/language": "6.12.4",
@@ -40225,7 +40225,7 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^1.4.0",
@@ -40233,8 +40233,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.15.3",
"@getpaseo/protocol": "0.15.3",
"@getpaseo/client": "0.16.0-beta.2",
"@getpaseo/protocol": "0.16.0-beta.2",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -40244,8 +40244,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.15.3",
"@getpaseo/protocol": "0.15.3",
"@getpaseo/client": "0.16.0-beta.2",
"@getpaseo/protocol": "0.16.0-beta.2",
"react": ">=19.1.0 <20",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
@@ -40267,7 +40267,7 @@
},
"packages/protocol": {
"name": "@getpaseo/protocol",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "Apache-2.0",
"dependencies": {
"semver": "^7.8.5",
@@ -40295,7 +40295,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^2.4.0",
@@ -40517,17 +40517,17 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^0.17.1",
"@anthropic-ai/claude-agent-sdk": "0.3.246",
"@anthropic-ai/sdk": "^0.104.2",
"@getpaseo/client": "0.15.3",
"@getpaseo/highlight": "0.15.3",
"@getpaseo/plugin": "0.15.3",
"@getpaseo/protocol": "0.15.3",
"@getpaseo/relay": "0.15.3",
"@getpaseo/client": "0.16.0-beta.2",
"@getpaseo/highlight": "0.16.0-beta.2",
"@getpaseo/plugin": "0.16.0-beta.2",
"@getpaseo/protocol": "0.16.0-beta.2",
"@getpaseo/relay": "0.16.0-beta.2",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/sdk": "1.29.0",
"@opencode-ai/sdk": "1.14.46",
@@ -41474,7 +41474,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
@@ -43084,7 +43084,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
@@ -11,6 +11,7 @@ import {
seedLongMockAgentTimeline,
} from "../support/helpers/timeline-pagination";
import {
answerFreshnessCheck,
commitTimelineTurnsWhileDisconnected,
disconnectViewedTimeline,
expectResumeAnsweredWithoutFetch,
@@ -21,6 +22,7 @@ import {
restoreUnchangedViewedTimeline,
restoreViewedTimelineHoldingCatchUp,
restoreViewedTimelineWithHeldResponse,
reopenWithFreshnessCheckUnanswered,
waitForResumeAnswer,
reopenAppWatchingForUpdatingToast,
watchForUpdatingToast,
@@ -101,6 +103,27 @@ test.describe("Agent timeline resume", () => {
}
});
test("opening cached history reports an unanswered check until the daemon answers", async ({
page,
}) => {
test.setTimeout(120_000);
const gate = await installDaemonWebSocketGate(page);
const agent = await seedLongMockAgentTimeline({ turns: 3 });
try {
await openAgentTimeline(page, agent);
await expectTimelinePromptVisible(page, agent.newestPrompt);
const requests = rememberTimelineRequestCounts(gate);
await reopenWithFreshnessCheckUnanswered(page, gate, agent);
await answerFreshnessCheck(page, gate);
expectResumeAnsweredWithoutFetch(gate, requests);
} finally {
gate.restore();
await agent.cleanup();
}
});
test("returning to a changed chat reports the update and shows the new messages", async ({
page,
}) => {
@@ -644,6 +644,22 @@ test("copying an assistant selection preserves Markdown structure and links", as
'```typescript\nconst answer = "yes";\n return answer;\n```\n\nAfter code.',
);
// Crossing into part of the block keeps the selected code lines as a fenced block.
await selectAssistantAcrossCodeLines(page, "not a generated link.", "return");
await copySelection(page);
expect((await readRichClipboard(page)).plainText).toBe(
'not a generated link.\n\n```typescript\nconst answer = "yes";\n return\n```',
);
// So does starting partway through the block and leaving it.
await selectAssistantAcrossCodeLines(page, "answer", "After code.");
await copySelection(page);
expect((await readRichClipboard(page)).plainText).toBe(
'```typescript\nanswer = "yes";\n return answer;\n```\n\nAfter code.',
);
// Selecting a whole line runs off its end into the newline node. A trailing
// newline auto-executes the line when it is pasted into a terminal.
await selectAssistantAcrossCodeLines(page, "const", " ");
@@ -729,13 +745,25 @@ test.describe("on a touch-capable desktop browser", () => {
// The pan accepts touch only, and a mouse drag must still extend the browser's selection.
test.use({ hasTouch: true });
test("a mouse drag selects across assistant paragraphs", async ({ page }) => {
test("a mouse drag selects across assistant list, quote, and code blocks", async ({ page }) => {
const agent = await seedMockAgentWorkspace({
repoPrefix: "assistant-selection-drag-",
title: "Assistant selection drag",
initialPrompt: "Render three paragraphs.",
initialPrompt: "Render structured text.",
featureValues: {
mockAssistantResponse: "First paragraph.\n\nSecond paragraph.\n\nThird paragraph.",
mockAssistantResponse: [
"First paragraph.",
"",
"- List item.",
"",
"> Quote text.",
"",
"```ts",
"const answer = 1;",
"```",
"",
"Third paragraph.",
].join("\n"),
},
});
@@ -760,6 +788,9 @@ test.describe("on a touch-capable desktop browser", () => {
const selected = await page.evaluate(() => window.getSelection()?.toString() ?? "");
expect(selected).toContain("First paragraph.");
expect(selected).toContain("List item.");
expect(selected).toContain("Quote text.");
expect(selected).toContain("const answer = 1;");
expect(selected).toContain("Third paragraph.");
} finally {
await agent.cleanup();
@@ -125,11 +125,13 @@ async function renameWorkspaceViaSidebar(
await expect(renameItem).toBeVisible({ timeout: 10_000 });
await renameItem.click();
const modalPrefix = `sidebar-workspace-rename-modal-${serverId}:${input.workspaceId}`;
const renameInput = page.getByTestId(`${modalPrefix}-input`);
await expect(renameInput).toBeVisible({ timeout: 10_000 });
// Desktop-width sidebars rename in place.
const renameInput = page.getByTestId(
`sidebar-workspace-rename-input-${serverId}:${input.workspaceId}`,
);
await expect(renameInput).toBeFocused({ timeout: 10_000 });
await renameInput.fill(input.title);
await page.getByTestId(`${modalPrefix}-submit`).click();
await renameInput.press("Enter");
await expect(renameInput).toHaveCount(0, { timeout: 15_000 });
}
@@ -306,6 +306,24 @@ test("streamed Changes shows the tree before completion and applies a one-file r
await page.screenshot({ path: testInfo.outputPath("refreshed.png") });
});
test("reopening compact Changes keeps the painted diff while it resubscribes", async ({ page }) => {
const workspace = await createWorkspaceWithMountedTabDiff();
const stream = await holdDiffCompletion(page);
const explorer = await openCompactChanges(page, workspace);
stream.finish();
const firstFile = explorer.getByTestId("diff-file-0");
await expect(firstFile).toBeVisible({ timeout: 30_000 });
const painted = await firstFile.getAttribute("aria-label");
await explorer.getByTestId("workspace-tab-files").click();
stream.hold();
await explorer.getByTestId("workspace-tab-changes_tree").click();
await expect.poll(() => stream.held, { timeout: 30_000 }).toBeGreaterThan(0);
await expect(page.getByRole("progressbar", { name: "Loading..." })).toHaveCount(0);
await expect(firstFile).toHaveAccessibleName(painted ?? "");
stream.finish();
});
async function createLargeStreamedWorkspace(): Promise<DirtyWorkspace> {
const workspace = await createWorkspaceWithManyTinyDiffs(252);
await Promise.all(
@@ -371,6 +389,12 @@ async function holdDiffCompletion(page: Page) {
get completed() {
return completed;
},
get held() {
return completions.length;
},
hold: () => {
holding = true;
},
finish: () => {
holding = false;
completions.splice(0).forEach((send) => send());
@@ -19,6 +19,7 @@ import {
openSheetAsTab,
expectDeclinedDiscardPrompt,
expectSheetAtSnap,
promptMentioning,
replaceSheetFileText,
selectTabFromSwitcher,
sheet,
@@ -28,17 +29,6 @@ import {
const FILE_LINK = "linked.ts:3";
function promptMentioning(target: string): string {
return [
"Generate a title and a git branch name for a coding agent from the user prompt and attachments.",
"Return JSON only with fields 'title' and 'branch'.",
"",
"<user-prompt>",
`Open \`${target}\` now`,
"</user-prompt>",
].join("\n");
}
test("compact opens files and subagents in a sheet, leaving the tabs for agents", async ({
page,
}) => {
@@ -3,7 +3,7 @@ import { writeFile } from "node:fs/promises";
import path from "node:path";
import { expect, test, type Page } from "../support/fixtures";
import { seedSubagent } from "../support/helpers/subagents";
import { submitMessage } from "../support/helpers/composer";
import { expectWorkspaceHeaderVisible, submitMessage } from "../support/helpers/composer";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { gateNextAgentMessage } from "../support/helpers/agent-message-gate";
import {
@@ -918,11 +918,12 @@ test.describe("touch composer tracks", () => {
[tasks, subagents, changes].map(async (pill) => (await pill.boundingBox())!.width),
);
await page.setViewportSize({ width: 200, height: 844 });
const narrowWidths = await Promise.all(
[tasks, subagents, changes].map(async (pill) => (await pill.boundingBox())!.width),
);
for (const [index, width] of wideWidths.entries())
expect(narrowWidths[index]).toBeGreaterThanOrEqual(width - 1);
// The compact layout mounts a new composer, so measure only after it replaces the wide one.
await expectWorkspaceHeaderVisible(page);
for (const [index, pill] of [tasks, subagents, changes].entries())
await expect
.poll(async () => (await pill.boundingBox())?.width ?? 0)
.toBeGreaterThanOrEqual(wideWidths[index] - 1);
const track = page.getByTestId("composer-track-scroll");
expect(await track.evaluate((node) => node.scrollWidth)).toBeGreaterThan(
await track.evaluate((node) => node.clientWidth),
@@ -10,6 +10,7 @@ import {
selectComposerDraftRange,
} from "../support/helpers/composer";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { expectVisibleAgentSurfacesIdle } from "../support/helpers/agent-stream";
// The popover has no semantic role; its rows are React Native Pressables.
function fileSuggestions(page: Page) {
@@ -32,31 +33,33 @@ async function sendEmailIntact(page: Page, email: string): Promise<void> {
await expect(page.getByText(email, { exact: true })).toBeVisible();
}
for (const email of [
"user <12345+user@noreply.example.com>",
"alice@example.com",
"noreply+@example.com",
]) {
test(`Enter sends ${email} intact and still completes file mentions`, async ({ page }) => {
const agent = await seedMockAgentWorkspace({
repoPrefix: "composer-email-",
title: "Email mention regression",
repo: { files: [{ path: "example.com", content: "A file matching the email domain.\n" }] },
});
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await test.step("complete a workspace file mention with Enter", async () => {
await selectReadmeMention(page);
});
await test.step("send an email without offering or inserting workspace files", async () => {
await sendEmailIntact(page, email);
});
} finally {
await agent.cleanup();
}
test("Enter sends email formats intact and still completes file mentions", async ({ page }) => {
const agent = await seedMockAgentWorkspace({
repoPrefix: "composer-email-",
title: "Email mention regression",
repo: { files: [{ path: "example.com", content: "A file matching the email domain.\n" }] },
});
}
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
for (const email of [
"user <12345+user@noreply.example.com>",
"alice@example.com",
"noreply+@example.com",
]) {
await test.step(`complete a file mention, then send ${email} intact`, async () => {
await selectReadmeMention(page);
await sendEmailIntact(page, email);
// Start the next draft only after the daemon and visible agent have settled.
const reply = await agent.client.waitForFinish(agent.agentId, 15_000);
expect(reply.status).toBe("idle");
await expectVisibleAgentSurfacesIdle(page);
});
}
} finally {
await agent.cleanup();
}
});
test("fullscreen mention keys edit the draft while inline keys still complete files", async ({
page,
@@ -6,6 +6,7 @@ import {
fillComposerDraft,
typeIntoFocusedComposer,
} from "../support/helpers/composer";
import { expectVisibleAgentSurfacesIdle } from "../support/helpers/agent-stream";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
function userMessages(page: Page) {
@@ -29,7 +30,9 @@ async function pressInComposer(page: Page, key: string) {
}
test.describe("Composer recall", () => {
test("Up and Down walk sent messages from an empty composer", async ({ page }) => {
test("recalls, edits, and sends messages while keeping slash autocomplete usable", async ({
page,
}) => {
const session = await seedMockAgentWorkspace({
repoPrefix: "composer-recall-",
title: "Composer recall",
@@ -37,49 +40,44 @@ test.describe("Composer recall", () => {
try {
await openAgentRoute(page, session);
await expectComposerVisible(page);
await sendAndWaitForMessage(page, "fix the auth bug", 1);
await sendAndWaitForMessage(page, "add tests", 2);
await test.step("walk sent history, edit a recalled draft, and send it", async () => {
await sendAndWaitForMessage(page, "fix the auth bug", 1);
await sendAndWaitForMessage(page, "add tests", 2);
await pressInComposer(page, "ArrowUp");
await expectComposerDraft(page, "add tests");
await pressInComposer(page, "ArrowUp");
await expectComposerDraft(page, "fix the auth bug");
await pressInComposer(page, "ArrowDown");
await expectComposerDraft(page, "add tests");
await pressInComposer(page, "ArrowDown");
await expectComposerDraft(page, "");
await pressInComposer(page, "ArrowUp");
await expectComposerDraft(page, "add tests");
await pressInComposer(page, "ArrowUp");
await expectComposerDraft(page, "fix the auth bug");
await pressInComposer(page, "ArrowDown");
await expectComposerDraft(page, "add tests");
await pressInComposer(page, "ArrowDown");
await expectComposerDraft(page, "");
await pressInComposer(page, "ArrowUp");
await typeIntoFocusedComposer(page, " for login");
await expectComposerDraft(page, "add tests for login");
await pressInComposer(page, "ArrowUp");
await expectComposerDraft(page, "add tests for login");
await pressInComposer(page, "ArrowUp");
await typeIntoFocusedComposer(page, " for login");
await expectComposerDraft(page, "add tests for login");
await pressInComposer(page, "ArrowUp");
await expectComposerDraft(page, "add tests for login");
await sendDraftWhenReady(page);
await expect(userMessages(page)).toHaveCount(3, { timeout: 30_000 });
await expect(userMessages(page).last()).toContainText("add tests for login");
} finally {
await session.cleanup();
}
});
await sendDraftWhenReady(page);
await expect(userMessages(page)).toHaveCount(3, { timeout: 30_000 });
await expect(userMessages(page).last()).toContainText("add tests for login");
});
await test.step("recall a slash message without opening its picker, then edit it", async () => {
await expectComposerDraft(page, "");
const reply = await session.client.waitForFinish(session.agentId, 15_000);
expect(reply.status).toBe("idle");
await expectVisibleAgentSurfacesIdle(page);
await sendAndWaitForMessage(page, "/tdd", 4);
test("a recalled slash message does not open the command picker", async ({ page }) => {
const session = await seedMockAgentWorkspace({
repoPrefix: "composer-recall-slash-",
title: "Composer recall slash",
});
try {
await openAgentRoute(page, session);
await expectComposerVisible(page);
await sendAndWaitForMessage(page, "/tdd", 1);
const popover = page.getByTestId("composer-autocomplete-popover").filter({ visible: true });
await pressInComposer(page, "ArrowUp");
await expectComposerDraft(page, "/tdd");
await expect(popover).toHaveCount(0);
const popover = page.getByTestId("composer-autocomplete-popover").filter({ visible: true });
await pressInComposer(page, "ArrowUp");
await expectComposerDraft(page, "/tdd");
await expect(popover).toHaveCount(0);
await typeIntoFocusedComposer(page, "x");
await expect(popover.first()).toBeVisible({ timeout: 30_000 });
await typeIntoFocusedComposer(page, "x");
await expect(popover.first()).toBeVisible({ timeout: 30_000 });
});
} finally {
await session.cleanup();
}
@@ -21,6 +21,7 @@ import {
openAgent,
pressContextWindowMeter,
qaScreenshot,
recordContextWindowFrames,
refreshUsageCard,
reloadAgent,
scriptAgentUsage,
@@ -299,9 +300,10 @@ for (const theme of ["light", "dark"] as const) {
const slowSource = gate();
usage.answerNext({ stream: [slowSource.promise, onWorkLogin(claude!)] });
const closedEarly = await hoverContextWindowMeter(page);
await expect(closedEarly.getByText("Loading usage...", { exact: true })).toBeVisible();
await expect(usageCard(closedEarly, "claude:work").getByText(LOGIN_EXPIRED)).toBeVisible();
await leaveContextWindowMeter(page);
await usage.resumeAgent(agent);
const resumed = gate();
const finished = gate();
usage.answerNext({
@@ -385,6 +387,58 @@ for (const theme of ["light", "dark"] as const) {
});
}
test("an open with loaded usage paints it in its first frame and never moves", async ({
page,
agent,
}) => {
const [claude] = claudeAndCodexReports();
const usage = await scriptAgentUsage(page);
await page.setViewportSize(DESKTOP);
await openAgent(page, agent);
usage.answerNext([onWorkLogin(claude!)]);
const loaded = await hoverContextWindowMeter(page);
await expect(usageCard(loaded, "claude:work")).toBeVisible();
await leaveContextWindowMeter(page);
// The reopen's own request stays unanswered until the card has been on screen a while.
const refetch = gate();
usage.answerNext({ stream: [refetch.promise, onWorkLogin(claude!)] });
const recording = await recordContextWindowFrames(page);
const reopened = await hoverContextWindowMeter(page);
await page.waitForTimeout(300);
refetch.open();
await page.waitForTimeout(300);
await expect(usageCard(reopened, "claude:work")).toBeVisible();
const frames = (await recording.stop()).filter((frame) => frame.mounted);
await leaveContextWindowMeter(page);
expect(frames.filter((frame) => frame.loading)).toEqual([]);
expect(frames.filter((frame) => frame.usageCards !== 1)).toEqual([]);
expect(new Set(frames.map((frame) => frame.bottom)).size).toBe(1);
});
test("usage arriving after the card opens never moves its bottom edge", async ({ page, agent }) => {
const [claude] = claudeAndCodexReports();
const usage = await scriptAgentUsage(page);
await page.setViewportSize(DESKTOP);
await openAgent(page, agent);
const arrival = gate();
usage.answerNext({ stream: [arrival.promise, onWorkLogin(claude!)] });
const recording = await recordContextWindowFrames(page);
const card = await hoverContextWindowMeter(page);
await expect(card.getByText("Loading usage...", { exact: true })).toBeVisible();
arrival.open();
await expect(usageCard(card, "claude:work")).toBeVisible();
await page.waitForTimeout(300);
const frames = (await recording.stop()).filter((frame) => frame.mounted);
await leaveContextWindowMeter(page);
expect(frames.some((frame) => frame.loading)).toBe(true);
expect(frames.at(-1)?.usageCards).toBe(1);
expect(new Set(frames.map((frame) => frame.bottom)).size).toBe(1);
});
test("context details support keyboard entry and dismiss when the viewport moves", async ({
page,
agent,
@@ -127,8 +127,42 @@ for (const scenario of [
await creation.submitPrompt("Retry this workspace and agent together.");
await creation.expectAgentCount(1);
});
test(`an edited prompt after failed agent initialization starts the agent in its workspace${scenario.suffix}`, async ({
creation,
startup,
page,
}) => {
await creation.openWorkspaceForm("local");
await creation.submitPrompt("Start the original task.", "Create");
await creation.expectAgentStillStarting();
await startup.fail();
await creation.expectStartupFailure();
await creation.expectOneCreatedWorkspace();
await scenario.prepare(creation);
await creation.submitPrompt("Start the edited task.");
await creation.expectPromptVisible("Start the edited task.");
await creation.expectOneCreatedWorkspace();
await creation.expectAgentCount(1);
await expect(page.getByText(/request_key_conflict/)).toHaveCount(0);
});
}
test("an edited agent draft starts after its first start failed", async ({
creation,
startup,
page,
}) => {
await creation.openAgentDraft();
await startup.fail();
await creation.submitPrompt("Start the original task.");
await creation.expectStartupFailure();
await creation.submitPrompt("Start the edited task.");
await creation.expectPromptVisible("Start the edited task.");
await creation.expectAgentCount(1);
await expect(page.getByText(/request_key_conflict/)).toHaveCount(0);
});
for (const entry of [
{
name: "agent draft",
@@ -159,7 +193,9 @@ for (const entry of [
await entry.settled(creation);
await creation.expectCreatedAgentError();
await creation.expectPromptBeforeError(prompt);
await page.screenshot({ path: testInfo.outputPath("created-agent-prompt-error.png") });
await page.screenshot({
path: testInfo.outputPath("created-agent-prompt-error.png"),
});
await creation.reloadAgent();
await creation.expectPromptBeforeError(prompt);
await creation.submitPrompt("emit 1 coalesced agent stream updates for a corrected prompt.");
@@ -13,6 +13,7 @@ import {
ensureExplorerSidebar,
openFilesPanel,
waitForWorkspaceTabsVisible,
dragTabIntoExplorer,
} from "../support/helpers/workspace-tabs";
function explorerSidebar(page: Parameters<typeof ensureExplorerSidebar>[0]) {
@@ -194,26 +195,6 @@ test("Explorer keeps Files and Changes close actions in the context menu", async
}
});
async function dragTabIntoExplorer(
page: Parameters<typeof ensureExplorerSidebar>[0],
tabId: string,
) {
const source = page.getByTestId("workspace-pane-main").getByTestId(`workspace-tab-${tabId}`);
const destination = explorerSidebar(page).getByTestId("workspace-tab-files");
const sourceBox = await source.boundingBox();
const destinationBox = await destination.boundingBox();
if (!sourceBox || !destinationBox)
throw new Error("Tab drag requires visible source and destination");
const start = { x: sourceBox.x + 12, y: sourceBox.y + sourceBox.height / 2 };
await page.mouse.move(start.x, start.y);
await page.mouse.down();
await page.mouse.move(start.x + 12, start.y + 4);
await page.mouse.move(destinationBox.x + 12, destinationBox.y + destinationBox.height / 2, {
steps: 20,
});
await page.mouse.up();
}
test("moves agents into Explorer and keeps the shared Agent launcher available", async ({
page,
}, testInfo) => {
@@ -1,5 +1,11 @@
import { test } from "../support/fixtures";
import { withComposerControlsExample } from "../support/helpers/plugin-composer-items";
import {
expectToolbarNeverCondensedOrClipped,
recordToolbarFramesFromLoad,
withComposerControlsExample,
withPickerComposerItem,
withToggleAndWatcherComposerItems,
} from "../support/helpers/plugin-composer-items";
test("a narrow composer's overflow sheet shows a plugin item's row", async ({ page }) => {
test.setTimeout(120_000);
@@ -10,3 +16,66 @@ test("a narrow composer's overflow sheet shows a plugin item's row", async ({ pa
await composer.expectFeatureRow("Insert checklist");
});
});
test("a toolbar with room keeps a plugin toggle inline at full density", async ({ page }) => {
test.setTimeout(120_000);
await withToggleAndWatcherComposerItems(page, async (composer) => {
// Wider than what renders, too narrow for two 125-wide "Plugin item" estimates.
await composer.setWindowWidth(1000);
await composer.expectToolbarWidthBetween(470, 620);
await composer.expectToggleInlineAtFullDensity();
});
});
test("a toolbar without room moves a plugin toggle to the overflow sheet and back", async ({
page,
}) => {
test.setTimeout(120_000);
await withToggleAndWatcherComposerItems(page, async (composer) => {
await composer.setWindowWidth(1000);
await composer.expectToggleInlineAtFullDensity();
// Too narrow for full labels, wide enough that the controls have not folded away.
await composer.setWindowWidth(880);
await composer.expectToolbarWidthBetween(300, 395);
await composer.expectToggleInOverflow();
await composer.closeOverflowSheet();
await composer.setWindowWidth(1000);
await composer.expectToggleInlineAtFullDensity();
});
});
test("an open plugin picker closes when its trigger moves to the overflow", async ({ page }) => {
test.setTimeout(120_000);
await withPickerComposerItem(page, async (composer) => {
await composer.setWindowWidth(1000);
await composer.openInlinePicker();
await composer.setWindowWidth(880);
await composer.expectToolbarWidthBetween(300, 395);
await composer.expectPickerClosed();
});
});
test("the toolbar settles on one density without flipping as the window widens", async ({
page,
}) => {
test.setTimeout(120_000);
await withToggleAndWatcherComposerItems(page, async (composer) => {
await composer.setWindowWidth(880);
await composer.expectToolbarWidthBetween(300, 395);
await composer.startRecordingDensity();
for (let width = 880; width <= 1000; width += 8) await composer.setWindowWidth(width);
await composer.expectAtMostOneDensityChange();
});
});
test("a toolbar with room never paints condensed or clipped while the plugin loads", async ({
page,
}) => {
test.setTimeout(120_000);
await page.setViewportSize({ width: 1000, height: 800 });
await recordToolbarFramesFromLoad(page);
await withToggleAndWatcherComposerItems(page, async (composer) => {
await composer.expectToggleInlineAtFullDensity();
await expectToolbarNeverCondensedOrClipped(page);
});
});
@@ -2,6 +2,10 @@ import { test } from "../support/fixtures";
import {
CHECKLIST,
withComposerToolsExample,
withPluginFocusingAComposer,
withPluginFocusingASubagent,
withPluginFocusingAnAgentWithContextUsage,
withPluginHoldingNewWorkspaceComposer,
withPluginWritingToAnotherWorkspace,
} from "../support/helpers/plugin-composers-by-reference";
@@ -39,6 +43,17 @@ test("the panel follows which agent is focused", async ({ page }) => {
});
});
test("an Action in the compact controls sheet closes the sheet and focuses the composer", async ({
page,
}) => {
test.setTimeout(120_000);
await withComposerToolsExample(page, async (author) => {
await author.useCompactLayout();
await author.insertChecklistFromControlsSheet();
await author.expectComposerReadyToType(CHECKLIST);
});
});
test("a plugin writes to an agent's composer while its workspace is not on screen", async ({
page,
}) => {
@@ -51,3 +66,158 @@ test("a plugin writes to an agent's composer while its workspace is not on scree
await author.expectComposerText("A note from a plugin");
});
});
test("a pill that inserts text and focuses leaves the cursor in the composer, ready to type", async ({
page,
}) => {
test.setTimeout(120_000);
await withPluginFocusingAComposer(page, async (author) => {
await author.openTargetAgent();
await author.moveFocusOutOfComposer();
await author.pressPill();
await author.expectComposerFocused();
await author.typeAtCursor(" world");
await author.expectComposerText("HELLO world");
});
});
test("focus reaches an agent in another tab of the workspace", async ({ page }) => {
test.setTimeout(120_000);
await withPluginFocusingAComposer(page, async (author) => {
await author.openTargetAgent();
await author.openOtherAgent();
await author.focusFromCommandCenter();
await author.expectOnTargetAgent();
await author.expectComposerFocused();
});
});
test("focus reaches an agent in another workspace, with the selection asked for", async ({
page,
}) => {
test.setTimeout(120_000);
await withPluginFocusingAComposer(page, async (author) => {
await author.openTargetAgent();
await author.fillComposer("typed before");
await author.goToAnotherWorkspace();
await author.selectPromptFromCommandCenter();
await author.expectOnTargetAgent();
await author.expectComposerFocused();
await author.typeAtCursor("replaced");
await author.expectComposerText("replaced");
});
});
test("focus closes the compact Explorer panel covering the composer", async ({ page }) => {
test.setTimeout(120_000);
await withPluginFocusingAComposer(page, async (author) => {
await author.useCompactLayout();
await author.openTargetAgent();
await author.coverComposerWithExplorerPanel();
await author.pressPanelFocusButton();
await author.expectExplorerPanelClosed();
await author.expectComposerFocused();
});
});
test("focus rejects on a New workspace composer the user has left", async ({ page }) => {
test.setTimeout(120_000);
await withPluginHoldingNewWorkspaceComposer(page, async (author) => {
await author.openNewWorkspace();
await author.expectHeldComposerFocusResult("focused");
await author.openSettings();
await author.expectHeldComposerFocusResult("The composer is not on screen.");
});
});
test("focus closes a picker the composer opened over itself", async ({ page }) => {
test.setTimeout(120_000);
await withPluginHoldingNewWorkspaceComposer(page, async (author) => {
await author.openNewWorkspace();
await author.openThinkingPicker();
await author.expectHeldComposerFocusResult("focused");
await author.expectHeldComposerReadyToType();
});
});
test("focus closes an image preview the composer opened over itself", async ({ page }) => {
test.setTimeout(120_000);
await withPluginHoldingNewWorkspaceComposer(page, async (author) => {
await author.openNewWorkspace();
await author.previewAttachedImage();
await author.expectHeldComposerFocusResult("focused");
await author.expectHeldComposerReadyToType();
});
});
test("overlapping focus calls end at the later selection while a preview closes", async ({
page,
}) => {
test.setTimeout(120_000);
await withPluginHoldingNewWorkspaceComposer(page, async (author) => {
await author.openNewWorkspace();
await author.typeInHeldComposer("HELLO");
await author.previewAttachedImage();
await author.expectOverlappingFocusesKeepTheLatestSelection();
});
});
test("focus closes the context usage sheet on a phone", async ({ page }) => {
test.setTimeout(120_000);
await withPluginFocusingAnAgentWithContextUsage(page, async (author) => {
await author.openContextUsageOnPhone();
await author.focusAgent();
await author.expectReadyToType();
});
});
test("focus closes a page the composer's Subagents track opened over it", async ({ page }) => {
test.setTimeout(120_000);
await withPluginFocusingASubagent(page, async (author) => {
await author.openParentAgent();
await author.openSubagentPageInParentComposer();
await author.focusParent();
await author.expectParentReadyToType();
});
});
test("focus reaches a New workspace composer opened from a compact Explorer", async ({ page }) => {
test.setTimeout(120_000);
await withPluginHoldingNewWorkspaceComposer(page, async (author) => {
await author.leaveCompactExplorerForNewWorkspace();
await author.expectHeldComposerFocusResult("focused");
});
});
test("focus opens a compact subagent as a tab with its composer", async ({ page }) => {
test.setTimeout(120_000);
await withPluginFocusingASubagent(page, async (author) => {
await author.openParentAgent();
await author.openExplorer();
await author.focusSubagent();
await author.expectSubagentTabReadyToType();
});
});
test("focus closes a file sheet still opening over an Explorer composer", async ({ page }) => {
test.setTimeout(120_000);
await withPluginFocusingASubagent(page, async (author) => {
await author.keepParentInExplorerOnCompactScreen();
await author.focusParent();
await author.expectParentReadyToType();
await author.focusParentAsAFileSheetOpens();
await author.expectParentReadyToType();
});
});
test("focus reaches an agent kept in the Explorer on a compact screen", async ({ page }) => {
test.setTimeout(120_000);
await withPluginFocusingASubagent(page, async (author) => {
await author.keepParentInExplorerOnCompactScreen();
await author.focusParent();
await author.expectParentReadyToType();
await author.coverExplorerComposerWithFileSheet();
await author.focusParent();
await author.expectParentReadyToType();
});
});
+43 -14
View File
@@ -1,7 +1,14 @@
import { expect, test, type Page } from "../support/fixtures";
import { gotoAppShell, openSettings } from "../support/helpers/app";
import { openSettingsSection } from "../support/helpers/settings";
import { openWhatsNew, release, serveChangelog } from "../support/helpers/changelog";
import {
allChangesToggle,
hideAllChanges,
openWhatsNew,
release,
serveChangelog,
showAllChanges,
} from "../support/helpers/changelog";
const DISCORD_DESTINATION =
/^https:\/\/(?:discord\.gg\/jz8T2uahpH|discord\.com\/invite\/jz8T2uahpH)(?:[/?#]|$)/;
@@ -73,26 +80,30 @@ test("opens troubleshooting and support destinations", async ({ page }) => {
});
test("renders the changelog in the app and links the website", async ({ page }) => {
// A callout, a section name the app has never seen, and a fenced sample whose
// contents look like a release heading.
// Highlights, a section name the app has never seen, a callout, and a fenced
// sample whose contents look like a release heading.
await serveChangelog(page, [
"# Changelog",
"",
"## 9.1.0 - 2026-03-04",
"",
"Headline release note.",
"",
"> [!WARNING]",
"> Read this before upgrading.",
"- **Background tasks:** Paseo now shows the tasks an agent is running.",
"",
"### Sparkles",
"",
"- Added a brand new thing",
"",
"> [!WARNING]",
"> Read this before upgrading.",
"",
"```md",
"## 0.0.0 - 1999-01-01",
"```",
"",
"### Fixed",
"",
"- Fixed a crash",
"",
"## 9.0.0 - 2026-02-01",
"",
"### Fixed",
@@ -104,14 +115,32 @@ test("renders the changelog in the app and links the website", async ({ page })
const sheet = await openWhatsNew(page);
const latest = release(sheet, "9.1.0");
const older = release(sheet, "9.0.0");
await expect(latest.getByText("March 4, 2026", { exact: true })).toBeVisible();
await expect(latest.getByText("Headline release note.")).toBeVisible();
await expect(latest.getByText("Read this before upgrading.")).toBeVisible();
await expect(latest.getByText("Sparkles", { exact: true })).toBeVisible();
await expect(latest.getByText("Added a brand new thing")).toBeVisible();
await expect(release(sheet, "9.0.0")).toBeVisible();
await expect(release(sheet, "0.0.0")).toHaveCount(0);
await test.step("leads a release with its highlights and tucks the rest away", async () => {
await expect(latest.getByText("March 4, 2026", { exact: true })).toBeVisible();
await expect(latest.getByText("Paseo now shows the tasks an agent is running.")).toBeVisible();
await expect(latest.getByText("Added a brand new thing")).toHaveCount(0);
await expect(latest.getByText("Fixed a crash")).toHaveCount(0);
});
await test.step("shows every section on request and tucks them away again", async () => {
await showAllChanges(latest);
await expect(latest.getByText("Sparkles", { exact: true })).toBeVisible();
await expect(latest.getByText("Added a brand new thing")).toBeVisible();
await expect(latest.getByText("Read this before upgrading.")).toBeVisible();
await expect(latest.getByText("Fixed a crash")).toBeVisible();
await expect(release(sheet, "0.0.0")).toHaveCount(0);
await hideAllChanges(latest);
await expect(latest.getByText("Added a brand new thing")).toHaveCount(0);
await expect(latest.getByText("Paseo now shows the tasks an agent is running.")).toBeVisible();
});
await test.step("shows a release without highlights whole", async () => {
await expect(older.getByText("Fixed an older thing")).toBeVisible();
await expect(allChangesToggle(older)).toHaveCount(0);
});
await expectExternalPage(page, "changelog-open-website", CHANGELOG_DESTINATION);
await closeSheet(page, "changelog-sheet");
@@ -146,7 +146,9 @@ async function installPinRpcGate(
}
test.describe("Pin workspace shortcut", () => {
test("dispatches pin once and keeps project creation reachable", async ({ page }) => {
test("pins and unpins across sidebar collapse and keeps project creation reachable", async ({
page,
}) => {
const workspace = await seedWorkspace({
repoPrefix: "pin-project-creation-",
title: "Pinned workspace",
@@ -169,11 +171,27 @@ test.describe("Pin workspace shortcut", () => {
await expect(workspaceRow(page, workspace.workspaceId)).toHaveCount(1);
});
await test.step("keeps the pinned project available to workspace creation", async () => {
await test.step("unpins the active workspace while the Pinned section is collapsed", async () => {
await page.keyboard.press(PIN_SHORTCUT);
await expect(pinnedSection(page)).toBeVisible({ timeout: 10_000 });
expect(gate.sentCount()).toBe(3);
await page.getByTestId("sidebar-pinned-section-header").click();
await expect(workspaceRow(page, workspace.workspaceId)).toHaveCount(0, {
timeout: 10_000,
});
await page.keyboard.press(PIN_SHORTCUT);
await expect(pinnedSection(page)).toHaveCount(0, { timeout: 10_000 });
expect(gate.sentCount()).toBe(4);
await expect(workspaceRow(page, workspace.workspaceId)).toHaveCount(1);
});
await test.step("keeps the pinned project available to workspace creation", async () => {
await page.keyboard.press(PIN_SHORTCUT);
await expect(pinnedSection(page)).toBeVisible({ timeout: 10_000 });
expect(gate.sentCount()).toBe(5);
await openNewWorkspaceComposer(page, workspace);
await expectNewWorkspaceProjectSelected(page, workspace.projectDisplayName);
});
@@ -203,27 +221,6 @@ test.describe("Pin workspace shortcut", () => {
}
});
test("unpins the active workspace while the Pinned section is collapsed", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "pin-shortcut-unpin-" });
try {
await gotoAppShell(page);
await openWorkspace(page, workspace.workspaceId);
await page.keyboard.press(PIN_SHORTCUT);
await expect(pinnedSection(page)).toBeVisible({ timeout: 10_000 });
await page.getByTestId("sidebar-pinned-section-header").click();
await expect(workspaceRow(page, workspace.workspaceId)).toHaveCount(0, { timeout: 10_000 });
await page.keyboard.press(PIN_SHORTCUT);
await expect(pinnedSection(page)).toHaveCount(0, { timeout: 10_000 });
} finally {
await workspace.cleanup();
}
});
test("pins the active workspace while its status group is collapsed", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "pin-shortcut-status-" });
@@ -3,6 +3,7 @@ import { gotoAppShell } from "../support/helpers/app";
import { seedWorkspace } from "../support/helpers/seed-client";
import { openAgentRoute } from "../support/helpers/mock-agent";
import { getServerId } from "../support/helpers/server-id";
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
function workspaceRowTestId(workspaceId: string): string {
return `sidebar-workspace-row-${getServerId()}:${workspaceId}`;
@@ -12,9 +13,13 @@ function workspaceRenameModalTestId(workspaceId: string, suffix: string): string
return `sidebar-workspace-rename-modal-${getServerId()}:${workspaceId}-${suffix}`;
}
async function openRenameModal(page: Page, workspaceId: string) {
function workspaceRenameInputTestId(workspaceId: string): string {
return `sidebar-workspace-rename-input-${getServerId()}:${workspaceId}`;
}
async function chooseRenameFromKebab(page: Page, workspaceId: string): Promise<void> {
const serverId = getServerId();
const row = page.getByTestId(`sidebar-workspace-row-${serverId}:${workspaceId}`);
const row = page.getByTestId(workspaceRowTestId(workspaceId));
await expect(row).toBeVisible({ timeout: 30_000 });
await row.hover();
@@ -25,40 +30,87 @@ async function openRenameModal(page: Page, workspaceId: string) {
const renameItem = page.getByTestId(`sidebar-workspace-menu-rename-${serverId}:${workspaceId}`);
await expect(renameItem).toBeVisible({ timeout: 10_000 });
await renameItem.click();
}
const input = page.getByTestId(workspaceRenameModalTestId(workspaceId, "input"));
await expect(input).toBeVisible({ timeout: 10_000 });
return input;
/** Lets the app render a server message the gate just forwarded. */
async function waitForTwoFrames(page: Page): Promise<void> {
await page.evaluate(async () => {
const nextFrame = () => new Promise((resolve) => requestAnimationFrame(resolve));
await nextFrame();
await nextFrame();
});
}
type DaemonWebSocketGate = Awaited<ReturnType<typeof installDaemonWebSocketGate>>;
/** Sets the title from a second daemon client and waits until this page has rendered it. */
async function renameFromAnotherClient(
page: Page,
gate: DaemonWebSocketGate,
workspace: Awaited<ReturnType<typeof seedWorkspace>>,
title: string,
): Promise<void> {
gate.holdNextServerMessage("workspace_update");
await workspace.client.setWorkspaceTitle(workspace.workspaceId, title);
await gate.waitForHeldServerMessage("workspace_update");
gate.releaseHeldServerMessage("workspace_update");
await waitForTwoFrames(page);
}
interface Box {
x: number;
y: number;
width: number;
height: number;
}
async function rowBox(page: Page, workspaceId: string): Promise<Box> {
const box = await page.getByTestId(workspaceRowTestId(workspaceId)).boundingBox();
if (!box) throw new Error(`sidebar row ${workspaceId} has no layout box`);
return box;
}
// In Model B the workspace title is its identity: renaming sets a custom title
// layered over the derived branch/directory name, and reconciliation never
// touches it. The sidebar row shows the title verbatim — no branch mutation.
test.describe("Sidebar workspace rename", () => {
test("renaming via kebab sets a custom title that survives reload", async ({ page }) => {
test("renaming in place sets a custom title without moving the row, and survives reload", async ({
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-" });
try {
expect(workspace.workspaceName).toBe("main");
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
await expect(page.getByTestId(workspaceRowTestId(workspace.workspaceId))).toBeVisible({
timeout: 30_000,
});
const restingBox = await rowBox(page, workspace.workspaceId);
const input = await openRenameModal(page, workspace.workspaceId);
await chooseRenameFromKebab(page, workspace.workspaceId);
const input = page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId));
await expect(input).toBeFocused();
await expect(input).toBeEditable();
await expect(input).toHaveValue("main");
await expect(
page.getByTestId(workspaceRenameModalTestId(workspace.workspaceId, "input")),
).toHaveCount(0);
expect(await rowBox(page, workspace.workspaceId)).toEqual(restingBox);
const customTitle = "Payments Refactor";
await input.fill(customTitle);
await page.getByTestId(workspaceRenameModalTestId(workspace.workspaceId, "submit")).click();
// The whole title is selected, so typing replaces it.
await page.keyboard.type(customTitle);
expect(await rowBox(page, workspace.workspaceId)).toEqual(restingBox);
await page.keyboard.press("Enter");
await expect(input).toHaveCount(0, { timeout: 15_000 });
// The title is shown exactly as typed — not slugified into a branch name.
await expect(page.getByTestId(workspaceRowTestId(workspace.workspaceId))).toContainText(
customTitle,
{ timeout: 15_000 },
);
expect(await rowBox(page, workspace.workspaceId)).toEqual(restingBox);
// The custom title is backing metadata on the workspace: a full reload
// re-resolves the descriptor from persistence and must not lose it. This
@@ -73,6 +125,259 @@ test.describe("Sidebar workspace rename", () => {
await workspace.cleanup();
}
});
test("Escape discards an in-place rename and clicking away saves it", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-blur-" });
try {
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
const row = page.getByTestId(workspaceRowTestId(workspace.workspaceId));
const input = page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId));
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
await page.keyboard.type("Discarded title");
await page.keyboard.press("Escape");
await expect(input).toHaveCount(0);
await expect(row).toContainText("main");
await expect(row).not.toContainText("Discarded title");
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
// Clicking inside the field places the caret; it does not press the row underneath.
await input.click();
await expect(input).toBeFocused();
await input.fill("Saved on blur");
// Click empty space in the main pane, away from any control.
await page.mouse.click(900, 700);
await expect(input).toHaveCount(0, { timeout: 15_000 });
await expect(row).toContainText("Saved on blur");
} finally {
await workspace.cleanup();
}
});
test("the submitted title stays on screen until the renamed workspace arrives", async ({
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-hold-" });
try {
const gate = await installDaemonWebSocketGate(page);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
const row = page.getByTestId(workspaceRowTestId(workspace.workspaceId));
const input = page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId));
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
await page.keyboard.type("Held title");
// The daemon answers the rename before it pushes the renamed workspace.
gate.holdNextServerMessage("workspace_update");
await page.keyboard.press("Enter");
await gate.waitForHeldServerMessage("workspace_update");
await expect(input).toHaveValue("Held title");
await expect(input).not.toBeEditable();
await expect(row).not.toContainText("main");
gate.releaseHeldServerMessage("workspace_update");
await expect(input).toHaveCount(0);
await expect(row).toContainText("Held title");
} finally {
await workspace.cleanup();
}
});
test("an untouched in-place rename keeps a title set elsewhere while it was open", async ({
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-external-" });
try {
const gate = await installDaemonWebSocketGate(page);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
const row = page.getByTestId(workspaceRowTestId(workspace.workspaceId));
const input = page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId));
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
await expect(input).toHaveValue("main");
await renameFromAnotherClient(page, gate, workspace, "External title");
await page.mouse.click(900, 700);
await expect(input).toHaveCount(0);
await expect(row).toContainText("External title");
expect(gate.getClientRequestCount("workspace.title.set.request")).toBe(0);
} finally {
await workspace.cleanup();
}
});
test("saving after a rename elsewhere holds the submitted title until it arrives", async ({
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-external-save-" });
try {
const gate = await installDaemonWebSocketGate(page);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
const row = page.getByTestId(workspaceRowTestId(workspace.workspaceId));
const input = page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId));
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
await renameFromAnotherClient(page, gate, workspace, "External title");
await input.fill("Submitted title");
gate.holdNextServerMessage("workspace_update");
await page.keyboard.press("Enter");
await gate.waitForHeldServerMessage("workspace_update");
await expect(input).toHaveValue("Submitted title");
await expect(row).not.toContainText("External title");
gate.releaseHeldServerMessage("workspace_update");
await expect(input).toHaveCount(0);
await expect(row).toContainText("Submitted title");
} finally {
await workspace.cleanup();
}
});
test("submitting the title another client just set closes the field", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-external-same-" });
try {
const gate = await installDaemonWebSocketGate(page);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
const row = page.getByTestId(workspaceRowTestId(workspace.workspaceId));
const input = page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId));
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
await renameFromAnotherClient(page, gate, workspace, "External title");
// The daemon accepts it, but the title does not change, so no renamed workspace follows.
await input.fill("External title");
await page.keyboard.press("Enter");
await expect(input).toHaveCount(0);
await expect(row).toContainText("External title");
// The row is a row again: its menu opens and renames.
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
} finally {
await workspace.cleanup();
}
});
test("a rename elsewhere delivered while saving does not close the field", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-external-pending-" });
try {
const gate = await installDaemonWebSocketGate(page);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
const row = page.getByTestId(workspaceRowTestId(workspace.workspaceId));
const input = page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId));
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
await input.fill("Submitted title");
// Another client's rename lands just before ours. The page receives, in daemon order: that
// rename, our response, our renamed workspace. Each is held until the previous is rendered.
gate.holdNextServerMessage("workspace_update");
await workspace.client.setWorkspaceTitle(workspace.workspaceId, "External title");
await gate.waitForHeldServerMessage("workspace_update");
gate.holdNextServerMessage("workspace.title.set.response");
gate.holdNextServerMessage("workspace_update");
await page.keyboard.press("Enter");
await gate.waitForHeldServerMessage("workspace.title.set.response");
// Releases the oldest held update: the other client's. Ours stays held behind it.
gate.releaseHeldServerMessage("workspace_update");
await gate.waitForHeldServerMessage("workspace_update");
await waitForTwoFrames(page);
await expect(input).toHaveValue("Submitted title");
gate.releaseHeldServerMessage("workspace.title.set.response");
await waitForTwoFrames(page);
await expect(input).toHaveValue("Submitted title");
await expect(row).not.toContainText("External title");
gate.releaseHeldServerMessage("workspace_update");
await expect(input).toHaveCount(0);
await expect(row).toContainText("Submitted title");
} finally {
await workspace.cleanup();
}
});
test("a later rename that replaces the saved title closes the field", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-superseded-" });
try {
const gate = await installDaemonWebSocketGate(page);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
const row = page.getByTestId(workspaceRowTestId(workspace.workspaceId));
const input = page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId));
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
await input.fill("Submitted title");
// The daemon builds each update from its latest record, so a rename that lands after ours
// is accepted can be published in its place. Our update stays held: the page never sees it.
gate.holdNextServerMessage("workspace.title.set.response");
gate.holdNextServerMessage("workspace_update");
await page.keyboard.press("Enter");
await gate.waitForHeldServerMessage("workspace.title.set.response");
await gate.waitForHeldServerMessage("workspace_update");
gate.releaseHeldServerMessage("workspace.title.set.response");
await waitForTwoFrames(page);
await expect(input).toHaveValue("Submitted title");
await workspace.client.setWorkspaceTitle(workspace.workspaceId, "Later title");
await expect(input).toHaveCount(0);
await expect(row).toContainText("Later title");
await chooseRenameFromKebab(page, workspace.workspaceId);
await expect(input).toBeFocused();
} finally {
await workspace.cleanup();
}
});
test("below the lg breakpoint renaming opens the modal", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-modal-" });
try {
await page.setViewportSize({ width: 800, height: 800 });
await gotoAppShell(page);
await chooseRenameFromKebab(page, workspace.workspaceId);
const input = page.getByTestId(workspaceRenameModalTestId(workspace.workspaceId, "input"));
await expect(input).toBeVisible({ timeout: 10_000 });
await expect(page.getByTestId(workspaceRenameInputTestId(workspace.workspaceId))).toHaveCount(
0,
);
await input.fill("Modal Title");
await page.getByTestId(workspaceRenameModalTestId(workspace.workspaceId, "submit")).click();
await expect(input).toHaveCount(0, { timeout: 15_000 });
await expect(page.getByTestId(workspaceRowTestId(workspace.workspaceId))).toContainText(
"Modal Title",
);
} finally {
await workspace.cleanup();
}
});
});
async function toggleBackgroundWorkspaces(page: Page): Promise<void> {
@@ -0,0 +1,142 @@
import type { Page } from "@playwright/test";
import { expect, test } from "../support/fixtures";
import { expectAgentIdle } from "../support/helpers/agent-stream";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
// A long user message paints capped, with its fade and Show more, in the frame it mounts in. These
// tests sample every painted frame from before the chat opens and require each long message to
// show one state, the settled one, for its whole life on screen.
interface PreviewFrame {
height: number;
fade: boolean;
control: string | null;
}
declare global {
interface Window {
__previewFrames?: Record<string, PreviewFrame[]>;
}
}
function longPrompt(name: string) {
return Array.from({ length: 40 }, (_, line) => `${name} line ${line + 1}`).join("\n");
}
async function recordPreviewFrames(page: Page) {
await page.addInitScript(() => {
const frames: Record<string, PreviewFrame[]> = {};
window.__previewFrames = frames;
const sample = () => {
for (const row of document.querySelectorAll('[data-testid="user-message"]')) {
const rect = row.getBoundingClientRect();
if (rect.height === 0) continue;
const text = row.querySelector('[data-message-text="true"]');
if (!text) continue;
const name = (text.textContent ?? "").split(" line ")[0];
// The preview is the ancestor that carries the height cap; the fade paints inside it.
let preview = text.parentElement;
while (preview && preview !== row && getComputedStyle(preview).maxHeight === "none") {
preview = preview.parentElement;
}
const control = [...row.querySelectorAll("*")].find(
(node) => node.children.length === 0 && /^Show (more|less)$/.test(node.textContent ?? ""),
);
const frame = {
height: Math.round(rect.height),
fade: preview !== null && preview !== row && preview.querySelector("svg") !== null,
control: control?.textContent ?? null,
};
const seen = (frames[name] ??= []);
if (JSON.stringify(seen.at(-1)) !== JSON.stringify(frame)) seen.push(frame);
}
requestAnimationFrame(sample);
};
requestAnimationFrame(sample);
});
}
async function expectPaintedCollapsedFromFirstFrame(page: Page, name: string) {
const message = page.getByTestId("user-message").filter({ hasText: `${name} line 1` });
await expect(message.getByRole("button", { name: "Show more" })).toBeVisible();
// Let any late measurement land before reading the frames.
await page.waitForTimeout(500);
const frames = await page.evaluate((key) => window.__previewFrames?.[key] ?? [], name);
expect(frames).toEqual([{ height: expect.any(Number), fade: true, control: "Show more" }]);
}
test.describe("long user message preview", () => {
test("opening a chat paints its long message collapsed from the first frame", async ({
page,
}) => {
const agent = await seedMockAgentWorkspace({
repoPrefix: "user-message-open-",
title: "Preview open",
initialPrompt: longPrompt("Opened prompt"),
});
try {
await agent.client.waitForFinish(agent.agentId, 30_000);
await recordPreviewFrames(page);
await openAgentRoute(page, agent);
await expectPaintedCollapsedFromFirstFrame(page, "Opened prompt");
await page.reload();
await expectPaintedCollapsedFromFirstFrame(page, "Opened prompt");
} finally {
await agent.cleanup();
}
});
test("a long message arriving in an open chat paints collapsed from the first frame", async ({
page,
}) => {
const agent = await seedMockAgentWorkspace({
repoPrefix: "user-message-arrive-",
title: "Preview arrive",
initialPrompt: "short",
});
try {
await agent.client.waitForFinish(agent.agentId, 30_000);
await recordPreviewFrames(page);
await openAgentRoute(page, agent);
await expectAgentIdle(page);
await agent.client.sendAgentMessage(agent.agentId, longPrompt("Arrived prompt"));
await expectPaintedCollapsedFromFirstFrame(page, "Arrived prompt");
} finally {
await agent.cleanup();
}
});
test("a long message that arrived while its tab was hidden paints collapsed on return", async ({
page,
}) => {
const agent = await seedMockAgentWorkspace({
repoPrefix: "user-message-hidden-",
title: "Preview first",
initialPrompt: "short",
});
try {
await agent.client.createAgent({
provider: "mock",
cwd: agent.cwd,
workspaceId: agent.workspaceId,
title: "Preview second",
modeId: "load-test",
model: "e2e-fast-stream",
});
await agent.client.waitForFinish(agent.agentId, 30_000);
await recordPreviewFrames(page);
await openAgentRoute(page, agent);
await expectAgentIdle(page);
await page.getByRole("button", { name: "Preview second", exact: true }).click();
await agent.client.sendAgentMessage(agent.agentId, longPrompt("Hidden prompt"));
await agent.client.waitForFinish(agent.agentId, 30_000);
await page.getByRole("button", { name: "Preview first", exact: true }).click();
await expectPaintedCollapsedFromFirstFrame(page, "Hidden prompt");
} finally {
await agent.cleanup();
}
});
});
@@ -0,0 +1,32 @@
import { expect, test } from "../support/fixtures";
import { clickNewTerminal, gotoWorkspace } from "../support/helpers/launcher";
import { seedWorkspace } from "../support/helpers/seed-client";
import { waitForWorkspaceTabsVisible } from "../support/helpers/workspace-tabs";
// The browser owns Cmd+Shift+brackets for its own tabs, so web keeps
// Alt+Shift+brackets on every OS. Desktop bindings live in the desktop suite.
test("web switches to the previous and next tab with Alt+Shift+[ and ]", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "tab-relative-web-" });
try {
await gotoWorkspace(page, workspace.workspaceId);
await waitForWorkspaceTabsVisible(page);
const terminalTabs = page
.locator('[data-testid^="workspace-tab-terminal_"]')
.filter({ visible: true });
await clickNewTerminal(page);
await expect(terminalTabs).toHaveCount(1, { timeout: 30_000 });
await clickNewTerminal(page);
await expect(terminalTabs).toHaveCount(2, { timeout: 30_000 });
const first = terminalTabs.nth(0);
const second = terminalTabs.nth(1);
await expect(second).toHaveAttribute("aria-selected", "true");
await page.keyboard.press("Alt+Shift+BracketLeft");
await expect(first).toHaveAttribute("aria-selected", "true");
await page.keyboard.press("Alt+Shift+BracketRight");
await expect(second).toHaveAttribute("aria-selected", "true");
} finally {
await workspace.cleanup();
}
});
@@ -50,73 +50,64 @@ async function readClipboard(page: Page): Promise<string> {
return page.evaluate(() => navigator.clipboard.readText());
}
test.describe("Workspace terminal tab rename", () => {
test("right-click copy terminal id writes the terminal id to the clipboard", async ({
context,
page,
}) => {
test.setTimeout(60_000);
function terminalTab(page: Page, terminalId: string) {
return page.getByTestId(`workspace-tab-terminal_${terminalId}`).first();
}
const workspace = await seedWorkspace({ repoPrefix: "workspace-terminal-copy-id-" });
let terminalId: string | null = null;
async function copyTerminalId(page: Page, terminalId: string): Promise<void> {
const tab = terminalTab(page, terminalId);
await expect(tab).toBeVisible({ timeout: 15_000 });
await tab.click({ button: "right" });
const copy = page.getByRole("menuitem", { name: /^Copy terminal id/ });
await expect(copy).toBeVisible({ timeout: 10_000 });
await copy.click();
}
try {
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
await gotoWorkspace(page, workspace.workspaceId);
await clickNewTerminal(page);
terminalId = await waitForCreatedTerminalId(workspace);
async function renameTerminalTab(page: Page, terminalId: string, title: string): Promise<void> {
const tab = terminalTab(page, terminalId);
await expect(tab).toBeVisible({ timeout: 15_000 });
await tab.click({ button: "right" });
const rename = page.getByRole("menuitem", { name: "Rename", exact: true });
await expect(rename).toBeVisible({ timeout: 10_000 });
await rename.click();
const tab = page.getByTestId(`workspace-tab-terminal_${terminalId}`).first();
await expect(tab).toBeVisible({ timeout: 15_000 });
const modalPrefix = `workspace-tab-rename-modal-terminal-${terminalId}`;
const input = renameModalInput(page, modalPrefix);
await expect(input).toBeVisible({ timeout: 10_000 });
await input.fill(title);
await renameModalSubmit(page, modalPrefix).click();
await expect(input).toHaveCount(0, { timeout: 15_000 });
}
await tab.click({ button: "right" });
const copyTerminalId = page.getByRole("menuitem", {
name: /^Copy terminal id/,
test("terminal context menu copies its ID and persists a renamed title", async ({
context,
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "workspace-terminal-rename-" });
let terminalId: string | null = null;
try {
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
await gotoWorkspace(page, workspace.workspaceId);
await clickNewTerminal(page);
const createdTerminalId = await waitForCreatedTerminalId(workspace);
terminalId = createdTerminalId;
await test.step("copy the terminal ID from its tab", async () => {
await copyTerminalId(page, createdTerminalId);
await expect.poll(() => readClipboard(page)).toBe(createdTerminalId);
});
await test.step("rename the same terminal and read back its saved title", async () => {
await renameTerminalTab(page, createdTerminalId, "My Renamed Terminal");
await expect(terminalTab(page, createdTerminalId)).toContainText("My Renamed Terminal", {
timeout: 15_000,
});
await expect(copyTerminalId).toBeVisible({ timeout: 10_000 });
await copyTerminalId.click();
await expect.poll(() => readClipboard(page)).toBe(terminalId);
} finally {
await cleanupTerminal(workspace, terminalId);
}
});
test("right-click rename persists the terminal title and updates the tab label", async ({
page,
}) => {
test.setTimeout(60_000);
const workspace = await seedWorkspace({ repoPrefix: "workspace-terminal-rename-" });
let terminalId: string | null = null;
try {
await gotoWorkspace(page, workspace.workspaceId);
await clickNewTerminal(page);
terminalId = await waitForCreatedTerminalId(workspace);
const tab = page.getByTestId(`workspace-tab-terminal_${terminalId}`).first();
await expect(tab).toBeVisible({ timeout: 15_000 });
await tab.click({ button: "right" });
const renameItem = page.getByRole("menuitem", { name: "Rename", exact: true });
await expect(renameItem).toBeVisible({ timeout: 10_000 });
await renameItem.click();
const modalPrefix = `workspace-tab-rename-modal-terminal-${terminalId}`;
const input = renameModalInput(page, modalPrefix);
await expect(input).toBeVisible({ timeout: 10_000 });
await input.fill("My Renamed Terminal");
await renameModalSubmit(page, modalPrefix).click();
await expect(input).toHaveCount(0, { timeout: 15_000 });
await expect(tab).toContainText("My Renamed Terminal", { timeout: 15_000 });
await expect
.poll(() => fetchTerminalTitle(workspace, terminalId!))
.poll(() => fetchTerminalTitle(workspace, createdTerminalId))
.toBe("My Renamed Terminal");
} finally {
await cleanupTerminal(workspace, terminalId);
}
});
});
} finally {
await cleanupTerminal(workspace, terminalId);
}
});
@@ -0,0 +1,56 @@
import { test, expect } from "../support/fixtures";
import { openAgentRoute } from "../support/helpers/mock-agent";
import {
readReactRenders,
recordReactRenders,
resetReactRenders,
} from "../support/helpers/react-renders";
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
async function createMockAgent(workspace: SeededWorkspace, title: string): Promise<string> {
const agent = await workspace.client.createAgent({
provider: "mock",
cwd: workspace.repoPath,
workspaceId: workspace.workspaceId,
title,
modeId: "load-test",
model: "e2e-fast-stream",
});
return agent.id;
}
test.describe("Updates to agents in other workspaces", () => {
let open: SeededWorkspace;
let other: SeededWorkspace;
test.afterEach(async () => {
await open?.cleanup();
await other?.cleanup();
});
test("do not re-render the open workspace screen", async ({ page }) => {
open = await seedWorkspace({ repoPrefix: "unrelated-update-open-", title: "Open" });
other = await seedWorkspace({ repoPrefix: "unrelated-update-other-", title: "Other" });
const openAgentId = await createMockAgent(open, "Open agent");
const otherAgentId = await createMockAgent(other, "Other agent");
await recordReactRenders(page);
await openAgentRoute(page, { workspaceId: open.workspaceId, agentId: openAgentId });
await expect(
page.getByTestId(`workspace-tab-agent_${openAgentId}`).filter({ visible: true }).first(),
).toBeVisible({ timeout: 60_000 });
await page.waitForTimeout(2_000);
await resetReactRenders(page);
await other.client.sendAgentMessage(otherAgentId, "update");
await other.client.waitForFinish(otherAgentId, 60_000);
// The favicon follows every agent on the host, so it renders when the other agent runs and
// settles. That confirms the updates reached this page.
await expect
.poll(async () => (await readReactRenders(page)).FaviconStatusSync ?? 0)
.toBeGreaterThan(0);
const renders = await readReactRenders(page);
expect(renders.WorkspaceScreenContent ?? 0).toBe(0);
});
});
@@ -1,7 +1,6 @@
import { randomUUID } from "node:crypto";
import { execFileSync } from "node:child_process";
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import {
restoreArchivedWorkspace,
@@ -300,9 +299,7 @@ test.describe("Worktree restore", () => {
).toHaveText(switchedBranch, { timeout: 30_000 });
});
test("restores the workspace before explicitly unarchiving each selected agent", async ({
page,
}) => {
test("restores the workspace and all agents closed by its archive", async ({ page }) => {
const { agents, worktree } = await createArchivedMissingWorktree("restore-agents", {
agentCount: 2,
keepAgentsArchived: true,
@@ -330,13 +327,11 @@ test.describe("Worktree restore", () => {
await expect(
page.getByTestId(`workspace-tab-agent_${firstAgent.id}`).filter({ visible: true }).first(),
).toHaveAttribute("aria-selected", "true");
expect(await fetchAgentArchivedAt(client, firstAgent.id)).not.toBeNull();
expect(await fetchAgentArchivedAt(client, secondAgent.id)).not.toBeNull();
await page.getByRole("button", { name: "Unarchive", exact: true }).click();
await expect
.poll(() => fetchAgentArchivedAt(client, firstAgent.id), { timeout: 30_000 })
.toBeNull();
expect(await fetchAgentArchivedAt(client, secondAgent.id)).not.toBeNull();
await expect.poll(() => fetchAgentArchivedAt(client, firstAgent.id)).toBeNull();
await expect.poll(() => fetchAgentArchivedAt(client, secondAgent.id)).toBeNull();
await expect(
page.getByTestId(`workspace-tab-agent_${secondAgent.id}`).filter({ visible: true }).first(),
).toBeVisible();
await expect(page.getByRole("button", { name: "Unarchive" })).toHaveCount(0, {
timeout: 30_000,
});
@@ -346,13 +341,8 @@ test.describe("Worktree restore", () => {
await expect(
page.getByTestId(`workspace-tab-agent_${secondAgent.id}`).filter({ visible: true }).first(),
).toBeVisible({ timeout: 30_000 });
await expect(page.getByRole("button", { name: "Unarchive" })).toBeVisible({
timeout: 30_000,
});
await page.getByRole("button", { name: "Unarchive" }).click();
await expect
.poll(() => fetchAgentArchivedAt(client, secondAgent.id), { timeout: 30_000 })
.toBeNull();
await expect(page.getByRole("button", { name: "Unarchive" })).toHaveCount(0);
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeEditable();
});
test("restores a branchless workspace so its archived agent can be used again", async ({
@@ -410,12 +400,7 @@ test.describe("Worktree restore", () => {
await expect
.poll(() => existsSync(backingWorktree.workspaceDirectory), { timeout: 30_000 })
.toBe(true);
await expect(page.getByRole("button", { name: "Unarchive", exact: true })).toBeVisible({
timeout: 30_000,
});
await captureBranchlessRestoreStep(page, "02-unarchive-agent.png");
await page.getByRole("button", { name: "Unarchive", exact: true }).click();
await expect(page.getByRole("button", { name: "Unarchive", exact: true })).toHaveCount(0);
await expect.poll(() => fetchAgentArchivedAt(client, agent.id)).toBeNull();
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeEditable();
await captureBranchlessRestoreStep(page, "03-agent-ready.png");
@@ -506,7 +491,11 @@ test.describe("Worktree restore", () => {
});
async function captureBranchlessRestoreStep(page: Page, filename: string): Promise<void> {
const screenshotDirectory = path.join(tmpdir(), "paseo-branchless-restore-evidence");
const screenshotDirectory = path.join(
process.cwd(),
".artifacts",
"paseo-branchless-restore-evidence",
);
mkdirSync(screenshotDirectory, { recursive: true });
await page.screenshot({ path: path.join(screenshotDirectory, filename), fullPage: true });
}
@@ -85,6 +85,20 @@ agent-device test packages/app/e2e/mobile/modal-sheet/model-tablet.android.ad \
--artifacts-dir /tmp/paseo-model-tablet-qa
```
`model-tablet-profile.android.ad` taps the `+` of a model row in New workspace, asserts the seeded
profile form opens, and asserts that closing the form leaves the remembered model selected. Run it
on the same tablet setup, after `model-tablet.android.ad` or with `MODEL_LABEL` remembered, against a
host with no agent profiles: with a profile saved, the picker opens on its root view, which has no
Back. Set `PROFILE_MODEL_ID` to a different model on the provider's first page:
```sh
agent-device test packages/app/e2e/mobile/modal-sheet/model-tablet-profile.android.ad \
--serial "$ANDROID_SERIAL" --metro-port "$MODEL_QA_METRO_PORT" \
--env FORM_URL="paseo://new?serverId=${SHEET_QA_SERVER_ID}" \
--env PROVIDER_ID=codex --env MODEL_LABEL="$MODEL_QA_MODEL_LABEL" \
--env PROFILE_MODEL_ID="$MODEL_QA_PROFILE_MODEL_ID"
```
The existing-agent journey needs the sidebar pinned so its composer stays narrow. Start each run with no modal open;
a failed provider tap leaves its modal open, so dismiss it before the next run. These host-dependent
journeys remain outside the default mobile suite, alongside the compact sheet journeys above.
@@ -0,0 +1,22 @@
# Connected host with MODEL_LABEL selected and no agent profiles, 1600x2560 at density 320. See README.md.
# FORM_URL=paseo://new?serverId=<serverId>; PROFILE_MODEL_ID is another catalog model with no profile.
context platform=android timeout=60000 retries=0
env APP_ID=sh.paseo.debug
env PROVIDER_ID=codex
open "${APP_ID}" "${FORM_URL}"
wait "label=\"Workspace project\"" 20000
press "id=\"combined-model-selector\""
wait "id=\"combobox-desktop-container\"" 10000
# A remembered model opens its provider's list. Return to the provider page first.
press "label=\"Back\""
wait "id=\"model-provider-${PROVIDER_ID}\"" 10000
press "id=\"model-provider-${PROVIDER_ID}\""
wait "id=\"compact-model-list\"" 3000
# The row's profile action sits inside Android's independent scroll viewport.
press "id=\"model-create-profile-${PROVIDER_ID}-${PROFILE_MODEL_ID}\""
wait "text=\"Add agent profile\"" 5000
# Closing the form keeps the remembered model: the tap did not also select the row.
back
wait "id=\"combined-model-selector\" label=\"Select model (${MODEL_LABEL})\"" 3000
close
@@ -505,10 +505,14 @@ export async function expectCreateProfileFromModelRow(
page: Page,
input: { provider: string; modelId: string; modelLabel: string },
): Promise<void> {
const action = pickerViewport(page).getByTestId(
`model-create-profile-${input.provider}-${input.modelId}`,
);
// Until its row is hovered the plus is invisible, so a tap on its spot reaches the row.
await expect(action).toHaveCSS("pointer-events", "none");
await modelRow(page, input).hover();
await pickerViewport(page)
.getByTestId(`model-create-profile-${input.provider}-${input.modelId}`)
.click();
await expect(action).toHaveCSS("pointer-events", "auto");
await action.click();
const modal = editModal(page);
await expect(modal).toBeVisible({ timeout: 30_000 });
await expect(modal.getByRole("textbox", { name: "Name", exact: true })).toHaveValue(
@@ -27,3 +27,18 @@ export async function openWhatsNew(page: Page): Promise<Locator> {
export function release(sheet: Locator, version: string): Locator {
return sheet.getByTestId(`changelog-release-${version}`);
}
/** The one control a release with highlights has for its sections, in either state. */
export function allChangesToggle(entry: Locator): Locator {
return entry.getByRole("button", { name: /^(Show|Hide) all changes$/ });
}
export async function showAllChanges(entry: Locator): Promise<void> {
await entry.getByRole("button", { name: "Show all changes" }).click();
await expect(entry.getByRole("button", { name: "Hide all changes" })).toBeVisible();
}
export async function hideAllChanges(entry: Locator): Promise<void> {
await entry.getByRole("button", { name: "Hide all changes" }).click();
await expect(entry.getByRole("button", { name: "Show all changes" })).toBeVisible();
}
@@ -49,6 +49,83 @@ export async function moveOntoContextWindowDetails(page: Page, card: Locator): P
await page.mouse.move(meter.x + meter.width / 2, box.y + box.height / 2, { steps: 20 });
}
/** The hover card as one painted frame showed it, or unmounted. */
export interface ContextWindowFrame {
mounted: boolean;
bottom: number | null;
loading: boolean;
usageCards: number;
}
/**
* Reads the hover card as it was painted, every frame, until stopped, so a state that lasted one
* frame is seen. Stop it only after everything has settled.
*/
export async function recordContextWindowFrames(
page: Page,
): Promise<{ stop: () => Promise<ContextWindowFrame[]> }> {
await page.evaluate(() => {
const recorder = window as unknown as {
__contextWindowFrames: ContextWindowFrame[];
__contextWindowRecording: boolean;
};
recorder.__contextWindowFrames = [];
recorder.__contextWindowRecording = true;
const findCard = () =>
document.querySelector<HTMLElement>('[data-testid="context-window-details"]');
const read = (card: HTMLElement | null): ContextWindowFrame => ({
mounted: card !== null,
bottom: card?.getBoundingClientRect().bottom ?? null,
loading: card?.innerText.includes("Loading usage...") ?? false,
usageCards: card?.querySelectorAll('[data-testid^="usage-report-"]').length ?? 0,
});
// A card that just resized has not been painted yet: its frame is read from an observer,
// which runs before that paint.
let watched: HTMLElement | null = null;
let paintedHeight: number | null = null;
let observer: ResizeObserver | null = null;
const watch = (card: HTMLElement) => {
observer = new ResizeObserver(() => {
paintedHeight = card.offsetHeight;
recorder.__contextWindowFrames.push(read(card));
});
observer.observe(card);
};
const channel = new MessageChannel();
// A message posted from an animation frame runs after that frame's paint.
channel.port1.addEventListener("message", () => {
const card = findCard();
if (card !== watched) {
observer?.disconnect();
watched = card;
paintedHeight = null;
if (card) watch(card);
}
if (!card || card.offsetHeight === paintedHeight) {
recorder.__contextWindowFrames.push(read(card));
}
});
channel.port1.start();
const sample = () => {
if (!recorder.__contextWindowRecording) return;
channel.port2.postMessage(null);
requestAnimationFrame(sample);
};
requestAnimationFrame(sample);
});
return {
stop: () =>
page.evaluate(() => {
const recorder = window as unknown as {
__contextWindowFrames: ContextWindowFrame[];
__contextWindowRecording: boolean;
};
recorder.__contextWindowRecording = false;
return recorder.__contextWindowFrames;
}),
};
}
export async function leaveContextWindowMeter(page: Page): Promise<void> {
await page.mouse.move(0, 0);
await expect(contextWindowDetails(page)).toHaveCount(0);
@@ -139,6 +216,8 @@ export interface AgentUsageScript {
agentRequests(): string[];
/** Each scoped agent Refresh, by agent ID. */
refreshedAgents(): string[];
/** Reloads the agent's session, which starts it under a new usage scope, as a resume does. */
resumeAgent(agent: MockAgentSession): Promise<void>;
}
/**
@@ -169,6 +248,8 @@ export async function scriptAgentUsage(page: Page): Promise<AgentUsageScript> {
usage
.listRequests()
.flatMap((request) => (request.forceRefresh && request.agentId ? [request.agentId] : [])),
resumeAgent: (agent) =>
usage.untilUsageScopeChanges(agent.agentId, () => agent.client.refreshAgent(agent.agentId)),
};
}
+6 -1
View File
@@ -142,6 +142,8 @@ export async function createCreationScenario(page: Page) {
const requests = await observeCreationRequests(page);
const project = await seedWorkspace({ repoPrefix: "creation-idempotency-" });
let workspaceId = project.workspaceId;
// Workspaces the scenario opens itself to evict the deck; they are not creations under test.
const evictionWorkspaceIds = new Set<string>();
return {
cleanup: project.cleanup,
async openWorkspaceForm(isolation: "local" | "worktree") {
@@ -232,7 +234,9 @@ export async function createCreationScenario(page: Page) {
await requests.settled();
const workspaces = (await project.client.fetchWorkspaces()).entries.filter(
(workspace) =>
workspace.projectId === project.projectId && workspace.id !== project.workspaceId,
workspace.projectId === project.projectId &&
workspace.id !== project.workspaceId &&
!evictionWorkspaceIds.has(workspace.id),
);
expect(workspaces).toHaveLength(1);
workspaceId = workspaces[0]!.id;
@@ -276,6 +280,7 @@ export async function createCreationScenario(page: Page) {
source: { kind: "directory", path: project.repoPath },
});
if (!result.workspace) throw new Error(result.error ?? "Failed to seed eviction workspace");
evictionWorkspaceIds.add(result.workspace.id);
await switchWorkspaceViaSidebar({
page,
serverId: getServerId(),
@@ -1,8 +1,11 @@
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { expect, test, type Page } from "@playwright/test";
import { gotoAppShell } from "./app";
import { openAgentRoute } from "./mock-agent";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { copyPluginExample } from "./plugin-fixture";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { seedWorkspace } from "./seed-client";
const PLUGIN_ID = "composer-controls-example";
@@ -57,3 +60,236 @@ export async function withComposerControlsExample(
await workspace.cleanup();
}
}
const ONE_TOGGLE_PLUGIN_ID = "composer-toggle-and-watcher-e2e";
const ONE_TOGGLE_NAME = "Sandbox flag";
const ONE_TOGGLE_PLUGIN_SOURCE = `import { useComposer } from "@getpaseo/plugin/client";
import { Toggle } from "@getpaseo/plugin/client/ui";
import { useState } from "react";
function PromptWatcher() {
useComposer();
return null;
}
function SandboxFlag() {
const [value, setValue] = useState(false);
return (
<Toggle
title="${ONE_TOGGLE_NAME}"
icon="Lock"
value={value}
onValueChange={({ value: next }) => setValue(next)}
/>
);
}
export default function contribute(client) {
client.addComposerItem({ id: "prompt-watcher", Component: PromptWatcher });
client.addComposerItem({ id: "sandbox-flag", Component: SandboxFlag });
return () => {};
}`;
const PICKER_NAME = "Review state";
const PICKER_PLUGIN_SOURCE = `import { Select } from "@getpaseo/plugin/client/ui";
import { useState } from "react";
const OPTIONS = [
{ value: "draft", label: "Draft" },
{ value: "ready", label: "Ready" },
];
function ReviewState() {
const [value, setValue] = useState("draft");
return (
<Select
title="${PICKER_NAME}"
icon="CircleDot"
value={value}
options={OPTIONS}
onValueChange={({ value: next }) => setValue(next)}
/>
);
}
export default function contribute(client) {
client.addComposerItem({ id: "review-state", Component: ReviewState });
return () => {};
}`;
function toolbar(page: Page) {
return page.getByTestId("agent-controls-toolbar").filter({ visible: true }).first();
}
interface ToolbarFrame {
overflowButton: boolean;
clipped: boolean;
}
declare global {
interface Window {
__pluginToolbarFrames?: ToolbarFrame[];
}
}
/** From the first frame on, records whether the toolbar condensed or clipped. Call before loading. */
export async function recordToolbarFramesFromLoad(page: Page): Promise<void> {
await page.addInitScript(() => {
const frames: ToolbarFrame[] = [];
window.__pluginToolbarFrames = frames;
const tick = () => {
const row = Array.from(
document.querySelectorAll('[data-testid="agent-controls-toolbar"]'),
).find((node) => node.getClientRects().length > 0);
if (row) {
frames.push({
overflowButton: row.querySelector('[data-testid="agent-controls-features"]') !== null,
clipped: row.scrollWidth > row.clientWidth,
});
}
requestAnimationFrame(tick);
};
requestAnimationFrame(tick);
});
}
export async function expectToolbarNeverCondensedOrClipped(page: Page): Promise<void> {
const frames = await page.evaluate(() => window.__pluginToolbarFrames ?? []);
expect(frames.length).toBeGreaterThan(0);
expect(frames.filter((frame) => frame.overflowButton || frame.clipped)).toEqual([]);
}
function agentFeaturesButton(page: Page) {
return page.getByRole("button", { name: "Open agent features", exact: true });
}
interface ToolbarPluginComposer {
setWindowWidth(width: number): Promise<void>;
expectToolbarWidthBetween(min: number, max: number): Promise<void>;
expectToggleInlineAtFullDensity(): Promise<void>;
expectToggleInOverflow(): Promise<void>;
closeOverflowSheet(): Promise<void>;
startRecordingDensity(): Promise<void>;
expectAtMostOneDensityChange(): Promise<void>;
openInlinePicker(): Promise<void>;
expectPickerClosed(): Promise<void>;
}
/** Runs `run` in an agent's composer with one icon toggle and one item that renders nothing. */
export function withToggleAndWatcherComposerItems(
page: Page,
run: (composer: ToolbarPluginComposer) => Promise<void>,
) {
return withToolbarPlugin(page, ONE_TOGGLE_PLUGIN_SOURCE, run);
}
/** Runs `run` in an agent's composer with one plugin `Select` in the toolbar. */
export function withPickerComposerItem(
page: Page,
run: (composer: ToolbarPluginComposer) => Promise<void>,
) {
return withToolbarPlugin(page, PICKER_PLUGIN_SOURCE, run);
}
async function withToolbarPlugin(
page: Page,
pluginSource: string,
run: (composer: ToolbarPluginComposer) => Promise<void>,
) {
const workspace = await seedWorkspace({ repoPrefix: "composer-measured-items-" });
const agent = await workspace.client.createAgent({
provider: "mock",
cwd: workspace.repoPath,
workspaceId: workspace.workspaceId,
title: "Measured items agent",
model: "ten-second-stream",
modeId: "load-test",
});
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previous = await client.getDaemonConfig();
const directory = await mkdtemp(path.join(tmpdir(), "paseo-composer-measured-items-"));
await writeFile(
path.join(directory, "paseo-plugin.json"),
JSON.stringify({ id: ONE_TOGGLE_PLUGIN_ID, requirements: pluginRequirements }),
);
await writeFile(path.join(directory, "index.client.tsx"), pluginSource);
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await gotoAppShell(page);
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: agent.id });
await expect(toolbar(page)).toBeVisible({ timeout: 30_000 });
await run({
setWindowWidth: (width) =>
test.step(`set the window to ${width} wide`, () =>
page.setViewportSize({ width, height: 800 })),
expectToolbarWidthBetween: (min, max) =>
test.step(`the toolbar is between ${min} and ${max} wide`, async () => {
await expect
.poll(async () => (await toolbar(page).boundingBox())?.width ?? 0)
.toBeGreaterThanOrEqual(min);
expect((await toolbar(page).boundingBox())?.width ?? 0).toBeLessThanOrEqual(max);
}),
expectToggleInlineAtFullDensity: () =>
test.step("the toggle is inline and the toolbar keeps its labels", async () => {
const toggle = toolbar(page).getByRole("button", { name: ONE_TOGGLE_NAME, exact: true });
await expect(toggle).toBeVisible();
await expect(agentFeaturesButton(page)).toHaveCount(0);
await expect(toolbar(page).getByTestId("agent-thinking-selector")).toHaveText("Low");
const row = await toolbar(page).boundingBox();
const box = await toggle.boundingBox();
expect(box && row && box.x + box.width <= row.x + row.width).toBe(true);
}),
expectToggleInOverflow: () =>
test.step("the toggle has moved to the overflow sheet", async () => {
await expect(
toolbar(page).getByRole("button", { name: ONE_TOGGLE_NAME, exact: true }),
).toHaveCount(0);
await agentFeaturesButton(page).click();
await expect(
page.getByRole("button", { name: ONE_TOGGLE_NAME, exact: true }),
).toBeVisible();
}),
closeOverflowSheet: () =>
test.step("close the overflow sheet", async () => {
await page.keyboard.press("Escape");
await expect(page.getByTestId("agent-features-sheet")).toHaveCount(0);
}),
startRecordingDensity: () =>
test.step("record which density each frame paints", () =>
page.evaluate(() => {
const frames: boolean[] = [];
const paint = () => {
frames.push(
document.querySelector('[data-testid="agent-controls-features"]') !== null,
);
window.requestAnimationFrame(paint);
};
window.requestAnimationFrame(paint);
Object.assign(window, { __densityFrames: frames });
})),
expectAtMostOneDensityChange: () =>
test.step("the density changed once at most", async () => {
const changes = await page.evaluate(() => {
const frames = (window as unknown as { __densityFrames: boolean[] }).__densityFrames;
return frames.filter((frame, index) => index > 0 && frame !== frames[index - 1]).length;
});
expect(changes).toBeLessThanOrEqual(1);
}),
openInlinePicker: () =>
test.step("open the plugin picker from the toolbar", async () => {
await toolbar(page).getByRole("button", { name: PICKER_NAME, exact: true }).click();
await expect(page.getByTestId("combobox-desktop-container")).toBeVisible();
}),
expectPickerClosed: () =>
test.step("the plugin picker has closed", () =>
expect(page.getByTestId("combobox-desktop-container")).toHaveCount(0)),
});
} finally {
await client.removePlugin(ONE_TOGGLE_PLUGIN_ID);
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled });
await client.close();
await rm(directory, { recursive: true, force: true });
await workspace.cleanup();
}
}
@@ -3,16 +3,37 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { expect, test, type Page } from "@playwright/test";
import { gotoAppShell } from "./app";
import { attachComposerTestImage, openImageLightbox } from "./composer";
import {
contextWindowDetails,
pressContextWindowMeter,
seedAgentWithContextWindow,
} from "./context-window";
import { gotoWorkspace } from "./launcher";
import { openCommandCenter } from "./command-center";
import { openAgentRoute } from "./mock-agent";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { openAgentRoute, seedMockAgentWorkspace } from "./mock-agent";
import { connectNewWorkspaceDaemonClient, openGlobalNewWorkspaceComposer } from "./new-workspace";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { seedWorkspace } from "./seed-client";
import {
expectNoSheetOpen,
expectOpenTabCount,
promptMentioning,
sheet,
tapSheetBackdrop,
} from "./sheet";
import { openSubagentFromCompactTrack, seedSubagent } from "./subagents";
import { getServerId } from "./server-id";
import { createAgentTabFromMenu, ensureExplorerSidebar } from "./workspace-tabs";
import {
createAgentTabFromMenu,
dragTabIntoExplorer,
ensureExplorerSidebar,
} from "./workspace-tabs";
const WIDE = { width: 1440, height: 900 };
const COMPACT = { width: 390, height: 844 };
const CHECKLIST = "- [ ] Tests\n- [ ] Docs\n";
const FILE_LINK = "linked.ts:3";
type Workspace = Awaited<ReturnType<typeof seedWorkspace>>;
@@ -50,6 +71,9 @@ export async function withComposerToolsExample(
focusTheAgentTab(): Promise<void>;
expectPanelFocusedAgent(focused: boolean): Promise<void>;
expectPanelShowsReview(needsReview: boolean): Promise<void>;
useCompactLayout(): Promise<void>;
insertChecklistFromControlsSheet(): Promise<void>;
expectComposerReadyToType(text: string): Promise<void>;
}) => Promise<void>,
) {
const workspace = await seedWorkspace({ repoPrefix: "composer-tools-", title: "Composer tools" });
@@ -115,6 +139,23 @@ export async function withComposerToolsExample(
expect(
page.getByText(`Needs review: ${needsReview ? "yes" : "no"}`, { exact: true }),
).toBeVisible()),
useCompactLayout: () =>
test.step("narrow the window to a phone", async () => {
await page.setViewportSize(COMPACT);
await expect(prompt(page).filter({ visible: true })).toBeVisible();
}),
insertChecklistFromControlsSheet: () =>
test.step("press the Action in the composer's controls sheet", async () => {
await page.getByRole("button", { name: /^Select model/ }).click();
await page.getByText("Insert checklist", { exact: true }).click();
}),
expectComposerReadyToType: (text) =>
test.step("the sheet is closed and the cursor is in the composer", async () => {
await expectNoSheetOpen(page);
const input = prompt(page).filter({ visible: true });
await expect(input).toHaveValue(text);
await expect(input).toBeFocused();
}),
});
} finally {
await client.removePlugin("composer-controls-example");
@@ -205,4 +246,516 @@ export async function withPluginWritingToAnotherWorkspace(
}
}
/**
* A plugin that reaches one agent's composer from a pill and from Command Center items, and asks
* for focus, wherever the user is.
*/
export async function withPluginFocusingAComposer(
page: Page,
run: (author: {
openOtherAgent(): Promise<void>;
openTargetAgent(): Promise<void>;
goToAnotherWorkspace(): Promise<void>;
moveFocusOutOfComposer(): Promise<void>;
pressPill(): Promise<void>;
focusFromCommandCenter(): Promise<void>;
selectPromptFromCommandCenter(): Promise<void>;
useCompactLayout(): Promise<void>;
coverComposerWithExplorerPanel(): Promise<void>;
pressPanelFocusButton(): Promise<void>;
expectExplorerPanelClosed(): Promise<void>;
fillComposer(text: string): Promise<void>;
expectOnTargetAgent(): Promise<void>;
expectComposerFocused(): Promise<void>;
typeAtCursor(text: string): Promise<void>;
expectComposerText(text: string): Promise<void>;
}) => Promise<void>,
) {
const workspace = await seedWorkspace({ repoPrefix: "composer-focus-", title: "Composer focus" });
const elsewhere = await seedWorkspace({ repoPrefix: "focus-away-", title: "Focus away" });
const target = await createMockAgent(workspace, "Target agent");
const other = await createMockAgent(workspace, "Other agent");
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previous = await client.getDaemonConfig();
const directory = await mkdtemp(path.join(tmpdir(), "paseo-composer-focus-"));
const targetId = JSON.stringify(target.id);
await writeFile(
path.join(directory, "paseo-plugin.json"),
JSON.stringify({ id: "composer-focus", requirements: pluginRequirements }),
);
await writeFile(
path.join(directory, "index.client.tsx"),
`import { Pressable, Text } from "react-native";
export default function contribute(client) {
client.addComposerPill({
id: "hello",
workspaceId: ${JSON.stringify(workspace.workspaceId)},
agentId: ${targetId},
button: {
title: "Add HELLO to the composer",
icon: "Hand",
label: "Hello",
behavior: {
kind: "action",
async onPress() {
for (const composer of client.composers({ agentId: ${targetId} })) {
composer.insertText("HELLO");
await composer.focus();
}
},
},
},
});
client.addWorkspacePanel({
id: "tools",
title: "Focus tools",
icon: "ListChecks",
locations: ["explorer"],
Component() {
return (
<Pressable
accessibilityRole="button"
accessibilityLabel="Focus the target agent"
onPress={() => client.composers({ agentId: ${targetId} })[0]?.focus()}
>
<Text>Focus the target agent</Text>
</Pressable>
);
},
});
client.addCommandCenterItem({
id: "focus",
title: "Composer focus: focus the target",
icon: "Flag",
context: "global",
onSelect({ composers }) {
return composers({ agentId: ${targetId} })[0].focus();
},
});
client.addCommandCenterItem({
id: "select",
title: "Composer focus: select the prompt",
icon: "Flag",
context: "global",
onSelect({ composers }) {
const composer = composers({ agentId: ${targetId} })[0];
return composer.focus({ selection: { start: 0, end: composer.prompt.length } });
},
});
return () => {};
}`,
);
const targetTab = () => page.getByTestId(`workspace-tab-agent_${target.id}`);
const workspaceRow = (id: string) =>
page.getByTestId(`sidebar-workspace-row-${getServerId()}:${id}`);
const panelFocusButton = () =>
page.getByRole("button", { name: "Focus the target agent", exact: true });
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await run({
openOtherAgent: () =>
test.step("open another agent, so the target's tab is not showing", async () => {
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: other.id });
await expect(prompt(page)).toBeVisible({ timeout: 30_000 });
}),
openTargetAgent: () =>
test.step("open the target agent", async () => {
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: target.id });
await expect(prompt(page)).toBeVisible({ timeout: 30_000 });
}),
goToAnotherWorkspace: () =>
test.step("go to another workspace", async () => {
await workspaceRow(elsewhere.workspaceId).click();
await expect(targetTab().first()).toBeHidden();
}),
moveFocusOutOfComposer: () =>
test.step("the composer does not have focus", async () => {
await prompt(page).blur();
await expect(prompt(page)).not.toBeFocused();
}),
pressPill: () =>
test.step("press the pill", () => page.getByRole("button", { name: "Hello" }).click()),
focusFromCommandCenter: () =>
test.step("run the plugin's focus command", () =>
runCommand(page, "Composer focus: focus the target")),
selectPromptFromCommandCenter: () =>
test.step("run the plugin's select command", () =>
runCommand(page, "Composer focus: select the prompt")),
useCompactLayout: () =>
test.step("use a phone-sized window", () => page.setViewportSize(COMPACT)),
coverComposerWithExplorerPanel: () =>
test.step("open the plugin's panel in the Explorer, covering the composer", async () => {
const explorer = await ensureExplorerSidebar(page);
await explorer.getByRole("button", { name: "New tab", exact: true }).click();
await page
.getByTestId("workspace-new-tab-menu")
.filter({ visible: true })
.getByRole("menuitem", { name: "Focus tools", exact: true })
.click();
await expect(panelFocusButton()).toBeVisible();
}),
pressPanelFocusButton: () =>
test.step("press the panel's button", () => panelFocusButton().click()),
expectExplorerPanelClosed: () =>
test.step("the Explorer no longer covers the composer", () =>
expect(panelFocusButton()).toBeHidden({ timeout: 30_000 })),
fillComposer: (text) =>
test.step(`write "${text}" in the composer`, () => prompt(page).fill(text)),
expectOnTargetAgent: () =>
test.step("the target agent's tab is showing", async () => {
await expect(targetTab().filter({ visible: true }).first()).toHaveAttribute(
"aria-selected",
"true",
{ timeout: 30_000 },
);
}),
expectComposerFocused: () =>
test.step("the composer input has focus", () =>
expect(prompt(page)).toBeFocused({ timeout: 30_000 })),
typeAtCursor: (text) => test.step(`type "${text}"`, () => page.keyboard.type(text)),
expectComposerText: (text) =>
test.step("the composer holds the text", () => expect(prompt(page)).toHaveValue(text)),
});
} finally {
await client.removePlugin("composer-focus");
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled });
await client.close();
await rm(directory, { recursive: true, force: true });
await elsewhere.cleanup();
await workspace.cleanup();
}
}
export { CHECKLIST };
type HeldComposerGlobal = typeof globalThis & {
heldComposer?: {
focus(options?: { selection?: { start: number; end: number } }): Promise<void>;
};
};
export async function withPluginHoldingNewWorkspaceComposer(
page: Page,
run: (author: {
openNewWorkspace(): Promise<void>;
leaveCompactExplorerForNewWorkspace(): Promise<void>;
openSettings(): Promise<void>;
openThinkingPicker(): Promise<void>;
previewAttachedImage(): Promise<void>;
typeInHeldComposer(text: string): Promise<void>;
expectOverlappingFocusesKeepTheLatestSelection(): Promise<void>;
expectHeldComposerFocusResult(result: string): Promise<void>;
expectHeldComposerReadyToType(): Promise<void>;
}) => Promise<void>,
) {
const workspace = await seedWorkspace({ repoPrefix: "held-composer-", title: "Held composer" });
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previous = await client.getDaemonConfig();
const directory = await mkdtemp(path.join(tmpdir(), "paseo-held-composer-"));
await writeFile(
path.join(directory, "paseo-plugin.json"),
JSON.stringify({ id: "held-composer", requirements: pluginRequirements }),
);
await writeFile(
path.join(directory, "index.client.tsx"),
`import { useComposer } from "@getpaseo/plugin/client";
function Holder() {
globalThis.heldComposer = useComposer();
return null;
}
export default function contribute(client) {
client.addComposerItem({ id: "holder", Component: Holder });
return () => {};
}`,
);
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await run({
openNewWorkspace: () =>
test.step("open the New workspace composer", async () => {
await openGlobalNewWorkspaceComposer(page);
await page.waitForFunction(() => (globalThis as HeldComposerGlobal).heldComposer);
}),
leaveCompactExplorerForNewWorkspace: () =>
test.step("leave a compact Explorer for New workspace with the shortcut", async () => {
await gotoWorkspace(page, workspace.workspaceId);
await page.setViewportSize(COMPACT);
await expect(await ensureExplorerSidebar(page)).toBeVisible();
await page.evaluate(() => {
(globalThis as HeldComposerGlobal).heldComposer = undefined;
});
await page.keyboard.press("ControlOrMeta+n");
await expect(page).toHaveURL(/\/new(?:\?.*)?$/);
// A compact composer mounts plugin items inside its controls sheet.
await page.getByRole("button", { name: /^Select model/ }).click();
await page.waitForFunction(() => (globalThis as HeldComposerGlobal).heldComposer);
await tapSheetBackdrop(page);
await expectNoSheetOpen(page);
}),
openSettings: () =>
test.step("push Settings over the New workspace screen", async () => {
await page.getByTestId("sidebar-settings").filter({ visible: true }).click();
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
}),
openThinkingPicker: () =>
test.step("open the thinking picker in the New workspace composer", async () => {
await page
.getByRole("button", { name: /^Select thinking option/ })
.filter({ visible: true })
.click();
await expect(page.getByText("High", { exact: true })).toBeVisible();
}),
previewAttachedImage: () =>
test.step("attach an image to the New workspace composer and preview it", async () => {
await attachComposerTestImage(page);
await openImageLightbox(page);
}),
typeInHeldComposer: (text) =>
test.step(`type ${text} in the New workspace composer`, async () => {
await prompt(page).filter({ visible: true }).fill(text);
}),
expectOverlappingFocusesKeepTheLatestSelection: () =>
test.step("two overlapping focus() calls leave the later selection", async () => {
const selection = await page.evaluate(async () => {
const composer = (globalThis as HeldComposerGlobal).heldComposer!;
await Promise.all([
composer.focus({ selection: { start: 0, end: 1 } }),
composer.focus({ selection: { start: 2, end: 4 } }),
]);
const input = document.activeElement as HTMLTextAreaElement;
return [input.selectionStart, input.selectionEnd];
});
expect(selection).toEqual([2, 4]);
}),
expectHeldComposerReadyToType: () =>
test.step("nothing covers the composer and the cursor is in it", async () => {
await expect(page.getByText("High", { exact: true })).toHaveCount(0);
await expect(page.getByTestId("attachment-lightbox-close")).toHaveCount(0);
await expect(prompt(page).filter({ visible: true })).toBeFocused();
}),
expectHeldComposerFocusResult: (result) =>
test.step(`the held composer's focus() reports ${result}`, async () => {
const actual = await page.evaluate(() =>
(globalThis as HeldComposerGlobal).heldComposer?.focus().then(
() => "focused",
(error: Error) => error.message,
),
);
expect(actual).toBe(result);
}),
});
} finally {
await client.removePlugin("held-composer");
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled });
await client.close();
await rm(directory, { recursive: true, force: true });
await workspace.cleanup();
}
}
type FocusAgentGlobal = typeof globalThis & {
focusAgent?: (agentId: string) => Promise<void>;
};
export async function withPluginFocusingASubagent(
page: Page,
run: (author: {
openParentAgent(): Promise<void>;
openExplorer(): Promise<void>;
focusSubagent(): Promise<void>;
expectSubagentTabReadyToType(): Promise<void>;
keepParentInExplorerOnCompactScreen(): Promise<void>;
focusParent(): Promise<void>;
expectParentReadyToType(): Promise<void>;
coverExplorerComposerWithFileSheet(): Promise<void>;
focusParentAsAFileSheetOpens(): Promise<void>;
openSubagentPageInParentComposer(): Promise<void>;
}) => Promise<void>,
) {
const workspace = await seedMockAgentWorkspace({
repoPrefix: "focus-subagent-",
title: "Focus parent",
initialPrompt: promptMentioning(FILE_LINK),
});
await writeFile(path.join(workspace.cwd, "linked.ts"), "one\ntwo\nthree\n", "utf8");
const child = await seedSubagent(
{ client: workspace.client, repoPath: workspace.cwd, workspaceId: workspace.workspaceId },
{ parentId: workspace.agentId, title: "Focus child" },
);
const plugin = await installFocusingPlugin(page);
const { focusAgent } = plugin;
try {
await page.setViewportSize(COMPACT);
await gotoAppShell(page);
await run({
keepParentInExplorerOnCompactScreen: () =>
test.step("move the parent into the Explorer, then narrow the window", async () => {
await page.setViewportSize(WIDE);
await openAgentRoute(page, {
workspaceId: workspace.workspaceId,
agentId: workspace.agentId,
});
await page.waitForFunction(() => (globalThis as FocusAgentGlobal).focusAgent);
// The seeded turn must finish first, so the drag isn't racing its updates to the tab.
await expect(page.getByText(FILE_LINK, { exact: true })).toBeVisible({ timeout: 15_000 });
const explorer = await ensureExplorerSidebar(page);
await dragTabIntoExplorer(page, `agent_${workspace.agentId}`);
await expect(
explorer.getByTestId(`workspace-tab-agent_${workspace.agentId}`),
).toBeVisible();
await page.setViewportSize(COMPACT);
// The phone layout hides the Explorer; focus must find it there, not in the wide layout.
await expect(explorer).toBeHidden();
}),
focusParent: () =>
test.step("focus the agent kept in the Explorer", () => focusAgent(workspace.agentId)),
expectParentReadyToType: () =>
test.step("no sheet is open and the cursor is in the composer", async () => {
await expectNoSheetOpen(page);
await expect(prompt(page).filter({ visible: true })).toBeFocused();
}),
openSubagentPageInParentComposer: () =>
test.step("open the subagent's page from the parent's Subagents track", async () => {
await openSubagentFromCompactTrack(page, child.id);
await expect(sheet(page, child.title)).toBeVisible();
}),
coverExplorerComposerWithFileSheet: () =>
test.step("open a file's sheet over the Explorer's composer", async () => {
await page.getByText(FILE_LINK, { exact: true }).filter({ visible: true }).click();
await expect(sheet(page, "linked.ts")).toBeVisible();
}),
focusParentAsAFileSheetOpens: () =>
test.step("focus the agent while a file's sheet is opening over it", async () => {
// The click looks the file up first. Focus in the commit that mounts the sheet, before
// its opening animation has started.
await page.evaluate((id) => {
const global = globalThis as FocusAgentGlobal & {
focusedAsSheetOpens?: Promise<string>;
};
global.focusedAsSheetOpens = new Promise((resolve) => {
const observer = new MutationObserver(() => {
if (!document.querySelector('[aria-label="Bottom sheet backdrop"]')) return;
observer.disconnect();
void global.focusAgent?.(id).then(
() => resolve("focused"),
(error: Error) => resolve(error.message),
);
});
observer.observe(document.body, { childList: true, subtree: true });
});
}, workspace.agentId);
await page.getByText(FILE_LINK, { exact: true }).filter({ visible: true }).click();
const outcome = await page.evaluate(
() => (globalThis as { focusedAsSheetOpens?: Promise<string> }).focusedAsSheetOpens,
);
expect(outcome).toBe("focused");
}),
openParentAgent: () =>
test.step("open the parent agent on a phone", async () => {
await openAgentRoute(page, {
workspaceId: workspace.workspaceId,
agentId: workspace.agentId,
});
await expect(prompt(page)).toBeVisible({ timeout: 30_000 });
await expectOpenTabCount(page, 1);
await page.waitForFunction(() => (globalThis as FocusAgentGlobal).focusAgent);
}),
openExplorer: () =>
test.step("open the Explorer over the parent's composer", async () => {
await expect(await ensureExplorerSidebar(page)).toBeVisible();
}),
focusSubagent: () =>
test.step("focus the subagent, which has no tab", () => focusAgent(child.id)),
expectSubagentTabReadyToType: () =>
test.step("the subagent is a tab with the cursor in its composer", async () => {
await expectNoSheetOpen(page);
await expectOpenTabCount(page, 2);
await expect(prompt(page)).toBeFocused();
}),
});
} finally {
await plugin.remove();
await workspace.cleanup();
}
}
/** A plugin that focuses any agent's composer, as a callback holding the agent's id would. */
async function installFocusingPlugin(page: Page) {
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previous = await client.getDaemonConfig();
const directory = await mkdtemp(path.join(tmpdir(), "paseo-focus-agent-"));
await writeFile(
path.join(directory, "paseo-plugin.json"),
JSON.stringify({ id: "focus-agent", requirements: pluginRequirements }),
);
await writeFile(
path.join(directory, "index.client.tsx"),
`export default function contribute(client) {
globalThis.focusAgent = (agentId) => client.composers({ agentId })[0].focus();
return () => {};
}`,
);
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
return {
focusAgent: async (agentId: string) => {
const result = await page.evaluate(
(id) =>
(globalThis as FocusAgentGlobal).focusAgent?.(id).then(
() => "focused",
(error: Error) => error.message,
),
agentId,
);
expect(result).toBe("focused");
},
remove: async () => {
await client.removePlugin("focus-agent");
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled });
await client.close();
await rm(directory, { recursive: true, force: true });
},
};
}
export async function withPluginFocusingAnAgentWithContextUsage(
page: Page,
run: (author: {
openContextUsageOnPhone(): Promise<void>;
focusAgent(): Promise<void>;
expectReadyToType(): Promise<void>;
}) => Promise<void>,
) {
const agent = await seedAgentWithContextWindow();
const plugin = await installFocusingPlugin(page);
try {
await page.setViewportSize(COMPACT);
await gotoAppShell(page);
await run({
openContextUsageOnPhone: () =>
test.step("open the agent's context usage on a phone", async () => {
await openAgentRoute(page, agent);
await page.waitForFunction(() => (globalThis as FocusAgentGlobal).focusAgent);
await pressContextWindowMeter(page);
}),
focusAgent: () => test.step("focus the agent", () => plugin.focusAgent(agent.agentId)),
expectReadyToType: () =>
test.step("the context usage is closed and the cursor is in the composer", async () => {
await expect(contextWindowDetails(page)).toHaveCount(0);
await expect(prompt(page).filter({ visible: true })).toBeFocused();
}),
});
} finally {
await plugin.remove();
await agent.cleanup();
}
}
+12
View File
@@ -112,3 +112,15 @@ export async function expectDeclinedDiscardPrompt(
await close();
expect(await prompt).toContain("discard the draft");
}
/** A seeded prompt the mock agent echoes, so the chat shows `target` as a tappable file link. */
export function promptMentioning(target: string): string {
return [
"Generate a title and a git branch name for a coding agent from the user prompt and attachments.",
"Return JSON only with fields 'title' and 'branch'.",
"",
"<user-prompt>",
`Open \`${target}\` now`,
"</user-prompt>",
].join("\n");
}
+7 -4
View File
@@ -31,10 +31,13 @@ async function expectContextMenuAtPointer(
menuTestID: string,
anchor: ContextMenuAnchor,
): Promise<void> {
const bounds = await page.getByTestId(menuTestID).boundingBox();
if (!bounds) throw new Error(`Could not measure ${menuTestID}`);
expect(Math.abs(bounds.x - anchor.x)).toBeLessThanOrEqual(2);
expect(Math.abs(bounds.y - (anchor.y + 4))).toBeLessThanOrEqual(2);
// The visible measuring surface is replaced when layout places the menu at its anchor.
await expect(async () => {
const bounds = await page.getByTestId(menuTestID).boundingBox();
if (!bounds) throw new Error(`Could not measure ${menuTestID}`);
expect(Math.abs(bounds.x - anchor.x)).toBeLessThanOrEqual(2);
expect(Math.abs(bounds.y - (anchor.y + 4))).toBeLessThanOrEqual(2);
}).toPass({ timeout: 10_000 });
}
export async function openWorkspaceContextMenu(page: Page, workspaceId: string): Promise<void> {
@@ -1,5 +1,6 @@
import { expect, type Page } from "@playwright/test";
import type { installDaemonWebSocketGate } from "./daemon-websocket-gate";
import { readReplicaCache } from "./replica-cache-storage";
import type { LongTimelineAgent } from "./timeline-pagination";
import {
expectReconnectingToastGone,
@@ -13,6 +14,12 @@ const SUBSCRIPTION_REQUEST = "agent.timeline.set_subscription.request";
const SUBSCRIPTION_RESPONSE = "agent.timeline.set_subscription.response";
const TIMELINE_REQUEST = "fetch_agent_timeline_request";
const TIMELINE_RESPONSE = "fetch_agent_timeline_response";
/**
* `FRESHNESS_CHECK_QUIET_MS` is 500: an opening check unanswered that long reports Updating messages by
* design, however long the daemon takes. The app starts that wait just before it sends the question
* this helper times, so the bound stops short of 500.
*/
const QUIET_WINDOW_FLOOR_MS = 300;
export interface TimelineRequestCounts {
agentId?: string;
@@ -77,48 +84,99 @@ export async function waitForResumeAnswer(
]);
}
interface UpdatingToastTiming {
askedAt: number | null;
shownAt: number | null;
}
declare global {
interface Window {
__updatingToastTiming?: UpdatingToastTiming;
}
}
/** Runs in the page: times the freshness question and the toast's first commit on its own clock. */
function recordUpdatingToastTiming(): void {
const noteToast = (timing: UpdatingToastTiming) => {
if (document.querySelector('[data-testid="agent-updating-toast"]') === null) return;
timing.shownAt ??= performance.now();
};
const existing = window.__updatingToastTiming;
if (existing) {
existing.askedAt = null;
existing.shownAt = null;
noteToast(existing);
return;
}
const timing: UpdatingToastTiming = { askedAt: null, shownAt: null };
window.__updatingToastTiming = timing;
const send = WebSocket.prototype.send;
WebSocket.prototype.send = function sendRecordingQuestion(data) {
if (
typeof data === "string" &&
data.includes("agent.timeline.set_subscription.request") &&
data.includes('"agentIds":["')
) {
timing.askedAt ??= performance.now();
}
return send.call(this, data);
};
new MutationObserver(() => noteToast(timing)).observe(document, {
childList: true,
subtree: true,
});
noteToast(timing);
}
/** A toast may only follow an unanswered question; nothing about the daemon's speed changes that. */
async function expectToastWaitedForTheDaemon(page: Page): Promise<void> {
await waitForNextPaint(page);
const showedTooSoon = await page.evaluate((floorMs) => {
const { askedAt, shownAt } = window.__updatingToastTiming as UpdatingToastTiming;
if (shownAt === null) return false;
return askedAt === null || shownAt - askedAt < floorMs;
}, QUIET_WINDOW_FLOOR_MS);
expect(showedTooSoon, "the Updating messages toast did not wait for the daemon").toBe(false);
}
/** Records every appearance of the toast, including one that lasts a single commit. */
export async function watchForUpdatingToast(page: Page): Promise<() => Promise<void>> {
const watch = await page.evaluateHandle(() => {
let shown = false;
const check = () => {
shown ||= document.querySelector('[data-testid="agent-updating-toast"]') !== null;
};
const observer = new MutationObserver(check);
observer.observe(document.body, { childList: true, subtree: true });
check();
return {
stop() {
observer.disconnect();
return shown;
},
};
});
return async () => {
await waitForNextPaint(page);
const shown = await watch.evaluate((recorder) => recorder.stop());
await watch.dispose();
expect(shown, "the Updating messages toast appeared").toBe(false);
};
await page.evaluate(recordUpdatingToastTiming);
return () => expectToastWaitedForTheDaemon(page);
}
/** Reopens the app on this chat, recording the toast from the first paint of the new page. */
export async function reopenAppWatchingForUpdatingToast(page: Page): Promise<() => Promise<void>> {
await page.addInitScript(() => {
const recorder = window as Window & { updatingToastShown?: boolean };
new MutationObserver(() => {
recorder.updatingToastShown ||=
document.querySelector('[data-testid="agent-updating-toast"]') !== null;
}).observe(document, { childList: true, subtree: true });
});
await page.addInitScript(recordUpdatingToastTiming);
await page.reload();
return async () => {
await waitForNextPaint(page);
const shown = await page.evaluate(
() => (window as Window & { updatingToastShown?: boolean }).updatingToastShown === true,
);
expect(shown, "the Updating messages toast appeared").toBe(false);
};
return () => expectToastWaitedForTheDaemon(page);
}
/** Opens persisted history with the daemon's freshness answer held. */
export async function reopenWithFreshnessCheckUnanswered(
page: Page,
gate: DaemonWebSocketGate,
agent: LongTimelineAgent,
): Promise<void> {
// A cold open needs a persisted authoritative cursor to ask a freshness question.
await expect
.poll(async () => {
const cache = await readReplicaCache(page);
return cache?.hosts
?.flatMap((host) => host.timelines)
.find((timeline) => timeline.agentId === agent.agentId)?.range?.endSeq;
})
.toBeGreaterThan(0);
gate.holdNextClientRequest(SUBSCRIPTION_REQUEST);
await page.reload();
await expect(page.getByText(agent.newestPrompt, { exact: true })).toBeVisible();
await gate.waitForHeldClientRequest();
await expect(page.getByRole("alert").filter({ hasText: "Updating messages" })).toBeVisible();
}
export async function answerFreshnessCheck(page: Page, gate: DaemonWebSocketGate): Promise<void> {
gate.releaseHeldClientRequest();
await expect(page.getByRole("alert").filter({ hasText: "Updating messages" })).toHaveCount(0);
}
async function waitForNextPaint(page: Page): Promise<void> {
@@ -11,6 +11,8 @@ export interface UsageListRequest {
export interface UsageReportsFixture {
listRequests(): UsageListRequest[];
waitForListRequests(count: number): Promise<void>;
/** Runs `action`, then waits until the app has received the agent's next usage scope. */
untilUsageScopeChanges(agentId: string, action: () => Promise<unknown>): Promise<void>;
}
interface UsageReportsFixtureOptions {
@@ -97,6 +99,26 @@ function withUsageSupportFeature(
});
}
function agentUsageScope(message: WebSocketMessage): { agentId: string; key: string } | null {
const envelope = parseJson(message) as {
type?: unknown;
message?: {
type?: unknown;
payload?: { kind?: unknown; agent?: { id?: unknown; usageScopeKey?: unknown } };
};
} | null;
const agent = envelope?.message?.payload?.agent;
if (
envelope?.message?.type !== "agent_update" ||
envelope.message.payload?.kind !== "upsert" ||
typeof agent?.id !== "string" ||
typeof agent.usageScopeKey !== "string"
) {
return null;
}
return { agentId: agent.id, key: agent.usageScopeKey };
}
function pick<T>(values: T[], index: number): T {
const value = values[Math.min(index, values.length - 1)];
if (value === undefined) throw new Error("Usage fixture requires at least one response.");
@@ -127,6 +149,16 @@ export async function installUsageReportsFixture(
): Promise<UsageReportsFixture> {
const listRequests: UsageListRequest[] = [];
const listCounter = createCounter();
const usageScopes = new Map<string, string>();
const usageScopeChanges = new Map<string, ReturnType<typeof createCounter>>();
const usageScopeCounts = new Map<string, number>();
const usageScopeCounter = (agentId: string) => {
const existing = usageScopeChanges.get(agentId);
if (existing) return existing;
const created = createCounter();
usageScopeChanges.set(agentId, created);
return created;
};
const usageSupported = options.usageSupported ?? true;
const isUsageSupported = () =>
typeof usageSupported === "function" ? usageSupported() : usageSupported;
@@ -239,6 +271,15 @@ export async function installUsageReportsFixture(
options.usageSettingSupported ?? true,
)
: null;
const scope = agentUsageScope(message);
if (scope && usageScopes.get(scope.agentId) !== scope.key) {
usageScopes.set(scope.agentId, scope.key);
usageScopeCounts.set(scope.agentId, (usageScopeCounts.get(scope.agentId) ?? 0) + 1);
// The app must hold the new scope before a test acts on it.
ws.send(serverInfo ?? message);
usageScopeCounter(scope.agentId).increment();
return;
}
ws.send(serverInfo ?? message);
});
});
@@ -246,5 +287,10 @@ export async function installUsageReportsFixture(
return {
listRequests: () => [...listRequests],
waitForListRequests: (count) => listCounter.waitFor(count),
untilUsageScopeChanges: async (agentId, action) => {
const next = (usageScopeCounts.get(agentId) ?? 0) + 1;
await action();
await usageScopeCounter(agentId).waitFor(next);
},
};
}
@@ -61,6 +61,23 @@ function explorerSidebar(page: Page) {
return visibleTestId(page, "workspace-explorer-sidebar").first();
}
export async function dragTabIntoExplorer(page: Page, tabId: string): Promise<void> {
const source = page.getByTestId("workspace-pane-main").getByTestId(`workspace-tab-${tabId}`);
const destination = explorerSidebar(page).getByTestId("workspace-tab-files");
const sourceBox = await source.boundingBox();
const destinationBox = await destination.boundingBox();
if (!sourceBox || !destinationBox)
throw new Error("Tab drag requires visible source and destination");
const start = { x: sourceBox.x + 12, y: sourceBox.y + sourceBox.height / 2 };
await page.mouse.move(start.x, start.y);
await page.mouse.down();
await page.mouse.move(start.x + 12, start.y + 4);
await page.mouse.move(destinationBox.x + 12, destinationBox.y + destinationBox.height / 2, {
steps: 20,
});
await page.mouse.up();
}
async function selectWorkspaceTab(tab: Locator): Promise<void> {
if ((await tab.getAttribute("aria-selected")) !== "true") {
// The close action overlays the chip's trailing edge on hover. Click the
@@ -8,9 +8,12 @@ android {
defaultConfig {
versionCode 1
versionName '0.1.0'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
}
dependencies {
implementation 'com.facebook.react:react-android'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.6.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
}
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity android:name="android.app.Activity" android:exported="false" />
</application>
</manifest>
@@ -0,0 +1,81 @@
package sh.paseo.keyboard
import android.app.Activity
import android.content.Intent
import android.view.KeyEvent
import android.widget.EditText
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
/** Exercises the real Android window and editable that receive physical keys. */
@RunWith(AndroidJUnit4::class)
class TerminalArrowTest {
private val instrumentation = InstrumentationRegistry.getInstrumentation()
private var activity: Activity? = null
@After fun finish() {
instrumentation.runOnMainSync {
activity?.let {
HardwareKeyboard.release(it.window)
it.finish()
}
}
}
@Test fun physicalArrowsDoNotMoveTheTerminalInputCaret() {
withInput(terminal = true) { input, host ->
for (code in listOf(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_DPAD_RIGHT, KeyEvent.KEYCODE_DPAD_DOWN)) {
for (modifiers in listOf(0, KeyEvent.META_SHIFT_ON, KeyEvent.META_ALT_ON, KeyEvent.META_CTRL_ON)) {
input.setSelection(3)
for (repeat in 0..2) {
assertTrue(host.window.callback.dispatchKeyEvent(KeyEvent(0, 0, KeyEvent.ACTION_DOWN, code, repeat, modifiers)))
assertEquals("Physical arrows must leave the hidden input caret at the end", 3, input.selectionStart)
}
assertTrue(host.window.callback.dispatchKeyEvent(KeyEvent(0, 0, KeyEvent.ACTION_UP, code, 0, modifiers)))
}
}
host.window.callback.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_X))
host.window.callback.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_X))
assertEquals("abcx", input.text.toString())
}
}
@Test fun physicalArrowsStillEditOtherTextFields() {
withInput(terminal = false) { input, host ->
host.window.callback.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_LEFT))
host.window.callback.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DPAD_LEFT))
assertEquals(2, input.selectionStart)
host.window.callback.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_X))
host.window.callback.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_X))
assertEquals("abxc", input.text.toString())
}
}
private fun withInput(terminal: Boolean, check: (EditText, Activity) -> Unit) {
val host = instrumentation.startActivitySync(
Intent(instrumentation.targetContext, Activity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
)
activity = host
lateinit var input: EditText
instrumentation.runOnMainSync {
input = EditText(host)
if (terminal) input.setTag(com.facebook.react.R.id.view_tag_native_id, "paseo-terminal-input")
host.setContentView(input)
input.setText("abc")
input.requestFocus()
input.setSelection(3)
HardwareKeyboard.observe(host.window)
}
instrumentation.waitForIdleSync()
instrumentation.runOnMainSync {
assertSame("The editable must own window focus before keys are dispatched", input, host.window.currentFocus)
check(input, host)
}
}
}
@@ -10,18 +10,24 @@ import android.view.KeyEvent
import android.view.Window
import android.widget.EditText
import android.view.inputmethod.BaseInputConnection
import com.facebook.react.R
import com.facebook.react.bridge.UiThreadUtil
import com.facebook.react.bridge.ReactContext
import com.facebook.react.interfaces.ExtraWindowEventListener
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
// Matched against the hidden terminal input's `nativeID`
// (TERMINAL_INPUT_NATIVE_ID in terminal-input.native.tsx).
private const val TERMINAL_INPUT_NATIVE_ID = "paseo-terminal-input"
internal object HardwareKeyboard {
var module: PaseoHardwareKeyboardModule? = null
@Volatile var overlayKeys: Set<String> = emptySet()
private val windows = mutableMapOf<Window, KeyboardWindowCallback>()
val dispatcher = WindowKeyDispatcher<KeyEvent>()
private val consumedPresses = mutableSetOf<Int>()
private val terminalArrowCodes = setOf("ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight")
fun observe(window: Window) {
if (windows.containsKey(window)) return
@@ -38,7 +44,7 @@ internal object HardwareKeyboard {
consumedPresses.clear()
}
fun dispatch(event: KeyEvent, composing: Boolean): Boolean {
fun dispatch(event: KeyEvent, composing: Boolean, terminalFocused: Boolean): Boolean {
if (event.flags and KeyEvent.FLAG_SOFT_KEYBOARD != 0) return false
if (event.action != KeyEvent.ACTION_DOWN && event.action != KeyEvent.ACTION_UP) return false
val code = code(event.keyCode)
@@ -64,8 +70,12 @@ internal object HardwareKeyboard {
))
if (event.action == KeyEvent.ACTION_UP) return consumedPresses.remove(event.keyCode)
val overlayOwnsKey = key != "Dead" && key in overlayKeys && !event.isCtrlPressed && !event.isMetaPressed && !event.isAltPressed && !composing
if (overlayOwnsKey) consumedPresses.add(event.keyCode)
return overlayOwnsKey
// Without this the hidden input consumes the arrows as caret movement and
// its next text change stops being a plain append. Modifiers stay
// forwarded: Alt/Shift+arrow are terminal editing keys.
val terminalOwnsKey = terminalFocused && !composing && code in terminalArrowCodes
if (overlayOwnsKey || terminalOwnsKey) consumedPresses.add(event.keyCode)
return overlayOwnsKey || terminalOwnsKey
}
private fun code(keyCode: Int): String = when (keyCode) {
@@ -107,9 +117,15 @@ internal object HardwareKeyboard {
private class KeyboardWindowCallback(private val window: Window, val previous: Window.Callback) : Window.Callback by previous {
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
val editable = (window.currentFocus as? EditText)?.text
val focus = window.currentFocus
val editable = (focus as? EditText)?.text
val composing = editable != null && BaseInputConnection.getComposingSpanStart(editable) >= 0
return HardwareKeyboard.dispatcher.dispatch(event, { HardwareKeyboard.dispatch(event, composing) }, { previous.dispatchKeyEvent(event) })
val terminalFocused = focus?.getTag(R.id.view_tag_native_id) == TERMINAL_INPUT_NATIVE_ID
return HardwareKeyboard.dispatcher.dispatch(
event,
{ HardwareKeyboard.dispatch(event, composing, terminalFocused) },
{ previous.dispatchKeyEvent(event) },
)
}
}
@@ -8,6 +8,7 @@ private let hardwareShortcutEventName = "onHardwareKeyboardShortcut"
private weak var activeModule: PaseoHardwareKeyboardModule?
private var isHardwareSubmitEnabled = false
private var overlayKeys: Set<String> = []
private var claimedShortcuts: [ClaimedShortcut] = []
/// UIKit spells non-character keys as sentinel input strings rather than as the
/// character they would type. JS sends the DOM `code` and the mapping lives
@@ -19,6 +20,42 @@ private let namedKeyInputs: [String: String] = [
"Enter": "\r",
]
/// A shortcut the window takes from the focused text control: Shift+Tab would
/// otherwise insert a tab, and Option+Shift+[ would type a quote.
private struct ClaimedShortcut {
let input: String
let modifierFlags: UIKeyModifierFlags
}
struct ClaimedShortcutRecord: Record {
@Field var code: String = ""
@Field var shift: Bool = false
@Field var alt: Bool = false
}
private let claimableKeyInputs: [String: String] = [
"Tab": "\t", "Space": " ", "Enter": "\r", "Escape": UIKeyCommand.inputEscape,
"ArrowUp": UIKeyCommand.inputUpArrow, "ArrowDown": UIKeyCommand.inputDownArrow,
"ArrowLeft": UIKeyCommand.inputLeftArrow, "ArrowRight": UIKeyCommand.inputRightArrow,
"Minus": "-", "Equal": "=", "BracketLeft": "[", "BracketRight": "]", "Backslash": "\\",
"Semicolon": ";", "Quote": "'", "Backquote": "`", "Comma": ",", "Period": ".", "Slash": "/",
]
/// UIKit matches a key command against the unmodified character, so
/// Option+Shift+[ is registered as "[" with both modifier flags.
private func claimedShortcut(_ record: ClaimedShortcutRecord) -> ClaimedShortcut? {
let code = record.code
let input: String?
if code.count == 4 && code.hasPrefix("Key") { input = code.suffix(1).lowercased() }
else if code.count == 6 && code.hasPrefix("Digit") { input = String(code.suffix(1)) }
else { input = claimableKeyInputs[code] }
guard let input else { return nil }
var modifierFlags: UIKeyModifierFlags = []
if record.shift { modifierFlags.insert(.shift) }
if record.alt { modifierFlags.insert(.alternate) }
return ClaimedShortcut(input: input, modifierFlags: modifierFlags)
}
/// Whether the first responder is mid-IME-composition.
///
/// A committing key has to stay out of the way while a CJK candidate is being
@@ -62,6 +99,14 @@ public class PaseoHardwareKeyboardModule: Module {
}
}
Function("setClaimedShortcuts") { (shortcuts: [ClaimedShortcutRecord]) in
let claimed = shortcuts.compactMap(claimedShortcut)
DispatchQueue.main.async {
claimedShortcuts = claimed
UIMenuSystem.main.setNeedsRebuild()
}
}
OnDestroy {
self.keyboardObservers.forEach(NotificationCenter.default.removeObserver)
self.keyboardObservers = []
@@ -69,6 +114,7 @@ public class PaseoHardwareKeyboardModule: Module {
activeModule = nil
isHardwareSubmitEnabled = false
overlayKeys = []
claimedShortcuts = []
}
}
}
@@ -139,7 +185,10 @@ public final class PaseoHardwareKeyboardWindow: UIWindow {
{
commands.append(makeSubmitCommand())
}
if !isComposingText() { commands.append(contentsOf: overlayKeys.compactMap(makeShortcutCommand)) }
if !isComposingText() {
commands.append(contentsOf: overlayKeys.compactMap(makeShortcutCommand))
commands.append(contentsOf: claimedShortcuts.map(makeClaimedCommand))
}
return commands
}
@@ -172,6 +221,18 @@ public final class PaseoHardwareKeyboardWindow: UIWindow {
return command
}
/// The window's press stream still emits the shortcut; the command only keeps
/// the key away from the text control.
private func makeClaimedCommand(_ shortcut: ClaimedShortcut) -> UIKeyCommand {
let command = UIKeyCommand(
input: shortcut.input,
modifierFlags: shortcut.modifierFlags,
action: #selector(handleHardwareKeyboardShortcut(_:))
)
if #available(iOS 15.0, *) { command.wantsPriorityOverSystemBehavior = true }
return command
}
@objc
private func handleHardwareKeyboardSubmit(_ sender: UIKeyCommand) {
guard canSubmitCurrentTextInput() else {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.15.3",
"version": "0.16.0-beta.2",
"private": true,
"main": "index.ts",
"scripts": {
@@ -4,8 +4,12 @@ import { within } from "@testing-library/dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { i18n as testI18n } from "@/i18n/i18next";
import { ExpandableBadge } from "@/components/message";
import { page, userEvent } from "vitest/browser";
import { PlanCard } from "@/components/plan-card";
import { MessagePreview } from "@/components/user-message";
import { createUserMessageExpansion } from "@/components/user-message/expansion";
import { UserMessageExpansionContext } from "@/components/user-message/expansion-context";
import { DisclosureRow } from "./disclosure";
import type { DisclosureTriggerEdge, StreamViewportHandle } from "./strategy";
@@ -72,26 +76,19 @@ const view = () => within(container);
const preLine = { whiteSpace: "pre-line" } as const;
async function waitForLayout() {
await act(async () => {
for (let frame = 0; frame < 2; frame += 1) {
await new Promise((resolve) => requestAnimationFrame(resolve));
}
});
}
describe("timeline disclosures hold their row", () => {
it("routes user message show more and show less through the row's hold", async () => {
it("routes user message show more and show less through the row's hold", () => {
const longText = Array.from({ length: 60 }, (_, line) => `Line ${line + 1}`).join("\n");
const expansion = createUserMessageExpansion();
const holds = mountRow(
"message-1",
() => view().queryByRole("button", { name: "Show less" }) !== null,
<MessagePreview>
<span style={preLine}>{longText}</span>
</MessagePreview>,
<UserMessageExpansionContext.Provider value={expansion}>
<MessagePreview itemId="message-1">
<span style={preLine}>{longText}</span>
</MessagePreview>
</UserMessageExpansionContext.Provider>,
);
// The preview learns it overflows from its first layout.
await waitForLayout();
act(() => view().getByRole("button", { name: "Show more" }).click());
expect(view().getByRole("button", { name: "Show less" })).toBeTruthy();
@@ -145,3 +142,63 @@ describe("timeline disclosures hold their row", () => {
expect(isExpanded()).toBe(true);
});
});
function renderFileDetails() {
return <div>File contents</div>;
}
describe("tool badge file action", () => {
it("keeps file opening separate from the accessible disclosure button", async () => {
let opened = 0;
function Badge({ hasFile }: { hasFile: boolean }) {
const [expanded, setExpanded] = React.useState(false);
const toggle = React.useCallback(() => setExpanded(!expanded), [expanded]);
const openFile = React.useCallback(() => {
opened += 1;
}, []);
return (
<ExpandableBadge
label="Read"
secondaryLabel="src/index.ts"
isExpanded={expanded}
onToggle={toggle}
onOpenFile={hasFile ? openFile : undefined}
renderDetails={renderFileDetails}
/>
);
}
container.style.width = "300px";
container.style.marginLeft = "20px";
act(() => root.render(<Badge hasFile={false} />));
const header = page.getByRole("button", { name: "Read src/index.ts", exact: true });
const headerElement = view().getByRole("button", { name: /^Read src\/index\.ts$/ });
expect(headerElement.getBoundingClientRect().width).toBeGreaterThan(260);
await header.click({ position: { x: 220, y: 10 } });
await expect.element(page.getByText("File contents")).toBeVisible();
await header.click({ position: { x: 2, y: 2 } });
await expect.element(page.getByText("File contents")).not.toBeInTheDocument();
await header.click({ position: { x: 2, y: 2 } });
await expect.element(page.getByText("File contents")).toBeVisible();
await header.click({ position: { x: 220, y: 10 } });
await expect.element(page.getByText("File contents")).not.toBeInTheDocument();
act(() => root.render(<Badge hasFile />));
await page.getByRole("button", { name: "Read src/index.ts", exact: true }).hover();
const file = view().getByRole("button", { name: /^Open file$/ });
expect(file.parentElement?.closest("button")).toBeNull();
await page.getByRole("button", { name: "Open file", exact: true }).click();
expect(opened).toBe(1);
const disclosure = view().getByRole("button", { name: /^Read src\/index\.ts$/ });
expect(view().queryByText("File contents")).toBeNull();
await header.click({ position: { x: 220, y: 10 } });
await expect.element(page.getByText("File contents")).toBeVisible();
expect(opened).toBe(1);
act(() => file.focus());
await userEvent.keyboard("{Enter}");
expect(opened).toBe(2);
expect(view().getByText("File contents")).toBeTruthy();
act(() => disclosure.focus());
await userEvent.keyboard("{Enter}");
expect(view().queryByText("File contents")).toBeNull();
});
});
+34 -26
View File
@@ -66,6 +66,10 @@ import {
useAgentToolCallExpansion,
useExpandedToolCallGroups,
} from "@/tool-calls/expansion-context";
import {
UserMessageExpansionContext,
useAgentUserMessageExpansion,
} from "@/components/user-message/expansion-context";
import { ToolCallSheetProvider } from "@/components/tool-call-sheet";
import { createStreamPresentation } from "./presentation";
import { OverviewToolCallGroupView } from "@/tool-calls/detail-level/overview/view";
@@ -382,6 +386,7 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
new Set(),
);
const toolCallExpansion = useAgentToolCallExpansion(agentId);
const userMessageExpansion = useAgentUserMessageExpansion(agentId);
const expandedToolCallGroups = useExpandedToolCallGroups(toolCallExpansion);
const [expandedTurnHostIds, setExpandedTurnHostIds] = useState<ReadonlySet<string>>(new Set());
@@ -711,6 +716,7 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
(layoutItem: StreamLayoutItem, item: Extract<StreamItem, { kind: "user_message" }>) => {
return (
<UserMessage
itemId={item.id}
serverId={resolvedServerId}
agentId={agentId}
messageId={item.messageId}
@@ -1169,32 +1175,34 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
<AssistantSelectionCopySurface style={stylesheet.container}>
<MessageOuterSpacingProvider disableOuterSpacing>
<ToolCallExpansionContext.Provider value={toolCallExpansion}>
{streamRenderStrategy.render({
readingRowReplacements: presentation.readingRowReplacements,
agentId,
segments: renderModel.segments,
historyRowRevision,
liveHeadRowRevision: expandedToolCallGroups,
boundary,
renderers,
listEmptyComponent,
viewportRef,
routeBottomAnchorRequest,
isAuthoritativeHistoryReady,
isInitialHistoryLoading,
revealInitialHistory,
onNearBottomChange: nearBottom.set,
onReadingPositionChange: handleReadingPositionChange,
onNearHistoryStart: loadOlder,
isLoadingOlderHistory: isLoadingOlder,
hasOlderHistory: hasOlder,
olderHistoryProgressKey: progressKey,
scrollEnabled: streamScrollEnabled,
listStyle: stylesheet.list,
baseListContentContainerStyle: stylesheet.listContentContainer,
forwardListContentContainerStyle: stylesheet.forwardListContentContainer,
contentMaxWidth,
})}
<UserMessageExpansionContext.Provider value={userMessageExpansion}>
{streamRenderStrategy.render({
readingRowReplacements: presentation.readingRowReplacements,
agentId,
segments: renderModel.segments,
historyRowRevision,
liveHeadRowRevision: expandedToolCallGroups,
boundary,
renderers,
listEmptyComponent,
viewportRef,
routeBottomAnchorRequest,
isAuthoritativeHistoryReady,
isInitialHistoryLoading,
revealInitialHistory,
onNearBottomChange: nearBottom.set,
onReadingPositionChange: handleReadingPositionChange,
onNearHistoryStart: loadOlder,
isLoadingOlderHistory: isLoadingOlder,
hasOlderHistory: hasOlder,
olderHistoryProgressKey: progressKey,
scrollEnabled: streamScrollEnabled,
listStyle: stylesheet.list,
baseListContentContainerStyle: stylesheet.listContentContainer,
forwardListContentContainerStyle: stylesheet.forwardListContentContainer,
contentMaxWidth,
})}
</UserMessageExpansionContext.Provider>
</ToolCallExpansionContext.Provider>
</MessageOuterSpacingProvider>
<ChatOutlineRail
@@ -759,6 +759,56 @@ describe("assistant selection copy inside highlighted code", () => {
"```typescript\nconst answer = 1;\n if (answer) {\n doThing();\n```\n\nAfter the block.",
);
});
it("keeps line breaks when a quote selection ends partway through code", () => {
const message = mountHighlighted();
const quote = document.createElement("div");
quote.setAttribute("data-paseo-markdown-tag", "blockquote");
quote.textContent = "Quoted context";
message.querySelector('[data-paseo-markdown-tag="pre"]')!.before(quote);
const content = copyBetween(
[tokenText(message, "Quoted context"), 0],
[tokenText(message, " (answer)"), 9],
);
expect(content?.plainText).toBe(
"> Quoted context\n\n```typescript\nconst answer = 1;\n if (answer)\n```",
);
});
it("keeps indented code lines inside their list item", () => {
const host = document.createElement("div");
host.innerHTML = [
'<div data-testid="assistant-message">',
'<div data-paseo-markdown-tag="ol" data-paseo-markdown-list-start="1">',
'<div data-paseo-markdown-tag="li">',
'<div data-paseo-markdown-ignore="true" data-paseo-markdown-list-marker="true">1.</div>',
'<div><div data-paseo-markdown-tag="p"><span>Item text</span></div>',
highlightedCodeBlock("typescript"),
"</div></div></div></div>",
].join("");
document.body.append(host);
const content = copyBetween([tokenText(host, "1."), 0], [tokenText(host, " (answer)"), 9]);
expect(content?.plainText).toBe(
"1. Item text\n\n ```typescript\n const answer = 1;\n if (answer)\n ```",
);
});
it("keeps line breaks when a selection starts partway through code", () => {
const message = mountHighlighted();
const content = copyBetween(
[tokenText(message, " answer"), 1],
[tokenText(message, "After the block."), "After the block.".length],
);
expect(content?.plainText).toBe(
"```typescript\nanswer = 1;\n if (answer) {\n doThing();\n```\n\nAfter the block.",
);
});
});
describe("semantic library output", () => {
@@ -81,7 +81,8 @@ turndown.addRule("compactListItem", {
const item = content
.replace(/^\n+/, "")
.replace(/\n+$/, "\n")
.replace(/\n(?=\S)/g, "\n ");
// Every non-empty line, so indented code lines stay inside the item.
.replace(/\n(?=[^\n])/g, "\n ");
const parent = node.parentElement;
if (parent?.nodeName !== "OL") {
return `${options.bulletListMarker} ${item}\n`;
@@ -359,6 +360,9 @@ function shouldPreserveSemanticElement(range: Range, element: Element): boolean
if (tag === "p" || tag === "img" || isTableStructure(tag)) {
return true;
}
if (isCrossBoundaryCodeElement(range, element, tag)) {
return true;
}
const isSelectableSemantic = tag !== null && tag !== "li" && tag !== "ol" && tag !== "ul";
if (
(isSelectableSemantic || element.tagName === "A") &&
@@ -386,6 +390,11 @@ function shouldPreserveSemanticElement(range: Range, element: Element): boolean
return hasSelectedAllContents(range, element, tag === "li");
}
function isCrossBoundaryCodeElement(range: Range, element: Element, tag: string | null): boolean {
const isCode = tag === "pre" || (tag === "code" && Boolean(element.closest(CODE_BLOCK_SELECTOR)));
return isCode && !selectionStaysInsideElement(range, element);
}
function selectionStaysInsideElement(range: Range, element: Element): boolean {
return (
range.startContainer !== element &&
@@ -1,4 +1,4 @@
import { memo, useCallback, useMemo } from "react";
import { memo, useCallback, useMemo, useState } from "react";
import { Pressable, Text, View, type PressableStateCallbackType } from "react-native";
import { ExternalLink, Gift } from "lucide-react-native";
import { useTranslation } from "react-i18next";
@@ -156,9 +156,19 @@ interface ReleaseViewProps {
isCurrent: boolean;
}
/**
* A release that has highlights shows only them until the reader asks for the
* sections, which are the full record. A release without highlights has nothing
* to stand in for its sections, so it shows them as it always did.
*/
const ReleaseView = memo(function ReleaseView({ release, isCurrent }: ReleaseViewProps) {
const { t } = useTranslation();
const date = formatChangelogDate(release.date);
const [showingAllChanges, setShowingAllChanges] = useState(false);
const toggleAllChanges = useCallback(() => setShowingAllChanges((value) => !value), []);
const allChangesState = useMemo(() => ({ expanded: showingAllChanges }), [showingAllChanges]);
const hasHighlights = release.highlights.length > 0;
const showsSections = !hasHighlights || showingAllChanges;
return (
<View style={styles.release} testID={`changelog-release-${release.version}`}>
@@ -168,26 +178,40 @@ const ReleaseView = memo(function ReleaseView({ release, isCurrent }: ReleaseVie
<View style={styles.headingSpacer} />
{date ? <Text style={styles.date}>{date}</Text> : null}
</View>
{keyChangelogSections(release.sections).map(({ key, section }) => (
<View key={key} style={styles.section}>
{section.title ? <Text style={styles.sectionTitle}>{section.title}</Text> : null}
{section.body ? <MarkdownRenderer text={section.body} compact /> : null}
</View>
))}
{hasHighlights ? <MarkdownRenderer text={release.highlights} compact /> : null}
{hasHighlights && release.sections.length > 0 ? (
<Button
variant="ghost"
style={styles.allChangesToggle}
accessibilityState={allChangesState}
onPress={toggleAllChanges}
>
{t(showingAllChanges ? "changelog.hideAllChanges" : "changelog.showAllChanges")}
</Button>
) : null}
{showsSections ? <ReleaseSections sections={release.sections} /> : null}
</View>
);
});
function ReleaseSections({ sections }: { sections: readonly ChangelogSection[] }) {
return keyChangelogSections(sections).map(({ key, section }) => (
<View key={key} style={styles.section}>
{section.title ? <Text style={styles.sectionTitle}>{section.title}</Text> : null}
{section.body ? <MarkdownRenderer text={section.body} compact /> : null}
</View>
));
}
/** A release can repeat a section title; the occurrence keeps the key stable. */
function keyChangelogSections(
sections: readonly ChangelogSection[],
): { key: string; section: ChangelogSection }[] {
const seen = new Map<string, number>();
return sections.map((section) => {
const title = section.title ?? "";
const occurrence = seen.get(title) ?? 0;
seen.set(title, occurrence + 1);
return { key: `${title}:${occurrence}`, section };
const occurrence = seen.get(section.title) ?? 0;
seen.set(section.title, occurrence + 1);
return { key: `${section.title}:${occurrence}`, section };
});
}
@@ -236,6 +260,12 @@ const styles = StyleSheet.create((theme) => ({
textTransform: "uppercase",
letterSpacing: 0.5,
},
// Flush with the highlights above it, so the label's ink sits on their rail.
allChangesToggle: {
alignSelf: "flex-start",
paddingHorizontal: 0,
borderWidth: 0,
},
showMore: {
alignSelf: "center",
},
@@ -8,15 +8,15 @@ import {
type ChangelogSection,
} from "./parse-changelog";
function bodies(markdown: string, releaseIndex = 0): string[] {
return parseChangelog(markdown)[releaseIndex].sections.map(sectionBody);
function bodies(markdown: string): string[] {
return parseChangelog(markdown)[0].sections.map(sectionBody);
}
function sectionBody(section: ChangelogSection): string {
return section.body;
}
function sectionTitle(section: ChangelogSection): string | null {
function sectionTitle(section: ChangelogSection): string {
return section.title;
}
@@ -25,17 +25,36 @@ function releaseDate(release: ChangelogRelease): string {
}
function authoredLines(release: ChangelogRelease): string[] {
return release.sections.flatMap(sectionLines);
return [...release.highlights.split("\n"), ...release.sections.flatMap(sectionLines)];
}
function sectionLines(section: ChangelogSection): string[] {
return [...(section.title ? [`### ${section.title}`] : []), ...section.body.split("\n")];
return [`### ${section.title}`, ...section.body.split("\n")];
}
function isNotBlank(line: string): boolean {
return line.trim().length > 0;
}
function readRepositoryFile(path: string): string {
return readFileSync(fileURLToPath(new URL(`../../../../../${path}`, import.meta.url)), "utf8");
}
/** The cases the app, the website and the release scripts must all split the same way. */
interface ChangelogStructureCases {
document: string[];
releases: {
version: string;
date: string;
highlights: string[];
sectionTitles: string[];
}[];
}
const structureCases: ChangelogStructureCases = JSON.parse(
readRepositoryFile("scripts/test-support/changelog-structure.json"),
);
describe("parseChangelog", () => {
it("reads the shape the changelog is authored in today", () => {
const releases = parseChangelog(
@@ -44,7 +63,8 @@ describe("parseChangelog", () => {
"",
"## 0.8.0-beta.1 - 2026-09-08",
"",
"This release extends what plugins can do.",
"- **Plugin providers:** Plugins can add providers.",
"- **Faster diffs:** Diffs load sooner.",
"",
"### Plugins",
"",
@@ -67,8 +87,9 @@ describe("parseChangelog", () => {
{
version: "0.8.0-beta.1",
date: "2026-09-08",
highlights:
"- **Plugin providers:** Plugins can add providers.\n- **Faster diffs:** Diffs load sooner.",
sections: [
{ title: null, body: "This release extends what plugins can do." },
{
title: "Plugins",
body: "- Added provider contributions ([#4314](https://example.com/4314))",
@@ -79,6 +100,7 @@ describe("parseChangelog", () => {
{
version: "0.7.2",
date: "2026-09-02",
highlights: "",
sections: [{ title: "Fixed", body: "- Fixed a thing" }],
},
]);
@@ -89,7 +111,7 @@ describe("parseChangelog", () => {
"# Changelog\n\nAll notable changes.\n\n## 1.0.0 - 2026-01-01\n\n- One\n",
);
expect(releases).toHaveLength(1);
expect(releases[0].sections).toEqual([{ title: null, body: "- One" }]);
expect(releases[0]).toMatchObject({ highlights: "- One", sections: [] });
});
it("returns nothing for a document with no releases", () => {
@@ -136,13 +158,13 @@ describe("parseChangelog", () => {
it("does not treat a deeper heading as a release", () => {
const releases = parseChangelog("## 1.0.0 - 2026-01-01\n\n#### Deep\n\n- One\n");
expect(releases).toHaveLength(1);
expect(releases[0].sections).toEqual([{ title: null, body: "#### Deep\n\n- One" }]);
expect(releases[0].highlights).toBe("#### Deep\n\n- One");
});
it("does not treat an unspaced hash run as a heading", () => {
const releases = parseChangelog("## 1.0.0 - 2026-01-01\n\n##notaheading\n");
expect(releases).toHaveLength(1);
expect(releases[0].sections[0].body).toBe("##notaheading");
expect(releases[0].highlights).toBe("##notaheading");
});
});
@@ -162,14 +184,34 @@ describe("parseChangelog", () => {
]);
});
it("drops an empty lead section", () => {
it("keeps a bare section heading as an untitled section", () => {
const releases = parseChangelog("## 1.0.0 - 2026-01-01\n\n###\n\n- One\n");
expect(releases[0].sections).toEqual([{ title: "", body: "- One" }]);
});
});
describe("highlights", () => {
it("has none when the release opens with a section", () => {
const releases = parseChangelog("## 1.0.0 - 2026-01-01\n\n### Fixed\n\n- One\n");
expect(releases[0].sections).toEqual([{ title: "Fixed", body: "- One" }]);
expect(releases[0]).toMatchObject({
highlights: "",
sections: [{ title: "Fixed", body: "- One" }],
});
});
it("reads the summary paragraphs older entries opened with as highlights", () => {
const releases = parseChangelog(
"## 1.0.0 - 2026-01-01\n\nDaemon restarts keep terminals.\n\nMore here.\n\n### Added\n\n- One\n",
);
expect(releases[0]).toMatchObject({
highlights: "Daemon restarts keep terminals.\n\nMore here.",
sections: [{ title: "Added", body: "- One" }],
});
});
it("keeps a release that is only prose", () => {
const releases = parseChangelog("## 1.0.0 - 2026-01-01\n\nJust a note.\n");
expect(releases[0].sections).toEqual([{ title: null, body: "Just a note." }]);
expect(releases[0]).toMatchObject({ highlights: "Just a note.", sections: [] });
});
});
@@ -256,7 +298,12 @@ describe("parseChangelog", () => {
it("reads CRLF documents", () => {
const releases = parseChangelog("## 1.0.0 - 2026-01-01\r\n\r\n### Fixed\r\n\r\n- One\r\n");
expect(releases).toEqual([
{ version: "1.0.0", date: "2026-01-01", sections: [{ title: "Fixed", body: "- One" }] },
{
version: "1.0.0",
date: "2026-01-01",
highlights: "",
sections: [{ title: "Fixed", body: "- One" }],
},
]);
});
});
@@ -272,19 +319,45 @@ describe("formatChangelogDate", () => {
});
});
describe("the structure every changelog surface shares", () => {
for (const lineEnding of ["\n", "\r\n"]) {
it(`splits the shared cases with ${JSON.stringify(lineEnding)} line endings`, () => {
const releases = parseChangelog(structureCases.document.join(lineEnding));
expect(
releases.map((release) => ({
version: release.version,
date: release.date,
highlights: release.highlights.split("\n").filter(isNotBlank),
sectionTitles: release.sections.map(sectionTitle),
})),
).toEqual(
structureCases.releases.map((release) => ({
version: release.version,
date: release.date,
highlights: release.highlights.filter(isNotBlank),
sectionTitles: release.sectionTitles,
})),
);
});
}
});
describe("the repository's own CHANGELOG.md", () => {
const markdown = readFileSync(
fileURLToPath(new URL("../../../../../CHANGELOG.md", import.meta.url)),
"utf8",
);
const markdown = readRepositoryFile("CHANGELOG.md");
const releases = parseChangelog(markdown);
it("finds a release for every release heading line", () => {
const headingLines = markdown.split("\n").filter((line) => line.startsWith("## "));
expect(releases).toHaveLength(headingLines.length);
});
it("parses every release heading", () => {
expect(releases.length).toBeGreaterThan(50);
for (const release of releases) {
expect(release.version).toMatch(/^\d+\.\d+\.\d+/);
expect(release.date).toMatch(/^\d{4}-\d{2}-\d{2}$/);
expect(release.sections.length).toBeGreaterThan(0);
expect(release.highlights.length + release.sections.length).toBeGreaterThan(0);
}
});
@@ -3,7 +3,10 @@
*
* The document is authored in the repository, fetched at runtime, and rewritten
* on every release, so this parser commits to exactly two facts: a `##` heading
* starts a release and a `###` heading starts a section inside it. Everything
* starts a release and a `###` heading starts a section inside it. Whatever sits
* between the release heading and its first section is the release's
* highlights: the list a release now leads with, or the summary paragraphs and
* notices older entries opened with. Everything
* else — prose, callouts, block quotes, fenced code, images, video and embed
* HTML, tables, nested lists — is carried through verbatim and handed to the
* Markdown renderer. A new block kind in the changelog therefore needs no
@@ -17,8 +20,8 @@
*/
export interface ChangelogSection {
/** The `###` heading text, or null for content that precedes the first one. */
title: string | null;
/** The `###` heading text. Empty for a bare `###`. */
title: string;
/** Verbatim markdown under the heading. */
body: string;
}
@@ -28,7 +31,9 @@ export interface ChangelogRelease {
version: string;
/** The heading tail after the version. Empty when the heading carried none. */
date: string;
/** Sections in document order; the untitled lead section comes first. */
/** Verbatim markdown before the first section. Empty when the release opens with one. */
highlights: string;
/** The `###` sections in document order. */
sections: ChangelogSection[];
}
@@ -46,13 +51,14 @@ const LEADING_V = /^v(?=\d)/i;
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
interface SectionDraft {
title: string | null;
title: string;
lines: string[];
}
interface ReleaseDraft {
version: string;
date: string;
highlights: string[];
sections: SectionDraft[];
}
@@ -75,7 +81,8 @@ export function parseChangelog(markdown: string): ChangelogRelease[] {
if (releaseHeading) {
releases.push({
...splitReleaseHeading(releaseHeading[1] ?? ""),
sections: [{ title: null, lines: [] }],
highlights: [],
sections: [],
});
continue;
}
@@ -83,7 +90,7 @@ export function parseChangelog(markdown: string): ChangelogRelease[] {
const sectionHeading = line.match(SECTION_HEADING);
if (sectionHeading && releases.length > 0) {
releases[releases.length - 1].sections.push({
title: (sectionHeading[1] ?? "").replace(ATX_CLOSING, "").trim() || null,
title: (sectionHeading[1] ?? "").replace(ATX_CLOSING, "").trim(),
lines: [],
});
continue;
@@ -91,19 +98,22 @@ export function parseChangelog(markdown: string): ChangelogRelease[] {
}
const release = releases.at(-1);
if (release) release.sections[release.sections.length - 1].lines.push(line);
if (release) (release.sections.at(-1)?.lines ?? release.highlights).push(line);
}
return releases.map(materializeRelease);
}
function materializeRelease(draft: ReleaseDraft): ChangelogRelease {
const sections = draft.sections
.map((section) => ({ title: section.title, body: trimBlankLines(section.lines) }))
// A heading with an empty body still names something; an empty lead section
// is just the gap between the release heading and the first section.
.filter((section) => section.title !== null || section.body.length > 0);
return { version: draft.version, date: draft.date, sections };
return {
version: draft.version,
date: draft.date,
highlights: trimBlankLines(draft.highlights),
sections: draft.sections.map((section) => ({
title: section.title,
body: trimBlankLines(section.lines),
})),
};
}
function trimBlankLines(lines: string[]): string {
@@ -28,6 +28,7 @@ import { isWeb } from "@/constants/platform";
import { useKeyboardVisibility } from "@/hooks/use-keyboard-visibility";
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
import { AdaptiveTextInput } from "@/components/adaptive-text-input";
import { useDismissibleOverlay } from "@/components/ui/overlay-dismissal";
export { AdaptiveTextInput, type AdaptiveTextInputProps } from "@/components/adaptive-text-input";
// Horizontal indent token shared by the sheet header (title, back arrow,
@@ -654,6 +655,9 @@ export function AdaptiveModalSheet({
const isMobile = useIsCompactFormFactor();
const isKeyboardVisible = useKeyboardVisibility(visible);
const resolvedSnapPoints = useMemo(() => snapPoints ?? ["65%", "90%"], [snapPoints]);
const isSheet = isMobile || !isWeb;
// The sheet registers itself; the desktop dialog does not use it.
useDismissibleOverlay(visible && !isSheet, onClose);
const footerView = useMemo(
() => (footer ? <SheetFooter style={footerContainerStyle}>{footer}</SheetFooter> : null),
[footer, footerContainerStyle],
@@ -668,7 +672,7 @@ export function AdaptiveModalSheet({
const { sheetRef, handleSheetChange, handleSheetDismiss } = useIsolatedBottomSheetVisibility({
visible,
isEnabled: isMobile || !isWeb,
isEnabled: isSheet,
onClose,
});
const [shouldRenderWeb, setShouldRenderWeb] = useState(visible);
@@ -305,7 +305,7 @@ const styles = StyleSheet.create((theme) => ({
alignItems: "center",
backgroundColor: "transparent",
gap: theme.spacing[1],
...toolbarContentSlot(theme.spacing[2]),
...toolbarContentSlot(),
borderRadius: theme.borderRadius.full,
},
triggerHovered: {
@@ -338,7 +338,6 @@ const styles = StyleSheet.create((theme) => ({
customTriggerWrapper: {
paddingHorizontal: 0,
paddingVertical: 0,
marginHorizontal: 0,
height: "auto",
},
triggerFill: {
@@ -63,10 +63,25 @@ const html = `<!doctype html>
#diagram svg {
display: block;
}
/* Keep Mermaid's temporary render container unscaled when the host mounts this frame
at 0x0 or 240x240 before the diagram's own dimensions are known. */
#staging-clip {
position: fixed;
width: 0;
height: 0;
overflow: hidden;
visibility: hidden;
pointer-events: none;
}
#staging {
width: 16384px;
height: 16384px;
}
</style>
</head>
<body>
<div id="diagram"></div>
<div id="staging-clip" aria-hidden="true"><div id="staging"></div></div>
<script>${js}</script>
</body>
</html>`;
@@ -40,6 +40,9 @@ function initializeMermaid(colorScheme: "light" | "dark"): void {
],
flowchart: { htmlLabels: false },
class: { htmlLabels: false },
// A gantt chart takes the width of the element it renders in, which is the oversized staging
// container. Keep it as wide as this frame, which on native is the message column.
gantt: { useWidth: document.body.clientWidth },
});
}
@@ -97,7 +100,15 @@ function measureDiagram(host: HTMLElement, svg: SVGSVGElement | null): DiagramSi
async function render(message: MermaidRuntimeRenderMessage): Promise<void> {
try {
initializeMermaid(message.colorScheme);
const { svg } = await mermaid.render(`paseo-mermaid-${message.revision}`, message.source);
const staging = document.getElementById("staging");
if (!staging) {
throw new Error("Missing Mermaid staging container");
}
const { svg } = await mermaid.render(
`paseo-mermaid-${message.revision}`,
message.source,
staging,
);
if (message.revision !== latestRevision) {
return;
}
File diff suppressed because one or more lines are too long
@@ -29,9 +29,15 @@ function waitForRuntimeMessage(
});
}
async function mountRuntime(size?: { width: number; height: number }): Promise<HTMLIFrameElement> {
async function mountRuntime(
size?: { width: number; height: number },
options?: { allowSameOrigin?: boolean },
): Promise<HTMLIFrameElement> {
const frame = document.createElement("iframe");
frame.sandbox.add("allow-scripts");
if (options?.allowSameOrigin) {
frame.sandbox.add("allow-same-origin");
}
if (size) {
frame.style.width = `${size.width}px`;
frame.style.height = `${size.height}px`;
@@ -112,6 +118,103 @@ describe("Mermaid sandbox runtime", () => {
expect(renderedSize(narrow)).toEqual(renderedSize(wide));
});
/**
* MermaidFenceHost renders the first revision inside a 240x240 measuring frame (or 0x0 before
* ResizeObserver settles), then resizes the frame to the reported diagram size without
* re-rendering. Diagrams such as xychart-beta set `width="100%"` and `viewBox="0 0 700 500"`
* before measuring axis text with `getBoundingClientRect()`, so rendering directly in a narrow
* frame shrinks measured glyph boxes and leaves the Y-axis title colliding with tick labels and
* X-axis labels clipped at the bottom edge.
*/
it("preserves unscaled SVG layout when rendered inside a narrow or zero-sized frame", async () => {
const source = [
"xychart-beta",
' title "Throughput by Stage (req/s)"',
' x-axis ["v1-base", "v2-parse", "v3-batch", "v4-cache", "v5-simd", "v6-final"]',
' y-axis "Throughput (req/s)" 92.5 --> 93.6',
" bar [92.7, 92.8, 93.1, 93.2, 93.3, 93.5]",
].join("\n");
const zeroFrame = await mountRuntime({ height: 0, width: 0 }, { allowSameOrigin: true });
const measuringFrame = await mountRuntime(
{ height: 240, width: 240 },
{ allowSameOrigin: true },
);
const fullFrame = await mountRuntime({ height: 500, width: 700 }, { allowSameOrigin: true });
await render(zeroFrame, { revision: 1, source });
await render(measuringFrame, { revision: 1, source });
await render(fullFrame, { revision: 1, source });
for (const frame of [zeroFrame, measuringFrame]) {
frame.style.width = "700px";
frame.style.height = "500px";
const doc = frame.contentDocument;
if (!doc) {
throw new Error("Expected inspectable runtime document");
}
const svgRect = doc.querySelector("#diagram svg")?.getBoundingClientRect();
const yTitleRect = doc.querySelector(".left-axis .title text")?.getBoundingClientRect();
const yLabels = Array.from(doc.querySelectorAll(".left-axis .label text"));
const xLabels = Array.from(doc.querySelectorAll(".bottom-axis .label text"));
expect(svgRect).not.toBeUndefined();
expect(yTitleRect).not.toBeUndefined();
expect(yLabels.length).toBeGreaterThan(0);
expect(xLabels.length).toBeGreaterThan(0);
for (const label of yLabels) {
expect(yTitleRect!.right).toBeLessThan(label.getBoundingClientRect().left);
}
for (const label of xLabels) {
expect(label.getBoundingClientRect().bottom).toBeLessThanOrEqual(svgRect!.bottom);
}
}
function axisOrigin(frame: HTMLIFrameElement): { leftAxisX: number; bottomAxisY: number } {
const doc = frame.contentDocument;
const leftPath = doc?.querySelector(".left-axis .axisl-line path")?.getAttribute("d") ?? "";
const bottomPath =
doc?.querySelector(".bottom-axis .axis-line path")?.getAttribute("d") ?? "";
const leftMatch = leftPath.match(/^M\s+([\d.]+),/);
const bottomMatch = bottomPath.match(/^M\s+[\d.]+,([\d.]+)/);
if (!leftMatch || !bottomMatch) {
throw new Error(`Unexpected axis paths: ${leftPath} | ${bottomPath}`);
}
return {
leftAxisX: Number.parseFloat(leftMatch[1]),
bottomAxisY: Number.parseFloat(bottomMatch[1]),
};
}
const fullOrigin = axisOrigin(fullFrame);
for (const candidate of [measuringFrame, zeroFrame]) {
const origin = axisOrigin(candidate);
expect(origin.leftAxisX).toBeCloseTo(fullOrigin.leftAxisX, 3);
expect(origin.bottomAxisY).toBeCloseTo(fullOrigin.bottomAxisY, 3);
}
});
/**
* A gantt chart takes the width of the element Mermaid renders it in. Rendering inside the large
* offscreen container must keep it as wide as the frame, which on native is the message column.
*/
it("renders a gantt chart as wide as the frame the host gives it", async () => {
const source = [
"gantt",
" title Release plan",
" dateFormat YYYY-MM-DD",
" section Build",
" Design :a1, 2024-01-01, 10d",
" Implement :after a1, 20d",
].join("\n");
const widths = [];
for (const width of [240, 350, 900]) {
const frame = await mountRuntime({ height: 240, width });
widths.push(renderedSize(await render(frame, { revision: 1, source })).width);
}
expect(widths).toEqual([240, 350, 900]);
});
it("coalesces queued input and never reports an obsolete result", async () => {
const frame = await mountRuntime();
const obsoleteSource = `flowchart TD\n${Array.from({ length: 250 }, (_, index) => `A${index} --> A${index + 1}`).join("\n")}`;
+41 -60
View File
@@ -92,6 +92,8 @@ export type { InlinePathTarget } from "@/assistant-file-links";
export type { AssistantForkTarget };
interface UserMessageProps {
/** The timeline item's id, which keeps the message's expanded state. */
itemId: string;
sender?: AgentMessage["sender"];
serverId?: string;
agentId?: string;
@@ -391,6 +393,7 @@ function UserMessageImagePill({ image, onOpen, accessibilityLabel }: UserMessage
const MESSAGE_TEXT_DATASET = { messageText: "true" };
export const UserMessage = memo(function UserMessage({
itemId,
sender,
serverId,
agentId,
@@ -480,7 +483,7 @@ export const UserMessage = memo(function UserMessage({
>
{sender ? <MessageSender sender={sender} serverId={serverId} /> : null}
<View style={userMessageStylesheet.bubble}>
<MessagePreview>
<MessagePreview itemId={itemId}>
{hasImages ? (
<View style={imagePreviewContainerStyle}>
{images.map((image) => (
@@ -922,13 +925,19 @@ const expandableBadgeStylesheet = StyleSheet.create((theme) => ({
borderRadius: theme.borderRadius.lg,
borderWidth: theme.borderWidth[1],
borderColor: "transparent",
paddingHorizontal: theme.spacing[2],
paddingVertical: theme.spacing[1],
overflow: "hidden",
},
pressablePressed: {
opacity: 0.9,
},
disclosureButton: {
flex: 1,
minWidth: 0,
paddingHorizontal: theme.spacing[2],
paddingVertical: theme.spacing[1],
flexDirection: "row",
alignItems: "center",
},
headerRow: {
flexDirection: "row",
alignItems: "center",
@@ -984,15 +993,12 @@ const expandableBadgeStylesheet = StyleSheet.create((theme) => ({
flexShrink: 0,
},
openFileButton: {
marginRight: theme.spacing[2],
marginLeft: theme.spacing[1],
padding: theme.spacing[1],
borderRadius: theme.borderRadius.md,
flexShrink: 0,
},
openFileButtonPlaceholderIcon: {
width: 14,
height: 14,
},
detailWrapper: {
borderBottomLeftRadius: theme.borderRadius.lg,
borderBottomRightRadius: theme.borderRadius.lg,
@@ -1598,7 +1604,6 @@ interface ExpandableBadgeWebShimmerOverlayProps {
secondaryLabel?: string;
shimmerLabelTextStyle: StyleProp<TextStyle>;
shimmerSecondaryTextStyle: StyleProp<TextStyle>;
showOpenFileButton: boolean;
}
function ExpandableBadgeWebShimmerOverlay({
@@ -1606,7 +1611,6 @@ function ExpandableBadgeWebShimmerOverlay({
secondaryLabel,
shimmerLabelTextStyle,
shimmerSecondaryTextStyle,
showOpenFileButton,
}: ExpandableBadgeWebShimmerOverlayProps) {
return (
<View style={expandableBadgeStylesheet.shimmerOverlay} pointerEvents="none">
@@ -1618,14 +1622,7 @@ function ExpandableBadgeWebShimmerOverlay({
{secondaryLabel}
</Text>
) : null}
{showOpenFileButton ? (
<View style={expandableBadgeStylesheet.openFileButton}>
<View style={expandableBadgeStylesheet.openFileButtonPlaceholderIcon} />
</View>
) : null}
{!secondaryLabel && !showOpenFileButton ? (
<View style={expandableBadgeStylesheet.spacer} />
) : null}
{!secondaryLabel ? <View style={expandableBadgeStylesheet.spacer} /> : null}
</View>
);
}
@@ -1649,11 +1646,6 @@ interface ExpandableBadgeLabelRowProps {
onLabelRowLayout: (event: LayoutChangeEvent) => void;
onLabelLayout: (event: LayoutChangeEvent) => void;
onSecondaryLayout: (event: LayoutChangeEvent) => void;
showOpenFileButton: boolean;
isOpenFileHovered: boolean;
onOpenFilePress: (event: GestureResponderEvent) => void;
onOpenFileHoverIn: () => void;
onOpenFileHoverOut: () => void;
}
function ExpandableBadgeLabelRow({
@@ -1675,13 +1667,7 @@ function ExpandableBadgeLabelRow({
onLabelRowLayout,
onLabelLayout,
onSecondaryLayout,
showOpenFileButton,
isOpenFileHovered,
onOpenFilePress,
onOpenFileHoverIn,
onOpenFileHoverOut,
}: ExpandableBadgeLabelRowProps) {
const { t } = useTranslation();
return (
<View
style={expandableBadgeStylesheet.labelRow}
@@ -1700,30 +1686,12 @@ function ExpandableBadgeLabelRow({
shouldMeasureWebShimmer={shouldMeasureWebShimmer}
onSecondaryLayout={onSecondaryLayout}
/>
{showOpenFileButton ? (
<Pressable
onPress={onOpenFilePress}
onHoverIn={onOpenFileHoverIn}
onHoverOut={onOpenFileHoverOut}
accessibilityRole="button"
accessibilityLabel={t("message.actions.openFile")}
testID="tool-call-open-file"
style={expandableBadgeStylesheet.openFileButton}
hitSlop={6}
>
<ThemedFileSymlinkIcon
size={14}
uniProps={isOpenFileHovered ? foregroundColorMapping : foregroundMutedColorMapping}
/>
</Pressable>
) : null}
{isWebShimmer ? (
<ExpandableBadgeWebShimmerOverlay
label={label}
secondaryLabel={secondaryLabel}
shimmerLabelTextStyle={shimmerLabelTextStyle}
shimmerSecondaryTextStyle={shimmerSecondaryTextStyle}
showOpenFileButton={showOpenFileButton}
/>
) : null}
{isNativeShimmer ? (
@@ -1928,6 +1896,7 @@ export const ExpandableBadge = memo(function ExpandableBadge({
borderlessWhenExpanded = false,
testID,
}: ExpandableBadgeProps) {
const { t } = useTranslation();
const resolvedDisableOuterSpacing = useDisableOuterSpacing(disableOuterSpacing);
const [isHovered, setIsHovered] = useState(false);
const [isOpenFileHovered, setIsOpenFileHovered] = useState(false);
@@ -2190,13 +2159,13 @@ export const ExpandableBadge = memo(function ExpandableBadge({
onPointerEnter={isWeb ? handleHoverIn : undefined}
onPointerLeave={isWeb ? handleHoverOut : undefined}
>
<Pressable
{...pressHandlers}
disabled={!isInteractive}
accessibilityState={accessibilityState}
style={pressableStyle}
>
<View style={expandableBadgeStylesheet.headerRow}>
<View style={[pressableStyle, expandableBadgeStylesheet.headerRow]}>
<Pressable
{...pressHandlers}
disabled={!isInteractive}
accessibilityState={accessibilityState}
style={expandableBadgeStylesheet.disclosureButton}
>
<View style={expandableBadgeStylesheet.iconBadge}>{iconSlotNode}</View>
<ExpandableBadgeLabelRow
label={label}
@@ -2217,14 +2186,26 @@ export const ExpandableBadge = memo(function ExpandableBadge({
onLabelRowLayout={handleLabelRowLayout}
onLabelLayout={handleLabelLayout}
onSecondaryLayout={handleSecondaryLayout}
showOpenFileButton={Boolean(onOpenFile && isHovered)}
isOpenFileHovered={isOpenFileHovered}
onOpenFilePress={handleOpenFilePress}
onOpenFileHoverIn={handleOpenFileHoverIn}
onOpenFileHoverOut={handleOpenFileHoverOut}
/>
</View>
</Pressable>
</Pressable>
{onOpenFile && isHovered ? (
<Pressable
onPress={handleOpenFilePress}
onHoverIn={handleOpenFileHoverIn}
onHoverOut={handleOpenFileHoverOut}
accessibilityRole="button"
accessibilityLabel={t("message.actions.openFile")}
testID="tool-call-open-file"
style={expandableBadgeStylesheet.openFileButton}
hitSlop={6}
>
<ThemedFileSymlinkIcon
size={14}
uniProps={isOpenFileHovered ? foregroundColorMapping : foregroundMutedColorMapping}
/>
</Pressable>
) : null}
</View>
{detailContent ? (
<Pressable
ref={detailWrapperRef}
+64 -25
View File
@@ -106,29 +106,76 @@ function ProviderSettingsAction({
);
}
function AgentProfilesEditAction({ onPress }: { onPress: () => void }) {
const { t } = useTranslation();
/**
* An icon button that explains itself in a tooltip on desktop hover. Tooltips
* never open on mobile, so native renders the shared gesture-aware pressable
* instead of a plain Pressable: inside the model list's independent scroll
* viewport (Android, wide windows) the native scroll gesture cancels a plain
* Pressable's touches and the button would never fire.
*/
function IconActionButton({
accessibilityLabel,
testID,
onPress,
style,
children,
}: {
accessibilityLabel: string;
testID: string;
onPress: () => void;
style?:
| StyleProp<ViewStyle>
| ((state: PressableStateCallbackType & { hovered?: boolean }) => StyleProp<ViewStyle>);
children: React.ReactNode;
}) {
if (isNative) {
return (
<ModelBrowserPressable
onPress={onPress}
hitSlop={8}
style={style}
accessibilityLabel={accessibilityLabel}
testID={testID}
>
{children}
</ModelBrowserPressable>
);
}
return (
<Tooltip delayDuration={250} enabledOnDesktop enabledOnMobile={false}>
<TooltipTrigger asChild>
<Pressable
onPress={onPress}
hitSlop={8}
style={iconButtonStyle}
style={style}
accessibilityRole="button"
accessibilityLabel={t("modelSelector.editProfilesLabel")}
testID="model-profiles-edit"
accessibilityLabel={accessibilityLabel}
testID={testID}
>
<ThemedPencil size={ICON_SIZE.xs} uniProps={foregroundExtraMutedMapping} />
{children}
</Pressable>
</TooltipTrigger>
<TooltipContent side="top" align="center" offset={8}>
<Text style={styles.tooltipText}>{t("modelSelector.editProfilesLabel")}</Text>
<Text style={styles.tooltipText}>{accessibilityLabel}</Text>
</TooltipContent>
</Tooltip>
);
}
function AgentProfilesEditAction({ onPress }: { onPress: () => void }) {
const { t } = useTranslation();
return (
<IconActionButton
onPress={onPress}
style={iconButtonStyle}
accessibilityLabel={t("modelSelector.editProfilesLabel")}
testID="model-profiles-edit"
>
<ThemedPencil size={ICON_SIZE.xs} uniProps={foregroundExtraMutedMapping} />
</IconActionButton>
);
}
const IndependentScrollGestureContext = createContext<ReturnType<typeof Gesture.Native> | null>(
null,
);
@@ -637,24 +684,14 @@ function ModelRowProfileAction({
[visible],
);
return (
<Tooltip delayDuration={250} enabledOnDesktop enabledOnMobile={false}>
<TooltipTrigger asChild>
<Pressable
onPress={onPress}
hitSlop={8}
style={pressableStyle}
pointerEvents={visible ? "auto" : "none"}
accessibilityRole="button"
accessibilityLabel={label}
testID={testID}
>
{children}
</Pressable>
</TooltipTrigger>
<TooltipContent side="top" align="center" offset={8}>
<Text style={styles.tooltipText}>{label}</Text>
</TooltipContent>
</Tooltip>
<IconActionButton
onPress={onPress}
style={pressableStyle}
accessibilityLabel={label}
testID={testID}
>
{children}
</IconActionButton>
);
}
@@ -1690,8 +1727,10 @@ const styles = StyleSheet.create((theme) => ({
rowIconButtonPressed: {
backgroundColor: theme.colors.surface1,
},
// Hidden in style so every pressable branch that applies the style also stops taking taps.
profileActionHidden: {
opacity: 0,
pointerEvents: "none",
},
emptyState: {
padding: theme.spacing[4],
@@ -17,6 +17,7 @@ import {
useEffect,
useRef,
type ReactElement,
type ReactNode,
type MutableRefObject,
type Ref,
type ComponentProps,
@@ -35,7 +36,7 @@ import type { Theme } from "@/styles/theme";
import type { SidebarSurfaceBackdrop } from "@/styles/surface-backdrop";
import { getSidebarRowBackdrop } from "@/components/sidebar/sidebar-row-backdrop";
import { type GestureType } from "react-native-gesture-handler";
import { WorkspaceRenameModal } from "@/components/workspace-rename-modal";
import { useSidebarWorkspaceRename } from "@/workspace-rename";
import { useWorkspaceClipboardActions } from "@/hooks/use-workspace-clipboard-actions";
import { ExternalLink, Settings, MoreVertical, Plus, Trash2 } from "lucide-react-native";
import { NestableScrollContainer } from "react-native-draggable-flatlist";
@@ -287,6 +288,8 @@ interface WorkspaceRowInnerProps {
onCopyBranchName?: () => void;
onCopyPath?: () => void;
onRename?: () => void;
/** Present while the row is renamed in place: the row stops pressing, dragging and hovering. */
titleEditor?: ReactNode;
onMarkAsRead?: () => void;
onMarkAsUnread?: () => void;
archiveShortcutKeys?: ShortcutKey[][] | null;
@@ -1075,6 +1078,7 @@ function WorkspaceRowInner({
onCopyBranchName,
onCopyPath,
onRename,
titleEditor = null,
onMarkAsRead,
onMarkAsUnread,
archiveShortcutKeys,
@@ -1116,9 +1120,14 @@ function WorkspaceRowInner({
}, [interaction]);
const accessibilityState = useMemo(() => ({ selected }), [selected]);
const isEditingTitle = titleEditor !== null;
return (
<SidebarWorkspaceRowFrame workspace={workspace} isDragging={isDragging}>
<SidebarWorkspaceRowFrame
workspace={workspace}
isDragging={isDragging}
isEditingTitle={isEditingTitle}
>
{({ isHovered, contextMenuOpen, onContextMenuOpenChange, hoverHandlers }) => {
const isDesktop = !isTouchPlatform;
const serviceSummary = isDesktop ? selectWorkspaceServiceSummary(workspace.scripts) : null;
@@ -1132,7 +1141,7 @@ function WorkspaceRowInner({
return (
<View
{...dragAttributes}
{...dragHandleProps?.listeners}
{...(isEditingTitle ? null : dragHandleProps?.listeners)}
ref={dragHandleProps?.setActivatorNodeRef as unknown as Ref<View>}
style={styles.workspaceRowContainer}
{...hoverHandlers}
@@ -1158,15 +1167,16 @@ function WorkspaceRowInner({
onTogglePin={onTogglePin}
openInFileManagerPath={workspace.workspaceDirectory}
disabled={isArchiving}
enabled={!isEditingTitle}
aria-selected={selected}
accessibilityRole="button"
accessibilityState={accessibilityState}
style={workspaceRowStyle}
highlightStyle={styles.workspaceRowPressed}
onPressIn={handleWorkspacePressIn}
onTouchMove={interaction.handleTouchMove}
onPressOut={handleWorkspacePressOut}
onPress={handlePress}
onPressIn={isEditingTitle ? undefined : handleWorkspacePressIn}
onTouchMove={isEditingTitle ? undefined : interaction.handleTouchMove}
onPressOut={isEditingTitle ? undefined : handleWorkspacePressOut}
onPress={isEditingTitle ? undefined : handlePress}
testID={`sidebar-workspace-row-${workspace.workspaceKey}`}
>
<SidebarWorkspaceRowContent
@@ -1182,6 +1192,7 @@ function WorkspaceRowInner({
shortcutNumber={shortcutNumber}
showShortcutBadge={showShortcutBadge}
reserveIdleStatusIndicatorSpace={reserveIdleStatusIndicatorSpace}
titleEditor={titleEditor}
>
<WorkspaceRowRightGroup
workspace={workspace}
@@ -1251,7 +1262,7 @@ function WorkspaceRowWithMenu({
const { t } = useTranslation();
const toast = useToast();
const [isHidingWorkspace, setIsHidingWorkspace] = useState(false);
const [isRenameOpen, setIsRenameOpen] = useState(false);
const rename = useSidebarWorkspaceRename(workspace);
const isArchiving = workspace.archivingAt !== null || isHidingWorkspace;
const redirectAfterArchive = useCallback(() => {
redirectIfArchivingActiveWorkspace({
@@ -1287,14 +1298,6 @@ function WorkspaceRowWithMenu({
clipboard.copyBranchName(workspace);
}, [clipboard, workspace]);
const handleOpenRename = useCallback(() => {
setIsRenameOpen(true);
}, []);
const handleCloseRename = useCallback(() => {
setIsRenameOpen(false);
}, []);
const isPinned = workspace.pinnedAt != null;
const handleTogglePin = useCallback(() => {
onToggleWorkspacePin(workspace);
@@ -1352,7 +1355,8 @@ function WorkspaceRowWithMenu({
onArchive={handleArchive}
onCopyBranchName={canCopyBranchName ? handleCopyBranchName : undefined}
onCopyPath={handleCopyPath}
onRename={handleOpenRename}
onRename={rename.begin}
titleEditor={rename.titleEditor}
onMarkAsRead={hasClearableAttention ? handleMarkAsRead : undefined}
onMarkAsUnread={canMarkUnread ? handleMarkAsUnread : undefined}
archiveShortcutKeys={selected ? archiveShortcutKeys : null}
@@ -1360,12 +1364,7 @@ function WorkspaceRowWithMenu({
onTogglePin={onTogglePin}
reserveIdleStatusIndicatorSpace={reserveIdleStatusIndicatorSpace}
/>
<WorkspaceRenameModal
visible={isRenameOpen}
workspace={workspace}
onClose={handleCloseRename}
testID={`sidebar-workspace-rename-modal-${workspace.workspaceKey}`}
/>
{rename.modal}
</>
);
}
@@ -40,7 +40,7 @@ import {
CircleX,
} from "lucide-react-native";
import { useToast } from "@/contexts/toast-context";
import { WorkspaceRenameModal } from "@/components/workspace-rename-modal";
import { useSidebarWorkspaceRename } from "@/workspace-rename";
import { useWorkspaceClipboardActions } from "@/hooks/use-workspace-clipboard-actions";
import { redirectIfArchivingActiveWorkspace } from "@/utils/sidebar-workspace-archive-redirect";
import { useWorkspaceArchive } from "@/workspace/use-workspace-archive";
@@ -637,7 +637,7 @@ function StatusWorkspaceRowWithMenu({
const { t } = useTranslation();
const toast = useToast();
const [isHidingWorkspace, setIsHidingWorkspace] = useState(false);
const [isRenameOpen, setIsRenameOpen] = useState(false);
const rename = useSidebarWorkspaceRename(workspace);
const isArchiving = workspace.archivingAt !== null || isHidingWorkspace;
const redirectAfterArchive = useCallback(() => {
@@ -674,8 +674,6 @@ function StatusWorkspaceRowWithMenu({
clipboard.copyBranchName(workspace);
}, [clipboard, workspace]);
const handleOpenRename = useCallback(() => setIsRenameOpen(true), []);
const handleCloseRename = useCallback(() => setIsRenameOpen(false), []);
const isPinned = workspace.pinnedAt != null;
const handleTogglePin = useCallback(() => {
onToggleWorkspacePin(workspace);
@@ -728,7 +726,8 @@ function StatusWorkspaceRowWithMenu({
onArchive={handleArchive}
onCopyBranchName={workspace.projectKind === "git" ? handleCopyBranchName : undefined}
onCopyPath={handleCopyPath}
onRename={handleOpenRename}
onRename={rename.begin}
titleEditor={rename.titleEditor}
onMarkAsRead={hasClearableAttention ? handleMarkAsRead : undefined}
onMarkAsUnread={canMarkUnread ? handleMarkAsUnread : undefined}
archiveShortcutKeys={selected ? archiveShortcutKeys : null}
@@ -740,12 +739,7 @@ function StatusWorkspaceRowWithMenu({
isDragging={isDragging}
dragHandleProps={dragHandleProps}
/>
<WorkspaceRenameModal
visible={isRenameOpen}
workspace={workspace}
onClose={handleCloseRename}
testID={`sidebar-workspace-rename-modal-${workspace.workspaceKey}`}
/>
{rename.modal}
</>
);
}
@@ -767,6 +761,8 @@ interface StatusWorkspaceRowInnerProps {
onCopyBranchName?: () => void;
onCopyPath?: () => void;
onRename?: () => void;
/** Present while the row is renamed in place: the row stops pressing, dragging and hovering. */
titleEditor?: ReactNode;
onMarkAsRead?: () => void;
onMarkAsUnread?: () => void;
archiveShortcutKeys?: ShortcutKey[][] | null;
@@ -814,6 +810,7 @@ function StatusWorkspaceRowInnerContent({
onCopyBranchName,
onCopyPath,
onRename,
titleEditor = null,
onMarkAsRead,
onMarkAsUnread,
archiveShortcutKeys,
@@ -842,6 +839,7 @@ function StatusWorkspaceRowInnerContent({
const serviceSummary = isDesktop ? selectWorkspaceServiceSummary(workspace.scripts) : null;
const accessibilityState = useMemo(() => ({ selected }), [selected]);
const isEditingTitle = titleEditor !== null;
const didLongPressRef = dragInteraction?.didLongPressRef;
const startDragPress = dragInteraction?.handlePressIn;
const moveDragPress = dragInteraction?.handleTouchMove;
@@ -866,7 +864,11 @@ function StatusWorkspaceRowInnerContent({
}, [endDragPress]);
return (
<SidebarWorkspaceRowFrame workspace={workspace} isDragging={isDragging}>
<SidebarWorkspaceRowFrame
workspace={workspace}
isDragging={isDragging}
isEditingTitle={isEditingTitle}
>
{({ isHovered, contextMenuOpen, onContextMenuOpenChange, hoverHandlers }) => {
const showShortcut = showShortcutBadge && shortcutNumber !== null;
const {
@@ -895,7 +897,7 @@ function StatusWorkspaceRowInnerContent({
return (
<View
{...dragAttributes}
{...dragHandleProps?.listeners}
{...(isEditingTitle ? null : dragHandleProps?.listeners)}
ref={dragHandleProps?.setActivatorNodeRef as unknown as Ref<View>}
style={styles.workspaceRowContainer}
{...hoverHandlers}
@@ -922,14 +924,15 @@ function StatusWorkspaceRowInnerContent({
onTogglePin={onTogglePin}
openInFileManagerPath={workspace.workspaceDirectory}
disabled={isArchiving}
enabled={!isEditingTitle}
accessibilityRole="button"
accessibilityState={accessibilityState}
style={workspaceRowStyle}
highlightStyle={styles.workspaceRowPressed}
onPressIn={handlePressIn}
onTouchMove={moveDragPress}
onPressOut={handlePressOut}
onPress={handlePress}
onPressIn={isEditingTitle ? undefined : handlePressIn}
onTouchMove={isEditingTitle ? undefined : moveDragPress}
onPressOut={isEditingTitle ? undefined : handlePressOut}
onPress={isEditingTitle ? undefined : handlePress}
testID={`sidebar-workspace-row-${workspace.workspaceKey}`}
>
<SidebarWorkspaceRowContent
@@ -944,6 +947,7 @@ function StatusWorkspaceRowInnerContent({
shortcutNumber={shortcutNumber}
showShortcutBadge={showShortcutBadge}
reserveIdleStatusIndicatorSpace={reserveIdleStatusIndicatorSpace}
titleEditor={titleEditor}
>
{renderSlot ? (
<StatusWorkspaceActionSlot
@@ -46,10 +46,13 @@ const ThemedCircleAlert = withUnistyles(CircleAlert);
export function SidebarWorkspaceRowFrame({
workspace,
isDragging = false,
isEditingTitle = false,
children,
}: {
workspace: SidebarWorkspaceEntry;
isDragging?: boolean;
/** Hover would fade the kebab in over the title being edited and open the hover card. */
isEditingTitle?: boolean;
children: (input: {
isHovered: boolean;
contextMenuOpen: boolean;
@@ -77,10 +80,10 @@ export function SidebarWorkspaceRowFrame({
workspace={workspace}
prHint={workspace.prHint}
isDragging={isDragging}
disabled={contextMenuOpen}
disabled={contextMenuOpen || isEditingTitle}
>
{children({
isHovered: isHovered && !contextMenuOpen && !isDragging,
isHovered: isHovered && !contextMenuOpen && !isDragging && !isEditingTitle,
contextMenuOpen,
onContextMenuOpenChange: handleContextMenuOpenChange,
hoverHandlers,
@@ -102,6 +105,7 @@ export const SidebarWorkspaceRowContent = memo(function SidebarWorkspaceRowConte
shortcutNumber = null,
showShortcutBadge = false,
reserveIdleStatusIndicatorSpace = true,
titleEditor = null,
children,
}: {
workspace: SidebarWorkspaceEntry;
@@ -119,6 +123,8 @@ export const SidebarWorkspaceRowContent = memo(function SidebarWorkspaceRowConte
showShortcutBadge?: boolean;
/** Keep the empty leading slot when the workspace has no active status. */
reserveIdleStatusIndicatorSpace?: boolean;
/** Takes the title's place, in a box exactly one title line tall, while renaming in place. */
titleEditor?: ReactNode;
children?: ReactNode;
}) {
const {
@@ -160,13 +166,17 @@ export const SidebarWorkspaceRowContent = memo(function SidebarWorkspaceRowConte
)}
<View style={styles.workspaceContentColumn}>
<View style={styles.workspaceTitleRow}>
<Text
style={workspaceBranchTextStyle}
numberOfLines={1}
testID={`sidebar-workspace-title-${workspace.workspaceKey}`}
>
{workspaceLabel}
</Text>
{titleEditor ? (
<View style={styles.workspaceTitleEditorSlot}>{titleEditor}</View>
) : (
<Text
style={workspaceBranchTextStyle}
numberOfLines={1}
testID={`sidebar-workspace-title-${workspace.workspaceKey}`}
>
{workspaceLabel}
</Text>
)}
<View style={sidebarWorkspaceRowStyles.rowRight}>{children}</View>
</View>
<WorkspaceMetaRow
@@ -557,6 +567,11 @@ const styles = StyleSheet.create((theme) => ({
flex: 1,
minWidth: 0,
},
workspaceTitleEditorSlot: {
height: TITLE_LINE_HEIGHT,
flex: 1,
minWidth: 0,
},
workspaceBranchTextCreating: {
opacity: 0.92,
},
@@ -1,524 +0,0 @@
import { memo, useCallback, useMemo, useState, type Ref } from "react";
import { useTranslation } from "react-i18next";
import { View, Text, type GestureResponderEvent } from "react-native";
import { StyleSheet } from "react-native-unistyles";
import type { HostBadgeModel } from "@/hosts/appearance";
import type { SidebarWorkspaceEntry } from "@/hooks/use-sidebar-workspaces-list";
import { density } from "@/styles/density";
import type { SidebarSurfaceBackdrop } from "@/styles/surface-backdrop";
import type { DraggableListDragHandleProps } from "@/components/draggable-list.types";
import type { ShortcutKey } from "@/utils/format-shortcut";
import { WorkspaceRenameModal } from "@/components/workspace-rename-modal";
import { useWorkspaceClipboardActions } from "@/hooks/use-workspace-clipboard-actions";
import { useToast } from "@/contexts/toast-context";
import { toWorktreeArchiveRisk } from "@/git/worktree-archive-warning";
import { useWorkspaceArchive } from "@/workspace/use-workspace-archive";
import { useShortcutKeys } from "@/hooks/use-shortcut-keys";
import { useKeyboardActionHandler } from "@/hooks/use-keyboard-action-handler";
import { useWorkspaceReadState } from "@/hooks/use-workspace-read-state";
import { redirectIfArchivingActiveWorkspace } from "@/utils/sidebar-workspace-archive-redirect";
import { isNative as platformIsNative } from "@/constants/platform";
import { useIsCompactFormFactor } from "@/constants/layout";
import { useLongPressDragInteraction } from "@/components/sidebar/use-long-press-drag-interaction";
import {
SidebarWorkspaceContextMenu,
SidebarWorkspaceMenu,
} from "@/components/sidebar/sidebar-workspace-menu";
import {
SidebarWorkspaceRowFrame,
SidebarWorkspaceRowContent,
resolveTrailingActionVisibility,
SidebarWorkspaceTrailingActionBase,
SidebarWorkspaceTrailingActionOverlay,
SidebarWorkspaceTrailingActionSlot,
} from "@/components/sidebar/sidebar-workspace-row-content";
import { useOpenKebabMenuVisibility } from "@/components/sidebar/use-open-kebab-menu-visibility";
import { getSidebarRowBackdrop } from "@/components/sidebar/sidebar-row-backdrop";
import { selectWorkspaceServiceSummary } from "@/components/sidebar/workspace-meta-row";
import {
SidebarWorkspaceTrailingContent,
useSidebarWorkspaceTrailing,
type SidebarWorkspaceTrailing,
} from "@/components/sidebar/workspace-trailing";
interface SidebarWorkspaceRowProps {
workspace: SidebarWorkspaceEntry;
selected: boolean;
shortcutNumber: number | null;
showShortcutBadge: boolean;
canCopyBranchName: boolean;
onPress: () => void;
/** The host pill after the title. Absent → the sidebar spans one host, or this one is hidden. */
hostBadge?: HostBadgeModel | null;
/** Project grouping only: shows a transient "creating" affordance. */
isCreating?: boolean;
/** Project grouping only: drag-to-reorder wiring. Absent → not draggable. */
drag?: () => void;
isDragging?: boolean;
dragHandleProps?: DraggableListDragHandleProps;
}
export function SidebarWorkspaceRow({
workspace,
selected,
shortcutNumber,
showShortcutBadge,
canCopyBranchName,
onPress,
hostBadge,
isCreating = false,
drag,
isDragging = false,
dragHandleProps,
}: SidebarWorkspaceRowProps) {
const { t } = useTranslation();
const toast = useToast();
const [isHidingWorkspace, setIsHidingWorkspace] = useState(false);
const [isRenameOpen, setIsRenameOpen] = useState(false);
const isArchiving = workspace.archivingAt !== null || isHidingWorkspace;
const redirectAfterArchive = useCallback(() => {
redirectIfArchivingActiveWorkspace({
serverId: workspace.serverId,
workspaceId: workspace.workspaceId,
activeWorkspaceSelection: selected
? { serverId: workspace.serverId, workspaceId: workspace.workspaceId }
: null,
});
}, [selected, workspace]);
const archiveController = useWorkspaceArchive({
serverId: workspace.serverId,
workspaceId: workspace.workspaceId,
workspaceKind: workspace.workspaceKind,
name: workspace.name,
...toWorktreeArchiveRisk(workspace),
onArchiveStarted: redirectAfterArchive,
onSetHiding: setIsHidingWorkspace,
});
const handleArchive = useCallback(() => {
if (isArchiving) {
return;
}
archiveController.archive();
}, [archiveController, isArchiving]);
const clipboard = useWorkspaceClipboardActions();
const handleCopyPath = useCallback(() => {
clipboard.copyPath(workspace);
}, [clipboard, workspace]);
const handleCopyBranchName = useCallback(() => {
clipboard.copyBranchName(workspace);
}, [clipboard, workspace]);
const handleOpenRename = useCallback(() => {
setIsRenameOpen(true);
}, []);
const handleCloseRename = useCallback(() => {
setIsRenameOpen(false);
}, []);
const archiveShortcutKeys = useShortcutKeys("archive-workspace");
const { hasClearableAttention, canMarkUnread, clearAttention, markUnread } =
useWorkspaceReadState({
serverId: workspace.serverId,
workspaceId: workspace.workspaceId,
});
const handleMarkAsRead = useCallback(() => {
void clearAttention().catch((error) => {
toast.error(error instanceof Error ? error.message : "Failed to mark workspace as read");
});
}, [clearAttention, toast]);
const handleMarkAsUnread = useCallback(() => {
void markUnread().catch((error) => {
toast.error(error instanceof Error ? error.message : "Failed to mark workspace as unread");
});
}, [markUnread, toast]);
useKeyboardActionHandler({
handlerId: `workspace-archive-${workspace.workspaceKey}`,
actions: ["workspace.archive"],
enabled: selected && !isArchiving,
priority: 0,
handle: () => {
handleArchive();
return true;
},
});
return (
<>
<WorkspaceRowBody
workspace={workspace}
selected={selected}
shortcutNumber={shortcutNumber}
showShortcutBadge={showShortcutBadge}
hostBadge={hostBadge}
isCreating={isCreating}
isArchiving={isArchiving}
onPress={onPress}
drag={drag}
isDragging={isDragging}
dragHandleProps={dragHandleProps}
archiveLabel={t("sidebar.workspace.actions.archive")}
archiveStatus={isArchiving ? "pending" : "idle"}
archivePendingLabel={t("sidebar.workspace.actions.archiving")}
onArchive={handleArchive}
onCopyBranchName={canCopyBranchName ? handleCopyBranchName : undefined}
onCopyPath={handleCopyPath}
onRename={handleOpenRename}
onMarkAsRead={hasClearableAttention ? handleMarkAsRead : undefined}
onMarkAsUnread={canMarkUnread ? handleMarkAsUnread : undefined}
archiveShortcutKeys={selected ? archiveShortcutKeys : null}
/>
<WorkspaceRenameModal
visible={isRenameOpen}
workspace={workspace}
onClose={handleCloseRename}
testID={`sidebar-workspace-rename-modal-${workspace.workspaceKey}`}
/>
</>
);
}
interface WorkspaceRowBodyProps {
workspace: SidebarWorkspaceEntry;
selected: boolean;
shortcutNumber: number | null;
showShortcutBadge: boolean;
hostBadge?: HostBadgeModel | null;
isCreating: boolean;
isArchiving: boolean;
onPress: () => void;
drag?: () => void;
isDragging: boolean;
dragHandleProps?: DraggableListDragHandleProps;
archiveLabel?: string;
archiveStatus?: "idle" | "pending" | "success";
archivePendingLabel?: string;
onArchive?: () => void;
onCopyBranchName?: () => void;
onCopyPath?: () => void;
onRename?: () => void;
onMarkAsRead?: () => void;
onMarkAsUnread?: () => void;
archiveShortcutKeys?: ShortcutKey[][] | null;
}
function WorkspaceRowBody({
workspace,
selected,
shortcutNumber,
showShortcutBadge,
hostBadge,
isCreating,
isArchiving,
onPress,
drag,
isDragging,
dragHandleProps,
archiveLabel,
archiveStatus = "idle",
archivePendingLabel,
onArchive,
onCopyBranchName,
onCopyPath,
onRename,
onMarkAsRead,
onMarkAsUnread,
archiveShortcutKeys,
}: WorkspaceRowBodyProps) {
const isCompact = useIsCompactFormFactor();
const isTouchPlatform = platformIsNative || isCompact;
const [isPressed, setIsPressed] = useState(false);
const trailing = useSidebarWorkspaceTrailing();
const draggable = Boolean(drag);
const interaction = useLongPressDragInteraction({
drag,
menuController: null,
});
const {
role: _dragRole,
tabIndex: _dragTabIndex,
"aria-roledescription": _dragRoleDescription,
...dragAttributes
} = dragHandleProps?.attributes ?? {};
const handlePress = useCallback(() => {
if (interaction.didLongPressRef.current) {
interaction.didLongPressRef.current = false;
return;
}
onPress();
}, [interaction.didLongPressRef, onPress]);
const handleWorkspacePressIn = useCallback(
(event: GestureResponderEvent) => {
setIsPressed(true);
if (draggable) interaction.handlePressIn(event);
},
[draggable, interaction],
);
const handleWorkspacePressOut = useCallback(() => {
setIsPressed(false);
if (draggable) interaction.handlePressOut();
}, [draggable, interaction]);
const accessibilityState = useMemo(() => ({ selected }), [selected]);
return (
<SidebarWorkspaceRowFrame workspace={workspace} isDragging={isDragging}>
{({ isHovered, contextMenuOpen, onContextMenuOpenChange, hoverHandlers }) => {
const isDesktop = !isTouchPlatform;
const serviceSummary = isDesktop ? selectWorkspaceServiceSummary(workspace.scripts) : null;
const workspaceRowStyle = getWorkspaceRowStyle({
isDragging,
isPressed,
selected,
isHovered,
});
const backdrop = getSidebarRowBackdrop({ isDragging, isPressed, selected, isHovered });
return (
<View
{...(draggable ? dragAttributes : {})}
{...(draggable ? dragHandleProps?.listeners : {})}
ref={
draggable ? (dragHandleProps?.setActivatorNodeRef as unknown as Ref<View>) : undefined
}
style={styles.workspaceRowContainer}
{...hoverHandlers}
>
<SidebarWorkspaceContextMenu
contextMenuOpen={contextMenuOpen}
onContextMenuOpenChange={onContextMenuOpenChange}
workspace={workspace}
hostBadgeLabel={hostBadge?.label}
serviceSummary={serviceSummary}
workspaceKey={workspace.workspaceKey}
onCopyPath={onCopyPath}
onCopyBranchName={onCopyBranchName}
onRename={onRename}
onMarkAsRead={onMarkAsRead}
onMarkAsUnread={onMarkAsUnread}
onArchive={onArchive}
archiveLabel={archiveLabel}
archiveStatus={archiveStatus}
archivePendingLabel={archivePendingLabel}
archiveShortcutKeys={archiveShortcutKeys}
openInFileManagerPath={workspace.workspaceDirectory}
disabled={isArchiving}
aria-selected={selected}
accessibilityRole="button"
accessibilityState={accessibilityState}
style={workspaceRowStyle}
highlightStyle={styles.workspaceRowPressed}
onPressIn={handleWorkspacePressIn}
onTouchMove={draggable ? interaction.handleTouchMove : undefined}
onPressOut={handleWorkspacePressOut}
onPress={handlePress}
testID={`sidebar-workspace-row-${workspace.workspaceKey}`}
>
<SidebarWorkspaceRowContent
workspace={workspace}
hostBadge={hostBadge}
serviceSummary={serviceSummary}
backdrop={backdrop}
isHovered={isHovered}
isLoading={isArchiving || isCreating}
isCreating={isCreating}
shortcutNumber={shortcutNumber}
showShortcutBadge={showShortcutBadge}
>
<WorkspaceRowTrailingActions
workspace={workspace}
backdrop={backdrop}
trailing={trailing}
isHovered={isHovered}
isTouchPlatform={isTouchPlatform}
isCreating={isCreating}
showShortcutBadge={showShortcutBadge}
shortcutNumber={shortcutNumber}
archiveLabel={archiveLabel}
archiveStatus={archiveStatus}
archivePendingLabel={archivePendingLabel}
archiveShortcutKeys={archiveShortcutKeys}
onArchive={onArchive}
onCopyBranchName={onCopyBranchName}
onCopyPath={onCopyPath}
onRename={onRename}
onMarkAsRead={onMarkAsRead}
onMarkAsUnread={onMarkAsUnread}
/>
</SidebarWorkspaceRowContent>
</SidebarWorkspaceContextMenu>
</View>
);
}}
</SidebarWorkspaceRowFrame>
);
}
function WorkspaceRowTrailingActions({
workspace,
backdrop,
trailing,
isHovered,
isTouchPlatform,
isCreating,
showShortcutBadge,
shortcutNumber,
archiveLabel,
archiveStatus,
archivePendingLabel,
archiveShortcutKeys,
onArchive,
onMarkAsRead,
onMarkAsUnread,
onCopyBranchName,
onCopyPath,
onRename,
}: {
workspace: SidebarWorkspaceEntry;
backdrop: SidebarSurfaceBackdrop;
trailing: SidebarWorkspaceTrailing;
isHovered: boolean;
isTouchPlatform: boolean;
isCreating: boolean;
showShortcutBadge: boolean;
shortcutNumber: number | null;
archiveLabel?: string;
archiveStatus?: "idle" | "pending" | "success";
archivePendingLabel?: string;
archiveShortcutKeys?: ShortcutKey[][] | null;
onArchive?: () => void;
onMarkAsRead?: () => void;
onMarkAsUnread?: () => void;
onCopyBranchName?: () => void;
onCopyPath?: () => void;
onRename?: () => void;
}) {
const { t } = useTranslation();
const showShortcut = showShortcutBadge && shortcutNumber !== null;
const {
trailingPresentation,
showKebab: showKebabInSlot,
showArchiveButton,
showScrim,
renderSlot,
reserveSlotWidth,
} = resolveTrailingActionVisibility({
workspace,
trailing,
hasArchiveAction: Boolean(onArchive),
isHovered,
isTouchPlatform,
showShortcut,
});
const kebab = useOpenKebabMenuVisibility(showKebabInSlot);
return (
<>
{isCreating ? (
<Text style={styles.workspaceCreatingText}>{t("sidebar.workspace.status.creating")}</Text>
) : null}
{renderSlot ? (
<SidebarWorkspaceTrailingActionSlot reserveWidth={reserveSlotWidth}>
<SidebarWorkspaceTrailingActionBase presentation={trailingPresentation}>
<SidebarWorkspaceTrailingContent workspace={workspace} trailing={trailing} />
</SidebarWorkspaceTrailingActionBase>
<SidebarWorkspaceTrailingActionOverlay
visible={kebab.showKebab}
scrimBackdrop={showScrim ? backdrop : undefined}
workspaceKey={workspace.workspaceKey}
onArchiveButtonPress={showArchiveButton ? onArchive : undefined}
>
{onArchive ? (
<SidebarWorkspaceMenu
{...kebab.menuProps}
workspaceKey={workspace.workspaceKey}
serverId={workspace.serverId}
workspaceId={workspace.workspaceId}
workspaceLabels={workspace.labels}
onCopyPath={onCopyPath}
onCopyBranchName={onCopyBranchName}
onRename={onRename}
onMarkAsRead={onMarkAsRead}
onMarkAsUnread={onMarkAsUnread}
onArchive={onArchive}
archiveLabel={archiveLabel}
archiveStatus={archiveStatus}
archivePendingLabel={archivePendingLabel}
archiveShortcutKeys={archiveShortcutKeys}
/>
) : null}
</SidebarWorkspaceTrailingActionOverlay>
</SidebarWorkspaceTrailingActionSlot>
) : null}
</>
);
}
function getWorkspaceRowStyle({
isDragging,
isPressed,
selected,
isHovered,
}: {
isDragging: boolean;
isPressed: boolean;
selected: boolean;
isHovered: boolean;
}) {
return [
styles.workspaceRow,
isHovered && styles.workspaceRowHovered,
selected && styles.sidebarRowSelected,
isDragging && styles.workspaceRowDragging,
isPressed && styles.workspaceRowPressed,
];
}
export const MemoSidebarWorkspaceRow = memo(SidebarWorkspaceRow);
const styles = StyleSheet.create((theme) => ({
workspaceRowContainer: {
position: "relative",
},
workspaceRow: {
minHeight: density.rowHeight,
marginBottom: theme.spacing[1],
paddingVertical: theme.spacing[2],
paddingLeft: theme.spacing[2],
paddingRight: theme.spacing[3],
borderRadius: theme.borderRadius.lg,
flexDirection: "column",
alignItems: "stretch",
justifyContent: "center",
gap: theme.spacing[1],
userSelect: "none",
},
workspaceRowHovered: {
backgroundColor: theme.colors.surfaceSidebarHover,
},
workspaceRowPressed: {
backgroundColor: theme.colors.surface2,
},
workspaceRowDragging: {
backgroundColor: theme.colors.surface2,
borderWidth: 1,
borderColor: theme.colors.border,
transform: [{ scale: 1.02 }],
zIndex: 3,
...theme.shadow.md,
},
sidebarRowSelected: {
backgroundColor: theme.colors.surfaceSidebarSelected,
},
workspaceCreatingText: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.sm,
flexShrink: 0,
},
}));
@@ -51,10 +51,7 @@ import {
TERMINAL_SELECTION_GRIP_SIZE,
} from "../terminal/native-renderer/terminal-selection-controller";
import { resolveNativeTerminalMountAction } from "../terminal/native-renderer/terminal-mount-policy";
import {
forwardNativeTerminalKey,
type NativeTerminalKey,
} from "../terminal/native-renderer/terminal-key-events";
import { type NativeTerminalKeyEvent } from "../terminal/native-renderer/terminal-key-events";
import {
TerminalInput,
type TerminalInputHandle,
@@ -511,9 +508,9 @@ function NativeTerminalEmulator({
);
const handleNativeTerminalKey = useCallback(
(key: NativeTerminalKey) => {
(event: NativeTerminalKeyEvent) => {
claimActiveTerminalSizeForAction("key");
forwardNativeTerminalKey({ key, onTerminalKey: callbacksRef.current.onTerminalKey });
callbacksRef.current.onTerminalKey?.(event);
},
[claimActiveTerminalSizeForAction],
);
+48 -1
View File
@@ -1,5 +1,12 @@
import { describe, expect, it } from "vitest";
import { computePosition, fitSurfaceWidth, getTransformOrigin, type Rect } from "./anchor";
import {
computePosition,
fitSurfaceWidth,
getTransformOrigin,
holdSurfaceEdge,
surfaceFrameStyles,
type Rect,
} from "./anchor";
const DISPLAY: Rect = { x: 0, y: 0, width: 1000, height: 800 };
const TRIGGER: Rect = { x: 100, y: 100, width: 40, height: 20 };
@@ -78,6 +85,46 @@ describe("computePosition", () => {
});
});
/**
* Where a surface's edges land when its content has resized but it has not been placed again,
* the frame native paints before the next placement arrives. Resolves the frame styles the way
* layout does: a top-held surface grows down from its top, a bottom-held one up from the
* holder's bottom.
*/
function edgesBeforeReplacement(placedHeight: number, paintedHeight: number) {
const placed = position({ placement: "top", triggerRect: { ...TRIGGER, y: 400 } });
const { holder, surface } = surfaceFrameStyles(holdSurfaceEdge(placed, placedHeight));
const bottom =
typeof surface.bottom === "number"
? Number(holder.height) - surface.bottom
: Number(surface.top) + paintedHeight;
return { top: bottom - paintedHeight, bottom };
}
describe("surfaceFrameStyles", () => {
it("keeps a surface above its trigger off the trigger when its content grows", () => {
// Trigger top 400, offset 4: the surface ends at 396 however tall it becomes.
expect(edgesBeforeReplacement(CONTENT.height, CONTENT.height)).toEqual({
top: 296,
bottom: 396,
});
expect(edgesBeforeReplacement(CONTENT.height, 260)).toEqual({ top: 136, bottom: 396 });
});
it("keeps a surface above its trigger against the trigger when its content shrinks", () => {
expect(edgesBeforeReplacement(CONTENT.height, 40)).toEqual({ top: 356, bottom: 396 });
});
it("holds a surface below its trigger by its top edge", () => {
const { surface } = surfaceFrameStyles(holdSurfaceEdge(position(), CONTENT.height));
expect(surface).toMatchObject({ position: "absolute", top: 124, left: 100 });
});
it("waits off-screen until it is placed", () => {
expect(surfaceFrameStyles(null).surface).toMatchObject({ top: -9999, left: -9999 });
});
});
describe("getTransformOrigin", () => {
it.each([
["bottom", "start", [0, 0, 0]],
+52 -3
View File
@@ -1,8 +1,8 @@
import type { View } from "react-native";
import type { View, ViewStyle } from "react-native";
/**
* Where a floating surface goes relative to the thing that opened it. Menus and hover cards
* place themselves with it.
* Where a floating surface goes relative to the thing that opened it. Menus, hover cards, and
* tooltips place themselves with it.
*/
export type Placement = "top" | "bottom" | "left" | "right";
@@ -177,6 +177,55 @@ export function computePosition({
return { ...clampToDisplayArea({ ...anchored, contentSize, displayArea }), actualPlacement };
}
/** Where a placed surface sits: its left edge, and the edge that holds it vertically. */
export type SurfacePosition = { left: number; top: number } | { left: number; bottomEdge: number };
/**
* A surface above its trigger is held by its bottom edge, the edge that faces the trigger. When
* its content grows after it paints, it extends upward, away from the trigger. Held by its top,
* it would paint over the trigger until the next placement lands, a frame later on native.
*/
export function holdSurfaceEdge(
placed: { x: number; y: number; actualPlacement: Placement },
contentHeight: number,
): SurfacePosition {
if (placed.actualPlacement === "top") {
return { left: placed.x, bottomEdge: placed.y + contentHeight };
}
return { left: placed.x, top: placed.y };
}
/**
* Styles for a surface and the holder it sits in. Both fill the display area's width, so the
* surface lays out exactly as it would without the holder. Render the holder with the
* `pointerEvents="box-none"` prop so presses outside the surface reach what is behind it;
* react-native-web drops `box-none` given as an inline style. A bottom-held surface sits on the
* bottom of a holder that ends at its bottom edge, so layout keeps that edge in place however
* the content changes. Until it is placed, the surface waits off-screen to be measured.
*/
export function surfaceFrameStyles(position: SurfacePosition | null): {
holder: ViewStyle;
surface: ViewStyle;
} {
const fill: ViewStyle = { position: "absolute", top: 0, left: 0, right: 0 };
if (!position) {
return {
holder: { ...fill, bottom: 0 },
surface: { position: "absolute", top: -9999, left: -9999 },
};
}
if ("top" in position) {
return {
holder: { ...fill, bottom: 0 },
surface: { position: "absolute", top: position.top, left: position.left },
};
}
return {
holder: { ...fill, height: position.bottomEdge },
surface: { position: "absolute", bottom: 0, left: position.left },
};
}
export function getTransformOrigin(
placement: Placement,
alignment: Alignment,
@@ -63,6 +63,7 @@ import {
} from "@/components/adaptive-modal-sheet";
import { FloatingSurface } from "@/components/ui/floating";
import { useDismissKeyboardOnOpen } from "@/components/ui/keyboard-dismiss";
import { useDismissibleOverlay } from "@/components/ui/overlay-dismissal";
import { getOverlayRoot, OverlayLayerProvider, useOverlayLayer } from "@/lib/overlay-root";
import { density, densityIconBox } from "@/styles/density";
import { DensityIcon } from "@/components/ui/density-icon";
@@ -1369,6 +1370,7 @@ export function Combobox({
useEffect(() => {
if (!active && isOpen) handleClose();
}, [active, isOpen, handleClose]);
useDismissibleOverlay(isOpen, handleClose);
useResetSearchOnOpen(isOpen, setSearchQueryWithCallback, bumpSearchResetKey);
@@ -165,7 +165,9 @@ export function ContextMenuTrigger({
const handleContextMenu = useCallback(
(event: unknown) => {
if (isNative) return;
// A trigger with no menu of its own leaves the browser's menu alone, e.g. copy and paste
// in a field rendered inside it.
if (isNative || !shouldEnableOnThisPlatform) return;
if (typeof event === "object" && event !== null) {
const preventDefault = Reflect.get(event, "preventDefault");
const stopPropagation = Reflect.get(event, "stopPropagation");
@@ -175,7 +177,7 @@ export function ContextMenuTrigger({
onContextMenu?.(event);
openAtEvent(event);
},
[onContextMenu, openAtEvent],
[onContextMenu, openAtEvent, shouldEnableOnThisPlatform],
);
const resolveDynamicStyle = useCallback(
@@ -119,15 +119,10 @@ describe("control sizing gate", () => {
});
describe("toolbar glyphs and spacing", () => {
it("spaces touch toolbar controls by what they paint and keeps the pointer's 4px gap", () => {
expect(TOOLBAR_CONTROL_GAPS).toEqual({ touch: 20, pointer: 4 });
expect(TOOLBAR_CONTROL_GAP).toEqual({ xs: 20, md: 4 });
// A 20pt glyph's disc-sized frame reaches 8 into the gap on each side.
expect(toolbarSlot(20)).toEqual({
width: TOOLBAR_DISC_SIZE,
height: TOOLBAR_DISC_SIZE,
marginHorizontal: { xs: -8, md: 0 },
});
it("lays touch toolbar controls out at their highlight with no gap and keeps the pointer's 4px gap", () => {
expect(TOOLBAR_CONTROL_GAPS).toEqual({ touch: 0, pointer: 4 });
expect(TOOLBAR_CONTROL_GAP).toEqual({ xs: 0, md: 4 });
expect(toolbarSlot()).toEqual({ width: TOOLBAR_DISC_SIZE, height: TOOLBAR_DISC_SIZE });
});
it("paints touch toolbar glyphs at the header icons' 20pt and 1.5px stroke and leaves pointer unchanged", () => {
@@ -101,47 +101,23 @@ export const TOOLBAR_DISC_SIZES = { touch: 36, pointer: 28 } satisfies SizingVal
export const TOOLBAR_DISC_SIZE = bySizing(TOOLBAR_DISC_SIZES);
/**
* The space between adjacent toolbar controls. Touch-sized it is the visible space between what
* the controls paint, because each control lays out at its painted width (`toolbarSlot`).
* The space between adjacent toolbar controls. Touch-sized there is none: each control lays out at
* its fully rounded highlight, so neighbouring highlights touch and never overlap.
*/
export const TOOLBAR_CONTROL_GAPS = { touch: 20, pointer: 4 } satisfies SizingValue;
export const TOOLBAR_CONTROL_GAPS = { touch: 0, pointer: 4 } satisfies SizingValue;
export const TOOLBAR_CONTROL_GAP = bySizing(TOOLBAR_CONTROL_GAPS);
/**
* A toolbar control's frame: a disc-sized circle, which is also its fully rounded highlight.
* Touch-sized it lays out at the width of the glyph it paints, `shapeWidth`, and the circle reaches
* into the gaps on either side, so the row spaces what you see. Pointer-sized it is the square
* control.
*/
export function toolbarSlot(shapeWidth: number): {
width: LayoutValue;
height: LayoutValue;
marginHorizontal: LayoutValue;
} {
return {
width: TOOLBAR_DISC_SIZE,
height: TOOLBAR_DISC_SIZE,
marginHorizontal: bySizing({
touch: (shapeWidth - TOOLBAR_DISC_SIZES.touch) / 2,
pointer: 0,
}),
};
/** A labelled toolbar control's padding on each side of its content. */
export const TOOLBAR_LABEL_PADDING = 8;
/** An icon-only toolbar control's frame: a disc-sized circle, which is also its highlight. */
export function toolbarSlot(): { width: LayoutValue; height: LayoutValue } {
return { width: TOOLBAR_DISC_SIZE, height: TOOLBAR_DISC_SIZE };
}
/**
* A toolbar control as wide as its content, such as a labelled picker: a disc-tall pill. Touch-sized
* its padding reaches into the gaps, so its content is what the row spaces.
*/
export function toolbarContentSlot(padding: number): {
height: LayoutValue;
paddingHorizontal: number;
marginHorizontal: LayoutValue;
} {
return {
height: TOOLBAR_DISC_SIZE,
paddingHorizontal: padding,
marginHorizontal: bySizing({ touch: -padding, pointer: 0 }),
};
/** A toolbar control as wide as its content, such as a labelled picker: a disc-tall pill. */
export function toolbarContentSlot(): { height: LayoutValue; paddingHorizontal: number } {
return { height: TOOLBAR_DISC_SIZE, paddingHorizontal: TOOLBAR_LABEL_PADDING };
}
/**
+21 -10
View File
@@ -322,6 +322,17 @@ export function HoverCardContent(props: HoverCardContentProps): ReactElement | n
);
}
// A card above its trigger holds its bottom edge, so content that loads while it is open grows it
// upward without a correction. Anchored by its top, it would paint over the trigger until placed.
type CardPosition = { left: number; top: number } | { left: number; bottom: number };
function isSamePosition(current: CardPosition | null, next: CardPosition): boolean {
if (!current || current.left !== next.left) return false;
return "top" in current
? "top" in next && current.top === next.top
: "bottom" in next && current.bottom === next.bottom;
}
function readDomRect(view: View | null): Rect | null {
const element = view as unknown as HTMLElement | null;
if (!element) return null;
@@ -349,7 +360,7 @@ function HoverCardSurface({
contentRef: RefObject<View | null>;
}): ReactElement {
const overlayRef = useRef<View>(null);
const [position, setPosition] = useState<{ x: number; y: number } | null>(null);
const [position, setPosition] = useState<CardPosition | null>(null);
const place = useCallback(() => {
const triggerRect = readDomRect(triggerRef.current);
@@ -357,7 +368,7 @@ function HoverCardSurface({
const content = contentRef.current as unknown as HTMLElement | null;
if (!triggerRect || !overlayRect || !content) return;
const { width, height } = Dimensions.get("window");
const { x, y } = computePosition({
const { x, y, actualPlacement } = computePosition({
triggerRect,
contentSize: { width: content.offsetWidth, height: content.offsetHeight },
displayArea: { x: 0, y: 0, width, height },
@@ -366,19 +377,19 @@ function HoverCardSurface({
alignment,
offset,
});
const next = { x: x - overlayRect.x, y: y - overlayRect.y };
setPosition((current) => (current?.x === next.x && current.y === next.y ? current : next));
const left = x - overlayRect.x;
const next: CardPosition =
actualPlacement === "top"
? { left, bottom: overlayRect.height - (y + content.offsetHeight - overlayRect.y) }
: { left, top: y - overlayRect.y };
setPosition((current) => (isSamePosition(current, next) ? current : next));
}, [alignment, contentRef, offset, placement, triggerRef]);
useLayoutEffect(place, [place]);
const frameStyle = useMemo(
() => ({
position: "absolute" as const,
top: position?.y ?? -9999,
left: position?.x ?? -9999,
}),
[position?.x, position?.y],
() => ({ position: "absolute" as const, ...(position ?? { top: -9999, left: -9999 }) }),
[position],
);
const surfaceStyle = useMemo(() => [styles.surface, style], [style]);
@@ -5,6 +5,7 @@ import {
} from "@gorhom/bottom-sheet";
import React from "react";
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
import { useDismissibleOverlay } from "@/components/ui/overlay-dismissal";
import type { ElementRef, ReactNode } from "react";
import { systemBackPress } from "./back-press";
import {
@@ -163,6 +164,7 @@ export function useIsolatedBottomSheetVisibility({
useEffect(() => {
tracker.syncDesired({ visible, isEnabled });
}, [isEnabled, tracker, visible]);
useDismissibleOverlay(visible && isEnabled !== false, onClose);
return {
sheetRef: setSheetRef,
@@ -88,6 +88,18 @@ describe("bottom sheet visibility tracker", () => {
expect(sheet.events).toEqual([{ type: "present" }, { type: "dismiss" }]);
});
it("dismisses again when a sheet hidden while opening finishes opening anyway", () => {
const { sheet, tracker } = setup();
tracker.attachController(sheet);
tracker.syncDesired({ visible: true });
// The owner hides the sheet before its open animation reports in; the sheet still lands open.
tracker.syncDesired({ visible: false });
tracker.handleSheetIndexChange(0);
expect(sheet.events).toEqual([{ type: "present" }, { type: "dismiss" }, { type: "dismiss" }]);
});
it("waits to present until the sheet controller becomes available", () => {
const { sheet, tracker } = setup();
tracker.syncDesired({ visible: true });
@@ -120,6 +120,11 @@ export function createBottomSheetVisibilityTracker(opts: {
if (phase === "presenting" || phase === "dismissing") {
setPhase("presented");
}
// A dismiss sent before the sheet measured its layout is dropped, and the sheet still
// finishes opening. The owner wants it hidden, so it goes again.
if (!visible && isEnabled !== false) {
dismiss();
}
return;
}
if (phase === "presenting" || phase === "presented") {

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