@wrongstack/cli 0.313.0 → 0.316.1

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 (235) hide show
  1. package/dist/{acp-LQMSMV32.js → acp-CEQINXWB.js} +2 -2
  2. package/dist/acp-registry-cache.d.ts +0 -2
  3. package/dist/acp-server-agent.d.ts +2 -1
  4. package/dist/arg-parser.d.ts +2 -1
  5. package/dist/{auth-VQMSZGKE.js → auth-GZ5A5OF5.js} +3 -3
  6. package/dist/auth-menu/local.d.ts +3 -2
  7. package/dist/boot/boot-auto-thin.d.ts +44 -0
  8. package/dist/boot/brain-decision-log.d.ts +2 -1
  9. package/dist/boot/config-backup-recovery.d.ts +2 -6
  10. package/dist/boot/dispatch-singleshot.d.ts +2 -1
  11. package/dist/boot/dispatch-webui.d.ts +5 -1
  12. package/dist/boot/event-wiring.d.ts +1 -1
  13. package/dist/boot/execution-mode.d.ts +2 -1
  14. package/dist/boot/governance-shadow-bridge.d.ts +4 -3
  15. package/dist/boot/governance-trace-context.d.ts +4 -4
  16. package/dist/boot/launch-menu.d.ts +2 -2
  17. package/dist/boot/system-prompt-builder.d.ts +1 -1
  18. package/dist/boot/system-prompt-menu.d.ts +10 -58
  19. package/dist/boot/system-prompt.d.ts +3 -3
  20. package/dist/boot/tool-registry.d.ts +3 -1
  21. package/dist/boot/tui-coordinator-callbacks.d.ts +2 -1
  22. package/dist/boot/tui-coordinator-setup.d.ts +3 -2
  23. package/dist/boot/tui-goal-wiring.d.ts +2 -1
  24. package/dist/boot/tui-live-sessions.d.ts +3 -1
  25. package/dist/boot/tui-session-resume.d.ts +82 -10
  26. package/dist/boot/tui-session-stub-enrich.d.ts +7 -1
  27. package/dist/boot/tui-settings-adapter.d.ts +3 -2
  28. package/dist/boot/tui-theme-adapter.d.ts +3 -2
  29. package/dist/boot/webui-session-child.d.ts +2 -12
  30. package/dist/boot-auto-thin-BZ675EVT.js +102 -0
  31. package/dist/boot-config.d.ts +1 -1
  32. package/dist/brain-menu/panel-service.d.ts +2 -1
  33. package/dist/chimera-cascade-evidence.d.ts +4 -21
  34. package/dist/chimera-review-task.d.ts +0 -7
  35. package/dist/chimera-subagent-ladder.d.ts +2 -2
  36. package/dist/{chunk-USYOJIV2.js → chunk-32MTOI2I.js} +2 -2
  37. package/dist/{chunk-CNQZ4HG4.js → chunk-37SPPLUD.js} +57 -8
  38. package/dist/chunk-ALE5KHCA.js +1 -0
  39. package/dist/{chunk-GWVLRUVH.js → chunk-G3IMKQRH.js} +25 -6
  40. package/dist/{chunk-BZJ4MP32.js → chunk-GKHUHAIK.js} +8 -3
  41. package/dist/{chunk-3JPTNADJ.js → chunk-GPPRNAKW.js} +1 -1
  42. package/dist/{chunk-KE7E7DPX.js → chunk-HXJYHAR4.js} +1 -1
  43. package/dist/{chunk-X3N5TS2S.js → chunk-JACOMTIH.js} +2 -76
  44. package/dist/{chunk-DGXNL7OT.js → chunk-JHUJUIOH.js} +1 -18
  45. package/dist/{chunk-WOTGMHAH.js → chunk-KG4X5F7Z.js} +1 -1
  46. package/dist/{chunk-NUIHRGPY.js → chunk-NV3JDK4F.js} +1 -1
  47. package/dist/{chunk-E3X4KM7T.js → chunk-NZZOYLQ7.js} +5 -10
  48. package/dist/{chunk-H6C7SO5H.js → chunk-QC5I4VWZ.js} +1 -1
  49. package/dist/chunk-SXJTVNWF.js +78 -0
  50. package/dist/{chunk-AOAIPYFB.js → chunk-SYIBTG3X.js} +2 -2
  51. package/dist/{chunk-PKHGLWUJ.js → chunk-T642Q732.js} +5 -4
  52. package/dist/{chunk-BGFM3PD7.js → chunk-UZ2TMHNH.js} +1 -1
  53. package/dist/{chunk-4S52MIIM.js → chunk-VXCCBI2W.js} +2 -2
  54. package/dist/{chunk-FKWHSFX4.js → chunk-XYKYXFEE.js} +1 -1
  55. package/dist/cli-entry-point.d.ts +9 -0
  56. package/dist/cli-eternal-flag.d.ts +1 -1
  57. package/dist/{cli-main-BFUSCWXE.js → cli-main-IEAM6SK7.js} +3692 -1619
  58. package/dist/cli-main-helpers.d.ts +3 -3
  59. package/dist/config-doctor.d.ts +34 -3
  60. package/dist/context-limit.d.ts +4 -3
  61. package/dist/{diag-doctor-OPTB2NWY.js → diag-doctor-LFCCBPMD.js} +3 -3
  62. package/dist/execute-deps.d.ts +36 -7
  63. package/dist/{execution-TOBPK6MD.js → execution-TZUGCKFU.js} +462 -78
  64. package/dist/execution-chimera-cascade.d.ts +1 -1
  65. package/dist/execution-chimera-review.d.ts +1 -1
  66. package/dist/execution-cleanup.d.ts +2 -1
  67. package/dist/execution-kanban-dispatch.d.ts +2 -1
  68. package/dist/execution-repl-fleet-callbacks.d.ts +3 -2
  69. package/dist/fleet/budget-source.d.ts +2 -1
  70. package/dist/fleet/host-context.d.ts +8 -1
  71. package/dist/fleet/host-director-event-bridges.d.ts +28 -3
  72. package/dist/fleet/host-event-bridge.d.ts +6 -1
  73. package/dist/fleet/host-explore-companion-registry.d.ts +60 -0
  74. package/dist/fleet/host-explore-companion.d.ts +7 -3
  75. package/dist/fleet/host-provider.d.ts +2 -1
  76. package/dist/fleet/host-session-writer.d.ts +9 -1
  77. package/dist/fleet/host-shadow-manager.d.ts +82 -20
  78. package/dist/fleet/host-shadow-pass.d.ts +9 -1
  79. package/dist/fleet/host-spawn-types.d.ts +9 -0
  80. package/dist/fleet/host-status.d.ts +2 -1
  81. package/dist/fleet/host-subagent-factory.d.ts +2 -1
  82. package/dist/fleet/host-subagent-session-audit.d.ts +56 -0
  83. package/dist/fleet/host-supervisor.d.ts +11 -1
  84. package/dist/fleet/host-task-result-report.d.ts +2 -1
  85. package/dist/fleet/host.d.ts +38 -6
  86. package/dist/fleet/status-broadcast.d.ts +2 -1
  87. package/dist/fleet-statusline.d.ts +2 -1
  88. package/dist/goal-host.d.ts +3 -2
  89. package/dist/{governance-V2Z42RBE.js → governance-JSGHHA2R.js} +1 -1
  90. package/dist/governance-hq-telemetry.d.ts +2 -2
  91. package/dist/{hq-2XIXGAER.js → hq-NDTJRRX3.js} +3 -3
  92. package/dist/hq-publisher.d.ts +1 -1
  93. package/dist/hq-recovery-html.d.ts +1 -6
  94. package/dist/hq-server/auth-state.d.ts +2 -1
  95. package/dist/hq-server/auth.d.ts +3 -2
  96. package/dist/hq-server/login-attempt-store.d.ts +2 -1
  97. package/dist/hq-server/mailbox-gateway-manager.d.ts +2 -1
  98. package/dist/hq-server/preflight.d.ts +3 -2
  99. package/dist/hq-server/server-lifecycle.d.ts +2 -1
  100. package/dist/hq-server/snapshot.d.ts +0 -9
  101. package/dist/hq-server/startup.d.ts +2 -3
  102. package/dist/hq-server/types.d.ts +2 -2
  103. package/dist/hq-server/upgrade-handler.d.ts +2 -1
  104. package/dist/hq-server/ws-leader.d.ts +0 -6
  105. package/dist/{hq-server-DBT3OOYD.js → hq-server-OH3SPSE2.js} +3 -13
  106. package/dist/hq-server.d.ts +1 -6
  107. package/dist/hq-static-serve.d.ts +2 -1
  108. package/dist/{hq-ttl-U2FAYFAT.js → hq-ttl-KUO3AU7X.js} +2 -2
  109. package/dist/{hq-tunnel-RFKGC4HI.js → hq-tunnel-LO55RCZE.js} +1 -1
  110. package/dist/hq-tunnel.d.ts +2 -1
  111. package/dist/index.js +113 -109
  112. package/dist/input-reader.d.ts +2 -1
  113. package/dist/kanban-dispatch-route.d.ts +27 -2
  114. package/dist/kanban-hq-sync.d.ts +2 -1
  115. package/dist/launch-hints.d.ts +2 -1
  116. package/dist/live-settings-input.d.ts +5 -0
  117. package/dist/mailbox-bridge-bootstrap.d.ts +2 -3
  118. package/dist/{mailbox-serve-5S3PHG5D.js → mailbox-serve-VKQIRCCB.js} +47 -28
  119. package/dist/{mcp-RRPKNRSN.js → mcp-AQKSASHD.js} +1 -1
  120. package/dist/mcp-serve.d.ts +2 -1
  121. package/dist/{modeldiag-H6DKWJ2N.js → modeldiag-4NYBRSFP.js} +1 -1
  122. package/dist/next-task-predictor.d.ts +3 -2
  123. package/dist/permission-prompt.d.ts +2 -1
  124. package/dist/picker.d.ts +0 -18
  125. package/dist/plugin-management.d.ts +3 -14
  126. package/dist/{plugin-usage-GCTYOZPH.js → plugin-usage-AP7SJCDA.js} +2 -2
  127. package/dist/{plugins-EEKHCMBE.js → plugins-HQ5FU2AM.js} +3 -5
  128. package/dist/preflight.d.ts +2 -1
  129. package/dist/{proxy-wiring-G26YGP7S.js → proxy-wiring-EQB5X5YH.js} +3 -3
  130. package/dist/renderer.d.ts +18 -1
  131. package/dist/repl-client-registration.d.ts +2 -1
  132. package/dist/repl.d.ts +1 -1
  133. package/dist/{replay-XU6ZD7GM.js → replay-FJ2JBXUA.js} +1 -1
  134. package/dist/{sdd-runtime-GFZ3NJKS.js → sdd-runtime-FLKCSTYV.js} +3 -5
  135. package/dist/services/commit-message.d.ts +2 -1
  136. package/dist/services/sdd/state.d.ts +0 -2
  137. package/dist/services/sdd-runtime.d.ts +1 -1
  138. package/dist/services/statusline-config.d.ts +27 -4
  139. package/dist/session-event-wiring.d.ts +3 -5
  140. package/dist/{sessions-config-7Q7QJBKJ.js → sessions-config-P2LK2L32.js} +5 -1
  141. package/dist/sessions-doctor-EXHAZSSE.js +146 -0
  142. package/dist/settings-menu.d.ts +2 -1
  143. package/dist/shutdown-cleanup.d.ts +3 -2
  144. package/dist/{simpleui-dist-33VO3QHF.js → simpleui-dist-JKNRCRRK.js} +1 -1
  145. package/dist/simpleui-dist.d.ts +3 -2
  146. package/dist/slash-commands/brain-council.d.ts +0 -4
  147. package/dist/slash-commands/brain-status.d.ts +0 -1
  148. package/dist/slash-commands/command-context.d.ts +16 -2
  149. package/dist/slash-commands/fix-classifier.d.ts +2 -1
  150. package/dist/slash-commands/kanban-agent-helpers.d.ts +2 -1
  151. package/dist/slash-commands/kanban-board-handlers.d.ts +2 -1
  152. package/dist/slash-commands/kanban-lifecycle-diagnostics.d.ts +2 -1
  153. package/dist/slash-commands/kanban-task-subcommands.d.ts +0 -1
  154. package/dist/slash-commands/memory-audience.d.ts +1 -10
  155. package/dist/slash-commands/memory-flags.d.ts +2 -1
  156. package/dist/slash-commands/sdd-command-helpers.d.ts +3 -2
  157. package/dist/slash-commands/sdd.d.ts +2 -2
  158. package/dist/slash-commands/settings-mutations.d.ts +0 -1
  159. package/dist/slash-commands/sidebar.d.ts +4 -0
  160. package/dist/slash-commands/statusline.d.ts +4 -4
  161. package/dist/slash-commands/telegram-pairing.d.ts +2 -2
  162. package/dist/slash-commands/telegram-setup.d.ts +2 -1
  163. package/dist/slash-commands/tier.d.ts +13 -0
  164. package/dist/subcommands/handlers/acp-connection-gate.d.ts +4 -3
  165. package/dist/subcommands/handlers/bench-run-help.d.ts +3 -8
  166. package/dist/subcommands/handlers/daemon-inventory.d.ts +3 -2
  167. package/dist/subcommands/handlers/governance.d.ts +2 -1
  168. package/dist/subcommands/handlers/model-smoke-test.d.ts +3 -2
  169. package/dist/subcommands/handlers/modeldiag-eval.d.ts +0 -4
  170. package/dist/subcommands/handlers/modeldiag-profiles.d.ts +1 -1
  171. package/dist/subcommands/handlers/models-add-help.d.ts +3 -8
  172. package/dist/subcommands/handlers/sessions-doctor.d.ts +3 -0
  173. package/dist/subcommands/handlers/update.d.ts +1 -1
  174. package/dist/terminal-format.d.ts +3 -2
  175. package/dist/tui-resource-menus.d.ts +2 -1
  176. package/dist/tuneup.d.ts +5 -5
  177. package/dist/{update-ZXNC6I6G.js → update-XKARO3CY.js} +3 -3
  178. package/dist/{update-check-WARHSVZA.js → update-check-LICQNYFK.js} +2 -2
  179. package/dist/update-check.d.ts +1 -1
  180. package/dist/utils/hq-ttl.d.ts +2 -1
  181. package/dist/webui-server/connection-handler.d.ts +34 -2
  182. package/dist/webui-server/prefs-seeding.d.ts +11 -1
  183. package/dist/webui-server/route-contexts.d.ts +45 -5
  184. package/dist/webui-server/session-start-payload.d.ts +13 -0
  185. package/dist/webui-server/setup-events.d.ts +14 -1
  186. package/dist/{webui-server-I53IYBW4.js → webui-server-LZOEH7O6.js} +374 -169
  187. package/dist/webui-server-options.d.ts +30 -4
  188. package/dist/wiring/brain-and-orchestration.d.ts +3 -3
  189. package/dist/wiring/cli-execute-builder.d.ts +3 -0
  190. package/dist/wiring/cli-heap-watchdog.d.ts +2 -1
  191. package/dist/wiring/cli-prompt-and-tools-setup.d.ts +10 -8
  192. package/dist/wiring/codebase-index.d.ts +2 -1
  193. package/dist/wiring/command-host-state.d.ts +61 -5
  194. package/dist/wiring/controllers.d.ts +3 -4
  195. package/dist/wiring/dep-watcher-bridge.d.ts +3 -2
  196. package/dist/wiring/dep-watcher.d.ts +2 -1
  197. package/dist/wiring/design-studio.d.ts +2 -1
  198. package/dist/wiring/director-setup.d.ts +3 -2
  199. package/dist/wiring/domain-terms-mirror.d.ts +2 -1
  200. package/dist/wiring/external-plugins.d.ts +3 -2
  201. package/dist/wiring/fleet-command-handlers.d.ts +2 -2
  202. package/dist/wiring/heap-watchdog-setup.d.ts +2 -1
  203. package/dist/wiring/hq-telemetry.d.ts +3 -2
  204. package/dist/wiring/lifecycle-plugins.d.ts +2 -2
  205. package/dist/wiring/management-tools.d.ts +30 -2
  206. package/dist/wiring/metrics.d.ts +2 -2
  207. package/dist/wiring/plugins.d.ts +0 -1
  208. package/dist/wiring/prompt-journal-recorder.d.ts +1 -1
  209. package/dist/wiring/provider-runtime-setup.d.ts +9 -2
  210. package/dist/wiring/provider-runtime.d.ts +23 -3
  211. package/dist/wiring/provider-status.d.ts +2 -1
  212. package/dist/wiring/provider-utility-tools.d.ts +2 -1
  213. package/dist/wiring/provider.d.ts +2 -1
  214. package/dist/wiring/replay-governance-setup.d.ts +2 -1
  215. package/dist/wiring/replay.d.ts +2 -1
  216. package/dist/wiring/resume-candidate.d.ts +27 -0
  217. package/dist/wiring/runtime-controller-deps.d.ts +8 -1
  218. package/dist/wiring/runtime-dispatch-state.d.ts +2 -1
  219. package/dist/wiring/runtime-lifecycle-deps.d.ts +2 -1
  220. package/dist/wiring/runtime-picker-deps.d.ts +2 -1
  221. package/dist/wiring/session-command-handlers.d.ts +2 -2
  222. package/dist/wiring/session-establishment.d.ts +2 -1
  223. package/dist/wiring/session-registry.d.ts +3 -2
  224. package/dist/wiring/session-runtime.d.ts +1 -1
  225. package/dist/wiring/slash-commands.d.ts +5 -4
  226. package/dist/wiring/teardown-registrar.d.ts +3 -2
  227. package/dist/wiring/vector-memory-setup.d.ts +3 -2
  228. package/dist/wiring/wrongtrace-hooks.d.ts +1 -1
  229. package/dist/wiring/wrongtrace-telemetry.d.ts +2 -1
  230. package/dist/{wrongtrace-telemetry-6M2CCBX5.js → wrongtrace-telemetry-FNLANZ5I.js} +1 -1
  231. package/package.json +30 -30
  232. package/dist/auth-menu.d.ts +0 -7
  233. package/dist/chunk-WHOIR577.js +0 -1
  234. package/dist/webui-server/terminal-log-view.d.ts +0 -47
  235. package/dist/wiring/tools.d.ts +0 -29
