@lucascouts/claude-agent-tui 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/NOTICE +1 -1
  2. package/README.md +1 -1
  3. package/dist/acp-agent.d.ts +153 -8
  4. package/dist/acp-agent.js +356 -17
  5. package/dist/agent-catalog.d.ts +0 -1
  6. package/dist/ansi-mirror.d.ts +0 -1
  7. package/dist/besteffort.d.ts +0 -1
  8. package/dist/billing/entrypoint-guard.d.ts +0 -1
  9. package/dist/claude-path.d.ts +0 -1
  10. package/dist/command-catalog.d.ts +84 -0
  11. package/dist/command-catalog.js +339 -0
  12. package/dist/diff-enriched-reader.d.ts +0 -1
  13. package/dist/diff-source.d.ts +0 -1
  14. package/dist/drift-checks.d.ts +0 -1
  15. package/dist/end-of-turn.d.ts +0 -1
  16. package/dist/engine-lifecycle.d.ts +0 -1
  17. package/dist/engine-pty.d.ts +0 -1
  18. package/dist/engine-watcher.d.ts +0 -1
  19. package/dist/engine.d.ts +0 -1
  20. package/dist/event-switch.d.ts +0 -1
  21. package/dist/gate/port.d.ts +0 -1
  22. package/dist/gate/settings-writer.d.ts +0 -1
  23. package/dist/image-input.d.ts +0 -1
  24. package/dist/image-vision-smoke.d.ts +0 -1
  25. package/dist/index.d.ts +0 -1
  26. package/dist/index.js +20 -2
  27. package/dist/jsonl.d.ts +0 -1
  28. package/dist/lib.d.ts +0 -1
  29. package/dist/linearize.d.ts +1 -2
  30. package/dist/linearize.js +1 -1
  31. package/dist/live-diff-env.d.ts +0 -1
  32. package/dist/live-subagent-env.d.ts +0 -1
  33. package/dist/mcp-config-writer.d.ts +0 -1
  34. package/dist/model-catalog.d.ts +107 -10
  35. package/dist/model-catalog.js +233 -25
  36. package/dist/permissions/allow-inject.d.ts +0 -1
  37. package/dist/permissions/deny.d.ts +12 -1
  38. package/dist/permissions/deny.js +18 -0
  39. package/dist/permissions/elicitation-bridge.d.ts +71 -0
  40. package/dist/permissions/elicitation-bridge.js +146 -0
  41. package/dist/permissions/gate-wiring.d.ts +23 -3
  42. package/dist/permissions/gate-wiring.js +123 -1
  43. package/dist/permissions/hook-server.d.ts +11 -3
  44. package/dist/permissions/hook-server.js +10 -1
  45. package/dist/permissions/permission-mode.d.ts +0 -1
  46. package/dist/permissions/request-permission.d.ts +0 -1
  47. package/dist/settings.d.ts +0 -1
  48. package/dist/stop-reason-map.d.ts +0 -1
  49. package/dist/subagent-gate.d.ts +0 -1
  50. package/dist/subagent-source.d.ts +0 -1
  51. package/dist/subagent-watcher.d.ts +0 -1
  52. package/dist/tools.d.ts +0 -1
  53. package/dist/tools.js +20 -0
  54. package/dist/usage-env.d.ts +0 -1
  55. package/dist/usage.d.ts +0 -1
  56. package/dist/utils.d.ts +0 -1
  57. package/dist/zed-register.d.ts +0 -1
  58. package/package.json +13 -10
  59. package/dist/acp-agent.d.ts.map +0 -1
  60. package/dist/agent-catalog.d.ts.map +0 -1
  61. package/dist/ansi-mirror.d.ts.map +0 -1
  62. package/dist/besteffort.d.ts.map +0 -1
  63. package/dist/billing/entrypoint-guard.d.ts.map +0 -1
  64. package/dist/claude-path.d.ts.map +0 -1
  65. package/dist/diff-enriched-reader.d.ts.map +0 -1
  66. package/dist/diff-source.d.ts.map +0 -1
  67. package/dist/drift-checks.d.ts.map +0 -1
  68. package/dist/end-of-turn.d.ts.map +0 -1
  69. package/dist/engine-lifecycle.d.ts.map +0 -1
  70. package/dist/engine-pty.d.ts.map +0 -1
  71. package/dist/engine-watcher.d.ts.map +0 -1
  72. package/dist/engine.d.ts.map +0 -1
  73. package/dist/event-switch.d.ts.map +0 -1
  74. package/dist/gate/port.d.ts.map +0 -1
  75. package/dist/gate/settings-writer.d.ts.map +0 -1
  76. package/dist/image-input.d.ts.map +0 -1
  77. package/dist/image-vision-smoke.d.ts.map +0 -1
  78. package/dist/index.d.ts.map +0 -1
  79. package/dist/jsonl.d.ts.map +0 -1
  80. package/dist/lib.d.ts.map +0 -1
  81. package/dist/linearize.d.ts.map +0 -1
  82. package/dist/live-diff-env.d.ts.map +0 -1
  83. package/dist/live-subagent-env.d.ts.map +0 -1
  84. package/dist/mcp-config-writer.d.ts.map +0 -1
  85. package/dist/model-catalog.d.ts.map +0 -1
  86. package/dist/permissions/allow-inject.d.ts.map +0 -1
  87. package/dist/permissions/deny.d.ts.map +0 -1
  88. package/dist/permissions/gate-wiring.d.ts.map +0 -1
  89. package/dist/permissions/hook-server.d.ts.map +0 -1
  90. package/dist/permissions/permission-mode.d.ts.map +0 -1
  91. package/dist/permissions/request-permission.d.ts.map +0 -1
  92. package/dist/settings.d.ts.map +0 -1
  93. package/dist/stop-reason-map.d.ts.map +0 -1
  94. package/dist/subagent-gate.d.ts.map +0 -1
  95. package/dist/subagent-source.d.ts.map +0 -1
  96. package/dist/subagent-watcher.d.ts.map +0 -1
  97. package/dist/tools.d.ts.map +0 -1
  98. package/dist/usage-env.d.ts.map +0 -1
  99. package/dist/usage.d.ts.map +0 -1
  100. package/dist/utils.d.ts.map +0 -1
  101. package/dist/zed-register.d.ts.map +0 -1
