Compare commits

...
Author SHA1 Message Date
Mohamed Boudra 91fd0a7685 fix(app): cap composer input independently of dock queue track
ComposerViewportContent previously applied the 0.6x inline editing cap to the entire composer slot, including ComposerQueueTrack. On compact phones after keyboard open/close, restoring an attachment pill grew MessageInput enough to collapse the queued message list to ~10px.

Bound the outer dock slot to the full viewport capacity, move the 0.6x inline cap onto ComposerInputCap around the input box, and cap compact queue rows at 140dp so ~2 queued rows stay usable alongside a restored image pill.
2026-11-30 12:49:40 +01:00
Mohamed Boudra 45be9ebe6c fix(app): steer instead of interrupting on a host without a message queue
A "queue" send behavior fell back to "interrupt" on an older host, which
killed the running turn the user meant to wait for.
2026-11-30 11:53:40 +01:00
Mohamed Boudra e771e671f9 feat(app): queue a staged provider switch with its message
A prompt sent mid-turn with a staged switch goes to the host's queue with
the switch. Its row names the target provider, and Edit stages the switch
again.

Edits to the target's settings after queuing apply to the next message,
not to the queued one.

Refs #8436, #9023
2026-11-30 11:53:40 +01:00
Mohamed Boudra 1f07c32cf9 test(server): cover a queued message the timeline already holds after a crash 2026-11-30 11:53:39 +01:00
Mohamed Boudra 071ea27448 feat(protocol,server,client): queue a provider switch behind a running turn
A switch staged mid-turn relied on the app holding the prompt until the
turn ended. The host owns the queue now, so the queued message carries the
target provider and settings and the host switches when its turn comes.

The queued switch divides the queue: nothing ahead of it moves to the new
provider and nothing behind it runs on the old one. A switch that fails
keeps the message and holds the queue.

The switch request's new fields are optional. The client refuses to send a
queued switch to a host without the message queue, which would otherwise
drop the field and switch at once.

Refs #8436, #9023
2026-11-30 11:53:39 +01:00
Mohamed Boudra 33e0a862d8 fix(server): set aside a corrupt agent queue file instead of failing startup
One unreadable file under agent-queues/ stopped the daemon from booting.
It is renamed so it can be inspected, a warning is logged, and every other
queue loads.
2026-11-30 11:53:39 +01:00
Mohamed Boudra c3ea1a90c0 fix(app): keep the composer on screen with a long message queue
The queue list had no height limit and could not shrink, so enough rows
pushed the message input and Stop past the bottom of the window with no way
to scroll back. The rows now scroll in a capped frame that gives up height
before the input does. The frame is a View because the web build drops
Unistyles styles on the shared ScrollView.

Also keeps row icons from being squashed by a long sender name, puts row
text on the composer's text rail, and focuses the input after Edit.
2026-11-30 11:05:42 +01:00
Mohamed Boudra 6c05edbc5d feat(app): show the host's message queue above the composer
The app kept its own queue and sent it when it saw the agent stop. A
reload lost the queued messages, nothing was sent with the app closed,
and other clients and agent senders could not be seen. The host now owns
the queue; the app only lists it and asks the host to withdraw or send a
row.

Behavior changes:
- Stop leaves queued messages paused instead of sending them.
- Sending a message directly (steer or interrupt) delivers the queued
  messages ahead of it.
- Hosts without the agent message queue have no Queue action, and a
  "queue" send behavior interrupts.

Edit restores uploads as references to the files the host holds, so it
works after a reload or from another device without uploading again.

Refs #8436, #9023
2026-11-30 11:05:42 +01:00
Mohamed Boudra 5bb8e4f77b feat(protocol,server,client): add agent message queue RPCs and client sync
Expose the daemon's durable per-agent message queue over the session protocol so clients can hydrate, observe live updates, withdraw, and promote queued messages without maintaining a local queue.

- Keep queue updates opt-in via session.events.set_subscription and legacyWantsEvent=false so older clients never receive unknown frames.
- Sequence per-agent queue broadcasts on the session so out-of-order storage reads cannot overwrite newer queue state, while still publishing empty lists when an archived or deleted agent's queue is cleared.
- Ignore AbortError on withdrawn queued dispatch promises so user or lifecycle withdrawals do not log spurious run errors.

Refs #8436, #9023
2026-11-30 11:02:36 +01:00
Mohamed Boudra 63d3fc3df3 feat(server): keep queued agent messages across daemon restarts
Queued messages lived in memory. A crash lost them, a restored finish
subscription then reported a child that never ran its task, and a clean
shutdown forced a flush into busy agents and swallowed the failures.

The daemon now saves a message before acknowledging it, leaves the queue
in place on shutdown, and checks the recipient's history after a crash
before sending an interrupted dispatch again.

Behavior changes:
- A provider that refuses to start a turn no longer drops the message. It
  stays queued and the queue is held, because retrying alone would be
  refused again and add the prompt to the history each time. The sender's
  finish notice waits until the message is delivered.
- Retrying a queued send with the same messageId is acknowledged at once
  instead of blocking until delivery.

Refs #8436
2026-11-30 11:02:31 +01:00
Mohamed Boudra 89826f0961 feat(server): add durable agent message queue store
Define the AgentMessageQueueStore interface along with atomic per-agent JSON and in-memory adapters and shared contract tests.

