indusagi-coding-agent 0.2.3 → 0.2.5

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 (260) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +661 -0
  3. package/README.md +95 -1
  4. package/dist/entry.js +3205 -1585
  5. package/dist/guardrails.js +47 -515
  6. package/dist/index.js +3232 -1671
  7. package/package.json +8 -7
  8. package/dist/types/addons/addons.test.d.ts +0 -21
  9. package/dist/types/addons/contract.d.ts +0 -640
  10. package/dist/types/addons/dispatch/event-dispatcher.d.ts +0 -140
  11. package/dist/types/addons/dispatch/index.d.ts +0 -23
  12. package/dist/types/addons/dispatch/tool-interceptor.d.ts +0 -128
  13. package/dist/types/addons/host.d.ts +0 -246
  14. package/dist/types/addons/index.d.ts +0 -51
  15. package/dist/types/addons/manifest.d.ts +0 -56
  16. package/dist/types/addons/sandbox.d.ts +0 -103
  17. package/dist/types/addons/surface.d.ts +0 -42
  18. package/dist/types/boot/auth-vault.d.ts +0 -29
  19. package/dist/types/boot/boot.d.ts +0 -26
  20. package/dist/types/boot/boot.test.d.ts +0 -15
  21. package/dist/types/boot/contract.d.ts +0 -236
  22. package/dist/types/boot/index.d.ts +0 -20
  23. package/dist/types/boot/invocation.d.ts +0 -40
  24. package/dist/types/boot/invocation.test.d.ts +0 -8
  25. package/dist/types/boot/runners/addon-wiring.d.ts +0 -103
  26. package/dist/types/boot/runners/addon-wiring.test.d.ts +0 -19
  27. package/dist/types/boot/runners/checkpoint.d.ts +0 -133
  28. package/dist/types/boot/runners/checkpoint.test.d.ts +0 -12
  29. package/dist/types/boot/runners/delegate-runner.d.ts +0 -89
  30. package/dist/types/boot/runners/delegate-runner.test.d.ts +0 -13
  31. package/dist/types/boot/runners/index.d.ts +0 -13
  32. package/dist/types/boot/runners/link-runner.d.ts +0 -20
  33. package/dist/types/boot/runners/memdir.d.ts +0 -103
  34. package/dist/types/boot/runners/memdir.test.d.ts +0 -12
  35. package/dist/types/boot/runners/oneshot-runner.d.ts +0 -19
  36. package/dist/types/boot/runners/read-state.d.ts +0 -82
  37. package/dist/types/boot/runners/read-state.test.d.ts +0 -10
  38. package/dist/types/boot/runners/registry.d.ts +0 -30
  39. package/dist/types/boot/runners/repl-runner.d.ts +0 -19
  40. package/dist/types/boot/runners/session-persist.test.d.ts +0 -10
  41. package/dist/types/boot/runners/session.d.ts +0 -65
  42. package/dist/types/boot/runners/session.test.d.ts +0 -10
  43. package/dist/types/boot/stages.d.ts +0 -92
  44. package/dist/types/boot/upgrade/apply.d.ts +0 -45
  45. package/dist/types/boot/upgrade/index.d.ts +0 -13
  46. package/dist/types/boot/upgrade/upgrades.d.ts +0 -126
  47. package/dist/types/briefing/briefing.test.d.ts +0 -15
  48. package/dist/types/briefing/compose.d.ts +0 -37
  49. package/dist/types/briefing/context-docs.d.ts +0 -38
  50. package/dist/types/briefing/context-docs.test.d.ts +0 -18
  51. package/dist/types/briefing/contract.d.ts +0 -686
  52. package/dist/types/briefing/index.d.ts +0 -29
  53. package/dist/types/briefing/macros.d.ts +0 -206
  54. package/dist/types/briefing/skills.d.ts +0 -67
  55. package/dist/types/capability-deck/bridge-ledger/index.d.ts +0 -25
  56. package/dist/types/capability-deck/bridge-ledger/key.d.ts +0 -65
  57. package/dist/types/capability-deck/bridge-ledger/ledger.d.ts +0 -129
  58. package/dist/types/capability-deck/bridge-ledger/network.d.ts +0 -115
  59. package/dist/types/capability-deck/builtin-bridge.d.ts +0 -114
  60. package/dist/types/capability-deck/capability-deck.test.d.ts +0 -18
  61. package/dist/types/capability-deck/cards/bg-process-card.d.ts +0 -99
  62. package/dist/types/capability-deck/cards/index.d.ts +0 -37
  63. package/dist/types/capability-deck/cards/memory-card.d.ts +0 -68
  64. package/dist/types/capability-deck/cards/plan-file.d.ts +0 -56
  65. package/dist/types/capability-deck/cards/plan-tools.d.ts +0 -97
  66. package/dist/types/capability-deck/cards/plan-tools.test.d.ts +0 -9
  67. package/dist/types/capability-deck/cards/saas-card.d.ts +0 -78
  68. package/dist/types/capability-deck/cards/task-card.d.ts +0 -106
  69. package/dist/types/capability-deck/cards/todo-card.d.ts +0 -78
  70. package/dist/types/capability-deck/cards/workflow-card.d.ts +0 -55
  71. package/dist/types/capability-deck/cards/workflow-card.test.d.ts +0 -12
  72. package/dist/types/capability-deck/checkpoint.int.test.d.ts +0 -25
  73. package/dist/types/capability-deck/contract.d.ts +0 -317
  74. package/dist/types/capability-deck/index.d.ts +0 -46
  75. package/dist/types/capability-deck/manifest.d.ts +0 -60
  76. package/dist/types/capability-deck/provision.d.ts +0 -76
  77. package/dist/types/capability-deck/read-edit-gate.int.test.d.ts +0 -21
  78. package/dist/types/channels/channels.test.d.ts +0 -15
  79. package/dist/types/channels/contract.d.ts +0 -489
  80. package/dist/types/channels/framer.d.ts +0 -49
  81. package/dist/types/channels/index.d.ts +0 -24
  82. package/dist/types/channels/link/dialog.d.ts +0 -138
  83. package/dist/types/channels/link/driver.d.ts +0 -81
  84. package/dist/types/channels/link/index.d.ts +0 -13
  85. package/dist/types/channels/link/server.d.ts +0 -70
  86. package/dist/types/channels/oneshot.d.ts +0 -37
  87. package/dist/types/channels/ops.d.ts +0 -89
  88. package/dist/types/channels/session-ops.d.ts +0 -80
  89. package/dist/types/conductor/bash-guard.d.ts +0 -106
  90. package/dist/types/conductor/bash-guard.test.d.ts +0 -17
  91. package/dist/types/conductor/catalog/catalog.d.ts +0 -87
  92. package/dist/types/conductor/catalog/index.d.ts +0 -14
  93. package/dist/types/conductor/catalog/matcher.d.ts +0 -47
  94. package/dist/types/conductor/conductor.d.ts +0 -189
  95. package/dist/types/conductor/conductor.test.d.ts +0 -10
  96. package/dist/types/conductor/contract.d.ts +0 -774
  97. package/dist/types/conductor/diagnostics.d.ts +0 -183
  98. package/dist/types/conductor/diagnostics.test.d.ts +0 -10
  99. package/dist/types/conductor/index.d.ts +0 -26
  100. package/dist/types/conductor/permission-gate.integration.test.d.ts +0 -22
  101. package/dist/types/conductor/permission-wiring.test.d.ts +0 -14
  102. package/dist/types/conductor/permissions.d.ts +0 -217
  103. package/dist/types/conductor/permissions.test.d.ts +0 -12
  104. package/dist/types/conductor/plan-mode.integration.test.d.ts +0 -23
  105. package/dist/types/conductor/post-edit-diagnostics.test.d.ts +0 -13
  106. package/dist/types/conductor/signal-hub/hub.d.ts +0 -83
  107. package/dist/types/conductor/signal-hub/index.d.ts +0 -19
  108. package/dist/types/conductor/signal-hub/translate.d.ts +0 -77
  109. package/dist/types/conductor/skill-parse/index.d.ts +0 -10
  110. package/dist/types/conductor/skill-parse/parse.d.ts +0 -67
  111. package/dist/types/conductor/submit.test.d.ts +0 -28
  112. package/dist/types/conductor/transcript-store/index.d.ts +0 -16
  113. package/dist/types/conductor/transcript-store/serialize.d.ts +0 -106
  114. package/dist/types/conductor/transcript-store/serialize.test.d.ts +0 -10
  115. package/dist/types/conductor/transcript-store/store.d.ts +0 -188
  116. package/dist/types/console/components/AgentsView.d.ts +0 -41
  117. package/dist/types/console/components/BackgroundAgents.d.ts +0 -63
  118. package/dist/types/console/components/BackgroundAgents.test.d.ts +0 -8
  119. package/dist/types/console/components/Banner.d.ts +0 -110
  120. package/dist/types/console/components/Composer.d.ts +0 -37
  121. package/dist/types/console/components/StatusBar.d.ts +0 -42
  122. package/dist/types/console/components/TerminalConsole.d.ts +0 -32
  123. package/dist/types/console/components/WorkingIndicator.d.ts +0 -44
  124. package/dist/types/console/components/WorkingIndicator.test.d.ts +0 -9
  125. package/dist/types/console/components/banner-sweep.d.ts +0 -55
  126. package/dist/types/console/components/banner.test.d.ts +0 -9
  127. package/dist/types/console/components/welcome.d.ts +0 -115
  128. package/dist/types/console/components/welcome.test.d.ts +0 -9
  129. package/dist/types/console/console.test.d.ts +0 -19
  130. package/dist/types/console/contract.d.ts +0 -598
  131. package/dist/types/console/index.d.ts +0 -34
  132. package/dist/types/console/input/complete.d.ts +0 -120
  133. package/dist/types/console/input/dir-reader.d.ts +0 -28
  134. package/dist/types/console/input/index.d.ts +0 -24
  135. package/dist/types/console/input/input.test.d.ts +0 -14
  136. package/dist/types/console/input/keymap.d.ts +0 -193
  137. package/dist/types/console/input/paste.d.ts +0 -131
  138. package/dist/types/console/mount.d.ts +0 -53
  139. package/dist/types/console/overlays/approval-queue.d.ts +0 -71
  140. package/dist/types/console/overlays/approval.d.ts +0 -104
  141. package/dist/types/console/overlays/approval.test.d.ts +0 -17
  142. package/dist/types/console/overlays/auth.d.ts +0 -31
  143. package/dist/types/console/overlays/boards.d.ts +0 -55
  144. package/dist/types/console/overlays/host.d.ts +0 -45
  145. package/dist/types/console/overlays/index.d.ts +0 -15
  146. package/dist/types/console/overlays/pickers.d.ts +0 -37
  147. package/dist/types/console/overlays/sessions.d.ts +0 -29
  148. package/dist/types/console/reducer.d.ts +0 -51
  149. package/dist/types/console/slash/builtins.d.ts +0 -33
  150. package/dist/types/console/slash/commands/dynamic.d.ts +0 -57
  151. package/dist/types/console/slash/commands/dynamic.test.d.ts +0 -9
  152. package/dist/types/console/slash/commands/integrations.d.ts +0 -28
  153. package/dist/types/console/slash/commands/integrations.test.d.ts +0 -18
  154. package/dist/types/console/slash/commands/shared.d.ts +0 -72
  155. package/dist/types/console/slash/commands/transcript.d.ts +0 -24
  156. package/dist/types/console/slash/commands/transcript.test.d.ts +0 -10
  157. package/dist/types/console/slash/commands/workbench.d.ts +0 -21
  158. package/dist/types/console/slash/commands/workbench.test.d.ts +0 -10
  159. package/dist/types/console/slash/index.d.ts +0 -34
  160. package/dist/types/console/slash/registry.d.ts +0 -90
  161. package/dist/types/console/slash/resolve.d.ts +0 -109
  162. package/dist/types/console/slash/slash.test.d.ts +0 -18
  163. package/dist/types/console/startup.d.ts +0 -119
  164. package/dist/types/console/theme/adapter.d.ts +0 -79
  165. package/dist/types/console/theme/index.d.ts +0 -18
  166. package/dist/types/console/theme/palette.d.ts +0 -77
  167. package/dist/types/console/theme/resolve.d.ts +0 -45
  168. package/dist/types/console/theme/theme.test.d.ts +0 -16
  169. package/dist/types/console/theme/tokens.d.ts +0 -62
  170. package/dist/types/entry.d.ts +0 -17
  171. package/dist/types/guardrails.d.ts +0 -33
  172. package/dist/types/index.d.ts +0 -24
  173. package/dist/types/insight/channel.d.ts +0 -45
  174. package/dist/types/insight/contract.d.ts +0 -411
  175. package/dist/types/insight/index.d.ts +0 -26
  176. package/dist/types/insight/insight.test.d.ts +0 -17
  177. package/dist/types/insight/recorder.d.ts +0 -63
  178. package/dist/types/insight/redaction.d.ts +0 -44
  179. package/dist/types/insight/replay.d.ts +0 -77
  180. package/dist/types/insight/sampling.d.ts +0 -84
  181. package/dist/types/insight/serialize.d.ts +0 -54
  182. package/dist/types/insight/sinks/console.d.ts +0 -36
  183. package/dist/types/insight/sinks/file.d.ts +0 -37
  184. package/dist/types/insight/sinks/index.d.ts +0 -16
  185. package/dist/types/insight/sinks/stream.d.ts +0 -53
  186. package/dist/types/kit/clipboard-image.d.ts +0 -40
  187. package/dist/types/kit/external-editor.d.ts +0 -35
  188. package/dist/types/kit/image.d.ts +0 -102
  189. package/dist/types/kit/index.d.ts +0 -29
  190. package/dist/types/kit/kit.test.d.ts +0 -13
  191. package/dist/types/kit/shell.d.ts +0 -50
  192. package/dist/types/kit/tool-fetch.d.ts +0 -165
  193. package/dist/types/launch/catalog.d.ts +0 -51
  194. package/dist/types/launch/contract.d.ts +0 -387
  195. package/dist/types/launch/credentials.d.ts +0 -112
  196. package/dist/types/launch/index.d.ts +0 -28
  197. package/dist/types/launch/invocation/attachments.d.ts +0 -72
  198. package/dist/types/launch/invocation/flags.d.ts +0 -59
  199. package/dist/types/launch/invocation/index.d.ts +0 -23
  200. package/dist/types/launch/invocation/read.d.ts +0 -52
  201. package/dist/types/launch/invocation/usage.d.ts +0 -25
  202. package/dist/types/launch/launch.test.d.ts +0 -20
  203. package/dist/types/launch/oauth.d.ts +0 -101
  204. package/dist/types/launch/packages.d.ts +0 -75
  205. package/dist/types/launch/packages.test.d.ts +0 -15
  206. package/dist/types/launch/pickers.d.ts +0 -97
  207. package/dist/types/runtime-bridge/bridges/_drive.d.ts +0 -74
  208. package/dist/types/runtime-bridge/bridges/builtins.d.ts +0 -77
  209. package/dist/types/runtime-bridge/bridges/claude-cli.d.ts +0 -37
  210. package/dist/types/runtime-bridge/bridges/codex-cli.d.ts +0 -27
  211. package/dist/types/runtime-bridge/bridges/index.d.ts +0 -15
  212. package/dist/types/runtime-bridge/bridges/indusagi-cli.d.ts +0 -36
  213. package/dist/types/runtime-bridge/broker.d.ts +0 -182
  214. package/dist/types/runtime-bridge/contract.d.ts +0 -436
  215. package/dist/types/runtime-bridge/index.d.ts +0 -21
  216. package/dist/types/runtime-bridge/runtime-bridge.test.d.ts +0 -17
  217. package/dist/types/runtime-bridge/sink.d.ts +0 -59
  218. package/dist/types/sessions/contract.d.ts +0 -79
  219. package/dist/types/sessions/index.d.ts +0 -11
  220. package/dist/types/sessions/library.d.ts +0 -95
  221. package/dist/types/sessions/sessions.test.d.ts +0 -11
  222. package/dist/types/settings/contract.d.ts +0 -175
  223. package/dist/types/settings/index.d.ts +0 -13
  224. package/dist/types/settings/manager.d.ts +0 -109
  225. package/dist/types/settings/settings.test.d.ts +0 -16
  226. package/dist/types/transcript-export/index.d.ts +0 -20
  227. package/dist/types/transcript-export/publish.d.ts +0 -81
  228. package/dist/types/transcript-export/sgr.d.ts +0 -90
  229. package/dist/types/transcript-export/template.d.ts +0 -64
  230. package/dist/types/transcript-export/theme-bridge.d.ts +0 -99
  231. package/dist/types/transcript-export/transcript-export.test.d.ts +0 -16
  232. package/dist/types/window-budget/budget/estimate.d.ts +0 -47
  233. package/dist/types/window-budget/budget/gate.d.ts +0 -37
  234. package/dist/types/window-budget/budget/index.d.ts +0 -14
  235. package/dist/types/window-budget/budget/slice.d.ts +0 -38
  236. package/dist/types/window-budget/condenser.d.ts +0 -73
  237. package/dist/types/window-budget/contract.d.ts +0 -182
  238. package/dist/types/window-budget/index.d.ts +0 -17
  239. package/dist/types/window-budget/microcompact.d.ts +0 -68
  240. package/dist/types/window-budget/microcompact.test.d.ts +0 -16
  241. package/dist/types/window-budget/rehydrate.d.ts +0 -56
  242. package/dist/types/window-budget/summarize/condense.d.ts +0 -70
  243. package/dist/types/window-budget/summarize/index.d.ts +0 -12
  244. package/dist/types/window-budget/summarize/prompt.d.ts +0 -56
  245. package/dist/types/window-budget/window-budget.test.d.ts +0 -18
  246. package/dist/types/workflow-engine/agent-runner.d.ts +0 -105
  247. package/dist/types/workflow-engine/agent-runner.test.d.ts +0 -8
  248. package/dist/types/workflow-engine/display.d.ts +0 -148
  249. package/dist/types/workflow-engine/display.test.d.ts +0 -1
  250. package/dist/types/workflow-engine/engine.d.ts +0 -183
  251. package/dist/types/workflow-engine/engine.test.d.ts +0 -1
  252. package/dist/types/workflow-engine/index.d.ts +0 -21
  253. package/dist/types/workflow-engine/parse.d.ts +0 -64
  254. package/dist/types/workflow-engine/parse.test.d.ts +0 -1
  255. package/dist/types/workflow-engine/structured-output.d.ts +0 -51
  256. package/dist/types/workflow-engine/structured-output.test.d.ts +0 -1
  257. package/dist/types/workspace/brand.d.ts +0 -26
  258. package/dist/types/workspace/index.d.ts +0 -11
  259. package/dist/types/workspace/locator.d.ts +0 -50
  260. package/dist/types/workspace/runtime-detect.d.ts +0 -56
