Merge origin/main and retain terminal test removal

This commit is contained in:
Brennan Benson
2026-11-09 17:47:26 -08:00
1230 changed files with 31378 additions and 38899 deletions
+32 -257
View File
@@ -2,193 +2,42 @@
Thanks for contributing to Orca.
## Before You Start
- Found a security vulnerability? Do not open a public issue or PR; report it privately as described in [`SECURITY.md`](./SECURITY.md).
- Keep changes scoped to a clear user-facing improvement, bug fix, or refactor.
- Orca targets macOS, Linux, and Windows. Every change must stay compatible with all three platforms unless the code is explicitly guarded by a runtime platform check.
- For keyboard shortcuts, use runtime platform checks in renderer code and `CmdOrCtrl` in Electron menu accelerators.
- For shortcut labels, show `⌘` and `⇧` on macOS, and `Ctrl+` and `Shift+` on Linux and Windows.
- For file paths, use Node or Electron path utilities such as `path.join`.
- Orca must work against local repositories, remote servers, and SSH worktrees. Do not assume a process, file, credential, shell, or network path exists only on the local machine.
- Orca supports many CLI agents, integrations, and git providers. Keep generic behavior provider-neutral; guard integration-specific logic behind explicit checks.
- Keep changes well-engineered and performant: follow existing architecture, avoid unnecessary work in hot paths, clean up owned resources, and use concrete module names.
- For UI work, follow [`docs/STYLEGUIDE.md`](../docs/STYLEGUIDE.md), use the tokens and shadcn primitives it specifies, and verify polished behavior across platforms, light/dark mode, and SSH latency.
Found a security vulnerability? Do not open a public issue or PR; report it privately as described in [`SECURITY.md`](./SECURITY.md).
## Local Setup
Install Node 24, pnpm, and the Bun version in [`config/.bun-version`](../config/.bun-version).
`pnpm test` runs Vitest on Bun, with Node workers for runtime contracts such as SQLite,
native PTYs, socket liveness, and V8 memory behavior. `pnpm test:node` runs the same suites
entirely on Node. Builds and dependency installation still use Node and pnpm.
The server, its workers and its packaged dependencies target Node 24. The compatibility
launcher and CLI still target Node 18; the launcher hands off to bundled Node 24 before
loading server code. WSL guest programs and host discovery retain their Node 18 minimum.
Keep Node 24 APIs and server imports out of these host compatibility paths. Running an
unpackaged server directly requires Node 24 or newer.
Use the pnpm version in `packageManager` in [`package.json`](../package.json): `corepack enable`
needs Corepack 0.34.5 or newer to start the pinned pnpm (`npm install -g corepack@latest`). On
Windows it writes shims next to `node.exe` and fails with `EPERM` outside an elevated shell when
Node is in `C:\Program Files\nodejs`; run `npm install -g pnpm@<that version>` instead.
`pnpm install` compiles native modules such as `node-pty` with `node-gyp` and loads them in
Electron, so a fresh machine also needs:
- **macOS**: Xcode Command Line Tools (`xcode-select --install`).
- **Windows**: Python 3 and Visual Studio Build Tools with the "Desktop development with C++"
workload.
- **Linux**: a C++ toolchain, Python 3, and the libraries Electron loads even on a headless
machine, plus `xvfb`, which the `*.electron.test.ts` files in `pnpm test` use when `DISPLAY` is
unset. On Ubuntu 24.04+ and Debian 13+:
```bash
sudo apt-get update && sudo apt-get install -y build-essential python3 xvfb libgtk-3-0 libnss3 libgbm1 libasound2t64
```
Older releases name the last package `libasound2`.
Install Node 24, the pnpm version in `packageManager` in [`package.json`](../package.json), and the Bun version in [`config/.bun-version`](../config/.bun-version). `pnpm install` compiles native modules, so you also need a C++ toolchain and Python 3 (Xcode Command Line Tools on macOS, Visual Studio Build Tools on Windows, `build-essential` and Electron's libraries on Linux).
```bash
pnpm install
pnpm -C mobile install --frozen-lockfile # mobile/ has its own lockfile; build and lint need it
pnpm dev
```
`mobile/` is a separate pnpm project with its own lockfile, so the root `pnpm install` leaves its
dependencies uninstalled. `pnpm build` (`build:mobile-web` fails without them) and the lint
passes that cover `mobile/` need them. Install them before building or linting, and again
when `mobile/pnpm-lock.yaml` changes:
`pnpm dev` in a linked Git worktree uses its own profile and ports, so instances in different worktrees run side by side.
```bash
pnpm -C mobile install --frozen-lockfile
```
### Dev Profiles and Parallel Instances
`pnpm dev` in a linked Git worktree uses its own userData profile, renderer port, and remote
debugging (CDP) port, so dev instances in different worktrees run side by side. The main checkout
keeps the shared `orca-dev` profile. Ports are derived from the worktree path and move to the next
free port when taken: renderer ports start at 15200 and CDP ports at 9333.
On startup the runner prints one stdout line and writes the same JSON to `out/dev-instance.json`:
```text
ORCA_DEV_INSTANCE {"userData":".../orca-dev-wt/1d3830d4d3","profile":"worktree","rendererPort":15339,"rendererUrl":"http://localhost:15339","cdpPort":9513,"cdpUrl":"http://127.0.0.1:9513","repoRoot":"...","runnerPid":4242}
```
| Option | Effect |
| ----------------------------------------------------------------------- | ---------------------------------------------------------- |
| `pnpm dev --shared-profile` or `ORCA_DEV_PROFILE=shared` | Use the shared `orca-dev` profile |
| `pnpm dev --worktree-profile` or `ORCA_DEV_PROFILE=worktree` | Use a per-worktree profile, including in the main checkout |
| `ORCA_DEV_USER_DATA_PATH=<dir>` | Use an explicit profile directory |
| `REMOTE_DEBUGGING_PORT=<port>`, `ORCA_DEV_RENDERER_PORT=<port>` | Pin a port |
| `pnpm dev --seed-profile[=<dir>]` or `ORCA_DEV_SEED_PROFILE=<dir or 1>` | Seed an empty profile on first launch |
Per-worktree profiles live in `orca-dev-wt/<hash>` next to `orca-dev` (`~/Library/Application
Support` on macOS, `%APPDATA%` on Windows, `$XDG_CONFIG_HOME` or `~/.config` on Linux). The
automatic storage cleanup removes them once their worktree is gone and nothing still runs from
them. `config/scripts/orca-dev.mjs` and the `orca-dev` terminal wrapper target the profile this
checkout's `pnpm dev` used.
Seeding copies a slim set of state from another profile: projects, workspaces, settings, SSH
targets, and the Orca account session. Terminal sessions, PTY leases, automations, caches, logs,
and lock files are not copied, and the source profile is only read. The default source is
`orca-dev`, or the installed app's profile when `orca-dev` is empty. Seed from `orca-dev` when you
need the signed-in account session: dev builds cannot decrypt secrets the installed app encrypted.
```bash
pnpm dev:seed-profile [--from=<profile dir>] [--to=<profile dir>] [--reset]
pnpm dev:fresh [--keep] [--seed-from[=<profile dir>]] # temporary profile, removed on exit
```
### Targeting Local Tests
Use a test file or directory when you know the relevant suites. For dependency-based
feedback, Vitest can select tests affected by your edits:
```bash
pnpm test:changed src/main/runtime --maxWorkers=2
pnpm test --changed=origin/main --maxWorkers=2
pnpm test src/shared/automations/scheduling/automation-cron-input-validation.test.ts --maxWorkers=2
```
`test:changed` considers staged, unstaged, and untracked files. `--changed=origin/main`
also includes committed changes since the branch's merge base. Update that ref when
you need a newer baseline. Both accept the same path filters and options as `pnpm test`.
When Git reports no changed files at all, the launcher exits before starting Vitest.
Affected tests use Vitest's static import graph. Run suites explicitly for computed
dynamic imports, fixture files, subprocess inputs, or other dependencies outside that
graph. Local affected tests do not replace CI.
Use `pnpm test`, not raw `vitest`: only it keeps the transform cache that makes repeat runs fast.
Most unit files share a worker and its module cache with the files before them. After each file
the worker undoes mocks, fake timers, stubs, env, cwd, and leftover timers, listeners, and globals.
Files using `vi.doMock`, `vi.resetModules`, a DOM environment, or direct `globalThis` writes keep
their own worker. If a file passes alone but fails after others, add `// @orca-isolated-worker`
to it; `ORCA_VITEST_ISOLATE_EVERY_FILE=1` isolates every file to confirm a leak.
To reduce main-process rebuild CPU and memory when you do not need its source maps,
set `ORCA_DEV_MAIN_SOURCEMAPS=0` before `pnpm dev`. In Bash/zsh:
```bash
ORCA_DEV_MAIN_SOURCEMAPS=0 pnpm dev
```
In PowerShell, use `$env:ORCA_DEV_MAIN_SOURCEMAPS='0'` before `pnpm dev`.
Remove the variable when debugging the main process with source maps. Renderer and
preload settings are unaffected; production builds always keep their hidden main maps.
`pnpm dev` serves the renderer with Vite's bundled dev mode: a few bundled chunks instead of
thousands of module requests, so the first render and full reloads are faster. While a rebuild is
pending, a newly opened pop-out, space, or web window may briefly get placeholder HTML. If the
renderer misbehaves, set `ORCA_DEV_BUNDLED=0` (PowerShell: `$env:ORCA_DEV_BUNDLED='0'`) and report it.
Local installs use pnpm's global virtual store: each package version is one slot
under `~/pnpm/store` that every worktree links to, instead of a full `node_modules` per worktree.
An existing worktree converts on its next `pnpm install`, and an older branch without the setting
converts back the same way. CI always uses the normal layout. On Windows, pnpm links with
junctions when you lack the symlink privilege, so no administrator rights or Developer Mode are
needed. Things to know:
- Keep `~/node_modules` (and any other `node_modules` above the store) out of your home
directory. Node resolves upward from the store slot, so a stray one there supplies
dependencies the package never declared and hides missing-dependency bugs; `pnpm install` warns
when it finds one.
- Native addons are never rebuilt in place in a shared slot: each CPU gets its own build
beside it (see [`native-build-entry.cjs`](../config/scripts/native-build/node-addons/native-build-entry.cjs)), so
cross-arch packaging is safe for other worktrees.
- `ORCA_PNPM_GLOBAL_VIRTUAL_STORE=0` opts out. Keep it set
in your shell: `pnpm run` re-checks the install and relinks a worktree whose layout no longer
matches.
Ordinary installs include native optional dependencies for the current OS and CPU only.
Before a cross-architecture build (including `pnpm build:mac`, which produces both x64 and
arm64 artifacts by default), run `pnpm install:release` to add the other CPU's variants.
Linux `pnpm build`, `pnpm build:native`, and Linux packaging require a running Docker
daemon to build the clipboard helper against Ubuntu 20.04 rather than the host's
newer libraries. A verified cached helper can be reused without Docker. For native
Wayland development, run `pnpm build:native` before `pnpm dev` to make text copying
available. See the [clipboard build guide](../native/wayland-clipboard/README.md#building-and-testing).
macOS and Windows builds do not use this helper or require Docker for it.
See [`docs/development.md`](../docs/development.md) for per-OS packages, Corepack and Windows notes, dev profiles and seeding, cross-architecture and Linux (Docker) builds, and troubleshooting.
## Branch Naming
Use a clear, descriptive branch name that reflects the change.
Use a clear, descriptive branch name that reflects the change, such as `fix/ctrl-backspace-delete-word`, `feat/shift-enter-newline`, or `chore/update-contributor-guide`. Avoid vague names like `test`, `misc`, or `changes`.
Good examples:
## Code Guidelines
- `fix/ctrl-backspace-delete-word`
- `feat/shift-enter-newline`
- `chore/update-contributor-guide`
- Keep changes scoped to a clear user-facing improvement, bug fix, or refactor.
- Orca targets macOS, Linux, and Windows. Guard platform-specific code with runtime checks, use `CmdOrCtrl` in Electron menu accelerators, show `⌘`/`⇧` labels on macOS and `Ctrl+`/`Shift+` elsewhere, and build paths with `path.join`. See [cross-platform support](../docs/agents-md-refs/cross-platform-support.md).
- Orca must work against local repositories, remote servers, and SSH worktrees. Do not assume a process, file, credential, shell, or network path exists only on the local machine.
- Keep generic behavior provider-neutral across CLI agents, integrations, and git providers; guard integration-specific logic behind explicit checks.
- Follow existing architecture, avoid unnecessary work in hot paths, clean up owned resources, and use concrete module names.
- For UI work, follow [`docs/STYLEGUIDE.md`](../docs/STYLEGUIDE.md) and verify behavior across platforms, light/dark mode, and SSH latency.
Avoid vague names like `test`, `misc`, or `changes`.
### Type Declarations: Prefer `.ts` Over `.d.ts`
## Before Opening a PR
Put project-owned types in `.ts` files. `.d.ts` is reserved for ambient shims (e.g., `env.d.ts`). `skipLibCheck: true` applies to our own `.d.ts` files too, so an unresolved type reference there silently becomes `any`. CI enforces this for `src/preload/` and `src/shared/`.
Run the same checks that CI runs, after the `mobile/` install from [Local Setup](#local-setup):
## Checks Before Opening a PR
Run the same checks CI runs, after the `mobile/` install above:
```bash
pnpm lint
@@ -197,102 +46,28 @@ pnpm test
pnpm build
```
`pnpm lint` runs independent checks in a bounded pool. Use
`pnpm lint --maxWorkers=2 --timings` to limit concurrent checks and print their durations.
For faster repeat typechecks use `pnpm tc` (or `pnpm tc:node`, `pnpm tc:web`, `pnpm tc:cli`); run `pnpm tc:node` after editing shared tests.
For repeated local typechecks, use `pnpm tc` (or `pnpm tc:node`, `pnpm tc:web`,
and `pnpm tc:cli`). On Apple Silicon macOS and x64/arm64 Linux, these use the pinned
`tsrs` compiler with incremental caches. Keep `.cache/typecheck/` between checks;
delete it to force a fresh check. Caches are separate for each project, compiler
version, and worktree. At most two projects run together, subject to the memory budget.
Windows, Intel macOS, and other unsupported platforms use pinned Bun automatically.
Pass `--compiler=bun` to explicitly use Bun, or `--compiler=native` to use TypeScript.
CI uses `pnpm typecheck:ci`, which explicitly selects Bun and its CI concurrency.
Shared tests are checked by the
Node project; shared production code is checked in all three environments.
Run `pnpm tc:node` after editing shared tests, or `pnpm tc` to check everything.
Add a test when it would catch a regression of your behavior change or bug fix, not for shallow coverage; see [test anti-patterns](../docs/agents-md-refs/test-antipatterns.md). If your change affects UI or interaction behavior, verify it on the platforms it could impact.
Add high-quality tests for behavior changes and bug fixes. Prefer tests that would actually catch a regression, not shallow coverage that only exercises the happy path.
### Targeting Local Tests
If your change affects UI or interaction behavior, verify it on the platforms it could impact.
Use `pnpm test`, not raw `vitest`: only it keeps the transform cache that makes repeat runs fast.
## Type Declarations: Prefer `.ts` Over `.d.ts`
```bash
pnpm test src/shared/automations/scheduling/automation-cron-input-validation.test.ts --maxWorkers=2
pnpm test:changed src/main/runtime --maxWorkers=2 # staged, unstaged, and untracked changes
pnpm test --changed=origin/main --maxWorkers=2 # also commits since the merge base
```
Project-owned type declarations belong in `.ts` files. `.d.ts` is reserved for ambient shims (e.g., `env.d.ts`, `vite/client.d.ts`). TypeScript's `skipLibCheck: true` setting applies globally, including to our own `.d.ts` files, which means any unresolved type reference in a `.d.ts` silently becomes `any` at its call sites. Write your types in `.ts` files so the compiler actually checks them.
CI enforces this for `src/preload/` and `src/shared/`.
Affected tests follow Vitest's static import graph, so run suites explicitly for dynamic imports, fixtures, or subprocess inputs. Local affected tests do not replace CI. If a file passes alone but fails after others, add `// @orca-isolated-worker` to it.
## Pull Requests
Each pull request should follow [`.github/pull_request_template.md`](./pull_request_template.md). In particular:
Fill in every section of [`.github/pull_request_template.md`](./pull_request_template.md): an ELI5, what changed and why, a linked issue (required for outside contributors), a before and after (screenshots or videos) for any UI or behavior change (only if there is truly no visual or interaction change, write exactly `N/A` and briefly say why), how you tested it, the risk, and under Review a short summary from your AI coding agent covering cross-platform, SSH/remote, agent and integration compatibility, performance, UI quality, and security. Keep each PR small and focused on one topic.
- if you are an outside contributor, link the issue your PR addresses
- open with an ELI5 of the change (plain language paragraph; the PR title is the one-liner)
- explain what changed and why, and stay focused on a single topic when possible
- for any UI or interaction change, attach **before and after** screenshots (or short videos); if there is no visual or interaction change, write `N/A` and briefly explain why
- include high-quality tests when behavior changes or bug fixes warrant them
- include a brief code review summary from your AI coding agent that explicitly checks cross-platform compatibility, SSH/remote/local compatibility, supported agent and integration compatibility, performance risk, UI quality when applicable, and basic security risk
- mention any platform-specific, remote/SSH-specific, agent-specific, integration-specific, or git-provider-specific behavior and testing notes
- **Include your X (Twitter) handle** in the PR template Author section — we shout out contributors when we merge features on [@orca_build](https://x.com/orca_build).
Version bumps, tags, and releases are maintainer-managed. Do not include release version changes unless a maintainer asks. Maintainers cut releases with the [Cut Release](https://github.com/stablyai/orca/actions/workflows/release-cut.yml) workflow.
## Release Process
## Getting Help
Version bumps, tags, and releases are maintainer-managed. Do not include release version changes in a normal contribution unless a maintainer asks for them.
### Cutting a release (maintainers)
All releases are cut from the **Cut Release** GitHub Actions workflow. There is no local `pnpm release:*` script — running releases locally is too easy to get wrong (dirty tree, wrong branch, stale main).
**To cut a release:**
1. Open [Actions → Cut Release](../../actions/workflows/release-cut.yml).
2. Click **Run workflow** and pick:
- **kind**: one of `rc`, `patch`, `minor`, `major`.
- **ref**: the branch, tag, or SHA to build from. Defaults to `main`.
3. Run it.
The workflow resolves the next version from GitHub Releases, bumps `package.json`, tags, pushes, and runs the multi-platform build + publish inline.
**How the next version is chosen:**
All stable kinds (`patch`, `minor`, `major`) are computed off the latest _stable_ release, ignoring any RCs in between.
- `kind=rc` + last tag was stable (e.g. `v1.3.14`) → `v1.3.15-rc.0`.
- `kind=rc` + active RC series (e.g. `v1.3.15-rc.2`) → `v1.3.15-rc.3`.
- `kind=patch` + latest stable `v1.3.14` → `v1.3.15` (regardless of any intermediate RCs).
- `kind=minor` + latest stable `v1.3.14` → `v1.4.0`.
- `kind=major` + latest stable `v1.3.14` → `v2.0.0`.
**Safety guarantees:**
- Stable releases are refused if the new version isn't strictly greater than the latest published stable. This is the only rule `electron-updater` actually needs — it compares semver within the `latest` channel, so a regressing stable is the one thing that breaks auto-update for fresh installs.
- Complete RC draft releases created by the release workflow are published before cutting a new tag only when the draft tag was built from the current release ref. Stale drafts are skipped so fixes cut a fresh RC instead of exposing old artifacts.
- If the latest RC tag exists but is still draft-only or missing its GitHub Release, the workflow resumes that tag only when it was built from the current release ref. Otherwise the next RC number is cut.
- RC numbering also considers release commits on `main`, so deleting a stale tag does not let a later cut reuse the same RC number.
- Off-main releases (when `ref` is not the tip of `main`) only push the tag. `main` is never mutated from a non-main ref, so you can safely release an older commit without polluting history.
- When `ref` is the tip of `main`, the workflow tries to fast-forward the version-bump commit onto `main`. If main requires pull requests, it leaves main unchanged and pushes only the release tag. Other push errors still stop the cut.
**Common scenarios:**
- **Normal release:** `kind=patch`, `ref=main`.
- **"A bad commit just landed on main, release the commit before it":** `kind=patch`, `ref=<good-sha>`. `main` is left alone; the tag points at the good SHA. Fix forward on `main` afterward.
- **One-off RC for a feature branch:** `kind=rc`, `ref=<branch-or-sha>`. Produces an RC tag that does not touch `main`.
- **Minor or major bump:** `kind=minor` or `kind=major`.
## Release Channels
The public Homebrew cask tracks stable desktop releases:
```bash
brew install --cask stablyai/orca/orca
```
Release candidates use a separate cask token:
```bash
brew install --cask stablyai/orca/orca@rc
```
The two casks conflict because both install `Orca.app`. Switch channels with a
normal `brew uninstall --cask` followed by the install for the other channel.
Do not use `--zap` unless you intentionally want to remove local Orca state.
Ask questions on [Discord](https://discord.gg/fzjDKHxv8Q), or open an [issue](https://github.com/stablyai/orca/issues/new/choose) for bugs and feature requests.
@@ -19,7 +19,6 @@ on:
# Contracts without the .performance suffix. Keep in sync with config/vitest.performance.config.ts;
# without these a rename lands green and only breaks the next nightly.
- 'src/main/runtime/session-tabs/session-tabs-phone-layout-moves.test.ts'
- 'src/renderer/src/components/terminal-pane/pty-connection/startup/saved-resume-cancellation.test.ts'
- 'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts'
- 'src/shared/agent-launch/permissions/tui-agent-permission-choice.test.ts'
- 'src/main/runtime/rpc/methods/projects/repo.test.ts'
@@ -33,7 +32,6 @@ on:
- 'src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-queue-retention.test.ts'
- 'src/main/claude-usage/scanner-incremental-append.test.ts'
- 'src/main/claude-usage/store-checkpoint-persistence.test.ts'
- 'src/renderer/src/components/native-chat/surfaces/integration/NativeChatResolvedView.streaming-input.test.tsx'
permissions:
contents: read
+1
View File
@@ -99,6 +99,7 @@ docs/**
!docs/bug-reproductions/
!docs/bug-reproductions/**
!docs/STYLEGUIDE.md
!docs/development.md
!docs/styleguide/
!docs/styleguide/**
!docs/agents-md-refs/
+2
View File
@@ -272,6 +272,8 @@ _Or via a package manager:_
brew install --cask stablyai/orca/orca
# Upgrade an existing install
brew upgrade --cask stablyai/orca/orca
# Release candidates (conflicts with the stable cask; uninstall it first)
brew install --cask stablyai/orca/orca@rc
# Arch Linux (AUR) — or stably-orca-git to build from source
yay -S stably-orca-bin
+1 -2
View File
@@ -264,7 +264,6 @@
4 test-no-real-time-wait:src/renderer/src/components/activity/activity-auto-mark-read-loop.react185.test.tsx
1 test-no-real-time-wait:src/renderer/src/components/editor/DiagramViewerModal.test.tsx
1 test-no-real-time-wait:src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-stale-analysis-work-budget.test.tsx
1 test-no-real-time-wait:src/renderer/src/components/native-chat/drafts/native-chat-composer-draft-lifecycle.test.tsx
4 test-no-real-time-wait:src/renderer/src/components/native-chat/drafts/native-chat-composer-draft-store.test.ts
1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/layout/split/resolve-split-cwd.test.ts
2 test-no-real-time-wait:src/renderer/src/components/terminal-pane/pty-connection/emulation/fish-color-scheme-child-stdin.node-pty.test.ts
@@ -634,7 +633,7 @@
2 test-no-wall-clock:src/renderer/src/components/dashboard/useLiveDashboardSnapshot.test.ts
1 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx
1 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx
3 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx
2 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx
3 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatResolvedView.turn-status.test.tsx
1 test-no-wall-clock:src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx
3 test-no-wall-clock:src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx
+2 -1
View File
@@ -3,9 +3,10 @@
# This is a RATCHET: counts may only go DOWN. Layout moves to one runtime owner; do not add
# writers. Prune after removing writers: pnpm check:layout-writer-ratchets --prune
1 src/main/ipc/pty/ipc/leaf-move.ts
1 src/main/ipc/pty/pane/fresh-pane-binding.ts
1 src/main/ipc/pty/pane/pane-owner-replacement.ts
3 src/main/ipc/pty/pane/stable-owner.ts
2 src/main/ipc/pty/spawn-commit-binding.ts
1 src/main/ipc/pty/spawn-commit-binding.ts
1 src/main/ipc/renderer-shutdown-checkpoint.ts
1 src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.ts
1 src/main/ipc/runtime-environments/runtime-environment-session-reconcile.ts
+1
View File
@@ -282,6 +282,7 @@
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-supervisor-subscribe.ts
1 src/main/ipc/filesystem/watcher-process/rebinding-file-watch.ts
1 src/main/ipc/filesystem/watcher-process/watcher-event-root-path-rewrite.ts
1 src/main/ipc/floating-workspace-directory.ts
1 src/main/ipc/macos-keyboard-layout-snapshot.ts
1 src/main/ipc/notification-authorization-status.ts
1 src/main/ipc/pty/spawn-pane-env.ts
@@ -307,6 +307,27 @@
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/terminal/session/MobileSessionLatchKeys.tsx",
"kind": "object-property:label",
"text": "Shift",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/terminal/session/MobileSessionLatchKeys.tsx",
"kind": "object-property:label",
"text": "Ctrl",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/terminal/session/MobileSessionLatchKeys.tsx",
"kind": "object-property:label",
"text": "Alt",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/tasks/mobile-smart-source-modes.ts",
"kind": "object-property:label",
@@ -14,7 +14,7 @@
"import/export": "warn",
"import/named": "warn",
"import/namespace": "warn",
"import/no-cycle": ["warn", { "maxDepth": 3 }],
"import/no-cycle": ["warn", { "ignoreTypes": true }],
"import/no-duplicates": "warn",
"import/no-empty-named-blocks": "warn",
"import/no-self-import": "warn"
File diff suppressed because one or more lines are too long
@@ -24,6 +24,13 @@ import {
routePathnameFromKey
} from '../../mobile-web-app/mobile-web-app-route-manifest.mjs'
import { MOBILE_WEB_PAGE_ROUTES } from './mobile-web-page-routes.mjs'
import {
ROUTE_ENTRY_NAMESPACE,
entryStaticClosure,
isScriptOutput,
lazyModulesToAnchor,
sharedModulesToMerge
} from './mobile-web-app-chunk-grouping.mjs'
const projectDir = fileURLToPath(new URL('../../../..', import.meta.url))
const mobileDir = join(projectDir, 'mobile')
@@ -134,7 +141,7 @@ const HAIRLINE_PLUGIN_NAME = 'orca-hairline-device-pixel'
const ENTRY_CHUNK_NAME = 'entry'
const ROUTE_MANIFEST_MODULE = /web-entry[\\/]route-manifest(\.ts)?$/
const ROUTE_ENTRY_NAMESPACE = 'orca-route-entry'
const LAZY_ENTRY_NAMESPACE = 'orca-lazy-entry'
// The entry's static imports as written, minus the manifest: a route importing it would be an output cycle.
async function entryImportAnchors() {
@@ -160,8 +167,14 @@ const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
// Keep typed route-manifest file for TS/Metro resolution; replace only its body for web.
// Routes import the entry's imports first, so esbuild keeps those modules in one chunk instead of one per route subset.
// Routes also import every module in sharedModules, which esbuild then puts in one chunk all routes load.
function routeManifestPlugin(manifestSource, routes, sharedModules) {
// Lazy modules in anchoredLazyModules (path to export names) get the same imports, so they don't split those chunks either.
function routeManifestPlugin(manifestSource, routes, sharedModules, anchoredLazyModules) {
let anchors
const anchoredImports = async () => {
anchors ??= entryImportAnchors()
const shared = sharedModules.map((module) => `import ${JSON.stringify(module)}\n`).join('')
return `${await anchors}${shared}`
}
return {
name: ROUTE_MANIFEST_PLUGIN_NAME,
setup(build) {
@@ -170,26 +183,43 @@ function routeManifestPlugin(manifestSource, routes, sharedModules) {
loader: 'js',
resolveDir: mobileDir
}))
if (routes.length === 0) {
return
}
const routeImport = new RegExp(
`^(?:${routes.map(({ module }) => escapeRegExp(module)).join('|')})$`
)
build.onResolve({ filter: routeImport }, (args) =>
args.kind === 'dynamic-import'
? { path: args.path, namespace: ROUTE_ENTRY_NAMESPACE }
: undefined
)
build.onLoad({ filter: /.*/, namespace: ROUTE_ENTRY_NAMESPACE }, async (args) => {
anchors ??= entryImportAnchors()
const shared = sharedModules.map((module) => `import ${JSON.stringify(module)}\n`).join('')
return {
contents: `${await anchors}${shared}export { default } from ${JSON.stringify(args.path)}\n`,
if (routes.length > 0) {
const routeImport = new RegExp(
`^(?:${routes.map(({ module }) => escapeRegExp(module)).join('|')})$`
)
build.onResolve({ filter: routeImport }, (args) =>
args.kind === 'dynamic-import'
? { path: args.path, namespace: ROUTE_ENTRY_NAMESPACE }
: undefined
)
build.onLoad({ filter: /.*/, namespace: ROUTE_ENTRY_NAMESPACE }, async (args) => ({
contents: `${await anchoredImports()}export { default } from ${JSON.stringify(args.path)}\n`,
loader: 'js',
resolveDir: dirname(entryPoint)
}))
}
if (anchoredLazyModules.size === 0) {
return
}
build.onResolve({ filter: /.*/ }, async (args) => {
if (args.kind !== 'dynamic-import' || args.pluginData === LAZY_ENTRY_NAMESPACE) {
return undefined
}
const { path, errors } = await build.resolve(args.path, {
kind: args.kind,
importer: args.importer,
resolveDir: args.resolveDir,
pluginData: LAZY_ENTRY_NAMESPACE
})
return errors.length === 0 && anchoredLazyModules.has(path)
? { path, namespace: LAZY_ENTRY_NAMESPACE }
: undefined
})
build.onLoad({ filter: /.*/, namespace: LAZY_ENTRY_NAMESPACE }, async (args) => ({
contents: `${await anchoredImports()}export { ${anchoredLazyModules.get(args.path).join(', ')} } from ${JSON.stringify(args.path)}\n`,
loader: 'js',
resolveDir: dirname(entryPoint)
}))
}
}
}
@@ -234,7 +264,11 @@ const hairlineDevicePixelPlugin = {
}
/** Split out so a test can read the options MOBILE_WEB_APP_SHIMS claims, without a build. */
export function mobileWebAppBuildOptions(routes, sharedModules = []) {
export function mobileWebAppBuildOptions(
routes,
sharedModules = [],
anchoredLazyModules = new Map()
) {
return {
// Fixed so no absolute path of this checkout can reach the output.
absWorkingDir: mobileDir,
@@ -267,7 +301,12 @@ export function mobileWebAppBuildOptions(routes, sharedModules = []) {
zod: MOBILE_ZOD_PACKAGE
},
plugins: [
routeManifestPlugin(renderMobileWebAppRouteManifest(routes), routes, sharedModules),
routeManifestPlugin(
renderMobileWebAppRouteManifest(routes),
routes,
sharedModules,
anchoredLazyModules
),
lucideBarrelPlugin,
hairlineDevicePixelPlugin
],
@@ -311,66 +350,6 @@ export function mobileWebAppBuildOptions(routes, sharedModules = []) {
}
}
// Budget entry plus transitive static imports, stopping at dynamic imports; entry-only limits let shared initial chunks grow unseen.
export function entryStaticClosure(metafile, entryOutputPath) {
const reached = new Set([entryOutputPath])
for (const current of reached) {
for (const imported of metafile.outputs[current]?.imports ?? []) {
if (imported.kind !== 'import-statement' || reached.has(imported.path)) {
continue
}
reached.add(imported.path)
}
}
return reached
}
// esbuild cuts a chunk per set of routes sharing a module; one this small costs more as a request than as code every route loads.
const MERGED_SHARED_CHUNK_MAX_BYTES = 16 * 1024
// Small route-shared chunks whose static imports already load at boot or merge too, so merging adds only their own bytes.
// ESM only: a bare import runs a CommonJS module's body at route load, not where its importer first needs it.
function sharedModulesToMerge(metafile, entryOutputPath) {
const { inputs, outputs } = metafile
const boot = entryStaticClosure(metafile, entryOutputPath)
const routeReached = new Set(
Object.entries(outputs)
.filter(([, output]) => output.entryPoint?.startsWith(`${ROUTE_ENTRY_NAMESPACE}:`))
.flatMap(([path]) => [...entryStaticClosure(metafile, path)])
)
const merged = new Set(
Object.entries(outputs)
.filter(
([path, output]) =>
isScriptOutput(path) &&
!output.entryPoint &&
!boot.has(path) &&
routeReached.has(path) &&
output.bytes <= MERGED_SHARED_CHUNK_MAX_BYTES &&
Object.keys(output.inputs).every((input) => inputs[input]?.format === 'esm')
)
.map(([path]) => path)
)
const importsUnmerged = (path) =>
outputs[path].imports.some(
({ kind, path: imported }) =>
kind === 'import-statement' && !boot.has(imported) && !merged.has(imported)
)
for (let dropped = true; dropped;) {
dropped = false
for (const path of merged) {
if (importsUnmerged(path)) {
merged.delete(path)
dropped = true
}
}
}
return [...merged]
.flatMap((path) => Object.keys(outputs[path].inputs))
.sort()
.map((input) => resolve(mobileDir, input))
}
// Hash final output bytes leaf-first, rewriting dependency names before hashing importers.
// esbuild hashes checkout-dependent input paths; renaming makes manifest hashes/import URLs agree and avoids redownloading identical bundles across checkouts.
export function renameOutputsByContent(metafile, outputFiles) {
@@ -438,8 +417,6 @@ export function routeChunkNames(metafile, routes, renamed) {
)
}
const isScriptOutput = (path) => path.endsWith('.js')
// appDir is a seam for the tests, which bundle a scratch route tree; production always uses mobile/app.
// Page closure includes ancestor layouts as entry modules, not just route imports.
export async function mobileWebAppRouteClosure(routeModule) {
@@ -532,10 +509,12 @@ function entryOutput(metafile) {
// The page's scripts as shipped: a first build finds the small shared chunks, a second merges them.
export async function buildMobileWebAppScripts(routes) {
const split = await esbuild.build(mobileWebAppBuildOptions(routes))
const sharedModules = sharedModulesToMerge(split.metafile, entryOutput(split.metafile))
return sharedModules.length === 0
const entryOutputPath = entryOutput(split.metafile)
const sharedModules = sharedModulesToMerge(split.metafile, entryOutputPath)
const anchoredLazyModules = lazyModulesToAnchor(split.metafile, entryOutputPath)
return sharedModules.length === 0 && anchoredLazyModules.size === 0
? split
: esbuild.build(mobileWebAppBuildOptions(routes, sharedModules))
: esbuild.build(mobileWebAppBuildOptions(routes, sharedModules, anchoredLazyModules))
}
export async function bundleMobileWebApp({ appDir = defaultAppDir } = {}) {
@@ -599,7 +578,9 @@ export function resolveMobileWebPageRoutes(routeKeys, declared = MOBILE_WEB_PAGE
export async function buildMobileWebAppBundle({
appDir,
outDir = defaultOutDir,
pageRoutes = MOBILE_WEB_PAGE_ROUTES
pageRoutes = MOBILE_WEB_PAGE_ROUTES,
// Only the shipped tree pays for brotli-11; tests and verify's scratch builds read raw assets.
brotli = false
} = {}) {
const [
desktopVersion,
@@ -645,7 +626,8 @@ export async function buildMobileWebAppBundle({
written: [indexAsset, ...written],
desktopVersion,
protocolWindow,
routes: resolveMobileWebPageRoutes(routeKeys, pageRoutes)
routes: resolveMobileWebPageRoutes(routeKeys, pageRoutes),
brotli
})
return {
manifest,
@@ -670,7 +652,7 @@ if (isDirectInvocation(import.meta.url, process.argv[1])) {
}
try {
const { manifest, outDir, routeKeys, entryStaticBytes, chunkCount } =
await buildMobileWebAppBundle()
await buildMobileWebAppBundle({ brotli: true })
console.log(
`[build-mobile-web-app-bundle] OK — ${String(routeKeys.length)} route(s), ` +
`${String(chunkCount)} chunk(s), ${String(entryStaticBytes)} bytes before the first route, ` +
@@ -0,0 +1,102 @@
import { realpathSync } from 'node:fs'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const mobileDir = fileURLToPath(new URL('../../../../mobile', import.meta.url))
export const ROUTE_ENTRY_NAMESPACE = 'orca-route-entry'
export const isScriptOutput = (path) => path.endsWith('.js')
// Budget entry plus transitive static imports, stopping at dynamic imports; entry-only limits let shared initial chunks grow unseen.
export function entryStaticClosure(metafile, entryOutputPath) {
const reached = new Set([entryOutputPath])
for (const current of reached) {
for (const imported of metafile.outputs[current]?.imports ?? []) {
if (imported.kind !== 'import-statement' || reached.has(imported.path)) {
continue
}
reached.add(imported.path)
}
}
return reached
}
// esbuild cuts a chunk per set of routes sharing a module; one this small costs more as a request than as code every route loads.
const MERGED_SHARED_CHUNK_MAX_BYTES = 16 * 1024
// Small route-shared chunks whose static imports already load at boot or merge too, so merging adds only their own bytes.
// ESM only: a bare import runs a CommonJS module's body at route load, not where its importer first needs it.
export function sharedModulesToMerge(metafile, entryOutputPath) {
const { inputs, outputs } = metafile
const boot = entryStaticClosure(metafile, entryOutputPath)
const routeReached = new Set(
Object.entries(outputs)
.filter(([, output]) => output.entryPoint?.startsWith(`${ROUTE_ENTRY_NAMESPACE}:`))
.flatMap(([path]) => [...entryStaticClosure(metafile, path)])
)
const merged = new Set(
Object.entries(outputs)
.filter(
([path, output]) =>
isScriptOutput(path) &&
!output.entryPoint &&
!boot.has(path) &&
routeReached.has(path) &&
output.bytes <= MERGED_SHARED_CHUNK_MAX_BYTES &&
Object.keys(output.inputs).every((input) => inputs[input]?.format === 'esm')
)
.map(([path]) => path)
)
const importsUnmerged = (path) =>
outputs[path].imports.some(
({ kind, path: imported }) =>
kind === 'import-statement' && !boot.has(imported) && !merged.has(imported)
)
for (let dropped = true; dropped;) {
dropped = false
for (const path of merged) {
if (importsUnmerged(path)) {
merged.delete(path)
dropped = true
}
}
}
return [...merged]
.flatMap((path) => Object.keys(outputs[path].inputs))
.sort()
.map((input) => resolve(mobileDir, input))
}
// A lazy module sharing boot code gives those modules a new importer set, so esbuild would split the boot chunks;
// anchor it like a route. Modules boot imports lazily (routes, catalogs) stay as they are: anchoring them is an output cycle.
// esbuild's runtime helper chunk has no inputs and every chunk imports it, so self-contained engines (mermaid) keep their bytes.
export function lazyModulesToAnchor(metafile, entryOutputPath) {
const { outputs } = metafile
const boot = entryStaticClosure(metafile, entryOutputPath)
const bootLoadsLazily = new Set(
[...boot].flatMap((path) =>
outputs[path].imports
.filter(({ kind }) => kind === 'dynamic-import')
.map(({ path: imported }) => imported)
)
)
const sharesBootModules = ({ imports }) =>
imports.some(
({ kind, path }) =>
kind === 'import-statement' &&
boot.has(path) &&
Object.keys(outputs[path].inputs).length > 0
)
return new Map(
Object.entries(outputs)
.filter(
([path, output]) =>
output.entryPoint &&
!boot.has(path) &&
!bootLoadsLazily.has(path) &&
sharesBootModules(output)
)
.map(([, output]) => [realpathSync(resolve(mobileDir, output.entryPoint)), output.exports])
)
}
@@ -15,7 +15,11 @@ const PIXEL_PNG = Buffer.from(
'base64'
)
export async function writeMobileWebBundleFixtureTree({ outDir, body = 'fixture' }) {
export async function writeMobileWebBundleFixtureTree({
outDir,
body = 'fixture',
brotli = false
}) {
const [desktopVersion, protocolWindow] = await Promise.all([
readDesktopVersion(),
readProtocolWindow()
@@ -49,6 +53,7 @@ export async function writeMobileWebBundleFixtureTree({ outDir, body = 'fixture'
image
],
desktopVersion,
protocolWindow
protocolWindow,
brotli
})
}
@@ -3,10 +3,13 @@ import { readFile, mkdir, rm, writeFile } from 'node:fs/promises'
import { createRequire } from 'node:module'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { promisify } from 'node:util'
import { brotliCompress, constants as zlibConstants } from 'node:zlib'
const { darkBuildMarkers } = createRequire(import.meta.url)('../../../dark-build-switches.cjs')
const projectDir = fileURLToPath(new URL('../../../..', import.meta.url))
const brotliCompressAsync = promisify(brotliCompress)
export const MOBILE_WEB_BUNDLE_SCHEMA_VERSION = 1
export const MOBILE_WEB_BUNDLE_ENTRYPOINT = 'index.html'
@@ -101,6 +104,31 @@ export async function readDesktopVersion() {
return packageJson.version
}
// Mirrors mobileWebBundleBrotliPath in src/shared/mobile-web-bundle/manifest-contract.ts.
export function mobileWebBundleBrotliPath(assetPath) {
return `${assetPath}.br`
}
// Largest first so the slowest file starts first on zlib's thread pool; keep only copies that shrink.
async function compressWithBrotli(written) {
const largestFirst = [...written].sort((left, right) => right.byteLength - left.byteLength)
const copies = await Promise.all(
largestFirst.map((asset) =>
brotliCompressAsync(asset.bytes, {
params: {
[zlibConstants.BROTLI_PARAM_QUALITY]: zlibConstants.BROTLI_MAX_QUALITY,
[zlibConstants.BROTLI_PARAM_SIZE_HINT]: asset.byteLength
}
})
)
)
return new Map(
largestFirst.flatMap((asset, index) =>
copies[index].byteLength < asset.byteLength ? [[asset.path, copies[index]]] : []
)
)
}
// Single manifest producer keeps builder/contract/packaging guard shape aligned.
export async function writeMobileWebBundleTree({
outDir,
@@ -109,10 +137,22 @@ export async function writeMobileWebBundleTree({
protocolWindow,
// Empty route list makes shell render every screen natively.
routes = [],
// Whole-file brotli copies for phones that inflate natively.
brotli = false,
env = process.env
}) {
const brotliCopies = brotli ? await compressWithBrotli(written) : new Map()
const assets = written
.map(({ path, sha256, byteLength, contentType }) => ({ path, sha256, byteLength, contentType }))
.map(({ path, sha256, byteLength, contentType }) => {
const copy = brotliCopies.get(path)
return {
path,
sha256,
byteLength,
contentType,
...(copy === undefined ? {} : { brotliByteLength: copy.byteLength })
}
})
.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0))
const manifest = {
schemaVersion: MOBILE_WEB_BUNDLE_SCHEMA_VERSION,
@@ -133,6 +173,9 @@ export async function writeMobileWebBundleTree({
for (const asset of written) {
await writeFile(join(outDir, asset.path), asset.bytes)
}
for (const [path, copy] of brotliCopies) {
await writeFile(join(outDir, mobileWebBundleBrotliPath(path)), copy)
}
await writeFile(join(outDir, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`, 'utf8')
// Keep switch metadata outside manifest so compiled page bytes/buildId remain unchanged.
for (const marker of darkBuildMarkers(env)) {
@@ -102,13 +102,14 @@ export const MOBILE_WEB_PAGE_ROUTES = [
'native.audio.read',
'native.audio.stop'
],
// Optional media.name falls back to the file type; terminalKeyRail falls back to the page's row; the image viewer drops its actions without native.image.act; dictation uses the computer without native.speech.act.
// Optional media.name falls back to the file type; terminalKeyRail falls back to the page's row; the image viewer drops its actions without native.image.act; dictation uses the computer without native.speech.act; without native.a11y.announce only the page's live region speaks.
optionalGrants: [
'externalNavigation',
'native.media.name',
'native.pdf.view',
'native.image.act',
'native.speech.act',
'native.a11y.announce',
'terminalKeyRail',
DEVICE_STORE_GRANT
]
@@ -4589,7 +4589,6 @@
"src/packages/process-host/src/run-process-windows-tree-kill.test.ts": 81,
"src/packages/process-host/src/run-process.test.ts": 9406,
"src/packages/process-host/src/spawn-observer.test.ts": 357,
"src/packages/process-host/src/spawn-process-stdio.test.ts": 311,
"src/packages/process-host/src/windows-command-line.test.ts": 73,
"src/packages/process-host/src/windows-tree-kill.test.ts": 81,
"src/packages/process-host/src/wsl-distro-allowlist.test.ts": 55,
@@ -5173,7 +5172,6 @@
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx": 4252,
"src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx": 4070,
"src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.turn-membership.test.tsx": 3527,
"src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-status.test.tsx": 3370,
"src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx": 3069,
"src/renderer/src/components/native-chat/viewport/scroll/NativeChatMessageList.visual-scroll.test.tsx": 6691,
"src/renderer/src/components/native-chat/viewport/virtualization/NativeChatMessageList.windowing.test.tsx": 20958,
@@ -5201,9 +5199,7 @@
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.host-outage.test.tsx": 3552,
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.notice-card.test.tsx": 2911,
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.refusal-notices.test.tsx": 3014,
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.retained-draft.test.tsx": 3736,
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.test.tsx": 4459,
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.wsl-host-stopped.test.tsx": 3657,
"src/renderer/src/components/native-chat/tools/tasks/NativeChatStructuredSessionStatus.test.tsx": 583,
"src/renderer/src/components/native-chat/tools/lines/NativeChatToolLine.test.tsx": 3544,
"src/renderer/src/components/native-chat/tools/lines/NativeChatToolOutput.test.tsx": 410,
@@ -5268,7 +5264,6 @@
"src/renderer/src/components/native-chat/queue/editing/native-chat-queued-edit-draft.test.ts": 649,
"src/renderer/src/components/native-chat/viewport/rail/native-chat-rail-outline-parity.test.ts": 497,
"src/renderer/src/components/native-chat/viewport/scroll/native-chat-reader-scroll-input.test.tsx": 311,
"src/renderer/src/components/native-chat/paste/native-chat-remote-image-paste.test.tsx": 1834,
"src/renderer/src/components/native-chat/attachments/uploads/native-chat-resolved-path-ownership.test.ts": 1749,
"src/renderer/src/components/native-chat/viewport/virtualization/native-chat-row-height-estimate.test.ts": 293,
"src/renderer/src/components/native-chat/drafts/native-chat-sent-prompt-history.test.ts": 217,
@@ -5278,7 +5273,6 @@
"src/renderer/src/components/native-chat/pane/routing/native-chat-split-flow.test.ts": 1916,
"src/renderer/src/components/native-chat/composer/submit/native-chat-structured-send-composition-clear.test.tsx": 2098,
"src/renderer/src/components/native-chat/subagents/native-chat-subagent-handoff-copy-budget.test.ts": 362,
"src/renderer/src/components/native-chat/subagents/native-chat-subagent-section-work-runs.test.ts": 278,
"src/renderer/src/components/native-chat/pane/routing/native-chat-tab-directory.test.ts": 304,
"src/renderer/src/components/native-chat/native-chat-task-list-state.test.ts": 62,
"src/renderer/src/components/native-chat/native-chat-thread-goal-rows.test.ts": 50,
@@ -5808,9 +5802,6 @@
"src/renderer/src/components/terminal-pane/layout/close/RunningTerminalCloseDialog.test.tsx": 2303,
"src/renderer/src/components/terminal-pane/session-fork/TerminalAgentSessionForkDialog.test.tsx": 266,
"src/renderer/src/components/terminal-pane/titles/TerminalPaneHeaderOverlay.test.tsx": 1104,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalPaneRecoveryPortals.test.tsx": 670,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/TerminalRemoteRuntimeReconnectBanner.test.tsx": 812,
"src/renderer/src/components/terminal-pane/pty-transport/recovery/ssh/TerminalSshReconnectOverlay.test.tsx": 2354,
"src/renderer/src/components/terminal-pane/account-restart/detached/account-restart-queue-progress.test.ts": 1988,
"src/renderer/src/components/terminal-pane/agent-completion/agent-completion-coordinator-attention-dispatch.test.ts": 301,
"src/renderer/src/components/terminal-pane/agent-completion/agent-completion-coordinator-completion-replay-guard.test.ts": 318,
@@ -5884,7 +5875,6 @@
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-post-dispose-restore-termination.test.ts": 1215,
"src/renderer/src/components/terminal-pane/pty-connection/agent-identity/pty-connection-process-exit-row-retire.test.ts": 10626,
"src/renderer/src/components/terminal-pane/pty-connection/host-ownership/pty-connection-owner-hydration-backend-retention.test.ts": 4181,
"src/renderer/src/components/terminal-pane/pty-connection/startup/pty-connection-queued-startup-consume.test.ts": 4181,
"src/renderer/src/components/terminal-pane/pty-connection/reattach/pty-connection-reattach-binding.test.ts": 5240,
"src/renderer/src/components/terminal-pane/pty-connection/input/pty-connection-remote-new-terminal-typeahead.test.ts": 1864,
"src/renderer/src/components/terminal-pane/pty-connection/reattach/pty-connection-remote-snapshot-image-title.test.ts": 1754,
@@ -5892,7 +5882,6 @@
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-restored-baseline-shortfall.test.ts": 1902,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-spawn-and-startup.test.ts": 19652,
"src/renderer/src/components/terminal-pane/pty-connection/spawn/pty-connection-spawn-deferred-sleep.test.ts": 6918,
"src/renderer/src/components/terminal-pane/pty-connection/startup/pty-connection-split-cwd-resolution.test.ts": 2139,
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-visibility-and-exit.test.ts": 18950,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/pty-connection-visible-pane-output-pause-latch.test.ts": 1639,
"src/renderer/src/components/terminal-pane/pty-connection/reattach/deferred-session-reattach-newer-daemon-hold.test.ts": 2570,
@@ -5901,12 +5890,10 @@
"src/shared/terminal/protocol/escape/terminal-synchronized-output-socket-splits.test.ts": 92,
"src/renderer/src/components/terminal-pane/pty-connection/output/foreground-renderer-risk-scan-tail.test.ts": 111,
"src/renderer/src/components/terminal-pane/pty-connection/spawn/hidden-agent-resume-deferral.test.ts": 55,
"src/renderer/src/components/terminal-pane/pty-connection/startup/in-place-resume-hold-wiring.test.ts": 2484,
"src/renderer/src/components/terminal-pane/pty-connection/startup/main-pane-resume-banner.test.ts": 59,
"src/renderer/src/components/terminal-pane/pty-connection/spawn/main-pane-start-wait.test.ts": 76,
"src/renderer/src/components/terminal-pane/pty-connection/serialization/pane-serializer-register.test.ts": 123,
"src/renderer/src/components/terminal-pane/pty-connection/host-ownership/pty-kitty-file-reader.test.ts": 297,
"src/renderer/src/components/terminal-pane/pty-connection/startup/saved-resume-cancellation.test.ts": 1882,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/snapshot-covered-terminal-queries.test.ts": 150,
"src/renderer/src/components/terminal-pane/pty-connection/output/terminal-input-echo-delay.test.ts": 132,
"src/renderer/src/components/terminal-pane/pty-connection/host-ownership/unserved-ssh-pane-bridge.test.ts": 70,
@@ -5934,7 +5921,6 @@
"src/renderer/src/components/terminal-pane/pty-transport/ipc/pty-transport-pi-coalesce.test.ts": 683,
"src/renderer/src/components/terminal-pane/pty-transport/ipc/pty-transport-reattach-admission.test.ts": 1636,
"src/renderer/src/components/terminal-pane/pty-transport/ipc/pty-transport-recycled-pty-incarnation.test.ts": 787,
"src/renderer/src/components/terminal-pane/pty-transport/ipc/pty-transport-spawn-errors.test.ts": 1218,
"src/renderer/src/components/terminal-pane/input/focus/regular-terminal-focus-ownership.test.ts": 208,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/remote-hidden-output-restore-outcomes.test.ts": 2794,
"src/renderer/src/components/terminal-pane/pty-connection/output-restore/remote-hidden-output-restore-unavailable-banner.repro.test.ts": 2355,
@@ -6001,7 +5987,6 @@
"src/renderer/src/components/terminal-pane/emulation/terminal-capability-replies.test.ts": 131,
"src/renderer/src/components/terminal-pane/clipboard/terminal-clipboard-paste.test.ts": 76,
"src/renderer/src/components/terminal-pane/parking/retention/terminal-cold-park-timer-rearm.test.tsx": 701,
"src/renderer/src/components/terminal-pane/pty-transport/delivery/terminal-delivery-watchdog.test.ts": 111,
"src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-handler.test.ts": 638,
"src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-image-path.test.ts": 61,
"src/renderer/src/components/terminal-pane/input/file-drop/terminal-drop-internal-handler.test.ts": 800,
@@ -6274,8 +6259,8 @@
"src/renderer/src/hooks/useMacTccAttributionSeveredNotice.test.tsx": 2358,
"src/renderer/src/hooks/useMetadataListRequest.test.tsx": 266,
"src/renderer/src/hooks/useModalReturnFocus.test.tsx": 1938,
"src/renderer/src/hooks/usePrimarySelectionPaste.terminal-native-paste.test.tsx": 388,
"src/renderer/src/hooks/usePrimarySelectionPaste.test.tsx": 411,
"src/renderer/src/hooks/clipboard/primary-selection/usePrimarySelectionPaste.terminal-native-paste.test.tsx": 388,
"src/renderer/src/hooks/clipboard/primary-selection/usePrimarySelectionPaste.test.tsx": 411,
"src/renderer/src/hooks/useReadOnScreenAttention.away.test.ts": 2420,
"src/renderer/src/hooks/useReadOnScreenAttention.clock-skew.test.ts": 2093,
"src/renderer/src/hooks/useReadOnScreenAttention.floating-panel.test.ts": 2157,
@@ -6349,9 +6334,9 @@
"src/renderer/src/lib/agent-session/resume/history/ai-vault-session-resume-preparation.test.ts": 408,
"src/renderer/src/lib/agent-session/history/title-sync/ai-vault-tab-title-sync-inputs.test.ts": 476,
"src/renderer/src/lib/agent-session/history/title-sync/ai-vault-tab-title-sync.test.ts": 925,
"src/renderer/src/lib/app-command-dispatch.test.ts": 64,
"src/renderer/src/lib/app-keyboard-router.test.ts": 187,
"src/renderer/src/lib/app-menu-paste.test.ts": 229,
"src/renderer/src/lib/app-commands/app-command-dispatch.test.ts": 64,
"src/renderer/src/lib/keyboard/app-keyboard-router.test.ts": 187,
"src/renderer/src/lib/clipboard/menu/app-menu-paste.test.ts": 229,
"src/renderer/src/lib/automation-session-reuse.test.ts": 70,
"src/renderer/src/lib/automation-terminal-ownership.test.ts": 1795,
"src/renderer/src/lib/bounded-generation-map.test.ts": 35,
@@ -6367,7 +6352,7 @@
"src/renderer/src/lib/source-control/checks/check-run-details-log-normalization.test.ts": 75,
"src/renderer/src/lib/claude-account-switch-sessions.test.ts": 782,
"src/renderer/src/lib/claude-session-account-move.test.ts": 1816,
"src/renderer/src/lib/clipboard-image-copy.test.ts": 243,
"src/renderer/src/lib/clipboard/images/clipboard-image-copy.test.ts": 243,
"src/renderer/src/lib/cmd-j-host-qualified-candidate-ownership.test.ts": 526,
"src/renderer/src/lib/cmd-j-linear-issue-intent.test.ts": 42,
"src/renderer/src/lib/code-host-error-copy.test.ts": 297,
@@ -6410,11 +6395,10 @@
"src/renderer/src/lib/host-mirrored-pane-resume-replay.test.ts": 1814,
"src/renderer/src/lib/browser/navigation/http-link-completion.test.ts": 1760,
"src/renderer/src/lib/browser/navigation/http-link-routing-store.test.ts": 2211,
"src/renderer/src/lib/image-blob-png.test.ts": 253,
"src/renderer/src/lib/ime-composition-keyboard-event.test.ts": 274,
"src/renderer/src/lib/ime-text-field.test.tsx": 739,
"src/renderer/src/lib/text-input/ime/ime-composition-keyboard-event.test.ts": 274,
"src/renderer/src/lib/text-input/ime/ime-text-field.test.tsx": 739,
"src/renderer/src/lib/keyboard-layout/layout-base-character.test.ts": 48,
"src/renderer/src/lib/large-text-control-paste.test.ts": 220,
"src/renderer/src/lib/text-input/paste/large-text-control-paste.test.ts": 220,
"src/renderer/src/lib/agent-session/launch/background/launch-agent-background-session-launch-parity.test.ts": 2792,
"src/renderer/src/lib/agent-session/launch/background/launch-agent-background-session.test.ts": 1040,
"src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-main-surface.test.ts": 1821,
@@ -6519,7 +6503,7 @@
"src/renderer/src/lib/pane-manager/xterm-write-callback-guard.test.ts": 53,
"src/renderer/src/lib/pane-spawn-deferral-drain.test.ts": 61,
"src/renderer/src/lib/parked-terminal-host-hydration.test.ts": 274,
"src/renderer/src/lib/paste-payload-metadata.test.ts": 53,
"src/renderer/src/lib/text-input/paste/paste-payload-metadata.test.ts": 53,
"src/renderer/src/lib/path-head-elision.test.ts": 53,
"src/renderer/src/lib/path.test.ts": 55,
"src/renderer/src/lib/plugin-command-keybindings.test.ts": 1909,
@@ -6588,8 +6572,8 @@
"src/renderer/src/lib/task-provider-error-copy.test.ts": 363,
"src/renderer/src/lib/terminal-app-theme.test.ts": 301,
"src/renderer/src/lib/terminal-input-activity-coalescing.test.ts": 43,
"src/renderer/src/lib/text-control-paste-ownership.test.ts": 217,
"src/renderer/src/lib/text-control-paste.test.ts": 222,
"src/renderer/src/lib/text-input/paste/text-control-paste-ownership.test.ts": 217,
"src/renderer/src/lib/text-input/paste/text-control-paste.test.ts": 222,
"src/renderer/src/lib/text-generation-error-copy.test.ts": 466,
"src/renderer/src/lib/typing-latency/echo-instrumentation.test.ts": 145,
"src/renderer/src/lib/typing-latency/renderer-long-tasks.test.ts": 75,
@@ -1,6 +1,7 @@
const { createHash } = require('node:crypto')
const { readFileSync, readdirSync, statSync } = require('node:fs')
const { join, resolve } = require('node:path')
const { brotliDecompressSync } = require('node:zlib')
const { darkBuildMarkerFileNames } = require('../../../dark-build-switches.cjs')
@@ -98,6 +99,12 @@ function parseManifest(bundleDir) {
if (typeof asset.contentType !== 'string' || asset.contentType.length === 0) {
throw failure(`manifest asset ${asset.path} has no contentType`)
}
if (asset.brotliByteLength !== undefined) {
assertInteger(asset.brotliByteLength, `assets[${asset.path}].brotliByteLength`)
if (asset.brotliByteLength >= asset.byteLength) {
throw failure(`manifest asset ${asset.path} declares a brotli copy no smaller than itself`)
}
}
}
if (!manifest.assets.some((asset) => asset.path === manifest.entrypoint)) {
throw failure(`manifest entrypoint ${manifest.entrypoint} is not one of its assets`)
@@ -132,13 +139,33 @@ function listBundleFiles(directory, prefix = '') {
return found
}
// Mirrors mobileWebBundleBrotliPath in src/shared/mobile-web-bundle/manifest-contract.ts.
function brotliPath(asset) {
return `${asset.path}.br`
}
function brotliCopies(manifest) {
return manifest.assets.filter((asset) => asset.brotliByteLength !== undefined)
}
function statSize(bundleDir, path) {
try {
return statSync(join(bundleDir, path)).size
} catch (error) {
throw failure(
`manifest lists ${path}, which is missing from ${bundleDir} (${error.code ?? error.message}). ${REMEDY}`
)
}
}
// Reject unlisted on-disk assets: content-addressed stale files survive interrupted builds and would ship unreachable/unverified in asar.
function assertNoUnlistedFiles(bundleDir, manifest) {
// A dark build's marker is accounted for here; packaging refuses it through assertNotDarkBuild.
const listed = new Set([
'manifest.json',
...darkBuildMarkerFileNames(),
...manifest.assets.map((asset) => asset.path)
...manifest.assets.map((asset) => asset.path),
...brotliCopies(manifest).map((asset) => brotliPath(asset))
])
const strays = listBundleFiles(bundleDir).filter((path) => !listed.has(path))
if (strays.length > 0) {
@@ -155,14 +182,7 @@ function assertMobileWebBundleBuilt(bundleDir = MOBILE_WEB_BUNDLE_DIR) {
assertNoUnlistedFiles(bundleDir, manifest)
for (const asset of manifest.assets) {
const assetPath = join(bundleDir, asset.path)
let size
try {
size = statSync(assetPath).size
} catch (error) {
throw failure(
`manifest lists ${asset.path}, which is missing from ${bundleDir} (${error.code ?? error.message}). ${REMEDY}`
)
}
const size = statSize(bundleDir, asset.path)
if (size !== asset.byteLength) {
throw failure(
`${asset.path} is ${String(size)} bytes on disk, manifest says ${String(asset.byteLength)}. ${REMEDY}`
@@ -175,6 +195,20 @@ function assertMobileWebBundleBuilt(bundleDir = MOBILE_WEB_BUNDLE_DIR) {
)
}
}
// Phones verify only the inflated bytes, so a copy that inflates to anything else fails every download.
for (const asset of brotliCopies(manifest)) {
const path = brotliPath(asset)
const size = statSize(bundleDir, path)
if (size !== asset.brotliByteLength) {
throw failure(
`${path} is ${String(size)} bytes on disk, manifest says ${String(asset.brotliByteLength)}. ${REMEDY}`
)
}
const inflated = brotliDecompressSync(readFileSync(join(bundleDir, path)))
if (createHash('sha256').update(inflated).digest('hex') !== asset.sha256) {
throw failure(`${path} does not inflate to ${asset.path}. ${REMEDY}`)
}
}
console.log(
`[verify-packaged-mobile-web-bundle] OK — buildId ${manifest.buildId}, ` +
`${String(manifest.assets.length)} asset(s), ${String(manifest.totalBytes)} bytes`
@@ -2,6 +2,7 @@ import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { createRequire } from 'node:module'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { brotliCompressSync } from 'node:zlib'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { writeMobileWebBundleFixtureTree } from '../../build/mobile-web-app/mobile-web-bundle-fixture-tree.mjs'
@@ -10,11 +11,11 @@ const { assertMobileWebBundleBuilt } = require('./verify-packaged-mobile-web-bun
const electronBuilderConfig = require('../../../electron-builder.config.cjs')
const { darkBuildMarkers } = require('../../../dark-build-switches.cjs')
async function withBundle(run) {
async function withBundle(run, { brotli = false } = {}) {
const scratch = await mkdtemp(join(tmpdir(), 'orca-mobile-web-guard-'))
const bundleDir = join(scratch, 'mobile-web')
try {
const { manifest } = await writeMobileWebBundleFixtureTree({ outDir: bundleDir })
const { manifest } = await writeMobileWebBundleFixtureTree({ outDir: bundleDir, brotli })
await run({ bundleDir, manifest })
} finally {
await rm(scratch, { recursive: true, force: true })
@@ -65,6 +66,25 @@ describe('assertMobileWebBundleBuilt', () => {
})
})
it('accepts the brotli copies the manifest lists, and fails one that inflates to other bytes', async () => {
await withBundle(
async ({ bundleDir, manifest }) => {
const asset = manifest.assets.find((entry) => entry.brotliByteLength !== undefined)
expect(() => assertMobileWebBundleBuilt(bundleDir)).not.toThrow()
const forged = brotliCompressSync(Buffer.from('not the asset'))
await writeFile(join(bundleDir, `${asset.path}.br`), forged)
await rewriteManifest(bundleDir, (rewritten) => {
rewritten.assets.find((entry) => entry.path === asset.path).brotliByteLength =
forged.byteLength
})
expect(() => assertMobileWebBundleBuilt(bundleDir)).toThrow(
`${asset.path}.br does not inflate to ${asset.path}`
)
},
{ brotli: true }
)
})
it('refuses an asset path that escapes the bundle directory', async () => {
await withBundle(async ({ bundleDir }) => {
await rewriteManifest(bundleDir, (manifest) => {
+1 -3
View File
@@ -6,7 +6,6 @@ import { nodeRuntimePool } from './scripts/test-runtime/node-worker/vitest-node-
const contracts = [
'src/main/runtime/session-tabs/session-tabs-phone-layout-moves.test.ts',
'src/renderer/src/components/terminal-pane/pty-connection/startup/saved-resume-cancellation.test.ts',
'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts',
'src/shared/agent-launch/permissions/tui-agent-permission-choice.test.ts',
'src/main/runtime/rpc/methods/projects/repo.test.ts',
@@ -22,8 +21,7 @@ const contracts = [
'config/scripts/static-analysis/oxlint-contracts/app-store-performance-plugin.test.mjs',
'config/scripts/static-analysis/oxlint-contracts/quadratic-buffer-concat-plugin.test.mjs',
'src/main/claude-usage/scanner-incremental-append.test.ts',
'src/main/claude-usage/store-checkpoint-persistence.test.ts',
'src/renderer/src/components/native-chat/surfaces/integration/NativeChatResolvedView.streaming-input.test.tsx'
'src/main/claude-usage/store-checkpoint-persistence.test.ts'
]
for (const contract of contracts) {
if (!existsSync(resolve(contract))) {
+1 -1
View File
@@ -44,7 +44,7 @@ Tokens pair a **surface** with a **foreground** that meets contrast on it; alway
- Body letter-spacing is set globally on `body`; don't override per component.
- Use Tailwind's scale. Common: 14px body/default buttons, 13px sidebar items and dense rows, 12px sub-text and paths, 11px uppercase meta/captions.
- Use `text-2xs` (11px) and `text-3xs` (10px), not `text-[11px]` / `text-[10px]`.
- Category labels: 11px, `font-semibold`, `uppercase`, `tracking-wider` (0.05em).
- Category labels: 11px, `font-semibold`, `uppercase`, `tracking-wider` (0.05em). Settings content uses sentence case without tracking: 14px row labels, `text-settings-detail` (12.5px) help, and `text-settings-heading` (15px) semibold section headings. Settings form rows use about 9px vertical padding (44px minimum), selects are 28px, and the centered content column is at most 720px with at least 32px side gutters. These density rules are scoped to `.settings-view-shell`; shared primitives retain their defaults elsewhere.
- Native chat has its own lint-enforced scale and colours: see [native-chat.md](./styleguide/native-chat.md).
## Radius and elevation
+4 -4
View File
@@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="113" height="20" role="img" aria-label="downloads: 162m">
<title>downloads: 162m</title>
<svg xmlns="http://www.w3.org/2000/svg" width="113" height="20" role="img" aria-label="downloads: 163m">
<title>downloads: 163m</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
@@ -15,7 +15,7 @@
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
<text x="37" y="15" fill="#010101" fill-opacity=".3">downloads</text>
<text x="37" y="14">downloads</text>
<text x="93.5" y="15" fill="#010101" fill-opacity=".3">162m</text>
<text x="93.5" y="14">162m</text>
<text x="93.5" y="15" fill="#010101" fill-opacity=".3">163m</text>
<text x="93.5" y="14">163m</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 943 B

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 KiB

After

Width:  |  Height:  |  Size: 473 KiB

+57
View File
@@ -0,0 +1,57 @@
# Orca Development Environment
Setup details beyond [`CONTRIBUTING.md`](../.github/CONTRIBUTING.md).
## Prerequisites
Install Node 24, the pnpm version in `packageManager` in [`package.json`](../package.json), and the Bun version in [`config/.bun-version`](../config/.bun-version).
The server, its workers, and its packaged dependencies target Node 24. The compatibility launcher and CLI still target Node 18; the launcher hands off to bundled Node 24 before loading server code. WSL guest programs and host discovery retain their Node 18 minimum. Keep Node 24 APIs and server imports out of these host compatibility paths. Running an unpackaged server directly requires Node 24 or newer.
`corepack enable` needs Corepack 0.34.5 or newer (`npm install -g corepack@latest`). On Windows it fails with `EPERM` outside an elevated shell when Node is in `C:\Program Files\nodejs`; run `npm install -g pnpm@<that version>` instead.
`pnpm install` compiles native modules such as `node-pty`, so a fresh machine also needs:
- **macOS**: Xcode Command Line Tools (`xcode-select --install`).
- **Windows**: Python 3 and Visual Studio Build Tools with the "Desktop development with C++" workload.
- **Linux**: a C++ toolchain, Python 3, Electron's libraries, and `xvfb` (used by `*.electron.test.ts` when `DISPLAY` is unset). On Ubuntu 24.04+ and Debian 13+ (older releases name the last package `libasound2`):
```bash
sudo apt-get update && sudo apt-get install -y build-essential python3 xvfb libgtk-3-0 libnss3 libgbm1 libasound2t64
```
Re-run `pnpm -C mobile install --frozen-lockfile` whenever `mobile/pnpm-lock.yaml` changes.
## Dev Profiles and Parallel Instances
`pnpm dev` in a linked Git worktree uses its own profile, renderer port (from 15200), and CDP port (from 9333), so worktrees run side by side. The main checkout uses the shared `orca-dev` profile. The chosen profile and ports are printed on an `ORCA_DEV_INSTANCE` line and written to `out/dev-instance.json`.
| Option | Effect |
| ----------------------------------------------------------------------- | ---------------------------------------------------------- |
| `pnpm dev --shared-profile` or `ORCA_DEV_PROFILE=shared` | Use the shared `orca-dev` profile |
| `pnpm dev --worktree-profile` or `ORCA_DEV_PROFILE=worktree` | Use a per-worktree profile, including in the main checkout |
| `ORCA_DEV_USER_DATA_PATH=<dir>` | Use an explicit profile directory |
| `REMOTE_DEBUGGING_PORT=<port>`, `ORCA_DEV_RENDERER_PORT=<port>` | Pin a port |
| `pnpm dev --seed-profile[=<dir>]` or `ORCA_DEV_SEED_PROFILE=<dir or 1>` | Seed an empty profile on first launch |
After a worktree is removed and no process still uses its profile, a later `pnpm dev` can automatically delete that profile and its saved state. Back up any state you need before removing the worktree; the `userData` field in `ORCA_DEV_INSTANCE` or `out/dev-instance.json` gives the profile directory.
Seeding copies projects, workspaces, settings, SSH targets, and the Orca account session from another profile (default `orca-dev`, else the installed app's). Seed from `orca-dev` if you need to stay signed in: dev builds cannot decrypt secrets the installed app encrypted.
```bash
pnpm dev:seed-profile [--from=<profile dir>] [--to=<profile dir>] [--reset]
pnpm dev:fresh [--keep] [--seed-from[=<profile dir>]] # temporary profile, removed on exit
```
## Installs and Builds
- Local installs use pnpm's global virtual store (`~/pnpm/store`) shared by all worktrees. Do not keep a `node_modules` in your home directory: it hides missing-dependency bugs. Set `ORCA_PNPM_GLOBAL_VIRTUAL_STORE=0` in your shell to opt out.
- Before a cross-architecture build (including `pnpm build:mac`, which builds x64 and arm64), run `pnpm install:release`.
- On Linux, `pnpm build`, `pnpm build:native`, and packaging need a running Docker daemon for the clipboard helper. For native Wayland development, run `pnpm build:native` before `pnpm dev`. See the [clipboard build guide](../native/wayland-clipboard/README.md#building-and-testing).
## Troubleshooting
- Slow main-process rebuilds: set `ORCA_DEV_MAIN_SOURCEMAPS=0` before `pnpm dev` when you don't need main-process source maps.
- Renderer misbehaving in dev: set `ORCA_DEV_BUNDLED=0` to turn off bundled dev mode, and report it.
- Test passes alone but fails after others: add `// @orca-isolated-worker` to the file; `ORCA_VITEST_ISOLATE_EVERY_FILE=1` isolates every file to confirm a leak.
- Slow typechecks: where supported, `pnpm tc` keeps incremental caches in `.cache/typecheck/`; delete it to force a fresh check.
+1 -1
View File
@@ -27,4 +27,4 @@ The chat root (`.native-chat-appearance`) redefines these steps as ratios of the
- **Focus rings:** full-width transcript rows use the inset ring (`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`) so it isn't clipped by the scroll container; standalone controls use `focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`. Inside the chat `--ring` is `--chat-focus-ring`, which clears 3:1 on the canvas; don't lower its opacity.
- **Theme overrides:** plugin themes can set `--chat-bold-foreground`, `--chat-muted-foreground`, `--chat-inline-code`, `--chat-inline-code-foreground`, `--chat-code-block`, `--chat-selection` and `--chat-selection-foreground`. They feed `text-chat-foreground-faint`, `bg-chat-inline-code-surface`, `bg-chat-code-surface` and the chat root's `::selection`, so use those rather than reading the theme tokens directly.
- **Selection** inside the chat is the link hue mixed into the canvas (close to the system highlight), with selected text in the full foreground so every role stays 4.5:1. Don't add per-component `selection:` colors in transcript text.
- **State colours:** warnings use `text-chat-warning`; diff lines use `text-chat-diff-added` / `text-chat-diff-removed`. They are mixed toward the foreground so they pass text contrast in light and dark. Don't use raw palette colours (`text-yellow-500`) or the git decoration tokens for text on a tinted row.
- **State colours:** warnings use `text-chat-warning`; diff lines use `text-chat-diff-added` / `text-chat-diff-removed`; what the reader has not seen yet uses `text-chat-unread`. They are mixed toward the foreground so they pass text contrast in light and dark. Don't use raw palette colours (`text-yellow-500`) or the git decoration tokens for text on a tinted row.
+1
View File
@@ -114,6 +114,7 @@
"./plugins/android-window-density.js",
"./plugins/android-release-signing.js",
"./plugins/android-navigation-bar-theme.js",
"./plugins/android-device-transfer-rules.js",
"./plugins/ios-pod-deployment-target-floor.js",
"./plugins/ios-scene-lifecycle.js",
"./plugins/ios-bundle-phase-quoted-script-path.js",
@@ -15,6 +15,8 @@ android {
}
dependencies {
// Android ships no brotli decoder; Google's pure-Java one, as okhttp-brotli uses.
implementation 'org.brotli:dec:0.1.2'
testImplementation 'junit:junit:4.13.2'
// The android.jar used by JVM unit tests stubs org.json; the shared vectors are JSON.
testImplementation 'org.json:json:20240303'
@@ -0,0 +1,31 @@
package expo.modules.orcagziputf8codec
import java.io.ByteArrayInputStream
import java.io.IOException
import org.brotli.dec.BrotliInputStream
class BoundedBrotliException(message: String) : Exception(message)
/** Inflate one brotli stream into at most outputLimit bytes; callers pass one byte beyond the length they
* accept and check the result's length and hash, so truncated or overlong input fails there. */
fun brotliDecompressBounded(input: ByteArray, outputLimit: Int): ByteArray {
if (outputLimit <= 0 || input.isEmpty()) {
throw BoundedBrotliException("nothing to inflate")
}
val output = ByteArray(outputLimit)
var produced = 0
try {
BrotliInputStream(ByteArrayInputStream(input)).use { stream ->
while (produced < outputLimit) {
val count = stream.read(output, produced, outputLimit - produced)
if (count < 0) {
break
}
produced += count
}
}
} catch (error: IOException) {
throw BoundedBrotliException(error.message ?: "invalid brotli data")
}
return if (produced == outputLimit) output else output.copyOf(produced)
}
@@ -15,5 +15,10 @@ class OrcaGzipUtf8CodecModule : Module() {
Function("decodeUtf8") { input: ByteArray ->
decodeStrictUtf8(input)
}
// Async: a whole bundle asset can take tens of ms, too long to hold the JS thread.
AsyncFunction("brotliDecompress") { input: ByteArray, outputLimit: Int ->
brotliDecompressBounded(input, outputLimit)
}
}
}
@@ -0,0 +1,28 @@
import Compression
import Foundation
struct BoundedBrotliError: Error, CustomStringConvertible {
let description: String
}
/// Inflate one brotli stream into at most outputLimit bytes; callers pass one byte beyond the length they
/// accept and check the result's length and hash. Compression returns nothing for a stream that is invalid,
/// truncated or longer than the buffer, so all three throw here.
func brotliDecompressBounded(_ input: Data, outputLimit: Int) throws -> Data {
guard outputLimit > 0, !input.isEmpty else {
throw BoundedBrotliError(description: "nothing to inflate")
}
var output = Data(count: outputLimit)
let produced = input.withUnsafeBytes { (inBytes: UnsafeRawBufferPointer) -> Int in
output.withUnsafeMutableBytes { (outBytes: UnsafeMutableRawBufferPointer) -> Int in
compression_decode_buffer(
outBytes.bindMemory(to: UInt8.self).baseAddress!, outputLimit,
inBytes.bindMemory(to: UInt8.self).baseAddress!, inBytes.count,
nil, COMPRESSION_BROTLI)
}
}
guard produced > 0 else {
throw BoundedBrotliError(description: "not a whole brotli stream within the output limit")
}
return produced == outputLimit ? output : output.prefix(produced)
}
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = 'OrcaGzipUtf8Codec'
s.version = '0.0.1'
s.summary = 'Bounded gunzip and strict UTF-8 decode'
s.summary = 'Bounded gunzip and brotli inflate, and strict UTF-8 decode'
s.description = s.summary
s.license = { :type => 'MIT' }
s.author = 'Orca'
@@ -11,6 +11,6 @@ Pod::Spec.new do |s|
s.swift_version = '5.9'
s.static_framework = true
s.dependency 'ExpoModulesCore'
s.libraries = 'z'
s.libraries = 'z', 'compression'
s.source_files = '**/*.swift'
end
@@ -12,5 +12,10 @@ public class OrcaGzipUtf8CodecModule: Module {
Function("decodeUtf8") { (input: Data) -> String? in
decodeStrictUtf8(input)
}
// Async: a whole bundle asset can take tens of ms, too long to hold the JS thread.
AsyncFunction("brotliDecompress") { (input: Data, outputLimit: Int) throws -> Data in
try brotliDecompressBounded(input, outputLimit: outputLimit)
}
}
}
@@ -5,6 +5,8 @@ export type OrcaGzipUtf8CodecModule = {
gunzip(input: Uint8Array, outputLimit: number): Uint8Array
/** Well-formed UTF-8 with no leading BOM, decoded; null otherwise. */
decodeUtf8(input: Uint8Array): string | null
/** Inflate one brotli stream into at most outputLimit bytes, off the JS thread; throws on bad input. */
brotliDecompress(input: Uint8Array, outputLimit: number): Promise<Uint8Array<ArrayBuffer>>
}
/** Null in a binary built before the module existed. */
@@ -13,6 +13,7 @@ import expo.modules.kotlin.exception.Exceptions
import expo.modules.kotlin.functions.Queues
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
import java.io.File
class OrcaMobileWebShellModule : Module() {
private val main = Handler(Looper.getMainLooper())
@@ -57,6 +58,16 @@ class OrcaMobileWebShellModule : Module() {
discardSpare()
}
// Page builds live in filesDir: "Clear cache", cleaner apps and low storage empty cacheDir, which cost a full
// download on the next open. allowBackup false and the device-transfer rules keep them on this phone.
Function("generationStoreDirectory") { name: String ->
val filesDir = appContext.reactContext?.filesDir ?: throw Exceptions.ReactContextLost()
val directory = File(filesDir, name)
// A full disk can refuse the folder; the caller then keeps the old root.
if (!directory.mkdirs() && !directory.isDirectory) throw UnableToCreateGenerationStoreException()
Uri.fromFile(directory).toString()
}
AsyncFunction("prepareSpareDocument") { directory: String, sessionId: String ->
val activity = appContext.currentActivity ?: return@AsyncFunction false
MobileWebShellSparePool.prepare(activity, directory, sessionId)
@@ -124,3 +135,6 @@ class OrcaMobileWebShellModule : Module() {
}
}
}
private class UnableToCreateGenerationStoreException :
CodedException("The page build folder could not be created")
@@ -0,0 +1,15 @@
import Foundation
/// Application Support, which iOS never purges; the builds can be downloaded again, so backups skip them.
enum MobileWebShellGenerationStoreDirectory {
static func prepare(name: String) throws -> String {
var directory = try FileManager.default
.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
.appendingPathComponent(name, isDirectory: true)
try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
var values = URLResourceValues()
values.isExcludedFromBackup = true
try directory.setResourceValues(values)
return directory.absoluteString
}
}
@@ -47,6 +47,11 @@ public class OrcaMobileWebShellModule: Module {
MobileWebShellSparePool.shared.discardAll()
}.runOnQueue(.main)
// The generation store's root as a file URL, created and excluded from backups.
Function("generationStoreDirectory") { (name: String) throws -> String in
try MobileWebShellGenerationStoreDirectory.prepare(name: name)
}
// Home calls this once it has a paired host, so a user with nothing to open pays nothing.
Function("warmUp") {
// A second's delay keeps the warm-up off the launch's first frames.
@@ -0,0 +1,14 @@
import { requireOptionalNativeModule } from 'expo-modules-core'
// <name> under the app's durable storage (iOS Application Support, outside backups; Android filesDir) as a file URL.
// Null from a binary built before the function existed, or when the directory can't be made.
export function generationStoreDirectory(name: string): string | null {
const shell = requireOptionalNativeModule<{
generationStoreDirectory?: (name: string) => string
}>('OrcaMobileWebShell')
try {
return shell?.generationStoreDirectory?.(name) ?? null
} catch {
return null
}
}
+1
View File
@@ -33,6 +33,7 @@
"@xterm/addon-webgl": "0.20.0-beta.329",
"@xterm/xterm": "6.1.0-beta.336",
"buffer": "^6.0.3",
"diff": "8.0.4",
"expo": "^55.0.31",
"expo-build-properties": "^55.0.18",
"expo-camera": "^55.0.23",
@@ -0,0 +1,33 @@
const fs = require('node:fs')
const path = require('node:path')
const { withAndroidManifest, withDangerousMod, AndroidConfig } = require('expo/config-plugins')
// allowBackup="false" stops cloud backup but not Android 12+ device-to-device transfer, which copies filesDir.
// Page builds are re-downloadable and belong to this phone's pairings, so a new phone starts without them.
module.exports = function withAndroidDeviceTransferRules(config) {
config = withDangerousMod(config, [
'android',
(cfg) => {
const folder = path.join(cfg.modRequest.platformProjectRoot, 'app/src/main/res/xml')
fs.mkdirSync(folder, { recursive: true })
fs.writeFileSync(
path.join(folder, 'data_extraction_rules.xml'),
[
'<?xml version="1.0" encoding="utf-8"?>',
'<data-extraction-rules>',
' <device-transfer>',
' <exclude domain="file" path="mobile-web/"/>',
' </device-transfer>',
'</data-extraction-rules>',
''
].join('\n')
)
return cfg
}
])
return withAndroidManifest(config, (cfg) => {
const application = AndroidConfig.Manifest.getMainApplicationOrThrow(cfg.modResults)
application.$['android:dataExtractionRules'] = '@xml/data_extraction_rules'
return cfg
})
}
+9
View File
@@ -221,6 +221,9 @@ importers:
buffer:
specifier: ^6.0.3
version: 6.0.3
diff:
specifier: 8.0.4
version: 8.0.4
expo:
specifier: ^55.0.31
version: 55.0.31(0def556739f9e1a9e497ee4bc3b81b41)
@@ -4089,6 +4092,10 @@ packages:
resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
diff@8.0.4:
resolution: {integrity: sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==}
engines: {node: '>=0.3.1'}
dnssd-advertise@1.1.6:
resolution: {integrity: sha512-Ndrrf6BMPalkQPd/zubL+4YghH2J9NspapQ09uDXwYbvOPkP0oaqf5CkcwJ0b50kS2O3ul6yVu+jz+RY62Cejg==}
@@ -11728,6 +11735,8 @@ snapshots:
diff-sequences@29.6.3: {}
diff@8.0.4: {}
dnssd-advertise@1.1.6: {}
doctrine@2.1.0:
@@ -11,52 +11,6 @@
"$rpc": "null"
}
},
"00ef2dbe5026": {
"name": "github.project.resolveRef#1",
"ordinal": 21,
"args": [
{
"name": "method",
"value": "github.project.resolveRef"
},
{
"name": "params",
"value": {
"host": "github.com",
"input": "https://github.com/orgs/owner/projects/3"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-4",
"ok": true,
"result": {
"host": "github.com",
"number": 3,
"ok": true,
"owner": "owner",
"ownerType": "organization",
"title": "Board",
"viewNumber": 1
}
}
}
},
"0388fa155721": {
"name": "githubProjectError",
"ordinal": 11,
"value": ""
},
"060dcedb3fdb": {
"name": "githubProjectError",
"ordinal": 10,
@@ -331,13 +285,6 @@
"ordinal": 33,
"value": false
},
"34de2d655a0a": {
"name": "githubProjectTable",
"ordinal": 32,
"value": {
"$rpc": "null"
}
},
"376c9e8bd72a": {
"error": "",
"loading": false,
@@ -407,31 +354,6 @@
"ordinal": 14,
"value": "is:open"
},
"43352776b1e1": {
"name": "githubProjectTable",
"ordinal": 14,
"value": {
"fields": [],
"project": {
"id": "project-1",
"number": 3,
"title": "Board"
},
"rows": [],
"selectedView": {
"filter": "is:open",
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
}
},
"47507819e28a": {
"name": "githubProjectPasteInput",
"ordinal": 23,
"value": ""
},
"4809ea7ad5b0": {
"name": "github.project.viewTable#1",
"ordinal": 12,
@@ -449,87 +371,6 @@
}
]
},
"4eb521bbefdd": {
"name": "githubProjectSearch",
"ordinal": 15,
"value": "is:open"
},
"528af16518e6": {
"name": "githubProjectViews",
"ordinal": 16,
"value": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"5a4fc5c86d0c": {
"name": "githubProjectPasteBusy",
"ordinal": 34,
"value": false
},
"5f5f56db9d64": {
"name": "github.project.viewTable#1",
"ordinal": 12,
"args": [
{
"name": "method",
"value": "github.project.viewTable"
},
{
"name": "params",
"value": {
"host": "github.enterprise.test",
"owner": "owner",
"ownerType": "organization",
"projectNumber": 3,
"viewId": "view-1"
}
},
{
"name": "options",
"value": {
"timeoutMs": 60000
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-3",
"ok": true,
"result": {
"data": {
"fields": [],
"project": {
"id": "project-1",
"number": 3,
"title": "Board"
},
"rows": [],
"selectedView": {
"filter": "is:open",
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
},
"ok": true
}
}
}
},
"61ce1ab88e79": {
"name": "github.project.viewTable#1",
"ordinal": 13,
"json": "{\"id\":\"frame-3\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.viewTable\",\"params\":{\"owner\":\"owner\",\"host\":\"github.enterprise.test\",\"ownerType\":\"organization\",\"projectNumber\":3,\"viewId\":\"view-1\"}}"
},
"621b6b7b4159": {
"name": "github.project.listViews#1",
"ordinal": 7,
@@ -565,11 +406,6 @@
}
}
},
"654693493b51": {
"name": "githubProjectLoading",
"ordinal": 10,
"value": true
},
"685bc2bda05d": {
"name": "githubProjects",
"ordinal": 5,
@@ -623,16 +459,6 @@
"ordinal": 25,
"value": ""
},
"7a9df0d1a484": {
"name": "githubProjectLoading",
"ordinal": 25,
"value": true
},
"7b9d3b33c08b": {
"name": "githubProjectPasteError",
"ordinal": 19,
"value": ""
},
"7d488eda1d1c": {
"name": "githubProjectViews",
"ordinal": 15,
@@ -650,43 +476,16 @@
"ordinal": 16,
"value": false
},
"8792541c60ad": {
"name": "githubProjectError",
"ordinal": 26,
"value": ""
},
"8a0577280bad": {
"name": "showGitHubProjectPicker",
"ordinal": 23,
"value": false
},
"8e4dec1aad1f": {
"name": "github.project.listViews#2",
"ordinal": 28,
"json": "{\"id\":\"frame-5\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.listViews\",\"params\":{\"owner\":\"owner\",\"host\":\"github.com\",\"ownerType\":\"organization\",\"projectNumber\":3}}"
},
"8f3ee6c510b1": {
"name": "github.project.resolveRef#1",
"ordinal": 22,
"json": "{\"id\":\"frame-4\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.resolveRef\",\"params\":{\"input\":\"https://github.com/orgs/owner/projects/3\",\"host\":\"github.com\"}}"
},
"97bc7dc12b92": {
"name": "githubProjectLoading",
"ordinal": 32,
"value": false
},
"9b9f8dd75514": {
"name": "githubProjectViews",
"ordinal": 9,
"value": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"9f9a21ac7b9e": {
"name": "github.project.listViews#2",
"ordinal": 27,
@@ -732,11 +531,6 @@
}
}
},
"a4a1ff5df287": {
"name": "githubProjectPasteBusy",
"ordinal": 18,
"value": true
},
"a5a3530ec11c": {
"name": "githubProjectPartialFailures",
"ordinal": 2,
@@ -807,68 +601,6 @@
"ordinal": 4,
"json": "{\"id\":\"frame-1\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.listAccessible\",\"params\":{\"host\":\"github.com\"}}"
},
"b49ff9f109a5": {
"name": "github.project.listViews#2",
"ordinal": 27,
"args": [
{
"name": "method",
"value": "github.project.listViews"
},
{
"name": "params",
"value": {
"host": "github.com",
"owner": "owner",
"ownerType": "organization",
"projectNumber": 3
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-5",
"ok": true,
"result": {
"ok": true,
"views": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
}
}
}
},
"b5e354ed6023": {
"name": "githubProjectLoading",
"ordinal": 17,
"value": false
},
"b66c4f75c9ae": {
"name": "githubProjectViews",
"ordinal": 29,
"value": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"b948e8307e81": {
"status": "rejected",
"startedAt": 0,
@@ -972,16 +704,6 @@
}
}
},
"c453f220a7e2": {
"name": "githubProjectLoading",
"ordinal": 33,
"value": false
},
"c4c4250b0567": {
"name": "showGitHubProjectPicker",
"ordinal": 24,
"value": false
},
"c5c018cf9a70": {
"name": "githubProjectTable",
"ordinal": 13,
@@ -1180,18 +902,6 @@
}
}
},
"fa1d1b339394": {
"name": "appliedGithubProjectSearch",
"ordinal": 30,
"value": {
"$rpc": "undefined"
}
},
"fb9764680a74": {
"name": "githubProjectError",
"ordinal": 20,
"value": ""
},
"fc799562716c": {
"name": "github.project.listViews#1",
"ordinal": 7,
@@ -1229,11 +939,6 @@
}
}
},
"fe075936e563": {
"name": "githubProjectSearch",
"ordinal": 31,
"value": ""
},
"ff43b5ec92a9": {
"error": "",
"loading": false,
@@ -1279,21 +984,15 @@
"projects-0": "eb79a9b3682a",
"views-1": "be0da5b53ffb"
},
"state": "376c9e8bd72a",
"effects": [
"2085118de92f",
"a5a3530ec11c",
"685bc2bda05d",
"170fad8cb36b",
"9b9f8dd75514"
]
"state": "ff43b5ec92a9",
"effects": ["2085118de92f", "a5a3530ec11c", "685bc2bda05d", "170fad8cb36b"]
}
},
{
"id": "tk-project-board-load.normal:table-settled",
"observation": {
"sender": ["dfe16215433b", "d254913957c1", "5f5f56db9d64"],
"payloads": ["b42c8edc0d53", "15cb97c93333", "61ce1ab88e79"],
"sender": ["dfe16215433b", "d254913957c1", "0f1aa264f581"],
"payloads": ["b42c8edc0d53", "15cb97c93333", "4809ea7ad5b0"],
"settlements": {
"mount": "eb79a9b3682a",
"projects-0": "eb79a9b3682a",
@@ -1306,13 +1005,12 @@
"a5a3530ec11c",
"685bc2bda05d",
"170fad8cb36b",
"9b9f8dd75514",
"654693493b51",
"0388fa155721",
"43352776b1e1",
"4eb521bbefdd",
"528af16518e6",
"b5e354ed6023"
"2f290fa2acf5",
"060dcedb3fdb",
"c5c018cf9a70",
"3a8617cc8fd8",
"7d488eda1d1c",
"842c950ee7cc"
]
}
},
@@ -1322,16 +1020,16 @@
"sender": [
"dfe16215433b",
"d254913957c1",
"5f5f56db9d64",
"00ef2dbe5026",
"b49ff9f109a5"
"0f1aa264f581",
"f6003aed2098",
"ae89e058b351"
],
"payloads": [
"b42c8edc0d53",
"15cb97c93333",
"61ce1ab88e79",
"8f3ee6c510b1",
"8e4dec1aad1f"
"4809ea7ad5b0",
"be93253869e6",
"9f9a21ac7b9e"
],
"settlements": {
"mount": "eb79a9b3682a",
@@ -1346,26 +1044,25 @@
"a5a3530ec11c",
"685bc2bda05d",
"170fad8cb36b",
"9b9f8dd75514",
"654693493b51",
"0388fa155721",
"43352776b1e1",
"4eb521bbefdd",
"528af16518e6",
"b5e354ed6023",
"a4a1ff5df287",
"7b9d3b33c08b",
"fb9764680a74",
"47507819e28a",
"c4c4250b0567",
"7a9df0d1a484",
"8792541c60ad",
"b66c4f75c9ae",
"fa1d1b339394",
"fe075936e563",
"34de2d655a0a",
"c453f220a7e2",
"5a4fc5c86d0c"
"2f290fa2acf5",
"060dcedb3fdb",
"c5c018cf9a70",
"3a8617cc8fd8",
"7d488eda1d1c",
"842c950ee7cc",
"3985399034a2",
"26921f3a7c09",
"1b3350f71e56",
"dc8dd7739c49",
"8a0577280bad",
"ab1b10183665",
"6b03ace1146a",
"4c9b1e4ad1f5",
"0af48d475813",
"e87bea4bcd3c",
"0056704adc0b",
"97bc7dc12b92",
"3493818a7239"
]
}
},
@@ -4,187 +4,28 @@
"family": "tasks.project-board-load",
"namedDeltas": [],
"values": {
"00ef2dbe5026": {
"name": "github.project.resolveRef#1",
"ordinal": 21,
"args": [
{
"name": "method",
"value": "github.project.resolveRef"
},
{
"name": "params",
"value": {
"host": "github.com",
"input": "https://github.com/orgs/owner/projects/3"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-4",
"ok": true,
"result": {
"host": "github.com",
"number": 3,
"ok": true,
"owner": "owner",
"ownerType": "organization",
"title": "Board",
"viewNumber": 1
}
}
}
},
"0388fa155721": {
"name": "githubProjectError",
"ordinal": 11,
"value": ""
},
"15cb97c93333": {
"name": "github.project.listViews#1",
"ordinal": 8,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.listViews\",\"params\":{\"owner\":\"owner\",\"host\":\"github.enterprise.test\",\"ownerType\":\"organization\",\"projectNumber\":3}}"
},
"170fad8cb36b": {
"name": "githubProjectPartialFailures",
"ordinal": 6,
"value": []
},
"2085118de92f": {
"name": "githubProjectError",
"ordinal": 1,
"value": ""
},
"2ab1b35ff194": {
"error": "",
"loading": false,
"pasteError": "",
"projects": [
{
"host": "github.com",
"number": 3,
"owner": "owner",
"ownerType": "organization",
"title": "Board"
}
],
"table": {
"fields": [],
"project": {
"id": "project-1",
"number": 3,
"title": "Board"
},
"rows": [],
"selectedView": {
"filter": "is:open",
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
},
"views": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"34de2d655a0a": {
"0056704adc0b": {
"name": "githubProjectTable",
"ordinal": 32,
"ordinal": 31,
"value": {
"$rpc": "null"
}
},
"376c9e8bd72a": {
"error": "",
"loading": false,
"pasteError": "",
"projects": [
{
"host": "github.com",
"number": 3,
"owner": "owner",
"ownerType": "organization",
"title": "Board"
}
],
"table": {
"$rpc": "null"
},
"views": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"43352776b1e1": {
"name": "githubProjectTable",
"ordinal": 14,
"value": {
"fields": [],
"project": {
"id": "project-1",
"number": 3,
"title": "Board"
},
"rows": [],
"selectedView": {
"filter": "is:open",
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
}
},
"47507819e28a": {
"name": "githubProjectPasteInput",
"ordinal": 23,
"060dcedb3fdb": {
"name": "githubProjectError",
"ordinal": 10,
"value": ""
},
"4eb521bbefdd": {
"name": "githubProjectSearch",
"ordinal": 15,
"value": "is:open"
"0af48d475813": {
"name": "appliedGithubProjectSearch",
"ordinal": 29,
"value": {
"$rpc": "undefined"
}
},
"528af16518e6": {
"name": "githubProjectViews",
"ordinal": 16,
"value": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"5a4fc5c86d0c": {
"name": "githubProjectPasteBusy",
"ordinal": 34,
"value": false
},
"5f5f56db9d64": {
"0f1aa264f581": {
"name": "github.project.viewTable#1",
"ordinal": 12,
"ordinal": 11,
"args": [
{
"name": "method",
@@ -236,15 +77,130 @@
}
}
},
"61ce1ab88e79": {
"15cb97c93333": {
"name": "github.project.listViews#1",
"ordinal": 8,
"json": "{\"id\":\"frame-2\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.listViews\",\"params\":{\"owner\":\"owner\",\"host\":\"github.enterprise.test\",\"ownerType\":\"organization\",\"projectNumber\":3}}"
},
"170fad8cb36b": {
"name": "githubProjectPartialFailures",
"ordinal": 6,
"value": []
},
"1b3350f71e56": {
"name": "githubProjectError",
"ordinal": 19,
"value": ""
},
"2085118de92f": {
"name": "githubProjectError",
"ordinal": 1,
"value": ""
},
"26921f3a7c09": {
"name": "githubProjectPasteError",
"ordinal": 18,
"value": ""
},
"2ab1b35ff194": {
"error": "",
"loading": false,
"pasteError": "",
"projects": [
{
"host": "github.com",
"number": 3,
"owner": "owner",
"ownerType": "organization",
"title": "Board"
}
],
"table": {
"fields": [],
"project": {
"id": "project-1",
"number": 3,
"title": "Board"
},
"rows": [],
"selectedView": {
"filter": "is:open",
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
},
"views": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"2f290fa2acf5": {
"name": "githubProjectLoading",
"ordinal": 9,
"value": true
},
"3493818a7239": {
"name": "githubProjectPasteBusy",
"ordinal": 33,
"value": false
},
"376c9e8bd72a": {
"error": "",
"loading": false,
"pasteError": "",
"projects": [
{
"host": "github.com",
"number": 3,
"owner": "owner",
"ownerType": "organization",
"title": "Board"
}
],
"table": {
"$rpc": "null"
},
"views": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"3985399034a2": {
"name": "githubProjectPasteBusy",
"ordinal": 17,
"value": true
},
"3a8617cc8fd8": {
"name": "githubProjectSearch",
"ordinal": 14,
"value": "is:open"
},
"4809ea7ad5b0": {
"name": "github.project.viewTable#1",
"ordinal": 13,
"ordinal": 12,
"json": "{\"id\":\"frame-3\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.viewTable\",\"params\":{\"owner\":\"owner\",\"host\":\"github.enterprise.test\",\"ownerType\":\"organization\",\"projectNumber\":3,\"viewId\":\"view-1\"}}"
},
"654693493b51": {
"name": "githubProjectLoading",
"ordinal": 10,
"value": true
"4c9b1e4ad1f5": {
"name": "githubProjectViews",
"ordinal": 28,
"value": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
},
"685bc2bda05d": {
"name": "githubProjects",
@@ -259,34 +215,14 @@
}
]
},
"7a9df0d1a484": {
"name": "githubProjectLoading",
"ordinal": 25,
"value": true
},
"7b9d3b33c08b": {
"name": "githubProjectPasteError",
"ordinal": 19,
"value": ""
},
"8792541c60ad": {
"6b03ace1146a": {
"name": "githubProjectError",
"ordinal": 26,
"ordinal": 25,
"value": ""
},
"8e4dec1aad1f": {
"name": "github.project.listViews#2",
"ordinal": 28,
"json": "{\"id\":\"frame-5\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.listViews\",\"params\":{\"owner\":\"owner\",\"host\":\"github.com\",\"ownerType\":\"organization\",\"projectNumber\":3}}"
},
"8f3ee6c510b1": {
"name": "github.project.resolveRef#1",
"ordinal": 22,
"json": "{\"id\":\"frame-4\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.resolveRef\",\"params\":{\"input\":\"https://github.com/orgs/owner/projects/3\",\"host\":\"github.com\"}}"
},
"9b9f8dd75514": {
"7d488eda1d1c": {
"name": "githubProjectViews",
"ordinal": 9,
"ordinal": 15,
"value": [
{
"id": "view-1",
@@ -296,24 +232,39 @@
}
]
},
"a4a1ff5df287": {
"name": "githubProjectPasteBusy",
"ordinal": 18,
"value": true
"842c950ee7cc": {
"name": "githubProjectLoading",
"ordinal": 16,
"value": false
},
"8a0577280bad": {
"name": "showGitHubProjectPicker",
"ordinal": 23,
"value": false
},
"97bc7dc12b92": {
"name": "githubProjectLoading",
"ordinal": 32,
"value": false
},
"9f9a21ac7b9e": {
"name": "github.project.listViews#2",
"ordinal": 27,
"json": "{\"id\":\"frame-5\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.listViews\",\"params\":{\"owner\":\"owner\",\"host\":\"github.com\",\"ownerType\":\"organization\",\"projectNumber\":3}}"
},
"a5a3530ec11c": {
"name": "githubProjectPartialFailures",
"ordinal": 2,
"value": []
},
"b42c8edc0d53": {
"name": "github.project.listAccessible#1",
"ordinal": 4,
"json": "{\"id\":\"frame-1\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.listAccessible\",\"params\":{\"host\":\"github.com\"}}"
"ab1b10183665": {
"name": "githubProjectLoading",
"ordinal": 24,
"value": true
},
"b49ff9f109a5": {
"ae89e058b351": {
"name": "github.project.listViews#2",
"ordinal": 27,
"ordinal": 26,
"args": [
{
"name": "method",
@@ -356,22 +307,10 @@
}
}
},
"b5e354ed6023": {
"name": "githubProjectLoading",
"ordinal": 17,
"value": false
},
"b66c4f75c9ae": {
"name": "githubProjectViews",
"ordinal": 29,
"value": [
{
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
]
"b42c8edc0d53": {
"name": "github.project.listAccessible#1",
"ordinal": 4,
"json": "{\"id\":\"frame-1\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.listAccessible\",\"params\":{\"host\":\"github.com\"}}"
},
"be0da5b53ffb": {
"status": "fulfilled",
@@ -386,15 +325,30 @@
}
]
},
"c453f220a7e2": {
"name": "githubProjectLoading",
"ordinal": 33,
"value": false
"be93253869e6": {
"name": "github.project.resolveRef#1",
"ordinal": 21,
"json": "{\"id\":\"frame-4\",\"deviceToken\":\"recording-device\",\"method\":\"github.project.resolveRef\",\"params\":{\"input\":\"https://github.com/orgs/owner/projects/3\",\"host\":\"github.com\"}}"
},
"c4c4250b0567": {
"name": "showGitHubProjectPicker",
"ordinal": 24,
"value": false
"c5c018cf9a70": {
"name": "githubProjectTable",
"ordinal": 13,
"value": {
"fields": [],
"project": {
"id": "project-1",
"number": 3,
"title": "Board"
},
"rows": [],
"selectedView": {
"filter": "is:open",
"id": "view-1",
"layout": "TABLE_LAYOUT",
"name": "Table",
"number": 1
}
}
},
"d254913957c1": {
"name": "github.project.listViews#1",
@@ -441,6 +395,11 @@
}
}
},
"dc8dd7739c49": {
"name": "githubProjectPasteInput",
"ordinal": 22,
"value": ""
},
"dfe16215433b": {
"name": "github.project.listAccessible#1",
"ordinal": 3,
@@ -485,6 +444,11 @@
}
}
},
"e87bea4bcd3c": {
"name": "githubProjectSearch",
"ordinal": 30,
"value": ""
},
"eb79a9b3682a": {
"status": "fulfilled",
"startedAt": 0,
@@ -493,22 +457,46 @@
"$rpc": "undefined"
}
},
"fa1d1b339394": {
"name": "appliedGithubProjectSearch",
"ordinal": 30,
"value": {
"$rpc": "undefined"
}
},
"fb9764680a74": {
"name": "githubProjectError",
"f6003aed2098": {
"name": "github.project.resolveRef#1",
"ordinal": 20,
"value": ""
},
"fe075936e563": {
"name": "githubProjectSearch",
"ordinal": 31,
"value": ""
"args": [
{
"name": "method",
"value": "github.project.resolveRef"
},
{
"name": "params",
"value": {
"host": "github.com",
"input": "https://github.com/orgs/owner/projects/3"
}
},
{
"name": "options",
"value": {
"$rpc": "absent"
}
}
],
"settlement": {
"status": "fulfilled",
"startedAt": 0,
"settledAt": 0,
"value": {
"id": "frame-4",
"ok": true,
"result": {
"host": "github.com",
"number": 3,
"ok": true,
"owner": "owner",
"ownerType": "organization",
"title": "Board",
"viewNumber": 1
}
}
}
},
"ff43b5ec92a9": {
"error": "",
@@ -555,21 +543,15 @@
"projects-0": "eb79a9b3682a",
"views-1": "be0da5b53ffb"
},
"state": "376c9e8bd72a",
"effects": [
"2085118de92f",
"a5a3530ec11c",
"685bc2bda05d",
"170fad8cb36b",
"9b9f8dd75514"
]
"state": "ff43b5ec92a9",
"effects": ["2085118de92f", "a5a3530ec11c", "685bc2bda05d", "170fad8cb36b"]
}
},
{
"id": "table-settled",
"observation": {
"sender": ["dfe16215433b", "d254913957c1", "5f5f56db9d64"],
"payloads": ["b42c8edc0d53", "15cb97c93333", "61ce1ab88e79"],
"sender": ["dfe16215433b", "d254913957c1", "0f1aa264f581"],
"payloads": ["b42c8edc0d53", "15cb97c93333", "4809ea7ad5b0"],
"settlements": {
"mount": "eb79a9b3682a",
"projects-0": "eb79a9b3682a",
@@ -582,13 +564,12 @@
"a5a3530ec11c",
"685bc2bda05d",
"170fad8cb36b",
"9b9f8dd75514",
"654693493b51",
"0388fa155721",
"43352776b1e1",
"4eb521bbefdd",
"528af16518e6",
"b5e354ed6023"
"2f290fa2acf5",
"060dcedb3fdb",
"c5c018cf9a70",
"3a8617cc8fd8",
"7d488eda1d1c",
"842c950ee7cc"
]
}
},
@@ -598,16 +579,16 @@
"sender": [
"dfe16215433b",
"d254913957c1",
"5f5f56db9d64",
"00ef2dbe5026",
"b49ff9f109a5"
"0f1aa264f581",
"f6003aed2098",
"ae89e058b351"
],
"payloads": [
"b42c8edc0d53",
"15cb97c93333",
"61ce1ab88e79",
"8f3ee6c510b1",
"8e4dec1aad1f"
"4809ea7ad5b0",
"be93253869e6",
"9f9a21ac7b9e"
],
"settlements": {
"mount": "eb79a9b3682a",
@@ -622,26 +603,25 @@
"a5a3530ec11c",
"685bc2bda05d",
"170fad8cb36b",
"9b9f8dd75514",
"654693493b51",
"0388fa155721",
"43352776b1e1",
"4eb521bbefdd",
"528af16518e6",
"b5e354ed6023",
"a4a1ff5df287",
"7b9d3b33c08b",
"fb9764680a74",
"47507819e28a",
"c4c4250b0567",
"7a9df0d1a484",
"8792541c60ad",
"b66c4f75c9ae",
"fa1d1b339394",
"fe075936e563",
"34de2d655a0a",
"c453f220a7e2",
"5a4fc5c86d0c"
"2f290fa2acf5",
"060dcedb3fdb",
"c5c018cf9a70",
"3a8617cc8fd8",
"7d488eda1d1c",
"842c950ee7cc",
"3985399034a2",
"26921f3a7c09",
"1b3350f71e56",
"dc8dd7739c49",
"8a0577280bad",
"ab1b10183665",
"6b03ace1146a",
"4c9b1e4ad1f5",
"0af48d475813",
"e87bea4bcd3c",
"0056704adc0b",
"97bc7dc12b92",
"3493818a7239"
]
}
}
@@ -41,6 +41,9 @@ export const customKeyModalStyles = themedStyleSheet(() => ({
borderRadius: radii.surface,
overflow: 'hidden'
},
smartRailGroup: {
marginTop: spacing.md
},
shortcutForm: {
paddingTop: spacing.sm
},
+9 -1
View File
@@ -19,6 +19,7 @@ import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { MobileSwitch } from './MobileSwitch'
import { ListGroup, ListRow } from './list/ListGroup'
import { FieldTextInput } from './composer-input/FieldTextInput'
import { SmartRailRow } from './SmartRailRow'
type Step = 'choose-type' | 'shortcut-combo' | 'special-keys' | 'text-macro'
@@ -62,9 +63,11 @@ type Props = {
onClose: () => void
onKeysChanged: (keys: CustomKey[]) => void
onManageShortcuts?: () => void
smartRail?: { enabled: boolean; onChange: (enabled: boolean) => void }
}
export function CustomKeyModal({ visible, onClose, onKeysChanged, onManageShortcuts }: Props) {
export function CustomKeyModal(props: Props) {
const { visible, onClose, onKeysChanged, onManageShortcuts, smartRail } = props
useMobileColorScheme()
const t = useMobileTranslation()
const [step, setStep] = useState<Step>('choose-type')
@@ -235,6 +238,11 @@ export function CustomKeyModal({ visible, onClose, onKeysChanged, onManageShortc
) : null}
</ListGroup>
)}
{step === 'choose-type' && smartRail ? (
<ListGroup style={styles.smartRailGroup}>
<SmartRailRow {...smartRail} />
</ListGroup>
) : null}
{step === 'shortcut-combo' && (
<View style={styles.shortcutForm}>
+24
View File
@@ -0,0 +1,24 @@
import { ListRow } from './list/ListGroup'
import { MobileSwitch } from './MobileSwitch'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
/** The Smart rail setting: keys for what the terminal's agent is doing, at the front of the key row. */
export function SmartRailRow({
enabled,
onChange
}: {
enabled: boolean
onChange: (enabled: boolean) => void
}): React.JSX.Element {
const t = useMobileTranslation()
const title = t('components.smartRailRow.title', 'Smart rail')
return (
<ListRow
title={title}
subtitle={t('components.smartRailRow.subtitle', 'Shows keys for what your agent is doing')}
accessory={
<MobileSwitch accessibilityLabel={title} value={enabled} onValueChange={onChange} />
}
/>
)
}
@@ -27,6 +27,7 @@ import {
setTerminalAccessoryBuiltInVisible
} from '../terminal/terminal-accessory-layout'
import { MobileSwitch } from './MobileSwitch'
import { SmartRailRow } from './SmartRailRow'
// Absolutely positioned DragReorderList rows require one fixed height per section.
const REORDER_ROW_HEIGHT = 56
@@ -148,10 +149,13 @@ export function TerminalShortcutSettings({
[persistLayout]
)
// Resetting the keys leaves the Smart rail setting alone.
const resetBuiltInKeys = useCallback(() => {
const next = defaultLayout()
setShortcutLayout(next)
persistLayout(next)
setShortcutLayout((current) => {
const next = { ...defaultLayout(), smartRail: current.smartRail }
persistLayout(next)
return next
})
}, [defaultLayout, persistLayout])
const reorderCustomKeys = useCallback(
@@ -182,6 +186,18 @@ export function TerminalShortcutSettings({
return (
<>
<SettingsSection>
<SmartRailRow
enabled={shortcutLayout.smartRail === true}
onChange={(enabled) =>
setShortcutLayout((current) => {
const next = { ...current, smartRail: enabled }
persistLayout(next)
return next
})
}
/>
</SettingsSection>
{hasPad ? (
<SettingsSection
title={t('components.terminalShortcutSettings.directionPad', 'DIRECTION PAD')}
+14 -10
View File
@@ -260,18 +260,22 @@ let processStore: DeviceStore | null = null
let started = false
export function processDeviceStore(): DeviceStore {
processStore ??= createDeviceStore({
fileSystem: createExpoGenerationFileSystem(),
roots: {
if (processStore === null) {
const roots = {
cache: new Directory(Paths.cache, 'orca-store', 'v1').uri,
draft: new Directory(Paths.document, 'orca-drafts', 'v1').uri
},
keychain: {
read: () => readPairingKeychainItem(DEVICE_STORE_KEY_ITEM),
write: (hexKey) => writePairingKeychainItem(DEVICE_STORE_KEY_ITEM, hexKey)
},
loadPairedHostIds: async () => (await loadStoredHostProfiles())?.map((host) => host.id) ?? null
})
}
processStore = createDeviceStore({
fileSystem: createExpoGenerationFileSystem(roots.cache),
roots,
keychain: {
read: () => readPairingKeychainItem(DEVICE_STORE_KEY_ITEM),
write: (hexKey) => writePairingKeychainItem(DEVICE_STORE_KEY_ITEM, hexKey)
},
loadPairedHostIds: async () =>
(await loadStoredHostProfiles())?.map((host) => host.id) ?? null
})
}
return processStore
}
+4 -6
View File
@@ -24,6 +24,7 @@ import {
} from './mobile-dictation-controls-copy'
import { dictationAwayCopy } from './mobile-dictation-away-copy'
import { composerInputStyles } from '../components/composer-input/composer-input-styles'
import { MobileDictationStatusAnnouncement } from './MobileDictationStatusAnnouncement'
import {
useMobileDictationHost,
useMobileDictationHostLive,
@@ -163,13 +164,9 @@ function MobileDictationToast({
const timer = setTimeout(onDone, toast.open ? TOAST_WITH_OPEN_MS : TOAST_MS)
return () => clearTimeout(timer)
}, [onDone, toast])
// The live region stays mounted so a screen reader hears the message appear.
// The host's announcer reads the message (shell or live region), so the toast itself stays quiet.
return (
<View
style={[styles.toastRow, { bottom }]}
pointerEvents="box-none"
accessibilityLiveRegion="polite"
>
<View style={[styles.toastRow, { bottom }]} pointerEvents="box-none">
{toast ? (
<View style={styles.toast}>
<Text style={styles.toastText} numberOfLines={2}>
@@ -212,6 +209,7 @@ export function MobileDictationPillLayer(): React.JSX.Element | null {
<MobileDictationPill title={pill.title} onOpen={pill.open} onStop={stop} />
</View>
) : null}
<MobileDictationStatusAnnouncement liveText={pill.liveText} />
<MobileDictationToast
toast={pill.toast}
onDone={pill.clearToast}
@@ -1,7 +1,7 @@
import { StyleSheet, Text, View } from 'react-native'
import type { UseMobileDictationResult } from '../hooks/mobile-dictation-session-state'
import { translate } from '../i18n/mobile-i18n'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import type { MobileDictationLiveText } from './use-mobile-dictation-announcements'
export type MobileDictationStatusFlags = Pick<
UseMobileDictationResult,
@@ -18,16 +18,16 @@ export function mobileDictationStatusTitle(dictation: MobileDictationStatusFlags
: null
}
// Mic labels change silently; one live region tells screen readers for every mic, like desktop's indicator.
// The live region for announcements the shell could not speak itself (TalkBack reads it; older shells fall back to it).
// A new Text per message, so the same words twice are read twice.
export function MobileDictationStatusAnnouncement({
dictation
liveText
}: {
dictation: MobileDictationStatusFlags
liveText: MobileDictationLiveText
}): React.JSX.Element {
useMobileTranslation()
return (
<View style={styles.hidden} pointerEvents="none" accessibilityLiveRegion="polite">
<Text>{mobileDictationStatusTitle(dictation) ?? ''}</Text>
<Text key={liveText.id}>{liveText.text}</Text>
</View>
)
}
@@ -0,0 +1,42 @@
import { translate } from '../i18n/mobile-i18n'
// What a screen reader hears as a dictation moves along; nothing while you talk, so it never talks over you.
export const dictationAnnounceCopy = {
listening: (engine: 'phone' | 'computer', computer: string | null) =>
engine === 'phone'
? translate('dictation.announce.listeningOnPhone', 'Listening. Transcribing on this phone.')
: computer
? translate('dictation.announce.listeningOn', 'Listening. Transcribing on {{computer}}.', {
computer
})
: translate(
'dictation.announce.listeningOnComputer',
'Listening. Transcribing on the computer.'
),
stillListening: () => translate('dictation.announce.stillListening', 'Still listening.'),
finishing: () => translate('dictation.announce.finishing', 'Finishing.'),
inserted: () => translate('dictation.announce.inserted', 'Inserted.'),
cancelled: () => translate('dictation.announce.cancelled', 'Dictation cancelled.'),
movedToComputer: (computer: string | null) =>
computer
? translate(
'dictation.announce.movedTo',
'This phone stopped transcribing. Continuing on {{computer}}.',
{ computer }
)
: translate(
'dictation.announce.movedToComputer',
'This phone stopped transcribing. Continuing on the computer.'
),
stoppedKept: (reason: string | null) =>
reason
? translate(
'dictation.announce.stoppedKept',
'Dictation stopped. {{reason}}. Your recording is kept.',
{ reason }
)
: translate(
'dictation.announce.stoppedKeptGeneric',
'Dictation stopped. Your recording is kept.'
)
}
@@ -91,7 +91,18 @@ export function dictationMeterLabel(
}
// The few words a kept failure shows in the composer row; the full message is too long for it.
export function dictationFailureReason({ message, offline }: MobileDictationKeptFailure): string {
export function dictationFailureReason(failure: MobileDictationKeptFailure): string {
return (
dictationKeptFailureCause(failure) ??
translate('dictation.failure.stopped', 'Dictation stopped')
)
}
// Why a kept failure stopped, when it is known; null for the generic stop.
export function dictationKeptFailureCause({
message,
offline
}: MobileDictationKeptFailure): string | null {
if (offline || dictationFailureMessage(message) === dictationSessionLostMessage()) {
return translate('dictation.failure.connectionLost', 'Connection lost')
}
@@ -101,5 +112,5 @@ export function dictationFailureReason({ message, offline }: MobileDictationKept
if (message === phoneDictationFailedMessage()) {
return translate('dictation.failure.phoneStopped', 'Stopped on this phone')
}
return translate('dictation.failure.stopped', 'Dictation stopped')
return null
}
@@ -2,6 +2,7 @@ import { createContext, useContext, useEffect, useState, useSyncExternalStore }
import type { UseMobileDictationResult } from '../hooks/mobile-dictation-session-state'
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
import type { MobileDictationAwayTarget } from './mobile-dictation-away-insert'
import type { MobileDictationLiveText } from './use-mobile-dictation-announcements'
import type { DictationTerm } from '../../../src/shared/dictation-dictionary'
export type MobileDictationHostToast = { message: string; open?: () => void }
@@ -25,6 +26,8 @@ export type MobileDictationOwner = {
readonly dictationTerms: readonly DictationTerm[] | undefined
// The computer spells its own words with this worktree's repo terms.
readonly worktreeId: string
// The computer that would transcribe it, for what a screen reader hears; null when the phone lacks its name.
readonly computerName: string | null
}
// A mounted session screen, as the dictation host sees it.
@@ -48,6 +51,8 @@ export type MobileDictationHost = {
readonly start: (owner: MobileDictationOwner) => Promise<void>
// Stop with the selection tick, as every stop button does.
readonly stop: () => void
// Say something to the screen reader; a screen's own toast is not read on the page.
readonly announce: (message: string) => void
readonly attach: (screen: MobileDictationScreen) => () => void
// A screen's shown() answer changed; the pill reads it on render.
readonly refresh: () => void
@@ -69,6 +74,8 @@ export type MobileDictationPill = {
readonly clearToast: () => void
// The tallest bottom bar a screen reported, so the pill floats above it.
readonly clearance: number
// Announcements the shell could not speak, for the page's live region (TalkBack, older shells).
readonly liveText: MobileDictationLiveText
}
export const MobileDictationHostContext = createContext<MobileDictationHost | null>(null)
+52 -9
View File
@@ -4,12 +4,16 @@ import type { UseMobileDictationResult } from '../hooks/mobile-dictation-session
import { useRouteHandoff } from '../navigation/route-handoff'
import { triggerError } from '../platform/haptics'
import { useClipboardWriter } from '../platform/clipboard'
import { dictationFailureMessage } from './mobile-dictation-setup'
import { dictationFailureMessage, isDictationSetupRequiredError } from './mobile-dictation-setup'
import { useMobileDictationHaptics } from './use-mobile-dictation-haptics'
import { useMobileDictationSilenceStop } from './use-mobile-dictation-silence-stop'
import { insertMobileDictationAway } from './mobile-dictation-away-insert'
import { nativeChatDictationCopy } from './mobile-session-native-chat-dictation-copy'
import { dictationAwayCopy } from './mobile-dictation-away-copy'
import {
useMobileDictationAnnouncements,
useMobileDictationSpeech
} from './use-mobile-dictation-announcements'
import {
MobileDictationClearanceContext,
MobileDictationHostContext,
@@ -58,6 +62,8 @@ export function MobileDictationHostProvider({ children }: { children: ReactNode
const clearToast = useCallback(() => setToast(null), [])
const [clearances, setClearances] = useState<ReadonlyMap<symbol, number>>(new Map())
const clipboard = useClipboardWriter()
const speech = useMobileDictationSpeech()
const { say: speak } = speech
// Bring a dictation's target back: its screen if one is still mounted, otherwise open the session again.
const openOwner = useCallback(
@@ -78,10 +84,12 @@ export function MobileDictationHostProvider({ children }: { children: ReactNode
}, [openOwner])
// Say it on the screen that shows the dictation, else in the host's toast (with Open for the dictation it is about).
// A screen's toast is not read by VoiceOver on the page, so it is spoken too; the host's toast is spoken when it shows.
const say = (message: string, about?: MobileDictationOwner) => {
const screen = screenFor(screensRef.current, ownerRef.current, false)
if (screen?.shown()) {
screen.toast(message)
speak(message)
} else {
setToast(about ? { message, open: () => openOwner(about) } : { message })
}
@@ -90,6 +98,10 @@ export function MobileDictationHostProvider({ children }: { children: ReactNode
const screen = screenFor(screensRef.current, ownerRef.current, false)
if (screen?.shown()) {
screen.reportFailure(err)
// A setup refusal opens the setup sheet, which is read on its own.
if (!isDictationSetupRequiredError(err.message)) {
speak(dictationFailureMessage(err.message))
}
return
}
triggerError()
@@ -136,9 +148,30 @@ export function MobileDictationHostProvider({ children }: { children: ReactNode
useMobileDictationSilenceStop(dictation, owner?.dictationMode, stop, (message) => say(message))
// Screens subscribe to the live dictation; the host's context only changes when its owner or pill does.
const liveRef = useRef(dictation)
const liveRef = useRef<UseMobileDictationResult>(dictation)
const listenersRef = useRef(new Set<() => void>())
const { meter, start: startDictation, stop: stopDictation, cancel, retry } = dictation
const {
meter,
start: startDictation,
stop: stopDictation,
cancel: cancelDictation,
retry
} = dictation
const away =
owner !== null &&
isUnderway(dictation) &&
screenFor(screensRef.current, owner, false)?.shown() !== true
const { noteCancel } = useMobileDictationAnnouncements(
dictation,
{ computerName: owner?.computerName ?? null, away, toast: toast?.message ?? null },
speak
)
// Every ✕ (in place, the pill, the terminal's long press) ends here, so a cancel is never read as "Inserted."
const cancel = useCallback(() => {
noteCancel()
return cancelDictation()
}, [cancelDictation, noteCancel])
const published = useMemo(() => ({ ...dictation, cancel }), [cancel, dictation])
const idle = useMemo<UseMobileDictationResult>(
() => ({
status: 'idle',
@@ -159,7 +192,7 @@ export function MobileDictationHostProvider({ children }: { children: ReactNode
)
const idleRef = useRef(idle)
useLayoutEffect(() => {
liveRef.current = dictation
liveRef.current = published
idleRef.current = idle
for (const listener of listenersRef.current) {
listener()
@@ -215,19 +248,18 @@ export function MobileDictationHostProvider({ children }: { children: ReactNode
})
}, [])
const away =
owner !== null && isUnderway(dictation) && !screenFor(screensRef.current, owner, false)?.shown()
const title = owner?.title ?? ''
const clearance = Math.max(0, ...clearances.values())
const pill = useMemo(
() => ({ away, title, open, toast, clearToast, clearance }),
[away, clearToast, clearance, open, title, toast]
() => ({ away, title, open, toast, clearToast, clearance, liveText: speech.liveText }),
[speech.liveText, away, clearToast, clearance, open, title, toast]
)
const value = useMemo<MobileDictationHost>(
() => ({
owner,
start,
stop,
announce: speak,
attach,
refresh,
subscribe,
@@ -235,7 +267,18 @@ export function MobileDictationHostProvider({ children }: { children: ReactNode
getIdleDictation,
getUnderway
}),
[attach, getDictation, getIdleDictation, getUnderway, owner, refresh, start, stop, subscribe]
[
attach,
getDictation,
getIdleDictation,
getUnderway,
owner,
refresh,
speak,
start,
stop,
subscribe
]
)
return (
<MobileDictationClearanceContext.Provider value={setClearance}>
@@ -0,0 +1,113 @@
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
import type { UseMobileDictationResult } from '../hooks/mobile-dictation-session-state'
import { useAccessibilityAnnouncer } from '../platform/accessibility-announcer'
import { dictationAnnounceCopy } from './mobile-dictation-announce-copy'
import { dictationKeptFailureCause } from './mobile-dictation-controls-copy'
// Finishing is said only when it is slow.
const FINISHING_ANNOUNCE_DELAY_MS = 1000
// What the shell could not speak, for the page's live region; the id changes on every message so a repeat is read again.
export type MobileDictationLiveText = { readonly text: string; readonly id: number }
// Speak to the screen reader through the shell where it can, else into the live region. say keeps its identity.
export function useMobileDictationSpeech(): {
say: (message: string) => void
liveText: MobileDictationLiveText
} {
const announce = useAccessibilityAnnouncer()
const announceRef = useRef(announce)
useLayoutEffect(() => {
announceRef.current = announce
})
const [liveText, setLiveText] = useState<MobileDictationLiveText>({ text: '', id: 0 })
const say = useCallback((message: string) => {
void announceRef.current(message).then((spoken) => {
if (!spoken) {
setLiveText((current) => ({ text: message, id: current.id + 1 }))
}
})
}, [])
return { say, liveText }
}
// The dictation's own spoken moments: start, leaving its screen, a move to the computer, a slow finish, a cancel, a kept failure, the host's toasts.
// Outcomes (inserted, failed) are said by whoever knows them: the screen that inserted, or the host's failure report.
export function useMobileDictationAnnouncements(
dictation: Pick<UseMobileDictationResult, 'status' | 'engine' | 'failure'>,
{
computerName,
away,
toast
}: { computerName: string | null; away: boolean; toast: string | null },
say: (message: string) => void
): { noteCancel: () => void } {
const { status, engine, failure } = dictation
const previousStatus = useRef(status)
const cancelled = useRef(false)
const listeningSaid = useRef(false)
const movedAtSaid = useRef<number | null>(null)
const statusRef = useRef(status)
useEffect(() => {
const previous = previousStatus.current
previousStatus.current = status
statusRef.current = status
if (status === 'starting') {
cancelled.current = false
listeningSaid.current = false
}
// Only a ✕ (including Discard on a kept failure); a refused start's reason is said where it is reported.
if (status === 'idle' && previous !== 'idle' && cancelled.current) {
say(dictationAnnounceCopy.cancelled())
}
if (status === 'idle') {
cancelled.current = false
}
}, [say, status])
// Leaving the screen keeps it going; say so once, then the next screen reads as usual.
useEffect(() => {
if (away && statusRef.current === 'recording') {
say(dictationAnnounceCopy.stillListening())
}
}, [away, say])
useEffect(() => {
if (toast) {
say(toast)
}
}, [say, toast])
useEffect(() => {
if (status === 'recording' && engine && !listeningSaid.current) {
listeningSaid.current = true
say(dictationAnnounceCopy.listening(engine.kind, computerName))
}
if (engine?.movedAt != null && engine.movedAt !== movedAtSaid.current) {
movedAtSaid.current = engine.movedAt
say(dictationAnnounceCopy.movedToComputer(computerName))
}
}, [computerName, engine, say, status])
useEffect(() => {
if (status !== 'processing') {
return
}
const timer = setTimeout(
() => say(dictationAnnounceCopy.finishing()),
FINISHING_ANNOUNCE_DELAY_MS
)
return () => clearTimeout(timer)
}, [say, status])
useEffect(() => {
if (failure) {
say(dictationAnnounceCopy.stoppedKept(dictationKeptFailureCause(failure)))
}
}, [failure, say])
const noteCancel = useCallback(() => {
cancelled.current = true
}, [])
return { noteCancel }
}
@@ -17,10 +17,7 @@ export function useMobileDictationLive(
cancelLatest.current = cancel
}, [cancel])
const stableCancel = useCallback(() => cancelLatest.current(), [])
const hostProfile = useHostProfile(hostId)
const hostTitle = useHostDisplay(hostProfile).title
// A workspace routed to another server transcribes there, and the phone lacks that server's name.
const computerName = useWorkspaceExecutionHost() === undefined && hostProfile ? hostTitle : null
const computerName = useDictationComputerName(hostId)
const { meter, engine, failure, retry } = dictation
const failureReason = failure === null ? null : dictationFailureReason(failure)
return useMemo(
@@ -35,3 +32,10 @@ export function useMobileDictationLive(
[meter, engine, computerName, stableCancel, failureReason, retry]
)
}
// The computer that transcribes a session's dictation; null when another server runs the workspace and the phone lacks its name.
export function useDictationComputerName(hostId: string): string | null {
const hostProfile = useHostProfile(hostId)
const hostTitle = useHostDisplay(hostProfile).title
return useWorkspaceExecutionHost() === undefined && hostProfile ? hostTitle : null
}
+12 -1
View File
@@ -1339,7 +1339,18 @@
},
"announce": {
"typedInto": "Eingetippt in {{target}}",
"insertedIn": "Eingefügt in {{target}}"
"insertedIn": "Eingefügt in {{target}}",
"listeningOnPhone": "Hört zu. Transkription auf diesem Telefon.",
"listeningOn": "Hört zu. Transkription auf {{computer}}.",
"listeningOnComputer": "Hört zu. Transkription auf dem Computer.",
"finishing": "Wird abgeschlossen.",
"inserted": "Eingefügt.",
"cancelled": "Diktat abgebrochen.",
"movedTo": "Dieses Telefon hat die Transkription beendet. Weiter auf {{computer}}.",
"movedToComputer": "Dieses Telefon hat die Transkription beendet. Weiter auf dem Computer.",
"stoppedKept": "Diktat gestoppt. {{reason}}. Deine Aufnahme bleibt erhalten.",
"stoppedKeptGeneric": "Diktat gestoppt. Deine Aufnahme bleibt erhalten.",
"stillListening": "Hört weiter zu."
},
"pill": {
"open": "Öffnen",
+35 -1
View File
@@ -554,7 +554,18 @@
},
"announce": {
"typedInto": "Typed into {{target}}",
"insertedIn": "Inserted in {{target}}"
"insertedIn": "Inserted in {{target}}",
"listeningOnPhone": "Listening. Transcribing on this phone.",
"listeningOn": "Listening. Transcribing on {{computer}}.",
"listeningOnComputer": "Listening. Transcribing on the computer.",
"finishing": "Finishing.",
"inserted": "Inserted.",
"cancelled": "Dictation cancelled.",
"movedTo": "This phone stopped transcribing. Continuing on {{computer}}.",
"movedToComputer": "This phone stopped transcribing. Continuing on the computer.",
"stoppedKept": "Dictation stopped. {{reason}}. Your recording is kept.",
"stoppedKeptGeneric": "Dictation stopped. Your recording is kept.",
"stillListening": "Still listening."
},
"pill": {
"open": "Open",
@@ -1479,6 +1490,10 @@
},
"offlineAsOfTime": {
"yesterday": "yesterday, {{time}}"
},
"smartRailRow": {
"title": "Smart rail",
"subtitle": "Shows keys for what your agent is doing"
}
},
"pullRequest": {
@@ -2887,6 +2902,25 @@
},
"usePrTextAction": {
"updateFailed": "Failed to update pull request."
},
"smartKeys": {
"always": "Always",
"answer": "Answer",
"background": "Background",
"cancel": "Cancel",
"confirm": "Confirm",
"edit": "Edit",
"history": "History",
"keyLabel": "{{word}}, sends {{combo}}",
"mode": "Mode",
"no": "No",
"queue": "Queue",
"reject": "Reject",
"rewind": "Rewind",
"sendNow": "Send now",
"skip": "Skip",
"stop": "Stop",
"yes": "Yes"
}
},
"chat": {
+12 -1
View File
@@ -1380,7 +1380,18 @@
},
"announce": {
"typedInto": "Escrito en {{target}}",
"insertedIn": "Insertado en {{target}}"
"insertedIn": "Insertado en {{target}}",
"listeningOnPhone": "Escuchando. Transcribiendo en este teléfono.",
"listeningOn": "Escuchando. Transcribiendo en {{computer}}.",
"listeningOnComputer": "Escuchando. Transcribiendo en el ordenador.",
"finishing": "Terminando.",
"inserted": "Insertado.",
"cancelled": "Dictado cancelado.",
"movedTo": "Este teléfono dejó de transcribir. Continúa en {{computer}}.",
"movedToComputer": "Este teléfono dejó de transcribir. Continúa en el ordenador.",
"stoppedKept": "Dictado detenido. {{reason}}. Tu grabación se conserva.",
"stoppedKeptGeneric": "Dictado detenido. Tu grabación se conserva.",
"stillListening": "Sigue escuchando."
},
"pill": {
"open": "Abrir",
+12 -1
View File
@@ -1380,7 +1380,18 @@
},
"announce": {
"typedInto": "Saisi dans {{target}}",
"insertedIn": "Inséré dans {{target}}"
"insertedIn": "Inséré dans {{target}}",
"listeningOnPhone": "Écoute. Transcription sur ce téléphone.",
"listeningOn": "Écoute. Transcription sur {{computer}}.",
"listeningOnComputer": "Écoute. Transcription sur l’ordinateur.",
"finishing": "Finalisation.",
"inserted": "Inséré.",
"cancelled": "Dictée annulée.",
"movedTo": "Ce téléphone a arrêté de transcrire. Suite sur {{computer}}.",
"movedToComputer": "Ce téléphone a arrêté de transcrire. Suite sur l’ordinateur.",
"stoppedKept": "Dictée arrêtée. {{reason}}. Votre enregistrement est conservé.",
"stoppedKeptGeneric": "Dictée arrêtée. Votre enregistrement est conservé.",
"stillListening": "Toujours à l’écoute."
},
"pill": {
"open": "Ouvrir",
+12 -1
View File
@@ -1335,7 +1335,18 @@
},
"announce": {
"typedInto": "{{target}} に入力しました",
"insertedIn": "{{target}} に挿入しました"
"insertedIn": "{{target}} に挿入しました",
"listeningOnPhone": "聞き取り中。このスマートフォンで文字起こししています。",
"listeningOn": "聞き取り中。{{computer}} で文字起こししています。",
"listeningOnComputer": "聞き取り中。コンピュータで文字起こししています。",
"finishing": "仕上げ中。",
"inserted": "挿入しました。",
"cancelled": "音声入力をキャンセルしました。",
"movedTo": "このスマートフォンでの文字起こしが止まりました。{{computer}} で続けます。",
"movedToComputer": "このスマートフォンでの文字起こしが止まりました。コンピュータで続けます。",
"stoppedKept": "音声入力が停止しました。{{reason}}。録音は保持されています。",
"stoppedKeptGeneric": "音声入力が停止しました。録音は保持されています。",
"stillListening": "聞き取りを続けています。"
},
"pill": {
"open": "開く",
+12 -1
View File
@@ -1335,7 +1335,18 @@
},
"announce": {
"typedInto": "{{target}}에 입력됨",
"insertedIn": "{{target}}에 삽입됨"
"insertedIn": "{{target}}에 삽입됨",
"listeningOnPhone": "듣는 중. 이 휴대폰에서 받아쓰는 중입니다.",
"listeningOn": "듣는 중. {{computer}}에서 받아쓰는 중입니다.",
"listeningOnComputer": "듣는 중. 컴퓨터에서 받아쓰는 중입니다.",
"finishing": "마무리 중.",
"inserted": "삽입됨.",
"cancelled": "받아쓰기가 취소되었습니다.",
"movedTo": "이 휴대폰의 받아쓰기가 멈췄습니다. {{computer}}에서 계속합니다.",
"movedToComputer": "이 휴대폰의 받아쓰기가 멈췄습니다. 컴퓨터에서 계속합니다.",
"stoppedKept": "받아쓰기가 중지되었습니다. {{reason}}. 녹음은 보관됩니다.",
"stoppedKeptGeneric": "받아쓰기가 중지되었습니다. 녹음은 보관됩니다.",
"stillListening": "계속 듣는 중입니다."
},
"pill": {
"open": "열기",
+12 -1
View File
@@ -1380,7 +1380,18 @@
},
"announce": {
"typedInto": "Digitado em {{target}}",
"insertedIn": "Inserido em {{target}}"
"insertedIn": "Inserido em {{target}}",
"listeningOnPhone": "Ouvindo. Transcrevendo neste telefone.",
"listeningOn": "Ouvindo. Transcrevendo em {{computer}}.",
"listeningOnComputer": "Ouvindo. Transcrevendo no computador.",
"finishing": "Finalizando.",
"inserted": "Inserido.",
"cancelled": "Ditado cancelado.",
"movedTo": "Este telefone parou de transcrever. Continuando em {{computer}}.",
"movedToComputer": "Este telefone parou de transcrever. Continuando no computador.",
"stoppedKept": "Ditado interrompido. {{reason}}. Sua gravação foi mantida.",
"stoppedKeptGeneric": "Ditado interrompido. Sua gravação foi mantida.",
"stillListening": "Ainda ouvindo."
},
"pill": {
"open": "Abrir",
+12 -1
View File
@@ -1421,7 +1421,18 @@
},
"announce": {
"typedInto": "Введено в {{target}}",
"insertedIn": "Вставлено в {{target}}"
"insertedIn": "Вставлено в {{target}}",
"listeningOnPhone": "Слушаю. Распознавание на этом телефоне.",
"listeningOn": "Слушаю. Распознавание на {{computer}}.",
"listeningOnComputer": "Слушаю. Распознавание на компьютере.",
"finishing": "Завершение.",
"inserted": "Вставлено.",
"cancelled": "Диктовка отменена.",
"movedTo": "Этот телефон перестал распознавать. Продолжение на {{computer}}.",
"movedToComputer": "Этот телефон перестал распознавать. Продолжение на компьютере.",
"stoppedKept": "Диктовка остановлена. {{reason}}. Запись сохранена.",
"stoppedKeptGeneric": "Диктовка остановлена. Запись сохранена.",
"stillListening": "Продолжаю слушать."
},
"pill": {
"open": "Открыть",
+12 -1
View File
@@ -1339,7 +1339,18 @@
},
"announce": {
"typedInto": "{{target}} içine yazıldı",
"insertedIn": "{{target}} içine eklendi"
"insertedIn": "{{target}} içine eklendi",
"listeningOnPhone": "Dinleniyor. Bu telefonda yazıya dökülüyor.",
"listeningOn": "Dinleniyor. {{computer}} üzerinde yazıya dökülüyor.",
"listeningOnComputer": "Dinleniyor. Bilgisayarda yazıya dökülüyor.",
"finishing": "Tamamlanıyor.",
"inserted": "Eklendi.",
"cancelled": "Dikte iptal edildi.",
"movedTo": "Bu telefon yazıya dökmeyi bıraktı. {{computer}} üzerinde devam ediliyor.",
"movedToComputer": "Bu telefon yazıya dökmeyi bıraktı. Bilgisayarda devam ediliyor.",
"stoppedKept": "Dikte durdu. {{reason}}. Kaydınız saklandı.",
"stoppedKeptGeneric": "Dikte durdu. Kaydınız saklandı.",
"stillListening": "Dinlemeye devam ediliyor."
},
"pill": {
"open": "Aç",
+12 -1
View File
@@ -1335,7 +1335,18 @@
},
"announce": {
"typedInto": "已輸入到 {{target}}",
"insertedIn": "已插入到 {{target}}"
"insertedIn": "已插入到 {{target}}",
"listeningOnPhone": "正在聽。正在此手機上轉寫。",
"listeningOn": "正在聽。正在 {{computer}} 上轉寫。",
"listeningOnComputer": "正在聽。正在電腦上轉寫。",
"finishing": "正在完成。",
"inserted": "已插入。",
"cancelled": "已取消聽寫。",
"movedTo": "此手機已停止轉寫。在 {{computer}} 上繼續。",
"movedToComputer": "此手機已停止轉寫。在電腦上繼續。",
"stoppedKept": "聽寫已停止。{{reason}}。錄音已保留。",
"stoppedKeptGeneric": "聽寫已停止。錄音已保留。",
"stillListening": "仍在聽。"
},
"pill": {
"open": "開啟",
+12 -1
View File
@@ -1335,7 +1335,18 @@
},
"announce": {
"typedInto": "已输入到 {{target}}",
"insertedIn": "已插入到 {{target}}"
"insertedIn": "已插入到 {{target}}",
"listeningOnPhone": "正在听。正在此手机上转写。",
"listeningOn": "正在听。正在 {{computer}} 上转写。",
"listeningOnComputer": "正在听。正在电脑上转写。",
"finishing": "正在完成。",
"inserted": "已插入。",
"cancelled": "已取消听写。",
"movedTo": "此手机已停止转写。在 {{computer}} 上继续。",
"movedToComputer": "此手机已停止转写。在电脑上继续。",
"stoppedKept": "听写已停止。{{reason}}。录音已保留。",
"stoppedKeptGeneric": "听写已停止。录音已保留。",
"stillListening": "仍在听。"
},
"pill": {
"open": "打开",
@@ -41,7 +41,8 @@ export const BRIDGE_NATIVE_VERB_NAMES = [
'native.pdf.view',
'native.image.act',
BRIDGE_SPEECH_VERB,
BRIDGE_STORE_VERB
BRIDGE_STORE_VERB,
'native.a11y.announce'
] as const
export type BridgeNativeVerb = (typeof BRIDGE_NATIVE_VERB_NAMES)[number]
@@ -93,6 +94,11 @@ export type BridgePdfOpenParams = Omit<
'action'
>
// The page has no announce call of its own (RNW's is a no-op); the shell speaks for it. Long text is a page bug, so it is refused.
export const a11yAnnounceParamsSchema = z.strictObject({ message: z.string().min(1).max(500) })
// announced:false when the shell leaves it to the page's live region (Android, where TalkBack reads it).
export const a11yAnnounceResultSchema = z.strictObject({ announced: z.boolean() })
export const BRIDGE_NATIVE_VERBS: Readonly<Record<BridgeNativeVerb, BridgeNativeVerbSpec>> = {
'native.clipboard.write': {
params: clipboardWriteParamsSchema,
@@ -150,6 +156,10 @@ export const BRIDGE_NATIVE_VERBS: Readonly<Record<BridgeNativeVerb, BridgeNative
[BRIDGE_STORE_VERB]: {
params: storeParamsSchema,
result: storeResultSchema
},
'native.a11y.announce': {
params: a11yAnnounceParamsSchema,
result: a11yAnnounceResultSchema
}
}
@@ -1,35 +0,0 @@
import { createBridgePortPair } from './bridge-port-pair-test-harness'
import { createFakeRpcClient, type FakeRpcClient } from '../bridge-host-test-fakes'
import type { RpcClient } from '../../transport/rpc/rpc-client-contract'
import type { BridgePortPair, BridgePortPairOptions } from './bridge-port-pair-contract'
export function createFakeBridgePortPair(
options: Omit<BridgePortPairOptions<FakeRpcClient>, 'rpc'> & { rpc?: FakeRpcClient } = {}
): BridgePortPair<FakeRpcClient> {
return createBridgePortPair({ ...options, rpc: options.rpc ?? createFakeRpcClient() })
}
// Attempt each already-owned teardown phase even when an earlier original close throws.
export async function disposeBridgePortPair(
pair: Pick<BridgePortPair<RpcClient>, 'client' | 'host' | 'flush'>
): Promise<void> {
const errors: unknown[] = []
// Async wrappers turn a synchronous close/dispose throw into a rejection the same catch records.
for (const cleanup of [
async () => pair.client.close(),
async () => pair.host.dispose(),
() => pair.flush()
]) {
try {
await cleanup()
} catch (error) {
errors.push(error)
}
}
if (errors.length === 1) {
throw errors[0]
}
if (errors.length) {
throw new AggregateError(errors, 'Bridge pair teardown failed')
}
}
@@ -1,4 +1,5 @@
import type { RpcClient } from '../../transport/rpc/rpc-client-contract'
import { createFakeRpcClient, type FakeRpcClient } from '../bridge-host-test-fakes'
import { createBridgeHost, type BridgeHostDiagnostic } from '../bridge-host'
import type { BridgeNavigateBackOutcome } from '../bridge-host-contract'
import { BRIDGE_MAX_PENDING_REQUESTS } from './bridge-caps'
@@ -23,7 +24,6 @@ export type {
BridgePortObservation
} from './bridge-port-pair-contract'
import { createLane, readAll, defaultVerbAnswer, neutralObservation } from './bridge-port-lane'
export { createFakeBridgePortPair, disposeBridgePortPair } from './bridge-port-pair-lifecycle'
export const PORT_PAIR_CLIENT_IDENTITY = 'device-token-a'
@@ -217,3 +217,34 @@ export async function fillFreeDesktopSlots(pair: BridgePortPair): Promise<number
}
return BRIDGE_MAX_PENDING_REQUESTS + 1
}
export function createFakeBridgePortPair(
options: Omit<BridgePortPairOptions<FakeRpcClient>, 'rpc'> & { rpc?: FakeRpcClient } = {}
): BridgePortPair<FakeRpcClient> {
return createBridgePortPair({ ...options, rpc: options.rpc ?? createFakeRpcClient() })
}
// Attempt each already-owned teardown phase even when an earlier original close throws.
export async function disposeBridgePortPair(
pair: Pick<BridgePortPair<RpcClient>, 'client' | 'host' | 'flush'>
): Promise<void> {
const errors: unknown[] = []
// Async wrappers turn a synchronous close/dispose throw into a rejection the same catch records.
for (const cleanup of [
async () => pair.client.close(),
async () => pair.host.dispose(),
() => pair.flush()
]) {
try {
await cleanup()
} catch (error) {
errors.push(error)
}
}
if (errors.length === 1) {
throw errors[0]
}
if (errors.length) {
throw new AggregateError(errors, 'Bridge pair teardown failed')
}
}
@@ -18,6 +18,7 @@ import {
} from './bridge-audio-verbs'
import {
clipboardReadResultSchema,
a11yAnnounceResultSchema,
clipboardWriteResultSchema,
pdfViewResultSchema,
type BridgeClipboardMime,
@@ -70,6 +71,10 @@ export type NativeVerbs = {
speechRead: () => Promise<BridgeSpeechRead>
speechFinish: () => Promise<BridgeSpeechFinish>
speechCancel: () => Promise<void>
// Older shells lack it; the page then keeps its live region, which VoiceOver may not read.
canAnnounce: boolean
// True when the shell spoke it.
announce: (message: string) => Promise<boolean>
}
// Expose stable reason codes, including local ungranted and frame refusals. Unknown newer-shell codes floor to unreported so caller switches remain exhaustive.
@@ -204,7 +209,10 @@ export function useNativeVerbs(): NativeVerbs {
speechFinish: () => call(BRIDGE_SPEECH_VERB, { action: 'finish' }, speechFinishResultSchema),
speechCancel: async () => {
await call(BRIDGE_SPEECH_VERB, { action: 'cancel' }, speechCancelResultSchema)
}
},
canAnnounce: has('native.a11y.announce'),
announce: async (message) =>
(await call('native.a11y.announce', { message }, a11yAnnounceResultSchema)).announced
}
}, [client])
}
@@ -27,7 +27,8 @@ export function createFakeGenerationFileSystem(): FakeGenerationFileSystem {
const parentOf = (target: string): string => target.slice(0, target.lastIndexOf('/'))
const makeDirectory = (target: string): void => {
for (let at = target; at.startsWith(ROOT); at = parentOf(at)) {
// Any file:// tree, so a store can also be handed an older root on the same disk.
for (let at = target; at.startsWith('file:///'); at = parentOf(at)) {
nodes.set(at, { kind: 'directory' })
}
}
@@ -45,7 +46,7 @@ export function createFakeGenerationFileSystem(): FakeGenerationFileSystem {
writes,
paths: () =>
[...nodes.keys()]
.filter((key) => key !== ROOT)
.filter((key) => key.startsWith(`${ROOT}/`))
.map((key) => key.slice(ROOT.length + 1))
.sort(),
seed: (path, node) => {
@@ -0,0 +1,27 @@
import { joinUri } from './generation-cache-uri'
import type { GenerationFileSystem } from './generation-store-file-system'
// One pass, then the old root goes: an entry that fails to move costs one download, and nothing old can return
// after a later delete or cap. An entry already here wins over its old copy.
export async function adoptLegacyRoot(
fs: GenerationFileSystem,
legacyRootUri: string
): Promise<void> {
const legacy = await fs.list(legacyRootUri)
if (legacy.length === 0) {
return
}
await fs.createDirectory(fs.rootUri)
const present = new Set((await fs.list(fs.rootUri)).map((entry) => entry.name))
for (const entry of legacy) {
if (present.has(entry.name)) {
continue
}
const from = joinUri(legacyRootUri, entry.name)
const to = joinUri(fs.rootUri, entry.name)
await (entry.isDirectory ? fs.moveDirectory(from, to) : fs.moveFile(from, to)).catch(
() => undefined
)
}
await fs.delete(legacyRootUri)
}
@@ -1,6 +1,4 @@
import { Directory, File, Paths } from 'expo-file-system'
export const MOBILE_WEB_CACHE_DIRECTORY_NAME = 'mobile-web'
import { Directory, File } from 'expo-file-system'
export type GenerationDirectoryEntry = {
readonly name: string
@@ -53,9 +51,9 @@ export function generationDirectoryPath(uri: string): string {
return decodeURIComponent(uri.slice(FILE_URI_PREFIX.length))
}
export function createExpoGenerationFileSystem(): GenerationFileSystem {
export function createExpoGenerationFileSystem(rootUri: string): GenerationFileSystem {
return {
rootUri: new Directory(Paths.cache, MOBILE_WEB_CACHE_DIRECTORY_NAME).uri,
rootUri,
async list(uri) {
const directory = new Directory(uri)
if (!directory.exists) {
@@ -320,6 +320,17 @@ describe('generation store', () => {
expect(fs.paths()).toEqual(before)
expect((await store.readActiveGeneration(HOST))?.buildId).toBe(BUILD)
})
it('opens builds kept under the old root without a download once the root moves', async () => {
const fs = createFakeFileSystem()
const legacyRootUri = 'file:///caches/mobile-web'
await activate(createGenerationStore({ fileSystem: { ...fs, rootUri: legacyRootUri } }), HOST)
const store = createGenerationStore({ fileSystem: fs, legacyRootUri })
expect((await store.readActiveGeneration(HOST))?.buildId).toBe(BUILD)
expect(await fs.list(legacyRootUri)).toEqual([])
})
})
describe('reusable assets for the next download', () => {
@@ -6,6 +6,7 @@ import type {
import { joinUri } from './generation-cache-uri'
import { createGenerationHostOrder, withHostLast } from './generation-host-order'
import { createDeferredCommits } from './generation-deferred-commits'
import { adoptLegacyRoot } from './generation-legacy-root'
import { MANIFEST_FILE_NAME } from './generation-asset-path'
import { parseGenerationManifest, readWaitingStage } from './generation-manifest-read'
import { reusableAssetsOf, reusableAssetsOfHosts } from './generation-reuse'
@@ -72,6 +73,8 @@ export function createGenerationStore(options: {
fileSystem: GenerationFileSystem
// Runs before a host's built files are deleted, so nothing still reading them outlives them.
beforeHostFilesDeleted?: (hostKey: string) => Promise<void>
// An older root whose contents move here before any other work, so changing roots costs no download.
legacyRootUri?: string
}): GenerationStore {
const fs = options.fileSystem
const hostOrder = createGenerationHostOrder(fs)
@@ -308,7 +311,10 @@ export function createGenerationStore(options: {
}
// Serialize across the whole store to order stage/commit/sweep/delete and keep same-build staging writes contiguous.
let tail: Promise<unknown> = Promise.resolve()
let tail: Promise<unknown> =
options.legacyRootUri === undefined
? Promise.resolve()
: adoptLegacyRoot(fs, options.legacyRootUri).catch(() => undefined)
function serialize<T>(operation: () => Promise<T>): Promise<T> {
const run = tail.then(operation, operation)
tail = run.catch(() => undefined)
@@ -1,15 +1,26 @@
import { Directory, Paths } from 'expo-file-system'
import { generationStoreDirectory } from '../../modules/orca-mobile-web-shell/src/generation-store-directory'
import { createGenerationStore, type GenerationStore } from './generation-store'
import { createExpoGenerationFileSystem } from './generation-store-file-system'
import { dropHomeSparePage } from './home-spare-page'
const GENERATION_STORE_DIRECTORY_NAME = 'mobile-web'
let processStore: GenerationStore | null = null
// Share one store queue across native callers so host removal cannot interleave with generation/index/failure-log writes.
export function processGenerationStore(): GenerationStore {
processStore ??= createGenerationStore({
fileSystem: createExpoGenerationFileSystem(),
beforeHostFilesDeleted: dropHomeSparePage
})
if (processStore === null) {
// Builds lived in the OS cache until storage pressure or "Clear cache" emptied it and forced a full download.
const cacheRoot = new Directory(Paths.cache, GENERATION_STORE_DIRECTORY_NAME).uri
// A binary from before the durable directory keeps the cache root.
const durableRoot = generationStoreDirectory(GENERATION_STORE_DIRECTORY_NAME)
processStore = createGenerationStore({
fileSystem: createExpoGenerationFileSystem(durableRoot ?? cacheRoot),
beforeHostFilesDeleted: dropHomeSparePage,
...(durableRoot === null ? {} : { legacyRootUri: cacheRoot })
})
}
return processStore
}
@@ -12,7 +12,7 @@ import { createExpoGenerationFileSystem } from './generation-store-file-system'
import { forgetHostUpdateFailures } from './removed-host-shell-cache'
function store() {
return createGenerationStore({ fileSystem: createExpoGenerationFileSystem() })
return createGenerationStore({ fileSystem: createExpoGenerationFileSystem('') })
}
async function seed(hostId: string): Promise<void> {
@@ -42,7 +42,7 @@ describe('forgetHostUpdateFailures', () => {
})
it('writes nothing when nothing was recorded', async () => {
const fileSystem = createExpoGenerationFileSystem()
const fileSystem = createExpoGenerationFileSystem('')
expect(await fileSystem.readText(`${fileSystem.rootUri}/update-failures.json`)).toBeNull()
const write = vi.spyOn(fileSystem, 'writeText')
try {
@@ -0,0 +1,10 @@
import { useCallback } from 'react'
import { AccessibilityInfo } from 'react-native'
// Speak a message to the screen reader; false when the caller should put it in a live region instead.
export function useAccessibilityAnnouncer(): (message: string) => Promise<boolean> {
return useCallback(async (message: string) => {
AccessibilityInfo.announceForAccessibility(message)
return true
}, [])
}
@@ -0,0 +1,16 @@
import { useCallback } from 'react'
import { useNativeVerbs } from '../mobile-web-shell/bridge/use-native-verbs'
// RNW's announceForAccessibility does nothing, so the shell announces; older shells and Android leave it to the page's live region.
export function useAccessibilityAnnouncer(): (message: string) => Promise<boolean> {
const verbs = useNativeVerbs()
return useCallback(
async (message: string) => {
if (!verbs.canAnnounce) {
return false
}
return verbs.announce(message).catch(() => false)
},
[verbs]
)
}
@@ -0,0 +1,12 @@
import { AccessibilityInfo, Platform } from 'react-native'
import { a11yAnnounceParamsSchema } from '../mobile-web-shell/bridge/bridge-native-verbs'
// VoiceOver ignores the page's live regions inside the shell's WebView, so the shell announces for it; TalkBack reads them, so Android leaves it to the page.
export function serveNativeAnnounceVerb(params: unknown): { announced: boolean } {
const { message } = a11yAnnounceParamsSchema.parse(params)
if (Platform.OS !== 'ios') {
return { announced: false }
}
AccessibilityInfo.announceForAccessibilityWithOptions(message, { queue: true })
return { announced: true }
}
@@ -17,6 +17,11 @@ const device = vi.hoisted(() => ({
wakeTags: new Array<string>()
}))
// The shell's announce verb speaks through React Native's AccessibilityInfo.
vi.mock('react-native', () => ({
AccessibilityInfo: { announceForAccessibilityWithOptions: () => {} },
Platform: { OS: 'ios' }
}))
vi.mock('expo-clipboard', () => ({
setStringAsync: () => Promise.resolve(true),
getStringAsync: device.clipboard.getStringAsync,
@@ -7,6 +7,7 @@ import { NATIVE_AUDIO_DEVICE_SAMPLE_RATE, nativeAudioDeviceEngine } from './nati
import { createNativeSpeechServer } from './native-speech'
import { nativeSpeechDeviceEngine } from './native-speech-device'
import { serveNativeClipboardVerb } from './native-clipboard'
import { serveNativeAnnounceVerb } from './native-accessibility-announce'
import { createNativeMediaVerbServer } from './native-media'
import { discardStagedMedia, nativeMediaDeviceDeps } from './native-media-device'
@@ -37,6 +38,9 @@ export function useNativeDeviceVerbs(
if (verb === 'native.speech.act') {
return speech.serve(params)
}
if (verb === 'native.a11y.announce') {
return Promise.resolve(serveNativeAnnounceVerb(params))
}
if (verb === 'native.audio.start') {
return speech.mayCapture().then((may) =>
may
@@ -60,7 +60,6 @@ export function MobileSessionCommandDock({ controller }: { controller: MobileSes
<View style={dockStyles.inputBar}>
<LiveInputField
controller={controller}
keysInRail={rail.keysInRail}
trailing={
<MobileTerminalLiveInputStatus
dictation={dictation}
@@ -95,11 +94,9 @@ export function MobileSessionCommandDock({ controller }: { controller: MobileSes
// Only this field reads the typed text, so a keystroke re-renders it and not the dock or session.
function LiveInputField({
controller,
keysInRail,
trailing
}: {
controller: MobileSessionController
keysInRail: boolean
trailing: ReactNode
}) {
const t = useMobileTranslation()
@@ -124,11 +121,8 @@ function LiveInputField({
trailing={trailing}
value={text}
onChange={(event) => {
// A ctrl/alt/shift held on the Duo rail turns the next typed letter into a combo, while the rail shows it.
if (
!keysInRail ||
!dockKeys.interceptTypedCharacter(text, event.nativeEvent.text, liveInputRef)
) {
// A held Shift, Ctrl or Alt on the key row or the Duo rail turns the next typed letter into a combo.
if (!dockKeys.interceptTypedCharacter(text, event.nativeEvent.text, liveInputRef)) {
handleLiveInputChange(event)
}
}}
@@ -9,7 +9,6 @@ import { styles } from './mobile-session-styles'
import type { MobileSessionController } from './use-mobile-session-controller'
import { MobileSessionActiveContent } from './MobileSessionActiveContent'
import { MobileSessionCommandDock } from './MobileSessionCommandDock'
import { MobileDictationStatusAnnouncement } from '../dictation/MobileDictationStatusAnnouncement'
import { MobileDictationLiveContext } from '../dictation/mobile-dictation-live-context'
import { useMobileDictationLive } from '../dictation/use-mobile-dictation-live'
@@ -56,7 +55,6 @@ export function MobileSessionContentRow({ controller }: { controller: MobileSess
{/* Why: translate instead of resize so keyboard toggles don't trigger a server-side PTY viewport change. */}
<MobileSessionCommandDock controller={controller} />
</MobileDictationLiveContext.Provider>
<MobileDictationStatusAnnouncement dictation={dictation} />
</View>
{canDockPanel && activePanel !== null && (
<SessionDockColumn
@@ -77,6 +77,8 @@ export function MobileSessionSheets({ controller }: { controller: MobileSessionC
confirmDiscardMarkdown,
handleDeleteCustomKey,
handleManageShortcuts,
smartRailEnabled,
handleSmartRailChange,
handleClearTerminal,
handleCreateTerminal,
launchQuickCommand,
@@ -363,6 +365,7 @@ export function MobileSessionSheets({ controller }: { controller: MobileSessionC
onClose={() => setShowCustomKeyModal(false)}
onKeysChanged={setCustomKeys}
onManageShortcuts={handleManageShortcuts}
smartRail={{ enabled: smartRailEnabled, onChange: handleSmartRailChange }}
/>
<MobileDictationSetupSheet
visible={showDictationSetup}
+19 -52
View File
@@ -1,22 +1,18 @@
import { memo } from 'react'
import { lazy, Suspense } from 'react'
import { View, StyleSheet } from 'react-native'
import { MobileSourceControlRoutePanel } from '../source-control/MobileSourceControlRoutePanel'
import { MobileFileExplorerPanel } from '../files/MobileFileExplorerPanel'
import { mobilePrSidebarStyles } from '../components/pr-sidebar/mobile-pr-sidebar-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileDockResize } from './use-mobile-dock-resize'
import type { ActivePanel } from './session-panel-host'
import type { SessionDockPanelContentProps } from './SessionDockPanelContent'
type Props = {
activePanel: Exclude<ActivePanel, null>
hostId: string
worktreeId: string
name: string
availableWidth: number
onRequestClose: () => void
}
type Props = SessionDockPanelContentProps & { availableWidth: number }
type DockPanelContentProps = Omit<Props, 'availableWidth'>
// Panels load with the first dock open so phone sessions, which never dock, skip Source Control and Files code.
const SessionDockPanelContent = lazy(() =>
import('./SessionDockPanelContent').then((module) => ({
default: module.SessionDockPanelContent
}))
)
// Keep drag width state in this subtree; terminal refits follow frame onLayout and need no width prop.
export function SessionDockColumn({
@@ -34,49 +30,20 @@ export function SessionDockColumn({
{/* Dedicated drag handle over the dock's left border — a leaf overlay so the
inner ScrollView can't intercept the gesture on Android. */}
<View style={styles.resizeHandle} {...panHandlers} />
<DockPanelContent
activePanel={activePanel}
hostId={hostId}
worktreeId={worktreeId}
name={name}
onRequestClose={onRequestClose}
/>
{/* The column frame paints at once; its panel fills in from local disk with no spinner. */}
<Suspense fallback={null}>
<SessionDockPanelContent
activePanel={activePanel}
hostId={hostId}
worktreeId={worktreeId}
name={name}
onRequestClose={onRequestClose}
/>
</Suspense>
</View>
)
}
// Width-independent panel props let memo skip content rerenders during resize.
const DockPanelContent = memo(function DockPanelContent({
activePanel,
hostId,
worktreeId,
name,
onRequestClose
}: DockPanelContentProps) {
// Reuse the source-control hub so dock icon switches retain commit draft, visited tabs and scroll.
if (activePanel === 'sourceControl' || activePanel === 'pr') {
return (
<MobileSourceControlRoutePanel
hostId={hostId}
worktreeId={worktreeId}
name={name}
embedded
initialTab={activePanel === 'pr' ? 'pr' : 'changes'}
onRequestClose={onRequestClose}
/>
)
}
return (
<MobileFileExplorerPanel
hostId={hostId}
worktreeId={worktreeId}
name={name}
embedded
onRequestClose={onRequestClose}
/>
)
})
const RESIZE_EDGE_WIDTH = 24
const styles = StyleSheet.create({
@@ -0,0 +1,44 @@
import { memo } from 'react'
import { MobileSourceControlRoutePanel } from '../source-control/MobileSourceControlRoutePanel'
import { MobileFileExplorerPanel } from '../files/MobileFileExplorerPanel'
import type { ActivePanel } from './session-panel-host'
export type SessionDockPanelContentProps = {
activePanel: Exclude<ActivePanel, null>
hostId: string
worktreeId: string
name: string
onRequestClose: () => void
}
// Width-independent panel props let memo skip content rerenders during resize.
export const SessionDockPanelContent = memo(function SessionDockPanelContent({
activePanel,
hostId,
worktreeId,
name,
onRequestClose
}: SessionDockPanelContentProps) {
// Reuse the source-control hub so dock icon switches retain commit draft, visited tabs and scroll.
if (activePanel === 'sourceControl' || activePanel === 'pr') {
return (
<MobileSourceControlRoutePanel
hostId={hostId}
worktreeId={worktreeId}
name={name}
embedded
initialTab={activePanel === 'pr' ? 'pr' : 'changes'}
onRequestClose={onRequestClose}
/>
)
}
return (
<MobileFileExplorerPanel
hostId={hostId}
worktreeId={worktreeId}
name={name}
embedded
onRequestClose={onRequestClose}
/>
)
})
@@ -26,8 +26,11 @@ const seen = vi.hoisted(() => {
vi.mock('react-native', () => ({
AppState: { currentState: 'active', addEventListener: () => ({ remove: () => {} }) },
AccessibilityInfo: { announceForAccessibility: () => {} },
Platform: { OS: 'ios' }
}))
// The computer's name only words announcements; the stored host profile pulls in secure storage.
vi.mock('../transport/hosts/use-host-profile', () => ({ useHostProfile: () => null }))
vi.mock('@orca/expo-two-way-audio', () => ({
addExpoTwoWayAudioEventListener: (name: string, listener: (event: { data: string }) => void) => {
seen.audioListeners.set(name, listener)
@@ -57,3 +57,31 @@ it('settles a proven missing-original fork refusal but keeps a lost earlier atte
(await createMobileStructuredAgentSession(lost, 'workspace-1', 'opencode', forkFrom)).kind
).toBe('unknown')
})
it('settles a proven fork read refusal without settling a prior lost copy', async () => {
const refusal = {
ok: true,
result: {
ok: false,
refusal: {
code: 'agent_session_identity_required',
details: { reason: 'transcriptUnreadable' },
createAttemptRefusedBeforeCommit: true,
message: 'Codex could not read the saved chat.'
}
}
}
const client = clientReturning({ ok: true, result: { supported: true } }, refusal)
const forkFrom = { sessionId: 'source-chat', throughItemId: 'codex:source:selected:1' }
expect(
(await createMobileStructuredAgentSession(client, 'workspace-1', 'codex', forkFrom)).kind
).toBe('failed')
const lost = clientReturning({ ok: true, result: { supported: true } }, refusal)
lost.sendRequest
.mockImplementationOnce(async () => ({ ok: true, result: { supported: true } }))
.mockRejectedValueOnce(markRpcDeliveryUnknown(new Error('copy reply lost')))
.mockResolvedValueOnce(refusal)
expect(
(await createMobileStructuredAgentSession(lost, 'workspace-1', 'codex', forkFrom)).kind
).toBe('unknown')
})
@@ -7,7 +7,8 @@ import type {
} from '../../../src/shared/agent-session/agent-session-wire'
import {
isDefinitiveAgentSessionCreateRefusal,
isAgentSessionForkSourceAdmissionRefusal
isAgentSessionForkSourceAdmissionRefusal,
isAgentSessionCreateAdmissionRefusal
} from '../../../src/shared/agent-session/failures/agent-session-definitive-refusal'
import {
createStructuredAgentSessionId,
@@ -187,7 +188,8 @@ export async function createMobileStructuredAgentSession(
forkFrom &&
!priorCreateOutcomeUnknown &&
result.refusal.createAttemptRefusedBeforeCommit === true &&
isAgentSessionForkSourceAdmissionRefusal(result.refusal)
(isAgentSessionForkSourceAdmissionRefusal(result.refusal) ||
isAgentSessionCreateAdmissionRefusal(result.refusal))
) {
return {
kind: 'failed',
@@ -21,7 +21,7 @@ import {
readWholeAgentSessionFailureFact
} from '../../../../../src/shared/agent-session/failures/agent-session-failure'
import { agentSessionFailureSentence } from '../../../../../src/shared/agent-session/failures/agent-session-failure-words'
import { agentSessionRemoteSignInCommand } from '../../../../../src/shared/agent-session/lifecycle/agent-session-sign-in'
import { agentSessionSignInCommand } from '../../../../../src/shared/agent-session/lifecycle/agent-session-setup-commands'
import { nativeChatOrcaStopRowText } from '../../../../../src/shared/native-chat/native-chat-orca-stop-words'
import {
MobileNativeChatForkedFromContext,
@@ -127,7 +127,7 @@ export function MobileNativeChatNoticeRow({
const failureDetail = agentSessionFailureDetailText(failure)
const signInCommand =
failure?.kind === 'notSignedIn'
? agentSessionRemoteSignInCommand(names.agentName, failure.account)
? agentSessionSignInCommand(names.agentName, { account: failure.account, remote: true })
: null
const runInTerminal = names.onRunInTerminal
const detail = failureDetail?.trim() !== lineText.trim() ? failureDetail : undefined
@@ -15,10 +15,11 @@ import {
withMobileNativeChatHarness
} from './mobile-native-chat-projection-sources'
import {
buildMobileNativeChatUnit,
groupMobileNativeChatUnitMembers,
type Unit
} from './mobile-native-chat-projection-units'
buildNativeChatFoldUnit,
groupNativeChatFoldUnitMembers,
type NativeChatFoldUnit as Unit
} from '../../../../../src/shared/native-chat/transcript/native-chat-fold-units'
import { finishMobileNativeChatMessages } from '../mobile-native-chat-render-data'
// A tail harness row that is its own image unit and no roster member leaves every earlier unit as it was.
function staysInTail(harness: NativeChatMessage): boolean {
@@ -109,9 +110,15 @@ export function projectMobileNativeChatTail(
rescan.push(...newRows)
// Orphan names depend on every earlier id, so a re-projected unit with orphans takes the full pass.
const rebuilt: Unit[] = []
for (const members of groupMobileNativeChatUnitMembers(rescan, kinds)) {
for (const members of groupNativeChatFoldUnitMembers(rescan, kinds)) {
const held = previous.units.findLast((unit) => unit.sources[0]!.id === members[0]!.id)
const unit = buildMobileNativeChatUnit(members, NO_IDS, kinds, held)
const unit = buildNativeChatFoldUnit(
members,
NO_IDS,
kinds,
held,
finishMobileNativeChatMessages
)
if (unit !== held && unit.orphans.length > 0) {
return null
}
@@ -1,135 +0,0 @@
import type { NativeChatMessage } from '../../../../../src/shared/native-chat/native-chat-types'
import {
foldToolMessages,
type NativeChatToolFoldKind
} from '../../../../../src/shared/native-chat/tools/native-chat-tool-fold'
import {
orphanRowId,
type NativeChatOrphanOrigin
} from '../../../../../src/shared/native-chat/tools/native-chat-folded-tool-results'
import { finishMobileNativeChatMessages } from '../mobile-native-chat-render-data'
export type Unit = {
sources: readonly NativeChatMessage[]
rows: NativeChatMessage[]
orphans: readonly NativeChatOrphanOrigin[]
}
export function groupMobileNativeChatUnitMembers(
grouped: readonly NativeChatMessage[],
kinds: ReadonlyMap<NativeChatMessage, NativeChatToolFoldKind>
): NativeChatMessage[][] {
const members: NativeChatMessage[][] = []
let active = false
for (const source of grouped) {
const kind = kinds.get(source)!
if (active && (kind === 'tool' || kind === 'sidecar' || kind === 'pass')) {
members.at(-1)!.push(source)
} else {
members.push([source])
active = source.role === 'assistant' && kind !== 'orphan'
}
}
return members
}
export function buildMobileNativeChatUnit(
sources: readonly NativeChatMessage[],
ids: ReadonlySet<string>,
kinds: ReadonlyMap<NativeChatMessage, NativeChatToolFoldKind>,
before: Unit | undefined
): Unit {
if (
before &&
before.sources.length === sources.length &&
before.sources.every((source, index) => source === sources[index])
) {
return before
}
const substituted = before && substituteProse(before, sources, kinds)
const orphans: NativeChatOrphanOrigin[] = []
const rows =
substituted ??
finishMobileNativeChatMessages(
foldToolMessages(sources, ids, kinds, (origin) => orphans.push(origin))
)
return { sources, rows, orphans: substituted ? before!.orphans : orphans }
}
export function buildMobileNativeChatUnits(
grouped: readonly NativeChatMessage[],
kinds: ReadonlyMap<NativeChatMessage, NativeChatToolFoldKind>,
previous?: { units: readonly Unit[] }
): Unit[] {
const ids = new Set(grouped.map((row) => row.id))
const oldUnits = new Map(previous?.units.map((unit) => [unit.sources[0]!.id, unit]))
const units = groupMobileNativeChatUnitMembers(grouped, kinds).map((sources) =>
buildMobileNativeChatUnit(sources, ids, kinds, oldUnits.get(sources[0]!.id))
)
const allocated = new Set(ids)
const occurrences = new Map<string, number>()
return units.map((unit) => {
const renamed = new Map<NativeChatMessage, NativeChatMessage>()
const orphans = unit.orphans.map((origin) => {
const id = orphanRowId(origin.sourceId, allocated, occurrences)
allocated.add(id)
if (id === origin.row.id) {
return origin
}
const row = { ...origin.row, id }
renamed.set(origin.row, row)
return { ...origin, row }
})
return renamed.size === 0
? unit
: {
...unit,
orphans,
rows: unit.rows.map((row) => renamed.get(row) ?? row)
}
})
}
function substituteProse(
before: Unit,
sources: readonly NativeChatMessage[],
kinds: ReadonlyMap<NativeChatMessage, NativeChatToolFoldKind>
): NativeChatMessage[] | null {
if (before.sources.length !== sources.length) {
return null
}
const changed = sources.flatMap((source, index) =>
source === before.sources[index] ? [] : [index]
)
if (changed.length !== 1 || changed[0] !== 0) {
return null
}
const old = before.sources[0]!,
next = sources[0]!
if (
old.role !== next.role ||
(next.role !== 'assistant' && next.role !== 'reasoning') ||
old.unpairedToolResults ||
next.unpairedToolResults ||
!old.blocks.every((block) => block.type === 'text' && !block.providerFrame) ||
!next.blocks.every((block) => block.type === 'text' && !block.providerFrame)
) {
return null
}
const target = before.rows.find((row) => row.id === old.id && row.role === old.role)
if (!target || !old.blocks.every((block, index) => block === target.blocks[index])) {
return null
}
const contribution = sources
.slice(1)
.findLast(
(source) =>
source.journalPosition && (kinds.get(source) === 'tool' || kinds.get(source) === 'sidecar')
)
const replacement: NativeChatMessage = {
...next,
blocks: [...next.blocks, ...target.blocks.slice(old.blocks.length)],
...(contribution ? { foldedJournalPosition: contribution.journalPosition } : {})
}
return before.rows.map((row) => (row === target ? replacement : row))
}
@@ -9,13 +9,19 @@ import {
nativeChatImageTranscriptUnits,
normalizeImageTranscriptUnit
} from '../../../../../src/shared/native-chat/transcript/native-chat-image-transcript-markers'
import { foldMobileNativeChatMessages } from '../mobile-native-chat-render-data'
import {
finishMobileNativeChatMessages,
foldMobileNativeChatMessages
} from '../mobile-native-chat-render-data'
import {
prepareMobileNativeChatSources,
type MobileNativeChatProjectionSource
} from './mobile-native-chat-projection-sources'
import { projectMobileNativeChatTail } from './mobile-native-chat-projection-tail'
import { buildMobileNativeChatUnits, type Unit } from './mobile-native-chat-projection-units'
import {
buildNativeChatFoldUnits,
type NativeChatFoldUnit as Unit
} from '../../../../../src/shared/native-chat/transcript/native-chat-fold-units'
type ImageUnit = { sources: readonly NativeChatMessage[]; rows: NativeChatMessage[] }
export type MobileNativeChatProjection = {
@@ -75,7 +81,12 @@ export function projectMobileNativeChatMessages(
const kinds = new Map(
grouped.map((source) => [source, previous?.kinds.get(source) ?? nativeChatToolFoldKind(source)])
)
const units = buildMobileNativeChatUnits(grouped, kinds, previous)
const units = buildNativeChatFoldUnits(
grouped,
kinds,
new Map(previous?.units.map((unit) => [unit.sources[0]!.id, unit])),
finishMobileNativeChatMessages
)
const unchanged =
previous &&
units.length === previous.units.length &&
@@ -42,6 +42,10 @@ export type MobileSessionTab =
RuntimeMobileSessionTerminalTab,
| 'parentTabId'
| 'leafId'
| 'customTitle'
| 'quickCommandLabel'
| 'aiVaultTitle'
| 'generatedTitle'
| 'agentStatus'
| 'launchAgent'
| 'launchDraft'
@@ -22,7 +22,9 @@ import {
import { useMobileDictationLeaveHold } from '../dictation/mobile-dictation-leave-hold'
import { useMobileDictationHost } from '../dictation/mobile-dictation-host'
import { mobileDictationShownOnScreen } from '../dictation/mobile-dictation-shown'
import { useDictationComputerName } from '../dictation/use-mobile-dictation-live'
import { nativeChatDictationCopy } from '../dictation/mobile-session-native-chat-dictation-copy'
import { dictationAnnounceCopy } from '../dictation/mobile-dictation-announce-copy'
import {
useWorkspaceExecutionHost,
workspaceRouteHref
@@ -54,6 +56,7 @@ export function useMobileSessionDictation(
} = scope
const { showNativeChat, showNativeChatRef } = nativeChatController
const host = useMobileDictationHost()
const computerName = useDictationComputerName(hostId)
const { start: startHost } = host
const executionHost = useWorkspaceExecutionHost()
const sessionKey = JSON.stringify([hostId, executionHost ?? null, worktreeId])
@@ -93,12 +96,17 @@ export function useMobileSessionDictation(
)
const clipboard = useClipboardWriter()
// The screen's toast is not read on the page, so where the words went is also spoken.
const tell = (message: string) => {
showToast(message)
host.announce(message)
}
// A transcript its target refused must not vanish: keep it on the clipboard and say so.
const keepUndeliveredDictation = (text: string) => {
triggerError()
void clipboard.writeText(text).then(
() => showToast(nativeChatDictationCopy.insertFailedCopied()),
() => showToast(nativeChatDictationCopy.insertFailed())
() => tell(nativeChatDictationCopy.insertFailedCopied()),
() => tell(nativeChatDictationCopy.insertFailed())
)
}
@@ -106,7 +114,9 @@ export function useMobileSessionDictation(
// Chat dictation is inserted locally; a terminal's words are typed into it live, while it is the active one.
const insertHere = (text: string): boolean => {
if (destination.landsInChat(showNativeChatRef.current)) {
if (!destination.insertInChat(text)) {
if (destination.insertInChat(text)) {
host.announce(dictationAnnounceCopy.inserted())
} else {
keepUndeliveredDictation(text)
}
return true
@@ -124,7 +134,7 @@ export function useMobileSessionDictation(
(await sendLiveTerminalInput(insertHandle, text))
// Live input lands in a terminal the keyboard may cover, so say where the words went.
if (sent) {
showToast(nativeChatDictationCopy.inserted())
tell(nativeChatDictationCopy.inserted())
} else {
keepUndeliveredDictation(text)
}
@@ -237,9 +247,11 @@ export function useMobileSessionDictation(
dictationMode: scope.dictationMode,
removeFillerWords,
dictationTerms,
worktreeId
worktreeId,
computerName
})
}, [
computerName,
activeHandle,
activeSessionTab,
busyElsewhere,
@@ -5,7 +5,10 @@ import { useEffect, useRef, useCallback, useState } from 'react'
import { AppState, type AppStateStatus, Platform } from 'react-native'
import { useFocusEffect } from 'expo-router'
import { loadHosts } from '../transport/hosts/host-store'
import { loadTerminalAccessoryLayout } from '../terminal/terminal-accessory-layout'
import {
loadTerminalAccessoryLayout,
saveTerminalSmartRail
} from '../terminal/terminal-accessory-layout'
import {
recoverActiveTerminalAfterForeground,
shouldRecoverTerminalOnAppStateChange
@@ -25,6 +28,7 @@ export function useMobileSessionLifecycle(scope: MobileSessionTabReconciliationM
setCustomKeys,
setVisibleBuiltInIds,
setDirectionPadEnabled,
setSmartRailEnabled,
setHostEndpoint,
setHostName,
connStateRef,
@@ -101,6 +105,7 @@ export function useMobileSessionLifecycle(scope: MobileSessionTabReconciliationM
if (layout) {
setVisibleBuiltInIds(layout.visibleBuiltInIds)
setDirectionPadEnabled(layout.directionPadEnabled !== false)
setSmartRailEnabled(layout.smartRail === true)
}
setAccessoryLayoutLoaded(true)
}
@@ -112,6 +117,19 @@ export function useMobileSessionLifecycle(scope: MobileSessionTabReconciliationM
}
}, [padAvailable, shellStorage])
const handleSmartRailChange = useCallback(
(enabled: boolean) => {
// A read that started before the toggle must not flip it back.
layoutReadRevisionRef.current += 1
setSmartRailEnabled(enabled)
saveTerminalSmartRail(enabled, padAvailable).catch((error: unknown) => {
console.warn('[terminal-keys] the store would not take the Smart rail setting', error)
setSmartRailEnabled(!enabled)
})
},
[padAvailable]
)
useFocusEffect(
useCallback(() => {
const releaseKeys = refreshCustomKeys()
@@ -195,6 +213,7 @@ export function useMobileSessionLifecycle(scope: MobileSessionTabReconciliationM
}, [connState, scheduleDelayedAction, subscribeToTerminal, terminalResume, unsubscribeTerminal])
return {
accessoryPreferencesReady: customKeysLoaded && accessoryLayoutLoaded,
handleSmartRailChange,
pendingForegroundRecoveryRef
}
}

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