This is the persistence foundation for unifying human and agent message queues behind a SQLite-ready store boundary. Withdraw and promote return atomic discriminated outcomes inside the per-recipient lock so callers avoid racy pre-reads against active dispatches.
2026-11-30 11:00:20 +01:00
paseo-bot[bot] 3986e8b808 fix(server): enforce the forge host auth probe deadline (#11411)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 09:43:18 +00:00
paseo-bot[bot] 9fd8921697 fix(claude): show autonomous turns in reopened chats (#11405)
Command discovery can launch Claude before the user sends a message. Start reading each query when it launches so a turn Claude starts on its own reaches the live timeline.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 09:42:48 +00:00
paseo-bot[bot] 269fa33491 Close terminal programs on Windows when Restart and close terminals runs (#11398)
* fix(terminal): kill the program tree first on Windows in killAndWait

On Windows, node-pty's kill closes the pseudoconsole at once and kills
the console's processes only after a forked helper reports them.
Closing the pseudoconsole closes the output pipe, and node-pty reports
that as the program's exit. killAndWait therefore saw an exit inside
its graceful wait and skipped the force step added in #11147. The
terminal worker exits right after killAndWait during shutdown, so the
helper's kill never ran and the program kept running after "Restart
and close terminals".

On Windows, killAndWait now kills the program's process tree before it
closes the console. Windows has no graceful signal, and node-pty's own
kill was already TerminateProcess, so no graceful step is lost.

Refs #11134

* test(terminal): end the program before the caller of killAndWait exits

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 09:27:42 +00:00
paseo-bot[bot] ebcea47942 Show the latest ACP sessions in Import Session (#10675)
* fix(acp): show the latest sessions in Import Session

ACP peers can return sessions in storage order. Applying the result limit before sorting discards newer sessions before the daemon receives them.

* fix(acp): keep import results when extra pages stall

Once the provider supplies enough sessions, bound the time spent looking for newer ones. Return the rows already collected and close the listing connection when the extra scan ends.

* test(website): check plugin search parameters by name

Native GET form submission and hydrated navigation serialize the same filters in different orders. Verify the term and ranking window in both flows.

* test(server): wait for the watcher before deleting a file

The native macOS watcher starts delivering events after subscription returns. Use the existing liveness canary before removing the file under test.

* fix(acp): start the optional scan budget with the listing

* test(acp): follow the connection that lists sessions

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 09:12:49 +00:00
Mohamed Boudra fb9a1644f0 feat(plugins): let plugins read and arrange a workspace's layout (#11328)
Plugins can open, focus, move and close a workspace's panes and tabs, show or hide the Explorer, and read the layout, through a handle available in components, the client entry and commands. Requires Paseo 0.18.3 or later. `openPanel` is deprecated and behaves as before.

Tab closing moved out of the workspace screen into `@/workspace-tabs/close`, so plugin and UI closes share the same unsaved-work and destructive prompts.

Also fixes two problems a plugin's arrangement could reach: a chat in a phone's Explorer overlay never loaded, and a sheet from a hidden workspace was presented over the workspace on screen.

Includes two test-only repairs for CI failures outside this change: an ACP interrupt test with a too-short grace period, and a terminal lifecycle test whose failure message carried no daemon output.
2026-11-30 16:12:12 +07:00
paseo-ai[bot] 93278b217b fix: update lockfile signatures and Nix hash [skip ci] 2026-11-30 09:06:19 +00:00
Mohamed Boudra 5f453a2f74 Switch providers within the same chat on durable SQLite timelines (#11410)
* feat(timeline,agents): owned SQLite timelines and in-chat provider switching

* test: align rebased timeline, ACP reopen, and rewind tests with SQLite history
2026-11-30 15:56:36 +07:00
Mohamed Boudra 01aced8cd2 fix(app): keep uncaught plugin errors from crashing the native app (#11412)
React Native reports an error thrown out of a press handler, timer,
animation frame, or microtask to ErrorUtils as fatal, so one bad plugin
callback terminated a release app. The plugin error boundary only covers
render and effects.

Client bundles now evaluate with a paseo-plugin://<server>/<plugin>
source URL, and a wrapped global handler logs errors whose stack has a
plugin frame instead of forwarding them. Errors without a plugin frame
reach the previous handler unchanged.

Hermes prints an empty source for new Function code and records no
creation site, so the bundle receives a Function that appends a source
URL to code it compiles. Code compiled through eval, globalThis.Function,
or from already compiled code stays unattributed and fatal.

Refs #10978
2026-11-30 15:45:16 +07:00
paseo-bot[bot] 9d994aca9b fix(server): release workspace refreshes after forge CLI timeouts (#11252)
A forge command can ignore the default termination signal and keep its workspace refresh slot occupied. Use a forceful signal at the existing deadline so the refresh can finish.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 08:43:35 +00:00
paseo-bot[bot]and김동선 839d45103b Reconnect promptly when the app returns to a stalled handshake (#10348)
* fix(client): reconnect right away when the app returns to the foreground

While the app is hidden the OS blocks the network, so relay retries fail
and the backoff climbs to 24-30s. On returning, ensureConnected({ verify })
either waited for a connect attempt started while hidden to hit its 15s
timeout, or retried after that inflated backoff, leaving the mobile app on
"Reconnecting to host" for 40-60s.

Foregrounding now resets the backoff, and replaces a connect attempt that
has been pending for 3s or more instead of waiting out its timeout.

* fix(client): keep the base retry delay after a foreground reconnect

Use the immediate retry path when replacing a stalled connection attempt.
Arming a retry timer first would raise the backoff even though the
replacement cancels that timer before it fires.

Co-authored-by: 김동선 <88572124+dongsun1@users.noreply.github.com>

* fix(client): keep queued requests during foreground reconnect

A stalled handshake has not sent the queued requests. Replace its transport while the client remains connecting so the new handshake can send them with their existing deadlines.

* fix(client): serialize foreground credential lookup and handshake

Enter connecting before reading credentials so a foreground event shares the active connection attempt. Retire the previous transport before the read so no obsolete socket can disconnect the new one.

* fix(client): time out stalled credential lookups

Keep a single connection attempt from credential lookup through hello. Foreground recovery can replace that attempt, and only the current lookup can install a transport.

* fix(client): retire the connection deadline before retrying

A failed hello already schedules its retry. Clear the ended attempt at the retry transition so its deadline cannot change the error or raise the delay.

* Preserve the handshake timeout after credential lookup

---------

Co-authored-by: 김동선 <88572124+dongsun1@users.noreply.github.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 08:42:51 +00:00
Mohamed Boudraandthecardcheat 96fee23fbd Switch Direct connection between Form and URI modes (#11402)
* feat(app): switch Direct connection between Form and URI modes

The Advanced disclosure kept a second copy of the address. Connect read
the Host and Port fields while a tcp:// URI sat in the open Advanced
field, so a blank Host failed with "Host is required" and an edited URI
connected to the old address.

The step now holds one input whose type is the mode. Connect reads only
that input, so a hidden copy cannot exist. Switching modes converts the
input and never fails; an invalid port carries over as text so Connect
reports it. A tcp:// or relay:// address typed into Host moves to URI
mode, where its password and SSL settings count. A pairing link keeps
the Form segment disabled because it cannot be expressed as fields.

URI mode has no Password field, so a rejected password opens an inline
"Password for {host}" prompt, the same as Paste pairing link. URI mode
keeps the Form body's height and the actions sit in the sheet footer,
so Cancel and Connect stay put when the mode changes.

Closes #5495

Co-authored-by: thecardcheat <pitt.joshua.miller@gmail.com>

* fix(app): treat #offer= pairing links in Direct connection as a URI

paseo daemon pair prints an #offer= link next to the relay:// URI.
Pasted into Host it stayed in Form mode and probed the app's web host
as a daemon. All three pairing link formats now share one check.

* fix(app): show the whole Direct connection form on short phones

The compact sheet opened at the shared 65% stop. With Password always
visible and the mode switch above it, the form needs about 485dp of
sheet, so on phones about 690dp tall or shorter the footer covered the
Password field and its eye button. The sheet now opens at 80%.

---------

Co-authored-by: thecardcheat <pitt.joshua.miller@gmail.com>
2026-11-30 15:06:33 +07:00
Daniel JB ClarkandClaude Sonnet 5.5 e31f379d54 perf(desktop): ship precompressed web assets in app-dist (#10635)
The desktop app's Resources/app-dist was copied raw from packages/app/dist,
so the daemon-served web UI first load transferred about 25 MB. The server
already prefers `<asset>.br` / `<asset>.gz` beside an asset (web-ui.ts), but
only the standalone `build:daemon-web-ui` ever created them.

build:desktop now precompresses packages/app/dist after `expo export` and
before electron-builder copies it to app-dist via extraResources (no files
glob excludes .br/.gz). The compression code moves to
scripts/precompress-assets.mjs, shared with build-daemon-web-ui.mjs, with the
same extension list and brotli max quality (about 38 s for the 25 MB bundle;
first load drops to about 4 MB with br, 5.6 MB with gzip).

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-30 14:51:00 +07:00
paseo-bot[bot]andMohamed Boudra f37991f8d4 Reopen ACP chats with a rejected saved thinking level (#10333)
* fix(acp): reopen chats with a rejected saved thinking level

A stale thinking override aborted resume after the provider loaded the session. Preserve the loaded session when the provider rejects a value that its current model no longer offers, so the user can open the chat and select a supported value.

* fix(acp): report the restored model’s thinking level

Restoring the saved model can change the active thinking level before Paseo replays a saved preference. Read the level from the model response so a stale preference falls back to the current model’s setting.

* fix(acp): apply the thinking level from every full settings response

Restoring the saved mode can change the thinking level just like restoring the model. Keep the active level synchronized when accepting the provider’s selectors so resume reports the current setting after either change.

* fix(acp): refresh the thinking level only while restoring a chat

Reading the level from every settings response also changed what the thinking
picker shows after a live model switch. This fix is about reopening a saved
chat, so the read now happens once, after the saved mode and model are
restored. Open chats behave as before; #10336 tracks their picker updates.

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-11-30 14:40:52 +07:00
paseo-ai[bot] dbc3983314 fix: update lockfile signatures and Nix hash [skip ci] 2026-11-30 07:18:51 +00:00
paseo-bot[bot]andjsilhan b5f56a70f6 Finish Pi extension prompts when their work ends (#10572)
Closes #10548

Co-authored-by: jsilhan <jan.silhan@bighub.cz>
2026-11-30 14:09:32 +07:00
paseo-bot[bot]andLiebeLee 5ef84c6bc0 Keep workspace controls tappable after dismissing an opening file sheet (#11317)
Closes #11309

Co-authored-by: LiebeLee <27326628+LiebeLee@users.noreply.github.com>
2026-11-30 13:43:39 +07:00
paseo-bot[bot] 1e8bf499af test(terminal): restore AppImage zsh coverage (#11395)
The palette check reads the terminal overrides before building the child environment. Supply an empty override object so the AppImage fixture reaches its shell assertions.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 06:43:19 +00:00
paseo-bot[bot] 8849fd06c9 fix(desktop): avoid RPM conflicts with other Electron apps (#11354)
Electron RPMs can contain the same binary at different install paths. Turn off generated build-ID links so their RPMs can install alongside Paseo.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 13:39:34 +07:00
paseo-bot[bot]andmonarchmaisuriya 1cd2460a51 Restore finished Claude subagents after reopening (#10848)
Closes #8959

Co-authored-by: monarchmaisuriya <monarchmaisuriya7600@gmail.com>
2026-11-30 13:34:30 +07:00
yz 75abc739e6 Fix header taps scrolling panes to the top on iOS (#11262) 2026-11-30 13:33:06 +07:00
Bhaskaran S 728e09f0bb fix(app): archive closed subagents from 'Archive finished subagents' (#10865)
A child whose runtime was released (status closed) was listed in the
subagent track but treated as not finished, so the button skipped it
silently. Treat closed like idle/error, keeping the background-work and
parent/archived rechecks. Adds regression tests.
2026-11-30 13:29:52 +07:00
Mohamed Boudra cf68bd76d4 fix(server): deliver voice-only speak tool regardless of MCP injection policy (#11161)
* fix(server): deliver voice-only speak tool regardless of MCP injection policy

* fix(server): track HTTP MCP capability separately and validate voice speak before reload close
2026-11-30 13:22:56 +07:00
Mohamed Boudra 7f2ece0556 chore(release): reconcile v0.18.2 (#11393) 2026-11-30 13:15:10 +07:00
Mohamed Boudra f81d433afc fix(app): keep batched user messages on distinct timeline row keys (#11324)
* fix(app): keep batched user messages on distinct timeline row ids

When multiple queued or joined human prompts share a single provider turn, projectAgentMessages emits separate user_message rows with distinct clientMessageIds and the same provider messageId. appendUserMessage and buildCanonicalUserMessage bypassed createUserMessage's clientMessageId ?? messageId precedence by passing id: messageId, producing duplicate React keys in WebStreamViewport mountedHistoryRows.

Prefer clientMessageId over messageId when building canonical user rows, and normalize previously cached or retained rows whose id inherited a shared provider messageId during reconciliation and replica-cache hydration.

* refactor(app): keep legacy user row id heal at replica cache boundary

Pre-fix rows with id === messageId only persist in the replica cache, which already normalizes them on read. Move the helper into replica-cache with a COMPAT tag and remove the unreachable merge-path heal in produceUserMessage.
2026-11-30 13:14:41 +07:00
paseo-bot[bot] a931ac1cd7 test(cli): isolate worktree tests from the launch checkout (#11392)
An explicit daemon endpoint resolves relative paths from the daemon's working directory. Start the test daemon in the fixture repository so the checks exercise that path without reading the launch checkout.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 06:13:42 +00:00
paseo-bot[bot] cdfc788946 fix(cli): isolate the usage test from host reports (#11391)
The test daemon inherited settings that let built-in sources discover reports outside its temporary home. Give the usage fixture an explicit base environment so the list and removal assertions depend only on its plugin.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 06:13:10 +00:00
paseo-bot[bot]andShane Su 8be985cb27 Keep Muse token totals and context usage in the same session snapshot (#11389)
Co-authored-by: Shane Su <26364206+suniceman@users.noreply.github.com>
2026-11-30 05:42:58 +00:00
977049557a perf(app): open the mobile app faster after a cold launch (#11390)
A cold launch on Hermes keeps the JavaScript thread busy until the restored
workspace is on screen, so work removed there is launch time removed. A
sampled profile of a release build showed four costs that bought nothing:

- The provider snapshot cache rebuilt its size-and-age index on every
  launch by reading, parsing and validating every stored snapshot, about
  390 ms with a full 4 MB cache. The index is now stored and trusted for
  keys that still exist. Storage keys stay the authority: an indexed key
  that is gone is dropped, and a stored key the index does not list is
  read and measured.
- Zod compiled a parser for each object schema with `new Function`. Hermes
  has no JIT, so the compile was pure cost, about 145 ms. Native builds turn
  it off before any schema module loads; web and desktop keep it because V8
  optimises the compiled parsers.
- `localeCompare` builds a collator on every call, which dominated the
  project and workspace name sorts. They now share one collator.
- The replica cache measured each payload with a per-character loop, over
  about 1 MB of directory rows on every refresh.

Time from tap to the workspace on an Android emulator, release build,
median of six cold launches: 2.45 s to 1.76 s with a full provider cache,
2.30 s to 1.67 s with a small one.

Co-authored-by: Marcel Wysocki <4222082+maci0@users.noreply.github.com>
Co-authored-by: luke <1686898+luoph@users.noreply.github.com>
2026-11-30 12:37:40 +07:00
Mohamed Boudra 5d678b3848 perf(app): stop hidden workspaces re-rendering git actions on every switch (#11332)
Each retained workspace in the deck mounts git actions twice (header and
Changes surface). useGitActions subscribed to the whole workspaces map of the
host and resolved its workspace from the global active route. Any workspace
switch replaces that map, so every hidden workspace re-ran the hook and
rebuilt its actions. A hidden workspace also resolved the active workspace as
the one its archive action targets.

Callers now pass their own workspaceId, and the hook selects only that
descriptor, which the session store keeps by identity when other workspaces
change. The redirect after an archive reads the focused workspace when the
archive starts.
2026-11-30 12:23:58 +07:00
Mohamed Boudra 26550ff73f perf(app): skip the Markdown parse for replies that only link outside the workspace (#11327)
Opening a chat parsed every assistant reply that contained any Markdown link into a full
mdast tree, because a link into the workspace gets a hover title. A reply whose links all
point elsewhere produces no edit, so the parse and its garbage were wasted. Parse only when
the source contains the workspace root after a link, or a backslash escape that could spell
it. Character references already take the parse path through the `&` check.
2026-11-30 12:23:30 +07:00
Matt CowgerandMohamed Boudra eadd7c21bb feat(omp): track and stop OMP background jobs (#11270)
* feat(omp): track and stop OMP background jobs

- Inject a generated OMP extension that reports async job snapshots via ctx.ui.setStatus
- Map jobs to background_work items, excluding task jobs shown as subagents
- Stop jobs with /jobs kill and hide its output; require OMP 18.8.8+ for stop
- Clear inventory on process exit, runtime replacement and close
- OmpCliRuntime owns the extension file lifecycle

* fix(omp): skip OMP launch when start is aborted during extension setup

- Recheck the abort signal after writing the extension, before spawning OMP
- Add a regression test for an already-aborted start

* test(omp): skip POSIX permission assertion on Windows

- Split the extension file test so module loading still runs on every platform

* fix(omp): settle the waiting turn after Stop and hide Stop without /jobs kill

OMP 18.8.8 to 18.20.3 send nothing after /jobs kill cancels the last work
a run is waiting on, which left the turn running. After a Stop, read
get_state and complete the turn when OMP has nothing left.

OMP older than 18.8.8 has no /jobs kill, so publish its jobs with
canStop: false.

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-11-30 11:50:01 +07:00
paseo-bot[bot] a03fc5be64 Explain how to connect to TLS endpoints from the CLI (#11383)
* fix(cli): explain how to connect to TLS endpoints

A bare host and port selects plaintext WebSocket. A TLS proxy that replies with HTTP 400 leaves the user with generic connection advice, even though the same address works with wss://.

* fix(cli): include port shorthand in TLS guidance

Use the shared host parser so a port alone points to loopback in the recovery hint. Preserve the original port when switching the suggested URL to TLS.

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 04:43:02 +00:00
Mohamed Boudra c95a4a63fe Keep the keyboard open and land fullscreen composer toggles in one frame (#11326)
* fix(app): keep the keyboard and land each fullscreen toggle in one frame

Every fullscreen toggle on iOS closed the keyboard. The inline composer
root (shadow) and input wrapper (clipping) form Fabric stacking contexts
and the fullscreen styles do not, so the toggle flattened them and
re-parented the native editor, which resigns first responder. Both views
are now non-collapsable.

The rest of the jank came from layout split across commits:
- The slot cap and the body's keyboard reservation were worklets reading
  React `fullscreen`, which Reanimated applies frames after the commit. The
  fullscreen slot now fills with a static minHeight, and the reservation is a
  spacer mounted with the mode.
- Fullscreen resized the conversation list and re-measured the inline
  capacity and centered clearance, so exit corrected the list offset and the
  composer cap a few frames late. Fullscreen now covers that layout without
  changing it.
- The iOS translate view committed its mode change from a passive effect,
  and its persisted setNativeProps lift could stay stale on the resized view
  (the composer stuck 310pt above the screen) until the keyboard moved.

* fix(app): land the fullscreen composer toggle with its layout on every screen

With the keyboard open, entering fullscreen drew one frame of the fullscreen
layout at the inline keyboard lift: Send 310pt too high and the text off
screen. New workspace showed it on about half of the enters and a chat on
about one in eight.

The iOS translate view changed mode through two writers that nothing orders
with the mount. A layout-effect setNativeProps put the resting lift in the
shadow tree after React's commit, so React's own commit still carried the old
mode, and the native driver flipped the mode on its own queue. New workspace
drops its header in fullscreen, which resizes the translated surface, and
Fabric repaints a driven view's committed transform on resize: the stale one.
A chat never resized the surface, so only the driver's timing decided the
frame.

The translate view now commits where it rests as a React prop, from the
keyboard's target shift held in React state, so the commit that carries a
layout carries its lift. The driver follows a frame later, after the mount.
The dock moves the content and the composer slot with two translate views and
puts the mode on the slot, which fullscreen resizes on every screen, so a chat
and New workspace take the same path.

The fullscreen device check now records the screen through eight toggles on a
draft tab and on New workspace and fails on any frame that draws Send away
from its two resting places. Its snapshots are a second apart and passed
against the bug.

* test(app): count the chat dock's two keyboard translate views

The overlay placement test counts the translate views it checked. The chat
dock now moves its content and its composer slot with one view each.
2026-11-30 11:42:51 +07:00
paseo-bot[bot]andMatt Cowger a9c98a187d Choose an available model for new session defaults (#9052)
* fix(app): select available host model by default

* fix(app): resolve remembered models when host catalogs arrive

Keep opening model resolution pending until its selected catalog is ready, so a loading snapshot cannot freeze an unavailable preference. Preserve user edits and error presentation while awaiting recovery.

Co-authored-by: Matt Cowger <matt@cowger.us>

* fix(app): preserve pending form edits without repeated updates

Ignore equivalent pending inputs so freshly built fork defaults do not keep the view rendering. Apply fork defaults only to their provider and model, preserving mode and thinking choices made while discovery is pending.

* fix(app): preserve thinking defaults in legacy fork drafts

Resolve the legacy default model placeholder through the same canonical model lookup used for selection and identity comparisons.

---------

Co-authored-by: Matt Cowger <matt@cowger.us>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 11:37:08 +07:00
paseo-bot[bot] 07709a9651 Restore Pi chat history when transcripts contain unlinked metadata (#11379)
* fix(pi): restore history from transcripts with unlinked metadata

The transcript reader rejected title and model metadata without tree links before it could replay saved messages.

* fix(pi): preserve ancestry rooted at an older model change

Pi can omit the model change parent after reloading an ID-less title. Later messages still link to that model change.

* fix(pi): replay branches started immediately after an ID-less title

Pi can append a message as the root when it reloads an ID-less title. Keep rejecting other missing parent fields unless the row is a legacy model change.

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 04:12:50 +00:00
paseo-bot[bot]andClaude Opus 5.5 a099673413 test(cli): reserve lifecycle test ports outside the ephemeral range (#11378)
port() took a port from port 0 and released it before the daemon
listened. Port-0 ports are ephemeral, so the OS could give the same
port to another process in that gap, and the daemon failed with
EADDRINUSE. port() now picks a free port from 20000-31999, below the
ephemeral range of Linux, macOS, and Windows.

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-30 03:27:15 +00:00
SunicemanandShane Su 3abb0cb18e Leave unexpanded Windows variable paths unlinked in chat (#11228)
Co-authored-by: Shane Su <26364206+suniceman@users.noreply.github.com>
2026-11-30 03:12:59 +00:00
Mohamed Boudra c77a53ffdc fix(app): hold the launch splash until the restored workspace is on screen (#11348)
On a cold start the app showed the native splash, a grey frame, an empty
frame, a smaller second logo, then a series of different spinners before
the conversation appeared.

The grey came from the Android activity window, which had no background
and fell back to the AppCompat default under the fading splash. The rest
came from every screen in the startup chain rendering its own loading
state the moment it mounted, while the splash had already been hidden by
expo-router on first navigation.

native-splash now owns "launch is still loading": screens hold it while
their content can still come from the local cache, and it leaves once a
frame passes with no holds (5 s cap). It does not wait for the network;
a route that waits on the host shows one shared LoadingState that says
what it is waiting for. A host that is still connecting is loading, not
unreachable.

Android cannot time the hand-off from the system splash, so it swaps to
an identical in-app LaunchScreen at first commit and fades that out.

Also: the nested sidebar list is virtualised, and first launch waits
for host bootstrap to settle instead of giving up after a fixed 5 s.
2026-11-30 09:46:20 +07:00
Mohamed Boudra 614b4d3860 Open Profiles first and even out row heights in mobile Agent settings (#11371)
* feat(app): open Profiles by default when configuring a new agent on mobile

On a phone, picking a profile is the quickest way to set up a new agent, so
the agent settings drawer now opens with the Profiles card expanded for a
draft (New Chat, New Workspace) when profiles exist. A running agent keeps it
collapsed, since there a profile overwrites settings the agent already runs
with. A toggle holds until the drawer closes.

* fix(app): give every Agent settings row on mobile the same height

Model and switch rows used the settings-card row, sized for spacious settings
pages (switch height plus 16pt padding, 58pt on touch), while the sheet's
Profiles header and mode choices are 44pt list rows. A new list placement in
the row-density context makes settings rows in a sheet of list rows one touch
target tall, and Agent settings Home opts into it.
2026-11-30 09:44:32 +07:00
paseo-bot[bot] 80f0b11386 test(desktop): keep the link opener available during browser E2E (#11366)
A login shell that resets PATH removes the test opener before Electron launches a plugin link. Run the Linux desktop test with an isolated shell so the fixture receives both expected opens.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 01:42:48 +00:00
paseo-bot[bot] 95a90f5259 fix(cli): restore arguments on the desktop executable (#11363)
The bundled CLI build stopped emitting the runCli module that Electron imports for direct CLI calls. Build that module alongside the standalone CLI and include it in the Nix desktop trace.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 00:42:52 +00:00
paseo-bot[bot]andMarkA d059fcfd10 Show Schedules when a saved host is still connecting (#11361)
* fix(schedules): show results while another host connects

## Problem
An online host returning no schedules leaves the page loading indefinitely when
another saved host is still connecting. The user cannot reach the empty state or
create a schedule despite a successful response.

## Solution
Return the available results, including an empty list, and include a warning for
hosts still connecting. Preserve the initial connecting state when no host can
answer and existing errors when every attempted request fails.

* test(schedules): cover stalled hosts in the browser

## Problem
The schedules spinner regression needs a user-visible check, and partial
loading must not hide errors from the only connected host.

## Solution
Exercise an isolated daemon alongside a stalled WebSocket connection in the
existing schedules suite. Verify the empty state, warning, and creation
button, capture both responsive layouts, and preserve failed-host coverage.

* fix(schedules): keep host warnings consistent with fetched results

## Problem
A host changing connection state during another request could lose its
missing-results warning or gain a warning despite returning schedules.

## Solution
Remember settling hosts when deciding which requests to send. Cover both
connection transitions and express the browser regression through concise
user-level helpers.

* test(schedules): keep scenario mechanics in runtime fixtures

## Problem
Host-specific branching inside test bodies obscures the behaviors being
asserted and conflicts with the repository's test conventions.

## Solution
Reuse the runtime fixture for failed responses and isolate connection
transitions in a focused helper while preserving unconditional assertions.

* test(schedules): assert the empty state and creation control

Check the text and action the user sees when another host is still connecting.

Co-authored-by: MarkA <agenore990@gmail.com>

* fix(schedules): identify hosts that are still connecting

Carry the reason for each partial result so the banner can distinguish a pending connection from a failed schedule request.

---------

Co-authored-by: MarkA <agenore990@gmail.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-29 23:42:49 +00:00
paseo-bot[bot] cfd4efe289 fix(cli): exit agent logs after a daemon timeout (#11360)
Close the daemon connection before passing coded errors to the CLI error handler. An open connection kept the process running after the CLI printed the timeout.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-29 22:42:45 +00:00
Matchy 830697ba62 Close the image lightbox when switching sessions on web (#11358)
* fix(app): close the image lightbox when its panel goes inactive

Switching sessions (for example from a notification) keeps the old chat
mounted in a RetainedPanel that becomes inactive. On web, the next commit
freezes the hidden chat with react-freeze. The lightbox renders an RN Modal
that portals to document.body, so the image stayed on top of the new
session, and its close button, backdrop and Escape all set state inside the
frozen subtree, which never committed. On native the chat is not frozen,
but the old image was still left over the new session.

Do what MenuSurface already does: read useRetainedPanelActive(), call
onClose() when the panel turns inactive, and render nothing (with the
overlay layer and Escape registration off) in that same inactive commit, so
the portal is gone before the freeze. Outside a retained panel the signal
is true, so other callers are unaffected.

Checked with a browser test that opens the lightbox, deactivates the panel
under the web and native RetainedChatContent, and tries every close path:
it failed before this change and passes after.

* test(app): pin the lightbox closing when its chat leaves the screen

Opens the image lightbox inside a retained chat, deactivates the panel the
way a session switch does, and checks the lightbox is gone and stays gone
when the chat comes back. Runs under both the web RetainedChatContent,
which freezes the hidden chat, and the native one, which keeps it live.

Both cases fail on the commit before the lightbox fix and pass after it.

Refs #11355
2026-11-29 22:12:51 +00:00
paseo-bot[bot]andClaude Opus 5.5 41aceb042b test(server): wait for the shell prompt between terminal protocol helpers (#11357)
The three protocol-query tests typed the next helper command as soon as
the previous helper printed its OK line. That helper was still running,
so the shell printed its prompt and the typed-ahead command's output on
one row ("$ OSC_COLOR_OK:12:..."). The checks need the line to start
with, or equal, the OK text, so they waited until the 5 s timeout.

Each command now waits for the prompt before it is typed. A timeout
also prints the screen, so the next failure shows what it saw.

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-29 21:35:27 +00:00
Tri Dao 74f629bee1 fix(pi): run extension commands sent mid-turn without aborting the turn (#11341)
Slash input sent while a Pi turn runs used to replace the turn: steering refuses slash
commands, so Paseo aborted the turn and sent the command as a new prompt. Pi runs
extension commands immediately even while streaming, so the provider now claims them
through tryHandleOutOfBand (as /compact already is) and forwards them as a plain prompt.
The handler doesn't wait for Pi's ack, which arrives only when the command returns, so an
interactive command can't hold Stop. Idle input, skills, prompt templates and unknown
commands keep their existing paths.
2026-11-29 20:42:37 +00:00
paseo-bot[bot]andMatteo Pietro Dazzi 097a0f3a7d Restore Android scrolling in provider model settings (#11350)
* fix(app): scroll the provider models list on Android

The models list sits in a ScrollView nested in the provider sheet's own
scrolling body. On Android the sheet's pan gesture claims the drag and cancels
that inner scroll, so the scrollbar appears and the content stays put;
nestedScrollEnabled covers Android's nested scrolling, not gesture
cancellation.

Claim the touch stream for the nested scroller instead, with the Android-only
gesture the model browser already used for the same problem. It moves out of
model-browser.tsx into components/ui/independent-scroll-boundary.tsx, so the
provider settings can use it without importing the model browser. The gesture
activates on the first move and refuses interruption, which keeps Android's
native scroll and its ACTION_UP for the fling.

The provider update output box has the same shape in the same sheet and gets
the same wrapper.

The claim and the platform gate are covered by a test; the drag itself needs a
device.

Closes #10544

* fix(app): preserve model checkbox taps while scrolling provider settings

Wait for Android to detect a drag before the provider list claims the touch. Exercise the sheet with the native swipe and checkbox interactions.

Co-authored-by: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>

---------

Co-authored-by: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-29 19:12:40 +00:00
paseo-bot[bot]andClaude Opus 5.5 47b4205098 test(website): wait for the plugin section fade before checking the reduced-motion demo (#11351)
The reduced-motion plugin demo test gave scrolling plus the section's
0.5 s fade-in a 2 s budget. On slow WebKit runners each scroll call took
up to 0.9 s and the row was still at opacity 0 when the budget ran out.
Wait for the section to finish fading in, then check the row at once:
the staged demo would still be hiding it at that point.

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-29 18:39:17 +00:00
paseo-bot[bot] d8e9a39953 test(server): receive live shell events in Codex steering tests (#11336)
The test waits for a running shell call before sending a follow-up. Subscribe to the agent timeline before the first prompt so the collector receives that event. Let the installed Codex select its supported default model.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-29 17:12:43 +00:00
531 changed files with 45184 additions and 8096 deletions
+1 -1
View File
@@ -59,7 +59,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/changelog-utils.test.mjs scripts/release-version-utils.test.mjs scripts/publish-release-packages.test.mjs scripts/push-current-release-tag.test.mjs scripts/reconcile-release.test.mjs scripts/sync-fdroid-changelogs.test.mjs scripts/sync-release-notes-from-changelog.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/release-version-utils.test.mjs scripts/publish-release-packages.test.mjs scripts/push-current-release-tag.test.mjs scripts/reconcile-release.test.mjs scripts/sync-fdroid-changelogs.test.mjs scripts/sync-release-notes-from-changelog.test.mjs scripts/upload-release-assets.test.mjs scripts/precompress-assets.test.mjs
quality:
name: quality
+93
View File
@@ -1,5 +1,98 @@
# Changelog
## 0.18.2 - 2026-11-30
- **Redesigned model picker:** Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings. ([#11186](https://github.com/getpaseo/paseo/pull/11186), [#11280](https://github.com/getpaseo/paseo/pull/11280), [#11295](https://github.com/getpaseo/paseo/pull/11295), [#11371](https://github.com/getpaseo/paseo/pull/11371), [#11313](https://github.com/getpaseo/paseo/pull/11313))
- **File actions and filter:** Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees. ([#11073](https://github.com/getpaseo/paseo/pull/11073), [#11299](https://github.com/getpaseo/paseo/pull/11299), [#11320](https://github.com/getpaseo/paseo/pull/11320) by [@YASICJUNWOO](https://github.com/YASICJUNWOO), [@apple-ouyang](https://github.com/apple-ouyang), [@iqshen](https://github.com/iqshen), [@Ctrl-Creeper](https://github.com/Ctrl-Creeper), [@softyoda](https://github.com/softyoda))
- **New butterfly app icons:** Desktop and mobile now share the updated butterfly icon, with proper macOS Dock sizing and system lighting. ([#11091](https://github.com/getpaseo/paseo/pull/11091))
- **Live usage updates:** Claude and Codex usage summaries now update as turns finish instead of waiting for the five-minute poll. ([#11170](https://github.com/getpaseo/paseo/pull/11170) by [@Zayooo00](https://github.com/Zayooo00))
- **Faster CLI startup:** Paseo CLI commands now start 7 to 22 times faster by loading only the requested command. ([#11155](https://github.com/getpaseo/paseo/pull/11155), [#11193](https://github.com/getpaseo/paseo/pull/11193), [#11363](https://github.com/getpaseo/paseo/pull/11363))
- **Native ACP question cards:** Plugin ACP providers such as Antigravity now pause on interactive form questions with Paseo's question card instead of printing numbered lists. ([#11135](https://github.com/getpaseo/paseo/pull/11135) by [@djbclark](https://github.com/djbclark), [@krazyjakee](https://github.com/krazyjakee))
- **OMP background jobs:** OMP agents now list running background tasks above the composer and let you stop them without interrupting the agent. ([#11270](https://github.com/getpaseo/paseo/pull/11270) by [@mcowger](https://github.com/mcowger))
- **Plugin HTTP tunnels:** Plugins can now expose local HTTP services at public HTTPS URLs through tunnel providers, with built-in `cloudflared` and Tailscale Funnel support. ([#11036](https://github.com/getpaseo/paseo/pull/11036))
### Added
- Added `--all` to `paseo schedule ls` to list schedules targeting existing agents, and noted hidden schedules in table output ([#11243](https://github.com/getpaseo/paseo/pull/11243) by [@suniceman](https://github.com/suniceman))
- Added `activeTurnBehavior: "queue"` support for non-agent senders so plugins and UI actions can queue prompts behind a running turn ([#11169](https://github.com/getpaseo/paseo/pull/11169))
### Improved
- Reduced app memory use by dropping duplicate in-memory copies of cached transcripts ([#11322](https://github.com/getpaseo/paseo/pull/11322))
- Held the native launch splash until the restored workspace is on screen so mobile cold starts no longer flash empty frames or spinners ([#11348](https://github.com/getpaseo/paseo/pull/11348))
- Added a neutral focus border to the message composer ([#11097](https://github.com/getpaseo/paseo/pull/11097), [#11272](https://github.com/getpaseo/paseo/pull/11272) by [@Zayooo00](https://github.com/Zayooo00))
- Changed protocol parsing to ignore unknown newer fields and skip unrecognized list items instead of dropping whole messages ([#11284](https://github.com/getpaseo/paseo/pull/11284))
- Improved workspace lookup speed on hosts with many workspaces by filtering before loading workspace configs ([#11266](https://github.com/getpaseo/paseo/pull/11266))
### Changed
- Changed unattended Hub agent runs and their subagents to automatically deny unexpected permission prompts instead of blocking until timeout ([#11179](https://github.com/getpaseo/paseo/pull/11179))
- Changed delegated agent turn-end notices with pending work to appear as compact tool rows instead of peer message bubbles ([#11175](https://github.com/getpaseo/paseo/pull/11175))
### Fixed
- Fixed iOS composer buttons ignoring taps while the software keyboard is open and the model picker opening behind the keyboard on unfolded wide screens ([#11276](https://github.com/getpaseo/paseo/pull/11276))
- Fixed tapping Fullscreen or Exit fullscreen in the mobile composer closing the keyboard and flashing misaligned frames ([#11326](https://github.com/getpaseo/paseo/pull/11326))
- Fixed phone photos and large Android image batches failing to send by uploading images as chunked files and downscaling HEIC photos ([#11137](https://github.com/getpaseo/paseo/pull/11137), [#9328](https://github.com/getpaseo/paseo/pull/9328), [#11281](https://github.com/getpaseo/paseo/pull/11281) by [@Brandon168](https://github.com/Brandon168))
- Fixed Android's system Bold text setting clipping trailing characters and labels across the app ([#11162](https://github.com/getpaseo/paseo/pull/11162) by [@JustinJoshi](https://github.com/JustinJoshi))
- Fixed the discovered Models list in Android provider settings failing to scroll ([#11350](https://github.com/getpaseo/paseo/pull/11350) by [@ilteoood](https://github.com/ilteoood))
- Fixed mobile sending push notifications for the active chat by counting native touches and typing as presence ([#8070](https://github.com/getpaseo/paseo/pull/8070) by [@truelecter](https://github.com/truelecter))
- Fixed SVG files opening as blank image previews on iOS and Android ([#9094](https://github.com/getpaseo/paseo/pull/9094))
- Fixed reconnects on hosts with many workspaces causing mobile freezes and 60-second request timeouts ([#11145](https://github.com/getpaseo/paseo/pull/11145) by [@TheUnlimited64](https://github.com/TheUnlimited64))
- Fixed desktop browser tabs controlled by an agent stealing keyboard focus from chat composers ([#11158](https://github.com/getpaseo/paseo/pull/11158) by [@puchkoff](https://github.com/puchkoff))
- Fixed the web and desktop image lightbox staying stuck on screen after switching to another session ([#11358](https://github.com/getpaseo/paseo/pull/11358) by [@matchy233](https://github.com/matchy233))
- Fixed long desktop and web chats crashing with React error #185 during scroll re-measurement ([#11138](https://github.com/getpaseo/paseo/pull/11138) by [@kogekiplay](https://github.com/kogekiplay))
- Fixed scrolling older history crashing desktop when a timeline plugin reuses output IDs across messages ([#8498](https://github.com/getpaseo/paseo/pull/8498) by [@kevinle128](https://github.com/kevinle128), [@ykurilov](https://github.com/ykurilov))
- Fixed opening Changes with wrapped long lines freezing the desktop app ([#11113](https://github.com/getpaseo/paseo/pull/11113))
- Fixed streaming code blocks growing and shrinking by a line while their closing fence arrives ([#7006](https://github.com/getpaseo/paseo/pull/7006) by [@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
- Fixed sending a steering message while an agent streams splitting the reply in half ([#5267](https://github.com/getpaseo/paseo/pull/5267))
- Fixed the Schedules screen staying on a spinner when another saved host is offline or still connecting ([#11361](https://github.com/getpaseo/paseo/pull/11361) by [@agenore](https://github.com/agenore))
- Fixed starting a new session on another host submitting an unavailable remembered model instead of selecting an available one ([#9052](https://github.com/getpaseo/paseo/pull/9052) by [@mcowger](https://github.com/mcowger))
- Fixed the composer showing the wrong thinking level when an agent's level is absent from its model's option list ([#10937](https://github.com/getpaseo/paseo/pull/10937) by [@ortschun](https://github.com/ortschun))
- Fixed unexpanded Windows environment-variable paths like `%TEMP%\file.md` rendering as broken links in chat ([#11228](https://github.com/getpaseo/paseo/pull/11228) by [@suniceman](https://github.com/suniceman))
- Fixed Open in Antigravity on macOS launching the `agy` CLI instead of Antigravity IDE ([#10893](https://github.com/getpaseo/paseo/pull/10893) by [@wangfh5](https://github.com/wangfh5))
- Fixed opening a built-in plugin's settings page showing a "not installed or listed" error ([#11308](https://github.com/getpaseo/paseo/pull/11308))
- Fixed local host images inside plugin Markdown surfaces failing to render inline ([#11171](https://github.com/getpaseo/paseo/pull/11171))
- Fixed agent metadata disappearing from plugin views after an app reload ([#11265](https://github.com/getpaseo/paseo/pull/11265))
- Fixed Android terminal input doubling characters, dropping Backspace, breaking Korean/Pinyin/Gboard suggestions, and mishandling hardware Enter ([#11146](https://github.com/getpaseo/paseo/pull/11146), [#11318](https://github.com/getpaseo/paseo/pull/11318) by [@apple-ouyang](https://github.com/apple-ouyang), [@lennartschoch](https://github.com/lennartschoch), [@jasonmarkperez](https://github.com/jasonmarkperez))
- Fixed Light-mode terminals reporting dark colors to terminal apps and added live light/dark theme change notifications ([#11163](https://github.com/getpaseo/paseo/pull/11163), [#11312](https://github.com/getpaseo/paseo/pull/11312) by [@gstamp](https://github.com/gstamp))
- Fixed web and desktop terminals using the interface font instead of the configured Code font on the DOM renderer ([#11099](https://github.com/getpaseo/paseo/pull/11099) by [@sh0nuff](https://github.com/sh0nuff))
- Fixed Windows terminals exiting immediately on busy machines when ConPTY startup takes more than five seconds ([#11238](https://github.com/getpaseo/paseo/pull/11238))
- Fixed closing terminals or stopping the daemon on Windows leaving terminal programs running ([#11147](https://github.com/getpaseo/paseo/pull/11147))
- Fixed Cursor usage showing HTTP 401 or missing cards across macOS Keychain, encrypted desktop stores, and Windows ([#11148](https://github.com/getpaseo/paseo/pull/11148) by [@jasonhnd](https://github.com/jasonhnd), [@KronixDev](https://github.com/KronixDev), [@kiawin](https://github.com/kiawin), [@ChicorSun](https://github.com/ChicorSun), [@kbitz](https://github.com/kbitz))
- Fixed OpenCode v2 agents hiding plan usage windows in the chat meter and Codex usage reading stale OpenCode v1 logins ([#11153](https://github.com/getpaseo/paseo/pull/11153) by [@Wu-Jiayang](https://github.com/Wu-Jiayang))
- Fixed Usage missing custom Claude and Codex providers configured with separate credential directories ([#11149](https://github.com/getpaseo/paseo/pull/11149) by [@QichangZheng](https://github.com/QichangZheng))
- Fixed Claude and Codex wrapper commands or environment tokens showing a mismatched local account in Usage ([#11154](https://github.com/getpaseo/paseo/pull/11154))
- Fixed Claude progress updates hiding inside collapsed Thinking rows and multi-block messages repeating their final block ([#11160](https://github.com/getpaseo/paseo/pull/11160) by [@ThePharmer](https://github.com/ThePharmer))
- Fixed orphaned Claude CLI child processes leaking on concurrent resume or early cancel, and bounded headless metadata generation ([#11143](https://github.com/getpaseo/paseo/pull/11143) by [@desmond-rai](https://github.com/desmond-rai), [@nickmaglowsch](https://github.com/nickmaglowsch))
- Fixed idle Claude agents being marked as failed when their process exits cleanly with code 0 ([#11273](https://github.com/getpaseo/paseo/pull/11273) by [@lucamzanon](https://github.com/lucamzanon))
- Fixed Claude Advisor tool calls staying unsettled when rebuilding chat history ([#11202](https://github.com/getpaseo/paseo/pull/11202) by [@LucasValeQueiroz](https://github.com/LucasValeQueiroz), [@SirisZheng](https://github.com/SirisZheng))
- Fixed updated plugin system prompt instructions not reaching resumed Claude sessions ([#10917](https://github.com/getpaseo/paseo/pull/10917) by [@Tomblarom](https://github.com/Tomblarom))
- Fixed Codex alias `-c mcp_servers.*` overrides disappearing when Paseo injects MCP servers ([#11142](https://github.com/getpaseo/paseo/pull/11142))
- Fixed OpenCode v2 models having no Default thinking option to return to base model behavior ([#11184](https://github.com/getpaseo/paseo/pull/11184) by [@3ae3ae](https://github.com/3ae3ae))
- Fixed Pi and OMP live streaming splitting thinking and answer blocks out of order ([#11159](https://github.com/getpaseo/paseo/pull/11159))
- Fixed Pi chat history opening empty when transcripts contain unlinked title or model-change metadata ([#11379](https://github.com/getpaseo/paseo/pull/11379))
- Fixed sending a Pi extension slash command mid-turn aborting the active response ([#11341](https://github.com/getpaseo/paseo/pull/11341) by [@tridao](https://github.com/tridao))
- Fixed a rejected Pi history or rewind extension prompt crashing the daemon worker ([#11329](https://github.com/getpaseo/paseo/pull/11329) by [@thomasvan](https://github.com/thomasvan))
- Fixed completed Pi Tintinweb background subagents staying marked as Running ([#11168](https://github.com/getpaseo/paseo/pull/11168) by [@amcfague](https://github.com/amcfague))
- Fixed background OMP catalog refreshes triggering cancelled startup model requests ([#11129](https://github.com/getpaseo/paseo/pull/11129) by [@mcowger](https://github.com/mcowger))
- Fixed OMP turns timing out after ten minutes while actively streaming or waiting on a question card ([#11079](https://github.com/getpaseo/paseo/pull/11079) by [@LiebeLee](https://github.com/LiebeLee))
- Fixed Antigravity deferred turns ending early after an interim reply when the final background tool completes ([#10924](https://github.com/getpaseo/paseo/pull/10924) by [@Juns-g](https://github.com/Juns-g))
- Fixed stopping an unresponsive ACP agent leaving later prompts stuck behind an active foreground turn ([#11152](https://github.com/getpaseo/paseo/pull/11152))
- Fixed resumed Muse sessions dropping daemon and plugin system instructions ([#10915](https://github.com/getpaseo/paseo/pull/10915) by [@Tomblarom](https://github.com/Tomblarom))
- Fixed Unix-socket, named-pipe, non-loopback, and HTTP-proxy daemons dropping injected Paseo MCP tools and terminal activity reporting ([#11144](https://github.com/getpaseo/paseo/pull/11144))
- Fixed repeated daemon restarts duplicating provider image attachments in temporary directories ([#7895](https://github.com/getpaseo/paseo/pull/7895) by [@cleiter](https://github.com/cleiter))
- Fixed concurrent reloads of the same agent failing with "Unknown agent" ([#8369](https://github.com/getpaseo/paseo/pull/8369) by [@tieo](https://github.com/tieo))
- Fixed `paseo agent logs --tail` timing out on very large chat histories ([#10723](https://github.com/getpaseo/paseo/pull/10723) by [@minamorl](https://github.com/minamorl))
- Fixed `paseo agent logs` hanging instead of exiting after a daemon request timeout ([#11360](https://github.com/getpaseo/paseo/pull/11360))
- Fixed `paseo permit ls` missing pending permissions from background agents and agents past the first 200 ([#10655](https://github.com/getpaseo/paseo/pull/10655) by [@NightMachinery](https://github.com/NightMachinery))
- Fixed `paseo --host host:port` giving generic credential advice on HTTP 400 instead of suggesting `wss://` for TLS endpoints ([#11383](https://github.com/getpaseo/paseo/pull/11383))
### Plugins
- Added `update_workspace` and workspace `metadata` support to Paseo MCP and `PluginWorkspaceSnapshot` ([#11166](https://github.com/getpaseo/paseo/pull/11166))
- Fixed server plugin compilation failing when a dependency's type declarations import Node ambient types ([#8618](https://github.com/getpaseo/paseo/pull/8618) by [@nkwib](https://github.com/nkwib))
## 0.18.1 - 2026-11-27
- **Host metadata instructions:** Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests. ([#11064](https://github.com/getpaseo/paseo/pull/11064))
+93
View File
@@ -1,5 +1,98 @@
# Changelog
## 0.18.2 - 2026-11-30
- **重新设计的模型选择器**:桌面端采用支持跨 Provider 搜索的双栏视图,手机端合并为带思考强度滑块的单层抽屉,并支持在设置中按 Provider 筛选常用模型。([#11186](https://github.com/getpaseo/paseo/pull/11186), [#11280](https://github.com/getpaseo/paseo/pull/11280), [#11295](https://github.com/getpaseo/paseo/pull/11295), [#11371](https://github.com/getpaseo/paseo/pull/11371), [#11313](https://github.com/getpaseo/paseo/pull/11313))
- **文件操作与筛选**:支持按名称筛选文件树,并直接从对话文件链接、文件标签页和侧边栏文件树中定位文件、使用默认应用打开、下载或复制路径。([#11073](https://github.com/getpaseo/paseo/pull/11073), [#11299](https://github.com/getpaseo/paseo/pull/11299), [#11320](https://github.com/getpaseo/paseo/pull/11320),贡献者:[@YASICJUNWOO](https://github.com/YASICJUNWOO), [@apple-ouyang](https://github.com/apple-ouyang), [@iqshen](https://github.com/iqshen), [@Ctrl-Creeper](https://github.com/Ctrl-Creeper), [@softyoda](https://github.com/softyoda))
- **全新蝴蝶应用图标**:桌面端和移动端现已统一使用新版蝴蝶图标,并在 macOS 程序坞中具备正确的图标尺寸与系统光影。([#11091](https://github.com/getpaseo/paseo/pull/11091))
- **实时用量更新**:Claude 和 Codex 的用量摘要现在会在轮次结束时实时更新,不再需要等待五分钟轮询。([#11170](https://github.com/getpaseo/paseo/pull/11170),贡献者:[@Zayooo00](https://github.com/Zayooo00))
- **更快的 CLI 启动速度**:Paseo CLI 仅按需加载所执行的命令,启动速度提升 7 至 22 倍。([#11155](https://github.com/getpaseo/paseo/pull/11155), [#11193](https://github.com/getpaseo/paseo/pull/11193), [#11363](https://github.com/getpaseo/paseo/pull/11363))
- **原生 ACP 提问卡片**:Antigravity 等插件 ACP Provider 遇到交互式表单提问时,现在会暂停并显示 Paseo 原生提问卡片,而不再输出编号列表。([#11135](https://github.com/getpaseo/paseo/pull/11135),贡献者:[@djbclark](https://github.com/djbclark), [@krazyjakee](https://github.com/krazyjakee))
- **OMP 后台任务**:OMP Agent 现在会在 Composer 上方列出正在运行的后台任务,并支持直接停止而不中断 Agent。([#11270](https://github.com/getpaseo/paseo/pull/11270),贡献者:[@mcowger](https://github.com/mcowger))
- **插件 HTTP 隧道**:插件现在可以通过隧道 Provider 将本地 HTTP 服务暴露为公网 HTTPS 地址,内置支持 `cloudflared` 和 Tailscale Funnel。([#11036](https://github.com/getpaseo/paseo/pull/11036))
### 新增
- 为 `paseo schedule ls` 新增 `--all` 选项以列出指向现有 Agent 的定时任务,并在表格输出中提示已隐藏的定时任务 ([#11243](https://github.com/getpaseo/paseo/pull/11243),贡献者:[@suniceman](https://github.com/suniceman))
- 为非 Agent 发送方新增 `activeTurnBehavior: "queue"` 支持,使插件和界面操作可将提示词排队到当前运行轮次之后 ([#11169](https://github.com/getpaseo/paseo/pull/11169))
### 改进
- 移除了内存中重复保留的已缓存对话记录副本,降低了应用内存占用 ([#11322](https://github.com/getpaseo/paseo/pull/11322))
- 延长原生启动画面直到恢复的工作区渲染到屏幕上,避免移动端冷启动时闪烁空白帧或加载指示器 ([#11348](https://github.com/getpaseo/paseo/pull/11348))
- 为消息 Composer 新增中性色调的聚焦边框 ([#11097](https://github.com/getpaseo/paseo/pull/11097), [#11272](https://github.com/getpaseo/paseo/pull/11272),贡献者:[@Zayooo00](https://github.com/Zayooo00))
- 改进协议解析,忽略未知的新字段并跳过无法识别的列表项,不再丢弃整条消息 ([#11284](https://github.com/getpaseo/paseo/pull/11284))
- 在加载工作区配置前先进行过滤,提升包含大量工作区主机上的工作区查询速度 ([#11266](https://github.com/getpaseo/paseo/pull/11266))
### 变更
- 无人值守的 Hub Agent 及其子 Agent 遇到意外权限请求时,改为自动拒绝而不再阻塞直至超时 ([#11179](https://github.com/getpaseo/paseo/pull/11179))
- 仍有待处理任务的委托 Agent 轮次结束通知,改为显示为紧凑的工具调用行,而不再显示为对等消息气泡 ([#11175](https://github.com/getpaseo/paseo/pull/11175))
### 修复
- 修复 iOS 软键盘弹出时 Composer 按钮忽略点击,以及在展开的宽屏设备上模型选择器被键盘遮挡的问题 ([#11276](https://github.com/getpaseo/paseo/pull/11276))
- 修复在移动端 Composer 中点击全屏或退出全屏时收起键盘并闪烁错位帧的问题 ([#11326](https://github.com/getpaseo/paseo/pull/11326))
- 修复手机照片和大量 Android 图片批次发送失败的问题,改为以分块文件上传图片并将 HEIC 照片降采样为 JPEG ([#11137](https://github.com/getpaseo/paseo/pull/11137), [#9328](https://github.com/getpaseo/paseo/pull/9328), [#11281](https://github.com/getpaseo/paseo/pull/11281),贡献者:[@Brandon168](https://github.com/Brandon168))
- 修复 Android 系统开启粗体文字设置后应用内末尾字符和标签被截断的问题 ([#11162](https://github.com/getpaseo/paseo/pull/11162),贡献者:[@JustinJoshi](https://github.com/JustinJoshi))
- 修复 Android 的 Provider 设置中已发现的模型列表无法滚动的问题 ([#11350](https://github.com/getpaseo/paseo/pull/11350),贡献者:[@ilteoood](https://github.com/ilteoood))
- 修复移动端仍为当前正在查看的对话发送推送通知的问题,将原生触摸与输入计入在线活跃状态 ([#8070](https://github.com/getpaseo/paseo/pull/8070),贡献者:[@truelecter](https://github.com/truelecter))
- 修复 iOS 和 Android 上打开 SVG 文件预览显示空白的问题 ([#9094](https://github.com/getpaseo/paseo/pull/9094))
- 修复在包含大量工作区的主机上重连时导致移动端卡顿和 60 秒请求超时的问题 ([#11145](https://github.com/getpaseo/paseo/pull/11145),贡献者:[@TheUnlimited64](https://github.com/TheUnlimited64))
- 修复由 Agent 控制的桌面端浏览器标签页抢占对话 Composer 键盘焦点的问题 ([#11158](https://github.com/getpaseo/paseo/pull/11158),贡献者:[@puchkoff](https://github.com/puchkoff))
- 修复在网页端和桌面端切换到其他会话后图片灯箱仍卡在屏幕上的问题 ([#11358](https://github.com/getpaseo/paseo/pull/11358),贡献者:[@matchy233](https://github.com/matchy233))
- 修复桌面端和网页端长对话在滚动重新测量时触发 React 错误 #185 崩溃的问题 ([#11138](https://github.com/getpaseo/paseo/pull/11138),贡献者:[@kogekiplay](https://github.com/kogekiplay))
- 修复时间线插件跨消息复用输出 ID 时,滚动较早历史记录导致桌面端崩溃的问题 ([#8498](https://github.com/getpaseo/paseo/pull/8498),贡献者:[@kevinle128](https://github.com/kevinle128), [@ykurilov](https://github.com/ykurilov))
- 修复在变更视图中开启长行换行时桌面端卡死的问题 ([#11113](https://github.com/getpaseo/paseo/pull/11113))
- 修复流式输出代码块在闭合围栏尚未完整到达时高度增加一行又缩回的问题 ([#7006](https://github.com/getpaseo/paseo/pull/7006),贡献者:[@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
- 修复在 Agent 流式回复过程中发送引导消息将回复截成两半的问题 ([#5267](https://github.com/getpaseo/paseo/pull/5267))
- 修复另一个已保存主机离线或仍在连接时,定时任务页面一直停留在加载状态的问题 ([#11361](https://github.com/getpaseo/paseo/pull/11361),贡献者:[@agenore](https://github.com/agenore))
- 修复在另一台主机上启动新会话时提交上次记住但该主机不可用的模型,而未自动选择可用模型的问题 ([#9052](https://github.com/getpaseo/paseo/pull/9052),贡献者:[@mcowger](https://github.com/mcowger))
- 修复 Agent 的思考强度不在其模型选项列表中时,Composer 显示错误思考强度的问题 ([#10937](https://github.com/getpaseo/paseo/pull/10937),贡献者:[@ortschun](https://github.com/ortschun))
- 修复对话中未展开的 Windows 环境变量路径(如 `%TEMP%\file.md`)被渲染为失效链接的问题 ([#11228](https://github.com/getpaseo/paseo/pull/11228),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 macOS 上“在 Antigravity 中打开”启动 `agy` CLI 而不是 Antigravity IDE 的问题 ([#10893](https://github.com/getpaseo/paseo/pull/10893),贡献者:[@wangfh5](https://github.com/wangfh5))
- 修复打开内置插件设置页面时显示“未安装或未列出”错误的问题 ([#11308](https://github.com/getpaseo/paseo/pull/11308))
- 修复插件 Markdown 界面中的本地主机图片无法内联渲染的问题 ([#11171](https://github.com/getpaseo/paseo/pull/11171))
- 修复重新加载应用后插件视图中 Agent 元数据消失的问题 ([#11265](https://github.com/getpaseo/paseo/pull/11265))
- 修复 Android 终端输入重复字符、丢失退格键、破坏韩语/拼音/Gboard 候选词以及误处理实体回车键的问题 ([#11146](https://github.com/getpaseo/paseo/pull/11146), [#11318](https://github.com/getpaseo/paseo/pull/11318),贡献者:[@apple-ouyang](https://github.com/apple-ouyang), [@lennartschoch](https://github.com/lennartschoch), [@jasonmarkperez](https://github.com/jasonmarkperez))
- 修复浅色模式终端向终端程序报告深色配色的问题,并新增实时浅色/深色主题切换通知 ([#11163](https://github.com/getpaseo/paseo/pull/11163), [#11312](https://github.com/getpaseo/paseo/pull/11312),贡献者:[@gstamp](https://github.com/gstamp))
- 修复网页端和桌面端终端在 DOM 渲染器下使用界面字体而不是已配置代码字体的问题 ([#11099](https://github.com/getpaseo/paseo/pull/11099),贡献者:[@sh0nuff](https://github.com/sh0nuff))
- 修复在负载较高的 Windows 机器上 ConPTY 启动超过五秒时终端立即退出的问题 ([#11238](https://github.com/getpaseo/paseo/pull/11238))
- 修复在 Windows 上关闭终端或停止 daemon 时终端内程序仍在后台运行的问题 ([#11147](https://github.com/getpaseo/paseo/pull/11147))
- 修复 Cursor 使用情况在 macOS 钥匙串、加密桌面存储和 Windows 上返回 HTTP 401 或缺失卡片的问题 ([#11148](https://github.com/getpaseo/paseo/pull/11148),贡献者:[@jasonhnd](https://github.com/jasonhnd), [@KronixDev](https://github.com/KronixDev), [@kiawin](https://github.com/kiawin), [@ChicorSun](https://github.com/ChicorSun), [@kbitz](https://github.com/kbitz))
- 修复 OpenCode v2 Agent 在对话用量指示器中不显示套餐用量窗口,以及 Codex 使用情况读取过期 OpenCode v1 登录态的问题 ([#11153](https://github.com/getpaseo/paseo/pull/11153),贡献者:[@Wu-Jiayang](https://github.com/Wu-Jiayang))
- 修复使用情况遗漏配置了独立凭据目录的自定义 Claude 和 Codex Provider 的问题 ([#11149](https://github.com/getpaseo/paseo/pull/11149),贡献者:[@QichangZheng](https://github.com/QichangZheng))
- 修复使用包装命令或环境变量令牌的 Claude 和 Codex 在使用情况中显示不匹配的本地账号的问题 ([#11154](https://github.com/getpaseo/paseo/pull/11154))
- 修复 Claude 进度更新被隐藏在折叠的思考行内,以及多块消息重复显示最后一块的问题 ([#11160](https://github.com/getpaseo/paseo/pull/11160),贡献者:[@ThePharmer](https://github.com/ThePharmer))
- 修复并发恢复或提前取消时泄漏孤立 Claude CLI 子进程的问题,并限制无头元数据生成的并发 ([#11143](https://github.com/getpaseo/paseo/pull/11143),贡献者:[@desmond-rai](https://github.com/desmond-rai), [@nickmaglowsch](https://github.com/nickmaglowsch))
- 修复空闲 Claude Agent 进程以退出码 0 正常退出时被标记为失败的问题 ([#11273](https://github.com/getpaseo/paseo/pull/11273),贡献者:[@lucamzanon](https://github.com/lucamzanon))
- 修复重建对话历史时 Claude Advisor 工具调用一直停留在未完成状态的问题 ([#11202](https://github.com/getpaseo/paseo/pull/11202),贡献者:[@LucasValeQueiroz](https://github.com/LucasValeQueiroz), [@SirisZheng](https://github.com/SirisZheng))
- 修复更新后的插件系统提示词指令未能送达已恢复的 Claude 会话的问题 ([#10917](https://github.com/getpaseo/paseo/pull/10917),贡献者:[@Tomblarom](https://github.com/Tomblarom))
- 修复 Paseo 注入 MCP 服务器时 Codex 别名的 `-c mcp_servers.*` 覆盖配置丢失的问题 ([#11142](https://github.com/getpaseo/paseo/pull/11142))
- 修复 OpenCode v2 模型缺少 Default 思考选项、无法恢复模型默认行为的问题 ([#11184](https://github.com/getpaseo/paseo/pull/11184),贡献者:[@3ae3ae](https://github.com/3ae3ae))
- 修复 Pi 和 OMP 实时流式输出时思考块和回复块顺序错乱分割的问题 ([#11159](https://github.com/getpaseo/paseo/pull/11159))
- 修复包含未关联标题或模型变更元数据的 Pi 对话历史打开为空的问题 ([#11379](https://github.com/getpaseo/paseo/pull/11379))
- 修复在轮次进行中发送 Pi 扩展斜杠命令会中止当前回复的问题 ([#11341](https://github.com/getpaseo/paseo/pull/11341),贡献者:[@tridao](https://github.com/tridao))
- 修复被拒绝的 Pi 历史读取或回退扩展提示导致 daemon 工作进程崩溃的问题 ([#11329](https://github.com/getpaseo/paseo/pull/11329),贡献者:[@thomasvan](https://github.com/thomasvan))
- 修复已完成的 Pi Tintinweb 后台子 Agent 仍一直显示为运行中的问题 ([#11168](https://github.com/getpaseo/paseo/pull/11168),贡献者:[@amcfague](https://github.com/amcfague))
- 修复后台 OMP 目录刷新触发被取消的启动模型请求的问题 ([#11129](https://github.com/getpaseo/paseo/pull/11129),贡献者:[@mcowger](https://github.com/mcowger))
- 修复 OMP 轮次在持续流式输出或等待提问卡片超过十分钟后超时失败的问题 ([#11079](https://github.com/getpaseo/paseo/pull/11079),贡献者:[@LiebeLee](https://github.com/LiebeLee))
- 修复 Antigravity 延迟轮次在发出中间回复后,最后一个后台工具完成时提前结束轮次的问题 ([#10924](https://github.com/getpaseo/paseo/pull/10924),贡献者:[@Juns-g](https://github.com/Juns-g))
- 修复停止无响应的 ACP Agent 后,后续提示词一直卡在活跃前台轮次之后的问题 ([#11152](https://github.com/getpaseo/paseo/pull/11152))
- 修复恢复的 Muse 会话丢失 daemon 和插件系统指令的问题 ([#10915](https://github.com/getpaseo/paseo/pull/10915),贡献者:[@Tomblarom](https://github.com/Tomblarom))
- 修复监听 Unix 套接字、命名管道、非回环地址或处于 HTTP 代理后的 daemon 丢失内置 Paseo MCP 工具注入和终端活动上报的问题 ([#11144](https://github.com/getpaseo/paseo/pull/11144))
- 修复重复重启 daemon 在临时目录中不断复制 Provider 图片附件的问题 ([#7895](https://github.com/getpaseo/paseo/pull/7895),贡献者:[@cleiter](https://github.com/cleiter))
- 修复并发重载同一个 Agent 时返回“Unknown agent”错误的问题 ([#8369](https://github.com/getpaseo/paseo/pull/8369),贡献者:[@tieo](https://github.com/tieo))
- 修复 `paseo agent logs --tail` 在超长对话历史上超时的问题 ([#10723](https://github.com/getpaseo/paseo/pull/10723),贡献者:[@minamorl](https://github.com/minamorl))
- 修复 `paseo agent logs` 在 daemon 请求超时后挂起不退出的问题 ([#11360](https://github.com/getpaseo/paseo/pull/11360))
- 修复 `paseo permit ls` 遗漏后台 Agent 以及前 200 个之后 Agent 的待处理权限的问题 ([#10655](https://github.com/getpaseo/paseo/pull/10655),贡献者:[@NightMachinery](https://github.com/NightMachinery))
- 修复 `paseo --host host:port` 遇到 HTTP 400 时只提示检查凭据而未建议对 TLS 端点使用 `wss://` 的问题 ([#11383](https://github.com/getpaseo/paseo/pull/11383))
### 插件
- 为 Paseo MCP 和 `PluginWorkspaceSnapshot` 新增 `update_workspace` 和工作区 `metadata` 支持 ([#11166](https://github.com/getpaseo/paseo/pull/11166))
- 修复依赖的类型声明导入 Node 环境类型时服务端插件编译失败的问题 ([#8618](https://github.com/getpaseo/paseo/pull/8618),贡献者:[@nkwib](https://github.com/nkwib))
## 0.18.1 - 2026-11-27
- **主机元数据指令**:设置一次主机级指令,即可统一控制自动生成的工作区标题、分支名、提交信息和 PR 的语言、语气与格式。([#11064](https://github.com/getpaseo/paseo/pull/11064))
+1
View File
@@ -55,6 +55,7 @@ At the start of non-trivial work, list `docs/` and skim anything relevant to the
| [docs/permissions.md](docs/permissions.md) | Semantic daemon permissions, principals, credentials, pairing invitations, and Hub authority |
| [docs/terminal-performance.md](docs/terminal-performance.md) | Terminal latency pipeline, coalescing/backpressure invariants, benchmark + perf spec usage |
| [docs/terminal-rendering.md](docs/terminal-rendering.md) | Native terminal view: xterm owns the grid, cluster placement, emoji widths, mixed-direction limits, render regression |
| [docs/timeline-sync.md](docs/timeline-sync.md) | Owned agent history, rewind retirements, live stream vs authoritative fetch, paged catch-up, client replica |
| [docs/agent-stream-performance.md](docs/agent-stream-performance.md) | Assistant text pipeline — coalescing window, paced reveal, why arrival lumps are smoothed at render |
| [docs/agent-stream-disclosure.md](docs/agent-stream-disclosure.md) | Expand/collapse in the chat timeline — hold contract, native anchor sequence, frame spacing, render-window cost |
| [docs/markdown-renderer.md](docs/markdown-renderer.md) | Shared Markdown engine, the vendored library fork, native selection, links, images and library constraints |
+83 -16
View File
@@ -39,8 +39,8 @@ An unarchived agent may be `closed` without being deleted or archived. Closing r
processes and subscriptions while retaining its Paseo identity, persistence handle, timeline,
workspace, labels, title, usage, attention, timestamps, and parent relationship. Opening or prompting
the agent runs through `ensureAgentLoaded()`, which resumes the durable provider session under the
same Paseo agent ID. Provider history is not appended again when the canonical timeline is already
primed.
same Paseo agent ID. Resume does not read provider history when the agent already has a timeline;
see [owned history](timeline-sync.md#owned-history).
Reload releases the old runtime before resuming its durable session: an idle provider process can
still own an exclusive writer. A close failure retains that runtime for cleanup and blocks the
@@ -152,7 +152,7 @@ Users can also detach an existing subagent from the subagents track. Detach is d
`notifyOnFinish` defaults to `true` for agent-scoped creation and prompt follow-ups because most delegated work needs to report back to the creating agent. Set it to `false` for explicit reporting or no completion callback.
Agent-originated messages and automatic notifications share a recipient-daemon delivery module. A queued receipt acknowledges admission before provider dispatch. The module keeps one ordered queue per recipient, and the recipient reads its prompts in the order the daemon admitted them. Nothing overtakes an older queued message. A prompt takes its place when the daemon admits it, even while the provider is still starting an earlier turn, and a message stays in the queue until the turn that carries it starts. The turn has started when the agent manager acknowledges the run start; a turn that fails after that point is not delivered again.
Agent-originated messages and automatic notifications share a recipient-daemon delivery module. The daemon saves a queued message, then acknowledges it with a receipt, before provider dispatch. The module keeps one ordered queue per recipient, and the recipient reads its prompts in the order the daemon admitted them. Nothing overtakes an older queued message. A prompt takes its place when the daemon admits it, even while the provider is still starting an earlier turn, and a message stays in the queue until the turn that carries it starts. The turn has started when the agent manager acknowledges the run start; a turn that fails after that point is not delivered again.
Any sender picks `queue`, `steer`, or `interrupt` with `activeTurnBehavior`. Agent senders default to `queue`; non-agent senders (app, CLI, plugins, Hub, top-level MCP) default to `interrupt`. Each kind of prompt is released this way:
@@ -170,33 +170,64 @@ A command the provider accepts out of band is the one exception to admission ord
One provider prompt has one session mode. A batch released by a steer, an interrupt, or a person's prompt uses the latest explicit choice in it, the person's own first. Queued messages with conflicting choices keep separate ordered dispatches.
The pending message window is in memory. Clean shutdown flushes it, held messages included, before
closing agents; an abrupt crash can lose queued prompts. A durable send receipt remains pending until actual dispatch
acknowledgment, so a lost window never becomes a completed receipt. Completion waits cover queued
admission within their original timeout and cancellation scope, and return at permission
checkpoints and when a Stop holds the queue.
A provider switch can wait in the queue too (`agent.provider.switch.request` with
`activeTurnBehavior: "queue"`). The message carries the target provider and settings, shares a prompt
with nothing, and divides the queue: what is ahead of it goes to the current provider, and it and
what follows go to the target. A direct prompt therefore takes along only the queued rows ahead of
the switch. Promoting the switch cuts the running turn once the target is known to be usable. A chat
already on the target takes the message and its settings as a plain prompt. A switch that fails keeps
the message and holds the queue; the reason is in the daemon log.
The queue is saved in `$PASEO_HOME/agent-queues/` ([data model](data-model.md#directory-layout)),
and a message is saved before its receipt is sent. Inline images are first saved as uploads, so the
queue file holds references. An empty message is refused, and a recipient holds at most 100
messages.
A message is marked `dispatching` before the provider can receive it and removed when the provider
admits it. A dispatch that is not admitted returns the message to its place. A refused turn start
also holds the queue: retrying by itself would be refused again and would add the prompt to the
history each time. A message that cannot be sent is removed so that it does not block the ones
behind it.
Shutdown does not send the queue. It waits only for dispatches already in flight, and everything
else stays saved, held messages included. Closing an idle runtime keeps the queue. Archiving or
deleting the agent clears it.
Bootstrap restores queues before restart recovery resumes agents, and before finish subscriptions,
change-request watches, and ingress start. A held queue stays held. Other queues are sent, after the
resume prompt for an agent that restart recovery resumes. A crash can leave a message marked
`dispatching`, so the daemon looks for it in the recipient's history: a message found there is
removed, and one not found, or whose history cannot be read, is sent again.
A client that retries a queued message with the same `messageId` is acknowledged again at once. The
completed send receipt is written after dispatch, and a different request under that `messageId`
conflicts. Completion waits cover queued admission within their original timeout and cancellation
scope, and return at permission checkpoints and when the queue is held.
Finish notification intent has a separate daemon-owned lifetime. The finish-subscriptions module
persists caller, child, host, and ownership policy through an injectable store; its JSON adapter uses
`$PASEO_HOME/finish-subscriptions.json`. Registration must commit before creation or queued-prompt
acknowledgment promises a notification. A pending replacement retains its predecessor until dispatch
accepts; rejected dispatch removes only the candidate. Recovery coalesces registrations for the same
caller, child, and host into one watch.
accepts; rejected dispatch removes only the candidate. The record keeps the prompt's `messageId`, so
withdrawing that message removes the subscription, also after a restart. Recovery coalesces
registrations for the same caller, child, and host into one watch.
Bootstrap restores these watches after repairing stale running records to `closed` and before opening
ingress. Reading a closed child's result does not load its provider. A finish notification reports that
the child has settled (see below); the parent decides whether its task is complete. A child chosen for restart
recovery is observed only after its resume was sent, so the parent never hears that it was closed
in between. Archived or deleted parents suppress delivery;
in between. A subscription whose prompt is still queued stays pending until that prompt is
dispatched, so a held follow-up reports nothing. Archived or deleted parents suppress delivery;
parent-owned creation watches also stop
reporting after detachment.
Intent remains stored until the parent's notification dispatch is acknowledged. Dispatch failure
retries the captured notification; it does not change the child's reported outcome. Remote host loss
follows the [connected-host observation policy](connected-hosts.md#delegating-agents). Shutdown stops observation before flushing message delivery, retaining
outstanding intent. A crash after successful dispatch but before removal commits can repeat the
notification. Clean shutdown can also flush an already queued callback while retaining its intent,
so that callback can repeat after restart. This is an at-least-once wakeup, without turn attribution or exactly-once delivery.
follows the [connected-host observation policy](connected-hosts.md#delegating-agents). Shutdown stops
observation and retains outstanding intent. A final or permission notice has an id derived from its
subscription, so observing the same outcome again while the notice is queued adds nothing. A crash
after successful dispatch but before removal commits can repeat the notification. This is an
at-least-once wakeup, without turn attribution or exactly-once delivery.
A turn end is not always a settled child. A child can end its turn with work that will start its next
turn by itself: a running turn, queued messages, a pending provider wake-up
@@ -277,7 +308,8 @@ lifecycle is separate from public workspace visibility and is not a public creat
Archive is a **soft delete**: the agent record stays on disk with `archivedAt` set, the runtime is closed, and the agent disappears from active lists. Archive is **global** — it lives on the server and propagates to every connected client.
Archive sets `archivedAt`, invokes the provider's native archive hook, and cascades to managed
children.
children. The timeline and the provider children stay, so an archived chat reads them without its
provider; deleting the agent removes them.
`create_agent_request` can opt an agent into `autoArchive`. In that mode the daemon archives the agent after the first terminal turn event (`turn_completed`, `turn_failed`, or `turn_canceled`). When the agent owns an isolated workspace, auto-archive archives that workspace too; the managed worktree is removed when its final workspace reference is gone.
@@ -373,6 +405,8 @@ Workspace status is an aggregate activity signal computed **per `workspaceId`**.
Running provider-native subagents contribute `running` to the workspace owned by their parent agent. Their completed, failed, and canceled states stay in the parent's subagents track.
Only the parent's current runtime makes a provider child running. A child's stored status is the last report about it, and that report can come from provider history or from a runtime an earlier daemon ran, so a stored `running` child does not make the workspace running or keep the parent's runtime alive. It counts again once the live session reports it running. Closing a runtime cancels the children that runtime reported running; children it never reported keep their stored status.
A finished or failed workspace can be marked unread after it has been reviewed. The daemon restores
attention on its newest eligible workspace-root agent, `error` for an agent whose lifecycle is
`error` and `finished` otherwise, without sending a new notification. Opening a workspace restores
@@ -394,6 +428,39 @@ that leaves the lifecycle at `error`, and replaces unread `finished` attention;
agent would show the green dot or none. Subagents track marks are the exception: they follow the
child's lifecycle, because the track is where a failed child stays visible.
## The queue track
The queue track is the list above the composer of the messages the host holds for the open agent
(`packages/app/src/composer/queue/`). One list covers every sender, in the order the host sends
them: your queued prompts, agent messages, finish notifications, and change-request updates.
The host owns the [queue](#relationships) and the app keeps no copy of it. `packages/app/src/agent-queue/`
reads the list on mount and after each reconnect, and replaces it on each `agent.queue.update`. A
queued message therefore survives a reload, is sent with every client closed, and shows on every
client that views the agent. Files upload to the host before the message is queued, so any device
can open a row's attachments.
Rows take these commands:
- **Send now** promotes the row with your send behavior setting: `steer`, otherwise `interrupt`.
- **Edit** is offered on your own messages only. It withdraws the row, then replaces the composer
draft with its text and attachments, and stages the row's provider switch again. If the host
already started sending the row, the draft stays as it is.
- **Cancel** withdraws the row.
A message you send directly (`steer` or `interrupt`) takes the queued rows with it, ahead of your
text.
A message sent mid-turn with a staged provider switch is queued whatever the send behavior, and its
row names the target.
A row the host is `dispatching` takes no command. A held queue shows a paused notice. The notice
does not name Stop, because a refused turn start holds the queue too.
A host without `server_info.features.agentMessageQueue` has no queue track. The composer offers no
Queue action there, and a `queue` send behavior sends as `steer`, so it does not cut the running
turn.
## The subagents track
The track is a pill at the foot of an agent's pane (`packages/app/src/subagents/track.tsx`): a count you can read at a glance, and a panel behind it — a popover on wide screens, a sheet on compact ones — holding the rows. It floats over the transcript rather than sitting in a band above the composer, so the timeline scrolls underneath it; `packages/app/src/panels/agent-tracks.tsx` owns that placement, and the pill frame is shared with the task list in `packages/app/src/composer/tracks.tsx`.
+3 -1
View File
@@ -94,6 +94,7 @@ workspace for a directory clears it. The store lives in memory and resets on dae
| `server/directory-sync/` | Daemon-global latest-state sequences for projects, workspaces, and agents |
| `server/workspace-labels/` | Host-local label catalog, assignment mutations, and explicit subscriptions |
| `server/agent/agent-manager.ts` | Agent lifecycle state machine, timeline tracking, subscriber management |
| `server/agent/timeline/` | Owned agent history, provider children, rewind retirements, behind a backend |
| `server/agent/agent-storage.ts` | File-backed JSON persistence at `$PASEO_HOME/agents/` |
| `server/agent/tools/` | Transport-neutral catalog for workspaces, agents, permissions, and automation |
| `server/agent/mcp-server.ts` | Thin MCP adapter that registers the Paseo tool catalog with the MCP SDK |
@@ -402,7 +403,7 @@ initializing → idle ⇄ running
client-side dedup; the default fetch page is 200 items.
- Timeline row `timestamp` values are canonical daemon-owned timestamps. Providers may supply original replay timestamps, but clients must not guess timestamp trust or hide time UI based on local clock heuristics.
- Events stream to connected clients in real time; correctness is backed by authoritative timeline fetches and paged-to-completion catch-up.
- Agent state persists to `$PASEO_HOME/agents/{cwd-with-dashes}/{agent-id}.json`. Timeline rows are runtime memory; provider history is the durable transcript authority and resumed agents rebuild from it. That storage path is derived from `cwd`, not from workspace id.
- Agent state persists to `$PASEO_HOME/agents/{cwd-with-dashes}/{agent-id}.json`. That storage path is derived from `cwd`, not from workspace id. Timeline rows persist in the daemon database, `$PASEO_HOME/paseo.db`. They are the transcript authority after the first import of provider history. See [owned history](timeline-sync.md#owned-history).
## Right-sidebar boundary: directory-backed vs workspace-owned
@@ -478,6 +479,7 @@ Providers that can accept native tool definitions should set `supportsNativePase
```
$PASEO_HOME/
├── agents/{cwd-with-dashes}/{agent-id}.json # Agent record
├── paseo.db # Daemon database (SQLite): agent timelines
├── projects/projects.json # Project registry
├── projects/workspaces.json # Workspace registry
├── projects/icons/ # Custom project icon images
+44 -1
View File
@@ -34,7 +34,7 @@ Workspace archive runs lifecycle teardown from the exact `cwd` but removes only
`worktreeRoot` after its last active reference disappears. Worktree recovery recreates that backing
checkout from `mainRepoRoot`, then restores the relative path from `worktreeRoot` to `cwd`.
Paseo uses **file-based JSON persistence** instead of a traditional database. All data is validated at runtime with Zod schemas. Most stores write atomically (write to temp file, then rename); a few still use plain `writeFile` — see each section. There is no schema-versioning/migration framework — schemas rely on optional fields with defaults for forward compatibility, with a small amount of inline normalization in `persisted-config.ts` for legacy provider/speech entries.
Paseo persists most stores as JSON files, and agent timelines in the [daemon database](#daemon-database). JSON data is validated at runtime with Zod schemas. Most JSON stores write atomically (write to temp file, then rename); a few still use plain `writeFile` — see each section. JSON stores have no schema-versioning/migration framework — schemas rely on optional fields with defaults for forward compatibility, with a small amount of inline normalization in `persisted-config.ts` for legacy provider/speech entries.
All server-side stores live under `$PASEO_HOME` (defaults to `~/.paseo`).
@@ -53,12 +53,16 @@ $PASEO_HOME/
├── daemon-keypair.json # E2EE keypair for relay (mode 0600)
├── paseo.pid # Daemon PID lock file
├── local-credential # Per-run local client credential (mode 0600)
├── paseo.db # Daemon database (SQLite, with -wal and -shm files)
├── daemon.log # Default log file (path configurable)
├── agents/
│ └── {sanitized-cwd}/
│ └── {agentId}.json # One file per agent
├── schedules/
│ └── {scheduleId}.json # One file per schedule
├── agent-queues/
│ ├── {agentId}.json # Undelivered messages for one agent; removed when empty
│ └── {agentId}.json.corrupt.{ms} # Unreadable queue file, set aside at startup
├── projects/
│ ├── projects.json # Project registry
│ ├── workspaces.json # Workspace registry
@@ -181,6 +185,45 @@ Terminal activity contributes to the workspace status bucket **per `workspaceId`
---
## Daemon database
`$PASEO_HOME/paseo.db` is one SQLite file that the daemon opens at startup with `node:sqlite`
(`packages/server/src/server/database/`). Agent timelines are its only store today. Each store is a
`SchemaModule`: its own table-name prefix and an append-only list of migrations.
- **Migrations.** Startup runs every module's pending migrations in one transaction, so a failed
migration leaves the file as it was. `schema_versions` records each module's version and
`min_reader_version`. Mark a migration `breaking` when an older daemon cannot read the result,
for example a dropped or renamed column. An older daemon then refuses to start with
`DatabaseSchemaTooNewError`. Additive migrations leave older daemons working, and they ignore
modules they do not know. This matters because the app and the daemon update separately, and a
user can run an older daemon on the same `$PASEO_HOME`.
- **Failure.** A file that SQLite cannot open stops the daemon with `DatabaseOpenError`, which
names the path. The daemon does not delete or recreate the file.
- **Access.** The file holds every prompt and reply, so the daemon sets it and its `-wal` and `-shm`
files to mode `0600` on every open. SQLite gives the WAL files it creates the mode of the database
file.
- **Durability.** The database uses WAL with `synchronous = NORMAL`. A power loss can drop the
last commits but does not corrupt the file.
- **Checkpoints.** A checkpoint syncs the file to disk and takes up to 100 ms. SQLite's
auto-checkpoint runs it on the committing thread, which stalled the event loop during streaming.
The daemon turns it off and checkpoints from a worker thread with its own connection. If the
worker exits, the daemon turns auto-checkpoint back on.
- **Transactions.** `write` and `read` callbacks are synchronous, so a transaction never spans an
`await` and transactions never interleave.
- **Node.** `node:sqlite` needs Node 22.16 or later. Node 22 prints an experimental warning once,
when the daemon opens the database.
### Agent timelines
`AgentTimeline` owns each agent's history, and its SQLite backend stores the projected rows, the
source ranges, retirements, the open rewind, and provider children in `timeline_*` tables. The text
of a streamed assistant or reasoning message is stored as one chunk per source event, beside its
row, so a chunk never rewrites the message. An earlier file store rewrote the whole transcript on
every update. See [owned history](timeline-sync.md#owned-history).
---
## 2. Daemon Configuration
**Path:** `$PASEO_HOME/config.json`
+1 -1
View File
@@ -136,7 +136,7 @@ Cards inside a section sit closer than sections. Rows inside a card touch — on
Rows have generous vertical padding: roughly 16px of content plus 16px of vertical padding for settings rows, 8–12px for sidebar list items where many rows must fit. Every row is at least as tall as one holding a switch, so text rows, switch rows and rows that open something (`<SettingsDetailRow>`, a collapsible row's header) line up. A row holding a button or a select is taller. Compressing rows below the established density to fit more on the screen is wrong. Too many rows means more cards or more sections, not smaller rows.
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `sm` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand. Settings rows that share a menu surface with menu rows, such as Usage's options, go inside `<MenuSettingsRows>`, which puts their labels on the menu rows' label rail (`menuRowContentInset`).
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `sm` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand. Settings rows that share a menu surface with menu rows, such as Usage's options, go inside `<MenuSettingsRows>`, which puts their labels on the menu rows' label rail (`menuRowContentInset`). Settings rows that share a sheet with list rows, such as Agent settings with its radio choices and section headers, go inside `<ListSettingsRows>`, which makes every row one touch target tall so Model, switch and radio rows line up.
The whitespace is the design.
+2
View File
@@ -523,6 +523,8 @@ Measured bundle size for a standard Expo web export:
- gzip: 2.55 MiB
- brotli: 1.93 MiB
`npm run build:desktop` runs the same `scripts/precompress-assets.mjs` over `packages/app/dist` before electron-builder copies it to `app-dist`, so the desktop-served UI also gets `.br`/`.gz` siblings.
The desktop-managed daemon disables the bundled web UI by default (`PASEO_WEB_UI_ENABLED=false`) because the desktop app already ships the renderer as `app-dist`. Shipping the same assets again inside `@getpaseo/server` would duplicate the ~10.8 MiB install. Desktop packaging also excludes `node_modules/@getpaseo/server/dist/server/web-ui/**` from the packaged app.
## Built workspace packages
+4
View File
@@ -36,6 +36,10 @@ ordinary `WorkspaceTab` (`SheetTab` in the store) and is an `IsolatedBottomSheet
other sheet in the app, so it sits on the one app-wide stack: a sheet opened from any sheet lands on
top of it, and closing the top sheet (drag, Close, backdrop, or Android Back) uncovers the one below.
Because that stack is app-wide and hidden workspace screens stay mounted, a sheet is not presented
until its workspace has been on screen. A target opened in a workspace before the user gets there
waits in the store and appears on arrival.
A subagent chosen from the subagents list is the exception. It opens as a page of the list's own
sheet and replaces the list in place: Back returns to the list, Close ends both, and Open parent
closes the list, landing on the pane the list was opened from. The store's `selectSheetTab` describes
+36 -15
View File
@@ -194,9 +194,23 @@ signal because the stock iOS Reanimated value changes at move start, while
writing a replacement Reanimated value every frame interrupts UIKit's hide
animation. Keep this platform choice inside the keyboard module's private platform-specific translate files.
`ComposerDock` always keeps the surface at full height and wraps it in
`KeyboardTranslateView`. The panel root clips it at the header edge, so rows
slide under the header on open and out from under it on close. Do not swap the
On iOS the native driver and Fabric both write the view's transform, and
nothing orders a driver update with a mount. The translate view therefore
commits where it rests as a React prop. Fabric paints a driven view's committed
transform when it creates or resizes the view, in the same mount as the layout,
and the driver follows a frame later. Change `enabled` on the translate view
that the change resizes. Without a resize the old lift stays on screen until the
driver catches up, and a mode sent to the driver from the commit can paint over
the old layout: either way one frame draws the new layout at the old lift.
`ComposerDock` keeps the surface at full height and moves it with two
`KeyboardTranslateView`s on the same translation: one holds the content, one
holds the composer slot. Only the slot changes mode for fullscreen, and
fullscreen resizes it on every screen. Do not put the mode on one view around
both: that view resizes on New workspace, which drops its header, and not in a
chat, so the two screens land the toggle differently. The panel root clips the
surface at the header edge, so rows slide under the header on open and out from
under it on close. Do not swap the
dock to keyboard padding at rest. Changing its height creates either a blank
band or a paused transition when the stream list updates its viewport.
@@ -231,7 +245,7 @@ instead of expanding on close and shrinking again on open.
Fullscreen is a layout mode of the dock, not a second editor. `ComposerDock
fullscreen` fills the stationary viewport with the composer slot over the
still-mounted content, paints its own surface under the safe areas, and turns
the surface translation off. The composer's single tree keeps the editing
the slot's translation off. The content behind it keeps riding the keyboard. The composer's single tree keeps the editing
surface at the same position in both modes, so the mounted editor, its native
buffer, selection, and focus survive the toggle and Send's clear always reaches
the live input. A viewport crossing the compact breakpoint still remounts it:
@@ -278,8 +292,8 @@ for header clearance, but reserves the composer's own capped height before
shrinking the setup scroll view. The form must not take editing space from the
composer.
Move the stream and composer together through `ComposerDock`. Do not translate
them independently.
Move the stream and composer through `ComposerDock`, which gives both the same
translation. Do not translate either from outside the dock.
`KeyboardShiftProvider` owns the normalized shift used for settled insets and
portal geometry, plus the `isMoving` worklet value. It reconciles native
@@ -302,9 +316,9 @@ translation scope is React context and does not cross it (Gotcha 7). It returns:
Do not measure an anchor with `measureInWindow` and correct it by the keyboard
shift. On iOS the translate view uses the native driver, which moves the view
without updating the shadow tree. The translate view commits the resting lift to
the shadow tree once the keyboard settles, so `measureInWindow` includes the lift
at rest and misses it while the keyboard moves. Any correction double-lifts the
without updating the shadow tree. The translate view commits the lift the
keyboard is at or moving to, so `measureInWindow` includes the lift at rest and
runs ahead of the view while the keyboard moves. Any correction double-lifts the
popover or leaves it behind the keyboard. `measureAtRest` measures through
Fabric's transform-free `measureLayout` instead. Re-measure when `isMoving`
settles; the composer's resting position changes as the draft grows.
@@ -316,8 +330,8 @@ the anchor's rect against the layer and commits the placement with `flushSync`,
which runs after layout and before paint. On native a Reanimated frame callback
reads only the anchor's height on the UI thread and holds its bottom edge at
the rest measurement. A height carries no transform. On iOS the absolute
position does not include one while the keyboard moves: the lift runs on the
native driver and reaches the shadow tree only at rest. The
position does not follow the keyboard while it moves: the lift runs on the
native driver, and the shadow tree holds only where the keyboard is going. The
fixed-bottom model is wrong for the centered New workspace composer on tablets,
which grows around its middle, and for width or x changes. The popover is off
there by half the growth, or by the old width, until the next rest measurement.
@@ -433,10 +447,17 @@ wide layouts keep local geometry. That export is
what `patches/@gorhom+bottom-sheet+*.patch` adds.
A sheet whose owner may veto the close (unsaved work) passes `enableDismissOnClose={false}`. Every
close path then parks the sheet at index -1 with its content mounted; the owner hears
`onChange(-1)`, runs its guard, and either snaps back to 0 or drops its state, which unmounts the
sheet and takes it off the stack. Calling `dismiss()` on such a sheet bypasses the guard and
unmounts it, so its backdrop and Back press call `close()`.
close path then parks the sheet at index -1 with its content mounted; the owner runs its guard and
either snaps back to 0 or drops its state, which unmounts the sheet and takes it off the stack.
Calling `dismiss()` on such a sheet bypasses the guard and unmounts it, so its backdrop and Back
press call `close()`.
Run that guard from the wrapper's `onClosed`. Gorhom only calls `onChange` when a close ends at a
different index than the one it already recorded, and an interrupted mount animation leaves that
record at -1, so the close that follows is invisible: the sheet parks with its backdrop still over
the app, and every tap in the covered area is lost. `onClosed` watches the close animation settle at
the closed detent and reports it either way. Keeping `onChange` as well is harmless as long as the
guard is idempotent.
The wrapper must give Gorhom an object ref. Gorhom accepts a callback ref at the React boundary
but stores it in the modal queue and later reads `.current`; provider dismissal, replacement,
+3
View File
@@ -47,6 +47,9 @@ The component renders state and dispatches intent. That is all it does.
4. **Resolution is explicit model state, per host** (`idle | pending |
complete`), keyed off the opened snapshot's serverId. Waiting for data is a
state you can render, not an effect race.
Create-agent model preferences are shared across hosts, so resolve remembered
models against the selected host's ready catalog before applying them. Keep
explicit initial values and user selections intact.
5. **Displays are owned state.** The selected option's label is captured at
selection/seed time (`setProject(value, display)`), never re-derived from a
live options list — list churn must not flicker or blank a selection.
+2 -2
View File
@@ -57,8 +57,8 @@ Authoritative terminology. UI label wins. Don't invent synonyms; use what's here
- **Composer toolbar** — The bottom control row inside the composer input. Contains agent controls, attachment button, voice controls, and stop/send controls. Code: `leftContent`, `beforeVoiceContent`, and `rightContent` slots in `MessageInput` (`packages/app/src/composer/input/input.tsx`). Forbidden: "Status bar".
- **Agent controls** — Provider, model, mode, thinking, and provider-feature controls for an agent or draft agent. Code: `AgentControls` / `DraftAgentControls` (`packages/app/src/composer/agent-controls/index.tsx`). Forbidden: "Agent status bar".
- **Composer footer** — Optional area rendered below the composer input but still inside the keyboard-shifted composer layout. Code: `Composer.footer` (`packages/app/src/composer/index.tsx`).
- **Composer track** — A contextual lane at the foot of a pane, by the composer input. Specific tracks use the `<thing> track` form: **Queue track**, **Subagents track**, **Tasks track**. The subagents and tasks tracks are pills floating over the transcript, each opening a panel with its rows; the queue track is a lane inside the composer itself. Code: queue track inside `Composer` (`packages/app/src/composer/index.tsx`), pill and panel frame in `packages/app/src/composer/tracks.tsx`, `SubagentsTrack` (`packages/app/src/subagents/track.tsx`), `AgentTaskList` (`packages/app/src/composer/task-list/index.tsx`).
- **Steer** — A follow-up admitted into an agent's already-running turn instead of interrupting it. Interrupting the turn discards steers the provider has not read yet; there is no take-back short of that, and no provider offers one. The stop button and Escape both interrupt. A steer the provider never read keeps its transcript row, matching Codex. Sending while the agent waits on a permission denies that request first, so the message reaches the same turn instead of stalling behind it. UI: "Send and steer". Code: `steerActiveTurn` (`packages/server/src/server/agent/agent-sdk-types.ts`). Don't confuse with **Queue track**, which holds messages client-side until the turn ends and never enters the running turn. An agent sender's `activeTurnBehavior: "steer"` (CLI `--behavior steer`) means the same as a person's steer. Agent senders default to `queue` instead: the daemon holds the message until the running turn ends, as the queue track does for a person. Forbidden: "Delivery", "Queued prompt".
- **Composer track** — A contextual lane at the foot of a pane, by the composer input. Specific tracks use the `<thing> track` form: **Queue track**, **Subagents track**, **Tasks track**. The subagents and tasks tracks are pills floating over the transcript, each opening a panel with its rows; the [queue track](agent-lifecycle.md#the-queue-track) is a lane inside the composer itself. Code: `ComposerQueueTrack` (`packages/app/src/composer/queue/track.tsx`), pill and panel frame in `packages/app/src/composer/tracks.tsx`, `SubagentsTrack` (`packages/app/src/subagents/track.tsx`), `AgentTaskList` (`packages/app/src/composer/task-list/index.tsx`).
- **Steer** — A follow-up admitted into an agent's already-running turn instead of interrupting it. Interrupting the turn discards steers the provider has not read yet; there is no take-back short of that, and no provider offers one. The stop button and Escape both interrupt. A steer the provider never read keeps its transcript row, matching Codex. Sending while the agent waits on a permission denies that request first, so the message reaches the same turn instead of stalling behind it. UI: "Send and steer". Code: `steerActiveTurn` (`packages/server/src/server/agent/agent-sdk-types.ts`). Don't confuse with **Queue track**, which lists the messages the host holds until the turn ends. A queued message does not enter the running turn. An agent sender's `activeTurnBehavior: "steer"` (CLI `--behavior steer`) means the same as a person's steer. Agent senders default to `queue` instead: the daemon holds the message until the running turn ends, as it does for a person's queued message. Forbidden: "Delivery", "Queued prompt".
- **Subagent** — User-facing term for an agent session related to a parent agent session. Use **subagents** in UI copy and docs. Internal daemon/provider plumbing may say "child agent" or `child_session`, especially for provider-managed imports; do not surface "child agent" as a product term.
- **Attachment tray** — The selected-attachments row inside the composer input, above the text input. Code: `renderAttachmentTray` (`packages/app/src/composer/index.tsx`). Forbidden: "Attachment bar".
- **Fork** — Starting a NEW agent session seeded with a copy of another session's curated chat history. The history rides along as a `chat_history` composer attachment on a draft; the fork does **not** resume or branch the provider-side session, and the source session keeps running untouched. Two targets, one surface, one RPC (`agent.fork_context`, gated on the `agentForkContext` host feature). UI: the fork menu lives in the assistant turn footer and offers "Fork in a new tab" / "Fork in a new workspace". On a **completed** turn it sits beside the copy button and pins a boundary to that turn, so the fork stops where the turn ended. On the **in-flight** turn it sits beside the progress loader and elapsed timer, and omits the boundary entirely — `selectForkContextRows` projects the whole timeline when no boundary is given, so the fork captures everything **up to now**, including the response still streaming. That omission is what makes mid-run forking work; pinning a boundary there would silently drop the live response. Forbidden on provider-subagent (read-only) panes. Code: `useForkAgent` (`packages/app/src/hooks/use-fork-agent.ts`), `selectForkContextRows` (`packages/server/src/server/agent/activity-curator.ts`). Don't confuse with: git fork (unrelated; Paseo has no such concept), **Worktree** (filesystem isolation, not history copying).
+9 -1
View File
@@ -130,7 +130,15 @@ under an eight-line draft, selection with the keyboard shown and hidden, and
file mentions. Set `_SCENARIO=controls` to tap the attach button and the model
selector with a 3pt drag while the keyboard is open, then check that a wide
layout's model popover clears both the trigger and the keyboard. Run it on an
iPhone and on the iPhone Duo unfolded. These scenarios only need `_SERVER_ID` and `_WORKSPACE_ID`;
iPhone and on the iPhone Duo unfolded. Set `_SCENARIO=fullscreen` to toggle an
eight-line draft in and out of fullscreen with the keyboard open, on a workspace
draft tab and on New workspace. Every toggle must keep the keyboard, fullscreen
must cover the screen behind the keyboard with Send above it, and exit must
return the composer to its resting place. It then records the screen through
eight toggles and fails if any frame draws Send anywhere but its inline or its
fullscreen place; snapshots are a second apart and cannot see one wrong frame.
The recording needs `ffmpeg` on the PATH and reads the booted simulator unless
`_UDID` is set. These scenarios only need `_SERVER_ID` and `_WORKSPACE_ID`;
`_UDID` selects an exact simulator and `_ARTIFACTS_DIR` overrides the output path.
The Android sidebar scroll-retention flow requires a connected host with enough
+6 -2
View File
@@ -267,6 +267,10 @@ Plugin UI runs on desktop and mobile across multiple themes: color every `Text`
`theme.colors.foreground` or `theme.colors.foregroundMuted`, and size layout from `layout.compact`.
See `public-docs/plugins/reference.md`.
A plugin reads and arranges panes and tabs through `PluginWorkspaceLayout`. Its host,
`packages/app/src/plugins/workspace-layout/`, is a facade over the layout store and `workspace-tabs`,
so add behavior to those owners and keep layout mechanics out of the SDK types.
### SDK import boundaries
Classify every SDK export before adding it. All client entry points and implementations live under
@@ -1018,8 +1022,8 @@ payload that cannot be rendered intact. The daemon advertises this RPC through
`addSlashCommand` registers an agent- or workspace-context command in the composer. The
callback runs in the app, receives the trimmed text after the command name as `args`, and receives
the same `paseo`, `rpc`, `openScreen`, workspace, agent, and `openPanel` capabilities as the matching
Command Center callback.
the same `paseo`, `rpc`, `openScreen`, workspace, agent, and `workspaceLayout` capabilities as the
matching Command Center callback.
```ts
client.addSlashCommand({
+10
View File
@@ -724,3 +724,13 @@ Tests use `isProviderAvailable(provider)` to skip when the binary or credentials
- Gate the operations **the daemon issues** (prompt, slash command, summarize) on both the terminal and cancel settlement. Permission and question responses are not runner operations and must stay outside the gate, or an auto-approve deadlocks the stop. Runs the _provider_ starts on its own — plugin or autonomous wakes — are observed, not gated: the daemon does not choose when they begin, and holding their events back does not protect them from a cancel already in flight, it only hides a run that may already be dead.
- Fail closed: if the cancel never succeeded you never proved the run stopped, so refuse new runs until the next Stop issues a fresh cancel. `AgentManager` already turns a rejected `interrupt()` into a refused cancel.
- Suppress the canceled run's residue only until its authoritative terminal. Anything the provider publishes after that terminal is a new run by construction and must take the normal live path — buffering it and replaying it later is how autonomous/plugin wakes get lost.
**OMP background work comes from an injected extension.** OMP's RPC has no job inventory or cancel command, and adding them upstream is not an option. `OmpCliRuntime` launches every OMP process with `--extension` pointing at a module it generates (`packages/server/src/server/agent/providers/omp/background-work-extension.ts`) and deletes the file when that runtime closes. The extension polls `ctx.getAsyncJobSnapshot()` and sends changes through `ctx.ui.setStatus("paseo:background-work", …)`, which the adapter consumes and never shows. Stop sends `/jobs kill <id>` as an RPC prompt; OMP runs that builtin before the model sees the prompt, mid-turn or idle. What you get depends on the OMP release:
| OMP | Background jobs |
| ----------------- | ------------------------------------- |
| older than 17.2.0 | not listed (no `getAsyncJobSnapshot`) |
| 17.2.0 to 18.8.7 | listed, no Stop |
| 18.8.8 and newer | listed, with Stop |
The adapter reads the command list at launch and publishes `canStop: false` when `/jobs` has no `kill` subcommand. A run waiting on jobs ends with a non-terminal `agent_end` marked `awaitingAsyncWork`. From 18.8.8 until 18.21.0, OMP sends nothing after `/jobs kill` cancels the last of that work, so after a Stop the adapter reads `get_state` and completes the turn itself when nothing is left. Listing and Stop depend on OMP's extension API and the `/jobs` builtin, not on a wire contract, so recheck them when the minimum OMP version moves. `task` jobs are left out because OMP subagents already show as subagents. Pi's `createPiPaseoExtensionFile` injects its extension the same way.
+68 -11
View File
@@ -5,15 +5,9 @@ Agent chat delivery has two paths:
1. **Live stream** — `agent_stream` WebSocket messages for immediacy. These may be delta-shaped lifecycle updates.
2. **Authoritative history** — `fetch_agent_timeline_request` for correctness. This always returns full projected timeline items, never lifecycle deltas.
The daemon retains projected items in memory. Each source event advances the stream sequence,
then replaces the previous tool state or merges into the current text item. Intermediate payloads
are never retained for history or catch-up. Provider history is the durable transcript authority
and rebuilds the projection when an agent resumes.
Pagination bounds each read, not total resident history. Active and idle agents retain their
projected transcript; archive releases it and later history reads rebuild it from the provider.
Streaming overhead must remain proportional to the retained transcript. Cumulative text snapshots
must be released after their deltas have been consumed.
Pagination bounds each read, not total resident history. Streaming overhead must remain
proportional to the retained transcript. Cumulative text snapshots must be released after their
deltas have been consumed.
The invariants are:
@@ -32,6 +26,50 @@ bounded item is used for runtime timeline rows and live stream events. Provider
applies the same rule so reopening an agent cannot restore an oversized payload. Fetches apply it
again to assistant and reasoning rows the projection merges from many chunks.
## Owned history
The daemon owns each agent's history in `AgentTimeline`
(`packages/server/src/server/agent/timeline/`): one ordered history per agent, with each provider
child's descriptor and history in a child scope of the same agent. Each source event advances the
stream sequence, then replaces the previous tool state or merges into the current text item.
Intermediate payloads are never retained for history or catch-up.
History is append-only: rewind, import, reload and archive never delete or rewrite a row. Only
deleting the agent, or a provider removing one of its own children, deletes history.
- **Rewind** retires a range of rows. They leave the conversation and stay stored, in the same
epoch. See [Rewind retires rows](#rewind-retires-rows).
- **Provider history** is imported only into an agent that has no history. After that, resume
does not read it. Reload agent and Unarchive require the provider history to start with the
same prompt IDs and text in order. They then append whole new turns, starting at the next
prompt. Existing replies, including partial replies, stay as recorded. If the prompts differ,
for example because the provider stored expanded attachment text, the chat stays unchanged and
Paseo reports a mismatch. A provider child Paseo already holds, listed or retired, is never imported again.
- **Archive and reload** keep the history and the provider children. An archived chat reads them
without its provider. Opening a stored agent that has no provider session to resume starts its
first session on the same history.
- **Delete** removes the agent's history and every child's, retired ones included, before the
agent record. If the history cannot be removed, the request fails and the agent stays listed. The
user can keep using it and delete it again.
`epoch` is the stored history's identity, minted once when the history is created.
`AgentTimeline` serializes every operation of one agent, child scopes included, and keeps its
state in an `AgentTimelineBackend`: the sequence, the rows and retirements, prompt identities, the
open rewind, and the children. The backend contract suite is `agent-timeline.test.ts`, run over
`TIMELINE_CONTRACT_BACKENDS` in `timeline/testing.ts`. The daemon uses the SQLite backend in the
[daemon database](data-model.md#daemon-database). History, retirements, the open rewind, and
provider children survive a daemon restart in the same epoch, so clients keep their cursors. A
closed or archived agent holds no history in memory. Each fetch reads the page from the database
and starts no provider. An internal agent, such as the one that writes a commit message, keeps its
history in a memory backend instead, so it leaves nothing on disk. The memory backend also serves
tests.
An open rewind is stored with the history. Resuming an agent whose history holds one settles it
before the agent takes prompts: a recorded provider cut is committed, and an unknown outcome is
judged from the resumed provider history. When that history proves nothing, the rewind stays open
and the agent refuses prompts with the unknown-outcome error.
## Presence is not delivery
Client heartbeat reports presence:
@@ -173,7 +211,7 @@ or retry backoff. This cannot keep a mobile socket alive after the operating sys
bookkeeping without replacing timeline arrays, preserving an upward-scrolled viewport.
- When the page overlaps or is adjacent to the local end cursor, only projected items newer than
that cursor are applied. Already-covered rows are not replayed.
- A true middle gap, epoch change, or rewind atomically replaces stale canonical history with the
- A true middle gap or epoch change atomically replaces stale canonical history with the
latest tail. The replacement reconciles positioned live rows beyond its coverage and unresolved
local submissions; it never retains two discontiguous canonical ranges.
@@ -186,6 +224,24 @@ history replay. The pending approval UI can hide that tool from presentation, bu
must retain its position. Creating a new history card on rejection places it after the prompt that
rejected it; changing steer-event ordering would also put new assistant output before that prompt.
## Rewind retires rows
A conversation rewind commits a retirement `{ seq, retireFromSeq }`: active rows anchored in
`[retireFromSeq, seq)` leave the conversation, and `seq` is the retirement's own position in the
sequence. The provider children spawned by retired tool calls, and their descendants, are retired
in the same commit. They leave the listing, keep their history, and drop late provider events.
Clients learn of a retirement live through `agent.timeline.rewind`, and on pages through
`retirements`, which lists the retirements whose `seq` lies inside the page's span. The client
drops the rows it holds in that range; rows without a timeline position are unechoed local sends
and stay. Retired ranges and the retirement's `seq` count as covered, so forward cursors advance
through them. Tail, before and prompt-jump pages are served from active rows, so one served before
a retirement the client already applied is stale and is refetched (`viewed-timeline-sync.ts`).
Clients without `timeline_rewind_operations` cannot drop retired rows. For them the session derives
a wire epoch that changes with each retirement, so they take the destructive replacement they
always took on rewind. The shim is tagged `COMPAT(timelineRewindOperations)`.
## Provider child history
Child transcripts use the same projected-page reconciliation as the main conversation. The client
@@ -379,7 +435,7 @@ the draft-create handoff is the one boundary that also permits the legacy canoni
arrived first. Generic reducers and consumers do not reimplement message identity matching.
Ordinary bootstrap, same-epoch reset, and catch-up replacement preserve unmatched locally submitted
rows because a provider may never echo them. A known epoch change or rewind replaces history and
rows because a provider may never echo them. A known epoch change replaces history and
drops acknowledged local rows omitted by the new canonical epoch; every transaction not yet
acknowledged by the provider, and no other local row, crosses that destructive boundary. A cold
reset without an existing epoch is destructive because the client has no continuity anchor.
@@ -395,6 +451,7 @@ canonical assistant prefix, it stays in the head lane. No row may be returned in
## Relevant code
- Server owned history: `packages/server/src/server/agent/timeline/`
- Server live stream forwarding: `packages/server/src/server/session.ts`
- App sync planning: `packages/app/src/timeline/timeline-sync-plan.ts`
- App viewed-agent synchronization: `packages/app/src/timeline/viewed-timeline-sync.ts`
@@ -0,0 +1,4 @@
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
Full notes: https://paseo.sh/changelog
+1 -1
View File
@@ -1 +1 @@
sha256-34bUBmRmjekbUSp93597GLTmSWKt23TCHaK3ViXG+iU=
sha256-ZVIrRfb7oyTwx7kz6F51hs/ctT45qUdZM4v0QRLW9zA=
+49 -30
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.18.1",
"version": "0.18.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.18.1",
"version": "0.18.2",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -46,6 +46,9 @@
"react-dom": "19.2.3",
"typescript": "^5.9.3",
"ws": "^8.20.0"
},
"engines": {
"node": ">=22.16.0"
}
},
"node_modules/@0no-co/graphql.web": {
@@ -37543,7 +37546,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.18.1",
"version": "0.18.2",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -39696,13 +39699,13 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/server": "0.18.1",
"@getpaseo/client": "0.18.2",
"@getpaseo/protocol": "0.18.2",
"@getpaseo/server": "0.18.2",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
@@ -39721,6 +39724,9 @@
"typescript": "^5.2.2",
"vitest": "^4.1.6",
"zx": "^8.8.5"
},
"engines": {
"node": ">=22.16.0"
}
},
"packages/cli/node_modules/@vitest/expect": {
@@ -39949,11 +39955,11 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/protocol": "0.18.1",
"@getpaseo/relay": "0.18.1",
"@getpaseo/protocol": "0.18.2",
"@getpaseo/relay": "0.18.2",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
@@ -39965,7 +39971,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40208,7 +40214,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.18.1",
"version": "0.18.2",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40254,7 +40260,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/language": "6.12.4",
@@ -40284,7 +40290,7 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^1.4.0",
@@ -40292,8 +40298,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/client": "0.18.2",
"@getpaseo/protocol": "0.18.2",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -40303,8 +40309,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/client": "0.18.2",
"@getpaseo/protocol": "0.18.2",
"react": ">=19.1.0 <20",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
@@ -40326,7 +40332,7 @@
},
"packages/protocol": {
"name": "@getpaseo/protocol",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"semver": "^7.8.5",
@@ -40353,7 +40359,7 @@
}
},
"packages/react-native-enriched-markdown": {
"version": "0.18.1",
"version": "0.18.2",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
@@ -40369,7 +40375,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^2.4.0",
@@ -40591,17 +40597,17 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^0.17.1",
"@anthropic-ai/claude-agent-sdk": "0.3.326",
"@anthropic-ai/sdk": "^0.104.2",
"@getpaseo/client": "0.18.1",
"@getpaseo/highlight": "0.18.1",
"@getpaseo/plugin": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/relay": "0.18.1",
"@getpaseo/client": "0.18.2",
"@getpaseo/highlight": "0.18.2",
"@getpaseo/plugin": "0.18.2",
"@getpaseo/protocol": "0.18.2",
"@getpaseo/relay": "0.18.2",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/node": "2.1.2",
"@modelcontextprotocol/sdk": "1.29.0",
@@ -40649,7 +40655,7 @@
"@playwright/test": "^1.56.1",
"@types/express": "^4.17.20",
"@types/markdown-it": "^14.2.0",
"@types/node": "^20.9.0",
"@types/node": "^22.16.0",
"@types/qrcode": "^1.5.6",
"@types/uuid": "^9.0.7",
"@types/ws": "^8.5.8",
@@ -40657,6 +40663,9 @@
"cross-env": "^10.1.0",
"tsx": "^4.6.0",
"vitest": "^4.1.6"
},
"engines": {
"node": ">=22.16.0"
}
},
"packages/server/node_modules/@esbuild/aix-ppc64": {
@@ -41104,6 +41113,16 @@
"@types/mdurl": "^2"
}
},
"packages/server/node_modules/@types/node": {
"version": "22.20.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz",
"integrity": "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
}
},
"packages/server/node_modules/@vitest/expect": {
"version": "4.1.6",
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.6.tgz",
@@ -41552,7 +41571,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.18.1",
"version": "0.18.2",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
@@ -43178,7 +43197,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.18.1",
"version": "0.18.2",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+5 -2
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.18.1",
"version": "0.18.2",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
@@ -99,7 +99,7 @@
"web": "npm run web --workspace=@getpaseo/app",
"dev:desktop": "cross-env PASEO_LISTEN=127.0.0.1:6768 npm run dev --workspace=@getpaseo/desktop",
"dev:win:desktop": "npm run dev:win --workspace=@getpaseo/desktop",
"build:desktop": "npm run build:app-deps:clean && cd packages/app && cross-env PASEO_WEB_PLATFORM=electron npx expo export --platform web && cd ../.. && npm run build --workspace=@getpaseo/desktop --",
"build:desktop": "npm run build:app-deps:clean && cd packages/app && cross-env PASEO_WEB_PLATFORM=electron npx expo export --platform web && cd ../.. && node scripts/precompress-assets.mjs packages/app/dist && npm run build --workspace=@getpaseo/desktop --",
"db:query": "npm run db:query --workspace=@getpaseo/server --",
"cli": "./scripts/dev-home.sh npx tsx packages/cli/src/index.js",
"version": "npm run version:sync-internal && npm run fdroid:changelogs && npm run release:prepare && git add -A",
@@ -172,5 +172,8 @@
"tiny-async-pool": {
"semver@^5": "5.7.2"
}
},
"engines": {
"node": ">=22.16.0"
}
}
+2
View File
@@ -5,6 +5,7 @@ const withAndroidAsyncStorageSize = require("./plugins/with-android-async-storag
const withAndroidIgnoreBoldText = require("./plugins/with-android-ignore-bold-text");
const withAndroidOptionalCamera = require("./plugins/with-android-optional-camera");
const withAndroidProfileable = require("./plugins/with-android-profileable");
const withAndroidSplashWindowBackground = require("./plugins/with-android-splash-window-background");
const withFdroidAutolinking = require("./plugins/with-fdroid-autolinking");
const withPasteInput = require("./plugins/with-paste-input");
const withAndroidScroll = require("./modules/paseo-scroll/app.plugin");
@@ -165,6 +166,7 @@ export default {
},
},
],
withAndroidSplashWindowBackground,
...buildProfile.notificationPlugins,
"expo-audio",
[
+29
View File
@@ -26,6 +26,29 @@ async function resolveAndroidManifest() {
return exp._internal.modResults.android.manifest.manifest;
}
interface StyleItem {
$: { name: string };
_: string;
}
interface StyleGroup {
$: { name: string };
item?: StyleItem[];
}
async function resolveAndroidAppThemeItems(): Promise<Record<string, string>> {
const { exp } = await getPrebuildConfigAsync(__dirname, { platforms: ["android"] });
await compileModsAsync(exp, {
projectRoot: __dirname,
introspect: true,
platforms: ["android"],
assertMissingModProviders: false,
});
const styles: StyleGroup[] = exp._internal.modResults.android.styles.resources.style;
const appTheme = styles.find((style) => style.$.name === "AppTheme");
return Object.fromEntries((appTheme?.item ?? []).map((item) => [item.$.name, item._]));
}
describe("Android app config", () => {
afterEach(() => {
if (originalFdroidFlag === undefined) {
@@ -58,6 +81,12 @@ describe("Android app config", () => {
},
30_000,
);
// Without it, a dark device paints AppCompat's #303030 between the splash and the first screen.
it("paints the app window in the splash colour", async () => {
const appTheme = await resolveAndroidAppThemeItems();
expect(appTheme["android:windowBackground"]).toBe("@color/splashscreen_background");
}, 30_000);
});
it("follows system rotation on Android", async () => {
@@ -13,6 +13,13 @@ import {
import { expectNearBottom, scrollChatAwayFromBottom } from "../support/helpers/agent-bottom-anchor";
import { holdRewindCompletion } from "../support/helpers/agent-timeline-gate";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { userScrollsTimelineToHistoryStart } from "../support/helpers/timeline-pagination";
import {
closeWorkspaceAgentTab,
fetchAgentArchivedAt,
primeAdditionalPage,
resetSeededPageState,
} from "../support/helpers/archive-tab";
async function completeSubmittedTurn(
page: Page,
@@ -48,26 +55,98 @@ async function expectTurnCompletesNormally(
await expectAgentIdle(page);
}
async function openAgentOnAnotherClient(
page: Page,
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
): Promise<void> {
await primeAdditionalPage(page);
await resetSeededPageState(page);
await openAgentRoute(page, agent);
await expectComposerVisible(page);
}
/** The prompts the chat shows, in order, each exactly once. */
async function expectPrompts(page: Page, prompts: string[]): Promise<void> {
const messages = page.getByTestId("user-message");
await expect(messages).toHaveCount(prompts.length);
await expect(messages).toContainText(prompts);
}
async function reloadAgentFromTabMenu(page: Page, agentId: string): Promise<void> {
const tabId = `workspace-tab-agent_${agentId}`;
await page.getByTestId(tabId).filter({ visible: true }).first().click({ button: "right" });
await page.getByTestId(`workspace-tab-context-agent_${agentId}-reload-agent`).click();
}
async function archiveAgentByClosingTab(
page: Page,
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
): Promise<void> {
await closeWorkspaceAgentTab(page, agent.agentId);
await expect.poll(() => fetchAgentArchivedAt(agent.client, agent.agentId)).not.toBeNull();
}
async function unarchiveAgent(page: Page): Promise<void> {
await page.getByRole("button", { name: "Unarchive", exact: true }).click();
await expect(page.getByText("This agent is archived", { exact: true })).toHaveCount(0, {
timeout: 30_000,
});
}
async function expectToast(page: Page, message: string): Promise<void> {
await expect(page.getByTestId("app-toast-message")).toHaveText(message, { timeout: 30_000 });
}
/** The prompts of the whole conversation, after scrolling up through its older pages. */
async function expectConversationPrompts(page: Page, prompts: string[]): Promise<void> {
const messages = page.getByTestId("user-message");
await expect
.poll(async () => {
await userScrollsTimelineToHistoryStart(page);
return await messages.count();
})
.toBe(prompts.length);
await expect(messages).toContainText(prompts);
}
// A row React remounts loses this attribute; one that stays mounted keeps it.
async function markMounted(row: Locator): Promise<void> {
await row.evaluate((element) => element.setAttribute("data-e2e-mounted", "before-rewind"));
}
async function expectStillMounted(row: Locator): Promise<void> {
await expect(row).toHaveAttribute("data-e2e-mounted", "before-rewind");
}
test.describe("Agent message rewind", () => {
test("rewinds a submitted prompt without replaying history and preserves a human draft", async ({
test("rewinds a prompt in place on every open client and keeps a human draft", async ({
page,
}) => {
test.setTimeout(90_000);
test.setTimeout(150_000);
const retainedPrompt = "Keep this completed turn after rewind.";
const rewoundPrompt = "Remove this completed turn after rewind.";
const nextPrompt = "Continue after the rewind.";
const preservedDraft = "Keep this human draft after rewind.";
const agent = await seedMockAgentWorkspace({
repoPrefix: "message-rewind-roundtrip-",
title: "Message rewind roundtrip",
model: "ten-second-stream",
});
const otherClient = await page.context().newPage();
try {
const rewindCompletion = await holdRewindCompletion(page, agent.agentId);
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await completeSubmittedTurn(page, agent, retainedPrompt);
const retainedMessage = await completeSubmittedTurn(page, agent, retainedPrompt);
const userMessage = await completeSubmittedTurn(page, agent, rewoundPrompt);
await test.step("a second client opens the same chat", async () => {
await openAgentOnAnotherClient(otherClient, agent);
await expectPrompts(otherClient, [retainedPrompt, rewoundPrompt]);
});
await markMounted(retainedMessage);
await scrollChatAwayFromBottom(page, {
deltaY: -900,
minDistanceFromBottom: 300,
@@ -76,19 +155,91 @@ test.describe("Agent message rewind", () => {
await blurComposerInput(page);
rewindCompletion.clearTimelineStreamCount();
const rewind = rewindConversation(page, userMessage, rewoundPrompt);
await rewindCompletion.waitForDelayedResponse();
await expect(page.getByTestId("rewind-menu-conversation")).toBeDisabled();
expect(rewindCompletion.timelineStreamCount()).toBe(0);
rewindCompletion.release();
await rewind;
await test.step("the rewind stays pending until the daemon answers", async () => {
const rewind = rewindConversation(page, userMessage, rewoundPrompt);
await rewindCompletion.waitForDelayedResponse();
await expect(page.getByTestId("rewind-menu-conversation")).toBeDisabled();
expect(rewindCompletion.timelineStreamCount()).toBe(0);
rewindCompletion.release();
await rewind;
});
await expect(page.getByTestId("user-message").filter({ hasText: rewoundPrompt })).toHaveCount(
0,
);
await expectComposerDraft(page, preservedDraft);
await expectComposerNotFocused(page);
await expectNearBottom(page);
await test.step("the rewound turn leaves without reloading the chat", async () => {
await expectPrompts(page, [retainedPrompt]);
await expectStillMounted(retainedMessage);
expect(rewindCompletion.timelineFetchCount()).toBe(0);
await expectComposerDraft(page, preservedDraft);
await expectComposerNotFocused(page);
await expectNearBottom(page);
await expectPrompts(otherClient, [retainedPrompt]);
});
await test.step("the next prompt appears once on both clients", async () => {
await completeSubmittedTurn(otherClient, agent, nextPrompt);
await expectPrompts(otherClient, [retainedPrompt, nextPrompt]);
await expectPrompts(page, [retainedPrompt, nextPrompt]);
});
await test.step("a reconnecting client loads the rewound conversation", async () => {
await otherClient.reload();
await expectPrompts(otherClient, [retainedPrompt, nextPrompt]);
});
} finally {
await otherClient.close();
await agent.cleanup();
}
});
test("keeps the rewound conversation through Reload agent, archive and unarchive", async ({
page,
}) => {
test.setTimeout(150_000);
const keptPrompt = "Keep this turn through reload and archive.";
const rewoundPrompt = "Rewind this turn before reloading.";
const nextPrompt = "Continue after the rewind, then reload.";
const agent = await seedMockAgentWorkspace({
repoPrefix: "message-rewind-reload-archive-",
title: "Message rewind reload archive",
model: "ten-second-stream",
});
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await completeSubmittedTurn(page, agent, keptPrompt);
const rewound = await completeSubmittedTurn(page, agent, rewoundPrompt);
await rewindConversation(page, rewound, rewoundPrompt);
await expectPrompts(page, [keptPrompt]);
await completeSubmittedTurn(page, agent, nextPrompt);
await expectPrompts(page, [keptPrompt, nextPrompt]);
await test.step("Reload agent keeps the rewound conversation", async () => {
await reloadAgentFromTabMenu(page, agent.agentId);
await expectToast(page, "Reloaded agent");
await expectPrompts(page, [keptPrompt, nextPrompt]);
await expectComposerVisible(page);
});
await test.step("the archived chat shows the rewound conversation", async () => {
await archiveAgentByClosingTab(page, agent);
await openAgentRoute(page, agent);
await expect(page.getByText("This agent is archived", { exact: true })).toBeVisible({
timeout: 30_000,
});
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
});
await test.step("unarchiving keeps the rewound conversation", async () => {
await unarchiveAgent(page);
await expectComposerVisible(page);
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
});
await test.step("a reconnecting client loads the same conversation", async () => {
await page.reload();
await expectComposerVisible(page);
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
});
} finally {
await agent.cleanup();
}
@@ -18,6 +18,7 @@ import {
expectComposerVisible,
cancelAgent,
composerLocator,
configureComposerInterruptSend,
expectQueuedMessageButton,
fillComposerDraft,
holdSendButton,
@@ -404,15 +405,6 @@ async function queueMessage(page: Page, prompt: string): Promise<void> {
await sendDraftToQueue(page);
}
async function expectQueuedSendFailuresRestored(page: Page, prompts: string[]): Promise<void> {
await expect(page.getByRole("button", { name: "Send queued message now" })).toHaveCount(
prompts.length,
);
for (const prompt of prompts) {
await expect(page.getByTestId("user-message").filter({ hasText: prompt })).toHaveCount(0);
}
}
async function expectFailedSubmissionRestored(page: Page, prompt: string): Promise<void> {
await expectComposerDraft(page, prompt);
await expectComposerEditable(page);
@@ -431,14 +423,14 @@ async function expectInterruptedTurnOrderAfterReconnect(
});
const prompt = "Keep this prompt before its response.";
try {
await configureComposerInterruptSend(page);
await openAgentRoute(page, { workspaceId: agent.workspaceId, agentId: agent.agentId });
await expectComposerVisible(page);
await agent.client.sendAgentMessage(agent.agentId, "Start the turn that will be interrupted.");
await expect(page.getByRole("button", { name: /stop|cancel/i }).first()).toBeVisible();
await expect(page.getByText("Cycle 1", { exact: true })).toBeVisible();
await queueMessage(page, prompt);
gate.setAgentStreamSuppressed(true);
await page.getByRole("button", { name: "Send queued message now" }).click();
await submitMessage(page, prompt);
const promptRow = page.getByTestId("user-message").filter({ hasText: prompt });
await expect(promptRow).toBeVisible();
await gate.waitForServerMessage("send_agent_message_response");
@@ -659,14 +651,14 @@ async function expectLegacyAssistantStartsAfterInterruptedPrompt(
});
const prompt = "Start the replacement answer after this prompt.";
try {
await configureComposerInterruptSend(page);
await openAgentRoute(page, { workspaceId: agent.workspaceId, agentId: agent.agentId });
await expectComposerVisible(page);
await agent.client.sendAgentMessage(agent.agentId, "Start the interrupted answer.");
await expect(page.getByText("Cycle 1", { exact: true })).toBeVisible();
await queueMessage(page, prompt);
gate.setAssistantMessageIdsStripped(true);
gate.setAgentStreamEventSuppressed("turn_canceled", true);
await page.getByRole("button", { name: "Send queued message now" }).click();
await submitMessage(page, prompt);
const promptRow = page.getByTestId("user-message").filter({ hasText: prompt });
const replacementAnswer = page.getByText("(end of synthetic stream)", { exact: true }).last();
await expect(promptRow).toBeVisible();
@@ -1098,6 +1090,7 @@ test.describe("Agent message submission", () => {
gate.holdNextServerMessage("cancel_agent_response");
await page.getByRole("button", { name: "Stop agent", exact: true }).click();
await gate.waitForHeldServerMessage();
await page.getByRole("button", { name: "Send queued message now" }).click();
await expect(page.getByTestId("user-message").filter({ hasText: secondPrompt })).toHaveCount(
1,
@@ -1343,6 +1336,8 @@ test.describe("Agent message submission", () => {
await test.step("holding Send queues the draft", async () => {
await fillComposerDraft(page, queuedPrompt);
await holdSendButton(page, "Send and steer");
expect((await gate.waitForRequest()).activeTurnBehavior).toBe("queue");
gate.accept();
await expectQueuedMessageButton(page);
await expectComposerDraft(page, "");
await expectAgentReadyToInterrupt(page);
@@ -1351,19 +1346,22 @@ test.describe("Agent message submission", () => {
).toHaveCount(0);
});
await test.step("tapping Send still steers", async () => {
await test.step("tapping Send still steers and takes the queued row along", async () => {
const steeredPrompt = "Steer this turn with a tap.";
await fillComposerDraft(page, steeredPrompt);
await page.getByRole("button", { name: "Send and steer", exact: true }).click();
const request = await gate.waitForRequest();
const request = await gate.waitForRequest(2);
expect(request.text).toBe(steeredPrompt);
expect(request.activeTurnBehavior).toBe("steer");
gate.accept();
gate.accept(1);
await expect(
page.getByTestId("user-message").filter({ hasText: steeredPrompt }),
).toHaveCount(1);
await expectQueuedMessageButton(page);
await expect(page.getByRole("button", { name: "Send queued message now" })).toHaveCount(0);
await expect(
page.getByTestId("user-message").filter({ hasText: queuedPrompt }),
).toHaveCount(1);
});
} finally {
await agent.cleanup();
@@ -1380,26 +1378,21 @@ test.describe("Agent message submission", () => {
await replaySteeredSleepTurnInBrowser(page, testInfo, "codex");
});
test("restores overlapping queued sends when their connection fails", async ({
page,
}, testInfo) => {
test("restores the draft when queueing loses the connection", async ({ page }, testInfo) => {
test.setTimeout(120_000);
const gate = await gateNextAgentMessage(page);
const agent = await startRunningMockAgent(page, {
prefix: `overlapping-queued-send-${testInfo.workerIndex}-`,
prefix: `queue-connection-lost-${testInfo.workerIndex}-`,
model: "one-minute-stream",
prompt: "Keep the agent running while messages queue.",
prompt: "Keep the agent running while a message queues.",
});
const prompts = ["Restore the first queued send.", "Restore the second queued send."];
const prompt = "Keep this draft if queueing fails.";
try {
await queueMessage(page, prompts[0]);
await queueMessage(page, prompts[1]);
await page.getByRole("button", { name: "Send queued message now" }).first().click();
await gate.waitForRequest(1);
await page.getByRole("button", { name: "Send queued message now" }).first().click();
await gate.waitForRequest(2);
await fillComposerDraft(page, prompt);
await sendDraftToQueue(page);
await gate.waitForRequest();
await gate.disconnect();
await expectQueuedSendFailuresRestored(page, prompts);
await expectFailedSubmissionRestored(page, prompt);
} finally {
await agent.cleanup();
}
@@ -44,6 +44,26 @@ const PROFILE = {
const PROFILE_SUMMARY = "Mock Load Test · One minute stream · Approval test";
// Isolate this suite to the sole mock provider so it tests single-provider picker
// behavior deterministically regardless of which CLIs are installed on the host.
test.use({
e2eDaemonConfig: {
version: 1,
agents: {
providers: {
claude: { enabled: false },
codex: { enabled: false },
copilot: { enabled: false },
opencode: { enabled: false },
pi: { enabled: false },
omp: { enabled: false },
antigravity: { enabled: false },
hoplite: { enabled: false },
},
},
},
});
test.describe("Agent profiles in the model picker", () => {
test("an empty host still exposes agent profile settings from the picker", async ({ page }) => {
const seed = await seedAgentProfiles([]);
@@ -68,8 +88,8 @@ test.describe("Agent profiles in the model picker", () => {
page,
}) => {
const seed = await seedAgentProfiles([PROFILE]);
// A live agent is one provider's process, so the profile has to name that
// same provider or the picker will not offer it at all.
// With only the mock provider enabled on this host, the picker opens
// directly into its models and shows its pinned profile.
const workspace = await seedMockAgentWorkspace({
repoPrefix: "agent-profiles-picker-",
title: "Agent profiles picker",
@@ -128,6 +148,45 @@ test.describe("Agent profiles in the model picker", () => {
}
});
test("the compact drawer keeps a running agent's Profiles collapsed and its rows one height", async ({
page,
}, testInfo) => {
const seed = await seedAgentProfiles([PROFILE]);
const workspace = await seedMockAgentWorkspace({
repoPrefix: "agent-profiles-compact-running-",
title: "Agent profiles compact running",
model: "ten-second-stream",
modeId: "load-test",
});
try {
await page.setViewportSize({ width: 390, height: 800 });
await openAgentRoute(page, workspace);
await expectComposerVisible(page);
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
await expect(page.getByTestId("agent-controls-profiles")).toBeVisible();
await expect(page.getByTestId("agent-controls-profiles-list")).toHaveCount(0);
// Settings rows (Model, switches) sit in the same list as the Profiles header and mode rows.
const sheet = page.getByTestId("agent-controls-settings-list");
const rows = [
sheet.getByTestId("agent-controls-profiles"),
sheet.getByTestId("agent-controls-model"),
sheet.locator('[data-testid^="mode-option-"]').first(),
];
const heights = [];
for (const row of rows) {
await expect(row).toBeVisible();
heights.push(Math.round((await row.boundingBox())!.height));
}
await page.screenshot({ path: testInfo.outputPath("compact-agent-settings.png") });
expect(new Set(heights).size, `row heights ${heights.join(", ")}`).toBe(1);
} finally {
await workspace.cleanup();
await seed.restore();
}
});
test("a model row and its create-profile action are separate buttons", async ({ page }) => {
const seed = await seedAgentProfiles([]);
const workspace = await seedMockAgentWorkspace({
@@ -1,6 +1,6 @@
import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { expect, test } from "../support/fixtures";
import { expect, test, type Page } from "../support/fixtures";
import { expectComposerVisible } from "../support/helpers/composer";
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
import { installLocalDesktopHost } from "../support/helpers/local-desktop-host";
@@ -282,3 +282,63 @@ test("compact opens files and subagents in a sheet, leaving the tabs for agents"
await workspace.cleanup();
}
});
async function openFileAndDismissDuringAnimation(page: Page) {
const fileLink = page.getByText(FILE_LINK, { exact: true });
await expect(fileLink).toBeVisible({ timeout: 15_000 });
// Check and press in the same browser frame so automation cannot outlast the opening animation.
await fileLink.evaluate((link) => {
if (!(link instanceof HTMLElement)) throw new Error("Expected an HTML file link");
return new Promise<void>((resolve, reject) => {
const timeout = window.setTimeout(() => {
cancelAnimationFrame(frame);
reject(new Error("The file sheet did not pass through the opening position"));
}, 5_000);
const dismissDuringOpening = () => {
const header = document.querySelector('[data-testid="sheet-tab-header"]');
const top = header?.getBoundingClientRect().top ?? window.innerHeight;
const pressTarget = document.elementFromPoint(10, 10);
if (
top > window.innerHeight / 2 &&
top < window.innerHeight &&
pressTarget instanceof HTMLElement &&
pressTarget.getAttribute("aria-label") === "Bottom sheet backdrop"
) {
window.clearTimeout(timeout);
pressTarget.click();
resolve();
return;
}
frame = requestAnimationFrame(dismissDuringOpening);
};
let frame = requestAnimationFrame(dismissDuringOpening);
link.click();
});
});
}
test("a sheet dismissed while it is still opening closes its tab", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
const workspace = await seedMockAgentWorkspace({
repoPrefix: "compact-sheet-opening-dismiss-",
title: "Sheet parent",
initialPrompt: promptMentioning(FILE_LINK),
});
try {
await writeFile(path.join(workspace.cwd, "linked.ts"), "one\ntwo\nthree\n", "utf8");
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: workspace.agentId });
await openFileAndDismissDuringAnimation(page);
await expectNoSheetOpen(page);
await expectOpenTabCount(page, 1);
await page
.getByRole("button", { name: /Switch tabs/ })
.filter({ visible: true })
.click();
await expect(page.getByText("Workspace tabs", { exact: true })).toBeVisible();
} finally {
await workspace.cleanup();
}
});
@@ -0,0 +1,288 @@
import { expect, test } from "../support/fixtures";
import { expectAgentIdle } from "../support/helpers/agent-stream";
import {
attachComposerTestImage,
cancelAgent,
composerLocator,
expectAttachmentPill,
expectComposerDraft,
expectComposerVisible,
fillComposerDraft,
sendDraftToQueue,
} from "../support/helpers/composer";
import {
cancelQueuedMessage,
editQueuedMessage,
expectDeliveredImage,
expectComposerOnScreen,
expectDeliveredOnce,
expectSenderIconUnsquashed,
openSecondClient,
queuedRow,
queuedRows,
queueMessage,
queuePausedNotice,
queueThroughHost,
reopenAgent,
scrollQueueFrom,
seedAgentWithOpenTurn,
sendQueuedMessageNow,
} from "../support/helpers/composer-queue";
import { openAgentRoute } from "../support/helpers/mock-agent";
test.describe("Composer queue", () => {
test("a queued image prompt can be edited, survives a reload, and is delivered once", async ({
page,
}) => {
const prompt = "Describe this screenshot.";
const revised = "Describe this screenshot in one line.";
const agent = await seedAgentWithOpenTurn({ repoPrefix: "queue-edit-", title: "Queue edit" });
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await test.step("queue a prompt with an image", async () => {
await attachComposerTestImage(page);
await expectAttachmentPill(page, "composer-image-attachment-pill");
await queueMessage(page, prompt);
await expect(queuedRow(page, prompt)).toContainText("1 attachment");
});
await test.step("Edit takes the text and image back into the composer", async () => {
await editQueuedMessage(page, prompt);
await expect(queuedRows(page)).toHaveCount(0);
await expectComposerDraft(page, prompt);
await expectAttachmentPill(page, "composer-image-attachment-pill");
await expect(composerLocator(page)).toBeFocused();
});
await test.step("queue the revised prompt with the same image", async () => {
await queueMessage(page, revised);
await expect(queuedRow(page, revised)).toContainText("1 attachment");
});
await test.step("the row is still there after a reload", async () => {
await page.reload();
await expect(queuedRow(page, revised)).toBeVisible({ timeout: 30_000 });
await expect(queuedRows(page)).toHaveCount(1);
});
await test.step("the prompt is delivered once when the turn ends", async () => {
await agent.finishTurn();
await expectDeliveredOnce(page, revised);
await expectDeliveredImage(page, revised);
await expect(queuedRows(page)).toHaveCount(0);
});
} finally {
await agent.cleanup();
}
});
test("Stop pauses the queue until the user sends a row", async ({ page }) => {
const prompt = "Run after I say so.";
const agent = await seedAgentWithOpenTurn({ repoPrefix: "queue-held-", title: "Queue held" });
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await queueMessage(page, prompt);
await expect(queuePausedNotice(page)).toHaveCount(0);
await cancelAgent(page);
await expectAgentIdle(page);
await expect(queuePausedNotice(page)).toBeVisible();
await expect(queuedRow(page, prompt)).toBeVisible();
await sendQueuedMessageNow(page, prompt);
await expectDeliveredOnce(page, prompt);
await expect(queuePausedNotice(page)).toHaveCount(0);
} finally {
await agent.cleanup();
}
});
test("the host delivers a queued prompt with every client closed", async ({ page }) => {
const prompt = "Continue while I am away.";
const agent = await seedAgentWithOpenTurn({
repoPrefix: "queue-closed-",
title: "Queue closed",
});
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await queueMessage(page, prompt);
await page.close();
await agent.finishTurn();
await agent.client.waitForFinish(agent.agentId, 30_000);
const reopened = await reopenAgent(page, agent);
await expectDeliveredOnce(reopened, prompt);
await expect(queuedRows(reopened)).toHaveCount(0);
} finally {
await agent.cleanup();
}
});
test("two clients share one queue", async ({ browser, page }) => {
const unwanted = "Do not run this one.";
const urgent = "Run this one now.";
const agent = await seedAgentWithOpenTurn({ repoPrefix: "queue-sync-", title: "Queue sync" });
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
const second = await openSecondClient(browser, page, agent);
try {
await expectComposerVisible(second.page);
await test.step("a row queued on one client appears on the other", async () => {
await queueMessage(page, unwanted);
await expect(queuedRow(second.page, unwanted)).toBeVisible();
await fillComposerDraft(second.page, urgent);
await sendDraftToQueue(second.page);
await expect(queuedRows(page)).toContainText([unwanted, urgent]);
});
await test.step("Cancel on one client removes the row on the other", async () => {
await cancelQueuedMessage(second.page, unwanted);
await expect(queuedRow(page, unwanted)).toHaveCount(0);
});
await test.step("Send now on one client updates the other", async () => {
await sendQueuedMessageNow(page, urgent);
await expectDeliveredOnce(second.page, urgent);
await expect(
second.page.getByTestId("user-message").filter({ hasText: unwanted }),
).toHaveCount(0);
});
} finally {
await second.close();
}
} finally {
await agent.cleanup();
}
});
test("a long queue scrolls without pushing the composer off screen", async ({ page }) => {
const texts = Array.from({ length: 20 }, (_, index) => `Queued update ${index + 1}.`);
const first = "Queued update 1.";
const last = "Queued update 20.";
const agent = await seedAgentWithOpenTurn({ repoPrefix: "queue-long-", title: "Queue long" });
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await queueThroughHost(agent, texts);
await expect(queuedRows(page)).toHaveCount(20);
for (const viewport of [
{ width: 1280, height: 800 },
{ width: 390, height: 844 },
// A phone with its keyboard open.
{ width: 390, height: 500 },
]) {
await test.step(`${viewport.width}x${viewport.height}`, async () => {
await page.setViewportSize(viewport);
await expect(queuedRow(page, first)).toBeVisible();
await expectComposerOnScreen(page);
await scrollQueueFrom(page, first, 5000);
// Scrolled to the end, a fractional frame height can clip a sub-pixel of the row.
await expect(queuedRow(page, last)).toBeInViewport({ ratio: 0.99 });
await expectComposerOnScreen(page);
await scrollQueueFrom(page, last, -5000);
await expect(queuedRow(page, first)).toBeInViewport({ ratio: 1 });
});
}
} finally {
await agent.cleanup();
}
});
test("a message queued by another agent can be cancelled but not edited", async ({ page }) => {
const message = "The release notes are ready for review.";
const agent = await seedAgentWithOpenTurn({
repoPrefix: "queue-sender-",
title: "Queue recipient",
});
try {
const sender = await agent.client.createAgent({
provider: "mock",
cwd: agent.cwd,
workspaceId: agent.workspaceId,
title: "Release coordination and changelog verification helper for the mobile team",
model: "e2e-fast-stream",
});
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await agent.client.sendAgentMessage(agent.agentId, message, {
sourceAgentId: sender.id,
activeTurnBehavior: "queue",
});
const row = queuedRow(page, message);
await expect(row).toContainText("Sent by Release coordination");
await expect(row.getByRole("button", { name: "Send queued message now" })).toBeEnabled();
await expect(row.getByRole("button", { name: "Cancel queued message" })).toBeEnabled();
await expect(row.getByRole("button", { name: "Edit queued message" })).toHaveCount(0);
await test.step("a long sender name truncates without squashing its icon", async () => {
await page.setViewportSize({ width: 390, height: 844 });
await expect(row).toBeInViewport();
await expectSenderIconUnsquashed(row);
});
await cancelQueuedMessage(page, message);
await expect(queuedRows(page)).toHaveCount(0);
} finally {
await agent.cleanup();
}
});
test("editing a queued image prompt on a short phone viewport keeps remaining queued rows visible", async ({
page,
}) => {
const withImage = "Describe this screenshot.";
const remaining = Array.from({ length: 4 }, (_, index) => `Remaining update ${index + 1}.`);
const agent = await seedAgentWithOpenTurn({
repoPrefix: "queue-compact-edit-",
title: "Queue compact edit",
});
try {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await attachComposerTestImage(page);
await expectAttachmentPill(page, "composer-image-attachment-pill");
await queueMessage(page, withImage);
await queueThroughHost(agent, remaining);
await expect(queuedRows(page)).toHaveCount(5);
await page.setViewportSize({ width: 390, height: 500 });
await editQueuedMessage(page, withImage);
await expectComposerDraft(page, withImage);
await expectAttachmentPill(page, "composer-image-attachment-pill");
await expect(composerLocator(page)).toBeInViewport({ ratio: 1 });
await expect(
page.getByRole("button", { name: "Send and steer", exact: true }),
).toBeInViewport({
ratio: 1,
});
// The queue scroll viewport must keep a readable slice (>= 90px) above the restored image pill,
// not collapse to a sliver inside a 0.6*viewport slot clamp.
const scrollFrameHeight = await page
.getByRole("list", { name: "Queued messages" })
.evaluate((list) => {
const scrollView = list.parentElement?.parentElement;
return scrollView ? scrollView.getBoundingClientRect().height : 0;
});
expect(scrollFrameHeight).toBeGreaterThanOrEqual(90);
} finally {
await agent.cleanup();
}
});
});
@@ -317,13 +317,16 @@ test.describe("Cross-provider model search", () => {
await expectComposerFocused(page);
});
await test.step("the compact drawer surfaces collapsed Profiles above Model on Home and keeps provider headers stable on collapse", async () => {
await test.step("the compact drawer opens a new agent's Profiles above Model on Home and keeps provider headers stable on collapse", async () => {
await page.setViewportSize({ width: 390, height: 800 });
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
const profilesToggle = page.getByTestId("agent-controls-profiles");
const profilesList = page.getByTestId("agent-controls-profiles-list");
const modelRowButton = page.getByTestId("agent-controls-model");
await expect(profilesToggle).toBeVisible();
await expect(page.getByTestId("agent-controls-profiles-list")).toHaveCount(0);
await expect(profilesList).toBeVisible();
await profilesToggle.click();
await expect(profilesList).toHaveCount(0);
await waitForSettledPosition(profilesToggle);
const profilesBox = await profilesToggle.boundingBox();
const modelBox = await modelRowButton.boundingBox();
@@ -361,6 +364,7 @@ test.describe("Cross-provider model search", () => {
// Return Home, expand Profiles in place, and apply the profile.
await page.getByTestId("sheet-header-back").click();
await expect(profilesList).toHaveCount(0);
await profilesToggle.click();
const sheetProfileRow = page.getByTestId("model-profile-row-agent_profile_e2e_arrows");
await expect(sheetProfileRow).toBeVisible();
@@ -0,0 +1,324 @@
import { writeFile } from "node:fs/promises";
import path from "node:path";
import type { Locator } from "@playwright/test";
import { expect, test, type Page } from "../support/fixtures";
import { openCommandCenter } from "../support/helpers/command-center";
import { runWorkspaceActionFromCommandCenter } from "../support/helpers/command-center-workspace-actions";
import { submitMessageWithButton } from "../support/helpers/composer";
import { openFileExplorer, openFileFromExplorer } from "../support/helpers/file-explorer";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { runCommand } from "../support/helpers/plugin-sidebar-items";
import {
closeSheet,
expectNoSheetOpen,
expectOneSheetOpen,
promptMentioning,
sheet,
} from "../support/helpers/sheet";
import {
closeMobileExplorer,
expectMobileExplorerHidden,
expectMobileExplorerVisible,
openMobileAgentSidebar,
selectWorkspaceInSidebar,
} from "../support/helpers/sidebar";
import { getServerId } from "../support/helpers/server-id";
const WIDE = { width: 1600, height: 900 };
const COMPACT = { width: 390, height: 844 };
const AGENT_TITLE = "Layout agent";
const FILE_LINK = "README.md:1";
const NO_FILE = "Focus a file to see its outline";
const REPO_FILES = [
{ path: "README.md", content: "# Guide\n\n## Install\n" },
{ path: "notes.md", content: "# Notes\n\n## Open questions\n" },
{ path: "src/app.ts", content: "// TODO: handle errors\nexport const ready = true;\n" },
];
const REVIEW_TAB = "workspace-tab-plugin_agent_16_workspace-layout_6_review_";
const FINDINGS_TAB = "workspace-tab-plugin_workspace_16_workspace-layout_8_findings";
const OUTLINE_TAB = "workspace-tab-plugin_workspace_16_workspace-layout_7_outline";
async function withLayoutExample(
initialPrompt: string | undefined,
run: (agent: { agentId: string; workspaceId: string }) => Promise<void>,
): Promise<void> {
const example = await copyPluginExample("workspace-layout");
const workspace = await seedMockAgentWorkspace({
repoPrefix: "plugin-workspace-layout-",
title: AGENT_TITLE,
repo: { files: REPO_FILES },
initialPrompt,
});
try {
await withPluginInstalled(example.directory, () => run(workspace));
} finally {
await workspace.cleanup();
await example.cleanup();
}
}
async function withPluginInstalled(directory: string, run: () => Promise<void>): Promise<void> {
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previous = await client.getDaemonConfig();
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await run();
} finally {
await client.removePlugin("workspace-layout").catch(() => undefined);
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled ?? false });
await client.close();
}
}
/** `/open-elsewhere <id>` opens a file in that workspace, then one where the command ran. */
const OPEN_ELSEWHERE_ENTRY = `import type { PluginClientContext } from "@getpaseo/plugin/client";
export default function contribute(client: PluginClientContext) {
client.addSlashCommand({
name: "open-elsewhere",
description: "Open a file there, then one here",
argumentHint: "<workspaceId>",
context: "agent",
onSubmit({ args, workspaceLayout }) {
const there = client.workspaceLayout(args.trim());
there.open({ panelId: "paseo/file", params: { path: "README.md" } });
workspaceLayout.open({ panelId: "paseo/file", params: { path: "notes.md" } });
},
});
return () => {};
}
`;
async function withTwoWorkspaces(
run: (workspaces: {
first: { agentId: string; workspaceId: string };
second: { agentId: string; workspaceId: string };
}) => Promise<void>,
): Promise<void> {
const example = await copyPluginExample("workspace-layout");
await writeFile(path.join(example.directory, "index.client.tsx"), OPEN_ELSEWHERE_ENTRY);
const seed = (title: string) =>
seedMockAgentWorkspace({
repoPrefix: "plugin-workspace-layout-",
title,
repo: { files: REPO_FILES },
});
const first = await seed("First agent");
const second = await seed("Second agent");
try {
await withPluginInstalled(example.directory, () => run({ first, second }));
} finally {
await second.cleanup();
await first.cleanup();
await example.cleanup();
}
}
/** Picks a workspace in a phone's agent list. */
async function switchToWorkspace(page: Page, workspaceId: string): Promise<void> {
await openMobileAgentSidebar(page);
await selectWorkspaceInSidebar(page, workspaceId);
await expect(
page.getByTestId(`workspace-deck-entry-${getServerId()}:${workspaceId}`),
).toBeVisible();
await expect(composerIn(page.locator("body"))).toBeEditable({ timeout: 30_000 });
}
function mainPanes(page: Page): Locator {
return page.locator('[data-testid^="workspace-pane-"]').filter({ visible: true });
}
function explorer(page: Page): Locator {
return page.getByTestId("workspace-explorer-sidebar");
}
function agentTabs(scope: Locator): Locator {
return scope.locator('[data-testid^="workspace-tab-agent_"]');
}
function composerIn(scope: Locator): Locator {
return scope.getByRole("textbox", { name: "Message agent..." }).filter({ visible: true });
}
async function sendToMainChat(page: Page, text: string): Promise<void> {
const composer = composerIn(mainPanes(page).first());
await expect(composer).toBeEditable({ timeout: 30_000 });
await composer.fill(text);
await composer.press("Enter");
}
async function expectAsideChat(page: Page, input: { message: string; tabs: number }) {
const chats = agentTabs(explorer(page));
await expect(chats).toHaveCount(input.tabs, { timeout: 30_000 });
await expect(chats.last()).toHaveAttribute("aria-selected", "true");
await expect(
explorer(page).getByTestId("user-message").getByText(input.message, { exact: true }),
).toBeVisible();
await expect(composerIn(explorer(page))).toBeEditable();
}
/** Every visible tab chip, pane by pane, to compare the arrangement before and after. */
async function tabsByPane(page: Page): Promise<string[][]> {
const scopes = [...(await mainPanes(page).all()), explorer(page)];
return Promise.all(
scopes.map((scope) =>
scope
.getByTestId("workspace-tabs-row")
.locator('[data-testid^="workspace-tab-"]:not([data-testid^="workspace-tab-tooltip"])')
.evaluateAll((chips) => chips.map((chip) => chip.getAttribute("data-testid") ?? "")),
),
);
}
async function expectReviewLayout(page: Page, agentId: string): Promise<void> {
await expect(mainPanes(page)).toHaveCount(2);
const left = mainPanes(page).first();
const right = mainPanes(page).last();
await expect(left.getByTestId(`workspace-tab-agent_${agentId}`)).toBeVisible();
const review = right.getByTestId(`${REVIEW_TAB}${agentId.length}_${agentId}`);
await expect(review).toHaveAttribute("aria-selected", "true");
await expect(right.getByText(`Reviewing ${AGENT_TITLE}`, { exact: true })).toBeVisible();
await expect(right.getByTestId("workspace-tab-working_diff")).toHaveAttribute(
"aria-selected",
"false",
);
await expect(explorer(page).getByTestId(FINDINGS_TAB)).toBeVisible();
const [leftBox, rightBox] = [await left.boundingBox(), await right.boundingBox()];
if (!leftBox || !rightBox) throw new Error("Review layout panes have no bounds");
expect(rightBox.x).toBeGreaterThan(leftBox.x);
expect(rightBox.width / (leftBox.width + rightBox.width)).toBeCloseTo(0.4, 1);
}
async function openFileInFocusedPane(page: Page, name: string): Promise<void> {
await openFileExplorer(page);
await openFileFromExplorer(page, name);
await expect(mainPanes(page).getByTestId(`workspace-tab-file_${name}`)).toBeVisible();
}
async function expectOutline(page: Page, lines: string[]): Promise<void> {
const outline = page.getByTestId("workspace-layout-outline");
for (const line of lines) {
await expect(outline.getByText(line, { exact: true })).toHaveCount(1);
}
}
test("the workspace layout example arranges a wide workspace", async ({ page }) => {
test.setTimeout(180_000);
await withLayoutExample(undefined, async ({ agentId, workspaceId }) => {
await page.setViewportSize(WIDE);
await openAgentRoute(page, { workspaceId, agentId });
await test.step("/aside opens the child agent's chat in the Explorer", async () => {
await sendToMainChat(page, "/aside hey");
await expectAsideChat(page, { message: "hey", tabs: 1 });
await expect(agentTabs(mainPanes(page))).toHaveCount(1);
});
await test.step("a second /aside adds a second tab", async () => {
await sendToMainChat(page, "/aside again");
await expectAsideChat(page, { message: "again", tabs: 2 });
await expect(agentTabs(mainPanes(page))).toHaveCount(1);
});
await test.step("Review layout splits the workspace, and running it again changes nothing", async () => {
await runCommand(page, "Review layout");
await expectReviewLayout(page, agentId);
const arranged = await tabsByPane(page);
await mainPanes(page).first().getByTestId(`workspace-tab-agent_${agentId}`).click();
await runCommand(page, "Review layout");
await expectReviewLayout(page, agentId);
expect(await tabsByPane(page)).toEqual(arranged);
});
await test.step("the outline follows the focused file across split panes", async () => {
await mainPanes(page).first().getByTestId(`workspace-tab-agent_${agentId}`).click();
await runCommand(page, "Show outline");
await expectOutline(page, [NO_FILE]);
await openFileInFocusedPane(page, "README.md");
await explorer(page).getByTestId(OUTLINE_TAB).click();
await expectOutline(page, ["README.md", "Guide", "Install"]);
await runWorkspaceActionFromCommandCenter(page, "Split pane right");
await expect(mainPanes(page)).toHaveCount(3);
await openFileInFocusedPane(page, "notes.md");
await explorer(page).getByTestId(OUTLINE_TAB).click();
await expectOutline(page, ["notes.md", "Notes", "Open questions"]);
await mainPanes(page).getByTestId("workspace-tab-file_README.md").click();
await expectOutline(page, ["README.md", "Guide", "Install"]);
});
});
});
test("the workspace layout example opens over a phone's chat", async ({ page }) => {
test.setTimeout(180_000);
await withLayoutExample(promptMentioning(FILE_LINK), async ({ agentId, workspaceId }) => {
await page.setViewportSize(COMPACT);
await openAgentRoute(page, { workspaceId, agentId });
await test.step("/aside opens the Explorer over the chat", async () => {
await submitMessageWithButton(page, "/aside hey");
await expectMobileExplorerVisible(page);
await expectAsideChat(page, { message: "hey", tabs: 1 });
await closeMobileExplorer(page);
await expectMobileExplorerHidden(page);
await expect(
page.getByRole("button", { name: "Switch tabs (1 open)" }).filter({ visible: true }),
).toBeVisible();
});
await test.step("a file sheet updates the outline, and closing it restores it", async () => {
await openMobileAgentSidebar(page);
const commandCenter = await openCommandCenter(page);
await commandCenter.getByTestId("command-center-input").fill("Show outline");
await commandCenter.getByRole("button", { name: "Show outline", exact: true }).click();
await expectMobileExplorerVisible(page);
await expectOutline(page, [NO_FILE]);
await closeMobileExplorer(page);
await expectMobileExplorerHidden(page);
await page.getByText(FILE_LINK, { exact: true }).first().click();
await expect(sheet(page, "README.md")).toBeVisible();
// The sheet covers the Explorer, so the outline can only be read, not seen.
await expectOutline(page, ["README.md", "Guide", "Install"]);
await closeSheet(page, "README.md");
await expectOutline(page, [NO_FILE]);
});
});
});
test("a file a plugin opens in another workspace waits there on a phone", async ({ page }) => {
test.setTimeout(180_000);
await withTwoWorkspaces(async ({ first, second }) => {
await page.setViewportSize(COMPACT);
// Visiting the first workspace leaves its screen mounted behind the second.
await openAgentRoute(page, first);
await expect(composerIn(page.locator("body"))).toBeEditable({ timeout: 30_000 });
await switchToWorkspace(page, second.workspaceId);
await test.step("only the sheet of the workspace on screen is shown", async () => {
await submitMessageWithButton(page, `/open-elsewhere ${first.workspaceId}`);
await expect(sheet(page, "notes.md")).toBeVisible();
await expectOneSheetOpen(page);
await closeSheet(page, "notes.md");
await expectNoSheetOpen(page);
});
await test.step("the other sheet is there when the user goes to its workspace", async () => {
await switchToWorkspace(page, first.workspaceId);
await expect(sheet(page, "README.md")).toBeVisible();
await expectOneSheetOpen(page);
await closeSheet(page, "README.md");
await expectNoSheetOpen(page);
});
});
});
@@ -0,0 +1,605 @@
import { mkdir } from "node:fs/promises";
import path from "node:path";
import type { Locator } from "@playwright/test";
import { expect, test, type Page } from "../support/fixtures";
import { expectAgentIdle, expectAgentReadyToInterrupt } from "../support/helpers/agent-stream";
import {
drillIntoProvider,
expectComposerMode,
expectComposerModel,
openModelPicker,
selectModelRow,
} from "../support/helpers/agent-profiles";
import { expectWorkspaceAgentConfiguration } from "../support/helpers/command-center-agent-controls";
import {
expectComposerVisible,
expectQueuedMessageButton,
submitMessage,
submitMessageWithButton,
} from "../support/helpers/composer";
import { connectDaemonClient } from "../support/helpers/daemon-client-loader";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { userScrollsTimelineToHistoryStart } from "../support/helpers/timeline-pagination";
const DIRECT_PROVIDER = {
id: "direct-example",
label: "Direct provider example",
pluginId: "provider-direct-example",
modelId: "example-1",
modelLabel: "Example 1",
modeLabel: "Build",
} as const;
// Disable external CLIs so the E2E host deterministically exposes only Mock +
// the installed Direct provider plugin on both developer machines and CI.
test.use({
e2eDaemonConfig: {
version: 1,
agents: {
providers: {
claude: { enabled: false },
codex: { enabled: false },
copilot: { enabled: false },
opencode: { enabled: false },
pi: { enabled: false },
omp: { enabled: false },
antigravity: { enabled: false },
hoplite: { enabled: false },
},
},
},
});
interface PluginInstallDaemonClient {
connect(): Promise<void>;
close(): Promise<void>;
getDaemonConfig(): Promise<{ config: { pluginsEnabled?: boolean } }>;
patchDaemonConfig(config: { pluginsEnabled?: boolean }): Promise<unknown>;
installDirectoryPlugin(directory: string): Promise<unknown>;
removePlugin(pluginId: string): Promise<void>;
getProvidersSnapshot(): Promise<{
entries: Array<{ provider: string; available?: boolean }>;
}>;
}
async function hasDirectProvider(client: PluginInstallDaemonClient): Promise<boolean> {
const snapshot = await client.getProvidersSnapshot();
return snapshot.entries.some((entry) => entry.provider === DIRECT_PROVIDER.id);
}
async function expectSwitchMarkerCountAfterScroll(page: Page, expected: number): Promise<void> {
await expect
.poll(
async () => {
await userScrollsTimelineToHistoryStart(page);
return await page.getByTestId("provider-switch-marker").count();
},
{ timeout: 30_000 },
)
.toBe(expected);
}
async function captureQaScreenshot(page: Page, fileName: string): Promise<void> {
const dir = process.env.PASEO_QA_SCREENSHOT_DIR?.trim();
if (!dir) return;
await mkdir(dir, { recursive: true });
await page.screenshot({ path: path.join(dir, fileName), fullPage: false });
}
async function expectNoHorizontalOverflow(page: Page): Promise<void> {
const overflow = await page.evaluate(() => {
const doc = document.documentElement;
return Math.ceil(doc.scrollWidth - doc.clientWidth);
});
expect(overflow).toBeLessThanOrEqual(1);
}
async function startSwitchOrderGuard(page: Page): Promise<void> {
await page.evaluate(() => {
const violations: string[] = [];
let stopped = false;
const step = () => {
const msgs = Array.from(document.querySelectorAll('[data-testid="user-message"]'));
const markers = Array.from(
document.querySelectorAll('[data-testid="provider-switch-marker"]'),
);
const banner = document.querySelector('[data-testid="staged-provider-switch-banner"]');
if (msgs.length >= 2) {
const secondMsg = msgs[msgs.length - 1];
const lastMarker = markers[markers.length - 1];
if (!lastMarker) {
violations.push("user-message painted without switch marker");
} else {
const msgRect = secondMsg.getBoundingClientRect();
const markerRect = lastMarker.getBoundingClientRect();
if (markerRect.top > msgRect.top) {
violations.push(
`switch marker painted below user-message (${Math.round(markerRect.top)} > ${Math.round(msgRect.top)})`,
);
}
}
if (banner && banner.getBoundingClientRect().height > 0) {
violations.push("staged-provider-switch-banner stayed visible after submit");
}
}
if (!stopped) requestAnimationFrame(step);
};
requestAnimationFrame(step);
(window as unknown as { __stopSwitchOrderGuard?: () => string[] }).__stopSwitchOrderGuard =
() => {
stopped = true;
return violations;
};
});
}
async function stopSwitchOrderGuard(page: Page): Promise<string[]> {
return await page.evaluate(
() =>
(
window as unknown as { __stopSwitchOrderGuard?: () => string[] }
).__stopSwitchOrderGuard?.() ?? [],
);
}
async function completeMockTurn(
page: Page,
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
prompt: string,
): Promise<Locator> {
await submitMessage(page, prompt);
const userMessage = page.getByTestId("user-message").filter({ hasText: prompt });
await expect(userMessage).toBeVisible({ timeout: 30_000 });
const finish = await agent.client.waitForFinish(agent.agentId, 30_000);
expect(finish.status).toBe("idle");
await expectAgentIdle(page);
await expect(userMessage).toHaveAttribute("aria-busy", "false");
return userMessage;
}
async function completeDirectTurn(
page: Page,
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
prompt: string,
options?: { useSendButton?: boolean },
): Promise<Locator> {
if (options?.useSendButton) {
await submitMessageWithButton(page, prompt);
} else {
await submitMessage(page, prompt);
}
const userMessage = page.getByTestId("user-message").filter({ hasText: prompt });
await expect(userMessage).toBeVisible({ timeout: 30_000 });
const finish = await agent.client.waitForFinish(agent.agentId, 30_000);
expect(finish.status).toBe("idle");
await expectAgentIdle(page);
await expect(userMessage).toHaveAttribute("aria-busy", "false");
return userMessage;
}
async function stageProviderDesktop(
page: Page,
providerId: string,
modelId: string,
): Promise<void> {
await openModelPicker(page);
const picker = page.getByTestId("combobox-desktop-container");
const backButton = picker.getByTestId("sheet-header-back");
if (await backButton.isVisible()) {
await backButton.click();
}
await drillIntoProvider(page, providerId);
await selectModelRow(page, { provider: providerId, modelId });
await expect(page.getByTestId("staged-provider-switch-banner")).toBeVisible({ timeout: 30_000 });
}
async function stageDirectProviderDesktop(page: Page): Promise<void> {
await stageProviderDesktop(page, DIRECT_PROVIDER.id, DIRECT_PROVIDER.modelId);
}
async function stageDirectProviderCompact(page: Page): Promise<void> {
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
await expect(page.getByTestId("agent-controls-model")).toBeVisible({ timeout: 30_000 });
await page.getByTestId("agent-controls-model").click();
const modelPage = page.getByTestId("mobile-model-page");
await expect(modelPage).toBeVisible({ timeout: 30_000 });
const collapsedProvider = modelPage.getByTestId(`model-provider-${DIRECT_PROVIDER.id}`);
if (await collapsedProvider.isVisible()) {
await collapsedProvider.click();
}
await modelPage.getByTestId(`model-row-${DIRECT_PROVIDER.id}-${DIRECT_PROVIDER.modelId}`).click();
await expect(page.getByTestId("agent-controls-settings-list")).toBeVisible({ timeout: 30_000 });
// Dismiss the agent-controls sheet so the composer and banner are ready to submit.
await page.getByRole("button", { name: "Close", exact: true }).last().click();
await expect(page.getByTestId("agent-controls-model")).toHaveCount(0, { timeout: 30_000 });
await expect(page.getByTestId("staged-provider-switch-banner")).toBeVisible({ timeout: 30_000 });
}
async function rewindConversation(page: Page, userMessage: Locator, prompt: string): Promise<void> {
await userMessage.getByText(prompt, { exact: true }).hover();
await userMessage.getByRole("button", { name: "Rewind to this message", exact: true }).click();
await page.getByRole("menuitem", { name: "Rewind conversation", exact: true }).click();
}
test.describe.serial("Provider switching in chat", () => {
let pluginClient: PluginInstallDaemonClient;
let pluginFixture: Awaited<ReturnType<typeof copyPluginExample>>;
let previousPluginsEnabled: boolean | undefined;
test.beforeAll(async () => {
pluginClient = await connectDaemonClient<PluginInstallDaemonClient>({
clientIdPrefix: "provider-switching-e2e",
});
pluginFixture = await copyPluginExample("provider-direct");
previousPluginsEnabled = (await pluginClient.getDaemonConfig()).config.pluginsEnabled;
await pluginClient.patchDaemonConfig({ pluginsEnabled: true });
await pluginClient.installDirectoryPlugin(pluginFixture.directory);
await expect.poll(() => hasDirectProvider(pluginClient), { timeout: 30_000 }).toBe(true);
});
test.afterAll(async () => {
await pluginClient?.removePlugin(DIRECT_PROVIDER.pluginId).catch(() => undefined);
await pluginClient
?.patchDaemonConfig({ pluginsEnabled: previousPluginsEnabled })
.catch(() => undefined);
await pluginClient?.close().catch(() => undefined);
await pluginFixture?.cleanup().catch(() => undefined);
});
test("stages, cancels, switches providers, inspects marker, scopes rewind, and survives reload", async ({
page,
}) => {
test.setTimeout(150_000);
await page.setViewportSize({ width: 1280, height: 800 });
const preSwitchPrompt = "First prompt on Mock before switching.";
const postSwitchPrompt = "Follow up on Direct provider after switching.";
const postRewindPrompt = "Continue on Direct provider after rewinding.";
const workspace = await seedMockAgentWorkspace({
repoPrefix: "provider-switch-desktop-",
title: "Provider switch desktop",
model: "e2e-fast-stream",
modeId: "load-test",
});
try {
await openAgentRoute(page, workspace);
await expectComposerVisible(page);
await expectComposerMode(page, "Load test");
const initialUrl = page.url();
await completeMockTurn(page, workspace, preSwitchPrompt);
await test.step("staging updates only draft state and Cancel restores the live provider", async () => {
await stageDirectProviderDesktop(page);
await expectComposerModel(page, DIRECT_PROVIDER.modelLabel);
await expectComposerMode(page, DIRECT_PROVIDER.modeLabel);
await expect(page.getByTestId("staged-provider-switch-banner")).toContainText(
DIRECT_PROVIDER.label,
);
await expectWorkspaceAgentConfiguration(workspace, {
id: workspace.agentId,
provider: "mock",
model: "e2e-fast-stream",
modeId: "load-test",
});
// Editing a staged provider option must keep all staged option controls visible.
const conciseToggle = page.getByRole("button", { name: /Concise responses/i }).first();
const voiceSelect = page.getByRole("button", { name: /Voice/i }).first();
await expect(conciseToggle).toBeVisible();
await expect(voiceSelect).toBeVisible();
await conciseToggle.click();
await expect(conciseToggle).toBeVisible();
await expect(voiceSelect).toBeVisible();
await expectNoHorizontalOverflow(page);
await captureQaScreenshot(page, "desktop-staged-switch.png");
await page.getByTestId("cancel-staged-provider-switch").click();
await expect(page.getByTestId("staged-provider-switch-banner")).toHaveCount(0);
await expectComposerMode(page, "Load test");
// Returning to the live provider by choosing a different model clears the staged switch
// and applies the newly chosen model directly to the live provider.
await stageDirectProviderDesktop(page);
await openModelPicker(page);
const picker = page.getByTestId("combobox-desktop-container");
const backButton = picker.getByTestId("sheet-header-back");
if (await backButton.isVisible()) {
await backButton.click();
}
await drillIntoProvider(page, "mock");
await selectModelRow(page, { provider: "mock", modelId: "one-minute-stream" });
await expect(page.getByTestId("staged-provider-switch-banner")).toHaveCount(0);
await expectComposerModel(page, "One minute stream");
await expectWorkspaceAgentConfiguration(workspace, {
id: workspace.agentId,
provider: "mock",
model: "one-minute-stream",
modeId: "load-test",
});
});
await test.step("submitting commits the switch in place with clean user display text and inspectable marker", async () => {
await stageDirectProviderDesktop(page);
await startSwitchOrderGuard(page);
const switchedMessage = await completeDirectTurn(page, workspace, postSwitchPrompt);
expect(await stopSwitchOrderGuard(page)).toEqual([]);
expect(page.url()).toBe(initialUrl);
await expect(page.getByTestId("staged-provider-switch-banner")).toHaveCount(0);
await expectWorkspaceAgentConfiguration(workspace, {
id: workspace.agentId,
provider: DIRECT_PROVIDER.id,
model: DIRECT_PROVIDER.modelId,
modeId: "build",
});
// Clean display text: handoff summary must never leak into the visible user bubble.
await expect(switchedMessage).toContainText(postSwitchPrompt);
await expect(switchedMessage).not.toContainText("<chat-history-summary>");
// Direct provider echoes its prompt, proving bounded pre-switch context was attached.
const directReply = page
.getByTestId("assistant-message")
.filter({ hasText: "Echo:" })
.last();
await expect(directReply).toContainText(preSwitchPrompt);
await expect(directReply).toContainText(postSwitchPrompt);
// Switch marker is visible and expands to show context handoff details.
const marker = page.getByTestId("provider-switch-marker");
await expect(marker).toBeVisible({ timeout: 30_000 });
await marker.scrollIntoViewIfNeeded();
await marker.getByTestId("provider-switch-marker-toggle").click();
const details = marker.getByTestId("provider-switch-marker-details");
await expect(details).toBeVisible();
await expect(details).toContainText("Mock");
await expect(details).toContainText(DIRECT_PROVIDER.label);
await marker.scrollIntoViewIfNeeded();
await expectNoHorizontalOverflow(page);
await captureQaScreenshot(page, "desktop-switched-expanded.png");
await marker.getByTestId("provider-switch-marker-toggle").click();
await expect(details).toHaveCount(0);
});
await test.step("switching back to Mock enforces segment-scoped rewind and preserves pre-switch turns", async () => {
const backToMockPrompt = "Switch back to Mock for segment-scoped rewind.";
await stageProviderDesktop(page, "mock", "ten-second-stream");
await expect(page.getByTestId("staged-provider-switch-banner")).toContainText("Mock");
const backToMockMessage = await completeMockTurn(page, workspace, backToMockPrompt);
await expect(backToMockMessage).not.toContainText("<chat-history-summary>");
await expect(page.getByTestId("provider-switch-marker")).toHaveCount(2, {
timeout: 30_000,
});
await expectWorkspaceAgentConfiguration(workspace, {
id: workspace.agentId,
provider: "mock",
model: "ten-second-stream",
modeId: "load-test",
});
// Pre-switch prompts from earlier segments must not expose rewind even though Mock supports it.
const preSwitchMessage = page
.getByTestId("user-message")
.filter({ hasText: preSwitchPrompt });
await preSwitchMessage.scrollIntoViewIfNeeded();
await preSwitchMessage.getByText(preSwitchPrompt, { exact: true }).hover();
await expect(
preSwitchMessage.getByRole("button", { name: "Rewind to this message", exact: true }),
).toHaveCount(0);
const directMessage = page
.getByTestId("user-message")
.filter({ hasText: postSwitchPrompt });
await directMessage.scrollIntoViewIfNeeded();
await directMessage.getByText(postSwitchPrompt, { exact: true }).hover();
await expect(
directMessage.getByRole("button", { name: "Rewind to this message", exact: true }),
).toHaveCount(0);
// Post-switch prompt on Mock CAN rewind without retiring earlier segments or markers.
await backToMockMessage.scrollIntoViewIfNeeded();
await rewindConversation(page, backToMockMessage, backToMockPrompt);
await expect(
page.getByTestId("user-message").filter({ hasText: backToMockPrompt }),
).toHaveCount(0, { timeout: 30_000 });
await expect(
page.getByTestId("user-message").filter({ hasText: preSwitchPrompt }),
).toBeVisible();
await expect(
page.getByTestId("user-message").filter({ hasText: postSwitchPrompt }),
).toBeVisible();
await expect(page.getByTestId("provider-switch-marker")).toHaveCount(2);
// Continuing in the now-empty active segment completes cleanly.
const retriedMessage = await completeMockTurn(page, workspace, postRewindPrompt);
await expect(retriedMessage).not.toContainText("<chat-history-summary>");
});
await test.step("reload preserves the switched provider, markers, and rewind boundary", async () => {
await page.reload();
await expectComposerVisible(page);
await expectComposerModel(page, "Ten second stream");
await expectSwitchMarkerCountAfterScroll(page, 2);
const reloadedDirect = page
.getByTestId("user-message")
.filter({ hasText: postSwitchPrompt });
await expect(reloadedDirect).toBeVisible();
await expect(
page.getByTestId("user-message").filter({ hasText: postRewindPrompt }),
).toBeVisible();
await reloadedDirect.scrollIntoViewIfNeeded();
await reloadedDirect.getByText(postSwitchPrompt, { exact: true }).hover();
await expect(
reloadedDirect.getByRole("button", { name: "Rewind to this message", exact: true }),
).toHaveCount(0);
});
} finally {
await workspace.cleanup();
}
});
test("stages a switch mid-turn, queues the prompt, and switches cleanly between turns", async ({
page,
}) => {
test.setTimeout(150_000);
await page.setViewportSize({ width: 1280, height: 800 });
const runningPrompt = "Run a ten-second mock turn first.";
const queuedPrompt = "Queued handoff prompt for Direct provider.";
const workspace = await seedMockAgentWorkspace({
repoPrefix: "provider-switch-midturn-",
title: "Provider switch midturn",
model: "ten-second-stream",
modeId: "load-test",
});
try {
await openAgentRoute(page, workspace);
await expectComposerVisible(page);
await submitMessage(page, runningPrompt);
await expectAgentReadyToInterrupt(page);
// Stage Direct provider while Mock is actively streaming.
await stageDirectProviderDesktop(page);
await expectWorkspaceAgentConfiguration(workspace, {
id: workspace.agentId,
provider: "mock",
model: "ten-second-stream",
modeId: "load-test",
});
// Submitting queues the prompt instead of racing the live turn.
await submitMessage(page, queuedPrompt);
await expectQueuedMessageButton(page);
// Once the mock turn completes, the queue drains and commits the switch.
await expect(page.getByTestId("provider-switch-marker")).toBeVisible({ timeout: 45_000 });
await expect(page.getByTestId("staged-provider-switch-banner")).toHaveCount(0, {
timeout: 30_000,
});
await expect(
page.getByTestId("assistant-message").filter({ hasText: queuedPrompt }).last(),
).toBeVisible({ timeout: 30_000 });
await expectAgentIdle(page);
await expectWorkspaceAgentConfiguration(workspace, {
id: workspace.agentId,
provider: DIRECT_PROVIDER.id,
model: DIRECT_PROVIDER.modelId,
modeId: "build",
});
} finally {
await workspace.cleanup();
}
});
test("edits a queued switch and sends it now, cutting the running turn", async ({ page }) => {
test.setTimeout(150_000);
await page.setViewportSize({ width: 1280, height: 800 });
const queuedPrompt = "Take over now on the Direct provider.";
const workspace = await seedMockAgentWorkspace({
repoPrefix: "provider-switch-queued-edit-",
title: "Provider switch queued edit",
model: "one-minute-stream",
modeId: "load-test",
});
try {
await openAgentRoute(page, workspace);
await expectComposerVisible(page);
await submitMessage(page, "Run a one-minute mock turn first.");
await expectAgentReadyToInterrupt(page);
await stageDirectProviderDesktop(page);
const banner = page.getByTestId("staged-provider-switch-banner");
const queuedRow = page.getByRole("listitem").filter({ hasText: queuedPrompt });
await submitMessage(page, queuedPrompt);
await expect(queuedRow).toContainText(`Switches to ${DIRECT_PROVIDER.label}`);
await expect(banner).toHaveCount(0);
await captureQaScreenshot(page, "queued-provider-switch.png");
await queuedRow.getByRole("button", { name: "Edit queued message" }).click();
await expect(queuedRow).toHaveCount(0);
await expect(banner).toBeVisible();
await submitMessage(page, queuedPrompt);
await expect(queuedRow).toContainText(`Switches to ${DIRECT_PROVIDER.label}`);
await queuedRow.getByRole("button", { name: "Send queued message now" }).click();
await expect(page.getByTestId("provider-switch-marker")).toBeVisible({ timeout: 30_000 });
await expect(
page.getByTestId("assistant-message").filter({ hasText: queuedPrompt }).last(),
).toBeVisible({ timeout: 30_000 });
await expectAgentIdle(page);
await expectWorkspaceAgentConfiguration(workspace, {
id: workspace.agentId,
provider: DIRECT_PROVIDER.id,
model: DIRECT_PROVIDER.modelId,
modeId: "build",
});
} finally {
await workspace.cleanup();
}
});
test("switches providers cleanly on a compact viewport with zero horizontal overflow", async ({
page,
}) => {
test.setTimeout(150_000);
await page.setViewportSize({ width: 390, height: 844 });
const preSwitchPrompt = "Compact turn on Mock.";
const postSwitchPrompt = "Compact handoff on Direct.";
const workspace = await seedMockAgentWorkspace({
repoPrefix: "provider-switch-compact-",
title: "Provider switch compact",
model: "e2e-fast-stream",
modeId: "load-test",
});
try {
await openAgentRoute(page, workspace);
await expectComposerVisible(page);
await submitMessageWithButton(page, preSwitchPrompt);
await expect(
page.getByTestId("user-message").filter({ hasText: preSwitchPrompt }),
).toBeVisible({ timeout: 30_000 });
const firstFinish = await workspace.client.waitForFinish(workspace.agentId, 30_000);
expect(firstFinish.status).toBe("idle");
await expectAgentIdle(page);
await stageDirectProviderCompact(page);
await expectNoHorizontalOverflow(page);
await captureQaScreenshot(page, "compact-staged-switch.png");
const switchedMessage = await completeDirectTurn(page, workspace, postSwitchPrompt, {
useSendButton: true,
});
await expect(switchedMessage).not.toContainText("<chat-history-summary>");
const marker = page.getByTestId("provider-switch-marker");
await expect(marker).toBeVisible({ timeout: 30_000 });
await marker.scrollIntoViewIfNeeded();
const toggle = marker.getByTestId("provider-switch-marker-toggle");
const toggleBox = await toggle.boundingBox();
expect(toggleBox).not.toBeNull();
expect((toggleBox?.x ?? 0) + (toggleBox?.width ?? 0)).toBeLessThanOrEqual(390);
await toggle.click();
await expect(marker.getByTestId("provider-switch-marker-details")).toBeVisible();
await marker.scrollIntoViewIfNeeded();
await expectNoHorizontalOverflow(page);
await captureQaScreenshot(page, "compact-switched-expanded.png");
} finally {
await workspace.cleanup();
}
});
});
@@ -235,7 +235,7 @@ test.describe("Rewind sheet", () => {
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
await expect(userMessage(page, secondPrompt)).toHaveCount(0);
await expect(page.getByText("Cycle 1", { exact: true })).toHaveCount(0);
await expectUserMessageCount(page, 1);
await expectUserMessageCount(page, 0);
await expectComposerDraft(page, firstPrompt);
await expectComposerFocused(page);
@@ -243,7 +243,7 @@ test.describe("Rewind sheet", () => {
await expectUserMessageVisible(page, replacementPrompt);
await expect(userMessage(page, secondPrompt)).toHaveCount(0);
await expect(page.getByText("Cycle 1", { exact: true })).toHaveCount(0);
await expectUserMessageCount(page, 2);
await expectUserMessageCount(page, 1);
await fillComposerDraft(page, "");
await composerLocator(page).evaluate((element) => element.blur());
@@ -254,7 +254,19 @@ test.describe("Rewind sheet", () => {
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
await expectComposerDraft(page, "");
await expectComposerNotFocused(page);
await expectUserMessageCount(page, 2);
await expectUserMessageCount(page, 1);
const preservedDraft = "Keep this human draft after rewind.";
await fillComposerDraft(page, preservedDraft);
await composerLocator(page).evaluate((element) => element.blur());
await userMessage(page, replacementPrompt).hover();
await page.getByTestId("rewind-menu-trigger").last().click();
await expect(page.getByTestId("rewind-menu-content")).toBeVisible();
await selectRewindOption(page, "Rewind files");
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
await expectComposerDraft(page, preservedDraft);
await expectComposerNotFocused(page);
await expectUserMessageCount(page, 1);
await fillComposerDraft(page, "");
await composerLocator(page).evaluate((element) => element.blur());
@@ -265,7 +277,7 @@ test.describe("Rewind sheet", () => {
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
await expectComposerDraft(page, replacementPrompt);
await expectComposerFocused(page);
await expectUserMessageCount(page, 1);
await expectUserMessageCount(page, 0);
} finally {
await session.cleanup();
}
@@ -1,3 +1,4 @@
import { createServer, type Socket } from "node:net";
import { expect, test, type Page } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { addScheduleHostAndReload, createScheduleHost } from "../support/helpers/schedule-host";
@@ -141,6 +142,68 @@ async function findScheduleIdByName(workspace: SeededWorkspace, name: string): P
return schedule.id;
}
async function createConnectingHost() {
const sockets = new Set<Socket>();
// Accept TCP without completing the WebSocket handshake, like a stalled host.
const server = createServer((socket) => {
sockets.add(socket);
socket.on("close", () => sockets.delete(socket));
});
await new Promise<void>((resolve, reject) => {
server.once("error", reject);
server.listen(0, "127.0.0.1", resolve);
});
const address = server.address();
if (!address || typeof address === "string") throw new Error("Expected a TCP address");
return {
port: address.port,
close: async () => {
for (const socket of sockets) socket.destroy();
await new Promise<void>((resolve, reject) => {
server.close((error) => {
if (error) {
reject(error);
return;
}
resolve();
});
});
},
};
}
async function openSchedulesWithConnectingHost(
page: Page,
cleanupTasks: Array<() => Promise<void>>,
): Promise<void> {
const workspace = await seedWorkspace({ repoPrefix: "schedule-partial-hosts-", git: false });
cleanupTasks.push(() => workspace.cleanup());
const stalledHost = await createConnectingHost();
cleanupTasks.push(() => stalledHost.close());
await gotoAppShell(page);
await waitForSidebarHydration(page);
await page.goto(buildSchedulesRoute());
await addScheduleHostAndReload({
page,
serverId: "stalled-schedule-host",
label: "Connecting host",
port: stalledHost.port,
});
}
async function expectPartialEmptySchedules(page: Page): Promise<void> {
await expect(page.getByText("No active schedules", { exact: true })).toBeVisible();
await expect(page.getByText("Connecting host: Still connecting", { exact: true })).toBeVisible();
await expect(page.getByRole("button", { name: "New schedule", exact: true })).toBeVisible();
}
async function expectScheduleCreationAvailable(page: Page): Promise<void> {
await openNewScheduleSheet(page);
await page.getByRole("button", { name: "Cancel", exact: true }).click();
await expect(page.getByTestId("schedule-form-sheet")).toHaveCount(0);
}
test.describe("Schedules project target", () => {
const cleanupTasks: Array<() => Promise<void>> = [];
@@ -151,6 +214,12 @@ test.describe("Schedules project target", () => {
cleanupTasks.length = 0;
});
test("shows empty schedules while another host is still connecting", async ({ page }) => {
await openSchedulesWithConnectingHost(page, cleanupTasks);
await expectPartialEmptySchedules(page);
await expectScheduleCreationAvailable(page);
});
test("dismisses the new schedule sheet without reopening", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "schedule-sheet-dismiss-", git: false });
cleanupTasks.push(() => workspace.cleanup());
@@ -35,7 +35,13 @@ import {
expectSettingsHeader,
openAddHostFlow,
selectHostConnectionType,
toggleHostAdvanced,
selectDirectConnectionMode,
expectDirectConnectionMode,
expectDirectFormModeDisabled,
connectDirectHost,
connectDirectHostExpectingPassword,
pasteIntoDirectHost,
fillDirectHostPromptPassword,
openCompactSettings,
expectCompactSettingsList,
expectSettingsSidebarVisible,
@@ -50,11 +56,11 @@ import {
fillDirectHostUri,
expectDirectHostFormValues,
expectDirectHostSslEnabled,
expectDirectHostSslDisabled,
fillDirectHostAddress,
toggleDirectHostSsl,
expectDirectHostUriValue,
expectDirectHostUriHidden,
expectDirectFormFullyVisible,
expectDiagnosticsContent,
expectAboutContent,
expectGeneralContent,
@@ -71,6 +77,7 @@ import {
bindCommandCenterToEnter,
} from "../support/helpers/settings";
import { getServerId } from "../support/helpers/server-id";
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
import { expectAppRoute } from "../support/helpers/route-assertions";
import { clickNewChat, gotoWorkspace } from "../support/helpers/launcher";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
@@ -327,44 +334,105 @@ test.describe("Settings sidebar navigation", () => {
await verifyLegacyHostSettingsRedirect(page);
});
test("direct connection advanced URI round-trips SSL and password into the form", async ({
page,
}) => {
test("direct connection converts between Form and URI modes", async ({ page }) => {
await gotoAppShell(page);
await openSettings(page);
await openAddHostFlow(page);
await expectAddHostMethodOptions(page);
await selectHostConnectionType(page, "direct");
await expectDirectConnectionMode(page, "Form");
await fillDirectHostAddress(page, "example.paseo.test", "7443");
await expectDirectHostSslDisabled(page);
await toggleDirectHostSsl(page);
await expectDirectHostSslEnabled(page);
await toggleHostAdvanced(page);
await expectDirectHostUriValue(page, "tcp://example.paseo.test:7443?ssl=true");
await toggleHostAdvanced(page);
await toggleDirectHostSsl(page);
await expectDirectHostSslDisabled(page);
await toggleHostAdvanced(page);
await fillDirectHostUri(page, "tcp://example.paseo.test:7443?ssl=true&password=shared-secret");
await toggleHostAdvanced(page);
await expectDirectHostFormValues(page, {
host: "example.paseo.test",
port: "7443",
password: "shared-secret",
await test.step("Form fields become a URI", async () => {
await fillDirectHostAddress(page, "example.paseo.test", "7443");
await toggleDirectHostSsl(page);
await selectDirectConnectionMode(page, "URI");
await expectDirectHostUriValue(page, "tcp://example.paseo.test:7443?ssl=true");
});
await expectDirectHostSslEnabled(page);
await expectDirectHostUriHidden(page);
await toggleHostAdvanced(page);
await expectDirectHostUriValue(
page,
"tcp://example.paseo.test:7443?ssl=true&password=shared-secret",
);
await toggleHostAdvanced(page);
await expectDirectHostUriHidden(page);
await test.step("a URI becomes Form fields", async () => {
await fillDirectHostUri(
page,
"tcp://example.paseo.test:7443?ssl=true&password=shared-secret",
);
await selectDirectConnectionMode(page, "Form");
await expectDirectHostFormValues(page, {
host: "example.paseo.test",
port: "7443",
password: "shared-secret",
});
await expectDirectHostSslEnabled(page);
await expectDirectHostUriHidden(page);
});
await test.step("a pairing link pasted into Host stays a URI", async () => {
const link = "relay://relay.paseo.test:443/srv_e2e_pairing?key=daemon-key&ssl=true";
await pasteIntoDirectHost(page, link);
await expectDirectConnectionMode(page, "URI");
await expectDirectHostUriValue(page, link);
await expectDirectFormModeDisabled(page);
});
});
test("direct connection connects to a URI with Host blank", async ({ page }) => {
await gotoAppShell(page);
await openSettings(page);
await openAddHostFlow(page);
await selectHostConnectionType(page, "direct");
await selectDirectConnectionMode(page, "URI");
await fillDirectHostUri(page, `tcp://127.0.0.1:${getE2EDaemonPort()}`);
await connectDirectHost(page);
});
test("direct connection connects to an edited URI instead of the form", async ({ page }) => {
await gotoAppShell(page);
await openSettings(page);
await openAddHostFlow(page);
await selectHostConnectionType(page, "direct");
await fillDirectHostAddress(page, "127.0.0.1", "9");
await selectDirectConnectionMode(page, "URI");
await expectDirectHostUriValue(page, "tcp://127.0.0.1:9");
await fillDirectHostUri(page, `tcp://127.0.0.1:${getE2EDaemonPort()}`);
await connectDirectHost(page);
});
test("direct connection sends the password in a URI and asks again when it is wrong", async ({
page,
}) => {
const password = "e2e uri password";
const daemon = await startIsolatedHostDaemon("srv_e2e_uri_password_host", {
environment: { ...process.env, PASEO_PASSWORD: password },
});
try {
await gotoAppShell(page);
await openSettings(page);
await test.step("a URI with the password connects with one tap", async () => {
await openAddHostFlow(page);
await selectHostConnectionType(page, "direct");
await selectDirectConnectionMode(page, "URI");
await fillDirectHostUri(
page,
`tcp://127.0.0.1:${daemon.port}?password=${encodeURIComponent(password)}`,
);
await connectDirectHost(page);
});
await test.step("a wrong password asks for the host's password inline", async () => {
await openAddHostFlow(page);
await selectHostConnectionType(page, "direct");
await selectDirectConnectionMode(page, "URI");
await fillDirectHostUri(page, `tcp://127.0.0.1:${daemon.port}?password=wrong`);
await connectDirectHostExpectingPassword(page, `127.0.0.1:${daemon.port}`);
await fillDirectHostPromptPassword(page, password);
await connectDirectHost(page);
});
} finally {
await daemon.close();
}
});
test("Escape lets settings dropdowns and modals close before leaving settings", async ({
@@ -697,3 +765,16 @@ test("docked navigation keeps its density and Settings preserves reading width",
await expectSettingsSidebarHidden(page);
await expectAppearanceContent(page);
});
test.describe("Settings — small phone", () => {
test.use({ viewport: { width: 360, height: 640 } });
test("direct connection shows the whole form above Cancel and Connect", async ({ page }) => {
await gotoAppShell(page);
await openCompactSidebar(page);
await openSettingsFromCompactSidebar(page);
await openAddHostFlow(page);
await selectHostConnectionType(page, "direct");
await expectDirectFormFullyVisible(page);
});
});
@@ -46,7 +46,7 @@ import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-
import { addConnectedHostAndReload, addOfflineHostAndReload } from "../support/helpers/hosts";
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
const LOADING_WORKSPACE_TEXT_PATTERN = /Loading workspace/i;
const LOADING_WORKSPACE_TEST_ID = "workspace-loading";
async function expectNoLoadingWorkspacePane(
page: Page,
input: { label: string; durationMs?: number },
@@ -63,7 +63,7 @@ async function expectNoLoadingWorkspacePane(
.catch((error) => `[body unavailable: ${error instanceof Error ? error.message : error}]`);
samples.push(`${Date.now() - startedAt}ms ${url}\n${text.slice(0, 1000)}`);
if (LOADING_WORKSPACE_TEXT_PATTERN.test(text)) {
if ((await page.getByTestId(LOADING_WORKSPACE_TEST_ID).count()) > 0) {
throw new Error(
`${input.label}: loading workspace pane appeared during reconnect window.\n\n${samples.join(
"\n\n---\n\n",
@@ -76,7 +76,7 @@ async function expectNoLoadingWorkspacePane(
}
async function expectNoLoadingPane(page: Page): Promise<void> {
await expect(page.getByText(LOADING_WORKSPACE_TEXT_PATTERN)).toHaveCount(0);
await expect(page.getByTestId(LOADING_WORKSPACE_TEST_ID)).toHaveCount(0);
}
async function getVisibleDraftTabCount(page: Page): Promise<number> {
@@ -1,7 +1,7 @@
// Composer autocomplete placement on iOS with the software keyboard: chat, workspace
// draft tab, and New workspace. Run where agent-device reaches the simulator, with the
// development app connected to the fixture host. See docs/mobile-testing.md.
import { execFileSync } from "node:child_process";
import { execFileSync, spawn } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import process from "node:process";
@@ -391,6 +391,222 @@ async function runControlTaps() {
);
}
// Fullscreen is a layout mode of the same mounted editor: the toggle keeps its focus and
// the keyboard, and each mode lands at its resting place. A focus loss used to close
// the keyboard on every toggle, and a stale keyboard lift left the fullscreen composer
// 310pt above the screen with only Send visible. Sample for a while after each
// toggle, because the stale lift could land late.
const fullscreenDraft = Array.from(
{ length: 8 },
(_, line) => `Line ${line + 1} of the fullscreen draft`,
).join("\n");
async function assertFullscreenToggleHolds(name, place) {
const deadline = Date.now() + 2_500;
let samples = 0;
while (Date.now() < deadline || samples < 3) {
const snap = snapshot(`${name}-${samples}`);
samples += 1;
// A dismissed keyboard stays in the tree for a while, parked below the screen.
const screen = snap.data.nodes.find((node) => node.type === "Application").rect;
if (!keyboardShown(snap) || keyboardTop(snap) >= screen.y + screen.height)
throw new Error(`${name}: the toggle closed the keyboard`);
const problem = place(snap, keyboardTop(snap));
if (problem) throw new Error(`${name}: ${problem}`);
}
process.stdout.write(`PASS ${name}: keyboard open and placement held over ${samples} samples\n`);
}
// New workspace submits with Create where a chat has Send.
const sendButton = (snap) =>
snap.data.nodes.find(
(node) =>
node.type === "Button" &&
node.rect &&
(node.label === "Send message" || node.identifier === "workspace-create-submit"),
)?.rect;
const enteredFullscreen = (snap, keyboard) => {
const frame = nodeById(snap, "composer-fullscreen")?.rect;
const send = sendButton(snap);
if (!frame || !send) return "fullscreen composer or Send is missing";
// The frame fills the screen below the safe area, behind the keyboard.
if (frame.y < 0 || frame.y + frame.height < keyboard)
return `fullscreen composer spans ${Math.round(frame.y)}-${Math.round(frame.y + frame.height)}, not the screen behind the keyboard at ${Math.round(keyboard)}`;
if (send.y + send.height > keyboard + 1)
return `Send ends at ${Math.round(send.y + send.height)}, below the keyboard at ${Math.round(keyboard)}`;
return null;
};
// Leaving fullscreen returns the composer to where it rested on the keyboard before.
const exitedFullscreen = (resting) => (snap) => {
if (nodeById(snap, "composer-fullscreen")) return "still fullscreen";
const composer = nodeById(snap, "message-input-root")?.rect;
if (!composer) return "composer is missing";
const bottom = composer.y + composer.height;
if (Math.abs(bottom - resting) > 1)
return `composer ends at ${Math.round(bottom)}, not at its resting ${Math.round(resting)}`;
return null;
};
// Snapshots sample about once a second, so they cannot see one wrong frame. Record the
// screen through a run of toggles instead: Send has one place inline and one in
// fullscreen, and every recorded frame must draw it at one of the two. A keyboard lift
// that landed a frame after its layout drew Send 310pt higher for that frame. Needs
// ffmpeg on the PATH.
async function assertSendHoldsEveryFrame(name, { screen, keyboard, sends, toggle }) {
const video = path.join(artifactsDir, `${name.replaceAll(" ", "-")}.mp4`);
const recorder = spawn(
"xcrun",
["simctl", "io", udid ?? "booted", "recordVideo", "--codec", "h264", "--force", video],
{ stdio: ["ignore", "ignore", "pipe"] },
);
const finished = new Promise((resolve) => recorder.once("exit", resolve));
await new Promise((resolve, reject) => {
recorder.stderr.on("data", (chunk) => {
if (String(chunk).includes("Recording started")) resolve();
});
finished.then(() => reject(new Error(`${name}: the screen recording did not start`)));
});
// The first frame is the settled inline composer.
await sleep(500);
await toggle();
await sleep(1_000);
recorder.kill("SIGINT");
await finished;
// Decode the column of the screen that holds Send in both modes, one pixel per point.
const left = Math.floor(Math.min(...sends.map((send) => send.x)));
const right = Math.ceil(Math.max(...sends.map((send) => send.x + send.width)));
const width = right - left;
const height = Math.round(screen.height);
const column = `crop=iw*${width / screen.width}:ih:iw*${left / screen.width}:0,scale=${width}:${height}`;
const pixels = execFileSync(
"ffmpeg",
["-loglevel", "fatal", "-i", video, "-fps_mode", "passthrough", "-vf", column].concat([
"-f",
"rawvideo",
"-pix_fmt",
"rgb24",
"-",
]),
{ maxBuffer: 1024 ** 3 },
);
const frameSize = width * height * 3;
const frameCount = Math.floor(pixels.length / frameSize);
if (frameCount < 2) throw new Error(`${name}: the recording holds ${frameCount} frames`);
// Send's colour is the commonest one in the middle of its inline rect.
const [inline] = sends;
const counts = new Map();
for (let y = inline.y + inline.height / 4; y < inline.y + (inline.height * 3) / 4; y += 1) {
for (let x = inline.x + inline.width / 4; x < inline.x + (inline.width * 3) / 4; x += 1) {
const at = (Math.round(y) * width + Math.round(x - left)) * 3;
const colour = (pixels[at] >> 3) * 1024 + (pixels[at + 1] >> 3) * 32 + (pixels[at + 2] >> 3);
counts.set(colour, (counts.get(colour) ?? 0) + 1);
}
}
const [accent] = [...counts].sort((a, b) => b[1] - a[1])[0];
const isAccent = (at) =>
Math.abs((pixels[at] >> 3) - Math.floor(accent / 1024)) <= 2 &&
Math.abs((pixels[at + 1] >> 3) - (Math.floor(accent / 32) % 32)) <= 2 &&
Math.abs((pixels[at + 2] >> 3) - (accent % 32)) <= 2;
// The vertical centre of the rows Send's colour fills, above the keyboard.
const sendCentre = (frame) => {
const rows = [];
for (let y = 0; y < Math.floor(keyboard); y += 1) {
let filled = 0;
for (let x = 0; x < width; x += 1) {
if (isAccent(frame * frameSize + (y * width + x) * 3)) filled += 1;
}
if (filled >= inline.width * 0.4) rows.push(y);
}
return rows.length > 0 ? (rows[0] + rows.at(-1) + 1) / 2 : null;
};
const places = [];
for (let frame = 0; frame < frameCount; frame += 1) {
const centre = sendCentre(frame);
const known = places.some(
(place) =>
place === centre || (place !== null && centre !== null && Math.abs(place - centre) <= 2),
);
if (known) continue;
if (places.length === 2) {
const drawn = centre === null ? "did not draw Send" : `drew Send at ${Math.round(centre)}`;
throw new Error(
`${name}: frame ${frame + 1} of ${frameCount} ${drawn}; it rests at ${places.map((place) => (place === null ? "nowhere" : Math.round(place))).join(" and ")}. See ${video}`,
);
}
places.push(centre);
}
if (places.length !== 2 || places.includes(null))
throw new Error(`${name}: expected Send at two places, saw ${places.join(" and ")}`);
process.stdout.write(
`PASS ${name}: Send drawn only at ${places.map(Math.round).join(" and ")} over ${frameCount} frames\n`,
);
}
async function runFullscreenToggles(host) {
// The enter glyph sits in the input's own padding, so selectors report it covered.
const buttonCentre = (name, snap, label) => {
const button = snap.data.nodes.find(
(node) => node.type === "Button" && node.label === label && node.rect,
)?.rect;
if (!button) throw new Error(`${name}: missing ${label}`);
return [
String(Math.round(button.x + button.width / 2)),
String(Math.round(button.y + button.height / 2)),
];
};
const pressButton = (name, label) => ad("press", ...buttonCentre(name, snapshot(name), label));
// A run that failed in fullscreen leaves the composer there.
if (nodeById(snapshot(`${host}-fullscreen-start`), "composer-fullscreen"))
pressButton(`${host} fullscreen start`, "Exit fullscreen");
await clearInput(`${host}-fullscreen`);
ad("type", fullscreenDraft);
const typed = nodeById(
await settledWithKeyboard(`${host}-fullscreen-typed`, "message-input-root"),
"message-input-root",
).rect;
const resting = typed.y + typed.height;
for (let round = 1; round <= 4; round += 1) {
pressButton(`${host} fullscreen enter ${round} button`, "Fullscreen");
await assertFullscreenToggleHolds(`${host} fullscreen enter ${round}`, enteredFullscreen);
pressButton(`${host} fullscreen exit ${round} button`, "Exit fullscreen");
await assertFullscreenToggleHolds(
`${host} fullscreen exit ${round}`,
exitedFullscreen(resting),
);
}
const inline = snapshot(`${host}-fullscreen-frames-inline`);
const enter = buttonCentre(`${host} fullscreen frames`, inline, "Fullscreen");
ad("press", ...enter);
const entered = await waitFor(`${host}-fullscreen-frames-entered`, (snap) =>
Boolean(nodeById(snap, "composer-fullscreen") && sendButton(snap)),
);
const exit = buttonCentre(`${host} fullscreen frames`, entered, "Exit fullscreen");
ad("press", ...exit);
await waitFor(
`${host}-fullscreen-frames-exited`,
(snap) => !nodeById(snap, "composer-fullscreen"),
);
await assertSendHoldsEveryFrame(`${host} fullscreen frames`, {
screen: inline.data.nodes.find((node) => node.type === "Application").rect,
keyboard: keyboardTop(inline),
sends: [sendButton(inline), sendButton(entered)],
toggle: async () => {
for (let round = 1; round <= 8; round += 1) {
ad("press", ...enter);
await sleep(600);
ad("press", ...exit);
await sleep(600);
}
},
});
await clearInput(`${host}-fullscreen-done`);
}
if (scenario !== "all") {
ad(
"open",
@@ -403,7 +619,13 @@ if (scenario !== "all") {
if (scenario === "growth") await runLiveGrowth();
else if (scenario === "previews") await runBoundedPreview();
else if (scenario === "controls") await runControlTaps();
else throw new Error(`Unknown scenario: ${scenario}`);
else if (scenario === "fullscreen") {
await runFullscreenToggles("draft");
// New workspace hides its header in fullscreen, which resizes the dock on each toggle.
ad("open", `paseo://new?serverId=${serverId}`, "--platform", "ios", ...deviceArgs);
await waitFor("new-workspace", (snap) => Boolean(nodeById(snap, "message-input-root")), 60_000);
await runFullscreenToggles("new-workspace");
} else throw new Error(`Unknown scenario: ${scenario}`);
process.stdout.write(`Composer ${scenario} regression passed. Artifacts: ${artifactsDir}\n`);
process.exit(0);
}
@@ -111,7 +111,7 @@ Keep generated screenshots, recordings, and run logs outside the repository.
confirmation. It first types without tapping the input to verify autofocus, then cancels the
confirmation, closes and reopens the underlying sheet, confirms again,
and completes the password retry. `stacked-settings.ad` checks the same return and retry through
Settings → add host → Direct connection → Advanced. Run both on phones and tablets so both the
Settings → add host → Direct connection → URI. Run both on phones and tablets so both the
bottom sheet and centered dialog are exercised.
These integration journeys require the host-confirmation flow in the test app. Include both the
@@ -146,7 +146,7 @@ Android uses the same journeys: copy each script outside the repository, change
artifacts, and sessions separate from other runs. These host-dependent journeys remain outside the
default mobile suite, alongside the existing modal-sheet scripts.
On iPhone, bulk replacement or bulk keyboard entry of the advanced URI field triggers a
On iPhone, bulk replacement or bulk keyboard entry of the Connection URI field triggers a
repeated-update error with both the parent and stacked-sheet implementations. Entering the complete
URI one character at a time passed with both implementations; faster typing remains unverified.
On iPad, replacing the field a second time appends text. For this Settings journey, use the
@@ -10,7 +10,7 @@ wait "id=\"add-host-method-direct\"" 10000
screenshot "${OUT}/10-add-host-methods.png"
press "id=\"add-host-method-direct\""
wait stable
press "id=\"direct-host-advanced-toggle\""
press "id=\"direct-mode-uri\""
wait stable
fill "id=\"direct-host-uri-input\"" "${PAIRING_LINK}"
wait stable
@@ -32,9 +32,9 @@ wait "id=\"host-confirmation-connect\"" 10000
screenshot "${OUT}/14-add-host-confirmation-reopens.png"
press "id=\"host-confirmation-connect\""
wait stable
wait "id=\"direct-password-input\"" 20000
wait "id=\"direct-uri-password-input\"" 20000
screenshot "${OUT}/15-add-host-password.png"
fill "id=\"direct-password-input\"" "${PASSWORD}"
fill "id=\"direct-uri-password-input\"" "${PASSWORD}"
wait stable
press "id=\"direct-host-submit\""
wait stable
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
set -euo pipefail
# Open Pi settings from the Android model picker. Scroll the sheet body until
# most of the Models list is visible. Use a host with several Pi models and
# the default shown-models selection.
session="${1:?Pass the agent-device session with the Pi provider sheet open}"
artifacts="${2:-.artifacts/provider-model-scroll}"
mkdir -p "$artifacts"
ad() {
agent-device "$@" --session "$session"
}
visible_rows() {
jq -ce '
.data.nodes as $nodes
| ($nodes[] | select(.identifier == "provider-discovered-models")) as $list
| [$nodes[]
| select((.identifier // "") | startswith("provider-shown-model-"))
| select(.rect.height > 0 and .rect.y < ($list.rect.y + $list.rect.height))
| select(.rect.y + .rect.height > $list.rect.y)
| .label]
| select(length > 1)
' "$1"
}
ad snapshot --json > "$artifacts/before.json"
read -r x y dy < <(jq -er '
.data.nodes[]
| select(.identifier == "provider-discovered-models" and .rect.height >= 350)
| .rect
| [(.x + .width / 2 | floor), (.y + .height * 0.7 | floor), (-.height * 0.5 | floor)]
| @tsv
' "$artifacts/before.json") || {
printf 'Scroll the sheet body until the Models list is visible.\n' >&2
exit 1
}
before=$(visible_rows "$artifacts/before.json")
ad gesture pan "$x" "$y" 0 "$dy" 580
ad snapshot --json > "$artifacts/after.json"
after=$(visible_rows "$artifacts/after.json")
printf 'Before %s\nAfter %s\n' "$before" "$after"
first=$(jq -r '.[0]' <<<"$before")
if jq -e --arg first "$first" 'index($first) != null' <<<"$after" >/dev/null; then
printf 'The first model stayed visible after the upward drag.\n' >&2
exit 1
fi
model=$(jq -r '.[1]' <<<"$after")
ad press "role=checkbox label=\"$model\"" --settle
ad snapshot --json > "$artifacts/checked.json"
jq -e --arg model "$model" '
any(.data.nodes[]; .kind == "checkbox" and .label == $model and .checked == true)
' "$artifacts/checked.json" >/dev/null
ad press 'id="provider-shown-models-reset"' --settle
ad snapshot --json > "$artifacts/reset.json"
jq -e --arg model "$model" '
any(.data.nodes[]; .kind == "checkbox" and .label == $model and .checked == false)
' "$artifacts/reset.json" >/dev/null
@@ -1,5 +1,6 @@
import { expect, type Page } from "@playwright/test";
import { readScrollMetrics, waitForContentGrowth, expectNearBottom } from "./agent-bottom-anchor";
import { agentStopButton } from "./composer";
export async function awaitAssistantMessage(page: Page, hasText?: string | RegExp): Promise<void> {
const messages = page.getByTestId("assistant-message");
@@ -14,7 +15,7 @@ export async function awaitToolCall(page: Page, toolName: string | RegExp): Prom
}
export async function expectAgentIdle(page: Page, timeout = 30_000): Promise<void> {
await expect(page.getByRole("button", { name: /stop|cancel/i })).toHaveCount(0, { timeout });
await expect(agentStopButton(page)).toHaveCount(0, { timeout });
}
// The working indicator is an animated spinner View — no semantic ARIA role, testId is correct.
@@ -31,6 +31,8 @@ export interface RewindCompletionGate {
clearTimelineStreamCount(): void;
release(): void;
timelineStreamCount(): number;
/** Timeline reads this page sent since the last clear. */
timelineFetchCount(): number;
waitForDelayedResponse(): Promise<void>;
}
@@ -186,12 +188,20 @@ export async function holdDaemonHydration(page: Page): Promise<DaemonHydrationGa
};
}
// The rewind response and the timeline change it causes; the change removes the rewound row too.
const REWIND_COMPLETION_MESSAGES = new Set([
"agent.rewind.response",
"agent.timeline.rewind",
"agent.timeline.replacement",
]);
export async function holdRewindCompletion(
page: Page,
agentId: string,
): Promise<RewindCompletionGate> {
let released = false;
let timelineStreamCount = 0;
let timelineFetchCount = 0;
const delayedForwards: Array<() => void> = [];
let resolveDelayedResponse: (() => void) | null = null;
const delayedResponse = new Promise<void>((resolve) => {
@@ -200,7 +210,16 @@ export async function holdRewindCompletion(
await page.routeWebSocket(daemonWsRoutePattern(), (ws) => {
const server = ws.connectToServer();
ws.onMessage((message) => server.send(message));
ws.onMessage((message) => {
const sessionMessage = getSessionMessage(message);
if (
sessionMessage?.type === "fetch_agent_timeline_request" &&
sessionMessage.agentId === agentId
) {
timelineFetchCount += 1;
}
server.send(message);
});
server.onMessage((message) => {
const sessionMessage = getSessionMessage(message);
const payload = sessionMessage ? getPayload(sessionMessage) : null;
@@ -216,11 +235,11 @@ export async function holdRewindCompletion(
}
if (
!released &&
(sessionMessage?.type === "agent.rewind.response" ||
sessionMessage?.type === "agent.timeline.replacement") &&
sessionMessage &&
REWIND_COMPLETION_MESSAGES.has(String(sessionMessage.type)) &&
payload?.agentId === agentId
) {
// The replacement also signals completion and removes the rewound row/menu.
// The rewind also signals completion and removes the rewound row/menu.
// Hold it with the response so the pending-state assertion observes a pending rewind.
delayedForwards.push(() => ws.send(message));
if (sessionMessage.type === "agent.rewind.response") resolveDelayedResponse?.();
@@ -233,6 +252,7 @@ export async function holdRewindCompletion(
return {
clearTimelineStreamCount() {
timelineStreamCount = 0;
timelineFetchCount = 0;
},
release() {
released = true;
@@ -241,6 +261,7 @@ export async function holdRewindCompletion(
}
},
timelineStreamCount: () => timelineStreamCount,
timelineFetchCount: () => timelineFetchCount,
waitForDelayedResponse: () => delayedResponse,
};
}
@@ -0,0 +1,141 @@
import { expect, type Browser, type Locator, type Page } from "@playwright/test";
import { hideDeveloperToasts } from "../developer-ui.mjs";
import {
agentStopButton,
composerLocator,
expectComposerDraft,
fillComposerDraft,
sendDraftToQueue,
} from "./composer";
import { openAgentRoute, seedMockAgentWorkspace, type MockAgentWorkspace } from "./mock-agent";
export interface AgentWithOpenTurn extends MockAgentWorkspace {
/** Ends the open turn from outside the app, so it also works with every page closed. */
finishTurn(): Promise<void>;
}
/**
* A mock agent whose first turn stays open on a plan approval. The turn ends when the test
* answers it, so nothing here depends on how long a stream runs.
*/
export async function seedAgentWithOpenTurn(input: {
repoPrefix: string;
title: string;
}): Promise<AgentWithOpenTurn> {
const agent = await seedMockAgentWorkspace({
...input,
initialPrompt: "Emit synthetic plan approval.",
});
await agent.client.waitForFinish(agent.agentId, 30_000);
return {
...agent,
async finishTurn() {
const fetched = await agent.client.fetchAgent({ agentId: agent.agentId });
const request = fetched?.agent.pendingPermissions[0];
if (!request) throw new Error("The agent has no open turn to finish");
await agent.client.respondToPermission(agent.agentId, request.id, { behavior: "allow" });
},
};
}
export function queuedRows(page: Page): Locator {
return page.getByRole("list", { name: "Queued messages" }).getByRole("listitem");
}
export function queuedRow(page: Page, text: string): Locator {
return queuedRows(page).filter({ hasText: text });
}
export async function queueMessage(page: Page, text: string): Promise<void> {
await fillComposerDraft(page, text);
await sendDraftToQueue(page);
await expect(queuedRow(page, text)).toBeVisible();
await expectComposerDraft(page, "");
}
export async function editQueuedMessage(page: Page, text: string): Promise<void> {
await queuedRow(page, text)
.getByRole("button", { name: "Edit queued message", exact: true })
.click();
}
export async function cancelQueuedMessage(page: Page, text: string): Promise<void> {
await queuedRow(page, text)
.getByRole("button", { name: "Cancel queued message", exact: true })
.click();
}
export async function sendQueuedMessageNow(page: Page, text: string): Promise<void> {
await queuedRow(page, text)
.getByRole("button", { name: "Send queued message now", exact: true })
.click();
}
export function queuePausedNotice(page: Page): Locator {
return page.getByText("Queue paused until you send a message", { exact: true });
}
/** Queues through the host, for tests that need more rows than are worth typing. */
export async function queueThroughHost(agent: AgentWithOpenTurn, texts: string[]): Promise<void> {
for (const text of texts) {
await agent.client.sendAgentMessage(agent.agentId, text, { activeTurnBehavior: "queue" });
}
}
/** The composer input and Stop are both fully on screen. */
export async function expectComposerOnScreen(page: Page): Promise<void> {
await expect(composerLocator(page)).toBeInViewport({ ratio: 1 });
await expect(agentStopButton(page)).toBeInViewport({ ratio: 1 });
}
/** Turns the mouse wheel over one row, as a user does to move through the queue. */
export async function scrollQueueFrom(page: Page, text: string, deltaY: number): Promise<void> {
await queuedRow(page, text).hover();
await page.mouse.wheel(0, deltaY);
}
/** The icon leading a row's "Sent by" line is drawn at its full width. */
export async function expectSenderIconUnsquashed(row: Locator): Promise<void> {
const icon = await row.locator("svg").first().boundingBox();
if (!icon) throw new Error("The row has no visible sender icon");
expect(icon.width).toBeGreaterThanOrEqual(icon.height);
}
/** The queued prompt reached the transcript exactly once and left the queue. */
export async function expectDeliveredOnce(page: Page, text: string): Promise<void> {
await expect(page.getByTestId("user-message").filter({ hasText: text })).toHaveCount(1, {
timeout: 30_000,
});
await expect(queuedRow(page, text)).toHaveCount(0);
}
export async function expectDeliveredImage(page: Page, text: string): Promise<void> {
await expect(
page
.getByTestId("user-message")
.filter({ hasText: text })
.getByRole("button", { name: "Open image attachment" }),
).toHaveCount(1);
}
/** A page opened after the first one was closed, with the same stored app data. */
export async function reopenAgent(page: Page, agent: AgentWithOpenTurn): Promise<Page> {
const reopened = await page.context().newPage();
await hideDeveloperToasts(reopened);
await openAgentRoute(reopened, agent);
return reopened;
}
/** A second client of the same host: its own browser context and its own client id. */
export async function openSecondClient(
browser: Browser,
page: Page,
agent: AgentWithOpenTurn,
): Promise<{ page: Page; close(): Promise<void> }> {
const context = await browser.newContext({ storageState: await page.context().storageState() });
const second = await context.newPage();
await second.addInitScript(() => localStorage.removeItem("@paseo:client-id-v1"));
await hideDeveloperToasts(second);
await openAgentRoute(second, agent);
return { page: second, close: () => context.close() };
}
+13 -4
View File
@@ -103,8 +103,13 @@ export async function expectQueuedMessageButton(page: Page): Promise<void> {
});
}
/** The composer's Stop button. Queued rows also have a Cancel button, so match the whole name. */
export function agentStopButton(page: Page) {
return page.getByRole("button", { name: /^(stop|canceling) agent$/i });
}
export async function cancelAgent(page: Page): Promise<void> {
const stopButton = page.getByRole("button", { name: /stop|cancel/i }).first();
const stopButton = agentStopButton(page).first();
await expect(stopButton).toBeVisible({ timeout: 10_000 });
await stopButton.click();
}
@@ -300,9 +305,7 @@ export async function startRunningMockAgent(
await page.goto(agentUrl);
await expectComposerVisible(page);
await client.sendAgentMessage(agent.id, opts.prompt);
await expect(page.getByRole("button", { name: /stop|cancel/i }).first()).toBeVisible({
timeout: 30_000,
});
await expect(agentStopButton(page).first()).toBeVisible({ timeout: 30_000 });
return {
client,
repo,
@@ -467,6 +470,12 @@ export async function configureComposerQueueSend(page: Page): Promise<void> {
);
}
export async function configureComposerInterruptSend(page: Page): Promise<void> {
await page.addInitScript(() =>
localStorage.setItem("@paseo:app-settings", JSON.stringify({ sendBehavior: "interrupt" })),
);
}
/** Drive the real tab chooser's commands even when fullscreen covers its pointer surface.
* This exercises retained activity changes, not a claim that covered chrome is clickable.
*/
@@ -168,6 +168,11 @@ export interface SeedDaemonClient {
timeout?: number,
): Promise<{ status: string }>;
cancelAgent(agentId: string): Promise<void>;
respondToPermission(
agentId: string,
requestId: string,
response: { behavior: "allow" },
): Promise<void>;
sendAgentMessage(
agentId: string,
text: string,
@@ -182,9 +187,9 @@ export interface SeedDaemonClient {
): Promise<{ status: string; final?: { lastError?: string | null } | null }>;
archiveAgent(agentId: string): Promise<{ archivedAt: string }>;
refreshAgent(agentId: string): Promise<unknown>;
fetchAgent(options: {
agentId: string;
}): Promise<{ agent: { id: string; archivedAt?: string | null } } | null>;
fetchAgent(options: { agentId: string }): Promise<{
agent: { id: string; archivedAt?: string | null; pendingPermissions: Array<{ id: string }> };
} | null>;
getLastServerInfoMessage(): {
features?: {
projectAdd?: boolean;
+41 -2
View File
@@ -258,8 +258,37 @@ export async function expectAddHostFieldDrawnAsInput(page: Page, testId: string)
await expect(field).not.toHaveCSS("background-color", "rgba(0, 0, 0, 0)");
}
export async function toggleHostAdvanced(page: Page): Promise<void> {
await page.getByTestId("direct-host-advanced-toggle").click();
function directConnectionModeSegment(page: Page, mode: "Form" | "URI") {
return page.getByTestId("direct-mode").getByRole("button", { name: mode, exact: true });
}
export async function selectDirectConnectionMode(page: Page, mode: "Form" | "URI"): Promise<void> {
await directConnectionModeSegment(page, mode).click();
await expectDirectConnectionMode(page, mode);
}
export async function expectDirectConnectionMode(page: Page, mode: "Form" | "URI"): Promise<void> {
await expect(directConnectionModeSegment(page, mode)).toHaveAttribute("aria-selected", "true");
}
export async function expectDirectFormModeDisabled(page: Page): Promise<void> {
await expect(directConnectionModeSegment(page, "Form")).toBeDisabled();
}
export async function connectDirectHost(page: Page): Promise<void> {
await page.getByTestId("direct-host-submit").click();
await expect(page.getByTestId("add-host-modal")).toHaveCount(0, { timeout: 30_000 });
}
export async function connectDirectHostExpectingPassword(page: Page, host: string): Promise<void> {
await page.getByTestId("direct-host-submit").click();
await expect(page.getByText(`Password for ${host}`, { exact: true })).toBeVisible({
timeout: 30_000,
});
}
export async function fillDirectHostPromptPassword(page: Page, password: string): Promise<void> {
await page.getByRole("textbox", { name: "Host password", exact: true }).fill(password);
}
export async function openCompactSettings(page: Page, expectedStartRoute: string): Promise<void> {
@@ -422,6 +451,10 @@ export async function fillDirectHostAddress(page: Page, host: string, port: stri
await page.getByRole("textbox", { name: "Port", exact: true }).fill(port);
}
export async function pasteIntoDirectHost(page: Page, text: string): Promise<void> {
await page.getByRole("textbox", { name: "Host", exact: true }).fill(text);
}
export async function toggleDirectHostSsl(page: Page): Promise<void> {
await page.getByRole("checkbox", { name: "Use SSL", exact: true }).click();
}
@@ -439,6 +472,12 @@ export async function expectDirectHostUriHidden(page: Page): Promise<void> {
await expect(page.getByTestId("direct-host-uri-input")).toHaveCount(0);
}
/** The whole form shows above Cancel and Connect, with nothing cut off by the footer. */
export async function expectDirectFormFullyVisible(page: Page): Promise<void> {
await expect(page.getByTestId("direct-password-input")).toBeInViewport({ ratio: 1 });
await expect(page.getByTestId("direct-password-visibility-toggle")).toBeInViewport({ ratio: 1 });
}
export async function expectDiagnosticsContent(page: Page): Promise<void> {
await expect(page.getByRole("button", { name: "Run" })).toBeVisible();
await expect(page.getByRole("button", { name: "Play test" })).toBeVisible();
@@ -173,8 +173,11 @@ export async function expectHostConnectingOrOffline(
page: Page,
options?: { timeout?: number },
): Promise<void> {
// A host that is still connecting shows the workspace loading state; one that failed says so.
await expect(
page.getByText(/^Connecting$|localhost is offline|Cannot reach localhost/i),
page
.getByTestId("workspace-loading")
.or(page.getByText(/localhost is offline|Cannot reach localhost/i)),
).toBeVisible({ timeout: options?.timeout ?? 30_000 });
}
+2
View File
@@ -1,6 +1,8 @@
// Install runtime polyfills before any other module evaluates. Keep this the first import.
// oxlint-disable-next-line import/no-unassigned-import -- Polyfills install on import.
import "./src/polyfills/install-early";
import { keepNativeSplash } from "./src/native-splash";
keepNativeSplash();
// Configure Unistyles before Expo Router pulls in any components using StyleSheet.
import "./src/styles/unistyles";
@@ -63,6 +63,8 @@ using namespace facebook::react;
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
// The iOS status-bar tap region can overlap app header buttons (#11027).
self.scrollView.scrollsToTop = NO;
#if defined(__IPHONE_26_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_26_0
if (@available(iOS 26.0, *)) {
UIScrollView *scrollView = self.scrollView;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.18.1",
"version": "0.18.2",
"private": true,
"main": "index.ts",
"scripts": {
@@ -0,0 +1,22 @@
const { AndroidConfig, withAndroidStyles } = require("expo/config-plugins");
// The activity window shows under the splash while it fades out and until React
// paints. Expo's AppTheme sets no window background, so Android paints the
// AppCompat default (#303030 in dark mode, #fafafa in light mode) there.
// expo-splash-screen already defines `splashscreen_background` for day and night,
// so pointing the window at it keeps one colour from launch to the first screen.
const WINDOW_BACKGROUND = "@color/splashscreen_background";
function withAndroidSplashWindowBackground(config) {
return withAndroidStyles(config, (modConfig) => {
modConfig.modResults = AndroidConfig.Styles.assignStylesValue(modConfig.modResults, {
add: true,
parent: AndroidConfig.Styles.getAppThemeGroup(),
name: "android:windowBackground",
value: WINDOW_BACKGROUND,
});
return modConfig;
});
}
module.exports = withAndroidSplashWindowBackground;
+3 -14
View File
@@ -3,9 +3,12 @@ import { useTranslation } from "react-i18next";
import { i18n } from "@/i18n/i18next";
import { useProviderIcon } from "@/components/provider-icons";
import type { PanelDescriptor } from "@/panels/panel-registry";
import { resolveAgentLabel } from "@/panels/tab-labels";
import { useSessionStore, selectAgentTurnPresentation, type Agent } from "@/stores/session-store";
import { deriveSidebarStateBucket } from "@/utils/sidebar-agent-state";
export { resolveAgentLabel };
function formatProviderLabel(provider: Agent["provider"]): string {
if (!provider) {
return "Agent";
@@ -17,20 +20,6 @@ function formatProviderLabel(provider: Agent["provider"]): string {
.join(" ");
}
export function resolveAgentLabel(title: string | null | undefined): string | null {
if (typeof title !== "string") {
return null;
}
const normalized = title.trim();
if (!normalized) {
return null;
}
if (normalized.toLowerCase() === "new agent") {
return null;
}
return normalized;
}
export function useAgentDescriptor(
target: { kind: "agent"; agentId: string },
context: { serverId: string },
@@ -23,7 +23,15 @@ export interface DraftAgentProfileControls {
}
export type AgentProfileApplyTarget =
| { kind: "agent"; agentId: string; availableModeIds: readonly string[] | null }
| {
kind: "agent";
agentId: string;
availableModeIds: readonly string[] | null;
currentProvider?: string | null;
isSwitchInFlight?: () => boolean;
onApplySameProvider?: () => void;
onStageProviderSwitch?: (profile: MaterializedAgentProfile) => void;
}
| { kind: "draft"; controls: DraftAgentProfileControls };
/** Everything the model picker renders for one profile. It never sees the profile itself. */
@@ -43,6 +51,8 @@ export interface AgentProfilePickerRow {
export interface AgentProfilePicker {
rows: AgentProfilePickerRow[];
applyProfile: (profileId: string) => void;
/** What a picked profile configures: a running agent, or the draft of a new one. */
target: AgentProfileApplyTarget["kind"];
}
export interface UseAgentProfilePickerInput {
@@ -146,6 +156,16 @@ export function useAgentProfilePicker(
return;
}
if (
target.onStageProviderSwitch &&
(target.isSwitchInFlight?.() ||
(target.currentProvider && resolved.provider !== target.currentProvider))
) {
target.onStageProviderSwitch(resolved);
return;
}
target.onApplySameProvider?.();
const reconciled = reconcileMaterializedProfileMode(resolved, target.availableModeIds);
if (!reconciled) {
return;
@@ -155,7 +175,11 @@ export function useAgentProfilePicker(
return;
}
void client
.applyAgentConfig(target.agentId, toAgentConfigApply(reconciled))
.applyAgentConfig(
target.agentId,
toAgentConfigApply(reconciled),
target.currentProvider ? { expectedProvider: target.currentProvider } : undefined,
)
.then((notice) => showProviderNoticeToast(toast, notice))
.catch((error) => {
console.warn("[useAgentProfilePicker] applyAgentConfig failed", error);
@@ -166,7 +190,7 @@ export function useAgentProfilePicker(
);
return useMemo(
() => (isSupported && profiles !== null ? { rows, applyProfile } : null),
[applyProfile, isSupported, profiles, rows],
() => (isSupported && profiles !== null ? { rows, applyProfile, target: target.kind } : null),
[applyProfile, isSupported, profiles, rows, target.kind],
);
}
+161
View File
@@ -0,0 +1,161 @@
import { expect, test } from "vitest";
import type { PaseoAgentQueueItem } from "@getpaseo/client";
import type { SessionOutboundMessage } from "@getpaseo/protocol/messages";
import { createHostAgentQueueModel } from "./host";
interface Observer {
snapshot(): void;
update(message: SessionOutboundMessage): void;
error(error: unknown): void;
}
function item(id: string): PaseoAgentQueueItem {
return {
id,
seq: 1,
enqueuedAt: "2026-11-30T00:00:00.000Z",
text: `message ${id}`,
sender: { kind: "user" },
held: false,
state: "queued",
};
}
/** A host runtime plus the daemon client it hands out. */
function fakeHost(options: { supportsQueue: boolean }) {
let connected = false;
let notify = () => {};
const observers: Observer[] = [];
const calls: unknown[][] = [];
let releases = 0;
let queue = [item("a")];
const client = {
getLastServerInfoMessage: () =>
connected ? { features: { agentMessageQueue: options.supportsQueue } } : null,
listAgentQueue: async (agentId: string) => {
calls.push(["list", agentId]);
return { held: false, items: queue };
},
withdrawAgentQueueItem: async (agentId: string, messageId: string) => {
calls.push(["withdraw", agentId, messageId]);
return { withdrawn: true as const, item: item(messageId) };
},
promoteAgentQueueItem: async (agentId: string, messageId: string, behavior: string) => {
calls.push(["promote", agentId, messageId, behavior]);
return { promoted: true as const };
},
observeAgentQueue: () => ({
subscribe: (observer: Observer) => {
observers.push(observer);
},
release: async () => {
releases++;
},
}),
};
return {
host: {
getClient: () => client,
subscribe: (listener: () => void) => {
notify = listener;
return () => {};
},
},
observers,
calls,
releases: () => releases,
setQueue: (next: PaseoAgentQueueItem[]) => {
queue = next;
},
connect: () => {
connected = true;
notify();
},
disconnect: () => {
connected = false;
notify();
},
};
}
async function settle(): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, 0));
}
function queueUpdate(agentId: string, items: PaseoAgentQueueItem[]): SessionOutboundMessage {
return { type: "agent.queue.update", payload: { agentId, held: false, items } };
}
test("lists on connect, follows its own agent's updates, and lists again on reconnect", async () => {
const runtime = fakeHost({ supportsQueue: true });
const model = createHostAgentQueueModel("host", "agent", runtime.host);
const unsubscribe = model.subscribe(() => {});
expect(runtime.observers).toHaveLength(0);
runtime.connect();
runtime.observers[0].snapshot();
await settle();
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [item("a")] });
runtime.observers[0].update(queueUpdate("other-agent", []));
expect(model.getSnapshot().items).toEqual([item("a")]);
runtime.observers[0].update(queueUpdate("agent", [item("a"), item("b")]));
expect(model.getSnapshot().items).toEqual([item("a"), item("b")]);
runtime.disconnect();
expect(model.getSnapshot()).toMatchObject({ status: "stale", items: [item("a"), item("b")] });
expect(runtime.releases()).toBe(1);
runtime.setQueue([]);
runtime.connect();
runtime.observers[1].snapshot();
await settle();
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [] });
runtime.observers[0].update(queueUpdate("agent", [item("late")]));
expect(model.getSnapshot().items).toEqual([]);
unsubscribe();
});
test("sends withdraw and promote for the observed agent", async () => {
const runtime = fakeHost({ supportsQueue: true });
const model = createHostAgentQueueModel("host", "agent", runtime.host);
const unsubscribe = model.subscribe(() => {});
runtime.connect();
runtime.observers[0].update(queueUpdate("agent", [item("a"), item("b")]));
await model.promote("b", "interrupt");
await model.withdraw("a");
expect(runtime.calls).toEqual([
["promote", "agent", "b", "interrupt"],
["withdraw", "agent", "a"],
]);
unsubscribe();
});
test("rejects a command while the host is disconnected", async () => {
const runtime = fakeHost({ supportsQueue: true });
const model = createHostAgentQueueModel("host", "agent", runtime.host);
const unsubscribe = model.subscribe(() => {});
runtime.connect();
runtime.observers[0].update(queueUpdate("agent", [item("a")]));
runtime.disconnect();
await expect(model.withdraw("a")).rejects.toThrow("Host disconnected");
expect(runtime.calls).toEqual([]);
unsubscribe();
});
test("has no queue and asks nothing of a host without the feature", async () => {
const runtime = fakeHost({ supportsQueue: false });
const model = createHostAgentQueueModel("host", "agent", runtime.host);
const unsubscribe = model.subscribe(() => {});
runtime.connect();
await settle();
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [] });
expect(runtime.observers).toHaveLength(0);
expect(runtime.calls).toEqual([]);
unsubscribe();
});
+118
View File
@@ -0,0 +1,118 @@
import type {
PaseoAgentQueuePromoteResult,
PaseoAgentQueueState,
PaseoAgentQueueWithdrawResult,
} from "@getpaseo/client";
import type { ActiveTurnBehavior, SessionOutboundMessage } from "@getpaseo/protocol/messages";
import { getHostRuntimeStore } from "@/runtime/host-runtime";
import { createAgentQueueModel, type AgentQueueModel } from "./model";
interface AgentQueueClient {
getLastServerInfoMessage(): { features?: { agentMessageQueue?: boolean } | null } | null;
listAgentQueue(agentId: string): Promise<PaseoAgentQueueState>;
withdrawAgentQueueItem(
agentId: string,
messageId: string,
): Promise<PaseoAgentQueueWithdrawResult>;
promoteAgentQueueItem(
agentId: string,
messageId: string,
activeTurnBehavior: ActiveTurnBehavior,
): Promise<PaseoAgentQueuePromoteResult>;
observeAgentQueue(): {
subscribe(observer: {
snapshot(): void;
update(message: SessionOutboundMessage): void;
error(error: unknown): void;
}): unknown;
release(): Promise<void>;
};
}
interface AgentQueueHost {
getClient(): AgentQueueClient | null;
subscribe(listener: () => void): () => void;
}
function hostFor(serverId: string): AgentQueueHost {
const host = getHostRuntimeStore();
return {
getClient: () => host.getSnapshot(serverId)?.client ?? null,
subscribe: (listener) => host.subscribe(serverId, listener),
};
}
export function createHostAgentQueueModel(
serverId: string,
agentId: string,
host: AgentQueueHost = hostFor(serverId),
): AgentQueueModel {
let client: AgentQueueClient | null = null;
const connected = () => {
if (!client) throw new Error("Host disconnected");
return client;
};
return createAgentQueueModel({
list: async () => connected().listAgentQueue(agentId),
withdraw: async (messageId) => connected().withdrawAgentQueueItem(agentId, messageId),
promote: async (messageId, activeTurnBehavior) =>
connected().promoteAgentQueueItem(agentId, messageId, activeTurnBehavior),
observe: ({ snapshot, update, disconnected, failed }) => {
let release: (() => void) | undefined;
let currentObservation: ReturnType<AgentQueueClient["observeAgentQueue"]> | undefined;
const sync = () => {
const candidate = host.getClient();
// The runtime keeps the client across reconnects, but clears server info until handshake.
const next = candidate?.getLastServerInfoMessage() ? candidate : null;
if (next === client) return;
const previousRelease = release;
client = next;
release = undefined;
disconnected();
previousRelease?.();
if (!client) return;
// COMPAT(agentMessageQueue): added in v0.18.2, remove gate after 2027-06-01.
if (client.getLastServerInfoMessage()?.features?.agentMessageQueue !== true) {
update({ held: false, items: [] });
return;
}
const observedClient = client;
const observation = client.observeAgentQueue();
currentObservation = observation;
const isCurrent = () => client === observedClient && currentObservation === observation;
observation.subscribe({
snapshot: () => {
if (isCurrent()) snapshot();
},
update: (message) => {
if (
isCurrent() &&
message.type === "agent.queue.update" &&
message.payload.agentId === agentId
) {
update({ held: message.payload.held, items: message.payload.items });
}
},
error: () => {
if (isCurrent()) failed();
},
});
release = () => {
if (currentObservation === observation) currentObservation = undefined;
void observation
.release()
.catch((error: unknown) =>
console.error("Agent queue subscription cleanup failed", error),
);
};
};
const unsubscribe = host.subscribe(sync);
sync();
return () => {
unsubscribe();
client = null;
release?.();
};
},
});
}
+15
View File
@@ -0,0 +1,15 @@
import { useMemo, useSyncExternalStore } from "react";
import { createHostAgentQueueModel } from "./host";
import type { AgentQueueModel, AgentQueueSnapshot } from "./model";
export type { AgentQueueModel, AgentQueueSnapshot } from "./model";
/** Observes one agent's queue for as long as the caller is mounted. */
export function useAgentQueue(
serverId: string,
agentId: string,
): { model: AgentQueueModel; queue: AgentQueueSnapshot } {
const model = useMemo(() => createHostAgentQueueModel(serverId, agentId), [serverId, agentId]);
const queue = useSyncExternalStore(model.subscribe, model.getSnapshot, model.getSnapshot);
return { model, queue };
}
+210
View File
@@ -0,0 +1,210 @@
import { expect, test } from "vitest";
import type {
PaseoAgentQueueItem,
PaseoAgentQueueState,
PaseoAgentQueueWithdrawResult,
} from "@getpaseo/client";
import { createAgentQueueModel, type AgentQueuePort } from "./model";
function item(id: string, patch: Partial<PaseoAgentQueueItem> = {}): PaseoAgentQueueItem {
return {
id,
seq: 1,
enqueuedAt: "2026-11-30T00:00:00.000Z",
text: `message ${id}`,
sender: { kind: "user" },
held: false,
state: "queued",
...patch,
};
}
interface Deferred<T> {
promise: Promise<T>;
resolve(value: T): void;
reject(error: Error): void;
}
function deferred<T>(): Deferred<T> {
let resolve!: (value: T) => void;
let reject!: (error: Error) => void;
const promise = new Promise<T>((done, fail) => {
resolve = done;
reject = fail;
});
return { promise, resolve, reject };
}
/** A host queue the test drives: it records commands and answers them when told to. */
function fakeQueueHost() {
const lists: Deferred<PaseoAgentQueueState>[] = [];
const withdrawals: Array<{ messageId: string } & Deferred<PaseoAgentQueueWithdrawResult>> = [];
const promotions: Array<{ messageId: string; behavior: string }> = [];
let callbacks: Parameters<AgentQueuePort["observe"]>[0] | null = null;
const port: AgentQueuePort = {
list: () => {
const read = deferred<PaseoAgentQueueState>();
lists.push(read);
return read.promise;
},
withdraw: (messageId) => {
const request = deferred<PaseoAgentQueueWithdrawResult>();
withdrawals.push({ messageId, ...request });
return request.promise;
},
promote: async (messageId, behavior) => {
promotions.push({ messageId, behavior });
return { promoted: true };
},
observe: (next) => {
callbacks = next;
return () => {
callbacks = null;
};
},
};
return {
port,
lists,
withdrawals,
promotions,
isObserved: () => callbacks !== null,
connect: () => callbacks?.snapshot(),
disconnect: () => callbacks?.disconnected(),
fail: () => callbacks?.failed(),
publish: (queue: PaseoAgentQueueState) => callbacks?.update(queue),
};
}
async function settle(): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, 0));
}
test("hydrates the queue the host holds when observation starts", async () => {
const host = fakeQueueHost();
const model = createAgentQueueModel(host.port);
const unsubscribe = model.subscribe(() => {});
expect(model.getSnapshot()).toMatchObject({ status: "loading", held: false, items: [] });
host.connect();
host.lists[0].resolve({ held: true, items: [item("a", { held: true })] });
await settle();
expect(model.getSnapshot()).toMatchObject({
status: "ready",
held: true,
items: [item("a", { held: true })],
});
unsubscribe();
expect(host.isObserved()).toBe(false);
});
test("replaces the whole queue with each live update, ahead of a slower list", async () => {
const host = fakeQueueHost();
const model = createAgentQueueModel(host.port);
const unsubscribe = model.subscribe(() => {});
host.connect();
host.publish({ held: false, items: [item("a"), item("b", { seq: 2 })] });
host.lists[0].resolve({ held: false, items: [] });
await settle();
expect(model.getSnapshot().items.map((entry) => entry.id)).toEqual(["a", "b"]);
host.publish({ held: false, items: [item("b", { seq: 2 })] });
expect(model.getSnapshot().items.map((entry) => entry.id)).toEqual(["b"]);
unsubscribe();
});
test("keeps the last rows while disconnected and reads the queue again on reconnect", async () => {
const host = fakeQueueHost();
const model = createAgentQueueModel(host.port);
const unsubscribe = model.subscribe(() => {});
host.connect();
host.lists[0].resolve({ held: false, items: [item("a")] });
await settle();
host.disconnect();
expect(model.getSnapshot()).toMatchObject({ status: "stale", items: [item("a")] });
host.connect();
host.lists[1].resolve({ held: false, items: [] });
await settle();
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [] });
unsubscribe();
});
test("offers a retry when the queue cannot be read", async () => {
const host = fakeQueueHost();
const model = createAgentQueueModel(host.port);
const unsubscribe = model.subscribe(() => {});
host.connect();
host.lists[0].reject(new Error("timeout"));
await settle();
expect(model.getSnapshot().status).toBe("error");
model.retry();
host.lists[1].resolve({ held: false, items: [item("a")] });
await settle();
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [item("a")] });
unsubscribe();
});
test("marks a row busy while it is withdrawn and returns the withdrawn message", async () => {
const host = fakeQueueHost();
const model = createAgentQueueModel(host.port);
const unsubscribe = model.subscribe(() => {});
host.publish({ held: false, items: [item("a"), item("b", { seq: 2 })] });
const first = model.withdraw("a");
const second = model.withdraw("a");
expect(model.getSnapshot().busy).toEqual(new Set(["a"]));
host.withdrawals[0].resolve({ withdrawn: true, item: item("a") });
expect(await first).toEqual({ withdrawn: true, item: item("a") });
expect(await second).toBeNull();
expect(host.withdrawals).toHaveLength(1);
expect(model.getSnapshot().busy).toEqual(new Set());
expect(model.getSnapshot().items.map((entry) => entry.id)).toEqual(["b"]);
unsubscribe();
});
test("keeps the row when the host already started sending it", async () => {
const host = fakeQueueHost();
const model = createAgentQueueModel(host.port);
const unsubscribe = model.subscribe(() => {});
host.publish({ held: false, items: [item("a")] });
const result = model.withdraw("a");
host.withdrawals[0].resolve({ withdrawn: false, reason: "already_dispatching" });
expect(await result).toEqual({ withdrawn: false, reason: "already_dispatching" });
expect(model.getSnapshot().items.map((entry) => entry.id)).toEqual(["a"]);
expect(model.getSnapshot().busy).toEqual(new Set());
unsubscribe();
});
test("releases the row and reports the error when a command fails", async () => {
const host = fakeQueueHost();
const model = createAgentQueueModel(host.port);
const unsubscribe = model.subscribe(() => {});
host.publish({ held: false, items: [item("a")] });
const result = model.withdraw("a");
host.withdrawals[0].reject(new Error("Host disconnected"));
await expect(result).rejects.toThrow("Host disconnected");
expect(model.getSnapshot().busy).toEqual(new Set());
unsubscribe();
});
test("promotes a row with the chosen send behavior", async () => {
const host = fakeQueueHost();
const model = createAgentQueueModel(host.port);
const unsubscribe = model.subscribe(() => {});
host.publish({ held: true, items: [item("a", { held: true })] });
expect(await model.promote("a", "steer")).toEqual({ promoted: true });
expect(host.promotions).toEqual([{ messageId: "a", behavior: "steer" }]);
unsubscribe();
});
+145
View File
@@ -0,0 +1,145 @@
import type {
PaseoAgentQueueItem,
PaseoAgentQueuePromoteResult,
PaseoAgentQueueState,
PaseoAgentQueueWithdrawResult,
} from "@getpaseo/client";
import type { ActiveTurnBehavior } from "@getpaseo/protocol/messages";
export interface AgentQueuePort {
list(): Promise<PaseoAgentQueueState>;
withdraw(messageId: string): Promise<PaseoAgentQueueWithdrawResult>;
promote(
messageId: string,
activeTurnBehavior: ActiveTurnBehavior,
): Promise<PaseoAgentQueuePromoteResult>;
observe(callbacks: {
snapshot(): void;
disconnected(): void;
failed(): void;
update(queue: PaseoAgentQueueState): void;
}): () => void;
}
export interface AgentQueueSnapshot {
status: "loading" | "stale" | "ready" | "error";
/** The host waits for Send now or the next prompt before it sends these. */
held: boolean;
/** Admission order. The first row is sent next. */
items: PaseoAgentQueueItem[];
/** Rows with a command in flight. */
busy: ReadonlySet<string>;
}
/**
* One agent's queue as the host holds it. The host is the only writer: every update replaces
* the rows, and a command changes nothing here until the host answers it.
*/
export function createAgentQueueModel(port: AgentQueuePort) {
let state: AgentQueueSnapshot = {
status: "loading",
held: false,
items: [],
busy: new Set(),
};
let hasRead = false;
let sequence = 0;
let stop: (() => void) | undefined;
let observationFailed = false;
const listeners = new Set<() => void>();
const publish = (patch: Partial<AgentQueueSnapshot>) => {
state = { ...state, ...patch };
for (const listener of listeners) listener();
};
const replace = (queue: PaseoAgentQueueState) => {
hasRead = true;
publish({ status: "ready", held: queue.held, items: queue.items });
};
const pending = () => (hasRead ? "stale" : "loading");
const refresh = async () => {
const request = ++sequence;
publish({ status: pending() });
try {
const queue = await port.list();
if (request === sequence) replace(queue);
} catch {
if (request === sequence) publish({ status: "error" });
}
};
const start = () => {
observationFailed = false;
stop = port.observe({
snapshot: () => {
void refresh();
},
disconnected: () => {
sequence++;
publish({ status: pending() });
},
failed: () => {
observationFailed = true;
sequence++;
publish({ status: "error" });
},
update: (queue) => {
sequence++;
replace(queue);
},
});
};
/** Runs one command per row at a time. Returns null when the row cannot take one. */
const command = async <T>(messageId: string, run: () => Promise<T>): Promise<T | null> => {
const row = state.items.find((entry) => entry.id === messageId);
if (!row || row.state === "dispatching" || state.busy.has(messageId)) return null;
publish({ busy: new Set(state.busy).add(messageId) });
try {
return await run();
} finally {
const busy = new Set(state.busy);
busy.delete(messageId);
publish({ busy });
}
};
return {
getSnapshot: () => state,
withdraw: (messageId: string) =>
command(messageId, async () => {
const result = await port.withdraw(messageId);
// The host confirmed the removal. Drop the row now so it is not pressable again
// between this answer and the next update.
if (result.withdrawn) {
publish({ items: state.items.filter((entry) => entry.id !== messageId) });
}
return result;
}),
promote: (messageId: string, activeTurnBehavior: ActiveTurnBehavior) =>
command(messageId, () => port.promote(messageId, activeTurnBehavior)),
retry: () => {
if (observationFailed) {
stop?.();
stop = undefined;
publish({ status: pending() });
start();
} else {
void refresh();
}
},
subscribe(listener: () => void) {
listeners.add(listener);
if (!stop) start();
return () => {
listeners.delete(listener);
if (!listeners.size) {
sequence++;
stop?.();
stop = undefined;
}
};
},
};
}
export type AgentQueueModel = ReturnType<typeof createAgentQueueModel>;
@@ -56,6 +56,7 @@ export function ChatFind({
agentId,
serverId,
epoch,
rewindSeq,
items,
viewportRef,
revealLoadedMessage,
@@ -95,8 +96,8 @@ export function ChatFind({
);
const state = useSyncExternalStore(model.subscribe, model.getSnapshot, model.getSnapshot);
useEffect(() => {
model.updateHistory(epoch, items);
}, [model, epoch, items]);
model.updateHistory(epoch, items, rewindSeq);
}, [model, epoch, items, rewindSeq]);
useEffect(() => () => model.close(), [model]);
useEffect(() => {
if (!active) model.close();
@@ -18,7 +18,7 @@ function message(seq: number, text = "target"): StreamItem {
kind: "assistant_message",
text,
timestamp: new Date(0),
timelineCursor: { epoch: "epoch", seq },
timelineCursor: { epoch: "epoch", seq, anchorSeq: seq },
};
}
@@ -39,7 +39,7 @@ it("loads an older location and searches a response merged across suppressed tas
source.map((item, index) => ({
event: { type: "timeline" as const, provider: "claude" as const, item },
timestamp: new Date(0),
timelineCursor: { epoch: "epoch", seq: index + 1 },
timelineCursor: { epoch: "epoch", seq: index + 1, anchorSeq: index + 1 },
})),
{ source: "canonical" },
);
@@ -55,7 +55,7 @@ it("loads an older location and searches a response merged across suppressed tas
},
async load(_epoch, seq) {
loaded.push(seq);
model.updateHistory("epoch", history);
model.updateHistory("epoch", history, null);
},
async reveal(_id, _query, occurrence) {
revealed.push(occurrence);
@@ -64,7 +64,7 @@ it("loads an older location and searches a response merged across suppressed tas
clear() {},
});
try {
model.updateHistory("epoch", []);
model.updateHistory("epoch", [], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
@@ -99,7 +99,7 @@ it("skips a source-only candidate and highlights a displayed match", async () =>
clear() {},
});
try {
model.updateHistory("epoch", [message(1), message(2)]);
model.updateHistory("epoch", [message(1), message(2)], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().selectedItemId).toBe("row-2");
@@ -129,7 +129,7 @@ it("ignores replies after closing and does not navigate", async () => {
},
clear() {},
});
model.updateHistory("epoch", [message(1)]);
model.updateHistory("epoch", [message(1)], null);
model.open();
model.setQuery("target");
await expect.poll(() => calls).toEqual(["search"]);
@@ -155,7 +155,7 @@ it("retains a failed search for retry and distinguishes failure from zero matche
};
const model = new ChatFindModel(operations);
try {
model.updateHistory("epoch", []);
model.updateHistory("epoch", [], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("error");
@@ -185,7 +185,7 @@ it("reports a failed timeline load as a connection failure", async () => {
clear() {},
});
try {
model.updateHistory("epoch", []);
model.updateHistory("epoch", [], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("error");
@@ -207,24 +207,160 @@ it("reports a search result that outlived its epoch as a changed history", async
clear() {},
});
try {
model.updateHistory("epoch", [message(1)]);
model.updateHistory("epoch", [message(1)], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
model.updateHistory("epoch-2", [message(1)]);
model.updateHistory("epoch-2", [message(1)], null);
expect(model.getSnapshot()).toMatchObject({ phase: "error", failure: "historyChanged" });
} finally {
model.close();
}
});
it("reports results that a rewind took messages from as a changed history", async () => {
const model = new ChatFindModel({
async search() {
return response([{ seq: 2, role: "assistant" }]);
},
async load() {},
async reveal() {
return { count: 1, occurrence: 0 };
},
clear() {},
});
try {
model.updateHistory("epoch", [message(1), message(2)], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
expect(model.getSnapshot()).toMatchObject({ selectedItemId: "row-2", count: 1 });
// Another client rewinds the turn holding the match; the epoch stays.
model.updateHistory("epoch", [message(1)], 3);
expect(model.getSnapshot()).toMatchObject({
phase: "error",
failure: "historyChanged",
selectedItemId: null,
});
} finally {
model.close();
}
});
it("stops a search still receiving pages when a rewind lands between them", async () => {
let pages = 0;
let releaseSecondPage!: () => void;
const secondPage = new Promise<void>((resolve) => {
releaseSecondPage = resolve;
});
const model = new ChatFindModel({
async search(_query, cursor) {
pages += 1;
if (cursor === undefined)
return { ...response([{ seq: 2, role: "assistant" }]), nextCursor: 2 };
await secondPage;
return response([{ seq: 1, role: "assistant" }]);
},
async load() {},
async reveal() {
return { count: 1, occurrence: 0 };
},
clear() {},
});
try {
model.updateHistory("epoch", [message(1), message(2)], null);
model.open();
model.setQuery("target");
await expect.poll(() => pages).toBe(2);
model.updateHistory("epoch", [message(1)], 3);
releaseSecondPage();
await expect.poll(() => model.getSnapshot().failure).toBe("historyChanged");
expect(model.getSnapshot()).toMatchObject({ phase: "error", selectedItemId: null });
} finally {
model.close();
}
});
it.each([
["Next", "next"],
["Previous", "previous"],
] as const)("reports a rewind after %s as a changed history", async (_label, step) => {
const model = new ChatFindModel({
async search() {
return response([
{ seq: 1, role: "assistant" },
{ seq: 2, role: "assistant" },
]);
},
async load() {},
async reveal() {
return { count: 1, occurrence: 0 };
},
clear() {},
});
try {
model.updateHistory("epoch", [message(1), message(2)], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
model[step]();
await expect.poll(() => model.getSnapshot().selectedItemId).toBe("row-2");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
model.updateHistory("epoch", [message(1)], 3);
expect(model.getSnapshot()).toMatchObject({
phase: "error",
failure: "historyChanged",
selectedItemId: null,
});
} finally {
model.close();
}
});
it("stops a pending Next when a rewind lands before it reveals", async () => {
let reveals = 0;
let revealSecond!: () => void;
const secondReveal = new Promise<void>((resolve) => {
revealSecond = resolve;
});
const model = new ChatFindModel({
async search() {
return response([
{ seq: 1, role: "assistant" },
{ seq: 2, role: "assistant" },
]);
},
async load() {},
async reveal() {
reveals += 1;
if (reveals > 1) await secondReveal;
return { count: 1, occurrence: 0 };
},
clear() {},
});
try {
model.updateHistory("epoch", [message(1), message(2)], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
model.next();
await expect.poll(() => reveals).toBe(2);
model.updateHistory("epoch", [message(1)], 3);
revealSecond();
await expect.poll(() => model.getSnapshot().failure).toBe("historyChanged");
expect(model.getSnapshot()).toMatchObject({ phase: "error", selectedItemId: null });
} finally {
model.close();
}
});
it("can load a search location before the initial chat history has arrived", async () => {
const model = new ChatFindModel({
async search() {
return response([{ seq: 1, role: "assistant" }]);
},
async load() {
model.updateHistory("epoch", [message(1)]);
model.updateHistory("epoch", [message(1)], null);
},
async reveal() {
return { count: 1, occurrence: 0 };
@@ -232,7 +368,7 @@ it("can load a search location before the initial chat history has arrived", asy
clear() {},
});
try {
model.updateHistory(null, []);
model.updateHistory(null, [], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
@@ -260,7 +396,7 @@ it("reports the position across the whole chat and corrects it with rendered cou
clear() {},
});
try {
model.updateHistory("epoch", [message(1), message(2)]);
model.updateHistory("epoch", [message(1), message(2)], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
@@ -297,7 +433,7 @@ it("counts one match per message from a host that reports no counts", async () =
clear() {},
});
try {
model.updateHistory("epoch", [message(1), message(2)]);
model.updateHistory("epoch", [message(1), message(2)], null);
model.open();
model.setQuery("target");
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
@@ -76,6 +76,10 @@ export class ChatFindModel {
private items: StreamItem[] = [];
private epoch: string | null = null;
private resultEpoch: string | null = null;
/** The latest rewind applied to the history. A rewind keeps the epoch and retires messages. */
private rewindSeq: number | null = null;
/** The latest rewind when the current result set's search started; undefined until a search starts. */
private searchedRewindSeq: number | null | undefined = undefined;
private locations: Location[] = [];
private resolved = new Map<Location, Target>();
private current = -1;
@@ -113,6 +117,7 @@ export class ChatFindModel {
this.cancel();
this.locations = [];
this.resultEpoch = null;
this.searchedRewindSeq = undefined;
this.resolved.clear();
this.current = -1;
this.inMessage = { occurrence: 0, count: 0 };
@@ -144,6 +149,7 @@ export class ChatFindModel {
});
}
private async search(signal: AbortSignal) {
this.searchedRewindSeq = this.rewindSeq;
try {
let cursor: number | undefined;
do {
@@ -168,15 +174,14 @@ export class ChatFindModel {
this.fail(error, signal);
}
}
updateHistory(epoch: string | null, items: StreamItem[]) {
if (
this.resultEpoch !== null &&
epoch !== null &&
epoch !== this.resultEpoch &&
this.state.open
) {
/** `rewindSeq` is the sequence number of the latest rewind applied to this history. */
updateHistory(epoch: string | null, items: StreamItem[], rewindSeq: number | null) {
const replaced = this.resultEpoch !== null && epoch !== null && epoch !== this.resultEpoch;
const rewound = this.searchedRewindSeq !== undefined && rewindSeq !== this.searchedRewindSeq;
if ((replaced || rewound) && this.state.open) {
this.fail(new ChatFindFailureError("historyChanged"), this.abort.signal);
}
this.rewindSeq = rewindSeq;
this.epoch = epoch;
this.items = items;
this.historyListeners.forEach((listener) => listener());
@@ -9,6 +9,8 @@ export interface ChatFindProps {
agentId: string;
serverId: string;
epoch: string | null;
/** The sequence number of the latest rewind applied to this history, if any. */
rewindSeq: number | null;
items: StreamItem[];
viewportRef: RefObject<StreamViewportHandle | null>;
revealLoadedMessage(messageId: string): boolean;
@@ -139,7 +139,7 @@ describe("useChatOutline", () => {
kind: "user_message",
text: "live prompt",
timestamp: new Date(seq),
timelineCursor: { epoch: "epoch-1", seq },
timelineCursor: { epoch: "epoch-1", seq, anchorSeq: seq },
});
rerender({ tail: [loadedPrompt(2)] });
await waitFor(() => expect(runtime.listAgentTimelinePrompts).toHaveBeenCalledTimes(2));
@@ -198,7 +198,7 @@ describe("useChatOutline", () => {
kind: "assistant_message",
text: "chunk",
timestamp: new Date(),
timelineCursor: { epoch: "epoch-1", seq: 2 },
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
},
],
timelineEpoch: "epoch-1",
@@ -219,7 +219,7 @@ describe("useChatOutline", () => {
kind: "user_message",
text: "Replaced conversation",
timestamp: new Date(2),
timelineCursor: { epoch: "epoch-2", seq: 1 },
timelineCursor: { epoch: "epoch-2", seq: 1, anchorSeq: 1 },
},
],
timelineEpoch: "epoch-2",
@@ -275,7 +275,7 @@ describe("useChatOutline", () => {
kind: "user_message" as const,
text: "prompt",
timestamp: new Date(1),
timelineCursor: { epoch: "epoch-1", seq: 1 },
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
},
];
const { result, rerender } = renderHook(
@@ -326,7 +326,7 @@ describe("useChatOutline", () => {
kind: "user_message" as const,
text: "prompt",
timestamp: new Date(1),
timelineCursor: { epoch: "epoch-1", seq: 1 },
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
};
const { result, rerender } = renderHook(
({ tail, mountedHistoryMessageIds }) =>
@@ -381,7 +381,7 @@ describe("useChatOutline", () => {
kind: "user_message" as const,
text: "prompt",
timestamp: new Date(2),
timelineCursor: { epoch: "epoch-1", seq: 2 },
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
};
const revealLoadedMessage = vi.fn();
revealLoadedMessage.mockReturnValue(false);
@@ -58,7 +58,11 @@ function installProbe(
return function() {};
} };
})`;
const evaluated = runPluginClientBundle("probe-plugin", clientBundle, runtime);
const evaluated = runPluginClientBundle(
{ serverId: "test-host", pluginId: "probe-plugin" },
clientBundle,
runtime,
);
return {
...evaluated,
serverId: "host-1",
@@ -322,7 +326,7 @@ describe("stream presentation through installed plugins", () => {
const source = harness.source();
const live = source.head[0];
if (live?.kind !== "assistant_message") throw new Error("Expected a live assistant message");
const canonical = { ...live, timelineCursor: { epoch: "epoch-1", seq: 42 } };
const canonical = { ...live, timelineCursor: { epoch: "epoch-1", seq: 42, anchorSeq: 42 } };
const present = createStreamPresentation();
present({ ...presentationOptions, tail: [], head: [live], transform: undefined });
const repointed = rows(
@@ -332,7 +336,7 @@ describe("stream presentation through installed plugins", () => {
{
id: streamed[0]!.id,
text: "Streamed answer",
timelineCursor: { epoch: "epoch-1", seq: 42 },
timelineCursor: { epoch: "epoch-1", seq: 42, anchorSeq: 42 },
},
]);
});
@@ -519,7 +523,7 @@ describe("timeline presentation", () => {
messageId: "provider-message",
clientMessageId: "client-message",
turnId: "turn-1",
timelineCursor: { epoch: "epoch", seq: 12 },
timelineCursor: { epoch: "epoch", seq: 12, anchorSeq: 12 },
});
const presentMessage = () =>
present({
@@ -26,8 +26,10 @@ import {
} from "@legendapp/list/react-native";
import { withUnistyles } from "react-native-unistyles";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { LoadingState } from "@/components/ui/loading-state";
import { Button } from "@/components/ui/button";
import { useRetainedPanelActive } from "@/components/retained-panel";
import { useNativeSplashHold } from "@/native-splash";
import { useTranslation } from "react-i18next";
import type { StreamItem } from "@/types/stream";
import type { Theme } from "@/styles/theme";
@@ -761,6 +763,9 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
);
}, [historyStartPaginationState, hasOlderHistory, retryHistoryStart, t]);
// The launch splash stays up until the visible conversation has placed its rows. A hidden first
// fill means the cache had no history, so it waits on the host and shows its own loading state.
useNativeSplashHold(isActive && !isListPlaced);
const canExpandDrawDistance =
drawDistance < NATIVE_STREAM_DRAW_DISTANCE &&
isActive &&
@@ -807,8 +812,8 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
<InitialDrawDistanceExpansion schedule={drawDistanceExpansion.schedule} />
) : null}
{!historyStartPaginationState.visible ? (
<View pointerEvents="none" testID="agent-initial-fill" style={initialFillStyle}>
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
<View pointerEvents="none" style={initialFillStyle}>
<LoadingState testID="agent-initial-fill" title={t("agentPanel.states.loadingHistory")} />
</View>
) : null}
</View>
@@ -7,7 +7,7 @@ import { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { RetainedPanelActivity } from "@/components/retained-panel";
import { reduceStreamUpdate, type StreamItem } from "@/types/stream";
import { hydrateStreamState, reduceStreamUpdate, type StreamItem } from "@/types/stream";
import type { StreamRenderInput, StreamSegmentRenderers, StreamViewportHandle } from "./strategy";
import { createWebStreamStrategy } from "./strategy-web";
@@ -1660,4 +1660,86 @@ describe("createWebStreamStrategy", () => {
expect(container.querySelector('[data-testid="agent-chat-scroll"]')).toBe(scrollContainer);
expect(scrollTo).toHaveBeenCalledWith({ top: 2200, behavior: "auto" });
});
it("renders batched user messages sharing a provider messageId without duplicate React keys", () => {
const sharedProviderMessageId = "9ffc3d6e-f0ff-4005-8675-e76e9c5eb5a8";
const historyMounted = hydrateStreamState(
[
{
event: {
type: "timeline",
provider: "claude",
item: {
type: "user_message",
text: "first queued prompt",
messageId: sharedProviderMessageId,
clientMessageId: "client-queued-1",
},
},
timestamp: new Date("2026-11-29T13:00:00.000Z"),
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
},
{
event: {
type: "timeline",
provider: "claude",
item: {
type: "user_message",
text: "second direct prompt",
messageId: sharedProviderMessageId,
clientMessageId: "client-direct-2",
},
},
timestamp: new Date("2026-11-29T13:00:01.000Z"),
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
},
],
{ source: "canonical" },
);
const consoleError = vi.spyOn(console, "error").mockImplementation(() => {});
const renderers = createRenderers(() => {});
const strategy = createWebStreamStrategy({ isMobileBreakpoint: false });
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
const rendered = strategy.render({
agentId: "agent",
segments: { historyVirtualized: [], historyMounted, liveHead: [] },
boundary: {
hasVirtualizedHistory: false,
hasMountedHistory: true,
hasLiveHead: false,
},
renderers,
listEmptyComponent: null,
viewportRef: React.createRef<StreamViewportHandle>(),
routeBottomAnchorRequest: null,
isAuthoritativeHistoryReady: true,
onNearBottomChange: () => {},
onNearHistoryStart: async () => true,
isLoadingOlderHistory: false,
hasOlderHistory: false,
olderHistoryProgressKey: null,
scrollEnabled: true,
listStyle: null,
baseListContentContainerStyle: null,
forwardListContentContainerStyle: null,
contentMaxWidth: DEFAULT_CONTENT_MAX_WIDTH,
});
act(() => {
root?.render(rendered);
});
const isSameKeyMessage = (arg: unknown) => typeof arg === "string" && arg.includes("same key");
const duplicateKeyErrors = consoleError.mock.calls.filter((args) =>
args.some(isSameKeyMessage),
);
expect(duplicateKeyErrors).toEqual([]);
expect(
Array.from(container.querySelectorAll("[data-history-row-id]")).map((node) =>
node.getAttribute("data-history-row-id"),
),
).toEqual(["client-queued-1", "client-direct-2"]);
});
});
@@ -19,6 +19,7 @@ import { flushSync } from "react-dom";
import { withUnistyles } from "react-native-unistyles";
import { useRetainedPanelActive } from "@/components/retained-panel";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { LoadingState } from "@/components/ui/loading-state";
import { useStableEvent } from "@/hooks/use-stable-event";
import { useTranslation } from "react-i18next";
import { getStreamItemMessageId, type StreamItem } from "@/types/stream";
@@ -1719,8 +1720,8 @@ function WebStreamViewport(props: StreamRenderInput & { isMobileBreakpoint: bool
</div>
</div>
{!historyStartPaginationState.visible ? (
<div data-testid="agent-initial-fill" style={initialFillStyle}>
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
<div style={initialFillStyle}>
<LoadingState testID="agent-initial-fill" title={t("agentPanel.states.loadingHistory")} />
</div>
) : null}
{scrollEnabled && !isMobileBreakpoint ? (
@@ -33,7 +33,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
it("forks a failed assistant turn from its Paseo timeline cursor without a provider message id", () => {
const failedTurn = {
...assistantMessage("assistant-error", 2),
timelineCursor: { epoch: "timeline-1", seq: 42 },
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
};
expect(
@@ -50,7 +50,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
it("includes the provider message id with a supported timeline cursor", () => {
const selected = {
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
timelineCursor: { epoch: "timeline-1", seq: 42 },
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
};
expect(
@@ -68,7 +68,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
it("falls back to the provider message id when timeline cursors are unsupported", () => {
const selected = {
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
timelineCursor: { epoch: "timeline-1", seq: 42 },
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
};
expect(
@@ -116,7 +116,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
it("resolves a fork boundary from the reply a plugin card replaced", () => {
const reply = {
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
timelineCursor: { epoch: "timeline-1", seq: 42 },
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
};
const card: StreamItem = {
kind: "plugin",
@@ -154,7 +154,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
const appended: StreamItem = {
kind: "plugin",
id: "plugin/card-1",
timelineCursor: { epoch: "timeline-1", seq: 42 },
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
timestamp: timestamp(2),
pluginId: "plugin",
pluginItemId: "card-1",
@@ -1,7 +1,13 @@
import { getAssistantReply, type StreamItem, type TimelinePosition } from "@/types/stream";
import { getAssistantReply, type StreamItem } from "@/types/stream";
/** The daemon's timeline cursor; the row's anchor stays in the client. */
interface TimelineBoundaryCursor {
epoch: string;
seq: number;
}
export type AssistantTurnForkBoundary =
| { boundaryCursor: TimelinePosition; boundaryMessageId?: string }
| { boundaryCursor: TimelineBoundaryCursor; boundaryMessageId?: string }
| { boundaryCursor?: undefined; boundaryMessageId: string };
export function resolveAssistantTurnForkBoundary(input: {
@@ -15,7 +21,7 @@ export function resolveAssistantTurnForkBoundary(input: {
}
if (input.supportsTimelineCursor && reply.timelineCursor) {
return {
boundaryCursor: reply.timelineCursor,
boundaryCursor: { epoch: reply.timelineCursor.epoch, seq: reply.timelineCursor.seq },
...(reply.messageId ? { boundaryMessageId: reply.messageId } : {}),
};
}
@@ -139,7 +139,7 @@ describe("collapseTurns", () => {
it("stands at its host's timeline position, taking a new row when that position lands", () => {
const live = collapse([user("u1"), shell("c1"), reply("r1")]);
expect(live.summaryRowsByHostId.get("u1")).not.toHaveProperty("timelineCursor");
const cursor = { epoch: "epoch-1", seq: 7 };
const cursor = { epoch: "epoch-1", seq: 7, anchorSeq: 7 };
const placed = [{ ...user("u1"), timelineCursor: cursor }, shell("c1"), reply("r1")];
const canonical = collapse(placed, { previousSummaryRowsByHostId: live.summaryRowsByHostId });
expect(canonical.summaryRowsByHostId.get("u1")).not.toBe(live.summaryRowsByHostId.get("u1"));
@@ -101,7 +101,7 @@ function summaryRow(
}
function staysVisibleWhenCollapsed(item: StreamItem): boolean {
return isTurnTrigger(item) || item.kind === "compaction";
return isTurnTrigger(item) || item.kind === "compaction" || item.kind === "provider_switch";
}
function findLastReplyIndex(tail: StreamItem[], start: number, end: number): number {
@@ -159,10 +159,10 @@ const projectedReply: StreamItem = {
id: "reply",
messageId: "provider-reply-1",
text: 'Done.\n\n```ui\nCard("Summary", [])\n```',
timelineCursor: { epoch: "e1", seq: 5 },
timelineCursor: { epoch: "e1", seq: 5, anchorSeq: 5 },
timestamp: FRIDAY_NIGHT,
},
timelineCursor: { epoch: "e1", seq: 5 },
timelineCursor: { epoch: "e1", seq: 5, anchorSeq: 5 },
timestamp: FRIDAY_NIGHT,
pluginId: "genui",
pluginItemId: "reply/1",
+35 -2
View File
@@ -37,6 +37,7 @@ import {
ToolCall,
TodoListCard,
CompactionMarker,
ProviderSwitchMarker,
MessageOuterSpacingProvider,
type InlinePathTarget,
} from "@/components/message";
@@ -57,6 +58,7 @@ import { useFileExplorerActions } from "@/hooks/use-file-explorer-actions";
import { useLoadOlderAgentHistory } from "@/hooks/use-load-older-agent-history";
import { resolveContentMaxWidth, useSettings } from "@/hooks/use-settings";
import type { ToastApi } from "@/components/toast-host";
import { isPromptInActiveSegment } from "@/components/rewind/use-rewind-capabilities";
import { returnToTimelineTail } from "./timeline-tail-navigation";
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
import { ToolCallDetailsContent } from "@/components/tool-call-details";
@@ -408,6 +410,10 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
const timelineEpoch = useSessionStore(
(state) => state.sessions[resolvedServerId]?.agentTimelineCursor.get(agentId)?.epoch ?? null,
);
const timelineRewindSeq = useSessionStore((state) => {
const rewind = state.sessions[resolvedServerId]?.agentTimelineLatestRewind.get(agentId);
return rewind && rewind.epoch === timelineEpoch ? rewind.seq : null;
});
const isTimelineDetached = useSessionStore(
(state) => state.sessions[resolvedServerId]?.agentTimelineHasNewer.get(agentId) === true,
);
@@ -711,8 +717,15 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
const setToolCallGroupExpanded = toolCallExpansion.setGroupExpanded;
const activeSegmentStartSeq = useSessionStore(
(state) =>
state.sessions[resolvedServerId]?.agentTimelineCursor.get(agentId)?.activeSegmentStartSeq ??
0,
);
const renderUserMessageItem = useCallback(
(layoutItem: StreamLayoutItem, item: Extract<StreamItem, { kind: "user_message" }>) => {
const canRewindPrompt = isPromptInActiveSegment(item.timelineCursor, activeSegmentStartSeq);
return (
<UserMessage
itemId={item.id}
@@ -724,7 +737,7 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
images={item.images}
attachments={item.attachments}
timestamp={item.timestamp.getTime()}
capabilities={context.capabilities}
capabilities={canRewindPrompt ? context.capabilities : undefined}
client={client}
isFirstInGroup={layoutItem.isFirstInUserGroup}
isLastInGroup={layoutItem.isLastInUserGroup}
@@ -735,7 +748,14 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
/>
);
},
[context.capabilities, agentId, client, pendingClientMessageIds, resolvedServerId],
[
activeSegmentStartSeq,
context.capabilities,
agentId,
client,
pendingClientMessageIds,
resolvedServerId,
],
);
const renderAssistantMessageItem = useCallback(
@@ -949,6 +969,18 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
/>
);
case "provider_switch":
return (
<ProviderSwitchMarker
serverId={resolvedServerId}
fromProvider={item.fromProvider}
toProvider={item.toProvider}
fromModel={item.fromModel}
toModel={item.toModel}
context={item.context}
/>
);
case "plugin":
return (
<PluginTimelineItemView agentId={agentId} item={item} serverId={resolvedServerId} />
@@ -1174,6 +1206,7 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
agentId={agentId}
serverId={resolvedServerId}
epoch={timelineEpoch}
rewindSeq={timelineRewindSeq}
items={findItems}
viewportRef={viewportRef}
revealLoadedMessage={revealLoadedMessage}
@@ -75,6 +75,7 @@ export function estimateStreamItemHeight({
case "notification":
return 88;
case "compaction":
case "provider_switch":
return 72;
default:
return 120;
+20 -26
View File
@@ -1,4 +1,5 @@
import { useHardwareKeyboardPresent } from "@/keyboard";
import { LaunchScreen, useNativeSplashLaunchCommit } from "@/native-splash";
import {
WindowLayoutProvider,
WindowLayoutActionsHost,
@@ -78,11 +79,11 @@ import { HorizontalScrollProvider } from "@/contexts/horizontal-scroll-context";
import { SessionProvider } from "@/contexts/session-context";
import { SidebarCalloutProvider } from "@/contexts/sidebar-callout-context";
import { ToastProvider } from "@/contexts/toast-context";
import { WorkspaceTabCloseErrorToasts } from "@/workspace-tabs/close";
import { VoiceProvider } from "@/contexts/voice-context";
import {
resolveStartupBlocker,
resolveStartupNavigationReady,
shouldRunStartupGiveUpTimer,
startHostRuntimeBootstrap,
bindHostRuntimeAppState,
type StartupBlocker,
@@ -156,7 +157,7 @@ polyfillCrypto();
export interface HostRuntimeBootstrapState {
splashError: string | null;
retry: () => void;
hasGivenUpWaitingForHost: boolean;
isWaitingForHost: boolean;
isWaitingForSetup: boolean;
storeReady: boolean;
startupBlocker: StartupBlocker;
@@ -165,7 +166,7 @@ export interface HostRuntimeBootstrapState {
const HostRuntimeBootstrapContext = createContext<HostRuntimeBootstrapState>({
splashError: null,
retry: () => {},
hasGivenUpWaitingForHost: false,
isWaitingForHost: true,
isWaitingForSetup: false,
storeReady: false,
startupBlocker: { kind: "none" },
@@ -262,7 +263,6 @@ function useDaemonStartIsRunning(): boolean {
);
}
const STARTUP_GIVE_UP_TIMEOUT_MS = 5_000;
// How long the splash waits on top of host startup to learn whether setup opens. A slow host
// lands on the home instead, and setup opens over it once it is decided.
const STARTUP_SETUP_WAIT_TIMEOUT_MS = 3_000;
@@ -284,20 +284,29 @@ function HostRuntimeBootstrapProvider({ children }: { children: ReactNode }) {
return bindHostRuntimeAppState(store, AppState);
}, []);
const [isWaitingForHost, setIsWaitingForHost] = useState(true);
useEffect(() => {
let isMounted = true;
const store = getHostRuntimeStore();
const daemonStartService = getDaemonStartService({ store });
startHostRuntimeBootstrap({
void startHostRuntimeBootstrap({
store,
daemonStartService,
shouldStartDaemon: shouldStartBuiltInDaemon,
}).then(() => {
if (isMounted) {
setIsWaitingForHost(false);
}
return;
});
return () => {
isMounted = false;
};
}, []);
const anyOnlineHostServerId = useEarliestOnlineHostServerId();
const daemonStartError = useDaemonStartLastError();
const daemonStartIsRunning = useDaemonStartIsRunning();
const [hasGivenUpWaitingForHost, setHasGivenUpWaitingForHost] = useState(false);
const isDesktopRuntime = shouldUseDesktopDaemon();
const startupBlocker = useMemo(
() =>
@@ -309,24 +318,6 @@ function HostRuntimeBootstrapProvider({ children }: { children: ReactNode }) {
}),
[anyOnlineHostServerId, daemonStartError, daemonStartIsRunning, isDesktopRuntime],
);
const shouldRunGiveUpTimer = shouldRunStartupGiveUpTimer({
startupBlocker,
anyOnlineHostServerId,
hasGivenUpWaitingForHost,
});
useEffect(() => {
if (!shouldRunGiveUpTimer) {
return;
}
const handle = setTimeout(() => {
setHasGivenUpWaitingForHost(true);
}, STARTUP_GIVE_UP_TIMEOUT_MS);
return () => {
clearTimeout(handle);
};
}, [shouldRunGiveUpTimer]);
const isSetupDecisionPending = useIsSetupDecisionPending();
const [hasGivenUpWaitingForSetup, setHasGivenUpWaitingForSetup] = useState(false);
const isWaitingForSetup = isSetupDecisionPending && !hasGivenUpWaitingForSetup;
@@ -357,12 +348,12 @@ function HostRuntimeBootstrapProvider({ children }: { children: ReactNode }) {
() => ({
splashError,
retry,
hasGivenUpWaitingForHost,
isWaitingForHost,
isWaitingForSetup,
storeReady,
startupBlocker,
}),
[splashError, retry, hasGivenUpWaitingForHost, isWaitingForSetup, storeReady, startupBlocker],
[splashError, retry, isWaitingForHost, isWaitingForSetup, storeReady, startupBlocker],
);
return (
@@ -915,6 +906,7 @@ const ROOT_STACK_SCREEN_OWNED_APPEARANCE = ["settings/[section]"] as const;
function RootStack() {
const storeReady = useStoreReady();
useNativeSplashLaunchCommit();
return (
<ThemedStack
screenOptions={ROOT_STACK_SCREEN_OPTIONS}
@@ -1003,6 +995,7 @@ function RootOverlayProviders({ children }: { children: ReactNode }) {
<BottomSheetModalProvider>
{children}
<WindowLayoutActionsHost />
<WorkspaceTabCloseErrorToasts />
</BottomSheetModalProvider>
</PortalProvider>
</ToastProvider>
@@ -1043,6 +1036,7 @@ function RootAppTree() {
</AddHostProvider>
</LucideProvider>
</View>
<LaunchScreen />
</GestureHandlerRootView>
);
}
+14 -10
View File
@@ -24,16 +24,20 @@ export default function HostIndexRoute() {
return <StartupSplashScreen />;
}
// The loading screen stays up until the target route paints; a redirect alone renders nothing.
return (
<Redirect
href={resolveHostIndexRoute({
serverId,
workspaceSelection,
workspaceSelectionStatus: resolveWorkspaceSelectionStatus({
hasHydratedWorkspaces,
workspaceExists: workspaceSelectionExists,
}),
})}
/>
<>
<StartupSplashScreen />
<Redirect
href={resolveHostIndexRoute({
serverId,
workspaceSelection,
workspaceSelectionStatus: resolveWorkspaceSelectionStatus({
hasHydratedWorkspaces,
workspaceExists: workspaceSelectionExists,
}),
})}
/>
</>
);
}
+1 -1
View File
@@ -44,7 +44,7 @@ export default function Index() {
workspaceExists: workspaceSelectionExists,
}),
isWorkspaceSelectionLoaded,
hasGivenUpWaitingForHost: bootstrapState.hasGivenUpWaitingForHost,
isWaitingForHost: bootstrapState.isWaitingForHost,
isWaitingForSetup: bootstrapState.isWaitingForSetup,
});
@@ -308,6 +308,24 @@ describe("parseAssistantFileLink", () => {
});
});
it.each(["C:/repo", "\\\\host\\share\\repo"])(
"leaves Windows variable paths in inline code unlinked in %s",
(workspaceRoot) => {
expect(classifyAssistantFileLink("%TEMP%\\debug.md", { workspaceRoot })).toBeNull();
expect(classifyAssistantFileLink("%LOCALAPPDATA%/debug.md:3", { workspaceRoot })).toBeNull();
expect(classifyAssistantFileLink("C:\\Temp\\debug.md", { workspaceRoot })?.kind).toBe(
"directFile",
);
},
);
it("allows a literal percent-delimited directory in an authored file link", () => {
expect(
parseAssistantFileLink("%TEMP%/notes.md", { workspaceRoot: "C:/repo", explicitLink: true })
?.path,
).toBe("C:/repo/%TEMP%/notes.md");
});
it("parses absolute Windows hrefs inside the active workspace", () => {
expect(
parseAssistantFileLink("C:/repo/src/app.tsx#L12-L20", {
@@ -393,6 +393,14 @@ function parseWorkspaceRelativeFileLink(
value: string,
options: AssistantHrefParseOptions,
): InlinePathTarget | null {
// cmd.exe variables are shell expressions. The file opener only resolves literal paths.
if (
!options.explicitLink &&
/^(?:[A-Za-z]:[\\/]|[\\/]{2})/.test(options.workspaceRoot ?? "") &&
/^%[^%\\/]+%[\\/]/.test(value)
) {
return null;
}
const parsed = parseLocalPathParts(value, options);
if (!parsed || isAbsolutePath(parsed.path)) {
return null;
+2
View File
@@ -108,6 +108,8 @@ export type UserComposerAttachment =
| { kind: "file"; attachment: UploadedFileAttachment }
| WorkspaceFileComposerAttachment
| PluginResourceComposerAttachment
// An attachment taken back from a queued message. The host already holds it in wire form.
| { kind: "agent_attachment"; attachment: AgentAttachment }
| { kind: "forge_issue"; item: ForgeSearchItem }
| { kind: "forge_change_request"; item: ForgeSearchItem }
// COMPAT(githubAttachmentKinds): legacy persisted attachment kinds retained
+3 -2
View File
@@ -4,6 +4,7 @@ import type {
CommandCenterRegistration,
CommandCenterRegistrationOwner,
} from "./contributions";
import { compareText } from "@/utils/collation";
export interface CommandCenterRegistry {
getSnapshot(): CommandCenterContributionSnapshot;
@@ -28,10 +29,10 @@ function compareContributions(
right: CommandCenterContribution,
): number {
if (left.groupRank !== right.groupRank) return left.groupRank - right.groupRank;
const groupDelta = left.group.localeCompare(right.group);
const groupDelta = compareText(left.group, right.group);
if (groupDelta !== 0) return groupDelta;
if (left.rank !== right.rank) return left.rank - right.rank;
return left.id.localeCompare(right.id);
return compareText(left.id, right.id);
}
function sameContributions(
@@ -205,6 +205,7 @@ export function useWorkspaceCommandCenterActions(): void {
const { overrides } = useKeyboardShortcutOverrides();
const { gitActions, isGit, archiveWorkspace } = useGitActions({
serverId: serverId ?? "",
workspaceId,
cwd: cwd ?? "",
icons: GIT_ACTION_ICONS,
});
@@ -81,6 +81,7 @@ export function ArchivedAgentCallout({
agentId,
isWorkspaceRestoring = false,
}: ArchivedAgentCalloutProps) {
const { t } = useTranslation();
const targetKey = `${serverId}:${agentId}`;
const toast = useToast();
const { unarchive, isUnarchiving, canUnarchive } = useUnarchiveAgent({ serverId, agentId });
@@ -110,7 +111,15 @@ export function ArchivedAgentCallout({
const attemptKey = targetKey;
setUnarchiveErrorState(null);
try {
await unarchive();
await unarchive({
onRefreshed: (refreshed) => {
if (refreshed.historyDiverged) {
toast.show(t("workspace.tabs.toasts.reloadedAgentHistoryDiverged"), {
variant: "warning",
});
}
},
});
} catch (error) {
deliverUnarchiveError({
error,
@@ -121,7 +130,7 @@ export function ArchivedAgentCallout({
onToastError: toast.error,
});
}
}, [canUnarchive, targetKey, toast, unarchive]);
}, [canUnarchive, t, targetKey, toast, unarchive]);
return (
<KeyboardTranslateView style={styles.container}>
@@ -1,10 +1,13 @@
import React, { act } from "react";
import React, { act, useCallback, useState } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { persistAttachmentFromBlob } from "@/attachments/service";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { i18n } from "@/i18n/i18next";
import { WindowLayoutProvider } from "@/window-layout";
import { RetainedPanelActivity } from "@/components/retained-panel";
import { RetainedChatContent as NativeChatContent } from "@/panels/retained-chat-content.native";
import { RetainedChatContent as WebChatContent } from "@/panels/retained-chat-content.web";
import { AttachmentLightbox, type ImageLightboxSource } from "./attachment-lightbox";
interface FrameSample {
@@ -147,3 +150,48 @@ describe("AttachmentLightbox opening in the browser", () => {
await expectOpeningPaintsOnlyTheFittedImage({ type: "uri", uri });
});
});
let openImage: (() => void) | null = null;
function ThreadWithImage({ uri }: { uri: string }) {
const [source, setSource] = useState<ImageLightboxSource | null>(null);
openImage = () => setSource({ type: "uri", uri });
const close = useCallback(() => setSource(null), []);
return <AttachmentLightbox source={source} onClose={close} />;
}
function isLightboxShown(): boolean {
return document.querySelector('[data-testid="attachment-lightbox-backdrop"]') !== null;
}
describe("AttachmentLightbox when its chat leaves the screen", () => {
for (const [platform, ChatContent] of [
["web", WebChatContent],
["native", NativeChatContent],
] as const) {
it(`closes on ${platform} when another session takes over, and stays closed on return`, async () => {
const uri = URL.createObjectURL(await createPng(400, 300));
const showThread = (active: boolean) =>
root.render(
<SafeAreaProvider>
<WindowLayoutProvider>
<RetainedPanelActivity active={active}>
<ChatContent>
<ThreadWithImage uri={uri} />
</ChatContent>
</RetainedPanelActivity>
</WindowLayoutProvider>
</SafeAreaProvider>,
);
await act(async () => showThread(true));
await act(async () => openImage?.());
expect(isLightboxShown()).toBe(true);
await act(async () => showThread(false));
expect(isLightboxShown()).toBe(false);
await act(async () => showThread(true));
expect(isLightboxShown()).toBe(false);
});
}
});
@@ -13,6 +13,7 @@ import {
useAttachmentPreviewUrl,
} from "@/attachments/use-attachment-preview-url";
import { isNative } from "@/constants/platform";
import { useRetainedPanelActive } from "@/components/retained-panel";
import { SPACING } from "@/styles/theme";
import { WindowChromeRootRegion } from "@/utils/desktop-window";
import { ZoomableImage } from "@/components/zoomable-viewport/image";
@@ -42,12 +43,21 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
const contentSize = source?.type === "uri" ? source.contentSize : undefined;
const [errored, setErrored] = useState(false);
const failed = errored || image.status === "failed";
const modalLayer = useGlobalOverlayLayer("modal", source !== null);
const panelActive = useRetainedPanelActive();
const open = source !== null && panelActive;
const modalLayer = useGlobalOverlayLayer("modal", open);
useEffect(() => {
setErrored(false);
}, [metadata?.id, url]);
// The image belongs to the panel that opened it and closes for good when that panel leaves the
// screen. On web the Modal portals out of the hidden panel, and the hidden chat is frozen on the
// next commit, so the lightbox must also unmount in this inactive commit (see MenuSurface).
useEffect(() => {
if (source !== null && !panelActive) onClose();
}, [onClose, panelActive, source]);
const handleOverlayKeyDown = useCallback(
(event: KeyboardInputEvent) => {
if (event.key !== "Escape") return false;
@@ -60,7 +70,7 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
);
const setOverlayScope = useOverlayRegistration({
keys: ["Escape"],
active: source !== null,
active: open,
layer: modalLayer,
onKeyDown: handleOverlayKeyDown,
});
@@ -79,7 +89,7 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
const handleImageError = useCallback(() => setErrored(true), []);
if (!source) {
if (!open) {
return null;
}
@@ -131,13 +131,18 @@ export function AttachmentLabel({ icon, title, subtitle }: AttachmentLabelProps)
);
}
/** Holds a thumbnail's space while its image loads. */
export function AttachmentThumbnailPlaceholder() {
return <View style={styles.thumbnailPlaceholder} />;
}
/** Square image preview pill body. */
export function AttachmentThumbnail({ metadata }: { metadata: AttachmentMetadata }) {
const preview = useAttachmentPreviewUrl(metadata);
const uri = preview.status === "ready" ? preview.url : null;
const source = useMemo(() => (uri ? { uri } : null), [uri]);
if (!source) {
return <View style={styles.thumbnailPlaceholder} />;
return <AttachmentThumbnailPlaceholder />;
}
return <Image source={source} style={styles.thumbnail} />;
}
@@ -84,6 +84,9 @@ export function DraggableListHandle({ testID, style, children }: DraggableListHa
}
const SCROLL_ENABLED_FLEX_STYLE = { flex: 1 };
// Viewports of rows a nestable list keeps rendered around the container's viewport: two above,
// two below. FlatList's default of 21 would still render a long sidebar in full.
const NESTED_WINDOW_SIZE = 5;
// A drop remounts every row between the drag's start and end slots (see the draggable-flatlist
// patch), so state held inside a rendered row resets when a drop moves it. Keep state that must
@@ -206,9 +209,12 @@ export function DraggableList<T>({
showsVerticalScrollIndicator={showsVerticalScrollIndicator}
scrollEnabled={scrollEnabled}
// A list that doesn't scroll shows every row, so it renders them all in its first commit.
// FlatList's default first render is 10 rows; a nested list remounted by a drop would paint
// 10 rows, then grow on a later commit.
initialNumToRender={scrollEnabled ? undefined : data.length}
// FlatList's default first render is 10 rows; a list remounted by a drop would paint 10
// rows, then grow on a later commit. A nestable list is the exception: its
// NestableScrollContainer is a VirtualizedList, so it renders only the rows near that
// container's viewport, and a hidden sidebar does not render rows nobody can see.
initialNumToRender={scrollEnabled || nestable ? undefined : data.length}
windowSize={nestable ? NESTED_WINDOW_SIZE : undefined}
extraData={extraData}
simultaneousHandlers={simultaneousHandlers}
dragGestureHostPresented={gestureHostPresented}
@@ -688,6 +688,32 @@ it("keeps workspace-relative hover titles on explicit absolute file links", () =
);
});
it.each([
[
"an angle-bracket destination",
"[Open](</repo/src/file.ts>)",
'[Open](</repo/src/file.ts> "src/file.ts")',
],
["an escaped slash", "[Open](\\/repo/src/file.ts)", '[Open](\\/repo/src/file.ts "src/file.ts")'],
[
"an escaped separator",
"[Open](/repo\\/src/file.ts)",
'[Open](/repo\\/src/file.ts "src/file.ts")',
],
[
"a character reference",
"[Open](&#x2F;repo/src/file.ts)",
'[Open](&#x2F;repo/src/file.ts "src/file.ts")',
],
])("keeps the workspace hover title on a link written with %s", (_form, source, rendered) => {
expect(prepareMarkdownSource(source, "/repo").render()).toBe(rendered);
});
it("leaves links outside the workspace as written", () => {
const source = "[Docs](https://example.com/repo/x) and [Other](/repository/x) near /repo/x";
expect(prepareMarkdownSource(source, "/repo").render()).toBe(source);
});
it.each(['""', "''", "()"])("preserves an authored empty link title: %s", (title) => {
const source = `[Open](/repo/file.ts ${title})`;
expect(prepareMarkdownSource(source, "/repo").render()).toBe(source);
@@ -150,6 +150,13 @@ function workspaceHoverTitle(link: Link, markup: string, workspaceRoot?: string)
return link.url.slice(workspaceRoot.length + 1);
}
// Only a link into the workspace gets an edit, its hover title. A link's URL differs from its
// source text only by backslash escapes and character references, and `&` already takes the parse.
function mayLinkIntoWorkspace(source: string, workspaceRoot?: string): boolean {
if (!workspaceRoot || !source.includes("](")) return false;
return source.includes(`${workspaceRoot}/`) || source.includes("\\");
}
/** Preserve source spelling; adapt workspace images, spoiler delimiters, and entity text. */
export function prepareMarkdownSource(
source: string,
@@ -191,7 +198,7 @@ export function prepareMarkdownSource(
!/^[\t >]*[^\t >\r\n][^\r\n]*(?:\r\n|\r|\n)[^\r\n]+(?:\r\n|\r|\n)(?=[\t >:|-]*\|)[\t >|]*:?-[-\t :|]*$/m.test(
source,
) &&
!(workspaceRoot && source.includes("](")) &&
!mayLinkIntoWorkspace(source, workspaceRoot) &&
!(external && /\]|<[a-z]+:/i.test(source))
) {
return { images, ...metadata, render: () => source };
+206
View File
@@ -21,9 +21,11 @@ import {
type RewindMode,
} from "@/components/rewind";
import { TaskListRow } from "@/components/task-list-row";
import { Button } from "@/components/ui/button";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { useIsCompactFormFactor } from "@/constants/layout";
import { isNative, isWeb } from "@/constants/platform";
import { useProvidersSnapshot } from "@/hooks/use-providers-snapshot";
import { useRevealedText, type MarkdownPhase } from "@/hooks/use-revealed-text";
import { ICON_SIZE, type Theme } from "@/styles/theme";
import { inlineUnistylesStyle } from "@/styles/unistyles-inline-style";
@@ -47,13 +49,17 @@ import type { AgentMessage } from "@getpaseo/protocol/agent-message";
import type {
AgentCapabilityFlags,
AgentMetric,
AgentProvider,
ProviderSwitchContextSummary,
ToolCallDetail,
} from "@getpaseo/protocol/agent-types";
import type { AgentAttachment } from "@getpaseo/protocol/messages";
import MaskedView from "@react-native-masked-view/masked-view";
import {
ArrowRightLeft,
Check,
CheckSquare,
ChevronDown,
ChevronRight,
CircleDot,
Copy,
@@ -1575,6 +1581,206 @@ export const CompactionMarker = memo(function CompactionMarker({
);
});
const StyledSwitchIcon = withUnistyles(ArrowRightLeft, (theme) => ({
color: theme.colors.foregroundMuted,
}));
const StyledChevronDownIcon = withUnistyles(ChevronDown, (theme) => ({
color: theme.colors.foregroundMuted,
}));
const StyledChevronRightIcon = withUnistyles(ChevronRight, (theme) => ({
color: theme.colors.foregroundMuted,
}));
export interface ProviderSwitchMarkerProps {
serverId?: string | null;
fromProvider: AgentProvider;
toProvider: AgentProvider;
fromModel?: string | null;
toModel?: string | null;
context?: ProviderSwitchContextSummary;
}
const providerSwitchStylesheet = StyleSheet.create((theme) => ({
wrapper: {
paddingVertical: theme.spacing[2],
gap: theme.spacing[2],
},
row: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
width: "100%",
},
line: {
flex: 1,
minWidth: 12,
height: 1,
backgroundColor: theme.colors.border,
},
triggerButton: {
flexShrink: 1,
minWidth: 0,
maxWidth: "85%",
},
triggerContent: {
flexDirection: "row",
alignItems: "center",
flexShrink: 1,
minWidth: 0,
maxWidth: "100%",
gap: theme.spacing[1.5],
},
triggerText: {
flexShrink: 1,
minWidth: 0,
fontFamily: theme.fontFamily.ui,
fontSize: 13,
color: theme.colors.foregroundMuted,
},
chevronSlot: {
width: 12,
height: 12,
alignItems: "center",
justifyContent: "center",
},
detailsCard: {
alignSelf: "center",
maxWidth: 480,
width: "100%",
paddingVertical: theme.spacing[2],
paddingHorizontal: theme.spacing[3],
borderRadius: theme.borderRadius.md,
borderWidth: 1,
borderColor: theme.colors.border,
backgroundColor: theme.colors.surface0,
gap: theme.spacing[1],
},
detailRow: {
fontFamily: theme.fontFamily.ui,
fontSize: 12,
color: theme.colors.foregroundMuted,
},
}));
function resolveProviderSwitchLabel(
provider: string,
entries: ReturnType<typeof useProvidersSnapshot>["entries"],
): string {
return entries?.find((entry) => entry.provider === provider)?.label ?? provider;
}
function resolveProviderSwitchModelLabel(
provider: string,
modelId: string | null | undefined,
entries: ReturnType<typeof useProvidersSnapshot>["entries"],
): string | null {
if (!modelId) return null;
const entry = entries?.find((candidate) => candidate.provider === provider);
return entry?.models?.find((model) => model.id === modelId)?.label ?? modelId;
}
function formatProviderSwitchEndpoint(providerLabel: string, modelLabel: string | null): string {
return modelLabel ? `${providerLabel} (${modelLabel})` : providerLabel;
}
export const ProviderSwitchMarker = memo(function ProviderSwitchMarker({
serverId = null,
fromProvider,
toProvider,
fromModel,
toModel,
context,
}: ProviderSwitchMarkerProps) {
const { t } = useTranslation();
const { entries: providerEntries } = useProvidersSnapshot(serverId);
const [expanded, setExpanded] = useState(false);
const handleToggle = useCallback(() => setExpanded((prev) => !prev), []);
const fromLabel = resolveProviderSwitchLabel(fromProvider, providerEntries);
const toLabel = resolveProviderSwitchLabel(toProvider, providerEntries);
const fromModelLabel = resolveProviderSwitchModelLabel(fromProvider, fromModel, providerEntries);
const toModelLabel = resolveProviderSwitchModelLabel(toProvider, toModel, providerEntries);
const title = t("message.providerSwitch.switched", {
from: fromLabel,
to: toLabel,
});
const contextLine = context
? t("message.providerSwitch.contextSummary", {
count: context.includedItems,
chars: context.charCount.toLocaleString(),
budget: context.budgetChars.toLocaleString(),
})
: null;
const reasonsLine =
context?.truncated && context.omittedReasons?.length
? t("message.providerSwitch.trimmed", {
reasons: context.omittedReasons
.map((reason) => {
if (reason === "tail_window_limit") {
return t("message.providerSwitch.reasonTailWindow");
}
if (reason === "char_budget") {
return t("message.providerSwitch.reasonCharBudget");
}
return reason;
})
.join(", "),
})
: null;
let chevronIcon: React.ReactNode = null;
if (context) {
chevronIcon = expanded ? (
<StyledChevronDownIcon size={12} />
) : (
<StyledChevronRightIcon size={12} />
);
}
return (
<View style={providerSwitchStylesheet.wrapper} testID="provider-switch-marker">
<View style={providerSwitchStylesheet.row}>
<View style={providerSwitchStylesheet.line} />
<Button
variant="ghost"
size="sm"
style={providerSwitchStylesheet.triggerButton}
onPress={context ? handleToggle : undefined}
accessibilityLabel={title}
testID="provider-switch-marker-toggle"
>
<View style={providerSwitchStylesheet.triggerContent}>
<StyledSwitchIcon size={12} />
<Text
style={providerSwitchStylesheet.triggerText}
numberOfLines={1}
ellipsizeMode="tail"
>
{title}
</Text>
<View style={providerSwitchStylesheet.chevronSlot}>{chevronIcon}</View>
</View>
</Button>
<View style={providerSwitchStylesheet.line} />
</View>
{expanded && context ? (
<View style={providerSwitchStylesheet.detailsCard} testID="provider-switch-marker-details">
<Text style={providerSwitchStylesheet.detailRow}>
{`${formatProviderSwitchEndpoint(fromLabel, fromModelLabel)} → ${formatProviderSwitchEndpoint(toLabel, toModelLabel)}`}
</Text>
{contextLine ? (
<Text style={providerSwitchStylesheet.detailRow}>{contextLine}</Text>
) : null}
{reasonsLine ? (
<Text style={providerSwitchStylesheet.detailRow}>{reasonsLine}</Text>
) : null}
</View>
) : null}
</View>
);
});
interface TodoListCardProps {
items: TodoEntry[];
activity: TaskActivity;
@@ -4,8 +4,8 @@ import { FlatList, Text, View } from "react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { AlertTriangle, ChevronDown, Layers } from "lucide-react-native";
import type { AgentProfilePickerRow } from "@/agent-profiles";
import { IndependentScrollBoundary } from "@/components/ui/independent-scroll-boundary";
import {
IndependentScrollBoundary,
MODEL_PICKER_ROW_HEIGHT,
ModelBrowserLoadingState,
ModelBrowserNoProviders,
+5 -29
View File
@@ -12,7 +12,6 @@ import {
import { useTranslation } from "react-i18next";
import {
FlatList,
Platform,
Pressable,
ScrollView,
Text,
@@ -27,6 +26,10 @@ import {
type StyleProp,
type ViewStyle,
} from "react-native";
import {
IndependentScrollBoundary,
useIndependentScrollGesture,
} from "@/components/ui/independent-scroll-boundary";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import {
@@ -209,10 +212,6 @@ function AgentProfilesEditAction({ onPress }: { onPress: () => void }) {
);
}
const IndependentScrollGestureContext = createContext<ReturnType<typeof Gesture.Native> | null>(
null,
);
interface ModelBrowserNavContextValue {
activeKey: string | null;
onActivateKey: (key: string) => void;
@@ -616,7 +615,7 @@ function ModelBrowserPressable({
onLayout,
testID,
}: ModelBrowserPressableProps) {
const independentScrollGesture = useContext(IndependentScrollGestureContext);
const independentScrollGesture = useIndependentScrollGesture();
const [pressed, setPressed] = useState(false);
// Android's scroll handler must keep the pointer stream until release so a
// fling survives leaving the short viewport. A simultaneous Tap keeps rows
@@ -1381,29 +1380,6 @@ function GroupedProviderRows({
);
}
export function IndependentScrollBoundary({ children }: { children: React.ReactElement }) {
// Prevent the parent sheet from cancelling Android's native scroll when the
// finger crosses this viewport; receiving ACTION_UP is what preserves fling.
const nativeScrollGesture = useMemo(
() =>
Gesture.Native()
.shouldActivateOnStart(true)
.shouldCancelWhenOutside(false)
.disallowInterruption(true),
[],
);
if (Platform.OS !== "android") {
return children;
}
return (
<IndependentScrollGestureContext.Provider value={nativeScrollGesture}>
<GestureDetector gesture={nativeScrollGesture}>{children}</GestureDetector>
</IndependentScrollGestureContext.Provider>
);
}
function resolveModelListRevealTarget({
shouldRevealActive,
hasActiveHeaderItem,
@@ -11,11 +11,6 @@ describe("pairing target password", () => {
expect(target.changeUrl(second)).toBe(false);
});
it("clears the direct form credential when its advanced URI changes to a relay target", () => {
const target = new PairingTargetTracker("", true);
expect(target.changeUrl("relay://relay.example:443/srv_new?key=BBBB&ssl=true")).toBe(true);
});
it("keeps the password when a relay URI receives harmless whitespace", () => {
const uri = "relay://relay.example:443/srv_a?key=AAAA&ssl=true";
const target = new PairingTargetTracker(uri);
@@ -19,8 +19,8 @@ function pairingTarget(url: string): string | null {
export class PairingTargetTracker {
private currentTarget: string | null;
constructor(initialUrl = "", startsFromDirectForm = false) {
this.currentTarget = pairingTarget(initialUrl) ?? (startsFromDirectForm ? "direct-form" : null);
constructor(initialUrl = "") {
this.currentTarget = pairingTarget(initialUrl);
}
changeUrl(nextUrl: string): boolean {
@@ -10,7 +10,11 @@ import { useToast } from "@/contexts/toast-context";
import type { AgentScreenReadySyncState } from "@/hooks/use-agent-screen-state-machine";
import { selectAgentTimelineState, useSessionStore } from "@/stores/session-store";
import { useRewindAgentMutation } from "./use-rewind-agent-mutation";
import { isRewindableMessage, useRewindMenuItems } from "./use-rewind-capabilities";
import {
isPromptInActiveSegment,
isRewindableMessage,
useRewindMenuItems,
} from "./use-rewind-capabilities";
export function RewindCommandCenterRegistration({
serverId,
@@ -42,10 +46,16 @@ export function RewindCommandCenterRegistration({
if (timeline.status !== "synced" || timeline.newer === "available") {
return undefined;
}
return (
const candidate =
session.agentStreamHead.get(agentId)?.findLast((item) => item.kind === "user_message") ??
timeline.items.findLast((item) => item.kind === "user_message")
);
timeline.items.findLast((item) => item.kind === "user_message");
if (
!candidate ||
!isPromptInActiveSegment(candidate.timelineCursor, timeline.range?.activeSegmentStartSeq)
) {
return undefined;
}
return candidate;
});
const { rewindAgent, isPending } = useRewindAgentMutation({
serverId,
@@ -9,6 +9,7 @@ import { useRewindComposerRestore } from "./composer-restore";
import { useSessionStore } from "@/stores/session-store";
import { shouldRestoreComposerForRewindMode } from "./rewind-mode";
import { getHostRuntimeStore } from "@/runtime/host-runtime";
import { hostSupportsFeature } from "@/runtime/host-features";
interface UseRewindAgentMutationInput {
serverId?: string;
@@ -42,7 +43,16 @@ export function useRewindAgentMutation(input: UseRewindAgentMutationInput): {
throw new Error(t("common.errors.daemonClientUnavailable"));
}
await input.client.rewindAgent(input.agentId, input.messageId, mode);
if (mode !== "files") {
// COMPAT(timelineRewindOperations): added in v0.18.0, remove after 2027-05-25. A daemon with
// the feature delivers the rewind on the live timeline; an older one replaced the timeline
// and this client has to read it again.
const appliesLive =
input.serverId !== undefined &&
hostSupportsFeature(
useSessionStore.getState().sessions[input.serverId]?.serverInfo,
"timelineRewindOperations",
);
if (mode !== "files" && !appliesLive) {
const cursor = input.serverId
? useSessionStore
.getState()
@@ -26,6 +26,20 @@ export function isRewindableMessage(messageId: string | undefined, text: string)
return Boolean(messageId) && text.trim().length > 0;
}
/**
* Whether a user prompt belongs to the active provider segment (after the latest provider switch).
* Prompts from earlier provider segments cannot be rewound.
*/
export function isPromptInActiveSegment(
timelineCursor: { anchorSeq?: number; seq?: number } | undefined,
activeSegmentStartSeq: number | undefined,
): boolean {
if (!activeSegmentStartSeq || activeSegmentStartSeq <= 0) return true;
const anchor = timelineCursor?.anchorSeq ?? timelineCursor?.seq;
if (anchor === undefined) return true;
return anchor > activeSegmentStartSeq;
}
export function resolveRewindMenuItems(
capabilities:
| Pick<
@@ -37,7 +37,7 @@ export type { SettingsRowHintStatus } from "./row-header";
export { SettingsAddRow } from "./add-row";
export { SettingsBackLink, SettingsDetailHeader } from "./detail-header";
export { SettingsInfoTip } from "./headings/settings-info-tip";
export { MenuSettingsRows } from "./row-density";
export { ListSettingsRows, MenuSettingsRows } from "./row-density";
/**
* What app screens can add to a plugin-facing row: an accessory beside the label, such as an info

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