@@ -1,774 +0,0 @@
1
- /**
2
- * Conductor contract — the FROZEN type surface of Phase 2 (agent runtime core).
3
- *
4
- * This module is the single typed seam between the coding-agent *product* (the
5
- * UI/channels that drive a session) and the framework `Agent` (the raw LLM
6
- * conversation loop, published by `indusagi/agent`). It declares *only* shapes
7
- * plus two tiny inert helpers — no behavior, no I/O, no orchestration. Every
8
- * later conductor module (the signal hub, the transcript store, the model
9
- * catalog/matcher, the credential vault, the conductor factory, and the
10
- * `SessionConductor` itself) is written against the names declared here, so the
11
- * file is intentionally small, append-mostly, and stable.
12
- *
13
- * Design stance:
14
- * - The conductor *wraps* the framework `Agent`. The framework emits a
15
- * fine-grained `AgentEvent` stream for its own loop; the conductor consumes
16
- * that internally and **re-emits a distinct, product-level
17
- * {@link SessionSignal} stream** to consumers. The two are deliberately not
18
- * the same union: `SessionSignal` is the stable surface the app renders,
19
- * free to evolve independently of the framework's loop events.
20
- * - Faults are **typed discriminated values** ({@link ConductorFault}), never
21
- * string sentinels. A consumer switches on `fault.kind`, not on substring
22
- * matching of a message.
23
- * - Persistence uses a **fresh on-disk vocabulary** ({@link TranscriptEntry},
24
- * {@link SessionHead}, {@link TRANSCRIPT_SCHEMA}). The node is a `parent`-linked
25
- * tree, the version is a namespaced string, and the field names are the
26
- * conductor's own — not the framework's session-manager schema.
27
- * - State is exposed as an **immutable snapshot** ({@link ConductorState});
28
- * consumers read it, they never mutate it.
29
- *
30
- * Framework anchors (all from the `indusagi` package — the sibling rebuilt
31
- * framework this app targets):
32
- * - `AgentMessage`, `ThinkingLevel`, `AgentTool` ← `indusagi/agent`
33
- * - `Model`, `Usage`, `KnownProvider` ← `indusagi/ai`
34
- *
35
- * The conductor never re-declares these; it composes them.
36
- */
37
- import type { AgentMessage, AgentTool, CanUseToolFn, ThinkingLevel } from "indusagi/agent";
38
- import type { KnownProvider, Model, Usage } from "indusagi/ai";
39
- import type { PermissionMode } from "../settings";
40
- import type { ApprovalResolver } from "./permissions";
41
- /** Re-exported framework vocabulary that conductor consumers routinely need. */
42
- export type { AgentMessage, AgentTool, CanUseToolFn, ThinkingLevel, Model, Usage, KnownProvider };
43
- /** Re-exported permission vocabulary, so conductor consumers get it in one import. */
44
- export type { PermissionMode, ApprovalResolver };
45
- /**
46
- * The closed set of failure categories the conductor can surface.
47
- *
48
- * Each is a distinct recovery story, so the kind is a discriminant — not a
49
- * free-form string:
50
- * - `model` — the LLM call itself failed (transport, provider, decode).
51
- * - `tool` — a tool invocation threw or returned a hard error.
52
- * - `persistence` — writing/reading the on-disk transcript failed.
53
- * - `aborted` — the caller cancelled the in-flight turn via {@link SessionConductor.abort}.
54
- * - `overflow` — the context window was exceeded and could not be condensed.
55
- */
56
- export type FaultKind = "model" | "tool" | "persistence" | "aborted" | "overflow";
57
- /**
58
- * A typed, discriminated failure value emitted on the {@link SessionSignal}
59
- * stream and attached to faulted states.
60
- *
61
- * The `kind` selects the category; `message` is a human-readable summary; the
62
- * optional `cause` carries the underlying error (or any structured detail) for
63
- * logging without forcing consumers to parse the message string.
64
- */
65
- export interface ConductorFault {
66
- /** Failure category — the discriminant consumers switch on. */
67
- readonly kind: FaultKind;
68
- /** Human-readable, single-line summary of what went wrong. */
69
- readonly message: string;
70
- /** Underlying error or structured detail, if any. */
71
- readonly cause?: unknown;
72
- }
73
- /**
74
- * Construct a {@link ConductorFault}. The single sanctioned way to mint a fault,
75
- * so the shape stays uniform across every producer.
76
- *
77
- * @param kind the failure category
78
- * @param message a human-readable, single-line summary
79
- * @param cause optional underlying error or structured detail
80
- */
81
- export declare function conductorFault(kind: FaultKind, message: string, cause?: unknown): ConductorFault;
82
- /**
83
- * The product-level event stream the conductor emits to its consumers (the
84
- * interactive UI, the print/JSON mode, the JSON-RPC link).
85
- *
86
- * This is the conductor's **re-emitted surface** — distinct from the framework
87
- * `AgentEvent` union. The conductor subscribes to the raw framework loop,
88
- * layers persistence / auto-condense / fault handling on top, and projects the
89
- * result down to this small, stable set of discriminated signals. Consumers
90
- * switch on `kind` and never see a framework loop event directly.
91
- *
92
- * - `prompt` — the user's turn was committed to the conversation; `text`
93
- * is the submitted prompt. Emitted the instant the turn is
94
- * accepted (before the model replies) so a UI can echo the
95
- * user message immediately rather than waiting for the first
96
- * assistant token.
97
- * - `text` — a chunk of assistant answer text streamed in.
98
- * - `thinking` — a chunk of reasoning/thinking text streamed in.
99
- * - `tool_start`— a tool invocation began (correlate by `id`).
100
- * - `tool_update`— a running tool emitted partial progress (correlate by `id`);
101
- * `name` is the tool name and `details` is the tool's own typed
102
- * partial-result detail (e.g. the live `◆ Workflow` snapshot).
103
- * - `tool_end` — a tool invocation finished (`ok` = no error).
104
- * - `turn_end` — the assistant turn settled; `usage` reports token spend.
105
- * - `persisted` — the latest node was committed to the transcript (`entryId`).
106
- * - `compacted` — the transcript was condensed to fit the context window.
107
- * - `fault` — a typed {@link ConductorFault} occurred.
108
- * - `queue` — the pending-input queue changed; `count` is its new depth.
109
- * - `idle` — the conductor has no in-flight work and is ready for input.
110
- */
111
- export type SessionSignal = {
112
- readonly kind: "prompt";
113
- readonly text: string;
114
- } | {
115
- readonly kind: "text";
116
- readonly delta: string;
117
- } | {
118
- readonly kind: "thinking";
119
- readonly delta: string;
120
- } | {
121
- readonly kind: "tool_start";
122
- readonly id: string;
123
- readonly name: string;
124
- } | {
125
- readonly kind: "tool_update";
126
- readonly id: string;
127
- readonly name: string;
128
- readonly details: unknown;
129
- } | {
130
- readonly kind: "tool_end";
131
- readonly id: string;
132
- readonly ok: boolean;
133
- } | {
134
- readonly kind: "turn_end";
135
- readonly usage: Usage;
136
- } | {
137
- readonly kind: "persisted";
138
- readonly entryId: string;
139
- } | {
140
- readonly kind: "compacted";
141
- } | {
142
- readonly kind: "fault";
143
- readonly fault: ConductorFault;
144
- } | {
145
- readonly kind: "queue";
146
- readonly count: number;
147
- } | {
148
- readonly kind: "idle";
149
- };
150
- /** The discriminant literals of {@link SessionSignal}, for filtering/logging. */
151
- export type SignalKind = SessionSignal["kind"];
152
- /** Extract a single member of {@link SessionSignal} by its `kind`. */
153
- export type SignalOf<K extends SignalKind> = Extract<SessionSignal, {
154
- kind: K;
155
- }>;
156
- /** A subscriber callback registered with {@link SessionConductor.subscribe}. */
157
- export type SignalHandler = (signal: SessionSignal) => void;
158
- /**
159
- * The on-disk transcript schema namespace + version.
160
- *
161
- * A namespaced string (not a bare integer) so the format is self-describing and
162
- * can evolve without colliding with any other versioned artifact in the app.
163
- * This is deliberately the conductor's own vocabulary.
164
- */
165
- export declare const TRANSCRIPT_SCHEMA: "indus/transcript@1";
166
- /** The literal type of {@link TRANSCRIPT_SCHEMA}. */
167
- export type TranscriptSchema = typeof TRANSCRIPT_SCHEMA;
168
- /**
169
- * The conversational role a {@link TranscriptEntry} node carries.
170
- *
171
- * Spans both the LLM-facing turns (`user`/`assistant`/`tool`) and the
172
- * conductor's own bookkeeping nodes (`system` seed, `condense` markers, and
173
- * `note` for app-injected context). Kept open at the product layer so the
174
- * transcript can hold more than the framework's message roles.
175
- */
176
- export type TranscriptRole = "user" | "assistant" | "tool" | "system" | "condense" | "note";
177
- /**
178
- * A single node in the on-disk transcript tree.
179
- *
180
- * The transcript is an append-only **tree**: every node names its `parent`
181
- * (a root has `parent: null`), and the active leaf is tracked separately in
182
- * {@link SessionHead}. Branching is moving the head to an earlier node; the next
183
- * append becomes that node's child. `content` holds the framework
184
- * {@link AgentMessage} payload so the node round-trips back into the agent loop;
185
- * `meta` carries optional, non-LLM annotations (labels, condense bookkeeping,
186
- * model/reasoning markers).
187
- *
188
- * Field names are the conductor's own (`parent`, `createdAt`, `meta`) — not the
189
- * framework's persistence schema.
190
- */
191
- export interface TranscriptEntry {
192
- /** Stable unique node id (e.g. a ULID). */
193
- readonly id: string;
194
- /** Parent node id, or `null` for the transcript root. */
195
- readonly parent: string | null;
196
- /** Conversational role of this node. */
197
- readonly role: TranscriptRole;
198
- /** The framework message payload this node persists. */
199
- readonly content: AgentMessage;
200
- /** ISO-8601 creation timestamp. */
201
- readonly createdAt: string;
202
- /** Optional, non-LLM annotations keyed by name. */
203
- readonly meta?: Readonly<Record<string, unknown>>;
204
- }
205
- /**
206
- * The head record of a persisted transcript: which session, and where its
207
- * active leaf currently points.
208
- *
209
- * The `leaf` is the id of the most recently appended (or branched-to) node;
210
- * walking `parent` links from `leaf` to a root reconstructs the active branch.
211
- * `null` means an empty transcript (no nodes yet).
212
- */
213
- export interface SessionHead {
214
- /** Stable identifier of the session this transcript belongs to. */
215
- readonly sessionId: string;
216
- /** Id of the active leaf node, or `null` for an empty transcript. */
217
- readonly leaf: string | null;
218
- /**
219
- * Cumulative session usage (tokens + cost) persisted alongside the head so
220
- * resume can restore the running total instead of seeding zero. Optional and
221
- * absent on legacy transcripts; the store rewrites the head line on every
222
- * flush, keeping this current with the live tally.
223
- */
224
- readonly usage?: Usage;
225
- }
226
- /**
227
- * A lightweight, resolved reference to one model card in the catalog.
228
- *
229
- * This is the *display/identity* projection of a framework {@link Model} — the
230
- * minimum a UI needs to list, label, and select a model without holding the
231
- * full model object. The matcher produces these; the conductor resolves the
232
- * chosen one back to a full `Model` when it configures the agent.
233
- */
234
- export interface ModelCardRef {
235
- /** Canonical `"provider/modelId"` identifier (the catalog key). */
236
- readonly id: string;
237
- /** Owning provider. */
238
- readonly provider: KnownProvider | string;
239
- /** Provider-scoped model id (e.g. `"claude-sonnet-4"`). */
240
- readonly modelId: string;
241
- /** Human-readable display name. */
242
- readonly name: string;
243
- /** Whether this model exposes a reasoning/thinking budget. */
244
- readonly reasoning: boolean;
245
- }
246
- /**
247
- * A query against the model catalog/matcher.
248
- *
249
- * Resolution is a prioritized candidate pipeline: an explicit `provider`+`modelId`
250
- * pins a single card; otherwise `pattern` is matched (exact id, `provider/`
251
- * prefix, then glob/fuzzy) and narrowed by the optional capability filters.
252
- * All fields are optional so an empty query means "the default candidate".
253
- */
254
- export interface MatchQuery {
255
- /** Free-form selector: an id, an alias, or a glob pattern. */
256
- readonly pattern?: string;
257
- /** Restrict candidates to this provider. */
258
- readonly provider?: KnownProvider | string;
259
- /** Pin a specific provider-scoped model id (used with {@link provider}). */
260
- readonly modelId?: string;
261
- /** Require reasoning/thinking support. */
262
- readonly reasoning?: boolean;
263
- /** Require image input support. */
264
- readonly supportsImageInput?: boolean;
265
- }
266
- /**
267
- * The coarse lifecycle phase of the conductor at a point in time.
268
- *
269
- * - `idle` — assembled and ready; no turn in flight.
270
- * - `streaming` — an assistant turn is producing text/thinking.
271
- * - `tooling` — a tool invocation is executing mid-turn.
272
- * - `condensing` — the transcript is being condensed to fit the window.
273
- * - `faulted` — the last turn ended in a {@link ConductorFault}.
274
- */
275
- export type ConductorPhase = "idle" | "streaming" | "tooling" | "condensing" | "faulted";
276
- /**
277
- * An immutable snapshot of the conductor's observable state.
278
- *
279
- * Returned by {@link SessionConductor.snapshot} and resolved by
280
- * {@link SessionConductor.submit}. It is a value, not a live view: every field
281
- * is read-only and the object reflects the instant it was taken. Re-read with a
282
- * fresh `snapshot()` to observe later changes.
283
- */
284
- export interface ConductorState {
285
- /** Coarse lifecycle phase at snapshot time. */
286
- readonly phase: ConductorPhase;
287
- /** The active transcript head (session id + current leaf). */
288
- readonly head: SessionHead;
289
- /** Cumulative token/cost spend across the session so far. */
290
- readonly usage: Usage;
291
- /**
292
- * Tokens occupying the model's context window as of the most recent turn —
293
- * the last assistant turn's reported usage, NOT the cumulative session spend.
294
- * This is what the footer's `ctx:%` divides by the context window;
295
- * {@link usage}.totalTokens grows unbounded across turns and would inflate it.
296
- */
297
- readonly contextTokens: number;
298
- /** Canonical id of the model currently bound to the session. */
299
- readonly modelId: string;
300
- /** The fault from the most recent turn, when {@link phase} is `"faulted"`. */
301
- readonly fault?: ConductorFault;
302
- }
303
- /**
304
- * How a queued input rejoins the conversation once the active turn settles.
305
- *
306
- * - `steer` — interrupt-style input meant to redirect the agent; drained
307
- * ahead of plain follow-ups.
308
- * - `followUp` — input that simply waits its turn after the current one ends.
309
- *
310
- * The conductor enqueues input under one of these modes when {@link SessionConductor.submit}
311
- * is called while a turn is in flight, then drains the queue in order.
312
- */
313
- export type QueueMode = "steer" | "followUp";
314
- /**
315
- * One entry in the conductor's pending-input queue: the {@link QueueMode} it was
316
- * filed under and the raw user `text`. Surfaced by
317
- * {@link SessionConductor.pendingInputs} so a UI can render what is waiting.
318
- */
319
- export interface QueuedInput {
320
- /** How this input will rejoin the conversation when drained. */
321
- readonly mode: QueueMode;
322
- /** The raw user message text held for a later turn. */
323
- readonly text: string;
324
- }
325
- /**
326
- * A point-in-time tally of the active session: message counts by role, tool
327
- * activity, cumulative token spend, and total cost. Computed by
328
- * {@link SessionConductor.stats} from the live message list plus the running
329
- * usage carried on {@link ConductorState}.
330
- */
331
- export interface SessionStats {
332
- /** Identifier of the session these figures describe. */
333
- readonly sessionId: string;
334
- /** Number of user-role messages in the active branch. */
335
- readonly userMessages: number;
336
- /** Number of assistant-role messages in the active branch. */
337
- readonly assistantMessages: number;
338
- /** Number of tool invocations the assistant issued. */
339
- readonly toolCalls: number;
340
- /** Number of tool-result messages produced in reply. */
341
- readonly toolResults: number;
342
- /** Total message count across all roles. */
343
- readonly totalMessages: number;
344
- /** Cumulative token spend, broken out by category and totalled. */
345
- readonly tokens: {
346
- readonly input: number;
347
- readonly output: number;
348
- readonly cacheRead: number;
349
- readonly cacheWrite: number;
350
- readonly total: number;
351
- };
352
- /** Cumulative monetary cost of the session so far. */
353
- readonly cost: number;
354
- }
355
- /** Options for {@link SessionConductor.executeBash}. */
356
- export interface ExecuteBashOptions {
357
- /**
358
- * When `true`, the command's output is *not* recorded as a transcript note,
359
- * so it never re-enters the agent's context. Defaults to `false`.
360
- */
361
- readonly excludeFromContext?: boolean;
362
- }
363
- /** The settled result of {@link SessionConductor.executeBash}. */
364
- export interface BashOutcome {
365
- /** Combined stdout + stderr of the command. */
366
- readonly output: string;
367
- /** Process exit code (`0` on success; non-zero, or `1` on a thrown error). */
368
- readonly exitCode: number;
369
- }
370
- /**
371
- * The minimal file-checkpoint surface the conductor drives for rewind (#24).
372
- *
373
- * The product mints a concrete `CheckpointStore` (in `boot/runners/checkpoint.ts`),
374
- * injects it into the deck's `ctx.framework` bag under the `'checkpoint'` key so
375
- * the framework's write/edit tools record pre-mutation file content against the
376
- * active transcript node, and ALSO hands it to the conductor as this port. The
377
- * conductor pins the active node id as its head advances ({@link setActiveNodeId})
378
- * so a turn's edits key to the node that was active before the turn, and exposes
379
- * {@link restore}/{@link hasSnapshot} so the tree picker can roll the working tree
380
- * back when navigating to an earlier node.
381
- *
382
- * Declared as a tiny structural port (not the concrete store) so the conductor
383
- * stays free of any boot-layer import — the product's store satisfies it by shape.
384
- */
385
- export interface CheckpointPort {
386
- /**
387
- * Pin the transcript node subsequent file snapshots are filed under. Called by
388
- * the conductor as its head advances (at turn start) so a turn's edits key to
389
- * the node active before the turn ran.
390
- *
391
- * @param id the active transcript node id, or `null` to fall back to the root
392
- */
393
- setActiveNodeId(id: string | null): void;
394
- /** Whether a node has ANY recorded file snapshot (the picker's restore gate). */
395
- hasSnapshot(nodeId: string): boolean;
396
- /**
397
- * Roll the working tree back to a node's recorded state, rewriting each tracked
398
- * file to its pre-mutation content (deleting files recorded as absent). A safe
399
- * no-op when the node has no snapshot.
400
- *
401
- * @param nodeId the transcript node whose file state to restore to
402
- * @returns the absolute paths that were written or deleted
403
- */
404
- restore(nodeId: string): string[];
405
- }
406
- /**
407
- * Options that configure a {@link SessionConductor} at assembly time.
408
- *
409
- * Only {@link modelId} is required; everything else has a sensible default
410
- * resolved by the conductor factory. The shape is intentionally small — richer
411
- * wiring (MCP, memory, provider routing) is attached by the factory, not passed
412
- * through this surface.
413
- */
414
- export interface SessionConductorOptions {
415
- /** Canonical id of the model to bind the session to. */
416
- readonly modelId: string;
417
- /** Initial system prompt seeding the conversation. */
418
- readonly system?: string;
419
- /** Tools made available to the agent for this session. */
420
- readonly tools?: AgentTool[];
421
- /** Initial reasoning effort for models that support it. */
422
- readonly thinking?: ThinkingLevel;
423
- /**
424
- * Canonical id of a model to fall back to when the bound model is overloaded
425
- * (HTTP 529 / "overloaded") mid-turn (`--fallback-model`). When set, an
426
- * overload that exhausts the transient-retry budget swaps to this model once
427
- * per turn and retries instead of surfacing a terminal fault. Absent disables
428
- * the swap entirely (behavior-preserving default).
429
- */
430
- readonly fallbackModelId?: string;
431
- /** Working directory the session is scoped to (defaults to process cwd). */
432
- readonly workspace?: string;
433
- /**
434
- * Directory to persist the transcript into. When set, the conductor backs its
435
- * {@link TranscriptStore} with a filesystem backend rooted here (one
436
- * `<sessionId>.ndjson` per session) so the conversation survives the process
437
- * and can be resumed. Absent (or when a `store` dep is injected) keeps the
438
- * default in-memory store — nothing is written to disk.
439
- */
440
- readonly sessionsDir?: string;
441
- /** Condense the transcript automatically when it nears the window (default on). */
442
- readonly autoCompact?: boolean;
443
- /**
444
- * Resolve the credential for a provider on each call. Threaded to the framework
445
- * `Agent`, which calls it per request so short-lived OAuth access tokens (e.g.
446
- * `openai-codex`) can be refreshed and providers with no env-var mapping still
447
- * authenticate. Returning `undefined` lets the framework fall back to its own
448
- * environment lookup. May be sync or async.
449
- */
450
- readonly getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;
451
- /**
452
- * The hard per-tool permission gate, threaded straight to the framework `Agent`.
453
- * The framework awaits it on the validated arguments immediately before each
454
- * tool runs and either proceeds (optionally with substituted input) or
455
- * short-circuits to an `isError` tool result.
456
- *
457
- * Supplied as a **factory** `(currentMode, requestApproval?) => CanUseToolFn`:
458
- * the conductor calls it once with a getter onto its OWN live permission mode,
459
- * so the gate it returns reads `permissionMode()` live — a
460
- * {@link SessionConductor.setPermissionMode} retargets later tool calls with no
461
- * agent rebuild. (A caller that does not care about the live mode can simply
462
- * ignore the getter and close over a fixed gate.)
463
- *
464
- * The OPTIONAL second argument is a stable {@link ApprovalResolver} delegate the
465
- * conductor owns: it forwards to whatever resolver was installed via
466
- * {@link SessionConductor.setApprovalResolver} at call time (and denies when none
467
- * is installed). An interactive front-end can therefore wire its approval overlay
468
- * AFTER the conductor (and its gate) are built — the factory just closes over the
469
- * delegate. A factory that ignores it keeps today's behavior.
470
- *
471
- * Optional everywhere: omit it and the framework allows every tool (today's
472
- * allow-all behavior).
473
- */
474
- readonly canUseTool?: (currentMode: () => PermissionMode, requestApproval?: ApprovalResolver) => CanUseToolFn;
475
- /**
476
- * The permission mode the session opens in. Seeds {@link SessionConductor.permissionMode};
477
- * defaults to `"default"` when absent. The mode is consulted live by the
478
- * {@link canUseTool} gate, so a later {@link SessionConductor.setPermissionMode}
479
- * changes subsequent tool calls without rebuilding the gate.
480
- */
481
- readonly permissionMode?: PermissionMode;
482
- /**
483
- * Directory the approved plan-mode plan is persisted into. When the model calls
484
- * `exit_plan_mode` and the user approves leaving plan mode, the conductor writes
485
- * the plan as a slug-named markdown file under `<plansDir>/plans/`. Absent keeps
486
- * the handshake (mode flip + context injection) but skips the disk write —
487
- * tests and headless probes can run the round-trip without a filesystem.
488
- */
489
- readonly plansDir?: string;
490
- /**
491
- * The per-session file-checkpoint store for rewind (#24), or `undefined` to run
492
- * without code checkpointing. When present, the conductor pins the active
493
- * transcript node on it (the head leaf at turn start) so a turn's file edits key
494
- * to the node that was active before the turn, and {@link SessionConductor.restoreCode}
495
- * delegates to it so the tree picker can revert the working tree.
496
- */
497
- readonly checkpoint?: CheckpointPort;
498
- }
499
- /**
500
- * The conductor of a single coding-agent session.
501
- *
502
- * It owns the framework `Agent`, threads persistence and auto-condense through
503
- * the turn loop, and exposes a small product API: submit input, subscribe to
504
- * the {@link SessionSignal} stream, abort the in-flight turn, read an immutable
505
- * {@link ConductorState} snapshot, resume a persisted session, and optionally
506
- * rotate the active model. This is the surface all three run modes drive.
507
- */
508
- export interface SessionConductor {
509
- /**
510
- * Submit user input as a new turn and run the agent to settle.
511
- *
512
- * Streams {@link SessionSignal}s to subscribers as the turn progresses and
513
- * resolves to the immutable {@link ConductorState} once the turn settles
514
- * (success or fault).
515
- *
516
- * When a turn is already in flight the input is **not** dropped: it is handed
517
- * to {@link enqueue} and run automatically as a later turn once the current one
518
- * settles. In that case `submit` resolves immediately with the current
519
- * snapshot rather than waiting for the queued turn.
520
- *
521
- * @param input the user message text for this turn
522
- */
523
- submit(input: string): Promise<ConductorState>;
524
- /**
525
- * Queue an input to run as a future turn. Used directly, or reached via
526
- * {@link submit} when the conductor is busy. Queued items drain in order after
527
- * the active turn settles, each running as its own turn. Emits a
528
- * `{ kind: "queue" }` signal so a UI can reflect the new depth.
529
- *
530
- * @param input the user message text to hold for a later turn
531
- * @param mode how it rejoins the conversation when drained (default `"followUp"`)
532
- */
533
- enqueue(input: string, mode?: QueueMode): void;
534
- /** How many inputs are currently waiting in the pending-input queue. */
535
- pendingCount(): number;
536
- /** A read-only view of the queued inputs, oldest first. */
537
- pendingInputs(): readonly QueuedInput[];
538
- /** Discard every queued input. Emits a `{ kind: "queue" }` signal. */
539
- clearQueue(): void;
540
- /**
541
- * Remove and return the text of the most-recently queued input, or `undefined`
542
- * when the queue is empty. Lets a UI pop the last entry back into its prompt.
543
- */
544
- dequeueLast(): string | undefined;
545
- /**
546
- * The live transcript messages for the active branch.
547
- *
548
- * A read-through onto the wrapped agent's running message list — what the
549
- * interactive UI renders as the conversation. The returned array is the
550
- * current contents at call time; re-read to observe later turns.
551
- */
552
- messages(): readonly AgentMessage[];
553
- /**
554
- * The full framework {@link Model} object currently bound to the session, or
555
- * `undefined` when none could be resolved. Tracks the active selection across
556
- * {@link selectModel}/{@link cycleModel} changes.
557
- */
558
- model(): Model<any> | undefined;
559
- /** Whether a turn is currently in flight (guards re-entrant submit). */
560
- isBusy(): boolean;
561
- /**
562
- * The model catalog entries a picker lists, best-first. Derived from the
563
- * configured model matcher; returns `[]` when no matcher is wired in.
564
- */
565
- availableModels(): ModelCardRef[];
566
- /**
567
- * Bind a model by canonical id for subsequent turns. The companion of
568
- * {@link cycleModel}; both route through the same selection path.
569
- *
570
- * @param id canonical id of the model to switch to
571
- */
572
- selectModel(id: string): void;
573
- /**
574
- * Replace the agent's tool deck for subsequent turns.
575
- *
576
- * Used by `/mcp` to inject the tools of freshly-connected MCP servers into the
577
- * live session (and to drop them again on disconnect). The conductor merges the
578
- * passed list with its own seed deck (the built-in tools the session was
579
- * assembled with), so callers pass only the *extra* tools to add — never the
580
- * built-ins, which are preserved automatically. Pass `[]` to clear the extras
581
- * and fall back to the seed deck alone.
582
- *
583
- * @param tools the additional tools to layer over the seed deck
584
- */
585
- registerTools(tools: AgentTool[]): void;
586
- /**
587
- * Manually run the same transcript-condense path the auto-compactor uses,
588
- * emitting the existing `compacted` signal. Safe to call when idle; a no-op
589
- * when the condense hook returns the branch unchanged.
590
- */
591
- condense(): Promise<void>;
592
- /**
593
- * Branch the transcript from a prior node. A new branch is opened whose parent
594
- * is `entryId`; the agent's message list is rebound to that branch's root→leaf
595
- * path. The conductor's head advances onto the chosen node.
596
- *
597
- * @param entryId the transcript node to branch from
598
- */
599
- fork(entryId: string): Promise<void>;
600
- /**
601
- * Move the active leaf to `nodeId`, rebuild that branch's root→leaf path, and
602
- * rebind the agent's message list to it. Used to walk between existing
603
- * branches without forking a new one.
604
- *
605
- * @param nodeId the transcript node to make the active leaf
606
- */
607
- navigateTree(nodeId: string): Promise<void>;
608
- /**
609
- * Roll the working tree back to a transcript node's file-checkpoint state
610
- * (rewind, #24). Reverts every file the node tracked to its pre-mutation content
611
- * (deleting files that were absent at that point). Additive and code-only: it
612
- * does NOT move the conversation head — pair it with {@link navigateTree}/{@link fork}
613
- * for a combined "restore code and conversation". A safe no-op when no checkpoint
614
- * store is wired or the node has no recorded snapshot.
615
- *
616
- * @param nodeId the transcript node whose file state to restore to
617
- * @returns the absolute paths that were restored (written or deleted)
618
- */
619
- restoreCode(nodeId: string): Promise<string[]>;
620
- /**
621
- * Whether the tree picker should offer "restore code" for a node — i.e. whether
622
- * the node has any recorded file-checkpoint snapshot. `false` when no checkpoint
623
- * store is wired or the node never mutated files, so the picker's restore option
624
- * is a safe no-op there.
625
- *
626
- * @param nodeId the transcript node to test
627
- */
628
- codeRestoreInfo(nodeId: string): Promise<{
629
- readonly canRestore: boolean;
630
- }>;
631
- /**
632
- * Run a shell command in the session workspace, returning its combined
633
- * stdout+stderr and exit code. Unless `opts.excludeFromContext` is set, the
634
- * output is recorded as a transcript note so it re-enters the agent's context.
635
- * Never throws: a spawn/exec failure resolves to a non-zero {@link BashOutcome}.
636
- *
637
- * @param command the shell command to execute
638
- * @param opts execution options
639
- */
640
- executeBash(command: string, opts?: ExecuteBashOptions): Promise<BashOutcome>;
641
- /** A point-in-time {@link SessionStats} tally for the active session. */
642
- stats(): SessionStats;
643
- /**
644
- * Render the session's cumulative cost + token usage as a human-readable,
645
- * multi-line report. Drives the `/cost` slash command without the caller
646
- * having to format the {@link SessionStats} figures itself.
647
- */
648
- costReport(): string;
649
- /** The reasoning effort currently applied to the session. */
650
- thinkingLevel(): ThinkingLevel;
651
- /**
652
- * Set the reasoning effort for subsequent turns. Applied to the agent when it
653
- * exposes a setter; otherwise stored and applied on the next model bind.
654
- *
655
- * @param level the reasoning effort to apply
656
- */
657
- setThinkingLevel(level: ThinkingLevel): void;
658
- /**
659
- * Advance the reasoning effort to the next level in the cycle, applying it, and
660
- * return the newly-selected level.
661
- */
662
- cycleThinkingLevel(): ThinkingLevel;
663
- /**
664
- * The permission mode currently in effect. The live `canUseTool` gate reads
665
- * this on every tool call, so the value reflects the most recent
666
- * {@link setPermissionMode}.
667
- */
668
- permissionMode(): PermissionMode;
669
- /**
670
- * Switch the permission mode for subsequent tool calls. The gate consults the
671
- * mode live (via a getter), so this takes effect on the next tool call with no
672
- * agent rebuild. A no-op-equivalent when no gate was wired (the conductor still
673
- * tracks the mode for the UI).
674
- *
675
- * @param mode the permission mode to apply
676
- */
677
- setPermissionMode(mode: PermissionMode): void;
678
- /**
679
- * Install (or clear) the host approval resolver an `ask` decision routes to.
680
- *
681
- * The `canUseTool` gate consults a STABLE delegate the conductor owns; this
682
- * method swaps the resolver behind that delegate, so an interactive front-end
683
- * can wire its approval overlay AFTER the conductor (and its gate) are built —
684
- * the exact post-mount install the React console needs. Passing `undefined`
685
- * clears it (an `ask` then deterministically denies, the non-interactive
686
- * default). A no-op-equivalent when no gate was wired; the resolver is simply
687
- * never consulted.
688
- *
689
- * @param resolver the resolver to consult on an `ask`, or `undefined` to clear
690
- */
691
- setApprovalResolver(resolver: ApprovalResolver | undefined): void;
692
- /**
693
- * Toggle plan mode on or off.
694
- *
695
- * Entering plan mode (`true`) captures the current mode as the pre-plan mode and
696
- * switches to `"plan"` (read-only — the gate blocks every mutating tool).
697
- * Leaving (`false`) restores the captured pre-plan mode (or `"default"` when none
698
- * was captured). Idempotent: toggling on while already in plan mode is a no-op,
699
- * and toggling off when not in plan mode restores/keeps `"default"`. Drives the
700
- * `/plan` command and the Shift+Tab toggle, and is the same path the conductor's
701
- * own `enter_plan_mode` / approved `exit_plan_mode` handshake uses.
702
- *
703
- * @param on `true` to enter plan mode, `false` to leave it
704
- * @returns the permission mode in effect after the toggle
705
- */
706
- togglePlanMode(on: boolean): PermissionMode;
707
- /**
708
- * Advance the permission mode to the NEXT mode in the fixed cycle and return the
709
- * new mode. The order is `default → acceptEdits → plan → bypass → (wrap)
710
- * default`; the `"bypassPermissions"` alias is folded to `"bypass"` when reading
711
- * the current mode so the cycle is stable.
712
- *
713
- * Built on top of {@link setPermissionMode}, so the live `canUseTool` gate (which
714
- * reads {@link permissionMode} on every call) picks the new mode up immediately
715
- * with no agent rebuild. Plan bookkeeping is preserved: ENTERING `"plan"` captures
716
- * the pre-plan mode exactly as {@link togglePlanMode} does, so a later round-trip
717
- * restores the prior mode; LEAVING `"plan"` (cycling `plan → bypass`) is a plain
718
- * mode change — it does NOT run the `exit_plan_mode` approval handshake, since a
719
- * manual cycle is not a plan exit. Drives the Shift+Tab cycle; {@link togglePlanMode}
720
- * remains the path `/plan` uses.
721
- *
722
- * @returns the permission mode in effect after the advance
723
- */
724
- cyclePermissionMode(): PermissionMode;
725
- /**
726
- * The mode captured when plan mode was last entered, restored on exit — or
727
- * `undefined` when not currently in (or paused from) plan mode. Exposed so a UI
728
- * (and the round-trip tests) can observe the Enter/Exit pairing.
729
- */
730
- prePlanMode(): PermissionMode | undefined;
731
- /** The human-readable session name, or `undefined` when none is set. */
732
- sessionName(): string | undefined;
733
- /**
734
- * Assign a human-readable name to the session.
735
- *
736
- * @param name the display name to store
737
- */
738
- setSessionName(name: string): void;
739
- /**
740
- * Register a handler for the {@link SessionSignal} stream.
741
- *
742
- * @param handler invoked for every emitted signal
743
- * @returns an unsubscribe function that removes the handler
744
- */
745
- subscribe(handler: SignalHandler): () => void;
746
- /** Cancel the in-flight turn, if any; emits an `aborted` fault signal. */
747
- abort(): void;
748
- /** Read an immutable snapshot of the current {@link ConductorState}. */
749
- snapshot(): ConductorState;
750
- /**
751
- * Restore a previously persisted session, replacing the current transcript
752
- * and rebinding the agent to the restored model/leaf.
753
- *
754
- * @param sessionId the persisted session to resume
755
- */
756
- resume(sessionId: string): Promise<void>;
757
- /**
758
- * Abandon the current conversation and start a fresh, empty session.
759
- *
760
- * Drops the agent's message history, opens a new session id (so later turns
761
- * persist separately, leaving the prior transcript intact on disk), zeroes the
762
- * usage tally, clears the pending-input queue and session name, and settles to
763
- * `idle`. Emits an `idle` signal so a subscribed UI re-renders the now-empty
764
- * conversation. This is what `/clear` (and `/new`) drive.
765
- */
766
- newSession(): Promise<void>;
767
- /**
768
- * Rotate the active model for subsequent turns. Optional: not every assembly
769
- * supports mid-session model changes.
770
- *
771
- * @param id canonical id of the model to switch to
772
- */
773
- cycleModel?(id: string): void;
774
- }