@@ -3,7 +3,7 @@ import {
3
3
  loadCachedAcpRegistry,
4
4
  refreshAcpRegistry,
5
5
  setupProvider
6
- } from "./chunk-CNQZ4HG4.js";
6
+ } from "./chunk-37SPPLUD.js";
7
7
  import "./chunk-QYIIOMLE.js";
8
8
  import "./chunk-BXFYBQKR.js";
9
9
  import "./chunk-7OCVIDC7.js";
@@ -913,4 +913,4 @@ ${renderAcpBenchText(result)}
913
913
  export {
914
914
  acpCmd
915
915
  };
916
- //# sourceMappingURL=acp-LQMSMV32.js.map
916
+ //# sourceMappingURL=acp-CEQINXWB.js.map
@@ -17,8 +17,6 @@ export interface LoadedAcpRegistry {
17
17
  /** Full descriptors, for listing. */
18
18
  agents: ACPAgentDescriptor[];
19
19
  }
20
- /** Where the synced registry snapshot lives. */
21
- export declare function acpRegistryCachePath(paths: WstackPaths): string;
22
20
  /** Read the cached registry, or `null` if it's missing or unreadable. */
23
21
  export declare function loadCachedAcpRegistry(paths: WstackPaths): Promise<LoadedAcpRegistry | null>;