package/NOTICE CHANGED
@@ -10,5 +10,5 @@ This product is a derivative work of:
10
10
 
11
11
  The engine was rewritten to drive the Claude Code subscription TUI over a
12
12
  pseudo-terminal (PTY) instead of calling the Claude Agent SDK. See
13
- .fork-provenance.json (fork point: v0.39.0) and CHANGELOG.md for the scope
13
+ .fork-provenance.json (fork point: v0.53.0) and CHANGELOG.md for the scope
14
14
  of modifications.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  An [ACP](https://agentclientprotocol.com)-compatible agent that drives the **Claude Code subscription TUI** over a PTY, so your Claude Code threads render natively in [Zed](https://zed.dev) and other ACP clients.
6
6
 
7
- > **Fork** of [`@agentclientprotocol/claude-agent-acp`](https://github.com/agentclientprotocol/claude-agent-acp) v0.39.0. Where the upstream adapter calls the Claude Agent **SDK**, this fork spawns the `claude` **subscription CLI** in a pseudo-terminal and translates its JSONL transcript into ACP `session/update` notifications. See [`.fork-provenance.json`](.fork-provenance.json) for the exact fork point.
7
+ > **Fork** of [`@agentclientprotocol/claude-agent-acp`](https://github.com/agentclientprotocol/claude-agent-acp) v0.53.0. Where the upstream adapter calls the Claude Agent **SDK**, this fork spawns the `claude` **subscription CLI** in a pseudo-terminal and translates its JSONL transcript into ACP `session/update` notifications. See [`.fork-provenance.json`](.fork-provenance.json) for the exact fork point.
8
8
 
9
9
  ## Why this exists
10
10
 
@@ -1,4 +1,4 @@
1
- import { Agent, AgentSideConnection, AuthenticateRequest, CancelNotification, ClientCapabilities, ForkSessionRequest, ForkSessionResponse, InitializeRequest, InitializeResponse, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, ResumeSessionRequest, ResumeSessionResponse, SessionConfigOption, SessionModeState, SessionNotification, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModeRequest, SetSessionModeResponse, CloseSessionRequest, CloseSessionResponse, DeleteSessionRequest, DeleteSessionResponse, TerminalHandle, TerminalOutputResponse, WriteTextFileRequest, WriteTextFileResponse } from "@agentclientprotocol/sdk";
1
+ import { Agent, AgentSideConnection, AuthenticateRequest, CancelNotification, ClientCapabilities, ForkSessionRequest, ForkSessionResponse, InitializeRequest, InitializeResponse, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, NewSessionRequest, NewSessionResponse, PromptRequest, PromptResponse, ReadTextFileRequest, ReadTextFileResponse, ResumeSessionRequest, ResumeSessionResponse, SessionConfigOption, SessionModeState, SessionNotification, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModeRequest, SetSessionModeResponse, CloseSessionRequest, CloseSessionResponse, DeleteSessionRequest, DeleteSessionResponse, LogoutRequest, LogoutResponse, TerminalHandle, TerminalOutputResponse, WriteTextFileRequest, WriteTextFileResponse, AvailableCommand } from "@agentclientprotocol/sdk";
2
2
  import { ModelInfo, Options, PermissionMode, PermissionUpdate, SDKMessageOrigin, SDKPartialAssistantMessage } from "@anthropic-ai/claude-agent-sdk";
3
3
  import { ContentBlockParam } from "@anthropic-ai/sdk/resources";
4
4
  import { BetaContentBlock, BetaRawContentBlockDelta } from "@anthropic-ai/sdk/resources/beta.mjs";
@@ -31,6 +31,7 @@ type AccumulatedUsage = {
31
31
  cachedReadTokens: number;
32
32
  cachedWriteTokens: number;
33
33
  };
34
+ export declare const DEFAULT_CONTEXT_WINDOW = 200000;
34
35
  type Session = {
35
36
  /** The live PTY handle (story 013/014) running the subscription `claude` TUI for this session. */
36
37
  pty: IPty;
@@ -107,11 +108,14 @@ type Session = {
107
108
  */
108
109
  agents?: AgentCatalogEntry[];
109
110
  configOptions: SessionConfigOption[];
110
- /** Context window size of the last top-level assistant model, carried across
111
- * prompts so mid-stream usage_update notifications report a correct `size`
112
- * before the turn's first result message arrives. Defaults to
113
- * DEFAULT_CONTEXT_WINDOW, refreshed from each result's modelUsage, and
114
- * invalidated when the user switches the session's model. */
111
+ /** Context window size for the session, carried across prompts so mid-stream
112
+ * usage_update notifications report a correct `size` before the turn's first
113
+ * result message arrives. Seeded by `inferContextWindowFromModel` (the static
114
+ * `MODEL_CONTEXT_WINDOWS` curation) and re-resolved when the user switches the
115
+ * session's model. NOTE (story 068): there is NO `result.modelUsage` refresh —
116
+ * the JSONL `usage` block carries only token counts, never a window; the window
117
+ * comes from static curation (the Models API `max_input_tokens` is the real
118
+ * authority, which this PTY/JSONL fork does not call). */
115
119
  contextWindowSize: number;
116
120
  /** Accumulated task list for the session, keyed by task ID. Task IDs are
117
121
  * per-session, so this state must not be shared across sessions. */
@@ -164,6 +168,23 @@ type Session = {
164
168
  * `default`) is re-selected. The declarative spawn-time complement is {@link applyUltracodeSettings}.
165
169
  */
166
170
  ultracodeActive?: boolean;
171
+ /**
172
+ * Story 073 (R2.3/R3.2) — the session's CURRENT fast-mode on/off state (default off). Set by
173
+ * {@link applyFastModeChange} and read by {@link buildConfigOptions} for the `fast` option's
174
+ * `currentValue`. Reset to `false` on a switch away from an Opus model (R4.1).
175
+ */
176
+ fastModeOn?: boolean;
177
+ /**
178
+ * Story 073 (R1.3) — cached fast-mode availability for this session (the {@link FastModeProbe}
179
+ * result). `undefined` = not yet probed; `false` = unavailable/non-Opus (option omitted); `true` =
180
+ * available (option advertised). Re-probed on a return to an Opus model (R4.2).
181
+ */
182
+ fastModeAvailable?: boolean;
183
+ /**
184
+ * Story 073 (R3.1) — a `/fast on|off` inject requested WHILE a turn is in flight is deferred here
185
+ * (last-write-wins) and flushed once the turn settles (mirrors {@link pendingEffortInjection}).
186
+ */
187
+ pendingFastInjection?: boolean;
167
188
  /**
168
189
  * Story 046 (R3.8) — true WHILE an in-place re-spawn (R3.4 dontAsk/bypass switch) is between the old
169
190
  * PTY teardown and the new PTY being ready. Selector changes arriving in this window are rejected
@@ -330,6 +351,43 @@ export interface StartEngineArgs {
330
351
  }
331
352
  /** The createSession injection seam: spawn the PTY engine + JSONL watcher + locate the transcript. */
332
353
  export type StartEngine = (args: StartEngineArgs) => Promise<StartedEngine> | StartedEngine;
354
+ /** Context passed to a {@link FastModeProbe}: enough to drive/observe the live PTY when the real
355
+ * detector is wired (story 073 Task 1), without exposing the private `Session` type. */
356
+ export interface FastModeProbeContext {
357
+ pty: IPty;
358
+ cwd: string;
359
+ }
360
+ /**
361
+ * Story 073 (R1) — the fast-mode availability-detection seam. Returns whether fast mode (`/fast`) is
362
+ * available for THIS session's account. The production default {@link defaultFastModeProbe} fails CLOSED
363
+ * (returns `false`): the live spike (Task 1) found that OBTAINING the signal requires DRIVING `/fast`
364
+ * over the PTY (there is no passive signal when gated — verified live), and an unsolicited session-start
365
+ * PTY write violates the fork's read-only-load (R4.3) and no-Ctrl+U-in-closed-loop invariants. The live
366
+ * driver therefore ships as the OPT-IN {@link driveFastModeProbe} (wired via `deps.fastModeProbe` after
367
+ * the R7.3 live-proof), not as the default. Tests inject a fake returning `true` to exercise the
368
+ * advertise/apply/reconcile paths (R2–R4).
369
+ */
370
+ export type FastModeProbe = (ctx: FastModeProbeContext) => Promise<boolean> | boolean;
371
+ /** Production default — fail-closed (R1.2), invariant-safe: performs NO PTY write, so it preserves the
372
+ * read-only-load (R4.3) and no-unsolicited-Ctrl+U invariants. The live signal is characterized (see
373
+ * {@link classifyFastModeSignal}) and the live driver is {@link driveFastModeProbe}; wiring it as the
374
+ * default is deferred to the R7.3 live-proof + a non-intrusive (idle-gated) wiring follow-up. */
375
+ export declare const defaultFastModeProbe: FastModeProbe;
376
+ /**
377
+ * Story 073 (R1) — the OPT-IN live fast-mode detector (Task 1 spike + Task 3.1 parser). Opens the
378
+ * `/fast` panel via the SAME live PTY inject as `/effort` (no re-spawn, no `-p`/credit path — R3.3),
379
+ * collects the panel text on a temporary onData listener, classifies it with {@link classifyFastModeSignal},
380
+ * then writes Esc to dismiss the panel. Fails CLOSED (returns `false`) on timeout, a broken/dead PTY, or
381
+ * any throw (R1.2).
382
+ *
383
+ * NOT the production default: it writes to the PTY at probe time, which is safe only when the input box
384
+ * is idle. Wiring it as {@link defaultFastModeProbe} would break the read-only-load (R4.3) and
385
+ * no-Ctrl+U-in-closed-loop invariants (an unsolicited session-start write). It is exported so it can be
386
+ * injected via `deps.fastModeProbe` once the R7.3 live-proof validates it on a fast-available account and
387
+ * a non-intrusive (idle-gated) wiring lands. The pure classifier it delegates to IS unit-tested against
388
+ * the spike's live capture; this thin live-drive glue is exercised offline via a fake signal-emitting pty.
389
+ */
390
+ export declare const driveFastModeProbe: FastModeProbe;
333
391
  /** Optional bundle of injectable dependencies for {@link ClaudeAcpAgent} (Degrau-1 PTY engine). */
334
392
  export interface AgentDeps {
335
393
  /** Override the PTY-engine + JSONL-watcher start (production default: {@link defaultStartEngine}). */
@@ -415,6 +473,13 @@ export interface AgentDeps {
415
473
  * `~/.claude/agents`. Production passes nothing → the real disk glob.
416
474
  */
417
475
  discoverAgents?: (cwd: string) => AgentCatalogEntry[];
476
+ /**
477
+ * Story 063 (R1/R1.1) — override the offline command discovery `sendAvailableCommandsUpdate` sources
478
+ * the `available_commands_update` set from (default: the disk-only {@link discoverCommands}, keyed on
479
+ * the session cwd). Injected by the wiring test with an in-memory fake so the surface is exercised
480
+ * hermetically, never touching the real `~/.claude`. Production passes nothing → the real disk scan.
481
+ */
482
+ discoverCommands?: (cwd: string) => AvailableCommand[];
418
483
  /**
419
484
  * Story 056 (#812) — override the SDK session-metadata reader the end-of-turn `session_info_update`
420
485
  * push sources the title from (default: the pure {@link getSessionInfo} from the agent SDK, which
@@ -427,6 +492,12 @@ export interface AgentDeps {
427
492
  }) => Promise<{
428
493
  summary: string;
429
494
  } | undefined>;
495
+ /**
496
+ * Story 073 (R1) — override the fast-mode availability probe (default: {@link defaultFastModeProbe},
497
+ * which fails closed until the live spike wires the real detector). Tests inject a fake returning
498
+ * `true`/`false` to exercise the toggle's advertise/apply/reconcile paths hermetically.
499
+ */
500
+ fastModeProbe?: FastModeProbe;
430
501
  }
431
502
  /**
432
503
  * Production default for the {@link StartEngine} seam. Spawns the subscription `claude` TUI under a
@@ -560,6 +631,14 @@ export declare class ClaudeAcpAgent implements Agent {
560
631
  [key: string]: BackgroundTerminal;
561
632
  };
562
633
  clientCapabilities?: ClientCapabilities;
634
+ /**
635
+ * Story 065 (R1/R3) — did the client advertise `clientCapabilities.elicitation.form`
636
+ * at initialize? Presence-based (a present `form` may legitimately be an empty `{}`,
637
+ * so this is derived with `!= null`, NOT property truthiness). The 065 gate (task 3.1)
638
+ * reads this to decide relay-via-elicitation (R1) vs the story-064 deny fallback (R3).
639
+ * Defaults `false` so a client that never advertised elicitation falls back safely.
640
+ */
641
+ clientSupportsElicitationForm: boolean;
563
642
  logger: Logger;
564
643
  gatewayAuthRequest?: GatewayAuthRequest;
565
644
  engine: Engine;
@@ -587,9 +666,13 @@ export declare class ClaudeAcpAgent implements Agent {
587
666
  private readonly gateOptions?;
588
667
  /** Story 056 (R3.2) — main-thread agent-persona discovery seam; see {@link AgentDeps.discoverAgents}. */
589
668
  private readonly discoverAgents;
669
+ /** Story 063 (R1/R1.1) — offline `available_commands` discovery seam; see {@link AgentDeps.discoverCommands}. */
670
+ private readonly discoverCommands;
590
671
  /** Story 056 (#812) — SDK session-metadata reader for the end-of-turn title push; see
591
672
  * {@link AgentDeps.getSessionInfo}. */
592
673
  private readonly getSessionInfo;
674
+ /** Story 073 (R1) — fast-mode availability probe seam; see {@link AgentDeps.fastModeProbe}. */
675
+ private readonly fastModeProbe;
593
676
  /** Live PTY-engine registry shared with the per-session engines (story 014 cleanup map). */
594
677
  private readonly engines;
595
678
  constructor(client: AgentSideConnection, logger?: Logger, engine?: Engine, deps?: AgentDeps);
@@ -600,6 +683,17 @@ export declare class ClaudeAcpAgent implements Agent {
600
683
  loadSession(params: LoadSessionRequest): Promise<LoadSessionResponse>;
601
684
  listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse>;
602
685
  authenticate(_params: AuthenticateRequest): Promise<void>;
686
+ /**
687
+ * ACP `logout` (acp-sdk 1.0.0, acp.d.ts:1646). Under the PTY engine the bridge
688
+ * authenticates lazily and only tracks an in-memory `gatewayAuthRequest`; the
689
+ * interactive `claude` TUI owns the on-disk credential lifecycle. So `logout`
690
+ * here drops the in-memory auth intent and re-offers a clean handshake on the
691
+ * next `initialize()` (authMethods are recomputed there, unconditioned by this
692
+ * field). It does NOT read/write/delete `~/.claude` (billing seam — story 062
693
+ * R2) and never bridges `/logout` to the PTY (R3). Idempotent with no prior
694
+ * authenticate() (R4); active sessions are untouched (R6).
695
+ */
696
+ logout(_params: LogoutRequest): Promise<LogoutResponse | void>;
603
697
  prompt(params: PromptRequest): Promise<PromptResponse>;
604
698
  /**
605
699
  * Story 056 (#812) — push the sanitized session title to the client via `session_info_update`,
@@ -617,7 +711,7 @@ export declare class ClaudeAcpAgent implements Agent {
617
711
  /** Tear down all active sessions. Called when the ACP connection closes. */
618
712
  dispose(): Promise<void>;
619
713
  closeSession(params: CloseSessionRequest): Promise<CloseSessionResponse>;
620
- unstable_deleteSession(params: DeleteSessionRequest): Promise<DeleteSessionResponse>;
714
+ deleteSession(params: DeleteSessionRequest): Promise<DeleteSessionResponse>;
621
715
  setSessionMode(params: SetSessionModeRequest): Promise<SetSessionModeResponse>;
622
716
  setSessionConfigOption(params: SetSessionConfigOptionRequest): Promise<SetSessionConfigOptionResponse>;
623
717
  /**
@@ -726,6 +820,35 @@ export declare class ClaudeAcpAgent implements Agent {
726
820
  * sendPrompt's own submit `\r` is sufficient and NO confirm Enter is scheduled.
727
821
  */
728
822
  private injectEffortCommand;
823
+ /**
824
+ * Story 073 (R3) — apply a fast-mode toggle LIVE via `/fast on|off`, mirroring {@link applyEffortChange}
825
+ * exactly: a side-channel PTY write, no re-spawn, no turn, works before the first interaction. A no-op
826
+ * (same on/off state) applies nothing; mid-turn it defers (pendingFastInjection) and flushes when the
827
+ * turn settles. `enabled` is the resolved boolean state (story 074 R4.3 — resolveFastModeEnabled maps
828
+ * a boolean payload OR the on/off string to it). NO billing/spawn/credential change (R3.3).
829
+ */
830
+ private applyFastModeChange;
831
+ /**
832
+ * Side-channel `/fast on|off` write — synchronous, resolves immediately (never a turn). In claude
833
+ * 2.1.201 `/fast` is a `local-jsx` command: `/fast on|off` opens the "Fast mode (research preview)"
834
+ * confirmation panel (`tengu_fast_mode_picker_shown`) and leaves it OPEN — the arg pre-selects the
835
+ * target but does NOT auto-apply. So, exactly like {@link injectModelCommand}'s "Switch model?"
836
+ * dialog, schedule ONE blind confirm Enter once the panel has rendered; if no panel appears (same
837
+ * state / flag flipped) Enter-on-empty-input is a harmless no-op. (Superseded the earlier INLINE
838
+ * assumption, which left the panel unconfirmed so the toggle never took — story 073 R7.3 live-proof.)
839
+ */
840
+ private injectFastCommand;
841
+ /**
842
+ * Story 073 (R1) — (re-)probe fast-mode availability for a session and reconcile the `fast` toggle.
843
+ * On a non-Opus model it forces the toggle OFF/absent WITHOUT probing (R4.1); on an Opus model it
844
+ * consults the injectable {@link FastModeProbe} (production default fails closed), caches the result
845
+ * (R1.3), rebuilds `configOptions`, and emits a `config_option_update` only when the visible option
846
+ * set changes. Fire-and-forget from createSession + the model-switch reconcile (R4.2).
847
+ */
848
+ private refreshFastMode;
849
+ /** Story 073 — rebuild `configOptions` from the session's current selections (model/effort/agent) plus
850
+ * the fast-mode state, without re-globbing agents. Used by {@link refreshFastMode}. */
851
+ private rebuildConfigOptionsPreserving;
729
852
  /**
730
853
  * Story 056 (R3.3/R3.4) — apply a main-thread agent-persona change. Like effort, the persona has no
731
854
  * live mid-session mechanism (`--agent "<name>"` is a spawn flag), so a change re-spawns in place
@@ -895,5 +1018,27 @@ export declare function runAcp(deps?: AgentDeps): {
895
1018
  connection: AgentSideConnection;
896
1019
  agent: ClaudeAcpAgent;
897
1020
  };
1021
+ /** Resolve a model alias's context window (the usage_update `size` denominator).
1022
+ * NOTE (story 068): there is NO `result.modelUsage` window to refresh from — the
1023
+ * JSONL `usage` carries only token counts; the window comes from static curation
1024
+ * (the Models API `max_input_tokens` is the real authority, which this fork does
1025
+ * not call), as detailed below.
1026
+ *
1027
+ * Story 068 (R1, R1.1, R1.2): consults the static {@link MODEL_CONTEXT_WINDOWS}
1028
+ * alias→window map FIRST (an exact catalog-`value` hit — `default`/`fable5`/`opus`/
1029
+ * `sonnet`=1M, `haiku`=200K). This fixes `opus` having wrongly reported 200K, and
1030
+ * `sonnet` now seeds 1M (Sonnet 5 is native 1M). An alias absent from the map then
1031
+ * falls back to the legacy `\b1m\b` inference: Anthropic 1M-context variants
1032
+ * encode "1m" as a distinct token in the SDK model ID (e.g., "claude-opus-4-6-1m"),
1033
+ * which `\b1m\b` catches without also matching "10m" or embedded substrings.
1034
+ * `null` (fully unknown) is intentional — the two call sites apply
1035
+ * `?? DEFAULT_CONTEXT_WINDOW`. */
1036
+ export declare function inferContextWindowFromModel(model: string): number | null;
1037
+ /** Story 069 (R1) — AUTHORITATIVE context window from a turn's REAL model ID (the JSONL `model`
1038
+ * field), used by the pump to refine the alias seed once the model is known. Exact-ID lookup first
1039
+ * (MODEL_ID_CONTEXT_WINDOWS), then a family+version heuristic for dated snapshots / future variants
1040
+ * (Opus is NOT uniform: 4.6 and earlier = 200K, 4.7+ = 1M; Sonnet 4.x = 200K but Sonnet 5+ = 1M;
1041
+ * haiku = 200K; fable = 1M — story 071), then a
1042
+ * `\b1m\b` suffix, then null (R1.3: a missing / non-string id never refines). */
1043
+ export declare function inferContextWindowFromModelId(id: string): number | null;
898
1044
  export {};
899
- //# sourceMappingURL=acp-agent.d.ts.map