Repository navigation
fix(agent): handle include_reasoning in derive_thinking_compat - #1
Merged
Merged
Conversation
Claude models (Sonnet/Opus 4.x) use include_reasoning as their
thinking parameter, but derive_thinking_compat did not match it.
This left compat_thinking_format empty, causing apply_thinking_params
to return early when thinking was set to "off" — no disable
directive was ever sent to the API.
Add include_reasoning to the deepseek-format condition so Claude
models get thinkingFormat="deepseek", which sends
thinking: {type: "disabled"} when the user turns thinking off.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
ace331
marked this pull request as ready for review
July 14, 2026 07:08
huichen
pushed a commit
that referenced
this pull request
Jul 14, 2026
…handling, and more Bug fixes: - Navigation observer: poll 500ms instead of 15s for non-navigating actions. One fix resolves click file:// timeout, selector click timeout, and press 15s delay (bugs #1, #2, #3). - Snapshot: collect text content from h1-h6, p, li, td, th, dt, dd, label, span, div, pre, code, blockquote (bug #4). - CdpError: changed from plain object to class extends Error so it serialises as a readable message instead of '[object Object]' (bug #8). Improvements: - Snapshot: textarea/input name priority aria-label > placeholder > associated label > name > value[:30] (bug #10). - Tabs: all actions now return { tabs: [...], tabCount: N } for consistent output (bug #6). - Start: when endpoint already reachable, returns already_running with note instead of silently switching (bug #7). - Type: returns both ref (typed) and resolved selector (bug #9). - Scroll: new scroll command with direction/amount/ref arguments (bug #11). Defense in depth: - tools.ts catch block: extract .message from non-Error objects as fallback.
tallcode
added a commit
that referenced
this pull request
Jul 15, 2026
Two Unix borrows from opencode and Claude Code's shell layers. #1 login-shell env hydration (fixes "command not found"): A GUI launched from the Finder/dock inherits a minimal PATH (/usr/bin:/bin), so `bash -c` never sees tools the user installed via their shell rc (nvm/pyenv/conda, Homebrew, npm-global) — which is why `future ...` came back "command not found". At startup, before any thread or the tokio runtime (set_var is only sound single-threaded), run `$SHELL -l -i -c` once to dump `env` between markers, then take PATH from it and additively merge any vars the launcher didn't already set. 5s timeout + spawn-failure fallback keep a hanging rc from blocking startup. No-op on Windows (GUI processes already get the full registry PATH). Mirrors what VS Code / fix-path do. Verified: starting with PATH= /usr/bin:/bin, the agent logs "hydrated PATH from login shell (/bin/zsh)". #2 Unix shell resolution: shell_invocation no longer hardcodes "bash". It honors $SHELL when it is bash/zsh (both POSIX-compatible with the `( … ) 2>&1` wrapper), else probes bash then zsh on PATH, else falls back to sh. Never fish/nu — their syntax would break the wrapper. os_hint now names the actual resolved shell (e.g. zsh on macOS) instead of always saying "bash"; bash and zsh share command-line syntax so no separate syntax rules are needed — only an accurate name. Co-Authored-By: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Claude models (Sonnet/Opus 4.x) use include_reasoning as their
thinking parameter, but derive_thinking_compat did not match it.
This left compat_thinking_format empty, causing apply_thinking_params
to return early when thinking was set to "off" — no disable
directive was ever sent to the API.
Add include_reasoning to the deepseek-format condition so Claude
models get thinkingFormat="deepseek", which sends
thinking: {type: "disabled"} when the user turns thinking off.
Co-authored-by: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…handling, and more Bug fixes: - Navigation observer: poll 500ms instead of 15s for non-navigating actions. One fix resolves click file:// timeout, selector click timeout, and press 15s delay (bugs #1, #2, #3). - Snapshot: collect text content from h1-h6, p, li, td, th, dt, dd, label, span, div, pre, code, blockquote (bug #4). - CdpError: changed from plain object to class extends Error so it serialises as a readable message instead of '[object Object]' (bug #8). Improvements: - Snapshot: textarea/input name priority aria-label > placeholder > associated label > name > value[:30] (bug #10). - Tabs: all actions now return { tabs: [...], tabCount: N } for consistent output (bug #6). - Start: when endpoint already reachable, returns already_running with note instead of silently switching (bug #7). - Type: returns both ref (typed) and resolved selector (bug #9). - Scroll: new scroll command with direction/amount/ref arguments (bug #11). Defense in depth: - tools.ts catch block: extract .message from non-Error objects as fallback.
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Two Unix borrows from opencode and Claude Code's shell layers. #1 login-shell env hydration (fixes "command not found"): A GUI launched from the Finder/dock inherits a minimal PATH (/usr/bin:/bin), so `bash -c` never sees tools the user installed via their shell rc (nvm/pyenv/conda, Homebrew, npm-global) — which is why `future ...` came back "command not found". At startup, before any thread or the tokio runtime (set_var is only sound single-threaded), run `$SHELL -l -i -c` once to dump `env` between markers, then take PATH from it and additively merge any vars the launcher didn't already set. 5s timeout + spawn-failure fallback keep a hanging rc from blocking startup. No-op on Windows (GUI processes already get the full registry PATH). Mirrors what VS Code / fix-path do. Verified: starting with PATH= /usr/bin:/bin, the agent logs "hydrated PATH from login shell (/bin/zsh)". #2 Unix shell resolution: shell_invocation no longer hardcodes "bash". It honors $SHELL when it is bash/zsh (both POSIX-compatible with the `( … ) 2>&1` wrapper), else probes bash then zsh on PATH, else falls back to sh. Never fish/nu — their syntax would break the wrapper. os_hint now names the actual resolved shell (e.g. zsh on macOS) instead of always saying "bash"; bash and zsh share command-line syntax so no separate syntax rules are needed — only an accurate name. Co-Authored-By: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Claude models (Sonnet/Opus 4.x) use include_reasoning as their
thinking parameter, but derive_thinking_compat did not match it.
This left compat_thinking_format empty, causing apply_thinking_params
to return early when thinking was set to "off" — no disable
directive was ever sent to the API.
Add include_reasoning to the deepseek-format condition so Claude
models get thinkingFormat="deepseek", which sends
thinking: {type: "disabled"} when the user turns thinking off.
Co-authored-by: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…handling, and more Bug fixes: - Navigation observer: poll 500ms instead of 15s for non-navigating actions. One fix resolves click file:// timeout, selector click timeout, and press 15s delay (bugs #1, #2, #3). - Snapshot: collect text content from h1-h6, p, li, td, th, dt, dd, label, span, div, pre, code, blockquote (bug #4). - CdpError: changed from plain object to class extends Error so it serialises as a readable message instead of '[object Object]' (bug #8). Improvements: - Snapshot: textarea/input name priority aria-label > placeholder > associated label > name > value[:30] (bug #10). - Tabs: all actions now return { tabs: [...], tabCount: N } for consistent output (bug #6). - Start: when endpoint already reachable, returns already_running with note instead of silently switching (bug #7). - Type: returns both ref (typed) and resolved selector (bug #9). - Scroll: new scroll command with direction/amount/ref arguments (bug #11). Defense in depth: - tools.ts catch block: extract .message from non-Error objects as fallback.
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Two Unix borrows from opencode and Claude Code's shell layers. #1 login-shell env hydration (fixes "command not found"): A GUI launched from the Finder/dock inherits a minimal PATH (/usr/bin:/bin), so `bash -c` never sees tools the user installed via their shell rc (nvm/pyenv/conda, Homebrew, npm-global) — which is why `future ...` came back "command not found". At startup, before any thread or the tokio runtime (set_var is only sound single-threaded), run `$SHELL -l -i -c` once to dump `env` between markers, then take PATH from it and additively merge any vars the launcher didn't already set. 5s timeout + spawn-failure fallback keep a hanging rc from blocking startup. No-op on Windows (GUI processes already get the full registry PATH). Mirrors what VS Code / fix-path do. Verified: starting with PATH= /usr/bin:/bin, the agent logs "hydrated PATH from login shell (/bin/zsh)". #2 Unix shell resolution: shell_invocation no longer hardcodes "bash". It honors $SHELL when it is bash/zsh (both POSIX-compatible with the `( … ) 2>&1` wrapper), else probes bash then zsh on PATH, else falls back to sh. Never fish/nu — their syntax would break the wrapper. os_hint now names the actual resolved shell (e.g. zsh on macOS) instead of always saying "bash"; bash and zsh share command-line syntax so no separate syntax rules are needed — only an accurate name. Co-Authored-By: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Claude models (Sonnet/Opus 4.x) use include_reasoning as their
thinking parameter, but derive_thinking_compat did not match it.
This left compat_thinking_format empty, causing apply_thinking_params
to return early when thinking was set to "off" — no disable
directive was ever sent to the API.
Add include_reasoning to the deepseek-format condition so Claude
models get thinkingFormat="deepseek", which sends
thinking: {type: "disabled"} when the user turns thinking off.
Co-authored-by: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…handling, and more Bug fixes: - Navigation observer: poll 500ms instead of 15s for non-navigating actions. One fix resolves click file:// timeout, selector click timeout, and press 15s delay (bugs #1, #2, #3). - Snapshot: collect text content from h1-h6, p, li, td, th, dt, dd, label, span, div, pre, code, blockquote (bug #4). - CdpError: changed from plain object to class extends Error so it serialises as a readable message instead of '[object Object]' (bug #8). Improvements: - Snapshot: textarea/input name priority aria-label > placeholder > associated label > name > value[:30] (bug #10). - Tabs: all actions now return { tabs: [...], tabCount: N } for consistent output (bug #6). - Start: when endpoint already reachable, returns already_running with note instead of silently switching (bug #7). - Type: returns both ref (typed) and resolved selector (bug #9). - Scroll: new scroll command with direction/amount/ref arguments (bug #11). Defense in depth: - tools.ts catch block: extract .message from non-Error objects as fallback.
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Two Unix borrows from opencode and Claude Code's shell layers. #1 login-shell env hydration (fixes "command not found"): A GUI launched from the Finder/dock inherits a minimal PATH (/usr/bin:/bin), so `bash -c` never sees tools the user installed via their shell rc (nvm/pyenv/conda, Homebrew, npm-global) — which is why `future ...` came back "command not found". At startup, before any thread or the tokio runtime (set_var is only sound single-threaded), run `$SHELL -l -i -c` once to dump `env` between markers, then take PATH from it and additively merge any vars the launcher didn't already set. 5s timeout + spawn-failure fallback keep a hanging rc from blocking startup. No-op on Windows (GUI processes already get the full registry PATH). Mirrors what VS Code / fix-path do. Verified: starting with PATH= /usr/bin:/bin, the agent logs "hydrated PATH from login shell (/bin/zsh)". #2 Unix shell resolution: shell_invocation no longer hardcodes "bash". It honors $SHELL when it is bash/zsh (both POSIX-compatible with the `( … ) 2>&1` wrapper), else probes bash then zsh on PATH, else falls back to sh. Never fish/nu — their syntax would break the wrapper. os_hint now names the actual resolved shell (e.g. zsh on macOS) instead of always saying "bash"; bash and zsh share command-line syntax so no separate syntax rules are needed — only an accurate name. Co-Authored-By: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Claude models (Sonnet/Opus 4.x) use include_reasoning as their
thinking parameter, but derive_thinking_compat did not match it.
This left compat_thinking_format empty, causing apply_thinking_params
to return early when thinking was set to "off" — no disable
directive was ever sent to the API.
Add include_reasoning to the deepseek-format condition so Claude
models get thinkingFormat="deepseek", which sends
thinking: {type: "disabled"} when the user turns thinking off.
Co-authored-by: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…handling, and more Bug fixes: - Navigation observer: poll 500ms instead of 15s for non-navigating actions. One fix resolves click file:// timeout, selector click timeout, and press 15s delay (bugs #1, #2, #3). - Snapshot: collect text content from h1-h6, p, li, td, th, dt, dd, label, span, div, pre, code, blockquote (bug #4). - CdpError: changed from plain object to class extends Error so it serialises as a readable message instead of '[object Object]' (bug #8). Improvements: - Snapshot: textarea/input name priority aria-label > placeholder > associated label > name > value[:30] (bug #10). - Tabs: all actions now return { tabs: [...], tabCount: N } for consistent output (bug #6). - Start: when endpoint already reachable, returns already_running with note instead of silently switching (bug #7). - Type: returns both ref (typed) and resolved selector (bug #9). - Scroll: new scroll command with direction/amount/ref arguments (bug #11). Defense in depth: - tools.ts catch block: extract .message from non-Error objects as fallback.
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Two Unix borrows from opencode and Claude Code's shell layers. #1 login-shell env hydration (fixes "command not found"): A GUI launched from the Finder/dock inherits a minimal PATH (/usr/bin:/bin), so `bash -c` never sees tools the user installed via their shell rc (nvm/pyenv/conda, Homebrew, npm-global) — which is why `future ...` came back "command not found". At startup, before any thread or the tokio runtime (set_var is only sound single-threaded), run `$SHELL -l -i -c` once to dump `env` between markers, then take PATH from it and additively merge any vars the launcher didn't already set. 5s timeout + spawn-failure fallback keep a hanging rc from blocking startup. No-op on Windows (GUI processes already get the full registry PATH). Mirrors what VS Code / fix-path do. Verified: starting with PATH= /usr/bin:/bin, the agent logs "hydrated PATH from login shell (/bin/zsh)". #2 Unix shell resolution: shell_invocation no longer hardcodes "bash". It honors $SHELL when it is bash/zsh (both POSIX-compatible with the `( … ) 2>&1` wrapper), else probes bash then zsh on PATH, else falls back to sh. Never fish/nu — their syntax would break the wrapper. os_hint now names the actual resolved shell (e.g. zsh on macOS) instead of always saying "bash"; bash and zsh share command-line syntax so no separate syntax rules are needed — only an accurate name. Co-Authored-By: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Claude models (Sonnet/Opus 4.x) use include_reasoning as their
thinking parameter, but derive_thinking_compat did not match it.
This left compat_thinking_format empty, causing apply_thinking_params
to return early when thinking was set to "off" — no disable
directive was ever sent to the API.
Add include_reasoning to the deepseek-format condition so Claude
models get thinkingFormat="deepseek", which sends
thinking: {type: "disabled"} when the user turns thinking off.
Co-authored-by: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…handling, and more Bug fixes: - Navigation observer: poll 500ms instead of 15s for non-navigating actions. One fix resolves click file:// timeout, selector click timeout, and press 15s delay (bugs #1, #2, #3). - Snapshot: collect text content from h1-h6, p, li, td, th, dt, dd, label, span, div, pre, code, blockquote (bug #4). - CdpError: changed from plain object to class extends Error so it serialises as a readable message instead of '[object Object]' (bug #8). Improvements: - Snapshot: textarea/input name priority aria-label > placeholder > associated label > name > value[:30] (bug #10). - Tabs: all actions now return { tabs: [...], tabCount: N } for consistent output (bug #6). - Start: when endpoint already reachable, returns already_running with note instead of silently switching (bug #7). - Type: returns both ref (typed) and resolved selector (bug #9). - Scroll: new scroll command with direction/amount/ref arguments (bug #11). Defense in depth: - tools.ts catch block: extract .message from non-Error objects as fallback.
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
Two Unix borrows from opencode and Claude Code's shell layers. #1 login-shell env hydration (fixes "command not found"): A GUI launched from the Finder/dock inherits a minimal PATH (/usr/bin:/bin), so `bash -c` never sees tools the user installed via their shell rc (nvm/pyenv/conda, Homebrew, npm-global) — which is why `future ...` came back "command not found". At startup, before any thread or the tokio runtime (set_var is only sound single-threaded), run `$SHELL -l -i -c` once to dump `env` between markers, then take PATH from it and additively merge any vars the launcher didn't already set. 5s timeout + spawn-failure fallback keep a hanging rc from blocking startup. No-op on Windows (GUI processes already get the full registry PATH). Mirrors what VS Code / fix-path do. Verified: starting with PATH= /usr/bin:/bin, the agent logs "hydrated PATH from login shell (/bin/zsh)". #2 Unix shell resolution: shell_invocation no longer hardcodes "bash". It honors $SHELL when it is bash/zsh (both POSIX-compatible with the `( … ) 2>&1` wrapper), else probes bash then zsh on PATH, else falls back to sh. Never fish/nu — their syntax would break the wrapper. os_hint now names the actual resolved shell (e.g. zsh on macOS) instead of always saying "bash"; bash and zsh share command-line syntax so no separate syntax rules are needed — only an accurate name. Co-Authored-By: Claude Opus 4.8 <[email protected]>
tallcode
added a commit
that referenced
this pull request
Aug 7, 2026
…typed payloads, adopt @future-os/rpc (#112) * feat(rpc): scaffold future-rpc crate as single proto codegen owner First batch of the typed-RPC milestone (audit rec #1 / P1 #2): create the future-rpc workspace crate that owns the generated proto code for proto/future.proto, emitting both tonic server and client modules. The per-crate checked-in copies in agent/, channels/ and gui/src-tauri/ stay untouched this batch — consumers migrate in later batches. - build.rs regenerates under REGENERATE_PROTO=1 (same opt-in pattern as the existing crates); output checked into src/generated/proto.rs so normal builds never need protoc - smoke tests cover RpcResponse/StreamEvent wire round-trip - README records the contract rules (field-number stability, payload field 20, one-way dependency direction, gui version alignment) Zero behavior change: the crate has no consumers yet. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * refactor(rpc): move payload carriers into future-rpc with Deserialize Batch 2 of the typed-RPC milestone: pure move of the big-read-command payload structs from agent/src/rpc/payloads.rs into the future-rpc crate, preparing the shared decode layer. - All structs gain Deserialize alongside Serialize plus serde aliases for the legacy snake_case spellings, so both the agent's encode path and the clients' JSON fallback land in the same types (parity by construction) - New strip_legacy_aliases helper: the migration window dual-writes canonical + legacy keys and serde rejects duplicate field names, so decoders strip duplicates before deserializing (aliases still accept legacy-only JSON from pre-migration agents) - replay_event_payload splits: the crate keeps the wire struct, the agent keeps the SseEvent→payload adapter (SseEvent is agent-internal) - agent re-exports future_rpc::payloads; all 14 call sites compile unchanged Tests: the file's existing unit tests move with it; added dual-casing round-trip (inject → strip → deserialize → re-serialize equals canonical) and legacy-only decode coverage. Zero behavior change: the agent emits identical JSON. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat(proto): add typed ResponsePayload/EventPayload oneofs at field 20 Batch 3 of the typed-RPC milestone: the wire schema for the migration. Purely additive — all existing field numbers untouched, no consumer breaks. - RpcResponse.payload (ResponsePayload) with 16 typed response members: the four big reads (get_state/list_sessions/get_session_entries/ get_events_since, reusing the former doc-only messages) plus prompt ack, list_models, get_agent_info, get_commands, compact, shell, cycle_model, sync_future_models, refresh_skills, get_session_events_since, get_session_stats, get_runtime_metrics - EventPayload shared by StreamEvent/ProjectedRunEvent/ReplayEvent (all at field 20) with 14 typed event kinds — one member list decoded identically on live, replay and projection-snapshot paths - ApprovalRequestInfo extended with the full approval card (risk_level, summary, requested_action, sandbox_boundary, save_suggestion, reviewer, extras catch-all) so the event and get_state pendingApprovals share one message - null-semantics fields promoted to proto3 optional (wire-compatible): RunStateSnapshot.epoch/run_sequence/last_event_idx, RunTerminalInfo.error, SessionSummary.session_name/first_message, SessionEntry.thinking/meta/ tool_calls/output_tokens/duration_ms; SessionEntry gains content_is_object so decoders can re-inflate content into the exact original JSON value - Only future-rpc's generated code is regenerated this batch; agent/ channels/GUI keep their checked-in copies until their adoption batches Tests: typed oneof round-trip (RpcResponse with SessionState payload, StreamEvent with ToolEnd payload). Full workspace gate green; no behavior change (no consumer reads the new fields yet). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat(rpc,agent): dual-write typed payloads for the four big read commands Batch 4 of the typed-RPC milestone: the codec goes live and the agent becomes the first consumer of future-rpc. future-rpc: - encode.rs: JSON payload Value -> typed ResponsePayload for get_state / list_sessions / get_session_entries / get_events_since. Defensive by contract: unknown commands or shape mismatches return None so clients fall back to the JSON `data` string; nothing panics. Value-typed fields travel as serialized-JSON strings (source_meta, entry content/ meta/tool_calls, approval action/requested_action/sandbox_boundary/ save_suggestion + an extras catch-all) and are re-inflated on decode; SessionEntry.content_is_object discriminates display text from the session_info object. - decode.rs: response_data (typed-first, JSON fallback, canonical dual-casing Value with the migration aliases re-injected so downstream consumers see exactly what `data` carries) + typed getters (decode_get_state / decode_list_sessions / decode_session_entries / decode_events_since). - parity.rs: wire-parity round-trips for all four commands (encode -> typed -> decode == original fixture) across the full fallback matrix: dual-write, data-only (old agent), typed-only (future). Fixtures pin null-vs-absent semantics (interrupted run's runSequence null, epoch omitted), object source_meta, a full approval card, session_info object content and projection snapshots. agent: - grpc/mod.rs now re-exports future_rpc::proto (single codegen owner); the checked-in generated copy and the build.rs codegen block are gone. - execute_command dual-writes: RpcResponse.payload populated via future_rpc::encode alongside the unchanged JSON `data`. - StreamEvent / ProjectedRunEvent construction sites gain payload: None (event typing lands in a later batch). - New test proves the agent's real read-command envelopes always encode. proto: SessionState.session_file/session_id/session_name/ parent_session_id promoted to optional (wire-compatible) to preserve their null-vs-absent JSON semantics. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat(rpc,agent): typed payloads for all remaining Tier-1 responses Batches 5+6 of the typed-RPC milestone (merged — same mechanical codec work): prompt ack, list_models, get_agent_info, get_commands, compact, shell, cycle_model, sync_future_models, refresh_skills, get_session_stats, get_runtime_metrics, get_session_events_since. All 16 ResponsePayload members now dual-write. - payloads_ext.rs: serde carriers for the ad-hoc json! shapes, lifted so encode and decode share one definition. Wire casing preserved per command (camelCase; prompt ack and refresh_skills stay snake_case). null-vs-absent pinned exactly: runtime-metrics activeRunId/ eventJournalError serialize as JSON null (the agent emits null, not omission, for Option fields built with json!), cycle_model isScoped is omitted on the empty-catalog edge, session-stats cost rides as a raw JSON number so the int-vs-float representation survives the JSON path. - RunAck/RunAcceptedState move from agent runtime into the crate (agent re-exports; BusyPolicy stays agent-side as command input). - encode.rs/decode.rs gain the 12 new command arms; decode exposes typed getters (decode_prompt_ack / decode_list_models) with JSON fallback. - proto: ModelEntry.description/description_en and Command.name_zh/ description_zh promoted to optional (the catalog/skill fields are Option on the agent side and emit JSON null — parity pins it), fixtures cover the null cases. - Agent test now proves every real sessionless + session-scoped read envelope encodes (get_agent_info, list_models, get_commands, refresh_skills added alongside the batch-4 set). Untyped commands (trivial acks, get_messages/get_fork_messages) stay on the JSON `data` string by design; clients fall back automatically. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat(rpc,agent): typed payloads for the 14 stream event kinds Batch 7 of the typed-RPC milestone: the streaming half of the wire contract. The agent now dual-writes StreamEvent.payload / ProjectedRunEvent.payload / ReplayEvent.payload alongside the unchanged JSON `data` string, on the live stream, the atomic-attach replay tail, and projection snapshots. - event_payloads.rs: serde carriers for the event vocabulary (text_chunk, user_message, thinking_start/delta/end, agent_start/end, tool_start/ delta/end, usage, error, approval_decision). skip_serializing_if mirrors the broadcast serializer exactly — it omits empty strings and absent optionals, and injects a redundant `type` key that the typed form drops (every consumer keys off the envelope type). - encode.rs: event_payload() parses the event `data` JSON into the typed oneof; pass-through events (settings, ping, tool_sandboxed, ...) return None and stay JSON-only. Replay events are typed too via the same path, so reconnect/replay decode matches live. - decode.rs: event_data / event_data_json (+ projected/replay variants). Byte-stability first: during the migration window the original `data` string wins verbatim (GUI journal + NATS republish must not change); the typed reconstruction takes over only when `data` is absent. - agent grpc/mod.rs: map_broadcast_event, the attach-replay tail, and the projection-snapshot builder all populate the typed payload. - Parity fixtures cover all 14 kinds incl. agent_end sparse/full/incomplete shapes, tool_end exit-code/soft-fail/target-path semantics, usage with optional provider fields, both error variants, and the tool_args object-vs-JSON-string forms; a budget test pins text_chunk encode under 5µs/event (measured well below 1µs). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * refactor(channels): adopt future-rpc for proto, decode and event parsing Batch 8 of the typed-RPC milestone: the channel bridge becomes the first client on the shared wire contract. - grpc_client.rs consumes future_rpc::proto (re-exported under the historical module name); the checked-in channels/src/generated/proto.rs copy is deleted and build.rs no longer codegens future.proto (feishu_ws stays, so tonic-build drops out of the build-deps). - call() decodes through future_rpc::decode::response_data — typed payload first, JSON `data` fallback — so every command reads identically against old and new agents. - AgentClient::parse_event now delegates to future_rpc::events:: parse_agent_event; the AgentEvent enum and its parser moved into the crate so every future client decodes events the same way. The parser is typed-first with the JSON fallback; tool_args keeps its wire semantics (string-form only) on both paths. - expand_projection_snapshot carries the typed payload through, so reconnected/replayed events decode through the same path as live ones. - Parse tests moved to the crate, where each case now runs as twins: the JSON-data event (old agent) and the typed-payload event (new agent). Channels keeps projection-expansion, SessionState and ImageInput tests, plus a delegation smoke test on both wire states. - The (ignored, live-agent) integration test switches to future_rpc proto + decode instead of its private generated copy. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * refactor(gui): adopt future-rpc for agent wire decode Batch 9 of the typed-RPC milestone: the GUI Tauri backend joins the shared wire contract (largest consumer — boundary bridge strategy, not per-site typed migration, so every deep read keeps its exact shape). - agent_proto.rs re-exports future_rpc::proto under the historical paths; the checked-in src/generated/proto.rs and the build.rs codegen block are deleted (future-rpc is the single codegen owner; path dependency with aligned tonic/prost versions). - All unary response parses (remote-bridge pass-throughs, get_state deep reads for crash reconcile/watchdog, prompt ack, sync_future_models, models/skills typed structs, session ensure/entries, import, approval reconcile, run control, observer probes) now go through future_rpc::decode::response_data — typed payload first, JSON `data` fallback — returning the same canonical dual-casing Value the deep reads already expect. - Event pipeline (stream.rs persistence + fold, observer.rs forward/ persist/NATS mirror, remote snapshot republish) routes through event_data_json / projected_event_data_json: byte-stable while the agent dual-writes `data` (the original string wins verbatim), typed reconstruction takes over automatically once `data` is retired. - The observer's get_session_events_since reconstruction populates the typed payload so replayed session events decode like live ones. - New wire_decode_tests pin the GUI-facing guarantees: typed/data parity, old-agent fallback, dual-write byte stability, and typed reconstruction without `data`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * build(proto): converge codegen on future-rpc in Makefile and CI Batch 10 of the typed-RPC milestone: the codegen entry points match the new single-owner layout. - `make generate-proto` now regenerates future-rpc (future.proto — server + all clients) and channels (feishu_ws only) plus the TUI embedded proto; the retired agent / gui/src-tauri regeneration lines are gone. - CI rust-quality gains a "proto codegen is fresh" gate: regenerate under REGENERATE_PROTO and `git diff --exit-code` the checked-in generated files, catching proto edits that skipped `make generate-proto` (deterministic for the pinned prost/tonic-build). Verified: a clean-room regenerate of future-rpc + channels is byte-identical (no diff). The TUI/CLI embedded proto syncs when the TS clients adopt the shared package (next batches). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat(rpc): scaffold @future-os/rpc shared TS wire-contract package Batch 11 of the typed-RPC milestone: the TypeScript half of the shared contract, mirroring the Rust future-rpc crate. Standalone and additive — no client consumes it yet (adoption is the next batches). - shared/future-rpc: proto.ts (EMBEDDED_PROTO + a loader configured exactly as the TUI/CLI have always loaded it: camelCase, int64→String, enums→String, defaults, oneofs), decode.ts (responseData / streamEventData — JSON `data` first for migration-window shape parity, typed `payload` oneof as the post-`data` fallback), types.ts (merged superset of the duplicated tui/cli payload types), index.ts. - scripts/generate-proto.ts embeds proto/future.proto into EMBEDDED_PROTO; `make generate-proto` now refreshes it alongside the Rust codegen. - decode unit tests cover data-parse, type-key stripping, and the typed oneof fallback. .gitignore covers shared dist/node_modules. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(rpc): harden shared-package proto embedding + add grpc loader helper Follow-up to the @future-os/rpc scaffold: - generate-proto.ts now anchors on an explicit __EMBEDDED_PROTO_END__ marker instead of a bare backtick-semicolon; future.proto comments legitimately contain backticks and a "`;" sequence, which truncated the EMBEDDED_PROTO template literal on regeneration. - proto.ts: marker-anchored EMBEDDED_PROTO plus loadGrpcAgentProto(), the drop-in grpc.loadPackageDefinition(...).proto replacement the TUI/CLI will adopt. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * build(npm): make shared/future-rpc, tui, cli an npm workspace Prepares TUI/CLI to consume the @future-os/rpc wire-contract package. A single root package-lock.json replaces the per-package lockfiles (gui and mobile keep their own installs — separate toolchains). Node modules hoist to the repo root; @future-os/rpc resolves via workspace symlink. Baseline verified: tui and cli typecheck clean under the new install model. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * build(npm): workspace-aware Makefile + CI for shared package Makefile: a node-workspace target installs the root npm workspace and builds shared/future-rpc; build/test/lint for tui+cli depend on it (gui/mobile keep their per-directory installs). CI: tui/cli jobs run a single root `npm ci`, build shared/future-rpc before typecheck, and cache the root package-lock.json. The changes filter now also triggers tui/cli on shared/future-rpc/** and root manifest edits. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * refactor(tui): adopt @future-os/rpc for proto loading and wire decode Batch 12 of the typed-RPC milestone. The TUI's grpc-client drops its ~770-line EMBEDDED_PROTO copy and the local proto-loader/resolveProtoPath plumbing in favour of the shared wire-contract package: - proto comes from loadGrpcAgentProto() (@future-os/rpc), the single source of truth for the schema and its loader options. - unary responses decode through responseData(); stream events through streamEventData() — both read the typed payload oneof when present and fall back to the JSON `data` string during the migration window. - tui/scripts/generate-proto.ts now only refreshes the CLI's embedded proto (deleted once the CLI adopts the package in batch 13). The TUI's embedded proto is regenerated via shared/future-rpc/scripts/generate-proto.ts. Verified: tui tsc clean, 162 bun tests pass, `bun build --compile` bundles the workspace package (148 modules), and the standalone binary loads the proto and reaches the gRPC connect step at runtime. Also re-syncs the CLI's embedded proto with the payload-extended schema. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * refactor(cli): adopt @future-os/rpc; drop embedded proto from both TS clients Batch 13 of the typed-RPC milestone. The CLI's grpc-client drops its ~770-line EMBEDDED_PROTO copy and local proto-loader/resolveProtoPath plumbing in favour of the shared wire-contract package, completing the TS consolidation: - proto comes from loadGrpcAgentProto() (@future-os/rpc); unary responses decode through responseData(), streamed events through streamEventData() (typed oneof first, JSON `data` fallback during the migration window). - tui/scripts/generate-proto.ts is deleted — no TS client embeds the proto anymore; the single EMBEDDED_PROTO lives in shared/future-rpc/src/proto.ts and is refreshed via its own generate-proto (wired into `make generate-proto`). tui's build no longer runs a proto-embed step. Verified: tui+cli tsc clean, 162+108 bun tests pass, both standalone binaries \`bun build --compile\` (bundle the workspace package) and load the proto at runtime; \`make generate-proto\` regenerates Rust + TS code idempotently. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * docs(rpc): document the typed-RPC wire contract and dual-write policy Batch 14 (final) of the typed-RPC milestone: - future-rpc/README.md: full contract reference — single codegen ownership, the typed payload oneofs at field 20, the dual-write migration policy, encode/decode module map, and the field-number/optional/null-semantics rules. - CLAUDE.md: corrects the stale per-crate codegen note and adds the wire-contract conventions (future-rpc ownership, dual-write, decode fallback, field-number stability) for future contributors. Full gate green: root cargo fmt/clippy/test, GUI backend fmt/clippy/test, tui (162) + cli (108) + shared (10) bun tests, and both standalone binaries compile and load the shared proto at runtime. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(rpc): complete TS type adoption; end duplicated rpc types Review fix for the "shared types.ts is dead code" finding: the TUI and CLI local rpc/types.ts are now thin re-exports of @future-os/rpc, making the shared package the single source of truth for TS RPC payload types and removing ~425 lines of duplicated definitions. - shared types.ts gains PermissionLevel (CLI needs it) and legacy snake_case aliases on SessionSummary / RecentTerminalAck. The agent emits both canonical camelCase and legacy snake_case during the migration window, and client code reads a mix, so the shared types model both. Fields read as required (updated_at, run_id) are typed required to match existing call sites. - tui/src/rpc/types.ts and cli/src/rpc/types.ts become `export type * from "@future-os/rpc"`; all existing `from "./types.js"` imports keep working. The unused promptCmd helper is dropped. Verified: tui+cli tsc clean, 162+108 bun tests pass, both standalone binaries build. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(rpc): address third-party review of the typed-RPC wire contract Fixes from the external review of the typed-RPC milestone: P1 — TS typed fallback never fired: proto-loader with defaults:true materializes an absent `data` as "" (not undefined), and decode only checked `!= null`, so the typed `payload` fallback could never fire once the agent stops dual-writing. responseData/streamEventData now treat an empty string as absent. Adds real-loader-behavior tests (typed fallback fires on "" for both unary and stream). The shape-normalization layer (camelCase/int64/inflate parity with the legacy JSON) is deferred to a follow-up. P1 — CI path filters missed future-rpc: rust_workspace and gui_tauri now include future-rpc/** (and proto/** for the GUI path-dep), so edits to the shared crate revalidate the Rust workspace and GUI backend. P2 — build.rs rerun-if-changed: future-rpc and channels build.rs now declare rerun-if-changed on the proto source, so `make generate-proto` after a proto edit is not skipped by Cargo's build-script cache. P2 — stale standalone proto temp file: resolveProtoPath now derives the temp filename from a content hash, so a binary whose embedded proto changed never reads a stale temp file left by an older build. Deferred (flagged, separate work): release pipelines must build shared/future-rpc before the CLI/TUI; Makefile node-workspace staleness. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * build: build shared @future-os/rpc before CLI/TUI in release pipelines Remaining build-chain fixes from the third-party review: P1 — release pipelines did not build shared/future-rpc/dist: package.json exports point at dist/, which is gitignored, so a fresh runner's `npm ci` left the CLI's `@future-os/rpc` import unresolvable. build.yml, build-macos-signed.yml, build-windows-signed.yml and the local macOS/Windows packaging scripts now install the npm workspace at the root (shared/future-rpc + tui + cli) and run `npm run build` in shared/future-rpc before compiling the CLI. P2 — Makefile node-workspace staleness: the rebuild condition only compared proto.ts, so edits to decode.ts/types.ts/index.ts reused a stale dist. It now rebuilds when any shared/future-rpc/src/**/*.ts is newer than dist. `make clean` also removes the root node_modules and shared/future-rpc/dist. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * refactor(rpc): consolidate proto + rust crate + ts package under future-rpc/ Merge the three wire-contract homes into one directory: proto/future.proto moves to future-rpc/proto/, the future-rpc Rust crate moves to future-rpc/rust/, and the shared/future-rpc TS package moves to future-rpc/ts/. Update every caller: root/agent/channels/gui Cargo.toml workspace members and path deps, loop build.rs proto path, npm workspace + package-lock, Makefile, CI path filters and proto-freshness gate, packaging scripts (dmg + both Windows), .gitignore, and comments/docs. Verified: cargo check --workspace + gui lib, proto regeneration is diff-clean for both Rust and TS, npm build succeeds. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(rpc): clarify TS JSON-first strategy; fix make run targets and CI lockfile refs Address third-party review of the typed-RPC migration: document that TS clients stay JSON-first until replaced by Rust (no typed normalization planned), so the JSON dual-write is not retired prematurely. Fix `make run-tui`/`run-cli` to depend on node-workspace (fresh checkouts otherwise miss the @future-os/rpc dist build), build the rpc package before the CLI in the GUI test scripts, and point the release workflows' npm cache at the root package-lock.json (cli/package-lock.json was removed). Also align stale `proto/future.proto` path references to `future-rpc/proto/` across comments and docs, and fix resolveProtoPath's dev-checkout candidate range. Co-Authored-By: Claude Sonnet 5 <[email protected]> * ci(rpc): trigger TS checks on proto changes and verify embedded proto freshness Editing future.proto now revalidates the CLI/TUI jobs (added future-rpc/proto/** to their path filters) and the proto codegen freshness gate regenerates the TS embedded proto and includes future-rpc/ts/src/proto.ts in its git diff --exit-code, so a proto edit can no longer land with stale TS generated code while CI stays green. Co-Authored-By: Claude Sonnet 5 <[email protected]> * ci(rpc): add Node 24 to rust-quality for TS proto freshness step The proto codegen freshness gate regenerates the TS embedded proto with `node scripts/generate-proto.ts`, which relies on Node 24's native type stripping. The rust-quality job had no Setup Node step, so the runner's preinstalled node (20/22) would fail to parse the TypeScript and the gate could never pass. Add actions/setup-node@v6 pinned to Node 24. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Apply remaining changes Co-authored-by: tallcode <[email protected]> * style(gui): rustfmt the sidecar placeholder helper added by copilot The if/else ext assignment did not match rustfmt 1.97 output, failing `cargo fmt --check` in CI. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: tallcode <[email protected]>
huichen
added a commit
that referenced
this pull request
Oct 27, 2026
A code block's layout is its meaning. Folding a line onto the next one shifts every column after the fold, so box-drawing art, an aligned table and a paste of a TUI screen all come out scrambled: on a phone the launchpad capture `│ |> [Image #1][Image #2] … │` lost its right border onto a second line and the frame below it no longer closed. The block now sits in a horizontal ScrollView with the gutter on its scrolling content, and the virtual rows of a long block stack in a column (a horizontal ScrollView's content is a row, which would have put them side by side). A sideways pan is not contended for by the surrounding message list — the tables in the same file already rely on that — while the nested *vertical* viewport the old comment warned about stays gone; the expand toggle is still what makes a long block's tail reachable. This also matches the desktop, whose `<pre>` scrolls sideways instead of wrapping (`desktop/src/features/markdown/renderers/CodeBlock.tsx`), so the same reply now reads the same on both. Measured in the mobile harness (390×844, headless Chrome, a fenced box-art capture appended to the demo reply): the painted height divided by its line height is 5 for a 5-line source — no line folded — and the scroller carries 81 CSS px of horizontal overflow (scrollWidth 431 vs clientWidth 350) inside a 350 px column. Jest: 150 suites / 2889 tests pass.
huichen
added a commit
that referenced
this pull request
Oct 27, 2026
A code block's layout is its meaning. Folding a line onto the next one shifts every column after the fold, so box-drawing art, an aligned table and a paste of a TUI screen all come out scrambled: on a phone the launchpad capture `│ |> [Image #1][Image #2] … │` lost its right border onto a second line and the frame below it no longer closed. The block now sits in a horizontal ScrollView with the gutter on its scrolling content, and the virtual rows of a long block stack in a column (a horizontal ScrollView's content is a row, which would have put them side by side). A sideways pan is not contended for by the surrounding message list — the tables in the same file already rely on that — while the nested *vertical* viewport the old comment warned about stays gone; the expand toggle is still what makes a long block's tail reachable. This also matches the desktop, whose `<pre>` scrolls sideways instead of wrapping (`desktop/src/features/markdown/renderers/CodeBlock.tsx`), so the same reply now reads the same on both. Measured in the mobile harness (390×844, headless Chrome, a fenced box-art capture appended to the demo reply): the painted height divided by its line height is 5 for a 5-line source — no line folded — and the scroller carries 81 CSS px of horizontal overflow (scrollWidth 431 vs clientWidth 350) inside a 350 px column. Jest: 150 suites / 2889 tests pass.
huichen
added a commit
that referenced
this pull request
Oct 27, 2026
…ash-safe journals (#1384) * fix(mobile): stop folding code blocks — a long line pans instead A code block's layout is its meaning. Folding a line onto the next one shifts every column after the fold, so box-drawing art, an aligned table and a paste of a TUI screen all come out scrambled: on a phone the launchpad capture `│ |> [Image #1][Image #2] … │` lost its right border onto a second line and the frame below it no longer closed. The block now sits in a horizontal ScrollView with the gutter on its scrolling content, and the virtual rows of a long block stack in a column (a horizontal ScrollView's content is a row, which would have put them side by side). A sideways pan is not contended for by the surrounding message list — the tables in the same file already rely on that — while the nested *vertical* viewport the old comment warned about stays gone; the expand toggle is still what makes a long block's tail reachable. This also matches the desktop, whose `<pre>` scrolls sideways instead of wrapping (`desktop/src/features/markdown/renderers/CodeBlock.tsx`), so the same reply now reads the same on both. Measured in the mobile harness (390×844, headless Chrome, a fenced box-art capture appended to the demo reply): the painted height divided by its line height is 5 for a 5-line source — no line folded — and the scroller carries 81 CSS px of horizontal overflow (scrollWidth 431 vs clientWidth 350) inside a 350 px column. Jest: 150 suites / 2889 tests pass. * fix(tui): apply the model row that was picked when two providers share its id The model picker keyed its rows by the bare model id, and `enter` sent that id straight to `set_model`. With two providers offering one id — `future`'s `deepseek-flash` and a `models.json` `westlakehpc/deepseek-flash` — the row picked and the model set were decided by the agent's own resolution order (user-defined models before the built-in catalogue), so choosing the `future` row left the session on `westlakehpc/deepseek-flash`. Rows now carry the `provider/id` reference the desktop and phone clients already send, which is also the canonical spelling the agent persists. The launchpad's model chip and the model lookups behind the thinking-level ring resolve a reference (exact match first, bare id/tail only as a fallback) and cycle over references, so a staged choice names the same model the row did. * fix(rpc): give the journal report the maintenance deadline The run-journal report scans the table it reports on: it sums the payload length of every run_events row, so its cost follows the one table that grows without bound. Measured on a real 4.4 GiB store: 23.8 s for the first, cold, report, and an earlier cold run hit the 30 s STORAGE_TIMEOUT and printed 'Timeout expired' — the diagnostic failing on the database it exists to diagnose. Class it with the reclamation next to it (60 s) instead, and pin the invariant in a policy test. The cheap indexed reads must not follow it there, which the same test asserts. Also pin the sweep's own red line in a store test: entries and message_blocks are byte-identical across a reclamation. * docs(guide): measure run-journal cost and the reclamation procedure A 4.4 GiB agent.db was 76% run_events plus its uniqueness index, and the reads around it were not slow at all: session list, get_state and transcript measured the same at 4.4 GiB and 1.3 GiB. What was unbounded is the journal itself — only a completion notification folds it, and 135 of 1,166 settled runs still held their raw stream. Record the measurement, what the sanctioned sweep does and does not touch, the one-off VACUUM (5.4 s, 4.22 -> 1.30 GiB) with its lock and disk requirements, the backup/restore path, and the leftovers: 50 journals that never got an agent_end, 179 MiB, kept by design. * fix(tui): the rail opens to 60 columns, not 48 The divider stopped at 48 whatever the terminal width, so a file or a session row read in the rail was clipped to a column count the reader could not widen. The ceiling is now 60, which still leaves the conversation more than its 20-column floor at the narrowest frame that shows a rail (88 - 60 - 1 = 27). * feat(cli,agent): add --message-file for verbatim programmatic dispatch `future run` had one way to carry a message from a file: `@<file>`, which wraps the content in a `<file name="…">` block. That shape is right for a human attaching a file in a terminal, and the agent guideline told every programmatic dispatch (agent → agent, sub-session hand-off) to use it for long or non-ASCII payloads — so a dispatched child's first user turn was a file attachment rather than the instruction, and the title derived from that turn started at the wrapper. `host/src/agent_bridge/import.rs` already carries a patch for exactly that symptom. - `--message-file <path>`: the file's bytes ARE the message — no wrapper, no joining, nothing trimmed. Mutually exclusive with a message argument and `@files` (a usage error, not a silent winner). Empty/whitespace-only, unreadable, non-UTF-8 and NUL-bearing (binary) files each fail with their own message instead of sending nothing or truncating. - `@<file>` is untouched, byte for byte: same wrapper, same semantics. - The agent guideline now points programmatic dispatch at `--message-file` and says why `@<file>` is the wrong shape for it; the docs (wiki CLI in both languages, and the self-inspection guide's dispatch section) say the same. - The generic "No prompt provided" line no longer stacks on top of a failed read, so the reported reason is the only one printed. Verified live: a child session dispatched with `--message-file` stored the file's text verbatim (207 bytes, byte-identical) with no `<file` in its first user entry, and a session created that way was titled from the instruction's first line. * fix(agent): map thinking levels onto each model's declared effort vocabulary `westlakehpc/deepseek-flash` answers `reasoning_effort: "medium"` with HTTP 400 ("DeepSeek V4.1 reasoning_effort must be low, high, xhigh, max, or an integer within [1, 100] in chat_template_kwargs"), because the level was sent verbatim: `thinkingLevels` named the picker's levels, not the values that access path accepts. Any model at `medium` failed 100% of the time, and `medium` is one of the shipped levels. Which values a model accepts is now data. A model (or its provider) can declare `compat.reasoningEffort`: { "values": ["low", "high", "xhigh", "max"], "integer": {"min": 1, "max": 100}, "param": "chat_template_kwargs.reasoning_effort" } and each thinking level is mapped onto it, monotone and without dropping a level: a listed spelling travels as itself; an unlisted level travels as the integer at its own point of the provider's range (`medium` -> 50 for 1..=100, the midpoint, because the provider accepts a number but no such spelling); with no integer range it snaps to the closest spelling, ties going shallower (never more effort than the user chose). `param` exists because this gateway accepts the spellings at the top level but a number only under `chat_template_kwargs` (a top-level integer is a 500). A malformed declaration fails model resolution, and a level the vocabulary cannot express is named in a deduped warning when the model is resolved, instead of surfacing as a provider 400 after the user waited a request. Without `compat.reasoningEffort` every model keeps the previous contract (levels are wire values, sent verbatim), so the built-in catalogue is unchanged. `default` still sends nothing and `off` still sends the protocol's disable spelling; neither is used to paper over a refusal. Tests cover the failure shape end to end, every chat format plus the Responses API, the mapping rules and parse errors, and a sweep over every registered model at every level it offers, asserting the value on the wire is one the model declares it accepts. * feat(desktop): step through a folder's images in the preview, and read them at 1:1 Opening a picture from the right-hand Files panel showed one image at a time, so comparing a folder of figures meant closing the overlay and finding the next row by hand. The control bar also reported a percentage relative to "fit", which said 100% for a screenshot that was really being drawn at a third of its pixels — the number could not tell you whether you were looking at the real thing. - The bar now leads with <-/-> and a "2 / 5" readout that walk the images of the directory the row was opened from, in the tree's own order; the arrows disable at the ends, and Left/Right do the same from the keyboard. The list comes from the listing the row was drawn from, so no extra read. A folder with one image, or a preview that is not a picture, shows no stepping at all. - The percentage is now the picture's real scale against its own pixels, and a 1:1 button jumps to it (double-click still toggles fit <-> actual size). "Fit to window" replaces "Reset zoom", which no longer describes what that button does now that 1:1 sits beside it. - MAX_SCALE rises from 6x to 12x of fit so 1:1 stays reachable for very large images, whose fit is a small fraction (an 8000px screenshot in a 1200px window fits at 0.15). - The picture carries a hover hint — scroll/double-click to zoom, drag to pan once zoomed — because dragging at fit cannot move anything (the whole picture is already on screen) and that reads as "drag is broken". * fix(tui): the rail's arrows switch tabs in 文件 too A focused rail answers ←/→ with its neighbour tab, and its own hint row says so (`… · ←→ 页签`) — except on 文件, where the arrows had been given to the tree. There they did nothing at all on a file or on a closed top-level directory, and `→` on a file dropped a preview over the whole screen, so the third tab read as a dead end: the only ways out were `ctrl+1`…`ctrl+3` or the pointer. ←/→ are the strip's on all three tabs again. The tree keeps the keys that are its own: ↑↓ walk, `enter` opens a directory or previews a file, and `⌫` closes a directory or walks up to the one holding the row — the "up one" every file browser has. 文件's hint row names that key (`↑↓ · ⏎ 打开 · ⌫ 收起 · ←→ 页签`), which is the only place it can be discovered, and the other two tabs never claim it. Tests: ←/→ return `SwitchPanel` from four different tree rows (a file, a closed directory, an open one, a picture); `⌫` closes an open directory and climbs out of a nested row; the footer names `⌫` only on 文件. * feat(tui): reasoning starts collapsed, like the desktop The transcript printed the model's reasoning text in full by default, so a streamed reply spent the screen on its own thinking and pushed the answer it had just written off the bottom. The desktop and the phone both start a `Thinking` block collapsed; the terminal was the one client that did not. Reasoning now keeps one `▸ thinking` row at the default level — with the count in the compact view, and the ellipsis only while the reasoning itself is still arriving — and the text lives at the full-process level, so `ctrl+e` alone answers "what did it think?". `render_all_detailed` (the `/transcript` record) reveals it too. The old placeholder hint said `ctrl+o`, which in the workbench opens Preferences, so it is gone with the placeholder. A settled reply already folded to the answer it ends on; that path is unchanged, and the streaming/folding tests now pin the collapsed reasoning alongside it. * feat(tui): a framed user bubble instead of a full-width band A prompt used to be one full row of grey: the background started at the transcript's left edge and ran to its right edge, so the reader's own words looked like a highlight rather than a message, and two prompts in a row read as one striped block. The prompt is now a bubble, the same shape the desktop draws: a rounded frame in the palette's accent, `user_bg` filling only what the box covers, one column of padding either side, right-aligned with a column of margin. It hugs its own text (`hi there` gets a 12-column box, not a 120-column bar) and stops at 64 columns, which is the desktop's `max-w-2xl` inside `max-w-3xl` proportion. The run state (`queued (#2)`, `cancelled`, `merged into the previous run`) moves inside the bubble as its last row — it describes that prompt, and the box now holds everything about the message and nothing else. A column too narrow to frame (under 13 columns of bubble content) keeps the old band, because two borders and two padding columns there would leave almost nothing for the words. Tests: the transcript-row helpers now read *through* the frame (a body row gives back its words, the border rows drop), since fold/seam/spacer assertions are not about the box; three new tests pin the box itself — geometry and right alignment, the width cap with a wrapping prompt, and the narrow-column fallback. * fix(tui): the activity row follows the session, and counts a call once The footer's `思考 · 1071s · 53 工具` belonged to whichever conversation this client last narrated, not to the one on screen: `Live`'s run state (kind, clock, tool tally, rate) is the client's own and nothing dropped it when the reader clicked another row in the rail, so the conversation they had left kept counting there for as long as the TUI stayed open. - `switch`, a fork and `/new` now forget the run this client was narrating (`Live::forget_run`), and the newly attached session takes the row back: `get_state`'s `isStreaming` says whether its run is still in flight, which is what makes a conversation started by the desktop (or by a queued run) show the spinner instead of `idle` until its next event. - `53 工具` was also twice the truth. The agent announces one call twice (`phase: "input"` while its arguments stream, `phase: "execution"` when it runs) and `add_tool_start` dedupes the row, but the counter incremented per event — 26 calls read as 52, and `tool_end` only took one phantom back. The tally is now a set of call ids, and it is a tally for the run (what the row and the demo's `2 tool calls` both say) rather than a count of the calls still open, which would read `0` while the model thinks. `docs/guide/tui.md` says what the row means, since that ambiguity is what let both of these sit: the row describes the conversation on screen, counts one call per call, and starts over at a switch. * docs(screenshots): a sheet for the user bubble's hairline, with and without The user's own messages in a conversation are drawn as a filled bubble with a 1px accent hairline around it. Whether that hairline earns its place is a judgement about a soft edge, so it wants two panels of the same frame rather than an argument: `user-bubble-border-variants` renders the first user message with the border and with the border's colour taken out, injecting a stylesheet so a re-render cannot put the hairline back, and rejecting the capture if the bubble is not fully on screen — a sheet framed on the wrong element would otherwise look plausible. The window is 900 wide and the frame is scrolled last: two 1280 panels halve a 2x capture, and the fixture's approval card settles after boot, which moved the bubble under an earlier scroll. * feat(tui): the rail's 最近 splits into 活跃 and 更早, with a spinner The desktop's recent view files a conversation whose run is still in flight above the ones that have gone quiet, and marks the running row with a spinner. The rail had one flat list, so a run started from another client (or a `/future-goal` worker on the same agent) was invisible here. 最近 now leads with an 活跃 stretch and follows with 更早, each captioned with how many conversations it holds — the desktop's caption in the rail's shape. The two headings are only drawn while both stretches are non-empty: with nothing running the whole list *is* 更早, and a heading saying so would spend one of the rail's twenty rows on nothing. A running row draws the activity row's spinner in its state slot (`SessionRow::streaming`, from the agent's own `isStreaming`); the conversation on screen keeps its `▸` while it is quiet and yields the slot while it runs, because its title is already the accent one. Two things had to follow the flag. The rail's list is re-read every five seconds while the rail is on screen: the agent pushes events for the attached session only, so another client's run reaches this surface no other way, and without it the spinner would freeze mid-turn and 活跃 would never empty. And the tick clock now animates for the rail as well as the activity row, each gated on its band being laid out. Verified on a real pty against the demo agent: the frame shows `活跃 1` / `更早 2` with the spinner on the running row, and the spinner turns through all ten frames at the designed two a second (an earlier `paint |= …` kept a frame owed on every tick, which measured as eight). * fix(tui): the conversation starts under the header's rule, with no gap row The tall layout put the conversation one row below the header (`body_y = header_h + 1`), leaving a row no band paints: title, hairline, a blank line, then the transcript. It cost the conversation a row on every frame, and the frame diagram in `docs/guide/tui.md` draws the transcript directly beneath the hairline, so that gap was the one band nobody could name. The body now starts on `header_h`. Every frame row belongs to a band, and `the_bands_tile_the_frame_without_overlap_or_holes` says so outright (`blank == 0`) instead of allowing one. The rail moves up with it — its tab strip is row 2, not row 3 — so `the_rail_button_collapses_and_reopens_from_the_edge` is pinned to the frame's new shape. * fix(tui): the composer's box is as tall as its draft, not as tall as the cursor A draft typed with ctrl+j lost its closing rule as soon as the reader moved back up a line: the band grew by the cursor's row while the box painted every row of the draft, so the box was taller than the band and its *last* row — the closing rule — was what got cut off. The height now comes from the box itself (widgets::input_content_rows, sharing one window calculation with input_box), measured at the width the box paints at, and the composer passes that room back in so a draft taller than the window scrolls inside the box instead of overflowing it. The hardware cursor follows the row the box reports instead of assuming the draft's last line, and the key handler's line width is the box's own (-4, not -6): one definition of the draft's width for painting, moving and measuring. * feat(tui): delete a conversation, with a chord and a confirm box `future tui` had no way to remove a conversation: the rail only opened rows, `ctrl+r` only switched, and the palette had no verb for it — the agent's `delete_session`, the desktop's thread menu and the client's own `GrpcClient::delete_session` had no surface here. `ctrl+d` is now a rebindable action (`deleteSession`, listed in the shortcut editor and the help overlay), `/delete` is the palette's door to it, and `delete` in a focused rail opens the same box for the row under the cursor. None of them deletes: the box names the conversation and where it lives, and its `enter` is what asks the agent. Deleting the conversation on screen opens the row that took its place, so the transcript never stays on a session the agent no longer has; the last one detaches to the launchpad. A refusal (the agent keeps a session a compaction holds) leaves everything as it was and says why on the notice row. * refactor(tui): drop linear reading Nobody used it, so the option and the native-scrollback reader behind it are gone: `alt+l`, the preferences row, the rebindable `linearReading` action and the settings key it persisted. The workbench now always owns the alternate screen, which removes the mode-switch plumbing in the driver (`sync_mode`, the deferred overlay output, the single-line prompt redraw) and the second terminal start path. `system_theme_id` — the `COLORFGBG` light/dark hint, the one piece of the old `accessibility` module that had nothing to do with reading mode — moves next to the palette it selects. * feat(tui): colour a previewed file by its language The preview box showed every file as one colour of text: a `.rs` file read as a wall of body-coloured lines, with its comments, strings and numbers indistinguishable from its identifiers. `syntax.rs` classifies a preview's lines into keywords, types, called names, strings, numbers, comments, attributes and keys. It names tokens, never colours — `theme::Palette::token` maps them, so highlighted code follows the theme in force instead of arriving in a dark highlighter's palette on a light canvas, which is the one thing a 256-colour theme kit cannot afford to break. It is deliberately not a parser: each line is walked once and only "inside a block comment" or "inside a multi-line string" crosses lines. That covers Rust's raw strings and lifetimes, Python's docstrings and decorators, JavaScript's template literals, JSON/TOML/YAML keys, CSS properties and HTML tags; an unrecognised extension is painted exactly as it came. Classification happens once, when the file is read, and the lines travel as an `Arc<[Line]>` because the adapter rebuilds the frame's data once per event. Tabs are expanded to four spaces on the way in: a literal `\t` in a painted row moves the cursor to the terminal's own tab stop, which is how a tab-indented file tore the frame's columns before. Measured: a 55 KB file classifies in 4 ms in a debug build, 0.4 ms in release; the preview box keeps its exact-rows-of-exact-columns invariant at every size, in both themes (a new render test asserts the keyword colour, the string colour, the muted comment, and that a called name is not a keyword). * feat(mobile): preview any picture in the conversation, and send pictures as pictures On the phone an image in a reply was only reachable through the file-preview flow (download, then the reader), an image linked from elsewhere was not tappable at all, and a picture the user had sent showed up as a paperclip and a file name — so there was nothing to look at, and nothing to tap. - A new full-screen viewer (pinch to zoom, drag to pan, close in the header) is mounted by the chat screen and reached from every picture on it. A reply's image opens it on its already-loaded bytes instead of routing through the file-preview transfer; an image the agent linked with an http(s) URL is now tappable too; a picture inside a previewed document opens it as well. A linked picture still opens its link, and a surface with no viewer mounted keeps the old target rather than growing a button with nowhere to go. - A sent picture is drawn as itself: a bubble that was just sent reads this phone's own copy immediately, durable history reads the desktop copy through the same preview transfer the reply images use, and a refused transfer falls back to the old chip — which is still the way to the file preview and its download/share actions. - The harness could not prove any of this: the mobile mock pointed at port 7392 while `scenarios.json` served assets on 7391, and 7391 belongs to the desktop harness's terminal server, so `serve_assets` "reused" a server that answers 404 and every demo picture was a broken image while the capture reported success. The assets port is 7392 again, `serve_assets` refuses a port held by anything that does not serve the demo figures, and the existing `image` / `image-zoom` scenarios capture again. A new `image-attachment` scenario asserts the bubble draws a thumbnail and that tapping it opens the viewer. * refactor(tui): drop the density preference, always draw the two-row header `ctrl+o` no longer offers 界面密度. The two-row context header it already defaulted to is now the only header: the comfortable five-row identity block, its block-font wordmark and the `density` key in `settings.json` are gone, so a saved `"density": "comfortable"` is simply ignored. Removes the `Density` enum, `PreferenceRow::Density`, `effective_density`, `widgets::wordmark_rows`/`wordmark_width`, and renames `layout_with_preferences` to `layout_with_position` since rail position is the only layout preference left. * feat(tui): a rail that repeats neither its title nor a band of its own The rail's first row restated what the tab strip above it already said — `最近 308 个会话`, `工作区 3 个工作区`, `文件 12 项` — at the cost of one row of every list, so it is gone from all three tabs. The blank row under the tabs stays, and that is the whole heading now. The rows also painted `panel` (235) behind them, which was the only explicit background in the surface: the chat, the composer and the tab strip all keep the terminal's own canvas. On a terminal whose palette is not ours that read as a black rectangle dropped beside the conversation. The rail now keeps the canvas like everything else — the divider column already says where it starts — and `panel` is what fills a menu, a picker or an overlay box, whose frames paint it themselves. * fix(tui): shift+←→ walks the rail's three tabs, shift+↑↓ the conversations The focused rail's footer named `↑↓ 选择 · ⏎ 打开 · ←→ 页签`, which reads as if `↑↓` changed the conversation and `⏎` were the way to switch it. `↑↓` only moves the list cursor (the switch is `enter`, or a key that steps the transcript), and `←→` stop being the tab keys on 文件, where they walk the tree. So the two chords are now the shift pair, in one row at the foot of the rail: shift+←→ 页签 · shift+↑↓ 切换会话 `shift+←`/`shift+→` become a rebindable `PanelPrev`/`PanelNext` (the same intent as `ctrl+1`…`ctrl+3`, one tab at a time): they show a hidden rail, take the keys, and wrap through 最近 → 工作区 → 文件 — including on 文件, where the plain arrows belong to the tree. `shift+↑`/`shift+↓` take over the previous/next session step, and the preview box keeps all four chords so a picture cannot switch the conversation underneath it. * feat(tui): a git panel for the workbench `/git` (or `alt+g`) is a read-only, tig-shaped browser with four tabs: commits (`git log --graph`, 200 commits, decorations), refs (local/remote branches and tags with upstream tracking), changes (the working tree, the same porcelain read `/diff` uses) and stashes. The selected row's detail loads on its own: a commit's stat and patch, a ref's upstream and tip, a file's patch, a stash's diff. Keys inside the panel: `1`-`4` switch tabs, `tab` moves the keys between the list and the detail (a wide box shows both), `enter` opens what is under the cursor (a ref filters the log to it, a changed file opens in the preview box, a commit hands the keys to its patch), `y` copies the sha/ref name/path, `backspace` clears the filter, `r` re-reads and `esc` closes. Rows the log's graph only draws are painted but never selected, and the pointer is held to the same rule. Nothing here stages, commits, checks out, resets or drops a stash: the panel is a reader, like `/diff` and `/worktree`. Every query is argv-only, bounded (one page of log, a capped patch) and has a deadline, so a `git` waiting on another session's rebase lock cannot freeze the frame that asked for it. * feat(tui): a user bubble that is only its background The prompt is drawn right-aligned with a fill of `user_bg`, and it had a rounded accent frame on top of that: two rule rows, two side bars, and a colour that appears nowhere else in the transcript. The frame drew the eye to the box rather than to the words in it, so it is gone — the bubble is its background, one column of padding either side, nothing else. What is left is the same hug around the widest row and the same one-column margin off the transcript's edge, so a prompt still reads as its own block rather than a full-width band. The narrow-column fallback keeps its meaning with two fewer columns of chrome (the plain band now starts below 11 columns, not 13), and the transcript helpers that used to strip the frame no longer have one to strip. * fix(agent): a settled run's journal is foldable when its stream was cut off `agent_end` answered the wrong question. Whether a run is over is what `runs` says — every attempt re-reads it and again under the publish lock — while `agent_end` only says whether the *stream* is complete. The old gate used the second as the first, so it refused exactly the journals a crash leaves behind: truncated streams that will never grow a terminal. Measured on a real store, that was 50 runs / 762k events / 179 MiB kept forever, and they were the ones that most needed reclaiming. Now a truncated stream folds too, once its run has been settled for a minute (the `run_terminal` entry settles `runs` *before* the final event broadcast, so inside that window a producer may still be appending; a minute later it either finished or died). A run with no settle time — a legacy import — has no age to read and keeps its journal. The decision is made from the source read that already ran, so a refusal costs one indexed read instead of a full fold, and the source equality that fences publication now includes the tail's event type. Nothing diagnostic is lost by folding a truncated stream: `DeltaFolder` keeps every non-delta event verbatim — `error`, an unfinished `tool_start`, the partial arguments of a cancelled call — and only merges delta runs, which is what it already did for complete streams. The published snapshot carries exactly the events that were there. `journal.truncated_publishes` counts them durably and the report prints it as `Truncated`. `a_concurrent_append_never_produces_an_inconsistent_snapshot` asserted a gapless index sequence for *both* replay representations, which a folded snapshot cannot satisfy: merging a run of deltas moves the segment's index to the last one it absorbed. It now asserts no duplicate/ordering for both and gaplessness only for a raw journal, which is what those words mean. * feat(agent): a bounded startup catch-up folds what a crash left behind A completion notification only covers a run whose process is still alive when it ends. Everything else — a crash, a stop, an older build, a fold that failed — stayed a raw journal until somebody remembered to run `future session journal --reclaim`. That is how a real store reached 4.4 GiB with 135 of 1,166 settled runs still holding their streams, and the structure that produced it was still there for the next time. The compactor thread now takes one bounded catch-up pass, queued first at start: at most 16 runs and at most 10 s of folding, whichever ends first, with the budget starting after the candidate plan is read (at startup that job waits behind the storage worker's own migration, and billing that wait spent the whole budget before the first fold — measured on a 4.77 GiB store: 33 s of queueing). The plan itself is index-driven, not the sweep's whole-journal GROUP BY, because this runs at startup. Not interrupted mid-fold, so one very large run can exceed the time bound; `has_more` says the next start continues. It is not a timer and not on a request path, and it logs one line either way: folded/examined counts, events, snapshot bytes, truncated, errors, the refusal reasons and the elapsed time. Before this, "the store is quiet" and "the store has no idea" looked identical in a file that stopped shrinking. Measured on a 4.77 GiB copy with 148 settled runs holding raw journals: the first start after the upgrade folded 10 runs (162,544 events, 8 of them truncated) in 10.05 s and reported has_more; the explicit sweep took the remaining 138 (8,162,910 events) and left 0 reclaimable. Every one of the 363 session transcripts was byte-identical at each step. * docs(guide): the fold admission rule, the catch-up, and the second measurement The run-journal page said truncated streams are kept forever. They are not any more, so the page now states what actually decides a fold — `runs` for the run being over, `agent_end` for the stream being complete, the 60 s grace for the producer being gone — with a table of every state and its durable refusal reason, and the two cases that genuinely stay: no settle time to age, and provider deltas that cannot be proven duplicates. Adds the startup catch-up as its own section: the bounds, the fact that it is one pass on the compactor thread rather than a timer or a request path, the exact log line, and how to read it. Records the second measurement on a 4.77 GiB copy — 148 settled runs holding journals, 47 sessions with a crash-cut run, 138 runs / 8.16 M events reclaimed, 0 reclaimable after, 77.6 % off the file, and 0 transcript differences across all 363 sessions at every step. * feat(tui): the files panel moves out of the rail into its own surface The rail listed three things, two of which are true for the whole agent (the conversation list, filed two ways) and one of which is true for the conversation on screen (its workspace). A tree that belongs to a session does not belong in a tab strip of agent-wide lists. 文件 is now its own panel, the way /git is: `ctrl+3` (the chord the third tab answered to), the header's `[ctrl+3] 文件` button, or `/files` opens a box over the frame holding the session's workspace tree. The keys are the tree's own — `↑`/`↓` walk, `⏎`/`→` open, `⌫`/`←` go up a level, `r` re-reads, `esc`/`q` close — and a click on a row is the same verb as `⏎` on it. The rail keeps two tabs: `←`/`→`, `shift+←`/`→`, `ctrl+1`, `ctrl+2` and `/panel`-style verbs walk 最近 and 工作区 only. `PanelId::TABS` is the one list they read, so 文件 cannot be stepped onto by accident. The panel is scoped to the session, like the git browser: opening it re-reads the directory, and `Live::refresh_local` re-scans the tree when the conversation moves to another workspace, so switching conversations never leaves yesterday's tree on screen. The header paints its first pointer button — the app's `[key] label` shape, dropped whole when the row is too narrow to keep the title beside it — and the rows the box paints register their own hit regions, so the same model serves the rail, the narrow-terminal panel and the box. * feat(tui): the prompt is a full-width band again, not a bubble Reverts the framed bubble (`cd8cd659a`) and its follow-up (`d380ca766`), which had taken the frame off but kept the hug and the right alignment. What the reader's own words want here is the plainest thing the surface can do: the prompt on the transcript's left edge, its background running the full width of the column, nothing drawn around it. So `render_user_message` is one loop again — each markdown line as ` line` filled to the column width — and the run state (`queued (#2)`, `cancelled`, `merged into the previous run`) is a full-width dim row under it rather than a row inside a box. The bubble's constants, its row painter, its width cap and the geometry tests that pinned them go with it. * feat(tui): buttons and drag in the picture preview, and sharp zoom The preview box was keyboard-only: a reader with a mouse could zoom with the wheel and nothing else, a picture could not be dragged, and stepping to the next figure meant closing the box and finding the next row in the panel. And the picture itself was decoded to 1024 px, so zooming past 2x showed an upscaled guess rather than detail. - The box opens with a control row: `[缩小] 2x [放大] [适应]` and `[上一张] 2/5 [下一张]`. Every control is a key the box already answered (`+`/`-`/`0`, `[`/`]`), routed through the same handler — the row exists so a pointer does not need the chords, not as a second implementation. A segment that would do nothing (the ends of the folder, the terminals that cannot place a bitmap) is drawn dim, so nothing looks live that is not. - `[` and `]` step through the pictures of the folder the row was opened from, in the panel's own order; the list is read once when the box opens (`files::image_siblings`), and a folder with one picture offers no steps. - Dragging the picture pans it, one cell per cell, clamped by the paint to the picture's own edge. The delta comes from the press cell, so a drop and re-grab never drifts. - A preview is decoded to 2048 px now, which is what a zoom actually shows, while the bitmap transmitted to the terminal is downsampled to ten pixels per cell (`run::transmit_bitmap`): a 2048px photograph across a hundred cells does not ship fifteen megabytes over the pty to be scaled away on arrival. Images in the conversation are not part of this change: the transcript renders Markdown images as nothing today, so they need the message model, the shared renderer and the transcript's hit map to carry a picture's path before a click or `enter` can open it. That is the next step, not a flag away. * fix(tasks): give a run with no answer a reason instead of `completed` An hourly task run that produced no output left `status=completed` and an empty summary, and a `session_retention=delete` task had already thrown the conversation away — nothing said why, so the run could not be attributed at all. The 2026-10-27 sweep lost a whole turn that way (dev was 24 commits ahead of main with no open PR, and the ledger read "completed"). Two defects stacked up: - `agent_bridge::stream` read `cancelled` and `interrupted_by_restart` as clean terminals. The Agent labels a run it cut off exactly that way, so a run the Agent host restarted under was recorded as a finished one. A terminal carrying an `error` was ignored too. - `run_prepared_prompt_inner` marked the local run failed and then returned `Ok(())`, so the task executor saw success and read an empty answer out of the journal. Now the fold maps every non-finishing state to its own termination kind, headless callers are told about the failure, and the ledger records `finish_reason` (`answer` / `empty_answer` / `cancelled` / `interrupted` / `timeout` / `provider_error` / `error`) plus a one-line `finish_note` saying how far the run got (answer size, last tool call). A blank answer is a failure with `[EMPTY_ANSWER]`, not a completion with an empty string. `future task runs --json` (and the phone's ledger view) expose both fields. `future session wait` had the same silent success for delegated sub-sessions: it printed nothing and exited 0 whether the child answered or was cut off. It now names the run's ending and fails on anything but an answer. Goal workers already read the Agent's raw terminal state and never claimed a `completed` run it had not finished; their remaining gap (a completed-but- empty turn counts as success for todos with no evidence contract) is left alone here. * feat(tui): one prefix for the shortcuts — ctrl only, no tmux collisions Every default was either `ctrl+…` or `alt+…` depending on when it was added — `ctrl+m` model beside `alt+m` mouse, `ctrl+r` sessions beside `alt+r` refresh — and five of them were chords the terminal owns: `ctrl+m` is Enter without modifier reporting, `ctrl+1/2/3` are not ctrl chords at all in a legacy terminal, `ctrl+b` is tmux's prefix, `ctrl+v` is some terminals' paste, and `alt` composes a character on macOS unless Option is set to Meta, which is the terminal this surface is developed against. Now every default is a `ctrl` chord (or an arrow with shift), and the map is the fifteen letters that actually arrive: `ctrl+c` quit, `ctrl+n` new chat, `ctrl+r` sessions, `ctrl+d` delete, `ctrl+x` stop, `ctrl+q` queue, `ctrl+e` fold/unfold the process, `ctrl+p` commands, `ctrl+o` model, `ctrl+t` effort, `ctrl+l` language, `ctrl+g` git, `ctrl+s` the rail, `ctrl+f` refresh, `ctrl+v` paste. The rest have no chord and keep a typed door instead: approval `/mode`, workspaces `/workspace`, copy `/copy`, mouse capture `/mouse`, preferences `/preferences`, the newest attachment `/preview` (new command), the files panel `/files`, the rail's three panels (a click, or `shift+←`/`shift+→`), reduced motion (the preferences row). The help overlay prints `—` in the key column for those, the shortcut editor round-trips "no chord" as an empty override, and moving a chord onto such an action takes it from its owner instead of duplicating it. Letters are excluded for stated reasons, documented on `default_key`: a terminal sends Backspace/Tab/`\n`/Enter for `ctrl+h`/`i`/`j`/`m`; `ctrl+a` and `ctrl+b` are the `screen` and `tmux` prefixes; `ctrl+z` is suspend; and `ctrl+u`/`k`/`w`/`y` are the composer's own readline set, which a global chord would shadow. * feat(tui): the desktop's palette family in /theme The TUI had six palettes while the desktop ships fourteen; the reader who picks `tokyo-night` there had nothing comparable here. `/theme` now offers 22: the six the workbench already shipped, unchanged and still first, plus the desktop's own family — `ayu`, `catppuccin`, `everforest`, `gruvbox`, `kanagawa`, `nightfox`, `nord`, `rose-pine`, `solarized`, `tokyo-night`, `vesper` — and `-light` renditions of catppuccin, everforest, gruvbox, rose pine and solarized, because a TUI theme is one rendition and a light terminal deserves more than two choices. Each new palette exists twice, as the file layout requires: a 29-field inline `Theme` (`tui/src/themes.rs`) and a workbench `Palette` (`tui/src/workbench/theme.rs`), same id, same order, both next to the existing six. Hues are nearest-match 256-colour approximations of `desktop/src/theme/palettes.json` (the comments carry the source hex), so the two apps read as one product; backgrounds are the desktop canvas stepped one index for `panel`, `tool_*_bg` and the selection band, which is what a full-screen surface needs and an inline one does not. The tests that pin the catalogue move with it: the frozen id list, the picker's window at 22 rows (a short terminal must still reach the last entry), and a new frame test that renders every palette end to end — a palette is data, and one that broke a row would otherwise only show up on the reader's screen. The i18n guard gains the seven new multi-word names as proper-noun exemptions (BUDGET 34 → 41). Docs: the user guide, the workbench spec's theme item (the frozen colour table stays as the contract for the original six) and the dsh parity table. * docs(tui): the files panel's entry, in the words the ctrl-only map uses The keymap redesign (`ctrl` only, `ctrl+1/2/3` retired) landed while the files panel was being built, so a few sentences still described the old entry: the spec promised `ctrl+3`, and its Chinese half promised `alt+t` — a chord this branch had picked and the redesign ruled out. Neither is back: the files panel keeps the doors it actually has, `/files` and the header's 文件 button, and the shortcut editor still lists the action so a reader who wants a chord can bind one. With every `ctrl` letter either taken (15) or unusable (11: Backspace/Tab/newline/Enter, the screen and tmux prefixes, suspend, and the composer's readline set) there is no letter left to give it. Its help row now says what it opens — "打开本会话的文件面板" — instead of a bare 文件 sitting in a column of descriptions, which is the `HelpKeyFiles` row the table already carried. Also in this pass: the Chinese spec's Keyboard section is brought in line with the English one the redesign rewrote (it still named `ctrl+b`, `ctrl+m` and `alt+z`), the duplicated `shift+←`/`shift+→` row in the zh key table is dropped, and the layout note over `layout_preferences` names `ctrl+s`. Tests: the help table and the shortcut editor print `—` for the chordless rows and never `ctrl+1`/`ctrl+2`/`ctrl+3`. * fix(tui): put the git panel's copy in the table and pin the preview box's protocol The `tui-cli` job failed two ways on the same branch, both for real. `i18n_guard` caught five hardcoded English sentences in `workbench/git_panel.rs` — the panel is new and never reached `workbench/i18n.rs`. Three of them are the panel's own words: a `git` that failed without a message, the empty-repository case (reusing the existing "not a git repository" row), and the ref header's `ahead N · behind N`. They are now `GitNoMessage`, `GitNoRepo` and `GitAheadBehind`, drawn with `t` / `render` in the reader's language. The `git show --format=` template behind a ref's tip is `GitTipFormat`: its `Author:` / `Date:` labels are drawn, so it belongs to the table too. Only the `does not have any commits` comparison — matched against git's own stderr and never painted — is exempt, with an `// i18n:` marker and one BUDGET step (34 → 35). The two preview tests (`the_preview_box_controls_step_through_the_folder`, `dragging_the_picture_pans_it`) asserted that a box drawn for a terminal with the kitty protocol has zoom controls and a drag surface, but never said which terminal that was: they read the process-global capability cache, which `terminal_image`'s own tests leave at whatever they last set — `render_image_iterm2` leaves Iterm2, `render_image_none_capabilities_returns_null` leaves None — and which `the_preview_box_paints_the_picture_and_stays_in_the_frame` overwrites twice mid-run. Outside a kitty/ghostty terminal (CI) detection answers None by itself, so the pair fails every run there; inside one it fails only when a sibling wins the race. `terminal_image::CapabilitiesGuard` gives each such test an exclusive hold that installs its protocol and restores the previous value on drop, and every test that touches the cache now goes through it. Measured: `cargo test -p future-tui --lib` with no kitty/ghostty in the environment failed both tests before (2 of 2 runs), passes 1382 tests twice with the guard; green in the developer's Ghostty env and with KITTY_WINDOW_ID=1 too.
huichen
added a commit
that referenced
this pull request
Oct 29, 2026
Pasting an image writes `[Image #1]` into the draft. Its `#1]` is the marker's own text, but the mention reader takes the token after the last space and only checks that it starts with a sigil, so the paste opened the conversation list with `1]` as the query — and the reader had to dismiss it before sending. A sigil inside a paste-written span (an `[Image #N]` marker or a `[Pasted Content … chars #N]` placeholder) is now part of that token instead of the start of a mention. A `#` typed after the marker still opens the list.
huichen
added a commit
that referenced
this pull request
Oct 29, 2026
Pasting an image writes `[Image #1]` into the draft. Its `#1]` is the marker's own text, but the mention reader takes the token after the last space and only checks that it starts with a sigil, so the paste opened the conversation list with `1]` as the query — and the reader had to dismiss it before sending. A sigil inside a paste-written span (an `[Image #N]` marker or a `[Pasted Content … chars #N]` placeholder) is now part of that token instead of the start of a mention. A `#` typed after the marker still opens the list.
huichen
added a commit
that referenced
this pull request
Oct 29, 2026
… search line (#1417) * test(agent): assert the fence lag a negative answer has to survive The fence lane is worth its one open connection only because the cost is bounded and compensated: a read that does not queue behind the ordered writer cannot see a write that is still queued, so a session whose placeholder commit is waiting reads missing. This asserts that lag directly — the fence answers while the writer is held, the queued create is not visible yet, and the same question answers present once it commits — so a later change that puts the fence back on the writer lane, or a caller that trusts missing without confirming it, has a test to fail. The desktop half of that contract is covered by agent_bridge::tests::presence_fence_tests (missing asked twice, deleted and present once). * test(agent): give the ordered-recovery wait room for a loaded disk recovery_is_ordered_after_already_accepted_appends asserts the order of two entries, not the latency of the commit between them, but it waited only 5 s for that commit to land. Every writer commits with `synchronous = FULL`, so a suite running 32 databases at once can spend longer than that in fsync alone: the full `cargo test -p future-agent` at 32 threads failed here with `Timeout` on 2026-10-29 while the same suite at 8 threads (CI-like) was green twice. The wait stays bounded — a real deadlock still fails — but at 60 s it measures scheduling rather than the disk. No assertion changed. * test(agent): key the reset race hook by session instead of one slot Four tests register a reset-race hook, and the registry held exactly one. Under parallel execution the last registration replaced the others, so a reset found no hook for its own id and succeeded where the test expected `history_changed` — the id gate was there, the storage was not. Measured 2026-10-29: the full `cargo test -p future-agent` failed here with 32 test threads and passed with 8. The registry is now a map keyed by session id, and the hook is removed before it runs: it writes through the same manager, so holding the registry across that work would serialize every other test's reset. Test-only (`#[cfg(test)]`); no production path changes. * fix(tui): typing, pasting and `esc` take the keys back from the rail A focused rail kept the keys while printable characters, pastes and the clipboard chord still reached the draft, so the `enter` that followed one of them opened the rail's selected conversation instead of sending the prompt. On the launchpad that read as "the first message was never sent — the screen jumped to somebody else's streaming session". Editing chords and a second `escape` now blur the rail too, so the keys land where the typing did. The search line keeps its own `escape`: the first one clears the filter, the next one leaves the rail. * fix(tui): leave the rail's tabs to shift+left/right only A focused rail answered the plain left/right arrows by switching between 最近 and 工作区. The rail can hold the keys while the prompt is still on screen — a click on a tab, a conversation opened from a row, `ctrl+d` — and a reader standing in the draft reads those two keys as the caret's, so the rail moved under a caret that never did. The tabs are now `shift+left`/`shift+right` alone (`Action::PanelPrev` / `PanelNext`), which already worked from anywhere. Inside a focused rail the plain arrows are swallowed rather than handed to the editor: that caret is not the reader's, and moving one they cannot see is the same surprise one layer down. * fix(agent): keep the exchanges a backward history page asked for `get_session_entries` counts a backward `limit` in user exchanges, but the canonical branch of `read_display_page` capped the row range at 64 on top of that window. One busy run is far more than 64 display rows on its own (an assistant step and a tool entry per call), so a ten-exchange tail page came back as whatever fitted, the client's missing-user-prefix fetch pulled that run's question in, and the transcript opened on the newest exchange alone — everything above it looked like it had been lost, with no page of it loaded and no sign that any existed. A backward read now takes the window it named. The row ceiling stays on the forward branch, where `limit` counts rows and `nextOffset` resumes them. The canonical page is still bounded: its rows carry no bodies, so the bound moves to the materializer that reads them — the same eight-megabyte budget every other page has, which happens to be exactly what the compatibility branch was already using for its inline bodies. Measured on a real 784-row session: a `limit: 10` tail read returned 64 rows (one exchange) before and 783 rows across all ten exchanges after. * test(host,agent): publish after the event lane exists; give the stop budget room Two required checks were red on #1415 (2026-10-29), and both still fail on the same tests today: - Rust macOS test / host-remote: `remote_peer::runtime_tests:: a_burst_of_events_reaches_the_emitter_in_order` — "the burst never fully arrived". - Rust Windows test / agent: `service::approval_tests:: shutdown_releases_a_blocking_tool_approval` — "Agent shutdown deadline exceeded during journal compactor and SQLite". The burst is a lost-publish race, not a slow stream. `connect_with_emitter` returns once the `SUB` has left the client, not once the broker has applied it: async-nats' `Client::flush()` only flushes the write buffer and awaits no acknowledgement (0.50 has no ping/pong call, contrary to the comment that sat in `session::subscribe` and said an "ordered PONG" was waited for). A publish from the host's *other* connection that reaches the fake broker first is then lost, and NATS Core has no replay — the emitter legitimately never sees it. Held open as a hypothesis only until it was made to fail on purpose: registering the events `SUB` 300 ms late in the fake broker reproduces the CI message verbatim, and `FakeNats::wait_for_sub` in the test turns it green. Two sibling tests in the same file published the same way with the same exposure, so all three now wait for the lane the way the rest of the file already did. The misleading comment in `remote-client/src/session.rs` now says what `flush` does and what it does not buy (production is unchanged: a gap across a reconnect is still healed by `get_events_since`). The shutdown test's 3 s budget was a bound on the Windows runner, not on the drain: its assertions are all final state (approval released, caller joined, `Stopped`), and the slow-lane measurement that landed with #1415 has one writer job holding storage for 18-30 s. The budget moves to 30 s, matching `cli_prompt_and_follow_up_use_real_run_finalization_without_dequeuing_on_shutdown`. No production behaviour changes. * fix(tui): keep the mention menu out of a pasted image marker Pasting an image writes `[Image #1]` into the draft. Its `#1]` is the marker's own text, but the mention reader takes the token after the last space and only checks that it starts with a sigil, so the paste opened the conversation list with `1]` as the query — and the reader had to dismiss it before sending. A sigil inside a paste-written span (an `[Image #N]` marker or a `[Pasted Content … chars #N]` placeholder) is now part of that token instead of the start of a mention. A `#` typed after the marker still opens the list. * fix(tui): keep a running reply's newest step on its own row The transcript is bottom-anchored: its window is the last rows, so a row that disappears at the tail pulls every line above it down, and the next event pushes them back up. The live fold did that once per step — the `▸ thinking…` marker became a count the moment reasoning ended, and each finished call folded into the burst above it — so a turn of eighteen calls jittered the whole conversation 36 times (measured: 8→6→7→8→6… rows per event; the screenshot's 思考… row was the row being removed). A running reply now keeps its newest step — the call in flight or just finished, the reasoning slice being written — on its own row until the next step takes it over, so the transcript only ever grows while a reply streams. Prose keeps the old shape: the summary moves onto the answer, in the row the step vacated. A reasoning slice also shows its marker as soon as it starts, not on its first token. Also rebuild the transcript when a fold's counts move with its structure unchanged (a prose slice's reasoning joining the counts above it) — heads alone said nothing moved, leaving the old numbers and a marker the counts had taken over on screen. * test(host,agent): publish after the event lane exists; give the stop budget room Two required checks were red on #1415 (2026-10-29), and both still fail on the same tests today: - Rust macOS test / host-remote: `remote_peer::runtime_tests:: a_burst_of_events_reaches_the_emitter_in_order` — "the burst never fully arrived". - Rust Windows test / agent: `service::approval_tests:: shutdown_releases_a_blocking_tool_approval` — "Agent shutdown deadline exceeded during journal compactor and SQLite". The burst is a lost-publish race, not a slow stream. `connect_with_emitter` returns once the `SUB` has left the client, not once the broker has applied it: async-nats' `Client::flush()` only flushes the write buffer and awaits no acknowledgement (0.50 has no ping/pong call, contrary to the comment that sat in `session::subscribe` and said an "ordered PONG" was waited for). A publish from the host's *other* connection that reaches the fake broker first is then lost, and NATS Core has no replay — the emitter legitimately never sees it. Held open as a hypothesis only until it was made to fail on purpose: registering the events `SUB` 300 ms late in the fake broker reproduces the CI message verbatim, and `FakeNats::wait_for_sub` in the test turns it green. Two sibling tests in the same file published the same way with the same exposure, so all three now wait for the lane the way the rest of the file already did. The misleading comment in `remote-client/src/session.rs` now says what `flush` does and what it does not buy (production is unchanged: a gap across a reconnect is still healed by `get_events_since`). The shutdown test's 3 s budget was a bound on the Windows runner, not on the drain: its assertions are all final state (approval released, caller joined, `Stopped`), and the slow-lane measurement that landed with #1415 has one writer job holding storage for 18-30 s. The budget moves to 30 s, matching `cli_prompt_and_follow_up_use_real_run_finalization_without_dequeuing_on_shutdown`. No production behaviour changes. * fix(tui): keep the mention menu out of a pasted image marker Pasting an image writes `[Image #1]` into the draft. Its `#1]` is the marker's own text, but the mention reader takes the token after the last space and only checks that it starts with a sigil, so the paste opened the conversation list with `1]` as the query — and the reader had to dismiss it before sending. A sigil inside a paste-written span (an `[Image #N]` marker or a `[Pasted Content … chars #N]` placeholder) is now part of that token instead of the start of a mention. A `#` typed after the marker still opens the list. * fix(tui): break Chinese lines at the width, not at a stray space `wrap_text_with_ansi` retreated to the last space whenever a line overflowed. Chinese may break between any two characters, so a draft with one space inside an otherwise unspaced run of Chinese (an IME habit, not a word separator) broke there and sent the rest of the line down: a pasted paragraph in the composer wrapped into half-empty rows and the box grew a row for each one. A break between two wide glyphs now uses the width itself. Closing punctuation never opens a line (禁则): when the break lands on `,。、`, the glyph before it comes down with it. ASCII word wrapping and the ASCII fast path are unchanged. * fix(tui): keep a running reply's newest step on its own row The transcript is bottom-anchored: its window is the last rows, so a row that disappears at the tail pulls every line above it down, and the next event pushes them back up. The live fold did that once per step — the `▸ thinking…` marker became a count the moment reasoning ended, and each finished call folded into the burst above it — so a turn of eighteen calls jittered the whole conversation 36 times (measured: 8→6→7→8→6… rows per event; the screenshot's 思考… row was the row being removed). A running reply now keeps its newest step — the call in flight or just finished, the reasoning slice being written — on its own row until the next step takes it over, so the transcript only ever grows while a reply streams. Prose keeps the old shape: the summary moves onto the answer, in the row the step vacated. A reasoning slice also shows its marker as soon as it starts, not on its first token. Also rebuild the transcript when a fold's counts move with its structure unchanged (a prose slice's reasoning joining the counts above it) — heads alone said nothing moved, leaving the old numbers and a marker the counts had taken over on screen. * fix(tui): read the cache rate off the prompt, not the prompt plus the reads `cache_percent` divided the cached reads by `cache_read_tokens + input_tokens`, treating `inputTokens` as the uncached remainder. It is not: the agent accumulates the provider's `prompt_tokens` there, and the cached bytes are part of that prompt (`Usage::cached_tokens_exceed_prompt` exists to reject a block where they are not). Adding the reads a second time pins every heavily cached session at a 50% ceiling — measured on this machine's runs, sessions reading 99.5% showed 49.9%, and the footer's "缓存 50%" was that ceiling rather than a rate. Divide by the prompt alone, which is the denominator `models::cache_hit_rate` already uses, and clamp a self-contradicting provider to 100%. * refactor(tui): drop the rail's search line The rail painted a search row in the blank line under its tabs (`/ 搜索会话`, and `❯ 搜索会话▏` while it took keys), and `/` on a focused rail opened it instead of the palette. That row is chrome the reader pays for on every frame, and searching sessions already has a door: `ctrl+r` opens the history picker with its own filter line, which matches the same three fields (title, workspace, id) as the rail did. So the row goes, and with it the second search implementation: - `panels::Filter` collapses back into `Folded` — the rail's only view state is which workspaces are shut, and `rows_with`/`render_with` take it directly; the query/open fields, the needle matching, the count-and-heading overrides and the "no matching sessions" empty state go with it. - `/` on a focused rail is the palette's key, exactly as it is from the prompt; the full-screen panel (`ctrl+d` on a narrow terminal) keeps `esc`/`q`/`↑`/`↓` and nothing else. - `RailSearch`/`RailSearchHint`/`PanelEmptySearch` leave the copy bundles, and the rail footer names only its own chords. Folds are untouched: `enter` on a workspace heading still folds, and `foldedWorkspaces` still survives a restart.
huichen
added a commit
that referenced
this pull request
Oct 29, 2026
A TUI message that carried a pasted screenshot stores the composer's attachment marker in its text, so an unnamed session listed as `[Image #1]现在 tui 中显示展示思考中` — a marker nobody can read, in front of the topic. Markdown in the first message reached the title the same way (`**加粗**`, `` `code` ``, `# 标题`, `- 逐条`). The shared title rule now flattens a message to plain text: composer placeholders (`[Image #N]`, `[Pasted Content N chars(#N)]`) are dropped, emphasis/strikethrough/code marks, headings, quotes, bullets, ordered-list numbers and rules are removed while the text inside them stays, and only delimiters that pair up go — `2 * 3` and `a_b_c` still read as written. A title a model mints is flattened too. `flatten_markup` is the one implementation in `future_rpc::title`; the Agent's bounded paged preview applies it after its scan and skips placeholders before they can spend the width budget, and the desktop/mobile `plainTitleText` mirror carries the same rules with the same tests. (cherry picked from commit 54fbf061c3129b21d1a406542c4b8920b5328ec1)
huichen
added a commit
that referenced
this pull request
Oct 29, 2026
…; plain-text titles (#1420) * fix(tui): keep sessions with no message out of the rail The agent lists a session from the moment a client creates it, before the first prompt arrives. A session opened and never spoken in therefore stayed in the rail as a row with neither a name nor a prompt, and the title fell back to the head of its id — `YYYYMMDD-HHMMSS-<hash>`, so the rail showed `20261019`: a date that is not a title, on a conversation nobody ever had (this store carried ten of them, and finding them by eye was the only way to notice). The desktop never showed them: its importer waits for the first message (`host/src/agent_bridge/import.rs`, `has_message`). The rail is the same view, so it now drops the same rows, decided by the `queryCount` the agent already sends — the TUI simply never parsed it. Filtering happens in `SessionList::replace`, so every reader of the list (the rail, the 工作区 filing, the successor a delete slides into place) walks conversations rather than session records. A peer that predates `queryCount` omits it, and an unknown count is not an empty session: those rows stay, so a client talking to an older agent never loses a history to the filter. `--continue` reads the same rule: `updatedAtMs` moves when the record is written (a storage migration restamps every session), so the newest row can be one nobody ever spoke in, and continuing onto it reopened an empty transcript. * fix(desktop): keep a wheel gesture inside the scroll container it started in WebKit re-targets every wheel event to whatever scrollable element is under the pointer, so a gesture begun in the conversation list carried on in the panel the pointer crossed: that list took the remaining delta and jumped while the list being read stopped where it was. Chromium latches the gesture to its starting element, which is what the layout is built around. Latch it in the app instead: the first wheel of a gesture claims the scroll container under the pointer, and a later event of that same gesture that would scroll a different one is cancelled. A gap ends the gesture, so scrolling one list and then the panel next to it is untouched. * fix(tui): keep a blank row between a folded reply's counts and its answer `▸ 工具调用 62 次 · 思考 39 次` sat on the row directly above the answer's first line, so the counts read as part of the prose they stand above (reported 2026-10-29 against a reply that opened with a table). The summary row is chrome that heads the answer — the demo transcript and the desktop's process fold both leave a row between them — so the answer now starts one blank row below it. A fold that rides on a call keeps the call on the next row: the band already separates the two. * feat(tui): show the session's input, output and cache tokens in the footer The activity row carried the cache hit rate alone, so "命中 50%" was a number with nothing to check it against. It now reads 42 tok/s · 输入 92.0k · 输出 3.3k · 缓存 88.0k · 命中 96% with the counts taken from the same cumulative session usage the panels report (`inputTokens` is the provider's `prompt_tokens`, so the cache figure is checkable by eye: 88.0k of 92.0k). `short_count` grows a `G` tier — a long session's cumulative prompt passes a billion tokens, and `2978.1M` is not a footer number. The tail is the right-hand end of a row it shares with what the session is doing, so it yields cells instead of squeezing that text out: over `budget` it drops the cache count first, then the output, then the input, then the rate, never the hit rate — the one figure no panel repeats. `activity_row` hands it `columns - 22`, the floor the spinner, kind and detail need. Labels are the footer's own keys (`RateInput`/`RateOutput`/ `RateCacheTokens`, `in`/`out`/`cache`), and `CacheLabel` becomes `命中 {}%` / `hit {}%` — two different numbers cannot both be called 缓存 on one row. The demo agent's usage fixture reported more cache than prompt (9.1k input, 88k cache), which no real session can produce. * fix(tui): keep the preview's control buttons on their labels The control row is laid out in display columns, but each segment's hit region was measured with `chars().count()`. A Hanzi is two cells, so `[缩小]` claimed four cells and painted six, and every later button drifted further: in the Chinese UI the row looked live while a click on `[上一张]` landed on the counter beside it and did nothing, and `[适应]` was dead entirely. Measure segments in display columns, clip them to the box (a label the box cuts off is no longer a target), and clip the finished row with `fit` instead of the character-counting loop that could leave a row wider than the box. The existing test clicked the middle of each registered rect, which resolves whatever the rect says — it could not see the labels move. The new test clicks the cell each label is *painted* on, and presses through to the action the key produces. * feat(tui): remember the workspace a new conversation starts in A fresh `future tui` staged its own working directory as the launchpad's workspace, so a terminal sitting in `/tmp` filed every new conversation under a workspace named `tmp` — the workspace picked in the previous session was never stored anywhere. `settings.json` now keeps `lastWorkspace`: the launchpad stages it instead of an ambient start directory (home, a temp directory, the filesystem root), while `cd project && future tui` still opens that project. The value is written when a workspace is chosen (the launchpad's staging, a picker row, a worktree row) and skipped when the directory is gone, so a removed worktree cannot become the next conversation's directory. * fix(tui): spell the billion tier `B`, not `G` Token counts are quoted in `B` (`1B tokens`); `G` reads as gigabytes on a terminal. Same tier, same threshold — only the unit changes. * Revert "fix(desktop): keep a wheel gesture inside the scroll container it started in" This reverts commit f2aeca7. * fix(tui): keep a wheel burst on the surface it began over The wheel was routed per report: whatever the pointer was over when an event arrived got the scroll. A terminal has no gesture, so a trackpad fling or a free-spinning wheel arrives as a long run of reports that follows the pointer — scroll the conversation, move the hand across the divider, and the rest of the gesture walked the rail's session list under a hand that never aimed at it. Latch it: reports closer together than 200 ms are one burst, and a burst stays on the surface it began over (Chromium latches a wheel gesture to its starting element for the same reason). A longer silence is a new burst and scrolls whatever the pointer is over by then, which is what stopping, aiming and rolling again looks like. * feat(tui): open a folded reply as a tree that folds back Opening a folded reply or a burst of work replaced its summary row with the rows it stood for, so the only row that could close it again was gone: an opened fold had no way back (`ctrl+e` changes the level for the whole session, which is not the same thing). The summary row now stays as the fold's header — `▸` turned down into `▾` — and the rows it stands for hang under it, one gutter in, with the rail carried between them. Pressing the header again (`enter`, or a click) folds them away; every row inside the tree still opens its own detail, and a settled reply's answer stays outside the tree because it is the reply's output rather than part of its process. The gutter is paid for by the layout, not added on top of it: a tree row is laid out one gutter narrower and the rail is painted on its band, so a call's background still runs edge to edge and no row outgrows the terminal. * fix(agent): stop the run before waiting on its durable stop marker `ctrl+x` / `/stop` reported `Could not stop the run: Timeout expired` and the run kept going. The stop wrote the session's durable `run_stop_requested` marker first and only then asked the runtime to cancel, so the interruption waited on one append in the store's single ordered writer. Measured 2026-10-29 03:39-03:40 UTC, session 35e316b8, one live `shell` call: - 03:39:18.678 an abort entered the handler, created its marker and blocked in that append; the next four presses each sat behind it (`fault_recovery` serializes stops) past the client's 5 s deadline, so each client reported `Timeout expired` while the run streamed on; - the append finally committed at 03:40:28.6, the cancellation followed in the same millisecond, and the shell was interrupted and the session released 25 ms later — the cancellation works; only its request was late; - the run's journal shows the 71 s hole between the tool call and its result, with the two markers that ever landed. The marker is still started before the run can be interrupted — recovery resumes an unterminated run that carries no `run_stop_requested`, which is exactly what a crash during cancellation must not do — but the stop now waits for it only `STOP_MARKER_GRACE` (250 ms) and then interrupts regardless; a slower write finishes on its own thread. A refused write is a warning: the worst case is a run recovered as `interrupted_by_restart` instead of `cancelled`, never a stop that silently did not happen. Both docs that state the ordering say so, and two tests pin it: a stop cancels a live run even when the journal refuses every insert (it fails on the old order with `success:false, error:"disk failure"` and no cancellation at all), and the marker still names the run the stop cancelled. * feat(tui): centre the tree's rail and nest what a row opens Three follow-ups on the opened-fold tree: - The rail sat in column 1, one column left of the header's `▸`, so it read as hanging off to the side of the block it groups. It now sits in the marker's own column, with a column of air on each side of it. - A row of air under the header: the tree is a block of its own, not the title's next line. - What a row opens — a call's body, a reasoning block's text — now hangs one level deeper, under a rail of its own. At the parent's column it read as another sibling of it; the second level is what makes the fold a tree rather than a flat list beside a rail. Both levels are paid for by the layout: a tree row and its details are laid out narrower and the rail is painted on their band, so no row outgrows the terminal and a call's background still runs edge to edge. * feat(tui): put the chat list on the header, where the app's name was The header's right corner spent its widest form on `● future-tui v…` — a name the row already carries twice (the brand at the left end, the window title) — and on exactly the frames where nothing else fit it was the only thing left. It is now the build number and the connection dot, and the cells that frees pay for a `[ctrl+r] 会话` door beside the panel buttons. The chat list had no pointer route at all: the rail is a keyboard surface, and on a narrow frame it is not even beside the conversation — which is why this door is the last one a short row gives up. The three claims on the row (corner, doors, title) are now spent by one `fit_row` ladder instead of an all-or-nothing group: the whole group is drawn with as much decoration as fits — brand and build number, brand alone, neither — then with doors from the tail, and never with the decoration back. Narrow rows also measure the title's floor against the *frame's* width (`NARROW_WIDTH`), not just its height, so a tall phone-sized terminal keeps the button; the brand and, when it does not fit, the build number are what give way for it. `app_name` leaves `WorkbenchData` with the label nothing else read. * feat(tui): ctrl+c interrupts the run, ctrl+x quits `ctrl+c` is the one chord whose meaning is not ours to pick: raw mode turns `ISIG` off, so the byte arrives as a key, and the reader's expectation of it comes from the shell — interrupt the foreground turn, not close the shell. Bound to a turn in flight it now does exactly that, and with no run in flight it does nothing at all: `Live::abort` asks the client whether one is live before it sends `abort`, where it used to send an empty run id and answer the reader with an error notice for pressing a key at the wrong moment. Leaving moves to `ctrl+x`, a chord nothing else in a terminal teaches, so it is never pressed by reflex; quitting stays the lossless direction (the session and its run are untouched on the agent). The quit guard that runs before every overlay still reads the binding rather than a literal, so the way out is never a modal's to swallow. The exit-signal path no longer forges a `ctrl+c` byte: SIGINT/SIGTERM/SIGHUP/ SIGQUIT now post their own `TerminalEvent::Signal`, or a `kill` would have interrupted a run and left the process alive. Attaching to a session that is already streaming keeps the run `get_state` named — publishing the session id cleared it, which would have made the new interrupt chord a no-op on a terminal that had just attached. Docs follow: the key tables in `docs/guide/tui*.md`, the READMEs (whose TUI table still described the pre-workbench surface), the `--help` text, the queue hint and the parity/redesign notes. * fix(tui): carry the tree's rail through the gap under its header The row under an opened fold's header was empty, which cut the rail the rows underneath hang from: the header, then a gap with nothing in it, then rows that all start with `│`. The gap now carries the rail too — the spine runs from the header to the last row of the fold unbroken. Same row, same column: `push_rail_row` is the one place that draws a rail-only row, and the separator between two rows of one fold now uses it. * feat(tui): draw pasted pictures as thumbnails in the transcript A picture a message carried used to reach the transcript as a markdown caption — the file's name, linked to its path — so the conversation said a picture was there without showing anything of it. It now renders as a small preview: a block of rows the surface reserves, which the terminal fills with the real bitmap (kitty / iTerm2), and the linked caption underneath. `tab` still steps onto that caption (one stop per picture, whatever its block draws) and `enter` opens it in the preview box; a click on the picture itself does the same, which is what a reader aims at. - `session_rows` carries attachments as `ChatMessage::pictures` instead of splicing `` into the content, so the renderer owns the layout - `chat_area` reserves the slot only on a terminal that can place a bitmap; one that cannot keeps exactly the caption it had, and a transcript being copied out keeps the caption without the blank rows - the frame turns each visible block into a placement, and one driver (`run::paint_images`) paints a list of pictures rather than a single one, deleting what the frame stopped asking for - thumbnails are decoded off the event loop, scaled to 320px, and cached per path: a conversation full of attachments decodes the ones on screen * feat(tui): line the rail's and the picker's tails up in columns The session list behind ctrl+r printed `workspace · age` as one string, so the divider landed wherever the workspace name happened to end — and `now` (three cells) against `1m` (two) moved it again on the age side. The rail's two panels had the same problem: 最近's divider drifted with the workspace name, 工作区's with the conversation count, and a conversation's age sat at a third of the row instead of beside the age on the heading above it. Both surfaces now pad each part of the tail to a column measured over the rows they are about to paint: the divider stands in one cell down the list, and every age flushes against the same right edge. A row with no workspace keeps its age in the age column and drops the separator, which otherwise read as a name that had gone missing. The picker's workspace column is capped (long names ellipsise) so a heading cannot eat the title; the rail's is capped by the half-row budget it already had. Also fixes the 工作区 heading row being one cell short of the panel, which put its age one column left of every conversation age under it. * fix(agent): index the symbol keys a conversation teardown checks Deleting one conversation took 113 s of CPU inside the store's single ordered writer, and every other session's writes — including a user stop — queued behind it for 71 s (2026-10-29 03:39 UTC, `session_tombstones` row at 03:39:17.409 through the release at 03:40:28.6; five sessions' journal batches all ended in the same millisecond, which is a queue behind one head job, not five slow writes). The cost was foreign-key lookups. `DELETE FROM sessions` cascades `stream_runs` → `stream_symbols`, and SQLite resolves each child key once per deleted symbol row. Seven of those keys had no index starting with the key column: six symbol references on `stream_contexts` (the scoped indexes lead with `stream_id`, and three are partial on `event_kind`, so none can serve a lookup by symbol) and `stream_body_owners.key_id`. Each lookup scanned the whole child table — 3.7k symbols × 75k context rows. Measured on a copy of the 1.4 GiB store: DELETE FROM sessions WHERE id=<30k-change conversation> before: 113 s of CPU (killed at 120 s) after: 0.29 s The same seven indexes cost 0.33 s to build on the real store at next open (+5.8 MB, 0.4%) and nothing afterwards. They are plain `CREATE INDEX IF NOT EXISTS`, in the schema batch `initialize_schema` always runs, so existing databases gain them without a version bump or a client handshake change, and they are deliberately not part of the compact-storage compatibility contract (a store without them is still correct, only slow). Two tests pin it rather than the numbers: every foreign key on the store is planned, and a lookup that scans fails the test with the child table and columns named. The second test drops the seven indexes, asserts exactly those seven lookups start scanning, then reopens the store and asserts the batch restores them — the upgrade path an existing install takes. * fix(session): name a conversation only after its plain text A TUI message that carried a pasted screenshot stores the composer's attachment marker in its text, so an unnamed session listed as `[Image #1]现在 tui 中显示展示思考中` — a marker nobody can read, in front of the topic. Markdown in the first message reached the title the same way (`**加粗**`, `` `code` ``, `# 标题`, `- 逐条`). The shared title rule now flattens a message to plain text: composer placeholders (`[Image #N]`, `[Pasted Content N chars(#N)]`) are dropped, emphasis/strikethrough/code marks, headings, quotes, bullets, ordered-list numbers and rules are removed while the text inside them stays, and only delimiters that pair up go — `2 * 3` and `a_b_c` still read as written. A title a model mints is flattened too. `flatten_markup` is the one implementation in `future_rpc::title`; the Agent's bounded paged preview applies it after its scan and skips placeholders before they can spend the width budget, and the desktop/mobile `plainTitleText` mirror carries the same rules with the same tests. (cherry picked from commit 54fbf061c3129b21d1a406542c4b8920b5328ec1)
huichen
added a commit
that referenced
this pull request
Oct 30, 2026
`/preview` was the only door to a draft's image and it did not open: the paste writes `[Image #N]` at the head of the draft, so a reader who typed the verb after attaching sent `[Image #1] /preview` to the agent as a prompt (`known_command` reads the first token) and never saw the picture. The row spent a palette slot on a verb that could not be reached from the state it served — the one state where an attachment exists. The count the composer already paints in its title (`· 📎 2 张图片`) becomes the door: `widgets::title_tail_cells` gives the painter and the hit map one answer for the cells that run covers, the composer (and the launchpad, whose box names the draft's pictures the same way) registers them as `input.attachments`, and a click there is `WbAction::PreviewAttachment` — the action the verb used to dispatch. `Action::PreviewAttachment` keeps its row in `/preferences`, so a reader who wants a chord can bind one. The verb goes with its i18n key, its palette row, its surface arm and the `/preview` name the handler tolerated, and the docs name the count instead.
huichen
added a commit
that referenced
this pull request
Oct 30, 2026
… picker, palette trims, /rename (#1436) * perf(tui): the loop stops waiting for the listing, the page above, and git Three doors still awaited their read inside the driver's loop, so the rail, a streaming reply and the keyboard stopped for the whole of it — the same defect the switch had, at less frequent doors. All three now start their read and let the loop's own arm install the answer (`workbench::live::Loaded`), with the answer dropped when the reader has moved on. Measured on this branch (release, 300 ms mock agent for the two agent reads, the real repository for `git`), loop time per door: turn boundary, listing 311.6 ms → 0.021 ms (real: 26–50 ms warm, 10 s cold) turn boundary, state 309.2 ms → 0.006 ms (real: 25 ms) scroll up a page 308.5 ms → 0.004 ms (real: 38–285 ms first read) /git panel 132–287 ms → 0.061 ms (this repository) and the work that moved off the loop costs the same as before when it lands (state 0.007 ms, page 0.021 ms to install). * **turn boundary** — `refresh_state().await` + `refresh_sessions().await` became `begin_state_refresh()` + `begin_sessions_refresh()`; the listing already had a started-not-awaited form for the rail's clock, and the state now has one too (one out at a time, and a failed read still frees the slot, so a decode error cannot wedge the footer for the rest of the session). The approval overlay a state answer can open is decided where the answer lands. * **the page above the transcript** — `Loaded::Older` carries the window it answers (`session_id`, `next_offset`), and `install_older` drops a page for a window the transcript has left instead of prepending rows that do not sit on it. `WbAction::LoadOlder` keeps its waiting form only for a surface with no driver. * **`/git`** — the read already ran on a blocking thread; the loop waited for it anyway. `begin_git_read` starts it and a generation counter drops a view read for a tab the reader has already left, so opening, tab-switching and narrowing the filter all keep the surface live. The three `/refresh`, `/history`, `/tree` verbs took the same treatment: they re-read the listing and the state, and none of them needs to hold the screen while it does. * perf(tui): read the two conversations beside the cursor ahead of the step Stepping between conversations still costs the page read of the one landed on — and on this store that is not small: measured through the real gRPC path at a 300 ms reading cadence, a conversation the agent has not served recently takes 120 ms at the median (225.8 ms for the worst of six, 13.8 ms for the best). The rail makes the next step's destination predictable, so the driver now reads the conversations either side of the cursor in the background as soon as a step settles (`warm_neighbours` → `Live::prefetch_page`). Nothing is installed — the answer is thrown away on purpose, because the agent keeps the page it materialized, keyed by the conversation's revision. Measured the same way: cold step 120.0 ms median (13.8–225.8 ms, n=6) warmed step 18.1 ms median (7.4–61.9 ms, n=6) per step, same conversations' size mix, alternate conversations, both arms paced at 300 ms. What is left on a warmed step is the payload itself (a 1099-row page is still 61.9 ms over the socket), which is the transport, not this. A prefetch costs the agent one page read off the loop; a conversation the reader never opens costs exactly that and nothing else, and a page whose conversation moved on since is keyed by a newer revision and simply read again when opened. A click warms nothing: it is not the start of a walk. * perf(tui): open a conversation on its last three exchanges, not its last ten A switch reads the conversation's tail page before the reader can see anything, and that page was ten exchanges. Three is what a reader needs when a conversation opens; the rest is a scroll away, where each page-up reads ten (`session_older_page` keeps that size: a deliberate page has a screen of reading in front of it). Measured on this machine's store through the real gRPC path, every conversation read once at each size with the order alternating (so the OS file cache warms one arm and one arm only — the bias runs against the change, not for it): 3 exchanges 33.7 ms median (4.2–310.8 ms, n=8) 10 exchanges 49.3 ms median (3.5–254.0 ms, n=8) per conversation, where it bites at all, it also ships a third of the rows: 193 → 62, 66 → 26, 124 → 82. It does **not** help a conversation whose history is one or two huge turns: there three exchanges already is the whole transcript (541 rows, 310 ms either way), because a page is bounded by the entries in it and not by how many turns they belong to. That case needs a page bounded by rows — an agent-side change, kept for its own round with its own numbers. * feat(tui): draw the git log's lane graph one commit per row `/git` showed `git log --graph`'s own drawing: a commit's row plus the connections below it as further lines (`|\`, `|/`), so most of the pane was rows with no commit on them and every lane swap was a diagonal. On this repository the first 60 commits printed as 102 lines, 42 of them bare drawing. The panel now lays the graph out itself, in tig's shape: * one row per commit — the cursor, the detail pane and the reader all work on the same rows, and no row is a drawing; * verticals and elbows (`┐ ┘ ├ ┤ ┬ ┴ ┼`) only, never a diagonal, because a diagonal says two lanes crossed where they in fact join; * a lane keeps its column: a new parent takes a free column to the right of the commit and only appends when there is none, so opening a branch never shifts (or recolours, since colour is the column) the lanes beside it; * every gutters share one width, so the subjects line up in one column. The read is now `--topo-order`, in both the all-refs log and a filtered one: a parent never precedes a child, and a line of work reads as one stretch instead of being interleaved with every other branch's dated commits, which is what lets a lane run from a branch's tip to where it joins. Parents are matched on full ids (`%H`/`%P`), so an abbreviation length that changes mid-log cannot break a lane. A parent past the page keeps its column as a ghost line, which says "the history continues" instead of handing that column to another branch. The demo log is written as the read's own text and parsed by its own parser, so a frame cannot show a graph the panel would never draw. * feat(tui): read the git log by date-time, committer, lanes, subject The log's row led with the subject and ended with the hash, the date and the author — the order that served a graph nobody could align, and the width spent on a hash the detail pane beside it already prints in full. Rows now read left to right as tig's do: 2026-10-30 10:12 chenhui │ ●─┐ Merge branch 'perf/tail-page-3' … * `2026-10-30 10:12` — the committer's date at minute precision, no zone: a `+0800` in every one of 200 rows is six cells that only repeat the local clock. * the committer (`%cn`, which is the person who made this commit, not the author the detail pane names), padded to one width for the page and clipped with an ellipsis past 10 cells; * then the graph, whose lanes now start at one cell in every row — the reason both columns are padded at all; * then the subject and its refs. The hash is gone from the row. Both columns are kept whole or dropped whole: a box too narrow for them *and* a readable subject loses the committer first and the date-time second, so a pane that cannot afford them shows the graph and the subject rather than a title cut to eight cells. At 150 columns the split layout shows both; the list on its own (`tab`) always does. The demo log carries times for the same reason, and its rows still come from the read's own parser. * feat(tui): lead a git log row with the refs, then the subject The row read `subject · HEAD -> dev-huichen, origin/dev-huichen`: what the commit did, then where it sits. Read the other way round — the refs first, as tig prints `[dev-huichen] Merge branch …` — a lane is identified before the work it carries, and a commit with no refs on it still starts at its subject. Only the order of the two pieces changes: the colours, the ` · ` between them, and the way a selected row is one band across both are untouched. A test that took `pieces[0]` for the subject now looks at every piece instead, since which position the subject has depends on whether the commit carries refs. * perf(agent,tui): bound a history page by rows and bytes, not by exchanges alone A page was bounded by ten exchanges and by an 8 MB byte budget that no real page ever reached — a guard that never fires reads as a guard that is not there. The exchange count could not see the expensive case at all: on this store the newest page of a conversation whose history is one huge turn was **541 rows and 1.69 MB**, and that conversation has three exchanges in total. Now a page stops at rows or bytes, whichever comes first, and the client is told it may begin anywhere in the exchange it lands in (`ExchangeStart`, shared with the host's history read, which keeps its completing behaviour). First page, what a switch waits for — 5 runs each, same database file, same client, the two agents run one after the other on it: rows median 87/124/126/138/140 unchanged (a typical page already fit) worst 168 / 541 / 813 / 1574 / 326 → 150 / 150 / 150 / 150 / 150 bytes median 354k/548k/527k/294k/664k → 354k/325k/301k/256k/377k worst 716k / 1.69M / 2.37M / 4.17M / 2.14M → 653k / 548k / 527k / 364k / 1.68M ms median 120/102/79/74/78 → 98/97/85/87/85 worst 205 / 629 / 246 / 360 / 133 → 175 / 180 / 103 / 107 / 117 The one page still at 1.68 MB is a single 1.6 MB entry, which no row or byte cut can split (the fragment path exists for that, and it is one entry the reader will open deliberately). Page-ups to walk a whole conversation to the top are unchanged (worst 12/2/9/3/5 → 14/3/11/4/5). That is why the ceiling is two numbers: the *first* page is capped at 150 rows because a switch waits for it, while a page-up may carry 600 because the reader is already reading and the read no longer holds the screen. Capping every page at 150 was measured first and rejected: the longest conversation then took 37 page-ups instead of 12. A first attempt at this also tried to nudge the cut up to the next call row, so a page would not begin with a tool result that cannot name its own call. It was reverted before landing: one turn is hundreds of consecutive results, so the nudge ate each page and the next request advanced by a row (392 pages for a 541-row conversation, measured). A page now keeps what it read; a result at its top shows its call id until the page above arrives. * refactor(tui): drop the reduce-motion preference and always animate The preferences box (`ctrl+q`) carried a 减少动态 / "Reduce motion" row, and the whole surface honoured it: a rail row painted a still `…` instead of a spinner frame, the activity glyph fell back to `… `, and the ticker stopped advancing under it. The row goes, and with it the setting `reducedMotion`, the rebindable `reduceMotion` action, and the still-mark path in the rail painter: the spinner is the one thing a terminal client animates, and the surface no longer has a way to switch it off. A `settings.json` that still carries `reducedMotion` keeps the rest of its keys — unknown keys are ignored on load and the field is dropped on the next save. * feat(tui): keep a git log row as tight as its own lanes Three sources of air sat between a row's columns and its subject, and two of them were padding: * two spaces separated the committer from the graph, on top of the committer's own cell padding — one is enough for two padded columns; * the gutter was padded to the widest lane *in the whole page*, so a commit that finished after two lanes carried the empty columns of a six-lane fork before its refs. It is now cut at the row's own last lane, with the single cell that separates the drawing from the fields kept. The lanes still start in one cell (that padding stays, it is the graph) and each lane still sits in its own column; * the rows' subjects therefore no longer share one column — they follow their own drawing — which is the trade for not reserving the page's widest graph on every line. The columns' drop rule still measures the *padded* pitch: that number is the same in every row, and a rule reading the trimmed width would show the columns on some rows and not others. * refactor(tui): drop the /transcript palette verb `/transcript` was one of the five entries the workbench once advertised and then answered `Unknown command`. Its replacement answered nothing either: the whole notice named `/export` and `/reply-detail`, both of which the palette already offers on their own rows, so the row spent a slot on a signpost. The command goes with its two i18n keys and its surface arm. `render_all_ detailed` — the full-detail render the *inline* pager used, left without a caller when that pager went — goes too; the one test that used it as "a copy read as text" now reads the ordinary render, which is what a copy is. * fix(tui): list the palette's skills alphabetically The `/` palette's skill column kept whatever order the skills arrived in: the agent reports them in discovery order and the local fallback reads app scope before the shared one, so the same set of skills came out in a different order and the reader had to scan the whole column to find one. Skills now break rank ties by name, so each rank reads alphabetically; commands keep the order they are declared in. * fix(tui): a blank row between a thought marker and the answer The collapsed `▸ 思考` marker is a row about the reasoning, not the first line of the reply — wedged against the prose it read as one paragraph's opening line. It now gets the same blank row the folded reply's count row already has, opened or collapsed. Reported 2026-10-30 against a `思考` marker with `大致可以分成六块,每块 都能真正动手执行…` on the very next row. * refactor(tui): list only the verbs with no other door in the palette The `/` menu (and `ctrl+p`, which opens the same list) carried 33 verbs, and most of them had a door of their own already: a chord (`ctrl+g` for `/git`, `ctrl+n` for `/new`), a row in the preferences box `ctrl+q` (`/theme`, `/lang`, `/mouse`) or a printable key (`?` for `/help`). Each of those spent a row of a one-screen list on a second name and pushed the verbs that have no other way in below the fold. `COMMANDS` is now the sixteen verbs whose typed spelling *is* the way in (`/queue` … `/pin`, `/delete`), in rank order for an empty query, with the two verbs that name a conversation under the rail's cursor last. The other seventeen moved to `TYPED_ONLY`, beside the door each one already has. They are still recognized when typed: the draft is shared between commands and prompts, so a verb dropped from the vocabulary entirely would be submitted to the agent as text — a reader with `/theme` in their fingers must land on the picker, not ask the model what `/theme` means. `known_command` reads both lists, so unlisted is not unhandled, and `every_palette_entry_has_a_handler` walks both so an unlisted verb cannot rot into `Unknown command` either. * docs(agent,rpc): write down the two page-boundary decisions, so they are not undone Both are load-bearing and both look like mistakes when read cold. `ExchangeStart`: one paging call, two modes, on purpose. The host's history read (desktop, mobile) completes the exchange so each page begins at the question its reply answers; the terminal's conversation switch accepts a page that begins mid-turn, because its first page is bounded by rows and bytes (150 rows / 2 MB) and completing the exchange would fetch the whole turn back — 541 rows, 1.69 MB and 629 ms on this store. Making the two agree either way undoes one of them, and the comment says which. `HISTORY_PAGE_BYTE_BUDGET`: an entry is atomic. One larger than the page ceiling is transported as fragments the client reassembles, so a page can still hold a 1.6 MB tool result (a 1.68 MB page) — known, deliberate, and not something to cap again: splitting an entry would break the display projection and the fragment checksum that make a paged read lossless. The price is paid once, when that entry is opened. Comments only; no behaviour change. * refactor(tui): list the command palette alphabetically The sixteen verbs were ordered by what a reader opens the menu for — the queue first, the two verbs that name a conversation under the rail's cursor last. That reads as a ranking only while the list is short enough to see whole; at sixteen rows a reader arrives holding the name they want (`/fork`, `/export`) and scans for it, which a ranking makes harder rather than easier. `COMMANDS` is now declared in name order, so the empty query lists it alphabetically and a filtered query keeps the same shape (the rank sort is stable). `the_command_column_is_alphabetical` asserts both ends of that: the table itself, so a row appended at the end fails instead of quietly landing out of order, and the painted rows, so the stable sort is what actually reaches the reader. The two-column test now reads the leading verb off the list instead of hard-coding one, so it follows the order rather than pinning it. The top of the list is a letter, not a recommendation: `enter` on an empty query runs `/approval`, which says no approval is waiting. * feat(tui): the attachment count opens the draft's picture; drop /preview `/preview` was the only door to a draft's image and it did not open: the paste writes `[Image #N]` at the head of the draft, so a reader who typed the verb after attaching sent `[Image #1] /preview` to the agent as a prompt (`known_command` reads the first token) and never saw the picture. The row spent a palette slot on a verb that could not be reached from the state it served — the one state where an attachment exists. The count the composer already paints in its title (`· 📎 2 张图片`) becomes the door: `widgets::title_tail_cells` gives the painter and the hit map one answer for the cells that run covers, the composer (and the launchpad, whose box names the draft's pictures the same way) registers them as `input.attachments`, and a click there is `WbAction::PreviewAttachment` — the action the verb used to dispatch. `Action::PreviewAttachment` keeps its row in `/preferences`, so a reader who wants a chord can bind one. The verb goes with its i18n key, its palette row, its surface arm and the `/preview` name the handler tolerated, and the docs name the count instead. * refactor(tui): drop the /providers command The `/providers` verb answered with one notice row of provider ids and model counts — the same list the model picker already groups by provider, so it spent a palette row on a second name for information the reader gets where they act on it. Provider configuration stays in the desktop. Removing it takes the palette row, its i18n keys, the adapter handler and the wire call behind it; `/model` and `/tools` are untouched. * refactor(tui): drop the /tree session tree and the /sandbox alias The palette carried two entries that earned no cell: /sandbox was only the older spelling of /mode (its own description said so), and /tree's parent/child view was the only door to a screen /history already answers for. Both go, and the tree overlay they were the only way into goes with them rather than staying as code nobody can reach. * feat(agent): export a session as one readable HTML file /export wrote a wall of pre-wrapped text: every message was escaped and dumped, thinking was dropped, and a tool call and its result sat in separate unlabelled blocks. Rebuild the exporter around the session's own block history instead of the LLM projection: - Markdown renders (tables, task lists, strikethrough and footnotes too); raw HTML is shown as text and javascript: links are neutralised. - Thinking and tool calls are folded, one card per assistant turn, with each call carrying its full input and the result that answers it. - The document is still one file: inline stylesheet and script, images as data: URLs, light/dark following the system (with a toolbar toggle), Expand all / Collapse all and printing unfolded. future session export writes the same file through the same handler. * feat(tui): align the git log's refs column, and drop lanes that carry nothing Two corrections to the row's shape, in opposite directions: the refs go back to one column, and a lane that carries no commit stops taking space at all. **The refs column is aligned again.** Cutting the gutter at each row's own last lane saved space but ragged the list: a two-lane row started its refs twelve cells left of the row above it. The gutter is padded to the page's widest drawing again, so refs and subjects start in one cell — the single space that separates the columns from the graph stays, which is the part of the earlier tightening that did not cost the alignment. **A lane with no commit of its own is not drawn.** `Merge origin/main into feat/x` opens a lane for main's tip; when that line is already being drawn elsewhere — main is merged into every feature branch, or a branch is merged twice — the lane runs down the page carrying nothing and closes at a commit the other lane lands on. The layout now notices: a lane that closes without ever hosting a commit records the parent link that opened it, and the log is laid out again without that link. The covered line keeps its commits; they are drawn once, where they already were. Measured on this repository: the gutter fell from 20 cells to 14 and the long empty parallels are gone. The two passes are enough in practice — dropping a link can only free a column — and the loop is bounded, since anything it still finds is drawn normally rather than dropped on a guess. * feat(tui): rename a conversation with /rename The workbench had every other verb over a conversation — fork it, delete it, pin it, export it — but nothing that names it, so the title a conversation is filed under was whatever the agent derived from its first message. The desktop and the phone both rename through the agent's `set_session_name`; this is the same command, spelled `/rename 新标题`. The words after the verb are the whole name, so a line like `/rename 修 parser` claims the verb and carries the title; a bare `/rename` answers with the usage line instead of asking the agent to title a conversation with nothing, and the launchpad has no conversation to name. The name is installed from the request — header, rail row and the cached copy of the conversation — rather than read back from a listing that costs seconds on a store of any size. The palette lists it because a rename has no chord and no panel: the typed spelling is the only way in. * perf(tui): a transcript scroll is one region scroll, not a whole-band repaint Scrolling moved every row in the transcript band, so the row-by-row diff rewrote all of them — at 180x40 that is the whole 8-9 KB frame for a one-line step, and a terminal (particularly one behind ConPTY) parses and renders every byte of it. The frame cache now recognises a frame that is the one on screen scrolled up inside the transcript's band: it sets the band as the scroll region, sends one `CSI n S`, writes only the n rows that came in at the bottom, and resets the region. Measured on a full-width 40-row frame with a 36-row band (in-process, synthetic rows at a real frame's width; the TUI could not be driven in a terminal here): one-line scroll 8067 bytes → 248 bytes (32x), one `CSI 1 S` ten-line scroll 8067 bytes → 2265 bytes (3.6x), one `CSI 10 S` What is written, verbatim, for a one-line scroll: \x1b[?25l \x1b[3;38r \x1b[1S \x1b[0m \x1b[38;1H \x1b[K <the new line> \x1b[r \x1b[0m Correctness is an equality, not a resemblance, and anything that is not exactly a scroll falls back to the row diff: same geometry, every row *outside* the band identical, and inside the band row `i` equal to row `i + n` for every row above the n that arrived. A row edited in place, a frame that grew in the middle, a resize, an overlay and a change outside the band are all covered by tests. Two things are deliberately not scrolled: * a frame with a **rail**: a terminal scrolls whole rows, and the rail is painted in the same rows as the transcript. The band is only offered when the rail is hidden (the surface's own default) — the reader who opens it pays row-by-row. * a frame carrying an **in-line picture**: the picture is anchored to the rows the scroll would move, so those frames keep the row repaint. Not measured here: the felt latency in a real terminal. The bytes are the proxy, and the second half of the acceptance (Windows Terminal, 100 lines, before and after) is for a human to time — this branch is validated in-process only. * feat(tui): copy and fork controls under each message, like the desktop Every message the reader wrote or the model wrote now ends in a row of controls: `[复制]` under both roles, and `[分支]` under a reply. The desktop draws the same pair in its message footer, revealed on hover; a terminal has no hover, so the row is permanent and the keyboard reaches it — `tab` stops on each chip, `enter` presses it, and a click does the same. * **Copy** puts *that* message's own text (the markdown source, not the painted ANSI) on the clipboard: a prompt back into the draft, a reply quoted elsewhere. A message with no prose of its own — a reply that only called tools, a prompt that was only a picture — draws no chip. * **Fork** branches the conversation at the *user message that produced the reply*, which is what the desktop's fork button means, and calls the same `fork` command `/fork` sends with the point already chosen. It waits until the reply has settled, and refuses with a notice — rather than guessing — when the prompt has no journal entry yet. Making that second one work needed one piece of wiring: the agent already announces the entry it wrote for each accepted prompt (`user_message`, carrying `entry_id` and `run_id`), and nothing consumed it. The adapter now remembers the pair and hands it to the prompt's bubble (by run id, else by the announced text, because a running prompt is never bound by id) — so a reply in a conversation that has never been reloaded is forkable, not just one read back from history. The controls are `RowStop`s like the rows that open things, which is what gives them the keyboard walk and the highlight for free; they name a different hit id (`chat.button.<row>.copy|fork`) because one row carries two targets and a shared id would run the left chip for either. `RowAction::kind()` is now an `Option`: a control has no open/closed state to toggle. Frame tests that read a transcript's own rows filter the control rows out (`ChatArea::control_rows`), and the controls have their own cases — placement, two spans on one row, streaming, and the entry a prompt learns. * refactor(tui): drop the /history verb, ctrl+r holds the session list `/history` and `ctrl+r` were two doors onto the same list: both read `data.sessions`, both filtered on the same three fields (title, workspace and id), and both switched to the row on `enter`. The picker's door is the stronger one — it marks the session in force with a check, keeps the workspace and age in aligned columns, and is reachable from every pane — so the verb the palette also spent a row on goes. Gone with it: `Overlay::History`, its `history_query` field and the three input exceptions it forced on the shared workflow keys (`q` and `space` typed instead of closing/paging, `backspace` edited the filter), `WbAction::OpenHistory` (never emitted), `workflows::filtered_sessions` / `session_table` and the `HistoryMode` enum left over from `/tree`, three i18n keys, and the two rows the guide spent on it. The two behavioural audit cases that drove that list — a scrolled long list and a filtered one, each asserting the row under the pointer opens the session it draws — move to the sessions picker, which is where that off-by-one would now live. The perceptual audit's `history` surface is dropped: its `session picker` surface already covers the shape. * test(tui): a wrapped line proves the scroll band is measured in physical rows The band is a slice of the frame's rows — one string per *screen* row, the transcript's logical lines already wrapped into them — so a wrapped line is a run of consecutive equalities and a scroll that would tear it apart cannot pass the predicate. That was true by construction and undocumented, which is the shape of a bug someone re-derives later: a band taken from *logical* lines would answer "up one line" for something that occupies three rows, hand the terminal `CSI 1 S`, and shift everything below it wrong — while a predicate comparing logical rows would still pass. So this pins it twice: a three-row wrapped line that scrolls as one (the replayed grid must equal the new frame, which a torn run cannot), and the same line re-wrapped in place, which is not a shift and is repainted row by row. The two doc comments (`frame_bytes_since`, `scroll_of`) now say the unit is the physical row and why the band must not be derived from logical ones. * fix(tui): drop the stale `tree` audit page and fail fast on one `/tree` was removed but its page name stayed in the interaction audit's `PAGES`, with no fixture arm behind it, so `fixture()` panicked on the sixteenth page and aborted the run — every page listed behind it (fork, worktree, preferences, keybindings, help, palette and all seven pickers) stopped being audited the moment the verb went. The dead `WbAction::OpenTree` goes with it. The panic now happens before the first page paints: `PAGES` is walked once up front so a name that outlives its feature fails at the top instead of halfway down a list that has already printed fifteen `ok`s. The message says what to do about it. With the run no longer cut short, the audit reaches the end and reports three pre-existing problems on the `queue` page (`queue.open`, `queue.band.0`, `queue.band.1` answer nothing at their own coordinates); they are unchanged from the base commit and belong to the queue band, not to this. * feat(tui): a git log branch hangs off the cell the last one left Two things made the lanes read unlike tig's, which is the shape this panel is modelled on: **A branch that starts where another ends reuses its column.** The merge closes a lane and opens the next one, and the new lane went to the first *free* column to the right — which is one past the column that was closing at that very row. So every merge walked the side line right by two cells: `●─┴─┐` then `│ ●`, then `●─┴─┴─┐`, and the graph drifted away from the line it hangs off. A closing column is now a candidate too, drawn as `●─┤` — the vertical passes through, the horizontal joins it — so a run of short branches stays two columns wide, as tig's does. **A horizontal breaks around a lane that keeps going.** It used to be drawn as `┼`, which claims the two lines touch at that cell; `●─│─┐` says the connection merely passes. The four-way glyph is gone from the vocabulary, and `┤` replaces the `├` that only ever appeared on the closing-and-reopening row (it was pointing the wrong way — the horizontal always arrives from the left). Both are covered by tests: one pins the column reuse row by row, one pins the broken crossing. * feat(tui): name the git log's nodes the way tig does, `o` and `M` Every commit was a `●`, so a merge and a plain commit looked the same until the eye followed the line out to a column and back. tig's two glyphs say it before that: `M` is a commit that joins lines, `o` one that only continues its own. Nothing else moves — the node keeps its lane's colour and the bold weight, the elbows and the broken horizontals are unchanged, and the `●` badge other tabs put in the same gutter ("the branch this checkout is on") stays a `●` because it marks a place, not a commit. * fix(tui): reply-only controls, a blank line above them, and a fork that keeps the answer Three fixes to the message controls, all from reading them on screen: * **A prompt gets no controls.** The copy chip under the reader's own bubble read as part of what they typed — the desktop keeps its copy button there, but a terminal has no hover to separate it from the fill. Their text can be retyped or selected; the row now belongs to replies only. * **One blank line between an answer and its chips.** Wedged against the last paragraph, `[复制] [分支]` read as another line of the answer. The gap is a row of its own, so `tab` still lands on the chips and nothing above moves. * **A fork now carries the reply it was taken from.** The chip (and `/fork`) sent `fork` with an empty `mode`, which the agent reads as `through_entry`: the child ended at the selected user entry, so the answer the reader branched on was missing and the fork opened on a question nobody had answered. The request now says `through_turn` — the mode the desktop's own fork sends — and the child ends with the whole turn: prompt, tool calls and answer. `fork_message`'s test asserts the mode, not just the entry id, because that one field is the bug. * perf(tui): read the branch out of .git/HEAD instead of spawning git A branch name is one line of one file: <gitdir>/HEAD holds ef: refs/heads/<name> while a branch is checked out. Reading it costs a handful of stats and one open, against a process spawn per workspace switch -- 49.91 ms -> 0.254 ms median on this machine (5 runs each, same answer), which on Windows is loader, image checks and the real-time scanner before git has read a single object. A shortcut, not a second implementation of git's naming rules: a detached HEAD (its short sha is core.abbrev's choice), a symref outside refs/heads/, and any tree with no .git above it all fall through to git rev-parse --abbrev-ref. The .git file indirection is followed, so a linked worktree and a submodule still name their own branch. * fix(tui): one `[分支]` under the newest reply, not one under every turn The fork chip landed under every reply, so a conversation of ten turns ended in ten `[分支]` chips — the noisiest thing on the screen, and none of them where the reader was. The desktop it copies draws its fork button in each reply's footer too, but reveals it only under the message the pointer rests on; a terminal has no hover, so the same intent is spelled the other way round: the chip rides the transcript's *newest* reply, once its stream has ended. An older point is still one `/fork` away, which lists every real user message. The chip is one row belonging to a message, so it moves the moment another reply arrives — into a message the incremental append is not redrawing. `ChatArea` therefore records which message carried it (`chip_owner`) and rebuilds instead of splicing when the chip would be left behind somewhere else; a reply starting or ending its stream moves the chip to or from the very message being spliced, which that splice redraws, so streaming deltas still cost one message rather than the transcript (the `a_streamed_delta...` case stays green). Verified on the scripted workbench: the settled transcript now shows one `[分支]` at the end of the last reply, and a reply still streaming shows none. * feat(desktop,mobile): the transcript's up/down pair lands on prompts only Both directions of the corner control now walk the reader's own prompts: down steps to the closest question below, up to the closest above, and a reply is never a stop -- a long answer costs one press to pass instead of one per screenful. What that removes is the machinery that only existed to make a reply a stop: the replyTail rung, the block a reply marked for the jump to measure (data-reply-tail on desktop, the anchor offset reported by the mobile bubble), and the jump lift that consumed it. The walk is now one list of question rows in each client, so the shared types and the tests say so. The tooltip and both locale files name it Next question instead of Next passage. * test(tui): assert the fork chip's refusal in the run's own language The fork chip's refusal is a sentence, and the sentence follows the interface language, which follows the reader's locale (the test attaches with no settings, so English on CI and Chinese on a Chinese desktop). The assertion matched a Chinese fragment, so it was right on exactly one of them, and CI failed on `--lib` while the local run passed. Assert the key's rendering in the language this run resolved instead, which keeps the invariant the test exists for: an unannounced prompt is refused, with the needs-persisted notice, and no `fork` is sent. * feat(tui,agent): `/fork` is the only road to a branch, and it lists answers too A fork chip sat under a reply, then under every reply, then under the newest one — three attempts at the same wrong idea. The desktop can afford a per-message fork button because it is revealed on hover; a terminal has no hover, so any chip is permanent, and a per-message verb on a transcript reads as part of the transcript. So the chip is gone: no message carries a fork control, and `/fork` is the one spelling of the verb, where a command belongs. `/fork` now opens the conversation's own history as a picker: every question the reader asked and every answer the model wrote, in transcript order, each row labelled with whose message it is. Picking one forks **after that message** — `through_entry`, so the child ends with it: pick a question and it stops at the question, pick an answer and it carries the answer. That needed one piece of agent work: `get_fork_messages` only lists user turns (what `session forks` and the desktop's fork button ask for), so a new `get_fork_entries` returns the whole settled history. "Settled" is the point of it: the entries a run is still writing are not candidates, because there is no answer to stop at yet — so while a reply streams, the newest row the picker offers is the prompt that started it, which is exactly the rule the reader stated. The demo agent in `tui/examples` answers it from the scripted journal, so a picker frame names the rows the transcript beside it names. Removing the chip also removed the plumbing that existed only to serve it: the per-prompt `user_message` → entry-id bookkeeping, `ChatMessage::entry_id`, the `fork_owner`/`chip_owner` render bookkeeping, the `RowAction::Fork` stop and its `chat.button.*.fork` hit region, and two i18n keys. `[复制]` is untouched — it is a copy button, not a verb that already has a command. * fix(tui): read the clipboard on alt+v on Windows, where the console owns ctrl+v Windows Terminal — the console Windows 11 opens a shell in — binds `ctrl+v` to its own paste, which carries text and can never carry an image. The byte never reached the TUI, so pressing it with a screenshot on the clipboard did nothing, and the app *has* to read the clipboard itself for an image to travel at all. The clipboard chord is now `alt+v` on Windows: it arrives as `ESC v` from either Windows front end (conhost and Windows Terminal) and no front end claims it. `ctrl+v` stays the chord everywhere else and `/paste` stays the typed door for anyone who rebinds it away. The keymap's "no alt default" rule is scoped to platforms with a composing Option (macOS), which is the reason it existed; the help overlay and the shortcut editor already read `Action::default_key`, so both now name the chord the platform really has. `docs/guide/tui{,.zh-CN}.md` and `docs/tui/workbench-spec{,.zh-CN}.md` say which chord Windows uses and why. * feat(goal): workers inherit the supervisor's model/thinking, and every run records which case applied `--model` / `--thinking-level` are per-run flags and were applied only when given, silently. With no goal-level default that made one pasted command line the de-facto configuration of every worker in a goal (measured: 13 dispatches, 9 of them carrying the same `--model --thinking-level high --max-turns 8`, no re-judgement in between), and an override left no trace in the log or the run header. - Fresh worker session: with neither flag, `future goal run` reads the session recorded by `supervisor register` (`get_state`) and applies its model and thinking level. With no supervisor to read it sends nothing and lets the agent's own default stand - no guessed constant here. - A resumed session (`--resume-session`) keeps the configuration it already has; only explicit flags touch it. Inheriting there would rewrite a running conversation's model because the supervisor happens to differ. - An explicit flag is still an override, now printed (`worker ... (override; supervisor was ...)`) and stamped in the run header. - `run_header` always carries `model` / `thinking_level` / `model_source` (`supervisor` | `override` | `default` | `session`), including the `default` shape, so a missing field keeps meaning "older log" and never "nothing was overridden". Values are read back from the agent after applying, not the caller's intent. - Resolution is a pure function with unit tests for all four cases plus the console line; `run_header` has its own test including a legacy line. Deliberately NOT changed: agent-side inheritance from `parent_session`. That field is lineage (desktop sidebar, forks), not a configuration source, and "supervisor" is a goal-plane concept - changing it would alter child-session behaviour for desktop/mobile without a requirement. Skill documentation (`skills/builtin/future-goal/SKILL.md`) lives in the `skills` submodule, so its correction ships as a companion PR there (futuregene/future-skills#108) rather than in this commit. * chore(skills): bump the skills submodule to f153e3c (worker-config inheritance) * perf(rpc): reach the paging loop through one state machine, not two `read_page` only ever added a constant to `read_page_from`, but as an `async fn` it paid for that constant with its own state machine nested inside the caller's. In a debug build that nesting is real stack, and the caller it matters to is the host's history read — the deepest `await` chain in `future-host` (`remote_host::business` -> `history::execute` -> the page read -> the agent call), which runs on a worker thread with the platform's default stack. Measured on the `remote::commands::bridge_tests` group, which reaches that chain, by bisecting the smallest worker stack the test runtime's `thread_stack_size` still survives with (arm64 debug, 8 KiB steps): before this commit: 2017280 B (1970 KiB) after this commit: 1937408 B (1892 KiB), i.e. the pre-branch cost That 78 KiB is what took `Rust Windows test / host-remote` over the edge: the chain sat at 92% of a worker's 2 MiB stack, and MSVC debug frames are wider than arm64 ones, so the extra layer was the difference between passing (as `main` does) and STATUS_STACK_OVERFLOW. Returning the future directly removes the layer instead of moving the ceiling. No behaviour change: the paging loop, `ExchangeStart` semantics and every assertion stay as they were. --------- Co-authored-by: agent <agent@local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When selecting Claude Sonnet 4.6 or Opus 4.8 in the Future agent and setting thinking level to "off", the model still produces reasoning/thinking content.
Root Cause
Claude models use
include_reasoningas their thinking parameter in the Future API, butderive_thinking_compatdid not match it. This leftcompat_thinking_formatempty, causingapply_thinking_paramsto return early when thinking was set to "off" — no disable directive was ever sent to the API.Fix
Add
include_reasoningto the deepseek-format condition inderive_thinking_compat. When thinking is "off", the deepseek format sendsthinking: {type: "disabled"}to the API server.Companion PR
Requires https://github.com/futuregene/future-server/pull/new/fix-claude-thinking-off for the server to handle the
thinking.type="disabled"field and translate it to Anthropic{type: "disabled"}.Testing
cargo check— passescargo test --lib— all 114 tests passcargo test helpers— all 15 thinking params tests passcargo test models— all 16 model tests pass🤖 Generated with Claude Code