Compare commits

...
Author SHA1 Message Date
Mohamed Boudra 7762ce0639 chore(release): cut 0.18.2 2026-11-30 06:17:10 +01:00
Mohamed Boudra 10e0a4364e docs(changelog): add 0.18.2 release notes 2026-11-30 06:11:54 +01: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
Feraidoon MehriandClaude Opus 5.5 d63f0204e5 fix(cli): list pending permissions of background agents in permit ls (#10655)
permit ls read one page of fetch_agents without includeBackground, so it missed requests from background agents and from any agent past the first 200. Read every page through fetchAllAgents and include background agents when the host supports them.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:12:45 +00:00
paseo-bot[bot]andThomas Van 9c9c839bd0 fix(pi): keep the daemon alive when an extension prompt fails (#11329)
Observe extension result rejections before awaiting the prompt response. Callers still receive the original prompt or extension error.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Thomas Van <9481872+thomasvan@users.noreply.github.com>
2026-11-29 15:42:43 +00:00
paseo-bot[bot]andClaude Opus 5.5 0e8e3987a0 Wait for the model sheet to settle before comparing Profiles and Model (#11330)
The compact-drawer step read the Profiles and Model rows' boxes in two
calls while the bottom sheet was still sliding up, so the second read
could land above the first. Wait for the sheet to stop moving first,
with the existing sheet-layout helper.

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 15:38:05 +00:00
0b1b2dd286 Keep plugin-transformed replies distinct in chat history (#8498)
* fix(app): keep chat history from crashing when two rows share an id

The chat virtualizer caches measured row sizes by key, and the key was the
row id. When two history rows had the same id, both rows wrote the same
cache entry. Each measurement pass set the size to the other row's height,
so the layout effect re-rendered without end and React aborted with
"Maximum update depth exceeded" (minified error #185).

Give each virtualized row a unique key. A repeated id gets a numeric
suffix, and the first occurrence keeps its plain id so the reading anchor
still matches it.

* fix(plugins): keep transformed replies distinct in chat history

Replacement IDs are local to their source message. Reusing a stable output
ID across replies aliased the row and virtualizer caches, reproducing a
packaged desktop React #185 crash. Scope row identity at projection and
retain the original prompt identity for navigation.

Build on the contributor regression, exercising transformed source rows
instead of assigning occurrence keys in the virtualizer.

Co-authored-by: Kevin Le <anhle12892@gmail.com>
Co-authored-by: ykurilov <110710320+ykurilov@users.noreply.github.com>

* test(plugins): verify repeated timeline IDs in a real browser

Exercise the installed plugin through the real daemon and chat viewport. Read the oldest virtualized replacement before and after reload, using actual browser row heights instead of extending the legacy JSDOM harness.

* test(app): use projected row IDs in turn footer assertions

---------

Co-authored-by: Kevin Le <anhle12892@gmail.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: ykurilov <110710320+ykurilov@users.noreply.github.com>
2026-11-29 14:42:45 +00:00
Mohamed Boudra 2c0bc525d3 perf(app): stop holding a copy of every cached transcript in renderer memory (#11322)
* perf(app): keep only row keys and sizes in the replica cache index

The replica cache kept every stored payload string in memory to enforce its
disk budget, so the renderer held a second copy of each cached transcript until
restart (#6477). Row stores now report each row's key and UTF-8 payload size
without loading payloads, and the cache budgets on those sizes alone.

* test(app): seed and read the replica cache at the app's database version
2026-11-29 20:54:01 +07:00
Mohamed Boudra 27e35a198d fix(app): close the keyboard when opening a file from the Files tree (#11320)
Since the Files tree gained a filter, its input stays focused when a match is
tapped. The preview sheet opens over the pane without taking input, so the
software keyboard covered the bottom of the file.
2026-11-29 20:23:44 +07:00
Mohamed Boudra 8b7cb47ef2 fix(app): keep Gboard suggestions and double-space period from corrupting Android terminal input (#11318)
* fix(app): keep Gboard suggestions and double-space period intact in the Android terminal

The Android terminal input connection emptied its editable after every
commit, while Gboard keeps its own copy of the committed text and edits it
by offset. On Android 14+ a suggestion pick or double-space period arrives as
replaceText(start, end, text); against the empty editable the range clamped
to [0, 0], so the insert reached the shell but the deletion was lost
(helo -> hello sent "lo ", giving "helolo ").

Keep the current shell line's IME text in the editable and diff it against
what the terminal holds, so offset edits become rubouts plus the new
suffix. Terminal keys still empty the editable; they now restart the IME
because Gboard ignores updateSelection as a signal to reload its text.

* fix(app): reset the Android terminal IME line on Gboard arrow keys

Gboard's editing-panel arrows reach the input connection as key events and move the shell cursor, but the editable kept the typed line. A later suggestion pick then sent rubouts for text the shell cursor was no longer after. Arrows now empty the editable and restart the IME like the other terminal keys.
2026-11-29 19:39:42 +07:00
Mohamed Boudra 693fa22377 fix(app): step back a page on Android Back in Agent settings (#11313)
AdaptiveModalSheet now forwards its header's back to the sheet's Android
Back handling, so Back from the Model page returns to Agent settings and
closes the sheet only from the first page.
2026-11-29 19:39:38 +07:00
Mohamed Boudra 22a318b1de fix(terminal): deliver one DEC 2031 report per theme switch (#11312)
The browser xterm (web and desktop) tracked CSI ?2031h itself and sent its
own unsolicited ESC[?997;Nn whenever its theme changed, on top of the
daemon's report. Query suppression could not catch it because no query is
involved. Every mounted viewer did this, so a background viewer that does
not own the terminal palette could also report a scheme the owner never
showed.

Turn off xterm's colorSchemeQuery extension so the daemon stays the only
DEC 2031 / DSR 996 responder, behind the existing palette ownership.

Refs #2795
2026-11-29 19:38:31 +07:00
paseo-bot[bot] 4f8fed2e2b test(app): wait for both pins before the pinned sidebar drag (#11319)
The pinned drag matched its two rows anywhere in the sidebar. Both rows
also exist in their project groups, so the test read the order while only
one pin had reached the Pinned section. The second pin then put its row on
top, and the drag moved it back down, which left the order the test read.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-29 12:36:39 +00:00
173 changed files with 5244 additions and 969 deletions
+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))
+6 -1
View File
@@ -601,7 +601,12 @@ The cache is capped at 32 MiB and evicts whole hosts in least-recently-written o
eviction, only a baseline replacement stores that host's directory again. Mutations queued around
the eviction are dropped when they are written, so a checkpoint never outlives its rows. Budget
bookkeeping may scan opaque row sizes during a deferred write, never during host registry startup or
before a requested cache row can paint. The row store is not encrypted. A cached timeline can contain
before a requested cache row can paint. The cache holds only each row's key and UTF-8 payload size,
never the payload: a timeline row can be megabytes, and the renderer would hold a second copy of
every cached transcript until restart. Each store reports sizes without loading payloads. SQLite
measures the stored text, and IndexedDB records the size on the row and reads an index over it.
Opening an IndexedDB database written before that index existed drops its rows, because they would
be readable but never counted against the budget. The row store is not encrypted. A cached timeline can contain
source code, prompts, and tool output; encrypted-at-rest storage is a separate security decision.
### Saved hosts
+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.
+25 -11
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.
+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.
+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
+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.
@@ -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
+29 -29
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": [
@@ -37543,7 +37543,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 +39696,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",
@@ -39949,11 +39949,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 +39965,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.18.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40208,7 +40208,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 +40254,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 +40284,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 +40292,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 +40303,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 +40326,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 +40353,7 @@
}
},
"packages/react-native-enriched-markdown": {
"version": "0.18.1",
"version": "0.18.2",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
@@ -40369,7 +40369,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 +40591,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",
@@ -41552,7 +41552,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 +43178,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.18.1",
"version": "0.18.2",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+1 -1
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": [
+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 () => {
@@ -128,6 +128,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({
@@ -30,6 +30,7 @@ import { openGlobalNewWorkspaceComposer } from "../support/helpers/new-workspace
import { clickNewChat, clickNewTerminal, gotoWorkspace } from "../support/helpers/launcher";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { seedWorkspace } from "../support/helpers/seed-client";
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
const MOCK_PROVIDER_LABEL = "Mock Load Test";
@@ -316,13 +317,17 @@ 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();
expect(profilesBox && modelBox && profilesBox.y < modelBox.y).toBe(true);
@@ -359,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();
@@ -15,6 +15,9 @@ import {
expectBothConsecutiveTools,
trackPluginChatRecovery,
reconnectPluginChat,
withRepeatedOutputTimeline,
readOldestPluginReplacement,
expectOldestPluginReplacementReadable,
} from "../support/helpers/plugin-timeline";
for (const width of [1100, 390]) {
@@ -82,3 +85,15 @@ test("plugin-transformed assistant reply keeps copy, fork, and turn duration in
expect(await forkAttachment.waitForText()).toContain(ASSISTANT_TEXT);
});
});
test("keeps older plugin replacements readable when source messages reuse local output IDs", async ({
page,
}, info) => {
await withRepeatedOutputTimeline(page, info, async () => {
await readOldestPluginReplacement(page);
await expectOldestPluginReplacementReadable(page);
await page.reload({ waitUntil: "domcontentloaded" });
await readOldestPluginReplacement(page);
await expectOldestPluginReplacementReadable(page);
});
});
@@ -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());
@@ -118,10 +118,14 @@ test("projects and pinned chats reorder while ordinary workspaces stay newest fi
await firstProject.client.setWorkspacePinned(firstProject.workspaceId, true);
await secondProject.client.setWorkspacePinned(secondProject.workspaceId, true);
const secondProjectWorkspaceTestId = `sidebar-workspace-row-${getServerId()}:${secondProject.workspaceId}`;
// Both rows also exist in their project groups, so match them only once each pin has
// moved its row into the Pinned section.
await quickDragFirstRowAfterSecond(
page.locator(
`[data-testid="${firstWorkspaceTestId}"], [data-testid="${secondProjectWorkspaceTestId}"]`,
),
page
.getByTestId("sidebar-pinned-section")
.locator(
`[data-testid="${firstWorkspaceTestId}"], [data-testid="${secondProjectWorkspaceTestId}"]`,
),
pressWorkspaceRow,
);
} finally {
@@ -392,6 +392,8 @@ test.describe("Terminal protocol queries", () => {
await terminalSurface(page).click();
await terminalSurface(page).pressSequentially("Q", { delay: 0 });
await expectTerminalOutput(lightTerminalId, "WATCH2031_DONE");
// One report per switch: a second responder would deliver each switch twice.
expect(watch2031Events(await terminalOutput(lightTerminalId))).toEqual(["1", "2"]);
await selectAppThemeInApp(page, "Dark");
await runPaletteChecks(lightTerminalId, TERMINAL_PALETTE_SCENARIOS.dark, {
@@ -428,6 +430,10 @@ test.describe("Terminal protocol queries", () => {
return capture.lines.join("").replace(/\s/g, "");
}
function watch2031Events(output: string): string[] {
return [...output.matchAll(/WATCH2031_EVENT:([12])/g)].map(([, scheme]) => scheme);
}
async function expectTerminalOutput(terminalId: string, text: string): Promise<void> {
await expect.poll(() => terminalOutput(terminalId), { timeout: 10_000 }).toContain(text);
}
@@ -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);
}
@@ -0,0 +1,60 @@
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { setTimeout } from "node:timers/promises";
// Opening a file from the filtered Files tree must close the software keyboard.
//
// Before running, on a phone-sized device with a software keyboard enabled, open
// Explorer -> Files in a workspace where the first match for the query is a file.
// The app must already run the checkout being verified against a real daemon.
const serial = process.env.ANDROID_SERIAL ?? "emulator-5554";
const query = process.env.PASEO_FILES_FILTER_QUERY ?? "README";
function adb(...args) {
return execFileSync("adb", ["-s", serial, ...args], { encoding: "utf8", timeout: 60_000 });
}
function findNode(id) {
adb("shell", "uiautomator", "dump", "/sdcard/files-filter-keyboard.xml");
const tree = adb("exec-out", "cat", "/sdcard/files-filter-keyboard.xml");
const node = tree.match(new RegExp(`<node [^>]*resource-id="${id}"[^>]*>`))?.[0];
const bounds = node?.match(/bounds="\[(\d+),(\d+)\]\[(\d+),(\d+)\]"/);
if (!bounds) return null;
const [left, top, right, bottom] = bounds.slice(1).map(Number);
return { x: Math.round((left + right) / 2), y: Math.round((top + bottom) / 2) };
}
async function waitForNode(id) {
const deadline = Date.now() + 30_000;
while (Date.now() < deadline) {
const node = findNode(id);
if (node) return node;
await setTimeout(250);
}
throw new Error(`Timed out waiting for ${id}`);
}
function tap({ x, y }) {
adb("shell", "input", "tap", String(x), String(y));
}
async function waitForKeyboard(shown) {
let stable = 0;
const deadline = Date.now() + 10_000;
while (Date.now() < deadline) {
const state = adb("shell", "dumpsys", "input_method");
stable = /^ {2}mInputShown=true$/m.test(state) === shown ? stable + 1 : 0;
if (stable === 3) return;
await setTimeout(200);
}
assert.fail(`Keyboard did not settle at shown=${shown}`);
}
const clear = findNode("files-filter-clear");
if (clear) tap(clear);
tap(await waitForNode("files-filter-input"));
await waitForKeyboard(true);
adb("shell", "input", "text", query);
const match = await waitForNode("file-filter-row-0");
await waitForKeyboard(true); // Typing and new results leave the keyboard up.
tap(match);
await waitForNode("sheet-tab-body");
await waitForKeyboard(false);
console.log("PASS: opening a filtered file closes the keyboard");
@@ -18,6 +18,9 @@ press "id=\"combined-model-selector\""
wait "id=\"model-provider-${PROVIDER_ID}\"" 10000
press "id=\"model-provider-${PROVIDER_ID}\""
wait "id=\"model-row-${PROVIDER_ID}-${MODEL_ID}\"" 3000
# Back takes the header's step to the provider list first, then dismisses the modal.
back
wait "id=\"model-provider-${PROVIDER_ID}\"" 3000
back
wait "id=\"combined-model-selector\" label=\"Select model (${MODEL_LABEL})\"" 3000
close
@@ -10,13 +10,13 @@ wait "id=\"agent-controls-model\"" 10000
gesture pan 540 790 0 960 500
wait "id=\"combined-model-selector\"" 3000
# Reopen, dismiss the nested model browser, then dismiss its restored parent.
# Android Back steps from Model back to Agent settings, then closes the sheet.
press "id=\"combined-model-selector\""
wait "id=\"agent-controls-model\"" 10000
press "id=\"agent-controls-model\""
wait stable 300 5000
gesture pan 540 790 0 960 500
wait "id=\"model-search-all-input\"" 10000
back
wait "id=\"agent-controls-model\"" 3000
gesture pan 540 790 0 960 500
back
wait "id=\"combined-model-selector\"" 3000
close
@@ -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
@@ -7,6 +7,7 @@ import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { openAgentRoute, seedMockAgentWorkspace, type MockAgentWorkspace } from "./mock-agent";
import { installDaemonWebSocketGate } from "./daemon-websocket-gate";
import { expectReconnectingToastVisible } from "./workspace-ui";
import { userScrollsTimelineToHistoryStart } from "./timeline-pagination";
const PLUGIN_ID = "timeline-transform-e2e";
@@ -373,3 +374,81 @@ export async function viewInlineThinkingExample(page: Page, info: TestInfo): Pro
await example.cleanup();
}
}
/** Reuse plugin-local IDs across distinct source messages in a real virtualized chat. */
export async function withRepeatedOutputTimeline(
page: Page,
info: TestInfo,
run: () => Promise<void>,
): Promise<void> {
info.setTimeout(120_000);
const agent = await seedMockAgentWorkspace({
repoPrefix: "timeline-local-ids-",
title: "Repeated plugin output IDs",
});
try {
for (const label of ["First", "Second", "Third"]) {
await agent.client.sendAgentMessage(
agent.agentId,
`${label}: emit 1 coalesced agent stream updates`,
);
await agent.client.waitForFinish(agent.agentId, 15_000);
}
await withDirectoryPlugin({
pluginId: "timeline-local-ids",
source: `import React from "react";
import { Text, View } from "react-native";
import { z } from "zod";
function Row({ item }) {
return <View style={{ height: item.data.tall ? 120 : 24 }}>
<Text>{item.data.label}</Text>
</View>;
}
export default function contribute(client) {
client.addTimelineTransformer({
id: "local-ids", query: { itemType: "user_message" },
transform({ item }) {
const label = item.text.split(":")[0];
return { items: Array.from({ length: 60 }, (_, index) => ({
type: "plugin", id: "part-" + index, kind: "reply", version: 1,
data: { label: label + " replacement " + index, tall: label === "Second" },
})) };
},
});
client.addTimelineRenderer({
kind: "reply", version: 1,
schema: z.object({ label: z.string(), tall: z.boolean() }), Component: Row,
});
return () => {};
}`,
run: async () => {
await openAgentRoute(page, agent);
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
await run();
},
});
} finally {
await agent.cleanup();
}
}
export async function readOldestPluginReplacement(page: Page): Promise<void> {
await expect(page.getByText("Third replacement 59", { exact: true }).first()).toBeAttached();
await expect
.poll(async () => {
await userScrollsTimelineToHistoryStart(page);
return page.getByText("First replacement 0", { exact: true }).isVisible();
})
.toBe(true);
}
export async function expectOldestPluginReplacementReadable(page: Page): Promise<void> {
await expect(
page
.getByTestId("agent-chat-scroll")
.locator("[data-index]")
.getByText("First replacement 0", { exact: true }),
).toBeVisible();
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
await expect(page.getByText("Paseo ran into a problem.", { exact: true })).toHaveCount(0);
}
@@ -61,18 +61,24 @@ async function readRows(input: {
storeName: string;
}): Promise<ReplicaRowRecord[]> {
const database = await new Promise<IDBDatabase>((resolve, reject) => {
const request = indexedDB.open(input.databaseName, 1);
request.addEventListener("success", () => resolve(request.result));
request.addEventListener("error", () => reject(request.error));
});
return new Promise((resolve, reject) => {
const request = database
.transaction(input.storeName, "readonly")
.objectStore(input.storeName)
.getAll();
// The app owns the database version; open whatever version it created.
const request = indexedDB.open(input.databaseName);
request.addEventListener("success", () => resolve(request.result));
request.addEventListener("error", () => reject(request.error));
});
try {
return await new Promise((resolve, reject) => {
const request = database
.transaction(input.storeName, "readonly")
.objectStore(input.storeName)
.getAll();
request.addEventListener("success", () => resolve(request.result));
request.addEventListener("error", () => reject(request.error));
});
} finally {
// An open connection would block the app from upgrading the database.
database.close();
}
}
function assembleCache(rows: ReplicaRowRecord[]): ReplicaCacheRecord {
@@ -185,19 +191,27 @@ export async function writeReplicaCache(page: Page, value: ReplicaCacheRecord):
await page.evaluate(
async ({ databaseName, storeName, nextRows }) => {
const database = await new Promise<IDBDatabase>((resolve, reject) => {
const request = indexedDB.open(databaseName, 1);
const request = indexedDB.open(databaseName);
request.addEventListener("success", () => resolve(request.result));
request.addEventListener("error", () => reject(request.error));
});
await new Promise<void>((resolve, reject) => {
const transaction = database.transaction(storeName, "readwrite");
const store = transaction.objectStore(storeName);
store.clear();
for (const row of nextRows) store.put(row);
transaction.addEventListener("complete", () => resolve());
transaction.addEventListener("error", () => reject(transaction.error));
transaction.addEventListener("abort", () => reject(transaction.error));
});
try {
await new Promise<void>((resolve, reject) => {
const transaction = database.transaction(storeName, "readwrite");
const store = transaction.objectStore(storeName);
store.clear();
// The app budgets the cache on each row's recorded UTF-8 payload size.
const encoder = new TextEncoder();
for (const row of nextRows) {
store.put({ ...row, payloadBytes: encoder.encode(row.payload).length });
}
transaction.addEventListener("complete", () => resolve());
transaction.addEventListener("error", () => reject(transaction.error));
transaction.addEventListener("abort", () => reject(transaction.error));
});
} finally {
database.close();
}
},
{ databaseName: DATABASE_NAME, storeName: STORE_NAME, nextRows: rows },
);
@@ -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";
@@ -1,11 +1,13 @@
package sh.paseo.terminal
import android.os.Build
import android.text.InputType
import android.view.KeyCharacterMap
import android.view.KeyEvent
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
@@ -77,6 +79,15 @@ class TerminalInputConnectionTest {
}
}
/** Gboard commits each letter in its own batch edit when the editor disables suggestions. */
private fun TerminalInputConnection.typeLikeGboard(text: String) {
for (ch in text) {
beginBatchEdit()
commitText(ch.toString(), 1)
endBatchEdit()
}
}
@Test
fun editorInfoDisablesSuggestionsFullscreenAndPersonalizedLearning() {
instrumentation.runOnMainSync {
@@ -100,13 +111,8 @@ class TerminalInputConnectionTest {
@Test
fun batchedCommitTextAndSetComposingTextDoNotDoubleCharacters() {
withInputHarness { _, ic, _, terminal ->
for (ch in listOf("a", "b", "c", "d")) {
ic.beginBatchEdit()
ic.commitText(ch, 1)
ic.endBatchEdit()
}
ic.typeLikeGboard("abcd")
assertEquals("abcd", terminal.rawStream)
assertEquals("", ic.editable.toString())
// Coalesced setComposingText + finishComposingText inside one batch emits once.
ic.beginBatchEdit()
@@ -114,28 +120,96 @@ class TerminalInputConnectionTest {
ic.finishComposingText()
ic.endBatchEdit()
assertEquals("abcdef", terminal.rawStream)
assertEquals("", ic.editable.toString())
}
}
@Test
fun editorKeepsTheTypedLineUntilTerminalKeyBoundary() {
withInputHarness { _, ic, _, terminal ->
// IMEs address edits by offsets into the text they committed, so the editor must keep it.
ic.typeLikeGboard("ab")
assertEquals("ab", ic.getTextBeforeCursor(10, 0).toString())
// Enter leaves the shell line, so the editor starts the next line empty.
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER))
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER))
assertEquals("", ic.getTextBeforeCursor(10, 0).toString())
ic.typeLikeGboard("helo")
ic.beginBatchEdit()
ic.setComposingRegion(0, 4)
ic.commitText("hello ", 1)
ic.endBatchEdit()
assertEquals("ab\rhello ", terminal.applyToLine())
}
}
@Test
fun gboardArrowKeyStartsTheEditorOnAnEmptyLine() {
withInputHarness { _, ic, _, terminal ->
ic.typeLikeGboard("echo helo")
// Gboard's editing panel sends arrows as key events. The shell cursor moves, so the
// editor's copy of the line no longer matches where the next edit lands.
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_LEFT))
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DPAD_LEFT))
assertEquals("", ic.getTextBeforeCursor(10, 0).toString())
assertEquals(listOf("ArrowLeft"), terminal.keys.map { it.key })
assertEquals("echo helo", terminal.rawStream)
}
}
@Test
fun suggestionPickedThroughComposingRegionReplacesCommittedWord() {
withInputHarness { _, ic, _, terminal ->
// Gboard before Android 14 selects the committed word, then commits the suggestion.
ic.typeLikeGboard("helo")
ic.beginBatchEdit()
ic.setComposingRegion(3, 4)
ic.commitText("lo ", 1)
ic.endBatchEdit()
assertEquals("hello ", terminal.applyToLine())
}
}
@Test
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
fun gboardReplaceTextRewritesCommittedText() {
// Gboard on Android 14+ picks suggestions and applies double-space period with replaceText,
// addressing text it committed earlier. Offsets and texts below are the calls Gboard made live.
fun assertReplacement(typed: String, start: Int, end: Int, replacement: String, line: String) {
withInputHarness { _, ic, _, terminal ->
ic.typeLikeGboard(typed)
ic.beginBatchEdit()
ic.replaceText(start, end, replacement, 1, null)
ic.endBatchEdit()
assertEquals("$typed -> $replacement", line, terminal.applyToLine())
}
}
assertReplacement("helo", 3, 4, "lo ", line = "hello ")
assertReplacement("helo", 3, 4, "p ", line = "help ")
assertReplacement("echo hello", 5, 10, "jello ", line = "echo jello ")
assertReplacement("ab ", 2, 3, ". ", line = "ab. ")
}
@Test
fun backspaceWorksAcrossAllThreeImePaths() {
withInputHarness { _, ic, _, terminal ->
ic.commitText("abcd", 1)
assertEquals("abcd", terminal.applyToLine())
// Path 1: deleteSurroundingText (empty editable after commit)
// Path 1: deleteSurroundingText
ic.deleteSurroundingText(0, 0)
assertEquals("abcd", terminal.applyToLine())
ic.deleteSurroundingText(1, 0)
assertEquals("abc", terminal.applyToLine())
// Path 2: deleteSurroundingTextInCodePoints (empty editable)
// Path 2: deleteSurroundingTextInCodePoints
ic.deleteSurroundingTextInCodePoints(1, 0)
assertEquals("ab", terminal.applyToLine())
// Path 2b: deleteSurroundingTextInCodePoints on surrogate-pair emoji in composing buffer
ic.setComposingText("😀", 1)
// Path 2b: deleteSurroundingTextInCodePoints removes a surrogate-pair emoji as one code point
ic.commitText("😀", 1)
assertEquals("ab😀", terminal.applyToLine())
ic.deleteSurroundingTextInCodePoints(1, 0)
assertEquals("ab", terminal.applyToLine())
@@ -145,10 +219,16 @@ class TerminalInputConnectionTest {
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL))
assertEquals("a", terminal.applyToLine())
// Multi-char deleteSurroundingText on empty buffer
// Multi-char deleteSurroundingText
ic.commitText("xyz", 1)
ic.deleteSurroundingText(2, 0)
assertEquals("ax", terminal.applyToLine())
// After Enter the editor is empty, so Backspace still reaches text the shell already holds
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER))
ic.deleteSurroundingText(1, 0)
ic.deleteSurroundingTextInCodePoints(1, 0)
assertEquals("\r\u007f\u007f", terminal.rawStream.takeLast(3))
}
}
@@ -242,7 +322,7 @@ class TerminalInputConnectionTest {
ic.commitText("the", 1)
assertEquals("hellothe", terminal.applyToLine())
// Repeated clipboard paste of identical text works because editable clears after commit
// Repeated clipboard paste of identical text appends both copies
ic.commitText("echo ok", 1)
ic.commitText("echo ok", 1)
assertEquals("hellotheecho okecho ok", terminal.applyToLine())
@@ -22,9 +22,16 @@ internal data class TerminalKeyPayload(
/**
* Single authoritative IME + key stream for the Android native terminal.
*
* Keeps a private [SpannableStringBuilder] so Android IMEs can compose Hangul, Pinyin, and Latin
* candidates normally, diffs the editable against what was last sent to the PTY once each batch
* edit settles, and clears the editable as soon as no composing span remains.
* The private [SpannableStringBuilder] holds the text the IME has typed on the current shell line,
* committed and composing alike. IMEs keep their own copy of that text and edit it by offset:
* Gboard picks a suggestion or applies double-space period by replacing text it committed
* earlier. Once each batch edit settles, the editable is diffed against what the terminal already
* holds and only the difference is sent, as rubouts plus the new suffix.
*
* A terminal key (Enter, Tab, Escape, arrows, control and hardware characters) changes the shell
* line outside the IME, so it empties the editable and restarts the IME on the empty line.
* Keys sent to the terminal without passing through this connection do not empty it: the
* accessory bar, and the hardware arrows that `PaseoHardwareKeyboardModule` claims at window level.
*/
internal class TerminalInputConnection(
private val targetView: View,
@@ -196,6 +203,7 @@ internal class TerminalInputConnection(
KeyEvent.KEYCODE_DPAD_LEFT,
KeyEvent.KEYCODE_DPAD_RIGHT -> {
deadAccent = 0
flushAndClear()
val name = when (keyCode) {
KeyEvent.KEYCODE_DPAD_UP -> "ArrowUp"
KeyEvent.KEYCODE_DPAD_DOWN -> "ArrowDown"
@@ -342,57 +350,38 @@ internal class TerminalInputConnection(
if (diff.isNotEmpty()) {
out.append(normalizeLineEndings(diff))
}
lastSentText = currentText
val compStart = getComposingSpanStart(sharedEditable)
val compEnd = getComposingSpanEnd(sharedEditable)
val isComposing = compStart >= 0 && compEnd > compStart
if (!isComposing) {
val hadText = sharedEditable.isNotEmpty()
if (hadText || compStart >= 0) {
clearEditableSilently()
}
lastSentText = ""
if (hadText) {
// The IME just advanced its cursor for the committed text; report the reset to 0, 0.
forceUpdateSelection(0, 0, -1, -1)
} else {
notifySelectionIfChanged(0, 0, -1, -1)
}
} else {
lastSentText = currentText
val selStart = maxOf(0, Selection.getSelectionStart(sharedEditable))
val selEnd = maxOf(0, Selection.getSelectionEnd(sharedEditable))
notifySelectionIfChanged(selStart, selEnd, compStart, compEnd)
var compStart = getComposingSpanStart(sharedEditable)
var compEnd = getComposingSpanEnd(sharedEditable)
if (compStart >= 0 && compEnd <= compStart) {
// An empty composing span would make hardware arrows look like IME navigation.
removeComposingSpans(sharedEditable)
compStart = -1
compEnd = -1
}
notifySelectionIfChanged(
maxOf(0, Selection.getSelectionStart(sharedEditable)),
maxOf(0, Selection.getSelectionEnd(sharedEditable)),
compStart,
compEnd,
)
if (out.isNotEmpty()) {
onInput(out.toString())
}
}
/** Sends pending IME text, then starts the IME on an empty line before a terminal key. */
private fun flushAndClear() {
batchEditDepth = 0
val hadText = sharedEditable.isNotEmpty()
val out = StringBuilder()
if (pendingBackspaces > 0) {
repeat(pendingBackspaces) { out.append('\u007f') }
pendingBackspaces = 0
}
val currentText = sharedEditable.toString()
val diff = computeDiff(lastSentText, currentText)
if (diff.isNotEmpty()) {
out.append(normalizeLineEndings(diff))
}
if (hadText || getComposingSpanStart(sharedEditable) >= 0) {
clearEditableSilently()
}
lastSentText = ""
if (hadText || lastSelStart != 0 || lastSelEnd != 0 || lastCompStart != -1 || lastCompEnd != -1) {
forceUpdateSelection(0, 0, -1, -1)
}
if (out.isNotEmpty()) {
onInput(out.toString())
flush()
if (sharedEditable.isEmpty()) return
resetState()
// The IME still holds the old line; updateSelection alone does not make Gboard reload it.
val imm = targetView.context.getSystemService(InputMethodManager::class.java) ?: return
if (imm.isActive(targetView)) {
imm.restartInput(targetView)
}
}
@@ -411,10 +400,6 @@ internal class TerminalInputConnection(
) {
return
}
forceUpdateSelection(selStart, selEnd, compStart, compEnd)
}
private fun forceUpdateSelection(selStart: Int, selEnd: Int, compStart: Int, compEnd: Int) {
lastSelStart = selStart
lastSelEnd = selEnd
lastCompStart = compStart
+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;
@@ -43,6 +43,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 {
@@ -166,7 +168,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],
);
}
+8 -7
View File
@@ -603,14 +603,15 @@ describe("layoutStream", () => {
splitIntoCards,
);
const layout = layoutFor({
platform,
tail,
timingIds: ["genui/a1/card", "genui/a2/card"],
});
const footerCardIds = tail
.filter((item) => item.kind === "plugin" && item.itemKind === "genui-card")
.map((item) => item.id);
expect(footerCardIds).toHaveLength(2);
expect(footerOwners(layout)).toEqual(["genui/a1/card", "genui/a2/card"]);
expect(findLayoutItem(layout, "genui/a1/card").completedFooter?.turnMetrics).toBe(
const layout = layoutFor({ platform, tail, timingIds: footerCardIds });
expect(footerOwners(layout)).toEqual(footerCardIds);
expect(findLayoutItem(layout, footerCardIds[0]).completedFooter?.turnMetrics).toBe(
first.turnMetrics,
);
expect(layout.auxiliaryTurnFooter?.turnMetrics).toBe(metrics);
@@ -203,7 +203,9 @@ describe("stream presentation through installed plugins", () => {
const source = rows(harness.source());
expect(source).toMatchObject([{ kind: "user_message", id: "prompt-1" }]);
expect(rendered).toMatchObject([{ kind: "plugin", id: "probe-plugin/prompt-1/0" }]);
expect(rendered).toMatchObject([
{ kind: "plugin", source: { id: "prompt-1" }, pluginItemId: "prompt-1/0" },
]);
// The chat outline jumps to the source id; the row it lands on is the plugin's.
expect(rendered.map(getStreamItemMessageId)).toEqual(["prompt-1"]);
});
@@ -611,7 +613,7 @@ it("folds work before a plugin-rendered reply and leaves the reply visible", ()
expect(result.tail.map((item) => item.id)).toEqual([
"prompt",
"turn-summary:prompt",
"probe-plugin/reply/0",
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
]);
expect(pluginData(result.tail)).toEqual([{ text: "$$x^2$$", phase: "complete" }]);
});
@@ -640,7 +642,7 @@ it("keeps streaming replies native, then folds work without losing manual expans
expect(present(completed).tail.map((item) => item.id)).toEqual([
"prompt",
"turn-summary:prompt",
"probe-plugin/reply/0",
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
]);
const expandedTurnHostIds = new Set(["prompt"]);
const opened = present({ ...completed, expandedTurnHostIds });
@@ -648,14 +650,16 @@ it("keeps streaming replies native, then folds work without losing manual expans
"prompt",
"turn-summary:prompt",
"tool-one",
"probe-plugin/reply/0",
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
]);
expect(opened.turns.nestedItemIds.has("probe-plugin/reply/0")).toBe(false);
expect(opened.turns.nestedItemIds.has(JSON.stringify(["probe-plugin", "reply", "reply/0"]))).toBe(
false,
);
expect(present({ ...completed, expandedTurnHostIds }).tail).toEqual(opened.tail);
expect(present(completed).tail.map((item) => item.id)).toEqual([
"prompt",
"turn-summary:prompt",
"probe-plugin/reply/0",
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
]);
});
@@ -679,7 +683,7 @@ it.each(["full", "collapseToolCalls"] as const)(
expect(result.tail.map((item) => item.id)).toEqual([
"prompt",
"tool-one",
"probe-plugin/reply/0",
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
]);
expect(result.turns.summaryRowsByHostId.size).toBe(0);
},
@@ -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>
@@ -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 ? (
+18 -26
View File
@@ -1,4 +1,5 @@
import { useHardwareKeyboardPresent } from "@/keyboard";
import { LaunchScreen, useNativeSplashLaunchCommit } from "@/native-splash";
import {
WindowLayoutProvider,
WindowLayoutActionsHost,
@@ -82,7 +83,6 @@ import { VoiceProvider } from "@/contexts/voice-context";
import {
resolveStartupBlocker,
resolveStartupNavigationReady,
shouldRunStartupGiveUpTimer,
startHostRuntimeBootstrap,
bindHostRuntimeAppState,
type StartupBlocker,
@@ -156,7 +156,7 @@ polyfillCrypto();
export interface HostRuntimeBootstrapState {
splashError: string | null;
retry: () => void;
hasGivenUpWaitingForHost: boolean;
isWaitingForHost: boolean;
isWaitingForSetup: boolean;
storeReady: boolean;
startupBlocker: StartupBlocker;
@@ -165,7 +165,7 @@ export interface HostRuntimeBootstrapState {
const HostRuntimeBootstrapContext = createContext<HostRuntimeBootstrapState>({
splashError: null,
retry: () => {},
hasGivenUpWaitingForHost: false,
isWaitingForHost: true,
isWaitingForSetup: false,
storeReady: false,
startupBlocker: { kind: "none" },
@@ -262,7 +262,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 +283,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 +317,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 +347,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 +905,7 @@ const ROOT_STACK_SCREEN_OWNED_APPEARANCE = ["settings/[section]"] as const;
function RootStack() {
const storeReady = useStoreReady();
useNativeSplashLaunchCommit();
return (
<ThemedStack
screenOptions={ROOT_STACK_SCREEN_OPTIONS}
@@ -1043,6 +1034,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;
@@ -60,6 +60,10 @@ export interface SheetHeaderSearch {
testID?: string;
}
/**
* One step back inside the sheet, such as from a page to the one before it. Android Back takes
* this step too, and closes the sheet only when the header has no back.
*/
export interface SheetHeaderBack {
onPress: () => void;
label?: string;
@@ -738,10 +742,17 @@ export function AdaptiveModalSheet({
}
}, [visible]);
const headerBack = header?.back?.onPress;
const handleBack = useCallback(() => {
if (!headerBack) return false;
headerBack();
return true;
}, [headerBack]);
const { sheetRef, handleSheetChange, handleSheetDismiss } = useIsolatedBottomSheetVisibility({
visible,
isEnabled: isSheet,
onClose,
onBack: handleBack,
});
const [shouldRenderWeb, setShouldRenderWeb] = useState(visible);
const [isWebClosing, setIsWebClosing] = useState(false);
@@ -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;
}
@@ -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}
@@ -12,6 +12,7 @@ import { useQuery } from "@tanstack/react-query";
import { useTranslation } from "react-i18next";
import {
FlatList,
Keyboard,
type LayoutChangeEvent,
ListRenderItemInfo,
Pressable,
@@ -629,6 +630,8 @@ export function FileExplorerPane({
if (!hasWorkspaceScope) {
return;
}
// The preview opens over this pane, so the filter must give up the keyboard.
Keyboard.dismiss();
onOpenFile?.(entry.path);
},
[hasWorkspaceScope, onOpenFile],
@@ -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,
@@ -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
@@ -1,7 +1,12 @@
import { createContext, useContext, useMemo, type ReactNode } from "react";
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
import { StyleSheet } from "react-native-unistyles";
import { CONTROL_HEIGHTS, mapLayout, type ControlSize } from "@/components/ui/control-geometry";
import {
CONTROL_HEIGHTS,
mapLayout,
TOUCH_TARGET,
type ControlSize,
} from "@/components/ui/control-geometry";
import { menuRowContentInset } from "@/components/ui/menu";
import { settingsStyles } from "@/styles/settings";
@@ -12,7 +17,9 @@ import { settingsStyles } from "@/styles/settings";
// - nested: rows revealed under a collapsible row belong to it, so they sit one step smaller than
// the rows of the card: tighter padding, smaller text, smaller controls.
// - menu: rows that share a menu surface with menu rows put their labels on the menu's label rail.
type RowPlacement = "card" | "nested" | "menu";
// - list: rows that share a sheet with list rows, such as radio choices and section headers, take
// the list row's height so every row in the sheet lines up.
type RowPlacement = "card" | "nested" | "menu" | "list";
const RowPlacementContext = createContext<RowPlacement>("card");
@@ -25,6 +32,11 @@ export function MenuSettingsRows({ children }: { children: ReactNode }) {
return <RowPlacementContext.Provider value="menu">{children}</RowPlacementContext.Provider>;
}
/** Settings rows rendered in a sheet of list rows, such as Agent settings. */
export function ListSettingsRows({ children }: { children: ReactNode }) {
return <RowPlacementContext.Provider value="list">{children}</RowPlacementContext.Provider>;
}
export interface SettingsRowLayout {
row: StyleProp<ViewStyle>;
title: StyleProp<TextStyle>;
@@ -49,6 +61,13 @@ function layoutFor(placement: RowPlacement): SettingsRowLayout {
hint: settingsStyles.rowHint,
controlSize: "md",
};
case "list":
return {
row: [settingsStyles.row, styles.listRow],
title: settingsStyles.rowTitle,
hint: settingsStyles.rowHint,
controlSize: "md",
};
case "card":
return {
row: settingsStyles.row,
@@ -72,6 +91,11 @@ const styles = StyleSheet.create((theme) => ({
paddingVertical: theme.spacing[2],
minHeight: mapLayout(CONTROL_HEIGHTS.sm, (height) => height + theme.spacing[2] * 2),
},
// A list row is a touch target tall on every input; a switch still fits inside its padding.
listRow: {
paddingVertical: theme.spacing[2],
minHeight: TOUCH_TARGET,
},
nestedText: {
fontSize: theme.fontSize.sm,
},
@@ -2311,7 +2311,7 @@ function ProjectModeList({
() =>
parentGestureRef
? ({
// NestableScrollContainer forwards props to RNGH ScrollView. Keep
// NestableScrollContainer forwards props to an RNGH FlatList. Keep
// vertical scroll and sidebar close pan simultaneous: vertical
// intent scrolls immediately, clear horizontal intent can still
// activate close from inside the list.
@@ -0,0 +1,44 @@
import { createContext, useContext, useMemo, type ReactElement } from "react";
import { Platform } from "react-native";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
const IndependentScrollGestureContext = createContext<ReturnType<typeof Gesture.Native> | null>(
null,
);
/** The native scroll gesture of the enclosing boundary, for gestures that must not cancel it. */
export function useIndependentScrollGesture(): ReturnType<typeof Gesture.Native> | null {
return useContext(IndependentScrollGestureContext);
}
/**
* Keeps a parent pan from interrupting an Android scroll and lets the list receive ACTION_UP
* for the fling. With activation on start, child taps must join the native scroll gesture.
* When activation waits for the scroll view to intercept a drag, ordinary pressables receive taps.
*/
export function IndependentScrollBoundary({
children,
activateOnStart = true,
}: {
children: ReactElement;
activateOnStart?: boolean;
}) {
const nativeScrollGesture = useMemo(
() =>
Gesture.Native()
.shouldActivateOnStart(activateOnStart)
.shouldCancelWhenOutside(false)
.disallowInterruption(true),
[activateOnStart],
);
if (Platform.OS !== "android") {
return children;
}
return (
<IndependentScrollGestureContext.Provider value={nativeScrollGesture}>
<GestureDetector gesture={nativeScrollGesture}>{children}</GestureDetector>
</IndependentScrollGestureContext.Provider>
);
}
@@ -0,0 +1,36 @@
import React, { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { page } from "vitest/browser";
import { i18n } from "@/i18n/i18next";
import { LoadingSpinner } from "./loading-spinner";
let root: Root;
let host: HTMLDivElement;
beforeEach(async () => {
await i18n.changeLanguage("en");
vi.stubGlobal("React", React);
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
host = document.createElement("div");
document.body.appendChild(host);
root = createRoot(host);
});
afterEach(() => {
act(() => root.unmount());
host.remove();
vi.unstubAllGlobals();
});
it("announces itself as loading when the caller gives no label", async () => {
act(() => root.render(<LoadingSpinner color="#888888" />));
await expect.element(page.getByRole("progressbar", { name: "Loading..." })).toBeVisible();
});
it("announces what is loading when the caller names it", async () => {
act(() => root.render(<LoadingSpinner color="#888888" accessibilityLabel="Loading commits" />));
await expect.element(page.getByRole("progressbar", { name: "Loading commits" })).toBeVisible();
});
@@ -1,12 +1,29 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { ActivityIndicator, type ActivityIndicatorProps } from "react-native";
interface LoadingSpinnerProps {
color: string;
size?: ActivityIndicatorProps["size"];
style?: ActivityIndicatorProps["style"];
/** What is loading. Screen readers announce "Loading" when this is absent. */
accessibilityLabel?: string;
}
export function LoadingSpinner({ color, size = "small", style }: LoadingSpinnerProps) {
return <ActivityIndicator size={size} color={color} style={style} />;
export function LoadingSpinner({
color,
size = "small",
style,
accessibilityLabel,
}: LoadingSpinnerProps) {
const { t } = useTranslation();
return (
<ActivityIndicator
size={size}
color={color}
style={style}
accessibilityRole="progressbar"
accessibilityLabel={accessibilityLabel ?? t("common.loading")}
/>
);
}
@@ -0,0 +1,66 @@
import { Text, View } from "react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import type { Theme } from "@/styles/theme";
const ThemedLoadingSpinner = withUnistyles(LoadingSpinner);
const foregroundMutedColorMapping = (theme: Theme) => ({
color: theme.colors.foregroundMuted,
});
/**
* A screen or pane waiting for its content. Every wait shows the same spinner in the same place,
* so a wait that changes what it is waiting for changes only the words under it.
*/
export function LoadingState({
title,
description,
testID,
}: {
/** What the wait is for. Leave it out while the wait is too short to read. */
title?: string;
description?: string;
testID?: string;
}) {
return (
<View style={styles.container} testID={testID}>
<ThemedLoadingSpinner
size="small"
uniProps={foregroundMutedColorMapping}
accessibilityLabel={title}
/>
{title ? (
<View style={styles.textStack}>
<Text style={styles.title}>{title}</Text>
{description ? <Text style={styles.description}>{description}</Text> : null}
</View>
) : null}
</View>
);
}
const styles = StyleSheet.create((theme) => ({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
gap: theme.spacing[3],
paddingHorizontal: theme.spacing[6],
},
textStack: {
alignItems: "center",
gap: theme.spacing[2],
maxWidth: 520,
},
title: {
color: theme.colors.foreground,
fontSize: theme.fontSize.base,
fontWeight: theme.fontWeight.normal,
textAlign: "center",
},
description: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.base,
textAlign: "center",
},
}));
@@ -88,7 +88,11 @@ export function AgentSettingsDrawer({
}: AgentSettingsDrawerProps) {
const { t } = useTranslation();
const [page, setPage] = useState<AgentSheetPage>(AGENT_SHEET_HOME);
const [profilesExpanded, setProfilesExpanded] = useState(false);
// Profiles open on Home for a new agent, where a profile is the quickest way to configure it.
// `null` until the user toggles the card in this opening.
const [profilesToggled, setProfilesToggled] = useState<boolean | null>(null);
const profilesExpanded =
profilesToggled ?? (profiles?.target === "draft" && profiles.rows.length > 0);
// Select pages search with this; the Model page keeps its own.
const [pageQuery, setPageQuery] = useState("");
const [pageSearchKey, setPageSearchKey] = useState(0);
@@ -103,8 +107,8 @@ export function AgentSettingsDrawer({
});
const toggleProfiles = useCallback(() => {
setProfilesExpanded((expanded) => !expanded);
}, []);
setProfilesToggled(!profilesExpanded);
}, [profilesExpanded]);
const goTo = useCallback((next: AgentSheetPage) => {
Keyboard.dismiss();
@@ -125,7 +129,7 @@ export function AgentSettingsDrawer({
const close = useCallback(() => {
Keyboard.dismiss();
setPage(AGENT_SHEET_HOME);
setProfilesExpanded(false);
setProfilesToggled(null);
setPageQuery("");
modelPage.reset();
onClose();
@@ -8,6 +8,7 @@ import type { AgentMode } from "@getpaseo/protocol/agent-types";
import { getAgentModeOptionIcon } from "@/agent-controls/icons";
import { formatAgentModeLabel } from "@/agent-controls/labels";
import {
ListSettingsRows,
SettingsCard,
SettingsDetailRow,
SettingsSection,
@@ -19,6 +20,7 @@ import { PressHighlight } from "@/components/ui/press-highlight";
import { ScrollView as SheetScrollView } from "@/components/ui/scroll-view";
import { SegmentedControl, type SegmentedControlOption } from "@/components/ui/segmented-control";
import { SteppedSlider, type SteppedSliderOption } from "@/components/ui/stepped-slider";
import { TOUCH_TARGET } from "@/components/ui/control-geometry";
import { isNative } from "@/constants/platform";
import { ICON_SIZE } from "@/styles/theme";
import {
@@ -85,17 +87,19 @@ export function AgentSheetHome({
>
{/* Themed insets sit on a View: the sheet scroller drops a themed contentContainerStyle on web. */}
<View style={styles.content}>
<View style={styles.block}>{topCard}</View>
{blocks.map((block) => (
<HomeBlock
key={blockKey(block)}
block={block}
modeControl={modeControl}
disabled={disabled}
onOpenSelect={onOpenSelect}
/>
))}
{footer}
<ListSettingsRows>
<View style={styles.block}>{topCard}</View>
{blocks.map((block) => (
<HomeBlock
key={blockKey(block)}
block={block}
modeControl={modeControl}
disabled={disabled}
onOpenSelect={onOpenSelect}
/>
))}
{footer}
</ListSettingsRows>
</View>
</SheetScrollView>
);
@@ -663,7 +667,7 @@ const styles = StyleSheet.create((theme) => ({
fontSize: theme.fontSize.base,
},
radioRow: {
minHeight: 44,
minHeight: TOUCH_TARGET,
flexDirection: "row",
alignItems: "center",
paddingHorizontal: theme.spacing[4],
+109 -58
View File
@@ -7,7 +7,7 @@ import { useIsCompactFormFactor } from "@/constants/layout";
import { HEADER_INNER_HEIGHT } from "@/constants/layout";
import { resolveContentMaxWidth, useAppSettings } from "@/hooks/use-settings";
import { KeyboardTranslateView } from "@/keyboard/shift";
import { createContext, useCallback, useContext, useState, type ReactNode } from "react";
import { createContext, useCallback, useContext, useMemo, useState, type ReactNode } from "react";
import { View, type LayoutChangeEvent, type ViewProps, StyleSheet } from "react-native";
import { StyleSheet as ThemedStyleSheet } from "react-native-unistyles";
import Animated, {
@@ -20,7 +20,7 @@ import { useKeyboardShift } from "@/keyboard/shift";
import {
resolveCenteredClearance,
resolveComposerBottomPlacement,
resolveComposerSlotCapacity,
resolveInlineComposerCapacity,
updateComposerCapacity,
type ComposerCapacity,
} from "./internal/capacity";
@@ -32,15 +32,21 @@ interface ComposerViewportProps extends ViewProps {
bottomInset?: number;
keyboardGap?: number;
centered?: boolean;
fullscreen?: boolean;
}
/** Measure the stationary space below the header, outside keyboard translation. */
/**
* Measure the stationary space below the header, outside keyboard translation. The
* capacity bounds the inline composer, so it keeps the inline measurement while
* fullscreen hides the screen's chrome; exit then lays out at the inline cap at once.
*/
function ComposerViewport({
children,
onLayout,
bottomInset = 0,
keyboardGap = 0,
centered = false,
fullscreen = false,
...props
}: ComposerViewportProps) {
const measuredHeight = useSharedValue(0);
@@ -63,10 +69,10 @@ function ComposerViewport({
);
const measureViewport = useCallback(
(event: LayoutChangeEvent) => {
measuredHeight.value = event.nativeEvent.layout.height;
if (!fullscreen) measuredHeight.value = event.nativeEvent.layout.height;
onLayout?.(event);
},
[measuredHeight, onLayout],
[fullscreen, measuredHeight, onLayout],
);
return (
@@ -77,18 +83,17 @@ function ComposerViewport({
}
/** Bound the complete composer (including its controls), not just the text input. */
function ComposerViewportContent({
style,
fullscreen = false,
...props
}: ViewProps & { fullscreen?: boolean }) {
function ComposerViewportContent({ style, ...props }: ViewProps) {
const compact = useIsCompactFormFactor();
const sizing = useContext(ViewportSizing);
if (!sizing) throw new Error("ComposerViewportContent requires ComposerViewport");
const constraint = useAnimatedStyle(() => ({
// Only viewport changes and keyboard start/end events trigger layout. Motion
// stays in KeyboardTranslateView and never changes this constraint per frame.
maxHeight: resolveComposerSlotCapacity(sizing.value, { compact, fullscreen }),
// Fullscreen styles override it with a static minHeight instead of feeding the mode
// in here: Reanimated applies a dependency change frames after the React commit,
// so the fullscreen slot would paint clamped to the inline cap first.
maxHeight: resolveInlineComposerCapacity(sizing.value?.capacity, compact),
}));
return (
@@ -96,17 +101,29 @@ function ComposerViewportContent({
);
}
/** The keyboard only needs to move a centered form once it reaches the form's resting bottom. */
function useCenteredClearance(safeAreaBottom: number) {
/**
* The keyboard only needs to move a centered form once it reaches the form's resting bottom.
* Fullscreen keeps the inline measurements: it does not translate, and re-measuring the
* fullscreen frame would rebuild the translation from stale keyboard values on enter and
* correct the form a frame late on exit.
*/
function useCenteredClearance(safeAreaBottom: number, fullscreen: boolean) {
const [viewportHeight, setViewportHeight] = useState(0);
const [formBottom, setFormBottom] = useState(0);
const measureViewport = useCallback((event: LayoutChangeEvent) => {
setViewportHeight(event.nativeEvent.layout.height);
}, []);
const measureForm = useCallback((event: LayoutChangeEvent) => {
const { y, height } = event.nativeEvent.layout;
setFormBottom(y + height);
}, []);
const measureViewport = useCallback(
(event: LayoutChangeEvent) => {
if (!fullscreen) setViewportHeight(event.nativeEvent.layout.height);
},
[fullscreen],
);
const measureForm = useCallback(
(event: LayoutChangeEvent) => {
if (fullscreen) return;
const { y, height } = event.nativeEvent.layout;
setFormBottom(y + height);
},
[fullscreen],
);
return {
value: resolveCenteredClearance({ viewportHeight, safeAreaBottom, formBottom }),
measureViewport,
@@ -114,6 +131,26 @@ function useCenteredClearance(safeAreaBottom: number) {
};
}
/**
* Fullscreen covers the conversation without resizing it. A resized list corrects its
* scroll position from JS a few frames after the layout, so leaving fullscreen would
* paint the conversation at a stale offset first.
*/
function useInlineSlotReservation(fullscreen: boolean) {
const [height, setHeight] = useState(0);
const measureSlot = useCallback(
(event: LayoutChangeEvent) => {
if (!fullscreen) setHeight(event.nativeEvent.layout.height);
},
[fullscreen],
);
const spacerStyle = useMemo(() => ({ height }), [height]);
return {
measureSlot,
spacer: fullscreen ? <View style={spacerStyle} /> : null,
};
}
interface ComposerDockProps {
children: [ReactNode, ReactNode, ReactNode?];
centered?: boolean;
@@ -133,13 +170,14 @@ export function ComposerDock({
}: ComposerDockProps) {
const insets = useSafeAreaInsets();
const contentMaxWidth = resolveContentMaxWidth(useAppSettings().settings);
const centeredClearance = useCenteredClearance(insets.bottom);
const centeredClearance = useCenteredClearance(insets.bottom, fullscreen);
const placement = resolveComposerBottomPlacement({
safeAreaBottom: insets.bottom,
contentSpacing: SPACING[4],
});
// Preserve the existing centered form's visual balance on tablets.
const bottomInset = centered && !fullscreen ? HEADER_INNER_HEIGHT + 24 : 0;
const bottomInset = centered ? HEADER_INNER_HEIGHT + 24 : 0;
const conversationReservation = useInlineSlotReservation(fullscreen);
const fullscreenSurface = [
themedStyles.fullscreenComposer,
{
@@ -161,6 +199,7 @@ export function ComposerDock({
}
bottomInset={bottomInset}
centered
fullscreen={fullscreen}
onLayout={centeredClearance.measureViewport}
>
<KeyboardTranslateView
@@ -172,8 +211,7 @@ export function ComposerDock({
onLayout={centeredClearance.measureForm}
>
<ComposerViewportContent
style={fullscreen ? dockStyles.surface : dockStyles.composer}
fullscreen={fullscreen}
style={fullscreen ? dockStyles.fullscreenSurface : dockStyles.composer}
>
<ScrollView
style={fullscreen ? dockStyles.hiddenSetup : dockStyles.setup}
@@ -182,8 +220,7 @@ export function ComposerDock({
{content}
</ScrollView>
<ComposerViewportContent
style={fullscreen ? dockStyles.surface : dockStyles.centeredComposer}
fullscreen={fullscreen}
style={fullscreen ? dockStyles.fullscreenSurface : dockStyles.centeredComposer}
>
<View style={fullscreen ? fullscreenSurface : dockStyles.centeredComposerSurface}>
{composer}
@@ -195,41 +232,53 @@ export function ComposerDock({
</ComposerViewport>
);
}
// The conversation and the composer ride the keyboard as two views. Only the composer
// changes mode, and its view is the one fullscreen resizes on every screen, which is
// what lands the mode with the layout (see KeyboardTranslateView).
return (
<ComposerViewport style={dockStyles.viewport} keyboardGap={placement.keyboardGap}>
<KeyboardTranslateView
style={dockStyles.surface}
enabled={!fullscreen}
keyboardGap={placement.keyboardGap}
>
<View
testID="composer-dock-content"
collapsable={false}
style={dockStyles.content}
pointerEvents="box-none"
>
{/* A responder ancestor intercepts native scroll drags on Android Fabric.
Only unclaimed background touches may reach this sibling. */}
<ComposerDockBackground style={StyleSheet.absoluteFill} />
<View style={dockStyles.content} pointerEvents="box-none">
{content}
</View>
</View>
<ComposerViewportContent
style={fullscreen ? dockStyles.fullscreenSlot : dockStyles.composer}
fullscreen={fullscreen}
>
<ComposerViewport
style={dockStyles.viewport}
keyboardGap={placement.keyboardGap}
fullscreen={fullscreen}
>
<View style={dockStyles.surface}>
<KeyboardTranslateView style={dockStyles.surface} keyboardGap={placement.keyboardGap}>
<View
style={
fullscreen
? fullscreenSurface
: [dockStyles.composer, { paddingBottom: placement.restingPadding }]
}
testID="composer-dock-content"
collapsable={false}
style={dockStyles.content}
pointerEvents="box-none"
>
{composer}
{/* A responder ancestor intercepts native scroll drags on Android Fabric.
Only unclaimed background touches may reach this sibling. */}
<ComposerDockBackground style={StyleSheet.absoluteFill} />
<View style={dockStyles.content} pointerEvents="box-none">
{content}
</View>
</View>
</ComposerViewportContent>
</KeyboardTranslateView>
</KeyboardTranslateView>
{conversationReservation.spacer}
<KeyboardTranslateView
style={fullscreen ? StyleSheet.absoluteFill : dockStyles.composer}
enabled={!fullscreen}
keyboardGap={placement.keyboardGap}
>
<ComposerViewportContent
style={fullscreen ? dockStyles.fullscreenSurface : dockStyles.composer}
onLayout={conversationReservation.measureSlot}
>
<View
style={
fullscreen
? fullscreenSurface
: [dockStyles.composer, { paddingBottom: placement.restingPadding }]
}
>
{composer}
</View>
</ComposerViewportContent>
</KeyboardTranslateView>
</View>
{overlay}
</ComposerViewport>
);
@@ -242,7 +291,9 @@ const dockStyles = StyleSheet.create({
surface: { flex: 1 },
content: { flex: 1, justifyContent: "flex-end" },
composer: { width: "100%", flexShrink: 1 },
fullscreenSlot: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 },
// Yoga applies minHeight after maxHeight, so this fills the viewport over the
// inline cap that ComposerViewportContent keeps animating.
fullscreenSurface: { flex: 1, minHeight: "100%" },
centeredViewport: { flex: 1, alignItems: "center", justifyContent: "center" },
centered: { flexShrink: 1, width: "100%" },
// Reserve the composer's own capped height before the setup scroll view shrinks.
@@ -2,7 +2,6 @@ import { describe, expect, it } from "vitest";
import {
resolveCenteredClearance,
resolveComposerBottomPlacement,
resolveComposerSlotCapacity,
resolveInlineComposerCapacity,
resolveComposerCapacity,
updateComposerCapacity,
@@ -68,21 +67,6 @@ describe("composer viewport", () => {
expect(resolveInlineComposerCapacity(open.capacity, false)).toBe(245);
expect(resolveInlineComposerCapacity(undefined, true)).toBeUndefined();
});
it("lets a fullscreen composer fill the viewport while inline keeps its cap", () => {
const open = updateComposerCapacity(undefined, {
height: 582,
bottomInset: 24,
safeAreaBottom: 0,
keyboardGap: 0,
centered: false,
keyboardShift: 308,
});
expect(resolveComposerSlotCapacity(open, { compact: true, fullscreen: true })).toBe(582);
expect(resolveComposerSlotCapacity(open, { compact: true, fullscreen: false })).toBe(147);
expect(resolveComposerSlotCapacity(undefined, { compact: true, fullscreen: true })).toBe(
undefined,
);
});
it("preserves the editing capacity when the keyboard closes", () => {
const viewport = {
height: 582,
@@ -12,8 +12,6 @@ interface ComposerGeometry {
export interface ComposerCapacity {
keyboardReserve: number;
capacity: number;
/** The stationary viewport; a fullscreen composer fills it and lays out the keyboard itself. */
viewportHeight: number;
}
export function resolveComposerCapacity(input: ComposerGeometry): number {
@@ -78,7 +76,6 @@ export function updateComposerCapacity(
return {
keyboardReserve,
capacity: resolveComposerCapacity({ ...input, keyboardShift: keyboardReserve }),
viewportHeight: input.height,
};
}
@@ -91,19 +88,3 @@ export function resolveInlineComposerCapacity(
if (capacity === undefined) return undefined;
return compact ? capacity * 0.6 : capacity;
}
export interface ComposerSlotLayout {
compact: boolean;
fullscreen: boolean;
}
/** The bound on the composer slot: inline capacity, or the whole viewport in fullscreen. */
export function resolveComposerSlotCapacity(
sizing: ComposerCapacity | undefined,
layout: ComposerSlotLayout,
): number | undefined {
"worklet";
if (sizing === undefined) return undefined;
if (layout.fullscreen) return sizing.viewportHeight;
return resolveInlineComposerCapacity(sizing.capacity, layout.compact);
}
@@ -1,5 +1,5 @@
import type { ReactNode } from "react";
import { StyleSheet, type ViewProps } from "react-native";
import { StyleSheet, View, type ViewProps } from "react-native";
import Animated, { useAnimatedStyle } from "react-native-reanimated";
import { KeyboardTranslateView, useKeyboardShift } from "@/keyboard/shift";
@@ -16,17 +16,23 @@ export function ComposerFullscreenBody({
fullscreen: boolean;
children: ReactNode;
}) {
const { layoutShift } = useKeyboardShift();
const reservation = useAnimatedStyle(() => ({
marginBottom: fullscreen ? layoutShift.value : 0,
}));
// The reservation mounts with the mode instead of reading it in a worklet: Reanimated
// applies a dependency change frames after the React commit, so the inline body would
// first paint squeezed by the fullscreen reservation.
return (
<Animated.View style={[fullscreen ? styles.fullscreen : styles.inline, reservation]}>
<View style={fullscreen ? styles.fullscreen : styles.inline}>
{children}
</Animated.View>
{fullscreen ? <KeyboardReservation /> : null}
</View>
);
}
function KeyboardReservation() {
const { layoutShift } = useKeyboardShift();
const reservation = useAnimatedStyle(() => ({ height: layoutShift.value }));
return <Animated.View style={reservation} />;
}
/** The Send row of a fullscreen composer rides the keyboard like the inline dock surface. */
export function ComposerFullscreenFooter({ children, ...props }: ViewProps) {
return <KeyboardTranslateView {...props}>{children}</KeyboardTranslateView>;
@@ -27,5 +27,6 @@ it("keeps dock overlays outside keyboard translation in every native layout", ()
ts.forEachChild(node, visit);
}
visit(source);
expect(surfaces).toBe(2);
// The centered form's view, and the chat dock's content and composer views.
expect(surfaces).toBe(3);
});
@@ -2386,6 +2386,11 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
: [styles.container, Platform.OS === "ios" && isCompact && styles.inputWrapperCompact]
}
testID="message-input-root"
// The editor's native parent is its nearest stacking-context ancestor. Inline
// iOS styles here (shadow) and on the input wrapper (clipping) form one and the
// fullscreen styles do not, so without these the toggle re-parents the editor
// and UIKit drops its focus and keyboard.
collapsable={false}
onLayout={handleComposerLayout}
>
<MessageInputAutoFocus
@@ -105,6 +105,8 @@ export function ComposerInputPresentation({
<ComposerFullscreenBody fullscreen={fullscreen}>
<View
ref={inputWrapperRef}
// Keeps the editor's native parent across the toggle; see message-input-root.
collapsable={false}
style={fullscreen ? styles.fullscreenInputWrapper : inputWrapperStyle}
pointerEvents={inputPointerEvents}
>
@@ -123,7 +123,7 @@ function buildProviderModelsByProvider(
for (const entry of snapshotEntries ?? []) {
map.set(
entry.provider,
entry.status === "ready" ? filterSelectableModels(entry.models ?? null) : null,
entry.status === "ready" ? filterSelectableModels(entry.models ?? []) : null,
);
}
return map;
@@ -273,8 +273,11 @@ export function useAgentFormState(options: UseAgentFormStateOptions): UseAgentFo
const modelSelectorProviders = snapshotModelSelectorProviders;
const availableModels = snapshotSelectedProviderModels;
const modeOptions = snapshotSelectedProviderModes;
const selectedProviderHasError =
snapshotSelectedEntry?.status === "error" || snapshotSelectedEntry?.status === "unavailable";
const isModelSelectionLoading =
isConnected &&
!selectedProviderHasError &&
(resolution.status === "pending" || snapshotIsLoading || selectedProviderIsLoading);
const isAllModelsLoading = isModelSelectionLoading;
@@ -43,7 +43,7 @@ describe("schedule mutation cache updates", () => {
const current: FetchAggregatedSchedulesResult = {
status: "loaded",
data: [schedule()],
hostErrors: [],
hostWarnings: [],
};
const result = updateAggregatedSchedulesData(current, pauseSchedules);
@@ -51,7 +51,7 @@ describe("schedule mutation cache updates", () => {
expect(result).toEqual({
status: "loaded",
data: [schedule({ status: "paused" })],
hostErrors: [],
hostWarnings: [],
});
});
@@ -69,7 +69,7 @@ describe("schedule mutation cache updates", () => {
const loaded: FetchAggregatedSchedulesResult = {
status: "loaded",
data: [schedule()],
hostErrors: [],
hostWarnings: [],
};
queryClient.setQueryData(connectingKey, connecting);
queryClient.setQueryData(loadedKey, loaded);
@@ -85,7 +85,7 @@ describe("schedule mutation cache updates", () => {
expect(queryClient.getQueryData(loadedKey)).toEqual({
status: "loaded",
data: [schedule({ status: "paused" })],
hostErrors: [],
hostWarnings: [],
});
});
});
+4 -4
View File
@@ -10,14 +10,14 @@ import {
schedulesQueryBaseKey,
type AggregateLoadState,
type AggregatedSchedule,
type ScheduleHostError,
type ScheduleHostWarning,
type ScheduleHostInput,
} from "@/schedules/aggregated-schedules";
export type {
AggregateLoadState,
AggregatedSchedule,
ScheduleHostError,
ScheduleHostWarning,
} from "@/schedules/aggregated-schedules";
export function schedulesQueryKey(serverIds: readonly string[]) {
@@ -26,7 +26,7 @@ export function schedulesQueryKey(serverIds: readonly string[]) {
export interface UseSchedulesResult {
loadState: AggregateLoadState<AggregatedSchedule>;
hostErrors: ScheduleHostError[];
hostWarnings: ScheduleHostWarning[];
isError: boolean;
error: Error | null;
refetch: () => void;
@@ -65,7 +65,7 @@ export function useSchedules(): UseSchedulesResult {
return {
loadState,
hostErrors: query.data?.status === "loaded" ? query.data.hostErrors : [],
hostWarnings: query.data?.status === "loaded" ? query.data.hostWarnings : [],
isError: query.isError,
error: query.error,
refetch: () => {
+2
View File
@@ -278,6 +278,8 @@ export const ar: TranslationResources = {
failedToLoad: "فشل تحميل الوكيل",
reconnecting: "جارٍ إعادة الاتصال",
updating: "جارٍ تحديث الرسائل",
loadingAgent: "جارٍ تحميل الوكيل",
loadingHistory: "جارٍ تحميل سجل الوكيل",
timelineSyncFailed: "تعذر تحديث سجل الوكيل.",
timelineSyncRetrying: "جارٍ إعادة المحاولة…",
archivingTitle: "وكيل الارشيف...",
+2
View File
@@ -276,6 +276,8 @@ export const en = {
failedToLoad: "Failed to load agent",
reconnecting: "Reconnecting",
updating: "Updating messages",
loadingAgent: "Loading agent",
loadingHistory: "Loading agent history",
timelineSyncFailed: "Couldn't refresh agent history.",
timelineSyncRetrying: "Retrying…",
archivingTitle: "Archiving agent...",
+2
View File
@@ -280,6 +280,8 @@ export const es: TranslationResources = {
failedToLoad: "No se pudo cargar el agente",
reconnecting: "Reconectando",
updating: "Actualizando mensajes",
loadingAgent: "Cargando agente",
loadingHistory: "Cargando historial del agente",
timelineSyncFailed: "No se pudo actualizar el historial del agente.",
timelineSyncRetrying: "Reintentando…",
archivingTitle: "Agente de archivo...",
+2
View File
@@ -281,6 +281,8 @@ export const fr: TranslationResources = {
failedToLoad: "Impossible de charger l’agent",
reconnecting: "Reconnexion…",
updating: "Mise à jour des messages…",
loadingAgent: "Chargement de l’agent",
loadingHistory: "Chargement de l’historique de l’agent",
timelineSyncFailed: "Impossible d’actualiser l’historique de l’agent.",
timelineSyncRetrying: "Nouvelle tentative…",
archivingTitle: "Archivage de l’agent…",
+2
View File
@@ -280,6 +280,8 @@ export const ja: TranslationResources = {
failedToLoad: "エージェントの読み込みに失敗しました",
reconnecting: "再接続中",
updating: "メッセージを更新中",
loadingAgent: "エージェントを読み込み中",
loadingHistory: "エージェントの履歴を読み込み中",
timelineSyncFailed: "エージェントの履歴を更新できませんでした。",
timelineSyncRetrying: "再試行しています…",
archivingTitle: "エージェントをアーカイブ中...",
+2
View File
@@ -278,6 +278,8 @@ export const ko: TranslationResources = {
failedToLoad: "에이전트를 불러오지 못했습니다",
reconnecting: "다시 연결하는 중",
updating: "메시지 업데이트 중",
loadingAgent: "에이전트 불러오는 중",
loadingHistory: "에이전트 기록 불러오는 중",
timelineSyncFailed: "에이전트 기록을 새로고침할 수 없습니다.",
timelineSyncRetrying: "재시도 중…",
archivingTitle: "에이전트 보관 중...",
+2
View File
@@ -279,6 +279,8 @@ export const ptBR: TranslationResources = {
failedToLoad: "Falha ao carregar agente",
reconnecting: "Reconectando",
updating: "Atualizando mensagens",
loadingAgent: "Carregando agente",
loadingHistory: "Carregando histórico do agente",
timelineSyncFailed: "Não foi possível atualizar o histórico do agente.",
timelineSyncRetrying: "Tentando novamente…",
archivingTitle: "Arquivando agente...",
+2
View File
@@ -280,6 +280,8 @@ export const ru: TranslationResources = {
failedToLoad: "Не удалось загрузить агента",
reconnecting: "Повторное подключение",
updating: "Обновление сообщений",
loadingAgent: "Загрузка агента",
loadingHistory: "Загрузка истории агента",
timelineSyncFailed: "Не удалось обновить историю агента.",
timelineSyncRetrying: "Повторная попытка…",
archivingTitle: "Агент перемещается в архив...",
+2
View File
@@ -278,6 +278,8 @@ export const zhCN: TranslationResources = {
failedToLoad: "加载 Agent 失败",
reconnecting: "正在重新连接",
updating: "正在更新消息",
loadingAgent: "正在加载代理",
loadingHistory: "正在加载代理历史记录",
timelineSyncFailed: "无法刷新代理历史记录。",
timelineSyncRetrying: "正在重试…",
archivingTitle: "正在归档 Agent...",
@@ -13,6 +13,12 @@ export interface KeyboardShiftContextValue {
export const KeyboardShiftContext = createContext<KeyboardShiftContextValue | null>(null);
/**
* The shift the keyboard is at, or is moving to. React state, where the shared values
* above are not: it changes when a keyboard motion starts and ends, never per frame.
*/
export const KeyboardTargetShiftContext = createContext(0);
/** How the nearest KeyboardTranslateView moves its descendants with the keyboard. */
export interface KeyboardTranslation {
enabled: boolean;
@@ -11,8 +11,8 @@ export function measureInWindow(element: View): Promise<WindowRect> {
/**
* The element's window rect with `frame`'s own transform left out. Whether
* `measureInWindow` includes a transform depends on the driver: Reanimated commits
* it to the shadow tree every frame, the iOS translate view commits it only once the
* keyboard settles. Fabric's `measureLayout` and a view's `measure` origin ignore
* it to the shadow tree every frame, the iOS translate view commits only where the
* keyboard rests. Fabric's `measureLayout` and a view's `measure` origin ignore
* transforms. The frame's parent must not move with the keyboard; the composer dock
* is the only anchor host, and its parent is the stationary dock viewport.
*/
@@ -1,4 +1,4 @@
import { createElement, useEffect, useMemo, type ReactNode } from "react";
import { createElement, useEffect, useMemo, useState, type ReactNode } from "react";
import { Platform } from "react-native";
import type { ViewStyle } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -12,13 +12,14 @@ import {
useSharedValue,
type SharedValue,
} from "react-native-reanimated";
import { scheduleOnRN } from "react-native-worklets";
import {
DEFAULT_IOS_KEYBOARD_INSET_MIN_HEIGHT,
resolveKeyboardShift,
reserveKeyboardLayoutShift,
shouldReconcileHiddenKeyboardEnd,
} from "./policy";
import { KeyboardShiftContext, useKeyboardShift } from "./context";
import { KeyboardShiftContext, KeyboardTargetShiftContext, useKeyboardShift } from "./context";
type KeyboardShiftMode = "translate" | "padding";
@@ -29,6 +30,7 @@ export function KeyboardShiftProvider({ children }: { children: ReactNode }) {
const isIos = Platform.OS === "ios";
const isMoving = useSharedValue(false);
const layoutShift = useSharedValue(0);
const [targetShift, setTargetShift] = useState(0);
useEffect(() => {
bottomInset.value = insets.bottom;
}, [bottomInset, insets.bottom]);
@@ -61,6 +63,7 @@ export function KeyboardShiftProvider({ children }: { children: ReactNode }) {
phase: "start",
});
isMoving.value = true;
scheduleOnRN(setTargetShift, target);
},
onEnd: (event) => {
"worklet";
@@ -81,6 +84,7 @@ export function KeyboardShiftProvider({ children }: { children: ReactNode }) {
keyboardProgress.value = 0;
}
isMoving.value = false;
scheduleOnRN(setTargetShift, target);
},
},
[bottomInset, isIos, isMoving, keyboardHeight, keyboardProgress, layoutShift],
@@ -96,7 +100,11 @@ export function KeyboardShiftProvider({ children }: { children: ReactNode }) {
[bottomInset, isMoving, layoutShift, shift],
);
return createElement(KeyboardShiftContext.Provider, { value }, children);
return createElement(
KeyboardShiftContext.Provider,
{ value },
createElement(KeyboardTargetShiftContext.Provider, { value: targetShift }, children),
);
}
export function useKeyboardShiftStyle(input: { mode: KeyboardShiftMode; enabled?: boolean }): {
@@ -1,10 +1,8 @@
import { useCallback, useMemo, useEffect, useRef, type ReactNode } from "react";
import { Animated, useAnimatedValue, type View, type ViewProps } from "react-native";
import { useContext, useEffect, useMemo, useRef, type ReactNode, type Ref } from "react";
import { Animated, useAnimatedValue, View, type ViewProps } from "react-native";
import { useKeyboardAnimation } from "react-native-keyboard-controller";
import { useAnimatedReaction } from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { scheduleOnRN } from "react-native-worklets";
import { KeyboardTranslationContext, useKeyboardShift } from "./context";
import { KeyboardTargetShiftContext, KeyboardTranslationContext } from "./context";
import { useKeyboardTranslationScope } from "./measure";
import { resolveKeyboardLift } from "./policy";
@@ -20,6 +18,27 @@ interface KeyboardTranslateViewProps extends ViewProps {
keyboardGap?: number;
}
/**
* The view the native driver moves. Animated renders a driven transform from its JS-side
* value, and the keyboard's values never reach JS, so React would commit an unlifted view.
* This commits where the view rests instead, which is what Fabric paints when it creates
* or resizes the view, and what Pressability measures. The driver paints the frames in
* between.
*/
function RestingFrame({
restingTranslateY,
style,
...props
}: ViewProps & { restingTranslateY: number; ref?: Ref<View> }) {
const resting = useMemo(
() => ({ transform: [{ translateY: restingTranslateY }] }),
[restingTranslateY],
);
return <View {...props} style={[style, resting]} />;
}
const DrivenFrame = Animated.createAnimatedComponent(RestingFrame);
export function KeyboardTranslateView({
children,
enabled = true,
@@ -47,28 +66,34 @@ export function KeyboardTranslateView({
});
return Animated.add(lift, gap);
}, [bottomClearance, height, insets.bottom, keyboardGap, progress]);
// Fullscreen resizes this view while disabling translation. iOS Fabric can
// reapply its previous transform during that layout commit. Keep the graph
// attached and apply the mode on the native animation frame; a static zero or
// setValue during the React commit gets overwritten by the resize. A rebuilt
// graph (a new bottomClearance after rotation) starts from JS-side keyboard
// values, so run it on the native frame too or it stays stale until the
// keyboard next moves.
const enabledValue = useAnimatedValue(enabled ? 1 : 0);
useEffect(() => {
const animation = Animated.timing(enabledValue, {
toValue: enabled ? 1 : 0,
duration: 0,
useNativeDriver: true,
});
animation.start();
return () => animation.stop();
}, [enabled, enabledValue, translateY]);
const keyboardStyle = useMemo(
() => ({ transform: [{ translateY: Animated.multiply(translateY, enabledValue) }] }),
[enabledValue, translateY],
);
// A change of mode or clearance lands with the layout that carries it: the commit holds
// the new resting lift, and Fabric paints a driven view's committed transform when the
// commit resizes the view. A caller that changes `enabled` must do it on the view the
// change resizes; without a resize the old lift stays until the driver catches up below.
const targetShift = useContext(KeyboardTargetShiftContext);
const restingLift = resolveKeyboardLift({
shift: targetShift,
enabled,
bottomClearance,
keyboardGap,
});
// The driver catches up one frame later, when the commit has mounted. Its operations
// are not ordered with a mount: sent from the commit, they could paint the new mode
// over the old layout. After the mount they repaint what Fabric already painted. A
// rebuilt graph (a new bottomClearance after rotation) needs the same push, or it
// keeps the old lift until the keyboard next moves.
useEffect(() => {
const frame = requestAnimationFrame(() => enabledValue.setValue(enabled ? 1 : 0));
return () => cancelAnimationFrame(frame);
}, [enabled, enabledValue, translateY]);
const frameRef = useRef<View>(null);
const translation = useMemo(
() => ({ enabled, bottomClearance, keyboardGap }),
@@ -76,30 +101,16 @@ export function KeyboardTranslateView({
);
const scope = useKeyboardTranslationScope(frameRef, translation);
// The native driver moves the view without telling the shadow tree, and Pressability
// measures its press region there. With a stale region, a touch that drifts a few
// points leaves it and the press is dropped. Commit the lift once the keyboard settles.
const { layoutShift, isMoving } = useKeyboardShift();
const commitRestingLift = useCallback(
(shift: number) => {
const lift = resolveKeyboardLift({ shift, ...translation });
frameRef.current?.setNativeProps({ transform: [{ translateY: -lift }] });
},
[translation],
);
useAnimatedReaction(
() => (isMoving.value ? null : layoutShift.value),
(restingShift) => {
if (restingShift !== null) scheduleOnRN(commitRestingLift, restingShift);
},
[commitRestingLift],
);
return (
<Animated.View ref={frameRef} style={[style, keyboardStyle]} {...props}>
<DrivenFrame
ref={frameRef}
style={[style, keyboardStyle]}
restingTranslateY={-restingLift}
{...props}
>
<KeyboardTranslationContext.Provider value={scope}>
{children}
</KeyboardTranslationContext.Provider>
</Animated.View>
</DrivenFrame>
);
}
+51
View File
@@ -0,0 +1,51 @@
import { useEffect, useLayoutEffect } from "react";
import { createNativeSplashController, type NativeSplashController } from "./internal/controller";
import { launchSurface } from "./internal/launch-surface";
export { LaunchScreen } from "./internal/launch-surface";
// Guards against a screen that never releases its hold. A slow device places the first
// conversation 2-4 s after the JS entry, so a shorter cap cuts in before it paints.
const CAP_MS = 5_000;
let controller: NativeSplashController | null = null;
let releaseLaunch: (() => void) | null = null;
/**
* Call once at the JS entry. The launch surface (the native splash, or on Android the
* `LaunchScreen` that replaces it) then covers the app until the root navigator has committed its
* first screen and no screen holds it, and leaves from here alone.
*/
export function keepNativeSplash(): void {
if (controller) return;
launchSurface.keep();
controller = createNativeSplashController(
{
hide: () => launchSurface.leave(),
afterNextFrame: (callback) => {
requestAnimationFrame(() => callback());
},
startTimer: (callback, ms) => {
setTimeout(callback, ms);
},
},
{ capMs: CAP_MS },
);
releaseLaunch = controller.hold();
}
/** The root navigator's first commit ends the launch hold. Screens committed with it hold first. */
export function useNativeSplashLaunchCommit(): void {
useEffect(() => {
releaseLaunch?.();
releaseLaunch = null;
}, []);
}
/** Keeps the launch surface up while `active`, for a screen that has nothing to show yet. */
export function useNativeSplashHold(active: boolean): void {
useLayoutEffect(() => {
if (!active) return;
return controller?.hold();
}, [active]);
}
@@ -0,0 +1,86 @@
import { describe, expect, it } from "vitest";
import { createNativeSplashController } from "./controller";
function createFakeSplash() {
const frames: Array<() => void> = [];
const timers: Array<{ callback: () => void; ms: number }> = [];
const splash = { hides: 0 };
const controller = createNativeSplashController(
{
hide: () => {
splash.hides += 1;
},
afterNextFrame: (callback) => {
frames.push(callback);
},
startTimer: (callback, ms) => {
timers.push({ callback, ms });
},
},
{ capMs: 3_000 },
);
const runFrame = () => {
for (const callback of frames.splice(0)) callback();
};
const runCap = () => {
for (const timer of timers.splice(0)) timer.callback();
};
return { controller, splash, runFrame, runCap, timers };
}
describe("native splash", () => {
it("stays up while a screen holds it and hides a frame after the last release", () => {
const { controller, splash, runFrame } = createFakeSplash();
const releaseLaunch = controller.hold();
const releaseScreen = controller.hold();
releaseLaunch();
runFrame();
expect(splash.hides).toBe(0);
releaseScreen();
expect(splash.hides).toBe(0);
runFrame();
expect(splash.hides).toBe(1);
});
it("stays up when the next screen takes the hold before the frame passes", () => {
const { controller, splash, runFrame } = createFakeSplash();
const releaseSplashRoute = controller.hold();
releaseSplashRoute();
const releaseWorkspace = controller.hold();
runFrame();
expect(splash.hides).toBe(0);
releaseWorkspace();
runFrame();
expect(splash.hides).toBe(1);
});
it("hides when the cap runs out even while a screen still holds it", () => {
const { controller, splash, runCap, runFrame, timers } = createFakeSplash();
const release = controller.hold();
expect(timers.map((timer) => timer.ms)).toEqual([3_000]);
runCap();
expect(splash.hides).toBe(1);
release();
runFrame();
expect(controller.hold()).toBeTypeOf("function");
runFrame();
expect(splash.hides).toBe(1);
});
it("counts a repeated release once", () => {
const { controller, splash, runFrame } = createFakeSplash();
const first = controller.hold();
controller.hold();
first();
first();
runFrame();
expect(splash.hides).toBe(0);
});
});
@@ -0,0 +1,53 @@
export interface NativeSplashPort {
hide(): void;
/** Runs the callback after the next frame, once the committed screen has been drawn. */
afterNextFrame(callback: () => void): void;
startTimer(callback: () => void, ms: number): void;
}
export interface NativeSplashController {
/** Keeps the splash up until the returned release runs. Holds after the hide do nothing. */
hold(): () => void;
}
/**
* The splash hides once, after a frame passes with nothing holding it, or when the cap runs out.
* The frame wait lets a screen that replaces a holding screen in the same commit take over.
*/
export function createNativeSplashController(
port: NativeSplashPort,
options: { capMs: number },
): NativeSplashController {
let holds = 0;
let hidden = false;
let checkScheduled = false;
const hide = () => {
if (hidden) return;
hidden = true;
port.hide();
};
const hideIfReleased = () => {
checkScheduled = false;
if (holds === 0) hide();
};
port.startTimer(hide, options.capMs);
return {
hold() {
if (hidden) return () => undefined;
holds += 1;
let released = false;
return () => {
if (released) return;
released = true;
holds -= 1;
if (holds > 0 || hidden || checkScheduled) return;
checkScheduled = true;
port.afterNextFrame(hideIfReleased);
};
},
};
}
@@ -0,0 +1,104 @@
import { useEffect, useState, useSyncExternalStore } from "react";
import { useColorScheme, View } from "react-native";
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
import { scheduleOnRN } from "react-native-worklets";
import { StyleSheet } from "react-native-unistyles";
import * as SplashScreen from "expo-splash-screen";
import { PaseoLogo } from "@/components/icons/paseo-logo";
// Android hands its splash to the app in a way the app cannot time: the system can show one app
// frame before its copy of the splash draws, and a frame the app draws first can be empty. So the
// native splash leaves as soon as React commits this screen, which looks the same as the splash,
// and this screen covers the app until launch is done.
// The splash colours from the expo-splash-screen entry in app.config.js. Android picks them from
// the system dark mode, not from the app theme.
const SPLASH_BACKGROUND = { dark: "#000000", light: "#ffffff" } as const;
// Android draws a splash icon without a background inside a 192dp circle.
const ICON_CIRCLE_SIZE = 192;
// The splash icon's glyph is 135dp wide, which the logo's glyph reaches at this SVG size.
const LOGO_SIZE = 182;
const EXIT_MS = 200;
let launchDone = false;
const listeners = new Set<() => void>();
function subscribe(listener: () => void): () => void {
listeners.add(listener);
return () => listeners.delete(listener);
}
function isLaunchDone(): boolean {
return launchDone;
}
/** Android: this screen covers the app until launch is done, then fades out. */
export const launchSurface = {
keep(): void {
void SplashScreen.preventAutoHideAsync().catch(() => undefined);
// The system's copy of the splash fades over this screen, which looks the same.
SplashScreen.setOptions({ duration: 150, fade: true });
},
leave(): void {
if (launchDone) return;
launchDone = true;
for (const listener of listeners) listener();
},
};
export function LaunchScreen() {
const leaving = useSyncExternalStore(subscribe, isLaunchDone);
const [gone, setGone] = useState(false);
const scheme = useColorScheme() === "light" ? "light" : "dark";
const opacity = useSharedValue(1);
const fadeStyle = useAnimatedStyle(() => ({ opacity: opacity.value }));
useEffect(() => {
SplashScreen.hide();
}, []);
useEffect(() => {
if (!leaving) return;
opacity.value = withTiming(0, { duration: EXIT_MS }, (finished) => {
if (finished) scheduleOnRN(setGone, true);
});
}, [leaving, opacity]);
if (gone) return null;
return (
<Animated.View
pointerEvents={leaving ? "none" : "auto"}
style={[styles.screen, { backgroundColor: SPLASH_BACKGROUND[scheme] }, fadeStyle]}
>
<View style={styles.iconCircle}>
<View style={styles.logo}>
<PaseoLogo size={LOGO_SIZE} color="#ffffff" />
</View>
</View>
</Animated.View>
);
}
const styles = StyleSheet.create({
screen: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
alignItems: "center",
justifyContent: "center",
},
iconCircle: {
width: ICON_CIRCLE_SIZE,
height: ICON_CIRCLE_SIZE,
borderRadius: ICON_CIRCLE_SIZE / 2,
backgroundColor: "#000000",
alignItems: "center",
justifyContent: "center",
},
logo: {
// Optical: the glyph sits right of the SVG's centre. The splash centres the glyph.
transform: [{ translateX: -4 }],
},
});
@@ -0,0 +1,20 @@
import * as SplashScreen from "expo-splash-screen";
// iOS fades the native splash straight into the first screen.
const FADE_MS = 150;
/** iOS and web: the native splash itself covers the app until launch is done. */
export const launchSurface = {
keep(): void {
// Taking control stops expo-router from hiding the splash when navigation is ready.
void SplashScreen.preventAutoHideAsync().catch(() => undefined);
SplashScreen.setOptions({ duration: FADE_MS, fade: true });
},
leave(): void {
SplashScreen.hide();
},
};
export function LaunchScreen(): null {
return null;
}
@@ -4,7 +4,6 @@ import {
resolveStartupNavigationReady,
resolveHostIndexRoute,
resolveStartupRoute,
shouldRunStartupGiveUpTimer,
startHostRuntimeBootstrap,
bindHostRuntimeAppState,
} from "./host-runtime-bootstrap";
@@ -90,6 +89,41 @@ describe("startHostRuntimeBootstrap", () => {
"decision:true",
]);
});
it("settles once the registry boot and the managed-daemon start have both finished", async () => {
let resolveBoot!: () => void;
let resolveDaemonStart!: (result: DaemonStartResult) => void;
let settled = false;
const bootstrap = startHostRuntimeBootstrap({
store: {
boot: () =>
new Promise<void>((resolve) => {
resolveBoot = resolve;
}),
},
daemonStartService: {
startIfEnabled: () =>
new Promise<DaemonStartResult>((resolve) => {
resolveDaemonStart = resolve;
}),
},
shouldStartDaemon: false,
});
void bootstrap.then(() => {
settled = true;
return;
});
resolveBoot();
await Promise.resolve();
await Promise.resolve();
expect(settled).toBe(false);
resolveDaemonStart({ ok: false, error: "daemon failed to start" });
await bootstrap;
expect(settled).toBe(true);
});
});
describe("startup blocking policy", () => {
@@ -100,18 +134,11 @@ describe("startup blocking policy", () => {
daemonStartError: null,
};
it("runs the give-up timer when no startup blocker is active", () => {
it("does not block navigation when no startup blocker is active", () => {
const blocker = resolveStartupBlocker(noBlockerInput);
expect(blocker).toEqual({ kind: "none" });
expect(resolveStartupNavigationReady({ startupBlocker: blocker })).toBe(true);
expect(
shouldRunStartupGiveUpTimer({
startupBlocker: blocker,
anyOnlineHostServerId: null,
hasGivenUpWaitingForHost: false,
}),
).toBe(true);
});
it("blocks navigation while desktop is starting the managed daemon", () => {
@@ -123,13 +150,6 @@ describe("startup blocking policy", () => {
expect(blocker).toEqual({ kind: "managed-daemon-starting" });
expect(resolveStartupNavigationReady({ startupBlocker: blocker })).toBe(false);
expect(
shouldRunStartupGiveUpTimer({
startupBlocker: blocker,
anyOnlineHostServerId: null,
hasGivenUpWaitingForHost: false,
}),
).toBe(false);
});
it("unblocks navigation when any host is online", () => {
@@ -156,13 +176,6 @@ describe("startup blocking policy", () => {
message: "daemon failed to start",
});
expect(resolveStartupNavigationReady({ startupBlocker: blocker })).toBe(true);
expect(
shouldRunStartupGiveUpTimer({
startupBlocker: blocker,
anyOnlineHostServerId: null,
hasGivenUpWaitingForHost: false,
}),
).toBe(false);
});
});
@@ -176,7 +189,7 @@ describe("resolveStartupRoute", () => {
workspaceSelection: null,
workspaceSelectionStatus: "unknown" as const,
isWorkspaceSelectionLoaded: true,
hasGivenUpWaitingForHost: false,
isWaitingForHost: true,
isWaitingForSetup: false,
};
const baseHostInput = {
@@ -220,7 +233,7 @@ describe("resolveStartupRoute", () => {
...baseIndexInput,
hostRegistryStatus: "loading",
workspaceSelection: { serverId: "server-1", workspaceId: "workspace-a" },
hasGivenUpWaitingForHost: true,
isWaitingForHost: false,
}),
).toEqual({ kind: "splash" });
});
@@ -265,7 +278,7 @@ describe("resolveStartupRoute", () => {
...baseIndexInput,
workspaceSelection: { serverId: "server-saved", workspaceId: "workspace-a" },
hosts: [{ serverId: "server-next" }],
hasGivenUpWaitingForHost: true,
isWaitingForHost: false,
}),
).toEqual({ kind: "redirect", href: "/h/server-next" });
});
@@ -306,16 +319,25 @@ describe("resolveStartupRoute", () => {
resolveStartupRoute({
...baseIndexInput,
hosts: [{ serverId: "server-saved" }],
hasGivenUpWaitingForHost: true,
isWaitingForHost: false,
}),
).toEqual({ kind: "redirect", href: "/h/server-saved" });
});
it("shows welcome after root startup gives up and no host exists", () => {
it("holds the splash while a startup host source can still add a host", () => {
expect(
resolveStartupRoute({
...baseIndexInput,
hasGivenUpWaitingForHost: true,
isWaitingForHost: true,
}),
).toEqual({ kind: "splash" });
});
it("shows welcome as soon as no host exists and none can still arrive", () => {
expect(
resolveStartupRoute({
...baseIndexInput,
isWaitingForHost: false,
}),
).toEqual({ kind: "redirect", href: "/welcome" });
});
@@ -26,9 +26,15 @@ export interface StartHostRuntimeBootstrapInput {
shouldStartDaemon: DaemonStartCondition;
}
export function startHostRuntimeBootstrap(input: StartHostRuntimeBootstrapInput): void {
/**
* Starts every source that can add a host at launch: the registry boot with its connection probes,
* and the managed daemon. Settles once none of them can still add one.
*/
export async function startHostRuntimeBootstrap(
input: StartHostRuntimeBootstrapInput,
): Promise<void> {
const registryReady = input.store.boot();
void input.daemonStartService.startIfEnabled({
const daemonStart = input.daemonStartService.startIfEnabled({
shouldStart: async () => {
await registryReady;
return typeof input.shouldStartDaemon === "boolean"
@@ -36,6 +42,7 @@ export function startHostRuntimeBootstrap(input: StartHostRuntimeBootstrapInput)
: input.shouldStartDaemon();
},
});
await Promise.allSettled([registryReady, daemonStart]);
}
const WELCOME_ROUTE: Href = "/welcome";
@@ -76,20 +83,6 @@ export function resolveStartupNavigationReady(input: { startupBlocker: StartupBl
return input.startupBlocker.kind !== "managed-daemon-starting";
}
export function shouldRunStartupGiveUpTimer(input: {
startupBlocker: StartupBlocker;
anyOnlineHostServerId: string | null;
hasGivenUpWaitingForHost: boolean;
}): boolean {
if (input.anyOnlineHostServerId) {
return false;
}
if (input.hasGivenUpWaitingForHost) {
return false;
}
return input.startupBlocker.kind === "none";
}
export type StartupRegistryStatus = "loading" | "ready";
export interface IndexStartupRouteTarget {
@@ -116,7 +109,8 @@ export interface ResolveIndexStartupRouteInput extends ResolveStartupRouteBaseIn
workspaceSelection: ActiveWorkspaceSelection | null;
workspaceSelectionStatus: WorkspaceSelectionStatus;
isWorkspaceSelectionLoaded: boolean;
hasGivenUpWaitingForHost: boolean;
/** A startup host source can still add a host; see `startHostRuntimeBootstrap`. */
isWaitingForHost: boolean;
/** Setup may still open over the empty home; see `useIsSetupDecisionPending`. */
isWaitingForSetup: boolean;
}
@@ -215,11 +209,11 @@ function resolveReadyIndexStartupRoute(input: ResolveIndexStartupRouteInput): St
return { kind: "redirect", href: buildHostRootRoute(savedHostServerId) };
}
if (input.hasGivenUpWaitingForHost) {
return { kind: "redirect", href: WELCOME_ROUTE };
if (input.isWaitingForHost) {
return { kind: "splash" };
}
return { kind: "splash" };
return { kind: "redirect", href: WELCOME_ROUTE };
}
function resolveReadyHostStartupRoute(input: ResolveHostStartupRouteInput): StartupRouteDecision {
+54 -19
View File
@@ -1,6 +1,8 @@
import { getHostRuntimeStore } from "@/runtime/host-runtime";
import { useNativeSplashHold } from "@/native-splash";
import { Button } from "@/components/ui/button";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { LoadingState } from "@/components/ui/loading-state";
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
import type { TFunction } from "i18next";
import { SquarePen } from "lucide-react-native";
@@ -97,6 +99,7 @@ import { ParentAgentCallout, useParentAgentId } from "@/subagents/parent";
import { useCreateFlowStore } from "@/stores/create-flow-store";
import { buildDraftStoreKey, generateDraftId } from "@/stores/draft-keys";
import {
selectAgentLoadingWait,
selectAgentTimelineState,
selectAgentTimelineTurnPresentation,
type Agent,
@@ -242,6 +245,7 @@ function AgentLoadErrorView({ message, onRetry }: { message: string; onRetry: ()
/** A draft has no agent to wait for; an agent shows its loading and error states until ready. */
function renderConversationNonReadyView(args: {
serverId: string;
draft: DraftConversation | null;
agentId: string | undefined;
cwd: string | null;
@@ -253,23 +257,25 @@ function renderConversationNonReadyView(args: {
if (args.draft) {
return null;
}
const nonReadyView = renderChatAgentNonReadyView(args);
invariant(args.agentId, "agent id is defined when the conversation is not a draft");
const nonReadyView = renderChatAgentNonReadyView({ ...args, agentId: args.agentId });
if (nonReadyView) {
return nonReadyView;
}
invariant(args.agentId, "agent id is defined when agent content is ready");
invariant(args.effectiveAgent, "effectiveAgent is defined when the non-ready view is absent");
invariant(args.cwd, "agent cwd is defined when agent content is ready");
return null;
}
function renderChatAgentNonReadyView(args: {
serverId: string;
agentId: string;
viewState: AgentScreenViewState;
effectiveAgent: AgentScreenAgent | null;
t: TFunction;
onRetryLoad: () => void;
}): React.ReactElement | null {
const { viewState, effectiveAgent, t, onRetryLoad } = args;
const { serverId, agentId, viewState, effectiveAgent, t, onRetryLoad } = args;
if (viewState.tag === "not_found") {
return (
<View style={styles.container} testID="agent-not-found">
@@ -283,13 +289,7 @@ function renderChatAgentNonReadyView(args: {
return <AgentLoadErrorView message={viewState.message} onRetry={onRetryLoad} />;
}
if (viewState.tag === "boot" || !effectiveAgent) {
return (
<View style={styles.container} testID="agent-loading">
<View style={styles.errorContainer}>
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
</View>
</View>
);
return <AgentLoadingView serverId={serverId} agentId={agentId} />;
}
return null;
}
@@ -647,13 +647,7 @@ function AgentPanelBody({
: null;
if (target.kind === "agent" && !agent) {
return (
<View style={styles.container} testID="agent-loading">
<View style={styles.errorContainer}>
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
</View>
</View>
);
return <AgentLoadingView serverId={serverId} agentId={target.agentId} />;
}
return (
@@ -669,6 +663,46 @@ function AgentPanelBody({
);
}
/**
* The pane's loading state, for its agent or the agent's history. A visible pane keeps the launch
* splash up while the cache can still answer; after that it says what the host has yet to send.
*/
function AgentLoadingState({
serverId,
agentId,
testID,
}: {
serverId: string;
agentId: string;
testID: string;
}) {
const { t } = useTranslation();
const isPaneVisible = useRetainedPanelActive();
const wait = useSessionStore(
useShallow((state) => selectAgentLoadingWait(state.sessions[serverId], agentId)),
);
useNativeSplashHold(isPaneVisible && wait.source === "cache");
if (wait.source === "cache") return <LoadingState testID={testID} />;
return (
<LoadingState
testID={testID}
title={
wait.waitingFor === "agent"
? t("agentPanel.states.loadingAgent")
: t("agentPanel.states.loadingHistory")
}
/>
);
}
function AgentLoadingView(props: { serverId: string; agentId: string }) {
return (
<View style={styles.container}>
<AgentLoadingState {...props} testID="agent-loading" />
</View>
);
}
function ChatAgentContent({
serverId,
workspaceId,
@@ -1003,6 +1037,7 @@ function ChatAgentContent({
[tabId, target, workspaceId],
);
const nonReadyView = renderConversationNonReadyView({
serverId,
draft,
agentId,
cwd: agentState.cwd,
@@ -1277,8 +1312,8 @@ const ChatAgentReadyContent = memo(function ChatAgentReadyContent({
const dockOverlay = (
<>
{showHistorySyncOverlay ? (
<View style={styles.historySyncOverlay} testID="agent-history-overlay">
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
<View style={styles.historySyncOverlay}>
<AgentLoadingState serverId={serverId} agentId={agentId} testID="agent-history-overlay" />
</View>
) : null}
@@ -82,6 +82,69 @@ describe("plugin timeline projection", () => {
expect(seen).toEqual(["Inspect files"]);
});
it("keeps repeated plugin output IDs distinct across source messages", () => {
const transform: TimelineItemTransform = ({ item }) => [
{
type: "plugin",
id: "part-0",
pluginId: "split",
kind: "part",
version: 1,
data: { text: item.type === "assistant_message" ? item.text : "" },
},
];
const first: StreamItem = {
kind: "assistant_message",
id: "message-1",
text: "Short",
timestamp: new Date("2026-01-01T00:00:00.000Z"),
};
const second: StreamItem = { ...first, id: "message-2", text: "A much longer reply" };
const rows = projectPluginTimelineItems([first, second], transform);
expect(new Set(rows.map((row) => row.id)).size).toBe(2);
expect(rows).toMatchObject([
{ source: { id: "message-1" }, pluginItemId: "part-0", data: { text: "Short" } },
{
source: { id: "message-2" },
pluginItemId: "part-0",
data: { text: "A much longer reply" },
},
]);
const updated = projectPluginTimelineItems(
[{ ...second, text: "Updated reply" }],
transform,
"streaming",
);
expect(updated[0].id).toBe(rows[1].id);
const completed = projectPluginTimelineItems([{ ...second, text: "Final reply" }], transform);
expect(completed[0].id).toBe(rows[1].id);
const prepended = projectPluginTimelineItems(
[{ ...first, id: "older-message" }, first, second],
transform,
);
expect(prepended.slice(1).map((row) => row.id)).toEqual(rows.map((row) => row.id));
});
it("keeps source and output ID separators unambiguous", () => {
const rows = projectPluginTimelineItems(
[
{ ...thought("First"), id: "message/a" },
{ ...thought("Second"), id: "message" },
],
({ sourceId }) => [
{
type: "plugin",
id: sourceId === "message/a" ? "b" : "a/b",
pluginId: "split",
kind: "part",
version: 1,
data: null,
},
],
);
expect(rows[0].id).not.toBe(rows[1].id);
});
it("does not expose mutable tool detail from stream state", () => {
const detail = { type: "read" as const, filePath: "/repo/original.ts" };
const source: StreamItem = {
@@ -126,8 +189,8 @@ describe("plugin timeline projection", () => {
expect(projectPluginTimelineItems([thought("First")], transform)).toMatchObject([
{
kind: "plugin",
id: "inline-thinking/thought-1/0",
source: { kind: "thought", id: "thought-1" },
pluginItemId: "thought-1/0",
data: { text: "First", phase: "streaming" },
},
]);
@@ -214,10 +277,11 @@ describe("plugin timeline projection", () => {
]);
const filtered = projectPluginTimelineItems([source], () => []);
expect(exploded.map((item) => item.id)).toEqual([
"split/thought-1/left",
"split/thought-1/right",
expect(exploded).toMatchObject([
{ source: { id: "thought-1" }, pluginItemId: "thought-1/left" },
{ source: { id: "thought-1" }, pluginItemId: "thought-1/right" },
]);
expect(new Set(exploded.map((item) => item.id)).size).toBe(2);
expect(filtered).toEqual([]);
});
@@ -254,13 +318,13 @@ describe("plugin timeline projection", () => {
expect(projected).toMatchObject([
{
kind: "plugin",
id: "genui/assistant-1/text",
pluginItemId: "assistant-1/text",
timelineCursor: { epoch: "e1", seq: 7 },
turnId: "turn-1",
},
{
kind: "plugin",
id: "genui/assistant-1/card",
pluginItemId: "assistant-1/card",
timelineCursor: { epoch: "e1", seq: 7 },
turnId: "turn-1",
},
@@ -94,7 +94,9 @@ function transformSourceItem(
return transformed.map((pluginItem) => {
const projected: PluginTimelineStreamItem = {
kind: "plugin",
id: `${pluginItem.pluginId}/${pluginItem.id}`,
// Output IDs are local to a source item. Encode each part so separators in
// source or output IDs cannot alias another replacement.
id: JSON.stringify([pluginItem.pluginId, item.id, pluginItem.id]),
source: item,
timestamp: item.timestamp,
pluginId: pluginItem.pluginId,
@@ -132,6 +132,34 @@ describe("resolveDefaultModel", () => {
});
});
describe("remembered model availability", () => {
it("uses the selected host's default when the remembered model belongs to another host", () => {
const preferences = {
provider: "codex" as const,
providerPreferences: { codex: { model: "remote/model" } },
};
const models: AgentModelDefinition[] = [
{ provider: "codex", id: "local/first", label: "First" },
{ provider: "codex", id: "local/default", label: "Default", isDefault: true },
];
const resolve = (availableModels: AgentModelDefinition[] | null) =>
resolveFormState(
undefined,
preferences,
availableModels,
INITIAL_USER_MODIFIED,
makeState().form,
codexProviderMap,
).model;
expect(resolve(null)).toBe("remote/model");
expect(resolve(models)).toBe("local/default");
expect(resolve([{ provider: "codex", id: "remote/model", label: "Remote" }])).toBe(
"remote/model",
);
});
});
describe("model aliases", () => {
it("canonicalizes a retired preferred model and restores thinking from its alias key", () => {
const resolved = resolveFormState(
@@ -793,17 +821,16 @@ describe("resolveFormState", () => {
});
});
it("keeps the explicit model when a refreshed catalogue no longer lists it", () => {
it("keeps a user-selected model when a refreshed catalog no longer lists it", () => {
const resolved = resolveFormState(
undefined,
{ provider: "codex", providerPreferences: { codex: { model: "gpt-6-astra" } } },
{ provider: "codex" },
CODEX_MODELS,
INITIAL_USER_MODIFIED,
makeState().form,
{ ...INITIAL_USER_MODIFIED, model: true },
makeState({ provider: "codex", model: "gpt-6-astra" }).form,
codexProviderMap,
);
expect(resolved.model).toBe("gpt-6-astra");
// Label/persistence lookup must not reinterpret the submitted ID as another model.
expect(resolveEffectiveModel(CODEX_MODELS, resolved.model)).toBeNull();
});
@@ -1324,3 +1351,197 @@ it("owns input readiness, reopening and user edits in the reducer", () => {
state = resolveAgentForm(state, { ...inputs, isPreferencesLoading: false, hasSnapshot: true });
expect(state.form).toMatchObject({ provider: "codex", model: "astra" });
});
it("resolves a remembered model against the new host after its catalog finishes loading", () => {
const inputs = {
type: "INPUTS_CHANGED" as const,
serverId: "second-host",
isVisible: true,
isCreateFlow: true,
isPreferencesLoading: false,
hasSnapshot: true,
initialValues: undefined,
preferences: {
provider: "codex",
providerPreferences: { codex: { model: "remote/model" } },
},
allowedProviderMap: codexProviderMap,
providerModelsByProvider: makeProviderModelsByProvider([["codex", null]]),
};
const firstHost = resolveAgentForm(makeState(), {
...inputs,
serverId: "first-host",
providerModelsByProvider: makeProviderModelsByProvider([
["codex", [{ provider: "codex", id: "remote/model", label: "Remote" }]],
]),
});
const opening = resolveAgentForm(firstHost, inputs);
expect(opening.form.model).toBe("remote/model");
expect(opening.resolution.status).toBe("pending");
const ready = resolveAgentForm(opening, {
...inputs,
providerModelsByProvider: makeProviderModelsByProvider([["codex", CODEX_MODELS]]),
});
expect(ready.form.model).toBe("gpt-5.3-codex");
expect(ready.form.thinkingOptionId).toBe("xhigh");
expect(ready.resolution.status).toBe("completed");
});
it("retains user input while the opening catalog is pending", () => {
const inputs = {
type: "INPUTS_CHANGED" as const,
serverId: "host",
isVisible: true,
isCreateFlow: true,
isPreferencesLoading: false,
hasSnapshot: true,
initialValues: undefined,
preferences: { provider: "codex", providerPreferences: { codex: { model: "remote/model" } } },
allowedProviderMap: codexProviderMap,
providerModelsByProvider: makeProviderModelsByProvider([["codex", null]]),
};
const opening = resolveAgentForm(makeState(), inputs);
const edited = resolveAgentForm(opening, {
type: "SET_MODEL_FROM_USER",
modelId: "manual/model",
availableModels: null,
providerPrefs: undefined,
});
const ready = resolveAgentForm(edited, {
...inputs,
providerModelsByProvider: makeProviderModelsByProvider([["codex", CODEX_MODELS]]),
});
expect(ready.form.model).toBe("manual/model");
expect(ready.resolution.status).toBe("completed");
});
it("resolves modeless providers once their empty catalog is ready", () => {
const ready = resolveAgentForm(makeState(), {
type: "COMPLETE_RESOLUTION",
initialValues: undefined,
preferences: { provider: "pi" },
providerModelsByProvider: makeProviderModelsByProvider([["pi", []]]),
allowedProviderMap: buildProviderDefinitionMap([TEST_PI_DEFINITION]),
});
expect(ready.form).toMatchObject({ provider: "pi", model: "" });
expect(ready.resolution.status).toBe("completed");
});
it("ignores equivalent pending inputs with freshly built fork defaults", () => {
const inputs = {
type: "INPUTS_CHANGED" as const,
serverId: "host",
isVisible: true,
isCreateFlow: true,
isPreferencesLoading: false,
hasSnapshot: true,
initialValues: { provider: "codex", model: "gpt-5.3-codex", modeId: "full-access" },
preferences: null,
allowedProviderMap: codexProviderMap,
providerModelsByProvider: makeProviderModelsByProvider([["codex", null]]),
};
const pending = resolveAgentForm(makeState(), inputs);
expect(resolveAgentForm(pending, { ...inputs, initialValues: { ...inputs.initialValues } })).toBe(
pending,
);
});
it("keeps the new provider's mode and thinking when switching away from pending fork defaults", () => {
const claudeModels: AgentModelDefinition[] = [
{
provider: "claude",
id: "sonnet",
label: "Sonnet",
defaultThinkingOptionId: "low",
thinkingOptions: [
{ id: "low", label: "Low" },
{ id: "high", label: "High" },
],
},
];
const claudePrefs = { mode: "bypassPermissions", thinkingByModel: { sonnet: "high" } };
const inputs = {
type: "INPUTS_CHANGED" as const,
serverId: "host",
isVisible: true,
isCreateFlow: true,
isPreferencesLoading: false,
hasSnapshot: true,
initialValues: {
provider: "codex",
model: "gpt-5.3-codex",
modeId: "full-access",
thinkingOptionId: "low",
},
preferences: { providerPreferences: { claude: claudePrefs } },
allowedProviderMap: bothProviderMap,
providerModelsByProvider: makeProviderModelsByProvider([
["codex", null],
["claude", claudeModels],
]),
};
const pending = resolveAgentForm(makeState(), inputs);
const switched = resolveAgentForm(pending, {
type: "SET_PROVIDER_AND_MODEL_FROM_USER",
provider: "claude",
modelId: "sonnet",
providerDef: TEST_CLAUDE_DEFINITION,
providerModels: claudeModels,
providerPrefs: claudePrefs,
});
expect(switched.form).toMatchObject({
provider: "claude",
model: "sonnet",
modeId: "bypassPermissions",
thinkingOptionId: "high",
});
expect(resolveAgentForm(switched, inputs).form).toEqual(switched.form);
});
it("keeps a new model's thinking preference when pending fork defaults finish resolving", () => {
const models: AgentModelDefinition[] = [
...CODEX_MODELS,
{ ...CODEX_MODELS[0], id: "next-model", defaultThinkingOptionId: "low" },
];
const preferences = {
providerPreferences: { codex: { thinkingByModel: { "next-model": "xhigh" } } },
};
const inputs = {
type: "INPUTS_CHANGED" as const,
serverId: "host",
isVisible: true,
isCreateFlow: true,
isPreferencesLoading: false,
hasSnapshot: true,
initialValues: { provider: "codex", model: "gpt-5.3-codex", thinkingOptionId: "low" },
preferences,
allowedProviderMap: codexProviderMap,
providerModelsByProvider: makeProviderModelsByProvider([["codex", null]]),
};
const pending = resolveAgentForm(makeState(), inputs);
const edited = resolveAgentForm(pending, {
type: "SET_MODEL_FROM_USER",
modelId: "next-model",
availableModels: models,
providerPrefs: preferences.providerPreferences.codex,
});
expect(edited.form.thinkingOptionId).toBe("xhigh");
const ready = resolveAgentForm(edited, {
...inputs,
providerModelsByProvider: makeProviderModelsByProvider([["codex", models]]),
});
expect(ready.form).toEqual(edited.form);
});
it("preserves saved thinking when a legacy default-model fork resolves", () => {
const resolved = resolveFormState(
{ provider: "codex", model: "default", thinkingOptionId: "low" },
{ providerPreferences: { codex: { thinkingByModel: { "gpt-5.3-codex": "xhigh" } } } },
CODEX_MODELS,
INITIAL_USER_MODIFIED,
makeState().form,
codexProviderMap,
);
expect(resolved.model).toBe("gpt-5.3-codex");
expect(resolved.thinkingOptionId).toBe("low");
});
@@ -146,7 +146,11 @@ function resolveCanonicalModelId(
): string {
const normalizedModelId = normalizeSelectedModelId(modelId);
if (!normalizedModelId || !availableModels) return normalizedModelId;
return findModelByReference(availableModels, normalizedModelId)?.id ?? "";
const model = findModelByReference(availableModels, normalizedModelId);
if (model) return model.id;
// COMPAT(default-model-id): added in v0.7.2, remove after 2026-12-06.
// Older drafts used "default" before providers exposed concrete model IDs.
return normalizedModelId === "default" ? resolveDefaultModelId(availableModels) : "";
}
export function resolveEffectiveModel(
@@ -321,22 +325,16 @@ function resolveModelField(input: {
if (!provider) return "";
const initialModel = normalizeSelectedModelId(initialValues?.model);
const preferredModel = normalizeSelectedModelId(providerPrefs?.model);
// COMPAT(default-model-id): added in v0.7.2, remove after 2026-12-06.
// Older drafts used "default" before providers exposed concrete model IDs.
if ((initialModel || preferredModel) === "default" && availableModels?.length) {
return (
findModelByReference(availableModels, "default")?.id || resolveDefaultModelId(availableModels)
);
}
if (initialModel) {
return !availableModels
? initialModel
: resolveCanonicalModelId(availableModels, initialModel) || initialModel;
}
if (preferredModel) {
return !availableModels
return !availableModels?.length
? preferredModel
: resolveCanonicalModelId(availableModels, preferredModel) || preferredModel;
: resolveCanonicalModelId(availableModels, preferredModel) ||
resolveDefaultModelId(availableModels);
}
return "";
}
@@ -361,8 +359,11 @@ function resolveThinkingOption(input: {
} = input;
if (!provider) return "";
if (userModified) return currentThinkingOptionId;
const initialModel = normalizeSelectedModelId(initialValues?.model);
const matchesInitialModel =
!initialModel || resolveCanonicalModelId(availableModels, initialModel) === modelId;
const initialThinkingOptionId =
typeof initialValues?.thinkingOptionId === "string"
matchesInitialModel && typeof initialValues?.thinkingOptionId === "string"
? initialValues.thinkingOptionId.trim()
: "";
const preferredThinking = resolvePreferredThinkingOptionId({
@@ -392,6 +393,10 @@ export function resolveFormState(
preferences,
});
const providerInitialValues =
initialValues?.provider && initialValues.provider !== result.provider
? undefined
: initialValues;
const providerDef = result.provider ? allowedProviderMap.get(result.provider) : undefined;
const providerPrefs = result.provider
? preferences?.providerPreferences?.[result.provider]
@@ -401,7 +406,7 @@ export function resolveFormState(
provider: result.provider,
userModified: userModified.modeId,
currentModeId: result.modeId,
initialValues,
initialValues: providerInitialValues,
providerDef,
providerPrefs,
});
@@ -410,7 +415,7 @@ export function resolveFormState(
provider: result.provider,
userModified: userModified.model,
currentModel: result.model,
initialValues,
initialValues: providerInitialValues,
providerPrefs,
availableModels,
});
@@ -420,7 +425,7 @@ export function resolveFormState(
userModified: userModified.thinkingOptionId,
currentThinkingOptionId: result.thinkingOptionId,
modelId: result.model,
initialValues,
initialValues: providerInitialValues,
providerPrefs,
availableModels,
});
@@ -553,9 +558,14 @@ function completeResolution(
state.form,
action.allowedProviderMap,
);
const nextState = { ...state, resolution: { status: "completed" } as const };
if (!hasFormStateChanged(state.form, resolved)) return nextState;
return { ...nextState, form: resolved };
const waitingForModels =
resolved.provider !== null && action.providerModelsByProvider.get(resolved.provider) === null;
const resolution = waitingForModels
? PENDING_AGENT_FORM_RESOLUTION
: ({ status: "completed" } as const);
const form = hasFormStateChanged(state.form, resolved) ? resolved : state.form;
if (form === state.form && resolution.status === state.resolution.status) return state;
return { ...state, resolution, form };
}
function applyProfile(state: AgentFormReducerState, action: ApplyProfileAction) {
@@ -15,6 +15,7 @@ import { SettingsRow, SettingsSection } from "@/components/settings";
import { Button } from "@/components/ui/button";
import { CheckboxRow } from "@/components/ui/checkbox";
import { bySizing, TOUCH_TARGET } from "@/components/ui/control-geometry";
import { IndependentScrollBoundary } from "@/components/ui/independent-scroll-boundary";
import { ToolbarButton, paneContentToolbarIconSize } from "@/components/ui/pane-content-toolbar";
import { SearchField } from "@/components/ui/search-field";
import { useIsCompactFormFactor } from "@/constants/layout";
@@ -232,14 +233,16 @@ export function ProviderModels({
/>
) : null}
{/* A provider can report hundreds of models; the rest of the page stays in reach. */}
<ScrollView
// Android scrolls a ScrollView nested in the page or the sheet only with this flag.
nestedScrollEnabled
style={[styles.discoveredList, curating && settingsStyles.rowBorder]}
testID="provider-discovered-models"
>
{discoveredBody}
</ScrollView>
<IndependentScrollBoundary activateOnStart={false}>
<ScrollView
// Android scrolls a ScrollView nested in the page or the sheet only with this flag.
nestedScrollEnabled
style={[styles.discoveredList, curating && settingsStyles.rowBorder]}
testID="provider-discovered-models"
>
{discoveredBody}
</ScrollView>
</IndependentScrollBoundary>
</View>
</SettingsSection>
) : null}
@@ -294,6 +294,75 @@ afterEach(() => {
});
describe("DirectorySync session readiness", () => {
function createCachedDirectory(
serverId: string,
readDirectory: DirectoryCheckpointStorage["readDirectory"] | null,
): DirectorySync {
serverIds.add(serverId);
const directory = new DirectorySync(
serverId,
{
onAgentStoppedRunning: () => undefined,
markAgentLoading: () => undefined,
markAgentReady: () => undefined,
markAgentError: () => undefined,
},
readDirectory
? {
readAgent: async () => undefined,
readWorkspace: async () => undefined,
readDirectory,
commitDirectoryMutations: () => undefined,
}
: undefined,
);
useSessionStore.getState().initializeSession(serverId, null, 0);
return directory;
}
const hasRestoredCachedDirectory = (serverId: string) =>
useSessionStore.getState().sessions[serverId]?.hasRestoredCachedDirectory;
it("records the cached directory as restored once its read settles, even when it is empty", async () => {
let finishRead: (
value: Awaited<ReturnType<DirectoryCheckpointStorage["readDirectory"]>>,
) => void = () => undefined;
const read = new Promise<Awaited<ReturnType<DirectoryCheckpointStorage["readDirectory"]>>>(
(resolve) => {
finishRead = resolve;
},
);
const directory = createCachedDirectory("restoring-empty-cache", () => read);
const restored = directory.restoreCachedDirectory();
expect(hasRestoredCachedDirectory("restoring-empty-cache")).toBe(false);
finishRead({ agents: new Map(), workspaces: new Map(), projects: new Map() });
await restored;
expect(hasRestoredCachedDirectory("restoring-empty-cache")).toBe(true);
directory.dispose();
});
it("records the cached directory as restored when its read fails", async () => {
const directory = createCachedDirectory("failed-cache-read", async () => {
throw new Error("storage unavailable");
});
await directory.restoreCachedDirectory().catch(() => undefined);
expect(hasRestoredCachedDirectory("failed-cache-read")).toBe(true);
directory.dispose();
});
it("records a host without cache storage as restored", async () => {
const directory = createCachedDirectory("no-cache-storage", null);
await directory.restoreCachedDirectory();
expect(hasRestoredCachedDirectory("no-cache-storage")).toBe(true);
directory.dispose();
});
it("restores the cached directory before network demand", async () => {
const serverId = "offline-cached-directory";
serverIds.add(serverId);
@@ -538,7 +538,10 @@ export class DirectorySync {
private loadCachedDirectory(): Promise<void> {
const checkpoints = this.checkpoints;
if (!checkpoints) return Promise.resolve();
if (!checkpoints) {
useSessionStore.getState().markCachedDirectoryRestored(this.serverId);
return Promise.resolve();
}
this.cacheLoad ??= (async () => {
const revision = this.revision;
const cached = await checkpoints.readDirectory(this.serverId);
@@ -549,7 +552,7 @@ export class DirectorySync {
this.workspaces.commitCached(cached);
if (this.revision === revision) this.cursors = cached.checkpoint ?? {};
this.cacheAccepted = true;
})();
})().finally(() => useSessionStore.getState().markCachedDirectoryRestored(this.serverId));
return this.cacheLoad;
}

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