24
22
  /** Fetch the live registry and persist it. Throws on network/parse failure. */
@@ -25,7 +25,7 @@ import type { SubcommandDeps } from './subcommands/contracts.js';
25
25
  export declare class AcpServerConfigError extends Error {
26
26
  constructor(message: string);
27
27
  }
28
- export interface AcpAgentFactoryOptions {
28
+ interface AcpAgentFactoryOptions {
29
29
  /** Caller-supplied logger; a minimal stderr logger is created when omitted. */
30
30
  logger?: Logger | undefined;
31
31
  }
@@ -64,4 +64,5 @@ export declare class ACPClientPermissionPolicy implements PermissionPolicy {
64
64
  * Throws `AcpServerConfigError` up front if no provider is configured.
65
65
  */
66
66
  export declare function buildAcpServerAgentFactory(deps: SubcommandDeps, options?: AcpAgentFactoryOptions): (sessionId: string, cwd: string, api?: RunTurnApi) => Promise<Agent>;
67
+ export {};
67
68
  //# sourceMappingURL=acp-server-agent.d.ts.map
@@ -19,7 +19,7 @@ export interface AuthFlags {
19
19
  }
20
20
  /** Parse `wstack auth <provider> [--label ...] [--family ...] [...]` flags. */
21
21
  export declare function parseAuthFlags(args: string[]): AuthFlags;
22
- export interface SpawnFlags {
22
+ interface SpawnFlags {
23
23
  description: string;
24
24
  opts: {
25
25
  provider?: string | undefined;
@@ -38,4 +38,5 @@ export interface SpawnFlags {
38
38
  * Anything after the last flag is the task description.
39
39
  */
40
40
  export declare function parseSpawnFlags(input: string): SpawnFlags;
41
+ export {};
41
42
  //# sourceMappingURL=arg-parser.d.ts.map
@@ -13,7 +13,7 @@ import {
13
13
  runOAuthLoginKind,
14
14
  runOAuthLoginMenu,
15
15
  validateFamily
16
- } from "./chunk-USYOJIV2.js";
16
+ } from "./chunk-32MTOI2I.js";
17
17
  import {
18
18
  restoreFlags
19
19
  } from "./chunk-CSAPOCBP.js";
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-2VMJ3E5Z.js";
24
24
  import {
25
25
  parseAuthFlags
26
- } from "./chunk-PKHGLWUJ.js";
26
+ } from "./chunk-T642Q732.js";
27
27
  import "./chunk-B4JLSXZB.js";
28
28
  import "./chunk-VUVOMXWP.js";
29
29
  import {
@@ -596,4 +596,4 @@ async function runAuthRemove(deps, providerId) {
596
596
  export {
597
597
  authCmd
598
598
  };
599
- //# sourceMappingURL=auth-VQMSZGKE.js.map
599
+ //# sourceMappingURL=auth-GZ5A5OF5.js.map
@@ -28,10 +28,11 @@ import type { SecretScrubber } from '@wrongstack/core/types';
28
28
  import type { ProbeOptions, ProbeResult } from '@wrongstack/runtime/probe';
29
29
  import { probeLocalLlm } from '@wrongstack/runtime/probe';
30
30
  import { type AuthAuditLogger } from './auth-menu-audit.js';
31
- import { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry } from './local-presets.js';
31
+ import { LOCAL_LLM_PRESETS } from './local-presets.js';
32
+ export type { LocalLlmPresetEntry } from './local-presets.js';
32
33
  import { suggestLabel } from './shared.js';
33
34
  import type { AuthMenuDeps } from './types.js';
34
- export { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry, type ProbeOptions, type ProbeResult, probeLocalLlm, };
35
+ export { LOCAL_LLM_PRESETS, type ProbeOptions, type ProbeResult, probeLocalLlm };
35
36
  export interface RunAuthLocalOptions {
36
37
  /**
37
38
  * Direct pick: skip the interactive menu and configure this preset.
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Boot-time entry point for the auto-thinning pipeline.
3
+ *
4
+ * Called once after `registerBuiltinTools` and after the Chronicle
5
+ * metrics store is opened. If `tools.autoThin.enabled` is true AND
6
+ * `tools.autoThin.applyOnBoot` is true, the pipeline queries the
7
+ * configured source (Chronicle primary, in-process bridge fallback),
8
+ * filters with the policy, and calls `registry.thinUnderused()`.
9
+ *
10
+ * The decision is persisted back to `disabledTools` and
11
+ * `disabledToolMeta` via `configStore.update` so the next boot picks up
12
+ * the same set without re-running the policy.
13
+ */
14
+ import type { ChronicleMetricsStore } from '@wrongstack/core/chronicle';
15
+ import type { EventBus } from '@wrongstack/core/kernel';
16
+ import { type ToolUsageSnapshot, type UnderusedToolCandidate } from '@wrongstack/core/observability';
17
+ import type { ToolRegistry } from '@wrongstack/core/registry';
18
+ import type { AutoThinConfig, ConfigStore } from '@wrongstack/core/types';
19
+ interface BootAutoThinDeps {
20
+ toolRegistry: ToolRegistry;
21
+ events: EventBus;
22
+ configStore: ConfigStore;
23
+ config: AutoThinConfig;
24
+ chronicle?: ChronicleMetricsStore | undefined;
25
+ /** In-process bridge snapshot — fallback when Chronicle is unavailable. */
26
+ bridge?: ToolUsageSnapshot | undefined;
27
+ /** Wall-clock anchor for tests; defaults to `Date.now()`. */
28
+ now?: () => number;
29
+ /**
30
+ * When true, log the dry-run outcome but do not mutate the registry
31
+ * or persist anything. Used by `/tool autothin candidates` and by
32
+ * the WebUI's "Run now" preview.
33
+ */
34
+ dryRun?: boolean;
35
+ }
36
+ interface BootAutoThinResult {
37
+ candidates: UnderusedToolCandidate[];
38
+ applied: string[];
39
+ skipped: string[];
40
+ source: 'chronicle' | 'in-process' | 'none';
41
+ }
42
+ export declare function runBootAutoThin(deps: BootAutoThinDeps): Promise<BootAutoThinResult>;
43
+ export {};
44
+ //# sourceMappingURL=boot-auto-thin.d.ts.map
@@ -12,7 +12,7 @@
12
12
  * The host wires this up once at boot and retains a reference to `brainLog`
13
13
  * (and indirectly `pushBrainLog`) for the duration of the session.
14
14
  */
15
- export type BrainDecisionKind = 'answered' | 'ask_human' | 'denied' | 'intervention' | 'council_warn';
15
+ type BrainDecisionKind = 'answered' | 'ask_human' | 'denied' | 'intervention' | 'council_warn';
16
16
  export interface BrainDecisionEntry {
17
17
  at: number;
18
18
  kind: BrainDecisionKind;
@@ -37,4 +37,5 @@ export declare function subscribeBrainDecisionLog(events: any): {
37
37
  pushBrainLog: (entry: BrainDecisionEntry) => void;
38
38
  dispose: () => void;
39
39
  };
40
+ export {};
40
41
  //# sourceMappingURL=brain-decision-log.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import type { ReadlineInputReader } from '../input-reader.js';
2
2
  import type { TerminalRenderer } from '../renderer.js';
3
- export interface ProviderConfigBackup {
3
+ interface ProviderConfigBackup {
4
4
  filePath: string;
5
5
  fileName: string;
6
6
  raw: string;
@@ -19,11 +19,6 @@ export declare function defaultProfileProvidersAreEmpty(profilePath: string): Pr
19
19
  * `profiles-default-config-2026-07-19T12-34-56-789.json`.
20
20
  */
21
21
  export declare function findLatestProviderBackup(globalRoot: string): Promise<ProviderConfigBackup | undefined>;
22
- export declare function restoreDefaultProfileBackup(opts: {
23
- backup: ProviderConfigBackup;
24
- globalRoot: string;
25
- profilePath: string;
26
- }): Promise<void>;
27
22
  /** Prompt once during an ordinary interactive boot. Enter accepts recovery. */
28
23
  export declare function maybeRestoreDefaultProfileFromBackup(opts: {
29
24
  globalRoot: string;
@@ -31,4 +26,5 @@ export declare function maybeRestoreDefaultProfileFromBackup(opts: {
31
26
  renderer: TerminalRenderer;
32
27
  reader: ReadlineInputReader;
33
28
  }): Promise<boolean>;
29
+ export {};
34
30
  //# sourceMappingURL=config-backup-recovery.d.ts.map
@@ -14,7 +14,7 @@
14
14
  import type { Agent } from '@wrongstack/core/agent';
15
15
  import type { TokenCounter } from '@wrongstack/core/types';
16
16
  import type { TerminalRenderer } from '../renderer.js';
17
- export interface SingleShotDispatchContext {
17
+ interface SingleShotDispatchContext {
18
18
  /** The agent to run. */
19
19
  agent: Agent;
20
20
  /** Joined positional args forming the query string. */
@@ -33,4 +33,5 @@ export interface SingleShotDispatchContext {
33
33
  * aborted.
34
34
  */
35
35
  export declare function runSingleShotDispatch(ctx: SingleShotDispatchContext): Promise<number>;
36
+ export {};
36
37
  //# sourceMappingURL=dispatch-singleshot.d.ts.map
@@ -67,7 +67,7 @@ export interface WebUIDispatchContext {
67
67
  /** Read-only worker transcript snapshot used for browser refresh replay. */
68
68
  agentTranscripts?: {
69
69
  getAllSessions(): import('@wrongstack/core/coordination').AgentVirtualSession[];
70
- loadSessionsFromDisk(): Promise<import('@wrongstack/core/coordination').AgentVirtualSession[]>;
70
+ loadSessionsFromDisk(only?: readonly string[]): Promise<import('@wrongstack/core/coordination').AgentVirtualSession[]>;
71
71
  } | undefined;
72
72
  /**
73
73
  * Pre-computed update info from the CLI's preflight version check.
@@ -83,6 +83,8 @@ export interface WebUIDispatchContext {
83
83
  model?: string | undefined;
84
84
  fallbackModels?: string[] | undefined;
85
85
  fallbackProfile?: string | undefined;
86
+ tier?: string | undefined;
87
+ role?: string | undefined;
86
88
  skills?: string[] | undefined;
87
89
  tools?: string[] | undefined;
88
90
  name?: string | undefined;
@@ -95,6 +97,8 @@ export interface WebUIDispatchContext {
95
97
  }) => Promise<string>) | undefined;
96
98
  /** Live fleet budget for WebUI concurrency/spawn gauges (issue #323). */
97
99
  getFleetBudget?: CliWebUIOptions['getFleetBudget'];
100
+ stopSessionFleet?: CliWebUIOptions['stopSessionFleet'];
101
+ onSessionRetired?: CliWebUIOptions['onSessionRetired'];
98
102
  /** Internal one-session child launch metadata, when --webui-session-child is active. */
99
103
  webuiSessionChild?: WebuiSessionChildOptions | undefined;
100
104
  }
@@ -1,5 +1,5 @@
1
1
  import type { EventBus } from '@wrongstack/core/kernel';
2
- export interface EventWiringRenderer {
2
+ interface EventWiringRenderer {
3
3
  write(text: string): void;
4
4
  }
5
5
  export type EvOn = (event: string, handler: (...args: any) => void) => void;
@@ -5,6 +5,7 @@
5
5
  * launchers, and execute(): a one-shot prompt owns the process, WebUI owns
6
6
  * stdout when requested alongside TUI, and --no-tui falls back to REPL.
7
7
  */
8
- export type ExecutionMode = 'single-shot' | 'tui' | 'webui' | 'repl';
8
+ type ExecutionMode = 'single-shot' | 'tui' | 'webui' | 'repl';
9
9
  export declare function resolveExecutionMode(positional: readonly string[], flags: Readonly<Record<string, string | boolean>>): ExecutionMode;
10
+ export {};
10
11
  //# sourceMappingURL=execution-mode.d.ts.map
@@ -1,13 +1,13 @@
1
1
  import type { EventBus } from '@wrongstack/core/kernel';
2
2
  import type { GovernanceRuntimeObservationInput, GovernanceRuntimeObservationResult } from '@wrongstack/runtime/governance-bootstrap';
3
3
  import type { GovernanceTraceContext } from './governance-trace-context.js';
4
- export interface GovernanceObservationSink {
4
+ interface GovernanceObservationSink {
5
5
  observe(input: GovernanceRuntimeObservationInput): Promise<GovernanceRuntimeObservationResult>;
6
6
  }
7
- export interface GovernanceShadowLogger {
7
+ interface GovernanceShadowLogger {
8
8
  warn(message: string, context?: unknown): void;
9
9
  }
10
- export interface GovernanceShadowBridge {
10
+ interface GovernanceShadowBridge {
11
11
  close(): void;
12
12
  }
13
13
  export declare function createGovernanceShadowBridge(input: {
@@ -16,4 +16,5 @@ export declare function createGovernanceShadowBridge(input: {
16
16
  readonly logger: GovernanceShadowLogger;
17
17
  readonly trace: GovernanceTraceContext;
18
18
  }): GovernanceShadowBridge;
19
+ export {};
19
20
  //# sourceMappingURL=governance-shadow-bridge.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import type { WorkspaceCheckpointRef } from '@wrongstack/core/types';
2
2
  export declare const MAX_GOVERNANCE_PLAN_BYTES: number;
3
- export declare const MAX_GOVERNANCE_ACTIVE_STEP_IDS = 128;
4
- export type GovernancePlanTrace = {
3
+ type GovernancePlanTrace = {
5
4
  readonly state: 'missing' | 'invalid' | 'unreadable';
6
5
  } | {
7
6
  readonly state: 'refreshing';
@@ -19,7 +18,7 @@ export type GovernancePlanTrace = {
19
18
  readonly activeStepIds: readonly string[];
20
19
  readonly activeStepIdsTruncated: boolean;
21
20
  };
22
- export type GovernanceWorkspaceTrace = {
21
+ type GovernanceWorkspaceTrace = {
23
22
  readonly state: 'not_captured';
24
23
  } | {
25
24
  readonly state: 'unavailable';
@@ -53,7 +52,7 @@ export interface GovernanceTraceContext {
53
52
  updateWorkspaceCheckpoint(promptIndex: number, observedAt: string, checkpoint: WorkspaceCheckpointRef | undefined): void;
54
53
  snapshot(taskId: string | null, boardId?: string | undefined): GovernanceTraceContextSnapshot;
55
54
  }
56
- export interface GovernanceTraceContextDependencies {
55
+ interface GovernanceTraceContextDependencies {
57
56
  readonly readFile: (filePath: string) => Promise<string>;
58
57
  readonly now: () => string;
59
58
  }
@@ -61,4 +60,5 @@ export declare function createGovernanceTraceContext(input: {
61
60
  readonly sessionId: string;
62
61
  readonly planPath: string;
63
62
  }, dependencies?: GovernanceTraceContextDependencies): Promise<GovernanceTraceContext>;
63
+ export {};
64
64
  //# sourceMappingURL=governance-trace-context.d.ts.map
@@ -34,9 +34,9 @@ import type { LaunchMenuChoice } from '@wrongstack/core/types';
34
34
  import type { ReadlineInputReader } from '../input-reader.js';
35
35
  import type { TerminalRenderer } from '../renderer.js';
36
36
  /** Top-level surfaces the user can launch from the menu. */
37
- export type LaunchMenuMode = LaunchMenuChoice['mode'];
37
+ type LaunchMenuMode = LaunchMenuChoice['mode'];
38
38
  /** Resolved menu result — the caller must act on this, not re-derive. */
39
- export interface LaunchMenuResult extends LaunchMenuChoice {
39
+ interface LaunchMenuResult extends LaunchMenuChoice {
40
40
  /**
41
41
  * True when the user typed `q` (or pressed Ctrl+C) at any prompt.
42
42
  * Caller should exit gracefully with code 0.
@@ -10,7 +10,7 @@ export interface MutableRef<T> {
10
10
  * on the full WstackPaths shape (which is huge and subject
11
11
  * to change).
12
12
  */
13
- export interface SystemPromptBuilderPaths {
13
+ interface SystemPromptBuilderPaths {
14
14
  projectGoal: string;
15
15
  projectSessions: string;
16
16
  globalInstructions?: string | undefined;
@@ -18,24 +18,22 @@
18
18
  * `q` at any prompt throws `LaunchAbortedError` (the same cancellation
19
19
  * contract as the launch prompts), and the caller in boot.ts exits 0.
20
20
  */
21
- import { type SystemInstructionVariant } from '@wrongstack/core/agent';
21
+ import { countSystemPromptTokens, persistSystemPromptVariant, readSavedSystemPromptVariant, SYSTEM_PROMPT_VARIANTS, type SystemInstructionVariant, type SystemPromptVariantPaths } from '@wrongstack/core/agent';
22
22
  import type { ReadlineInputReader } from '../input-reader.js';
23
23
  import type { TerminalRenderer } from '../renderer.js';
24
- /** Menu order + display labels. `default` is shown as "Standard". */
25
- export declare const SYSTEM_PROMPT_OPTIONS: ReadonlyArray<{
24
+ /**
25
+ * Menu order + display labels, re-exported from core so the CLI menu, the
26
+ * WebUI picker, and any other surface offer the same three options in the same
27
+ * order with the same token math.
28
+ */
29
+ export declare const SYSTEM_PROMPT_OPTIONS: readonly {
26
30
  variant: SystemInstructionVariant;
27
31
  label: string;
28
32
  hint: string;
29
- }>;
30
- /** All selectable variants, in menu order. */
31
- export declare const SYSTEM_PROMPT_VARIANTS: readonly SystemInstructionVariant[];
33
+ }[];
34
+ export { countSystemPromptTokens, persistSystemPromptVariant, readSavedSystemPromptVariant, SYSTEM_PROMPT_VARIANTS, };
32
35
  /** Instruction dirs used to resolve the identity text per variant. */
33
- export interface SystemPromptMenuPaths {
34
- /** Profile override directory, e.g. `~/.wrongstack/profiles/<name>/instructions`. */
35
- globalDir?: string | undefined;
36
- /** Project override directory, e.g. `<project>/.wrongstack/instructions`. */
37
- projectDir?: string | undefined;
38
- }
36
+ export type SystemPromptMenuPaths = SystemPromptVariantPaths;
39
37
  /** True when any `--system-*` flag pins a variant (menu must not show). */
40
38
  export declare function isSystemPromptPinned(flags: Record<string, string | boolean>): boolean;
41
39
  /**
@@ -45,41 +43,6 @@ export declare function isSystemPromptPinned(flags: Record<string, string | bool
45
43
  * flag-pinned launches never prompt.
46
44
  */
47
45
  export declare function shouldSkipSystemPromptMenu(flags: Record<string, string | boolean>): boolean;
48
- /**
49
- * Estimate the tokens of the system identity block each variant injects.
50
- *
51
- * Resolution goes through the same `loadInstructionBundle` the
52
- * SystemPromptBuilder runs (bundled → global → project, later layers override
53
- * `system.identity`), and composition goes through the builder's own
54
- * `buildIdentityLayer`. Calling the real composer matters: when the identity
55
- * came from the *project* layer, WS-016 makes the builder emit the bundled
56
- * identity PLUS a `<project-supplied-instructions>` delimiter block PLUS the
57
- * project text rather than replacing the identity. Counting
58
- * `bundle.system.identity` alone therefore under-reports a project override by
59
- * the whole bundled prompt — which is exactly the case a repo that ships its
60
- * own `system-pro.md` hits.
61
- *
62
- * The figure is an **upper bound**, not `/context` parity: `buildIdentityLayer`
63
- * is called without an `InstructionTemplateContext`, which by its own contract
64
- * keeps the full text, so `ws:if` blocks for tools the live request never
65
- * registers are still counted. Erring high is the right direction for a menu
66
- * whose purpose is comparing variant cost, and every figure is rendered with a
67
- * leading `~`.
68
- */
69
- export declare function countSystemPromptTokens(paths: SystemPromptMenuPaths): Promise<Record<SystemInstructionVariant, number>>;
70
- /**
71
- * Read the variant the user explicitly saved to the profile config file.
72
- *
73
- * The config loader materializes `systemPrompt: { variant: 'default' }` for
74
- * every config (see `@wrongstack/core` config-loader defaults), so the
75
- * in-memory Config cannot distinguish "user chose Standard" from "never
76
- * chose". Only the raw file can: {@link persistSystemPromptVariant} writes
77
- * the key explicitly, so its presence on disk is the signal that a selection
78
- * was made. Absence (first run, or a config edited before this feature
79
- * existed) returns undefined and the caller shows the full menu instead of
80
- * the summary gate.
81
- */
82
- export declare function readSavedSystemPromptVariant(configPath: string): Promise<SystemInstructionVariant | undefined>;
83
46
  /**
84
47
  * Run the interactive system-prompt selection. Returns the chosen variant.
85
48
  * Throws {@link LaunchAbortedError} when the user presses `q` (the caller
@@ -94,17 +57,6 @@ export declare function runSystemPromptMenu(deps: {
94
57
  /** Saved variant from config — enables the summary gate. */
95
58
  lastVariant?: SystemInstructionVariant | undefined;
96
59
  }): Promise<SystemInstructionVariant>;
97
- /**
98
- * Persist the chosen variant to the profile config file so the next boot
99
- * can offer a one-line "Continue with these?" gate. Mirrors
100
- * `persistLaunchChoices`: reads the existing JSON, mutates only the
101
- * `systemPrompt` block, writes back atomically with mode 0600. Other fields
102
- * (including encrypted secrets) pass through round-trip unchanged.
103
- *
104
- * @throws when the config file exists but is corrupt (same policy as the
105
- * launch-choices writer — never overwrite unreadable user config silently).
106
- */
107
- export declare function persistSystemPromptVariant(configPath: string, variant: SystemInstructionVariant): Promise<void>;
108
60
  /** Outcome of {@link maybeRunSystemPromptMenu}. */
109
61
  export interface SystemPromptMenuOutcome {
110
62
  /**
@@ -1,14 +1,14 @@
1
1
  import type { ProviderRegistry } from '@wrongstack/core/registry';
2
2
  import type { Config, Logger, ModelsRegistry, ResolvedProvider } from '@wrongstack/core/types';
3
- export type ModeId = string;
4
- export type ModePrompt = string;
3
+ type ModeId = string;
4
+ type ModePrompt = string;
5
5
  export interface ModelCapabilities {
6
6
  maxContextTokens: number;
7
7
  supportsTools: boolean;
8
8
  supportsVision: boolean;
9
9
  supportsReasoning: boolean;
10
10
  }
11
- export type ResolvedModeResult = {
11
+ type ResolvedModeResult = {
12
12
  kind: 'ok';
13
13
  resolvedProvider: ResolvedProvider;
14
14
  providerRegistry: ProviderRegistry;
@@ -1,7 +1,7 @@
1
1
  /** CLI boot adapter for canonical runtime tool registration and host policies. */
2
2
  import type { EventBus } from '@wrongstack/core/kernel';
3
3
  import type { ToolRegistry } from '@wrongstack/core/registry';
4
- import type { MemoryPort, TokenSavingTier, ToolDescriptionModeConfig, ToolResultRenderModeConfig } from '@wrongstack/core/types';
4
+ import type { AutoThinConfig, DisabledToolMeta, MemoryPort, TokenSavingTier, ToolDescriptionModeConfig, ToolResultRenderModeConfig } from '@wrongstack/core/types';
5
5
  import type { WstackPaths } from '@wrongstack/core/utils';
6
6
  import type { VectorMemoryStore } from '@wrongstack/vector-memory';
7
7
  interface RegisterBuiltinToolsDeps {
@@ -16,6 +16,8 @@ interface RegisterBuiltinToolsDeps {
16
16
  descriptionMode?: ToolDescriptionModeConfig | undefined;
17
17
  resultRenderMode?: ToolResultRenderModeConfig | undefined;
18
18
  disabledTools?: string[] | undefined;
19
+ disabledToolMeta?: Record<string, DisabledToolMeta> | undefined;
20
+ autoThin?: AutoThinConfig | undefined;
19
21
  nextsteps?: {
20
22
  enabled?: boolean | undefined;
21
23
  } | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { Context } from '@wrongstack/core/agent';
2
2
  import type { AutonomousCoordinator, CoordinatorEvent } from '@wrongstack/core/coordination';
3
3
  import type { TuiRuntimeState } from './tui-runtime-state.js';
4
- export interface TuiCoordinatorCallbacksContext {
4
+ interface TuiCoordinatorCallbacksContext {
5
5
  state: TuiRuntimeState;
6
6
  context: Context;
7
7
  coordinatorEvents: Set<(event: CoordinatorEvent) => void>;
@@ -42,4 +42,5 @@ export declare function createTuiCoordinatorCallbacks({ state, context, coordina
42
42
  };
43
43
  } | null>;
44
44
  };
45
+ export {};
45
46
  //# sourceMappingURL=tui-coordinator-callbacks.d.ts.map
@@ -3,7 +3,7 @@ import { AutonomousCoordinator, type Director } from '@wrongstack/core/coordinat
3
3
  import type { EventBus } from '@wrongstack/core/kernel';
4
4
  import type { WstackPaths } from '@wrongstack/core/utils';
5
5
  import type { TuiRuntimeState } from './tui-runtime-state.js';
6
- export interface CoordinatorSetupContext {
6
+ interface CoordinatorSetupContext {
7
7
  /** The shared mutable runtime state. */
8
8
  state: TuiRuntimeState;
9
9
  /** The main EventBus — used for the Director lifecycle hook. */
@@ -23,7 +23,7 @@ export interface CoordinatorSetupContext {
23
23
  /** Set by this module so execute()'s finally block can stop the coordinator. */
24
24
  onCoordinatorStopSetter: (fn: (() => void) | undefined) => void;
25
25
  }
26
- export interface CoordinatorSetupResult {
26
+ interface CoordinatorSetupResult {
27
27
  /** The ensureAutonomousCoordinator function (idempotent). */
28
28
  ensure: () => AutonomousCoordinator | null;
29
29
  /** Call to remove the Director lifecycle listener (for TUI cleanup). */
@@ -37,4 +37,5 @@ export interface CoordinatorSetupResult {
37
37
  * the event listener.
38
38
  */
39
39
  export declare function setupAutonomousCoordinator(ctx: CoordinatorSetupContext): CoordinatorSetupResult;
40
+ export {};
40
41
  //# sourceMappingURL=tui-coordinator-setup.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { EventBus } from '@wrongstack/core/kernel';
2
- export interface GoalWiring {
2
+ interface GoalWiring {
3
3
  /**
4
4
  * Called by the TUI to receive forwarded events. Each call registers
5
5
  * one listener per event name; the returned function unregisters all.
@@ -20,4 +20,5 @@ export interface GoalWiring {
20
20
  * and throw the moment Goal subscribes.
21
21
  */
22
22
  export declare function wireGoal(events: EventBus): GoalWiring;
23
+ export {};
23
24
  //# sourceMappingURL=tui-goal-wiring.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { TuiRuntimeState } from './tui-runtime-state.js';
2
- export interface LiveSessionsContext {
2
+ interface LiveSessionsContext {
3
3
  state: TuiRuntimeState;
4
4
  }
5
5
  /**
@@ -15,6 +15,7 @@ export declare function getLiveSessions(ctx: LiveSessionsContext): Promise<{
15
15
  gitBranch: string | undefined;
16
16
  status: import("@wrongstack/core/storage").SessionLiveStatus;
17
17
  pid: number;
18
+ clientType: string | undefined;
18
19
  startedAt: string;
19
20
  agentCount: number;
20
21
  agents: {
@@ -36,4 +37,5 @@ export declare function getLiveSessions(ctx: LiveSessionsContext): Promise<{
36
37
  * We open the target project fresh instead.
37
38
  */
38
39
  export declare function onSwitchToSession(ctx: LiveSessionsContext, _sessionId: string, targetRoot: string, projectName: string): void;
40
+ export {};
39
41
  //# sourceMappingURL=tui-live-sessions.d.ts.map
@@ -1,34 +1,106 @@
1
1
  import type { Agent } from '@wrongstack/core/agent';
2
2
  import type { EventBus } from '@wrongstack/core/kernel';
3
- import type { ContextSnapshot, TokenCounter } from '@wrongstack/core/types';
3
+ import type { ContextSnapshot, SessionLoadProgress, TokenCounter } from '@wrongstack/core/types';
4
4
  import type { TuiRuntimeState } from './tui-runtime-state.js';
5
- export interface SessionResumeContext {
5
+ interface SessionResumeContext {
6
6
  state: TuiRuntimeState;
7
7
  agent: Agent;
8
8
  tokenCounter: TokenCounter;
9
9
  switchProviderAndModel: ((providerId: string, modelId: string) => string | null | void | Promise<unknown>) | undefined;
10
10
  /** App EventBus — forwarded to the re-pointed todos checkpoint for storage.* events. */
11
11
  events?: EventBus | undefined;
12
+ /**
13
+ * Byte-level parse progress sink for large journals. When provided, the
14
+ * store's JSONL loader throttles it to ~4 updates/sec so the TUI picker
15
+ * hint can stream load progress instead of a static line.
16
+ */
17
+ onLoadProgress?: ((progress: SessionLoadProgress) => void) | undefined;
18
+ /**
19
+ * Why a resume returned `null`.
20
+ *
21
+ * `resumeSession` deliberately keeps returning `null` on failure — every
22
+ * rollback test pins that contract, and a throw escaping mid-rollback would
23
+ * be worse than a clean `null`. But `null` alone reaches the user as a bare
24
+ * "Failed to resume session <id>." with no reason, on every surface, which
25
+ * makes a broken resume undiagnosable. This sink carries the reason (and the
26
+ * STAGE it died at) out to the caller, which turns it into the message the
27
+ * user actually reads.
28
+ */
29
+ onFailure?: ((failure: SessionResumeFailure) => void) | undefined;
30
+ /**
31
+ * Live stage reporter.
32
+ *
33
+ * The same `stage` string the failure sink reports, but emitted as each step
34
+ * BEGINS rather than only when one fails. The TUI turns it into the rolling
35
+ * "what is happening right now" rows of the resume block — without it the
36
+ * only honest thing that surface could show during a multi-second journal
37
+ * parse was a spinner.
38
+ */
39
+ onStage?: ((stage: string) => void) | undefined;
40
+ }
41
+ /** The stage a failed resume died at, plus the underlying error text. */
42
+ export interface SessionResumeFailure {
43
+ /** Machine-readable step name, e.g. `resolve_id`, `open_writer`, `hydrate`. */
44
+ stage: string;
45
+ /** Error text from the failing step — never empty. */
46
+ message: string;
12
47
  }
13
- export interface SessionResumeResult {
48
+ interface SessionResumeResult {
14
49
  entries: unknown[];
15
50
  nextId: number;
16
51
  sessionId: string;
52
+ /**
53
+ * Whether the agent is now WRITING to this session.
54
+ *
55
+ * `false` means the transcript is on screen but ownership was never taken:
56
+ * the session stays read-only and the next prompt continues the session the
57
+ * user was already in. Showing the transcript anyway is deliberate — the
58
+ * expensive, safe half of a resume (read the journal, render the timeline)
59
+ * has no reason to be discarded because the risky half (claim the journal
60
+ * for writing) failed.
61
+ */
62
+ attached: boolean;
63
+ /**
64
+ * Non-fatal problems the user should see, e.g. a sidecar that could not be
65
+ * re-pointed or a provider that is no longer configured. These used to abort
66
+ * the whole resume and roll back a transcript that had already loaded.
67
+ */
68
+ warnings: string[];
17
69
  /**
18
70
  * Optional context-window snapshot for the resumed session. `tokens` is a
19
- * flat `number` (sum of `tokenCounter.currentRequestTokens()?.`'s
20
- * `{ input, cacheRead, cacheWrite }` fields) — the TUI consumer
21
- * (`packages/tui/src/reducers/composer.ts:561-577`) reads `tokens` as a
22
- * flat number and gates on `snap.tokens > 0`. Forwarding the raw object
23
- * would coerce to NaN and silently drop the snapshot at runtime.
71
+ * flat `number` the prompt size of the session's LAST request, read from
72
+ * its journal by `projectLastRequestTokens`. The TUI consumer
73
+ * (`packages/tui/src/reducers/composer.ts:561-577`) reads it as a flat
74
+ * number and gates on `snap.tokens > 0`, so a session that never reached the
75
+ * model reports 0 and simply leaves the chip alone.
24
76
  */
25
77
  contextSnapshot?: ContextSnapshot | undefined;
78
+ /**
79
+ * Text of the LAST assistant message in the resumed transcript.
80
+ *
81
+ * The caller parses `<nextsteps>` out of it. Deterministic by construction —
82
+ * the TUI's per-entry parser fires on whichever assistant entry happens to
83
+ * mount last during a replay, which is not necessarily the final turn, so a
84
+ * resume needs the authoritative one from the transcript itself.
85
+ */
86
+ lastAssistantText?: string | undefined;
26
87
  }
27
88
  /**
28
89
  * Resume a past session by id.
29
90
  *
30
- * Returns the replayed history entries + new session id, or null on
31
- * failure. Throws if the session is live in another process.
91
+ * Three outcomes, in decreasing order of success:
92
+ *
93
+ * 1. `{ attached: true }` — transcript replayed AND the agent now writes to
94
+ * this session. `warnings` may still list best-effort steps that failed
95
+ * (sidecars, provider restore, token accounting); none of them are worth
96
+ * throwing away a working resume for.
97
+ * 2. `{ attached: false }` — ownership could not be taken (another process
98
+ * holds it, the reservation lapsed, the writer would not open), but the
99
+ * journal read fine, so the transcript is shown read-only with the reason
100
+ * in `warnings`. The agent stays on the session it was already writing.
101
+ * 3. `null` — the journal itself could not be read. `onFailure` carries the
102
+ * stage and reason.
32
103
  */
33
104
  export declare function resumeSession(ctx: SessionResumeContext, sessionId: string): Promise<SessionResumeResult | null>;
105
+ export {};
34
106
  //# sourceMappingURL=tui-session-resume.d.ts.map