Skip to content

feat(native): drive agents from the composer: new threads, pickers, approvals - #20

Merged
rynfar merged 5 commits into
nativefrom
nw/w2-composer
Nov 2, 2026
Merged

rynfar merged 5 commits into
nativefrom
nw/w2-composer

Conversation

@rynfar

@rynfar rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Problem

The native app could read threads but not drive agents: no way to start a thread, pick a model, effort or permissions, or answer the approvals and questions an agent stops on. Issues #4, #5 and #6.

Approach

Logic is ported into t3-core with tests; views stay thin.

  • Server config (AP-SERVERCFG): subscribeServerConfig in the supervisor (decoded off the UI thread, workspaceSnapshotsOnDemand), typed forward-compatibly in core/server_config.rs with the serverConfigProjection.ts reducer. Unchanged resends report "no change", so views stay quiet. Keybindings stay raw (ServerConfig.keybindings) for the keymap's install. ClientHandle::request(method: &'static str, payload) uses the same signature and lines as the one in feat(native): right panel with tabs and the diff panel #18.
  • New thread (CO-NEWTHREAD, TV-DRAFT): Cmd+N, a header New thread button, and the project breadcrumb (ChatHeader.tsx) open a draft. Its project is the open thread's, else the draft's, else the first one (resolveThreadActionProjectRef). The draft hero reads "What should we build in ‹project›?" and picks the project. Defaults follow useNewThreadHandler: model from project override → environment default → the previous thread → first ready provider; permissions from the project or environment default. The first send calls orchestration.launchThread exactly as startThreadTurn does with bootstrap.createThread (title seed, generateTitle, root workspace), then selects the thread once the shell lists it. Cmd+Enter launches and keeps a fresh draft (composer.sendBackground).
  • Pickers (CO-MODEL, CO-TRAITS, CO-MODES): a model picker per §7.10 with a provider rail, search ranked as modelPickerSearch.ts, favorites (starring writes server.updateSettings setModelFavorites), a legacy-model "Show more", an effort column, and a footer with speed and permissions. Hidden models and model order come from providerModelPreferences. A started thread without handoff locks other providers with the web's message. The permissions chip shows only while the mode differs from the default (composerControlsOwnership.ts). Build/Plan and Shift+Tab work when planModeEnabled is on; like the web, it is off by default. Choices persist as the web persists them: thread.runtime-mode.set and thread.interaction-mode.set before the next turn, and the model (with only the options the user chose) on message.dispatch.
  • Approvals and questions (TR-APPROVAL, TR-INPUT): banners attached above the composer (ComposerBanner). Approvals show the kind, detail, app and reason, then "Waiting for approval" with Approve, Decline and the rest behind More (or the provider's own options, with warnings). A hover explains why full access still asks. Questions show options as radio or checkbox with 1–9 keys, multi-question progress, Previous, "Submit answer(s)", custom answers typed in the prompt (the thread draft is set aside and restored; displaced text is carried back), single-select auto-advance after 200ms, and Dismiss for message-mode requests. Everything is sent through runtime-request.respond and thread.user-input.dismiss. The transcript rows from feat(native): transcript rows and streaming markdown at web fidelity #17 already leave these actions to the composer.
  • Send (CO-SEND, CO-INPUT): steer or queue per followUpBehavior with Cmd for the alternate (composerDispatch.ts), steer forced while approvals are pending. A send over pending approvals declines them first, or sends decline feedback when supported. The send shortcut follows composerSubmissionIntentForKey. Stop uses thread.stop, or run.interrupt (holding the queue) when the server lacks threadStop. The web keeps the composer settings (sendShortcut, followUpBehavior, planModeEnabled) per device, so the native app reads them from $T3_NATIVE_HOME/settings.json using the web's keys and defaults.
  • Icons: my Lucide icons (stroke 1.75, generated from the web's [email protected]) are folded into the icons.rs from feat(native): transcript rows and streaming markdown at web fidelity #17, plus four composer glyphs under icons/composer/.

Ledger

AP-SERVERCFG, CO-NEWTHREAD, TV-DRAFT, CO-MODEL, CO-TRAITS, CO-MODES, CO-SEND, CO-INPUT, TR-APPROVAL, TR-INPUT and ST-CHAT are now partial, with Native paths and issues.

Verification

  • cargo test -p t3-core -p t3-client: 71 core tests, including new suites for server config, providers, traits, requests, composer rules and commands. cargo clippy --workspace --all-targets -D warnings, gen-theme --check and parity/sync.test.ts all pass, and the app builds.
  • Probe transcripts against the isolated dev server, all with the free devReplay provider:
$ probe --launch e2a348c9… "Write the approval demo file" --provider devReplay --model approval --runtime-mode approval-required --approve accept
launch: threadId="e555e111-…" resumed=false sequence=1382
pending Command approval: None live=true options=["Cancel", "Decline", "Always allow this session", "Approve"]
respond accept: Ok("{\"sequence\":1403}")
watched: e555e111-… "Write Approval Demo File" status=completed runtimeMode=approval-required pending=None

$ probe --launch e2a348c9… "Ask me a question" --provider devReplay --model question --runtime-mode full-access --answer
pending question [Fixture] Should this fixture prefer strict schemas or UI flexibility?: ["Strict schemas (Recommended)", "UI flexibility"]
answering: {"schema_vs_ui_flexibility":"Strict schemas (Recommended)"}
answer: Ok("{\"sequence\":1449}")
watched: 05836fd7-… "Ask a Clarifying Question" status=completed pending=None

$ probe --thread e555e111-… --compose "Show me the showcase" --provider devReplay --model showcase --runtime-mode auto-accept-edits
runtime-mode.set: Ok({"sequence": 1467})
message.dispatch: Ok({"sequence": 1475})
watched: e555e111-… status=completed runtimeMode=auto-accept-edits

$ probe --config   (server config decodes: 10 provider instances, models with option descriptors, settings defaults; threadStop=Some(true))
  • The app starts and stays up, including with a thread holding a pending approval or question restored. No screenshots: this machine's display was asleep, so GPUI drew only the first frames, and I could not see or exercise the composer in a real window. This needs one real-window pass before the issues close.

Gaps

Typed server config with forward-compatible decoding and its stream reducer
(serverConfigProjection.ts); provider entries, model options, search ranking and
draft defaults (providerInstances.ts, modelSelection.ts, useHandleNewThread.ts);
option descriptors and traits (shared/model.ts, modelTraits.ts); pending approvals
and questions with answer drafting (threadRequests.ts, pendingUserInput.ts); send
rules (composerDispatch.ts, composer-logic.ts, runtimeModeConfig.ts); and the
launch, respond, dismiss and thread-setting commands (operations/commands.ts).
The composer now starts threads, picks models and permissions, and answers what
the agent waits on, against an unmodified server:

- Server config: subscribeServerConfig in the supervisor, decoded off the UI
  thread, plus ClientHandle::request for any unary RPC.
- New thread: Cmd+N, a header button and the project breadcrumb open a draft for
  the open thread's project (else the first); the draft hero picks the project;
  the first send launches through orchestration.launchThread and selects the
  thread once the shell lists it. Cmd+Enter launches and keeps a fresh draft.
- Pickers: the model picker (provider rail, search, favorites, effort column,
  speed and permissions footer), the permissions chip when the mode differs from
  the default, and the legacy Build/Plan toggle with Shift+Tab. Choices persist
  as the web persists them: thread.runtime-mode.set and
  thread.interaction-mode.set before the next turn, the model on the turn.
- Approvals and questions: banners above the composer with Approve, Decline and
  the rest behind More; question options, multi-question progress, custom
  answers typed in the prompt, dismiss for message-mode requests. A message sent
  over pending approvals declines them (or sends feedback) and steers.
- Send: steer or queue behind a running turn per followUpBehavior, the send
  shortcut setting, Enter and Cmd+Enter as composerCommandKey.ts resolves them,
  and thread.stop or run.interrupt per the server's threadStop capability.
- Icons: vendored Lucide SVGs (stroke 1.75) served by one AssetSource.
…l asks

Reads fullAccessOverride, appName and responseMode from the turn items the transcript
work added: the banner shows the app and the reason, a hover explains an ask rule or a
provider safety check (fullAccessOverrideExplanation), and message-mode questions can
be dismissed even on a live session.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant