@wrongstack/cli 1.0.33 → 1.0.36

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 (145) hide show
  1. package/dist/{acp-EDGUWU7N.js → acp-QLU7T5WX.js} +470 -466
  2. package/dist/{auth-SUHKFFO4.js → auth-AED7RW7D.js} +7 -7
  3. package/dist/auth-menu/openai-codex-oauth.d.ts +1 -1
  4. package/dist/auth-menu/panel-provider-edits.d.ts +15 -0
  5. package/dist/auth-menu/panel-service.d.ts +1 -1
  6. package/dist/{automation-MCDFCIMV.js → automation-3E3AUPBF.js} +19 -4
  7. package/dist/boot/governance-evidence-candidate.d.ts +1 -2
  8. package/dist/boot/system-prompt-builder.d.ts +1 -1
  9. package/dist/boot/tui-project-spawn.d.ts +0 -1
  10. package/dist/boot/tui-session-resume-contracts.d.ts +95 -0
  11. package/dist/boot/tui-session-resume.d.ts +2 -88
  12. package/dist/boot/tui-settings-read.d.ts +3 -0
  13. package/dist/{boot-auto-thin-K2DHHYIW.js → boot-auto-thin-AGJ6TAWY.js} +3 -3
  14. package/dist/boot-launch-choices.d.ts +22 -0
  15. package/dist/boot-provider-gate.d.ts +28 -0
  16. package/dist/boot-subcommand-dispatch.d.ts +24 -0
  17. package/dist/boot.d.ts +1 -1
  18. package/dist/chimera-cascade-evidence.d.ts +1 -1
  19. package/dist/{chunk-TI7KLHYX.js → chunk-2CMMWRQH.js} +81 -80
  20. package/dist/{chunk-4BX2YDTQ.js → chunk-4JMAWKLA.js} +45 -4
  21. package/dist/{chunk-TWSQTQKR.js → chunk-4R6TVMYA.js} +2 -2
  22. package/dist/{chunk-HHRYIDOW.js → chunk-ACW64W4M.js} +34 -7
  23. package/dist/{chunk-5EA6OTLJ.js → chunk-AFOH6CHO.js} +2 -2
  24. package/dist/{chunk-WHEYHDIE.js → chunk-AKESWZH5.js} +2 -1
  25. package/dist/{chunk-JHUJUIOH.js → chunk-AT2A7RJZ.js} +4 -16
  26. package/dist/{chunk-LKFKO4JW.js → chunk-B6EHK772.js} +2 -2
  27. package/dist/{chunk-U3SS4NRH.js → chunk-BHXAKTBE.js} +1 -1
  28. package/dist/{chunk-4UWCMBPG.js → chunk-BJH44J7G.js} +3 -3
  29. package/dist/{chunk-MPQCHBDJ.js → chunk-CJSHS2K7.js} +5 -1
  30. package/dist/{chunk-RQ4UBKYH.js → chunk-GF7LUWQS.js} +5 -11
  31. package/dist/{chunk-TXAFIERF.js → chunk-L5NWFP5R.js} +2 -2
  32. package/dist/{chunk-24C6VVLM.js → chunk-LPGZ3NUF.js} +23 -23
  33. package/dist/{chunk-UQUYBDMG.js → chunk-M4G5FO7F.js} +1 -1
  34. package/dist/{chunk-P3GRLV47.js → chunk-NEWXDNF2.js} +212 -145
  35. package/dist/{chunk-3LEFXLAW.js → chunk-NOZJIN46.js} +36 -37
  36. package/dist/{chunk-4MDRHMX4.js → chunk-RE73FP2X.js} +4 -27
  37. package/dist/{chunk-5UZBUV2H.js → chunk-RKU66D2O.js} +6 -4
  38. package/dist/{chunk-SWOPJHXI.js → chunk-RYTSPBNM.js} +4 -4
  39. package/dist/{chunk-WTJDSTYD.js → chunk-T5KR6SNO.js} +2 -2
  40. package/dist/chunk-TGSPCFBT.js +1 -0
  41. package/dist/{chunk-ZYACRPLN.js → chunk-ULYAI7CP.js} +6 -3
  42. package/dist/{chunk-HLSHFXTO.js → chunk-WY74MMDB.js} +2 -2
  43. package/dist/{chunk-PGNERAZL.js → chunk-ZWBI7ORM.js} +3 -3
  44. package/dist/{cli-context-7HK67B2Z.js → cli-context-I6HJCVCV.js} +1607 -1495
  45. package/dist/cli-initial-tools.d.ts +54 -0
  46. package/dist/{cli-main-TQGLKB6D.js → cli-main-X7KD7IOC.js} +38223 -37136
  47. package/dist/cli-main-boot.d.ts +133 -0
  48. package/dist/cli-main-orchestration.d.ts +170 -0
  49. package/dist/cli-main-state.d.ts +19 -0
  50. package/dist/config-doctor.d.ts +1 -1
  51. package/dist/{config-transfer-UE37X4B5.js → config-transfer-YPD7HYXH.js} +7 -5
  52. package/dist/{execution-C2IECWF7.js → execution-M7D4KNBB.js} +171 -132
  53. package/dist/fleet/host-director-setup.d.ts +41 -0
  54. package/dist/fleet/host-spawn-types.d.ts +17 -0
  55. package/dist/fleet/host.d.ts +2 -1
  56. package/dist/goal-host-prompts.d.ts +5 -0
  57. package/dist/goal-host-types.d.ts +94 -0
  58. package/dist/goal-host.d.ts +2 -91
  59. package/dist/{hq-KBFDKTDD.js → hq-BBLGEEUH.js} +5 -6
  60. package/dist/hq-server/handle-types.d.ts +1 -1
  61. package/dist/hq-server/routes/auth-handlers.d.ts +1 -1
  62. package/dist/hq-server/routes.d.ts +1 -13
  63. package/dist/hq-server/utils.d.ts +1 -1
  64. package/dist/{hq-server-AVNKZ2PV.js → hq-server-5TR6NBGS.js} +3 -3
  65. package/dist/{hq-service-FGB7BY2D.js → hq-service-4Q64WFNT.js} +3 -3
  66. package/dist/{import-claude-code-AYG24RG2.js → import-claude-code-GHIS2F7Y.js} +3 -3
  67. package/dist/index.js +5 -5
  68. package/dist/live-settings-input.d.ts +2 -0
  69. package/dist/mailbox-bridge-bootstrap.d.ts +1 -4
  70. package/dist/{mailbox-serve-S536N66F.js → mailbox-serve-DRWJVMYU.js} +2 -2
  71. package/dist/{modeldiag-NEPTLFZW.js → modeldiag-F3LUF4VJ.js} +3 -3
  72. package/dist/picker-effort.d.ts +32 -0
  73. package/dist/picker-model-picker.d.ts +13 -2
  74. package/dist/picker-provider-list.d.ts +66 -0
  75. package/dist/picker.d.ts +12 -12
  76. package/dist/plugin-config.d.ts +6 -0
  77. package/dist/{plugin-usage-3TZGROK7.js → plugin-usage-EM752WHG.js} +3 -3
  78. package/dist/{plugins-ITH4SLO6.js → plugins-U6HQFJ7N.js} +4 -4
  79. package/dist/{providers-models-O75MKLN2.js → providers-models-S3S6VXME.js} +249 -239
  80. package/dist/repl-suggestions.d.ts +0 -5
  81. package/dist/{sage-FFKUOCQL.js → sage-BMRDJCDI.js} +9 -5
  82. package/dist/{sage-sync-ZMTHB477.js → sage-sync-PCWCNEUK.js} +2 -2
  83. package/dist/{sdd-runtime-PTOSPYI4.js → sdd-runtime-PF72WHLO.js} +3 -20
  84. package/dist/services/sdd/task-manager.d.ts +1 -12
  85. package/dist/services/sdd-runtime.d.ts +3 -4
  86. package/dist/services/statusline-config.d.ts +0 -2
  87. package/dist/{sessions-config-VE26SB56.js → sessions-config-RQRQDW5Q.js} +2 -2
  88. package/dist/settings-behavior-sections.d.ts +0 -1
  89. package/dist/short-circuit-flags-IEV3FEOT.js +10 -0
  90. package/dist/{skill-suggest-L2EVWB6R.js → skill-suggest-THANK3LV.js} +1 -1
  91. package/dist/slash-commands/command-context.d.ts +2 -0
  92. package/dist/slash-commands/doctor.d.ts +0 -9
  93. package/dist/slash-commands/fallback-chain-view.d.ts +3 -0
  94. package/dist/slash-commands/fallback-ref-validation.d.ts +34 -0
  95. package/dist/slash-commands/goal-refiner.d.ts +10 -2
  96. package/dist/slash-commands/goals.d.ts +6 -0
  97. package/dist/slash-commands/kanban-task-completion.d.ts +17 -0
  98. package/dist/slash-commands/mcp.d.ts +0 -1
  99. package/dist/slash-commands/memory-purge-domain-terms.d.ts +5 -0
  100. package/dist/slash-commands/nextsteps-mode.d.ts +13 -0
  101. package/dist/slash-commands/session-live-status.d.ts +21 -0
  102. package/dist/slash-commands/session.d.ts +1 -1
  103. package/dist/slash-commands/settings-feature-ui-mutations.d.ts +8 -0
  104. package/dist/slash-commands/settings-hq-autonomy-mutations.d.ts +8 -0
  105. package/dist/slash-commands/settings-persist-deps.d.ts +10 -0
  106. package/dist/slash-commands/settings-runtime-mutations.d.ts +12 -0
  107. package/dist/slash-commands/shadow.d.ts +0 -1
  108. package/dist/slash-commands/tool-auto-thin-commands.d.ts +15 -0
  109. package/dist/{standalone-auto-update-VQC4GYCM.js → standalone-auto-update-QUXOZ4B5.js} +13 -2
  110. package/dist/subcommands/handlers/acp-agents.d.ts +9 -0
  111. package/dist/subcommands/handlers/acp-server.d.ts +7 -0
  112. package/dist/subcommands/handlers/hq.d.ts +0 -1
  113. package/dist/subcommands/handlers/providers-models-custom.d.ts +33 -0
  114. package/dist/subcommands/handlers/providers-models-visibility.d.ts +29 -0
  115. package/dist/subcommands/handlers/skill-suggest.d.ts +0 -2
  116. package/dist/{subcommands-CLI6QTLU.js → subcommands-75IB23LS.js} +2 -2
  117. package/dist/{typesafe-NHC322W5.js → typesafe-KW2XHOG3.js} +2 -2
  118. package/dist/{update-J5WHAFPE.js → update-LHCWAWEZ.js} +3 -3
  119. package/dist/utils/win32-cmd.d.ts +1 -1
  120. package/dist/{version-help-ATOKGMTK.js → version-help-JQGRPDJW.js} +2 -2
  121. package/dist/webui-server/credential-watcher.d.ts +3 -1
  122. package/dist/webui-server/host-settings.d.ts +17 -0
  123. package/dist/webui-server/http-bridge.d.ts +32 -0
  124. package/dist/webui-server/instance-registration.d.ts +19 -0
  125. package/dist/webui-server/kanban-services.d.ts +9 -0
  126. package/dist/webui-server/message-router.d.ts +14 -0
  127. package/dist/webui-server/prefs-seeding.d.ts +1 -2
  128. package/dist/webui-server/provider-config.d.ts +0 -1
  129. package/dist/webui-server/provider-plane.d.ts +14 -0
  130. package/dist/webui-server/session-agents.d.ts +18 -0
  131. package/dist/webui-server/session-start-live.d.ts +11 -0
  132. package/dist/webui-server/stream-coalescer.d.ts +1 -1
  133. package/dist/webui-server/transport.d.ts +12 -0
  134. package/dist/{webui-server-GQOVLQS3.js → webui-server-CUIFA25W.js} +1472 -1335
  135. package/dist/webui-session-maintenance.d.ts +16 -0
  136. package/dist/wiring/brain-and-orchestration.d.ts +1 -1
  137. package/dist/wiring/cli-slash-commands-setup.d.ts +1 -0
  138. package/dist/wiring/command-host-state.d.ts +11 -2
  139. package/dist/wiring/dep-watcher-bridge.d.ts +8 -1
  140. package/dist/wiring/management-tools.d.ts +9 -1
  141. package/dist/wiring/session-command-handlers.d.ts +2 -1
  142. package/dist/worktree-command-host.d.ts +31 -0
  143. package/package.json +31 -31
  144. package/dist/chunk-WHOIR577.js +0 -1
  145. package/dist/short-circuit-flags-D6VAG47Y.js +0 -10
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  providerCloudConfig
3
- } from "./chunk-TXAFIERF.js";
3
+ } from "./chunk-L5NWFP5R.js";
4
4
  import {
5
5
  addCustomProvider,
6
6
  addFromCatalog,
@@ -20,12 +20,12 @@ import {
20
20
  runOAuthLoginKind,
21
21
  runOAuthLoginMenu,
22
22
  validateFamily
23
- } from "./chunk-P3GRLV47.js";
23
+ } from "./chunk-NEWXDNF2.js";
24
24
  import {
25
25
  renderAuthLocalHelpToString,
26
26
  wantsLocalHelp
27
27
  } from "./chunk-YTEOAWOJ.js";
28
- import "./chunk-5UZBUV2H.js";
28
+ import "./chunk-RKU66D2O.js";
29
29
  import {
30
30
  loadConfigProviders,
31
31
  maskedKey,
@@ -33,18 +33,18 @@ import {
33
33
  normalizeKeys,
34
34
  nowIso,
35
35
  writeKeysBack
36
- } from "./chunk-ZYACRPLN.js";
36
+ } from "./chunk-ULYAI7CP.js";
37
37
  import {
38
38
  activeProfileConfigPath
39
39
  } from "./chunk-YMXXOOFN.js";
40
- import "./chunk-4BX2YDTQ.js";
40
+ import "./chunk-4JMAWKLA.js";
41
41
  import {
42
42
  restoreFlags
43
43
  } from "./chunk-CSAPOCBP.js";
44
44
  import "./chunk-DAKVBMD4.js";
45
45
  import {
46
46
  parseAuthFlags
47
- } from "./chunk-MPQCHBDJ.js";
47
+ } from "./chunk-CJSHS2K7.js";
48
48
 
49
49
  // src/subcommands/handlers/auth.ts
50
50
  import { color as color6 } from "@wrongstack/core/utils";
@@ -748,4 +748,4 @@ async function runAuthRemove(deps, providerId) {
748
748
  export {
749
749
  authCmd
750
750
  };
751
- //# sourceMappingURL=auth-SUHKFFO4.js.map
751
+ //# sourceMappingURL=auth-AED7RW7D.js.map
@@ -31,7 +31,7 @@
31
31
  import { buildCodexAuthorizeUrl, exchangeCodexAuthorizationCode, refreshCodexTokens } from '@wrongstack/providers/oauth';
32
32
  import { type LoopbackServer } from './loopback-server.js';
33
33
  import type { AuthMenuDeps } from './types.js';
34
- export { CODEX_BASE_URL, CODEX_CATALOG_FAMILIES, CODEX_PROVIDER_ID, type CodexTokens, extractAccountId, FALLBACK_CODEX_MODELS, fallbackCodexModelIds, fallbackCodexProviderModels, fetchCodexModels, filterCurrentCodexModelIds, generatePkce, isCodexCatalogModel, type Pkce, parseAuthorizationInput, resolveCodexModels, } from '@wrongstack/providers/oauth';
34
+ export { CODEX_BASE_URL, CODEX_CATALOG_FAMILIES, CODEX_PROVIDER_ID, type CodexTokens, extractAccountId, FALLBACK_CODEX_MODELS, fallbackCodexModelIds, fallbackCodexProviderModels, fetchCodexModels, filterCurrentCodexModelIds, generatePkce, isCodexCatalogModel, parseAuthorizationInput, resolveCodexModels, } from '@wrongstack/providers/oauth';
35
35
  /** Build the Codex authorize URL. Alias kept for the historical local name. */
36
36
  export declare const buildAuthorizeUrl: typeof buildCodexAuthorizeUrl;
37
37
  /** Exchange an authorization code (+ PKCE verifier) for tokens. */
@@ -0,0 +1,15 @@
1
+ import type { AuthModelEdit, AuthProviderEdit, AuthProviderSetup } from '@wrongstack/tui';
2
+ import type { AuthPanelServiceDeps } from './panel-flow-bridge.js';
3
+ interface CreateProviderEditsInput {
4
+ deps: AuthPanelServiceDeps;
5
+ mutate: (mutator: (providers: Record<string, import('@wrongstack/core/types').ProviderConfig>, config: Record<string, unknown>) => string | null) => Promise<string | null>;
6
+ loadProviders: () => Promise<Record<string, import('@wrongstack/core/types').ProviderConfig>>;
7
+ }
8
+ export declare function createProviderEdits({ deps, mutate, loadProviders }: CreateProviderEditsInput): {
9
+ saveProviderSetup(setup: AuthProviderSetup): Promise<string | null>;
10
+ saveProviderEdit(edit: AuthProviderEdit): Promise<string | null>;
11
+ getModelEdit(providerId: string, modelId: string): Promise<AuthModelEdit | null>;
12
+ saveModelEdit(edit: AuthModelEdit): Promise<string | null>;
13
+ };
14
+ export {};
15
+ //# sourceMappingURL=panel-provider-edits.d.ts.map
@@ -1,6 +1,6 @@
1
+ import type { AuthPanelHost } from '@wrongstack/tui';
1
2
  import type { AuthPanelServiceDeps } from './panel-flow-bridge.js';
2
3
  export type { AuthPanelServiceDeps } from './panel-flow-bridge.js';
3
4
  export { plainMaskedKey } from './panel-flow-bridge.js';
4
- import type { AuthPanelHost } from '@wrongstack/tui';
5
5
  export declare function createAuthPanelHost(deps: AuthPanelServiceDeps): AuthPanelHost;
6
6
  //# sourceMappingURL=panel-service.d.ts.map
@@ -38,7 +38,10 @@ async function resolveAutomationCredentialBundle(refs, paths, vault) {
38
38
  let config = profiles.get(ref.profile);
39
39
  if (!config) {
40
40
  config = decryptConfigSecrets(
41
- JSON.parse(await readFile(paths.profileConfig(ref.profile), "utf8")),
41
+ // A leading UTF-8 BOM is valid (RFC 8259); the config loader accepts it.
42
+ JSON.parse(
43
+ (await readFile(paths.profileConfig(ref.profile), "utf8")).replace(/^\uFEFF/, "")
44
+ ),
42
45
  vault
43
46
  );
44
47
  profiles.set(ref.profile, config);
@@ -201,7 +204,10 @@ var automationCmd = async (args, deps) => {
201
204
  for (const ref of spec.credentials ?? []) {
202
205
  try {
203
206
  const profile = JSON.parse(
204
- await readFile2(deps.paths.profileConfig(ref.profile), "utf8")
207
+ (await readFile2(deps.paths.profileConfig(ref.profile), "utf8")).replace(
208
+ /^\uFEFF/,
209
+ ""
210
+ )
205
211
  );
206
212
  const provider = profile.providers && Object.hasOwn(profile.providers, ref.provider) ? profile.providers[ref.provider] : void 0;
207
213
  const key = provider?.apiKeys?.find(
@@ -326,8 +332,17 @@ Token file: ${path.join(directory, "token.txt")}
326
332
  mode: 384
327
333
  })
328
334
  );
335
+ let lastTickError;
329
336
  while (!abort.signal.aborted) {
330
- await service.tick();
337
+ try {
338
+ await service.tick();
339
+ lastTickError = void 0;
340
+ } catch (error) {
341
+ const message = toErrorMessage(error);
342
+ if (message !== lastTickError) deps.renderer.write(`automation: ${message}
343
+ `);
344
+ lastTickError = message;
345
+ }
331
346
  await new Promise((resolve2) => {
332
347
  const done = () => {
333
348
  clearTimeout(timer);
@@ -366,4 +381,4 @@ Token file: ${path.join(directory, "token.txt")}
366
381
  export {
367
382
  automationCmd
368
383
  };
369
- //# sourceMappingURL=automation-MCDFCIMV.js.map
384
+ //# sourceMappingURL=automation-3E3AUPBF.js.map
@@ -1,3 +1,2 @@
1
- export type { GovernanceEvidenceCandidate, GovernanceEvidenceCandidateMissingBinding, GovernanceEvidenceTraceSnapshot, GovernanceToolOutcomeMetadata, } from '@wrongstack/runtime/governance-bootstrap';
2
- export { createGovernanceEvidenceCandidate, GOVERNANCE_EVIDENCE_CANDIDATE_SCHEMA_VERSION, } from '@wrongstack/runtime/governance-bootstrap';
1
+ export { createGovernanceEvidenceCandidate, } from '@wrongstack/runtime/governance-bootstrap';
3
2
  //# sourceMappingURL=governance-evidence-candidate.d.ts.map
@@ -35,7 +35,6 @@ interface PathJoiner {
35
35
  * is typed against.
36
36
  */
37
37
  import type { DomainGlossaryListProvider as DomainGlossaryAdapter } from '../wiring/domain-glossary.js';
38
- export type { DomainGlossaryListProvider } from '../wiring/domain-glossary.js';
39
38
  interface BindSystemPromptBuilderDeps {
40
39
  /**
41
40
  * The `container` from main(). The helper only calls
@@ -124,4 +123,5 @@ interface BindSystemPromptBuilderDeps {
124
123
  * matches the pre-refactor inline behavior exactly.
125
124
  */
126
125
  export declare function bindSystemPromptBuilder(deps: BindSystemPromptBuilderDeps): void;
126
+ export {};
127
127
  //# sourceMappingURL=system-prompt-builder.d.ts.map
@@ -1,4 +1,3 @@
1
- export declare const PROJECT_SWITCH_EXIT_CODE = 42;
2
1
  export interface PendingProjectSwitch {
3
2
  root: string;
4
3
  name: string;
@@ -0,0 +1,95 @@
1
+ import type { Agent } from '@wrongstack/core/agent';
2
+ import type { EventBus } from '@wrongstack/core/kernel';
3
+ import type { ContextSnapshot, SessionLoadProgress, TokenCounter } from '@wrongstack/core/types';
4
+ import type { TuiRuntimeState } from './tui-runtime-state.js';
5
+ export interface SessionResumeContext {
6
+ state: TuiRuntimeState;
7
+ agent: Agent;
8
+ tokenCounter: TokenCounter;
9
+ switchProviderAndModel: ((providerId: string, modelId: string) => string | null | void | Promise<unknown>) | undefined;
10
+ /** App EventBus — forwarded to the re-pointed todos checkpoint for storage.* events. */
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;
47
+ }
48
+ export interface SessionResumeResult {
49
+ entries: unknown[];
50
+ nextId: number;
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[];
69
+ /**
70
+ * Optional context-window snapshot for the resumed session. `tokens` is a
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.
76
+ */
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;
87
+ }
88
+ /** Flatten a message's content to plain text (string form or text blocks). */
89
+ export declare function messageText(content: unknown): string;
90
+ /** Text of the final assistant turn, or undefined when the session has none. */
91
+ export declare function lastAssistantTextOf(messages: readonly {
92
+ role: string;
93
+ content: unknown;
94
+ }[]): string | undefined;
95
+ //# sourceMappingURL=tui-session-resume-contracts.d.ts.map
@@ -1,90 +1,5 @@
1
- import type { Agent } from '@wrongstack/core/agent';
2
- import { type EventBus } from '@wrongstack/core/kernel';
3
- import type { ContextSnapshot, SessionLoadProgress, TokenCounter } from '@wrongstack/core/types';
4
- import type { TuiRuntimeState } from './tui-runtime-state.js';
5
- interface SessionResumeContext {
6
- state: TuiRuntimeState;
7
- agent: Agent;
8
- tokenCounter: TokenCounter;
9
- switchProviderAndModel: ((providerId: string, modelId: string) => string | null | void | Promise<unknown>) | undefined;
10
- /** App EventBus — forwarded to the re-pointed todos checkpoint for storage.* events. */
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;
47
- }
48
- interface SessionResumeResult {
49
- entries: unknown[];
50
- nextId: number;
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[];
69
- /**
70
- * Optional context-window snapshot for the resumed session. `tokens` is a
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.
76
- */
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;
87
- }
1
+ import { type SessionResumeContext, type SessionResumeResult } from './tui-session-resume-contracts.js';
2
+ export type { SessionResumeFailure } from './tui-session-resume-contracts.js';
88
3
  /**
89
4
  * Resume a past session by id.
90
5
  *
@@ -102,5 +17,4 @@ interface SessionResumeResult {
102
17
  * stage and reason.
103
18
  */
104
19
  export declare function resumeSession(ctx: SessionResumeContext, sessionId: string): Promise<SessionResumeResult | null>;
105
- export {};
106
20
  //# sourceMappingURL=tui-session-resume.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { ConfigStore } from '@wrongstack/core/types';
2
+ export declare function readTuiSettings(configStore: ConfigStore): Record<string, unknown>;
3
+ //# sourceMappingURL=tui-settings-read.d.ts.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  persistConfigSetting
3
- } from "./chunk-4MDRHMX4.js";
3
+ } from "./chunk-RE73FP2X.js";
4
4
  import {
5
5
  activeProfileConfigPath
6
6
  } from "./chunk-YMXXOOFN.js";
7
- import "./chunk-4BX2YDTQ.js";
7
+ import "./chunk-4JMAWKLA.js";
8
8
 
9
9
  // src/boot/boot-auto-thin.ts
10
10
  import {
@@ -99,4 +99,4 @@ async function runBootAutoThin(deps) {
99
99
  export {
100
100
  runBootAutoThin
101
101
  };
102
- //# sourceMappingURL=boot-auto-thin-K2DHHYIW.js.map
102
+ //# sourceMappingURL=boot-auto-thin-AGJ6TAWY.js.map
@@ -0,0 +1,22 @@
1
+ /** Boot-time launch choices: system-prompt variant, mode, YOLO and autonomy (prompted or defaulted). */
2
+ import type { Config } from '@wrongstack/core/types';
3
+ import { type WstackPaths } from '@wrongstack/core/utils';
4
+ import type { BootPhaseExit } from './boot-provider-gate.js';
5
+ import type { ReadlineInputReader } from './input-reader.js';
6
+ import type { TerminalRenderer } from './renderer.js';
7
+ export interface BootLaunchInput {
8
+ isInteractiveTTY: boolean;
9
+ simpleUiFullAuto: boolean;
10
+ flags: Record<string, string | boolean>;
11
+ config: Config;
12
+ renderer: TerminalRenderer;
13
+ reader: ReadlineInputReader;
14
+ profileConfigPath: string;
15
+ wpaths: WstackPaths;
16
+ projectRoot: string;
17
+ }
18
+ export declare function applyBootLaunchChoices(input: BootLaunchInput): Promise<BootPhaseExit | {
19
+ kind: 'ok';
20
+ config: Config;
21
+ }>;
22
+ //# sourceMappingURL=boot-launch-choices.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Boot-time provider + model selection: flags, saved defaults, the first-run
3
+ * credential gate, the "continue with these?" summary and the picker.
4
+ */
5
+ import type { Config, ModelsRegistry } from '@wrongstack/core/types';
6
+ import { type BootConfigResult } from './boot-config.js';
7
+ import type { ReadlineInputReader } from './input-reader.js';
8
+ import type { TerminalRenderer } from './renderer.js';
9
+ export interface BootProviderInput {
10
+ flags: Record<string, string | boolean>;
11
+ config: Config;
12
+ vault: BootConfigResult['vault'];
13
+ modelsRegistry: ModelsRegistry;
14
+ renderer: TerminalRenderer;
15
+ reader: ReadlineInputReader;
16
+ profileConfigPath: string;
17
+ noInteractiveMode: string | boolean | undefined;
18
+ }
19
+ export type BootPhaseExit = {
20
+ kind: 'exit';
21
+ code: number;
22
+ };
23
+ export declare function resolveBootProviderModel(input: BootProviderInput): Promise<BootPhaseExit | {
24
+ kind: 'ok';
25
+ config: Config;
26
+ vault: BootConfigResult['vault'];
27
+ }>;
28
+ //# sourceMappingURL=boot-provider-gate.d.ts.map
@@ -0,0 +1,24 @@
1
+ import type { DefaultLogger } from '@wrongstack/core/infrastructure';
2
+ import type { DefaultModelsRegistry } from '@wrongstack/core/models';
3
+ import type { Config, SecretVault } from '@wrongstack/core/types';
4
+ import type { WstackPaths } from '@wrongstack/core/utils';
5
+ import type { ReadlineInputReader } from './input-reader.js';
6
+ import type { TerminalRenderer } from './renderer.js';
7
+ export interface BootSubcommandInput {
8
+ first: string | undefined;
9
+ positional: string[];
10
+ flags: Record<string, string | boolean>;
11
+ config: Config;
12
+ vault: SecretVault;
13
+ wpaths: WstackPaths;
14
+ cwd: string;
15
+ projectRoot: string;
16
+ userHome: string;
17
+ renderer: TerminalRenderer;
18
+ reader: ReadlineInputReader;
19
+ logger: DefaultLogger;
20
+ modelsRegistry: DefaultModelsRegistry;
21
+ }
22
+ /** Run the matching subcommand and return its exit code; undefined when none matches. */
23
+ export declare function dispatchBootSubcommand(input: BootSubcommandInput): Promise<number | undefined>;
24
+ //# sourceMappingURL=boot-subcommand-dispatch.d.ts.map
package/dist/boot.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { autoSelectSavedProvider, isHomeDirectory, shouldPrintYoloNotice, } from './boot-provider-selection.js';
2
1
  import { DefaultLogger } from '@wrongstack/core/infrastructure';
3
2
  import type { Config, ModelsRegistry, SecretVault } from '@wrongstack/core/types';
4
3
  import { type WstackPaths } from '@wrongstack/core/utils';
5
4
  import { ReadlineInputReader } from './input-reader.js';
6
5
  import { TerminalRenderer } from './renderer.js';
7
6
  import type { UpdateInfo } from './update-check.js';
7
+ export { autoSelectSavedProvider, isHomeDirectory, shouldPrintYoloNotice, } from './boot-provider-selection.js';
8
8
  export interface BootContext {
9
9
  config: Config;
10
10
  vault: SecretVault;
@@ -24,7 +24,6 @@
24
24
  * @module chimera-cascade-evidence
25
25
  */
26
26
  import type { CascadeEvidenceCheckResult, CascadeEvidenceStatus } from '@wrongstack/core/plugin';
27
- export type { CascadeEvidenceCheckResult, CascadeEvidenceStatus, } from '@wrongstack/core/plugin';
28
27
  /** One claimed verification check: the exact command and its observed exit code. */
29
28
  interface CascadeEvidenceCheck {
30
29
  command: string;
@@ -82,4 +81,5 @@ type RunCommandFn = (command: string, cwd: string, timeoutMs: number) => Promise
82
81
  * block.
83
82
  */
84
83
  export declare function verifyCascadeEvidence(evidence: CascadeEvidence | null | undefined, cwd: string, runCommand?: RunCommandFn, timeoutMs?: number): Promise<CascadeEvidenceVerification>;
84
+ export {};
85
85
  //# sourceMappingURL=chimera-cascade-evidence.d.ts.map
@@ -32,85 +32,6 @@ function unknownRestrictedToolNames(restriction, isRegistered) {
32
32
  );
33
33
  }
34
34
 
35
- // src/boot/restricted-mode.ts
36
- import { lockToProjectRoot, lockYoloOff, ToolCapabilities } from "@wrongstack/core/security";
37
- var RESTRICTED_ENV = "WRONGSTACK_RESTRICTED";
38
- var RESTRICTED_DENY_CAPABILITIES = [
39
- ToolCapabilities.SHELL_ARBITRARY,
40
- ToolCapabilities.SHELL_RESTRICTED,
41
- ToolCapabilities.SHELL_EXEC,
42
- ToolCapabilities.NET_OUTBOUND,
43
- ToolCapabilities.PACKAGE_INSTALL,
44
- ToolCapabilities.CONFIG_MUTATE,
45
- ToolCapabilities.FS_WRITE_OUTSIDE_PROJECT,
46
- ToolCapabilities.TOOL_MUTATE_ANY,
47
- ToolCapabilities.MCP_PROXY
48
- ];
49
- var CONFLICTING_FLAGS = [
50
- "yolo",
51
- "yolo-destructive",
52
- "full-auto",
53
- "mcp-config",
54
- // Pre-approving a tool would let writes skip the prompt this mode promises.
55
- "allowed-tools"
56
- ];
57
- function isRestrictedMode(flags) {
58
- return flags["restricted"] === true || process.env[RESTRICTED_ENV] === "1";
59
- }
60
- function validateRestrictedMode(flags) {
61
- if (!isRestrictedMode(flags)) return false;
62
- const conflict = CONFLICTING_FLAGS.find(
63
- (name) => flags[name] !== void 0 && flags[name] !== false
64
- );
65
- if (conflict) throw new Error(`--${conflict} cannot be combined with --restricted`);
66
- return true;
67
- }
68
- function withRestrictedTools(restriction, restricted) {
69
- if (!restricted) return restriction;
70
- return {
71
- ...restriction?.only ? { only: restriction.only } : {},
72
- deny: [...restriction?.deny ?? [], "mcp__*"],
73
- denyCapabilities: RESTRICTED_DENY_CAPABILITIES,
74
- requireDeclaredCapabilities: true
75
- };
76
- }
77
- var RESTRICTED_NOTICE = "Restricted mode: no shell, network, installs or MCP tools; files stay inside the project; YOLO is off.";
78
- var announced = false;
79
- function activateRestrictedMode(flags, write) {
80
- if (!validateRestrictedMode(flags)) return false;
81
- lockToProjectRoot();
82
- lockYoloOff();
83
- process.env[RESTRICTED_ENV] = "1";
84
- if (!announced) {
85
- announced = true;
86
- write(`${RESTRICTED_NOTICE}
87
- `);
88
- }
89
- return true;
90
- }
91
-
92
- // src/boot/safe-mode.ts
93
- var SAFE_MODE_ENV = "WRONGSTACK_SAFE_MODE";
94
- function isSafeMode(flags) {
95
- return flags["safe-mode"] === true || process.env[SAFE_MODE_ENV] === "1";
96
- }
97
- function propagateSafeMode(flags) {
98
- const on = isSafeMode(flags);
99
- if (on) process.env[SAFE_MODE_ENV] = "1";
100
- return on;
101
- }
102
- var SAFE_MODE_NOTICE = "Safe mode: third-party plugins, hooks, configured MCP servers, skills and instruction overrides are off.";
103
- var announced2 = false;
104
- function announceSafeMode(flags, write) {
105
- const on = propagateSafeMode(flags);
106
- if (on && !announced2) {
107
- announced2 = true;
108
- write(`${SAFE_MODE_NOTICE}
109
- `);
110
- }
111
- return on;
112
- }
113
-
114
35
  // src/diff-renderer.ts
115
36
  import { color, sanitizeTerminalText } from "@wrongstack/core/utils";
116
37
  function diffLineStyle(line) {
@@ -226,6 +147,86 @@ function renderPayloadPreview(input) {
226
147
  return typeof diff === "string" && diff ? clipPreview(diff, diffLineStyle) : "";
227
148
  }
228
149
 
150
+ // src/boot/restricted-mode.ts
151
+ import { lockToProjectRoot, lockYoloOff, ToolCapabilities } from "@wrongstack/core/security";
152
+ var RESTRICTED_ENV = "WRONGSTACK_RESTRICTED";
153
+ var RESTRICTED_DENY_CAPABILITIES = [
154
+ ToolCapabilities.SHELL_ARBITRARY,
155
+ ToolCapabilities.SHELL_RESTRICTED,
156
+ ToolCapabilities.SHELL_EXEC,
157
+ ToolCapabilities.NET_OUTBOUND,
158
+ ToolCapabilities.PACKAGE_INSTALL,
159
+ ToolCapabilities.CONFIG_MUTATE,
160
+ ToolCapabilities.FS_WRITE_OUTSIDE_PROJECT,
161
+ ToolCapabilities.TOOL_MUTATE_ANY,
162
+ ToolCapabilities.MCP_PROXY
163
+ ];
164
+ var CONFLICTING_FLAGS = [
165
+ "yolo",
166
+ "yolo-plus",
167
+ "yolo-destructive",
168
+ "full-auto",
169
+ "mcp-config",
170
+ // Pre-approving a tool would let writes skip the prompt this mode promises.
171
+ "allowed-tools"
172
+ ];
173
+ function isRestrictedMode(flags) {
174
+ return flags["restricted"] === true || process.env[RESTRICTED_ENV] === "1";
175
+ }
176
+ function validateRestrictedMode(flags) {
177
+ if (!isRestrictedMode(flags)) return false;
178
+ const conflict = CONFLICTING_FLAGS.find(
179
+ (name) => flags[name] !== void 0 && flags[name] !== false
180
+ );
181
+ if (conflict) throw new Error(`--${conflict} cannot be combined with --restricted`);
182
+ return true;
183
+ }
184
+ function withRestrictedTools(restriction, restricted) {
185
+ if (!restricted) return restriction;
186
+ return {
187
+ ...restriction?.only ? { only: restriction.only } : {},
188
+ deny: [...restriction?.deny ?? [], "mcp__*"],
189
+ denyCapabilities: RESTRICTED_DENY_CAPABILITIES,
190
+ requireDeclaredCapabilities: true
191
+ };
192
+ }
193
+ var RESTRICTED_NOTICE = "Restricted mode: no shell, network, installs or MCP tools; files stay inside the project; YOLO is off.";
194
+ var announced = false;
195
+ function activateRestrictedMode(flags, write) {
196
+ if (!validateRestrictedMode(flags)) return false;
197
+ lockToProjectRoot();
198
+ lockYoloOff();
199
+ process.env[RESTRICTED_ENV] = "1";
200
+ if (!announced) {
201
+ announced = true;
202
+ write(`${RESTRICTED_NOTICE}
203
+ `);
204
+ }
205
+ return true;
206
+ }
207
+
208
+ // src/boot/safe-mode.ts
209
+ var SAFE_MODE_ENV = "WRONGSTACK_SAFE_MODE";
210
+ function isSafeMode(flags) {
211
+ return flags["safe-mode"] === true || process.env[SAFE_MODE_ENV] === "1";
212
+ }
213
+ function propagateSafeMode(flags) {
214
+ const on = isSafeMode(flags);
215
+ if (on) process.env[SAFE_MODE_ENV] = "1";
216
+ return on;
217
+ }
218
+ var SAFE_MODE_NOTICE = "Safe mode: third-party plugins, hooks, configured MCP servers, skills and instruction overrides are off.";
219
+ var announced2 = false;
220
+ function announceSafeMode(flags, write) {
221
+ const on = propagateSafeMode(flags);
222
+ if (on && !announced2) {
223
+ announced2 = true;
224
+ write(`${SAFE_MODE_NOTICE}
225
+ `);
226
+ }
227
+ return on;
228
+ }
229
+
229
230
  // src/boot/simpleui-full-auto.ts
230
231
  function isSimpleUiFullAuto(flags) {
231
232
  return flags["simpleui"] === true && flags["full-auto"] === true;
@@ -607,4 +608,4 @@ export {
607
608
  detectProjectFacts,
608
609
  renderAgentsTemplate
609
610
  };
610
- //# sourceMappingURL=chunk-TI7KLHYX.js.map
611
+ //# sourceMappingURL=chunk-2CMMWRQH.js.map