@wrongstack/cli 0.301.0 → 0.302.2

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 (113) hide show
  1. package/data/providers.json +41 -155
  2. package/dist/{acp-DATHHPNT.js → acp-XCE4JJF3.js} +4 -4
  3. package/dist/{audit-QRCLEHHW.js → audit-BBR22QH3.js} +2 -2
  4. package/dist/{auth-JASC4K3F.js → auth-K7CYVVKH.js} +121 -78
  5. package/dist/auth-menu/index.d.ts +5 -5
  6. package/dist/auth-menu/local.d.ts +4 -5
  7. package/dist/auth-menu/openai-codex-oauth.d.ts +1 -1
  8. package/dist/{auto-discover-providers-DRW4OZHG.js → auto-discover-providers-MHFLDSD3.js} +2 -2
  9. package/dist/{bench-7ZDWSNEF.js → bench-XNDUJOSZ.js} +10 -11
  10. package/dist/boot/auto-discover-providers.d.ts +1 -1
  11. package/dist/boot/container-wiring.d.ts +3 -3
  12. package/dist/boot/dispatch-webui.d.ts +3 -16
  13. package/dist/boot/system-prompt.d.ts +1 -2
  14. package/dist/boot/tool-registry.d.ts +1 -1
  15. package/dist/boot/tui-coordinator-setup.d.ts +1 -1
  16. package/dist/boot/tui-project-picker-callback.d.ts +1 -1
  17. package/dist/boot/webui-session-child.d.ts +91 -0
  18. package/dist/boot-config.d.ts +2 -2
  19. package/dist/boot.d.ts +1 -1
  20. package/dist/{chunk-ETOEGL3V.js → chunk-3IC4IEZC.js} +7 -2
  21. package/dist/chunk-3JPTNADJ.js +128 -0
  22. package/dist/{chunk-4GVH7V3S.js → chunk-52C7PD2H.js} +1 -1
  23. package/dist/{chunk-OP47B3IX.js → chunk-7YLN7YUA.js} +7 -2
  24. package/dist/{chunk-263G3FMB.js → chunk-B4JLSXZB.js} +11 -14
  25. package/dist/{chunk-I5MEUFDI.js → chunk-BXQG3H2Y.js} +8 -3
  26. package/dist/{chunk-MHF2IJDE.js → chunk-C5NXM2SI.js} +21 -6
  27. package/dist/{chunk-XTIXVJXP.js → chunk-DGXNL7OT.js} +1 -1
  28. package/dist/{chunk-O7XNGCRT.js → chunk-FJVCVZIV.js} +974 -935
  29. package/dist/{chunk-MRLYDHQ7.js → chunk-JQURRYU4.js} +4 -6
  30. package/dist/{chunk-ZECLGUTF.js → chunk-KV6DNQT6.js} +2 -2
  31. package/dist/{chunk-F4PEGAJZ.js → chunk-NUIHRGPY.js} +1 -1
  32. package/dist/{chunk-GUHQQG63.js → chunk-RK7E3IXT.js} +2 -4
  33. package/dist/{chunk-PYTFS4MC.js → chunk-SSSJQVUY.js} +27 -16
  34. package/dist/{chunk-PJHET45A.js → chunk-SZ42FYPT.js} +3 -3
  35. package/dist/{chunk-2KDOFTTM.js → chunk-WOXUE2CN.js} +1067 -900
  36. package/dist/{chunk-A6Q5KGLV.js → chunk-YKBRFSGL.js} +5 -5
  37. package/dist/cli-context.d.ts +3 -1
  38. package/dist/cli-eternal-flag.d.ts +1 -2
  39. package/dist/{cli-main-XWC57MGE.js → cli-main-PJMDZHDK.js} +2683 -2134
  40. package/dist/context-limit.d.ts +11 -5
  41. package/dist/{diag-doctor-OQ3AA63O.js → diag-doctor-ZF5BF2MK.js} +2 -3
  42. package/dist/execute-deps.d.ts +3 -0
  43. package/dist/{execution-LHMSMDHB.js → execution-LZRYRGDD.js} +343 -177
  44. package/dist/{export-DOBGPY23.js → export-CCUXRJOU.js} +3 -11
  45. package/dist/fleet/host-supervisor.d.ts +1 -1
  46. package/dist/fleet/host.d.ts +1 -1
  47. package/dist/fleet/routing.d.ts +1 -2
  48. package/dist/goal-host.d.ts +2 -2
  49. package/dist/hooks-wiring.d.ts +1 -1
  50. package/dist/{hq-LN5CJHCM.js → hq-AHPAE7EN.js} +104 -55
  51. package/dist/hq-command-controller.d.ts +1 -1
  52. package/dist/hq-server/routes/system-handlers.d.ts +1 -2
  53. package/dist/hq-server/routes.d.ts +7 -7
  54. package/dist/{hq-server-S7HZG3PA.js → hq-server-KU2Z54QU.js} +2 -2
  55. package/dist/index.d.ts +1 -1
  56. package/dist/index.js +2712 -2642
  57. package/dist/mailbox-bridge-bootstrap.d.ts +2 -2
  58. package/dist/{mcp-OHPJH73U.js → mcp-E5EBGOHF.js} +6 -6
  59. package/dist/mcp-serve.d.ts +1 -1
  60. package/dist/{modeldiag-3DOK4BWW.js → modeldiag-SIVUOX2Y.js} +18 -13
  61. package/dist/{permissions-FNYLZIL4.js → permissions-2PWBL4YU.js} +5 -3
  62. package/dist/picker.d.ts +1 -1
  63. package/dist/plugin-management.d.ts +1 -1
  64. package/dist/{plugin-usage-YEVLOR33.js → plugin-usage-PTEETL3J.js} +2 -2
  65. package/dist/{plugins-K3BAUP4D.js → plugins-XRGWC3NJ.js} +3 -3
  66. package/dist/pre-launch.d.ts +2 -2
  67. package/dist/{providers-models-WEZ4EGLL.js → providers-models-VV74TRQ2.js} +86 -37
  68. package/dist/repl.d.ts +1 -1
  69. package/dist/{replay-FCBNHW3K.js → replay-WBRMEWQ5.js} +2 -2
  70. package/dist/{rewind-AOD3JIYX.js → rewind-7RE6ONIC.js} +17 -17
  71. package/dist/{sdd-runtime-AIJCJGWC.js → sdd-runtime-GFZ3NJKS.js} +2 -2
  72. package/dist/{sessions-config-XXN7267N.js → sessions-config-YX2ZPAFM.js} +36 -32
  73. package/dist/{simpleui-dist-JIFGUJO7.js → simpleui-dist-33VO3QHF.js} +9 -2
  74. package/dist/slash-commands/agents.d.ts +14 -0
  75. package/dist/slash-commands/command-context.d.ts +2 -3
  76. package/dist/slash-commands/helpers.d.ts +1 -1
  77. package/dist/slash-commands/index.d.ts +1 -1
  78. package/dist/slash-commands/intake.d.ts +10 -0
  79. package/dist/slash-commands/memory-triage.d.ts +1 -1
  80. package/dist/slash-commands/provider-status.d.ts +1 -1
  81. package/dist/subcommands/handlers/hq.d.ts +20 -0
  82. package/dist/subcommands/handlers/per-subcommand-help-data.d.ts +1 -1
  83. package/dist/{update-MV6TUACD.js → update-LTDJGAFU.js} +3 -3
  84. package/dist/{update-check-UMYTOH7Z.js → update-check-WARHSVZA.js} +2 -2
  85. package/dist/webui-server/connection-handler.d.ts +1 -1
  86. package/dist/webui-server/context-breakdown.d.ts +1 -1
  87. package/dist/webui-server/cost-helpers.d.ts +1 -1
  88. package/dist/webui-server/lifecycle.d.ts +1 -1
  89. package/dist/webui-server/prefs-seeding.d.ts +1 -1
  90. package/dist/webui-server/setup-events.d.ts +1 -1
  91. package/dist/webui-server/static-serve.d.ts +1 -1
  92. package/dist/{webui-server-DD35QFNO.js → webui-server-E3OPEKU5.js} +66 -25
  93. package/dist/webui-server-options.d.ts +7 -0
  94. package/dist/wiring/command-host-state.d.ts +2 -2
  95. package/dist/wiring/controllers.d.ts +1 -2
  96. package/dist/wiring/dep-watcher.d.ts +1 -1
  97. package/dist/wiring/director-setup.d.ts +3 -3
  98. package/dist/wiring/eternal-command-handlers.d.ts +2 -2
  99. package/dist/wiring/management-tools.d.ts +2 -2
  100. package/dist/wiring/provider-runtime.d.ts +1 -1
  101. package/dist/wiring/provider-status.d.ts +1 -1
  102. package/dist/wiring/provider-utility-tools.d.ts +3 -3
  103. package/dist/wiring/provider.d.ts +1 -1
  104. package/dist/wiring/replay.d.ts +1 -1
  105. package/dist/wiring/runtime-controller-deps.d.ts +1 -1
  106. package/dist/wiring/runtime-dispatch-state.d.ts +1 -2
  107. package/dist/wiring/runtime-lifecycle-deps.d.ts +2 -2
  108. package/dist/wiring/runtime-picker-deps.d.ts +1 -2
  109. package/dist/wiring/sage.d.ts +1 -1
  110. package/dist/wiring/session-command-handlers.d.ts +1 -2
  111. package/dist/wiring/session.d.ts +6 -1
  112. package/dist/wiring/slash-commands.d.ts +2 -3
  113. package/package.json +23 -23
@@ -25,14 +25,13 @@
25
25
  * in plaintext.
26
26
  */
27
27
  import type { SecretScrubber } from '@wrongstack/core/types';
28
+ import type { ProbeOptions, ProbeResult } from '@wrongstack/runtime/probe';
29
+ import { probeLocalLlm } from '@wrongstack/runtime/probe';
30
+ import { type AuthAuditLogger } from './auth-menu-audit.js';
28
31
  import { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry } from './local-presets.js';
29
32
  import { suggestLabel } from './shared.js';
30
33
  import type { AuthMenuDeps } from './types.js';
31
- import { probeLocalLlm } from '@wrongstack/runtime/probe';
32
- import type { ProbeOptions, ProbeResult } from '@wrongstack/runtime/probe';
33
- import { type AuthAuditLogger } from './auth-menu-audit.js';
34
- export { probeLocalLlm, type ProbeOptions, type ProbeResult };
35
- export { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry };
34
+ export { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry, type ProbeOptions, type ProbeResult, probeLocalLlm, };
36
35
  export interface RunAuthLocalOptions {
37
36
  /**
38
37
  * Direct pick: skip the interactive menu and configure this preset.
@@ -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, parseAuthorizationInput, type Pkce, 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, type Pkce, 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. */
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  discoverAndMergeProviders
3
- } from "./chunk-4GVH7V3S.js";
3
+ } from "./chunk-52C7PD2H.js";
4
4
  import "./chunk-7OCVIDC7.js";
5
5
  export {
6
6
  discoverAndMergeProviders
7
7
  };
8
- //# sourceMappingURL=auto-discover-providers-DRW4OZHG.js.map
8
+ //# sourceMappingURL=auto-discover-providers-MHFLDSD3.js.map
@@ -7,7 +7,6 @@ import "./chunk-7OCVIDC7.js";
7
7
  import * as fs from "node:fs/promises";
8
8
  import { createRequire } from "node:module";
9
9
  import * as path from "node:path";
10
- import { toErrorMessage } from "@wrongstack/core/utils";
11
10
  import {
12
11
  collectCellPredictions,
13
12
  computeToolManifestHash,
@@ -26,7 +25,7 @@ import {
26
25
  writeJsonArtifacts,
27
26
  writePredictionsJsonl
28
27
  } from "@wrongstack/bench";
29
- import { color } from "@wrongstack/core/utils";
28
+ import { color, toErrorMessage } from "@wrongstack/core/utils";
30
29
  var benchCmd = async (args, deps) => {
31
30
  const sub = args[0];
32
31
  const rest = args.slice(1);
@@ -58,9 +57,7 @@ function printUsage(deps) {
58
57
  color.dim(
59
58
  " wstack bench run --suite polyglot --polyglot-dir ./polyglot --models bench.config.json --limit 5"
60
59
  ),
61
- color.dim(
62
- " wstack bench run --suite local --suite-dir ./evals --models bench.config.json"
63
- ),
60
+ color.dim(" wstack bench run --suite local --suite-dir ./evals --models bench.config.json"),
64
61
  color.dim(" wstack bench mine --transcript ./session.jsonl --out ./evals"),
65
62
  color.dim(" wstack bench report ./bench-results/2026-06-14T10-00-00"),
66
63
  ""
@@ -198,9 +195,7 @@ async function benchReport(args, deps) {
198
195
  try {
199
196
  summary = await readSummary(outDir);
200
197
  } catch (err) {
201
- deps.renderer.writeError(
202
- `cannot read summary.json in ${outDir}: ${toErrorMessage(err)}`
203
- );
198
+ deps.renderer.writeError(`cannot read summary.json in ${outDir}: ${toErrorMessage(err)}`);
204
199
  return 1;
205
200
  }
206
201
  const md = renderMarkdownReport(summary);
@@ -211,7 +206,9 @@ async function benchReport(args, deps) {
211
206
  async function benchMine(args, deps) {
212
207
  const transcriptRaw = flagStr(deps, "transcript") ?? args.find((arg) => !arg.startsWith("-"));
213
208
  if (!transcriptRaw) {
214
- deps.renderer.writeError("Usage: wstack bench mine --transcript <session.jsonl> [--out <eval-dir>]");
209
+ deps.renderer.writeError(
210
+ "Usage: wstack bench mine --transcript <session.jsonl> [--out <eval-dir>]"
211
+ );
215
212
  return 1;
216
213
  }
217
214
  const outRaw = flagStr(deps, "out") ?? "evals";
@@ -220,7 +217,9 @@ async function benchMine(args, deps) {
220
217
  transcriptPath: path.resolve(deps.cwd, transcriptRaw),
221
218
  outDir: path.resolve(deps.cwd, outRaw)
222
219
  });
223
- deps.renderer.writeInfo(`Mined ${mined.candidates.length} edit attempt(s) from ${mined.sessionId}.`);
220
+ deps.renderer.writeInfo(
221
+ `Mined ${mined.candidates.length} edit attempt(s) from ${mined.sessionId}.`
222
+ );
224
223
  deps.renderer.writeInfo(`Pinned transcript \u2192 ${mined.copiedTranscriptPath}`);
225
224
  deps.renderer.writeInfo(`Curator drafts \u2192 ${mined.draftsPath}`);
226
225
  deps.renderer.writeInfo(
@@ -275,4 +274,4 @@ async function benchList(_args, deps) {
275
274
  export {
276
275
  benchCmd
277
276
  };
278
- //# sourceMappingURL=bench-7ZDWSNEF.js.map
277
+ //# sourceMappingURL=bench-XNDUJOSZ.js.map
@@ -1,5 +1,5 @@
1
- import type { Config, Logger } from '@wrongstack/core/types';
2
1
  import type { DefaultModelsRegistry } from '@wrongstack/core/models';
2
+ import type { Config, Logger } from '@wrongstack/core/types';
3
3
  /**
4
4
  * Fetch model lists for every auto-discovery provider in the config and merge
5
5
  * them into the catalog. Best-effort end to end: a down server or missing key
@@ -1,7 +1,7 @@
1
- import type { Config, Logger, Renderer, ModelsRegistry } from '@wrongstack/core/types';
2
- import type { WstackPaths } from '@wrongstack/core/utils';
3
- import type { EventBus } from '@wrongstack/core/kernel';
4
1
  import { DefaultPathResolver } from '@wrongstack/core/infrastructure';
2
+ import type { EventBus } from '@wrongstack/core/kernel';
3
+ import type { Config, Logger, ModelsRegistry, Renderer } from '@wrongstack/core/types';
4
+ import type { WstackPaths } from '@wrongstack/core/utils';
5
5
  import { createDefaultContainer } from '@wrongstack/runtime';
6
6
  import { makePromptDelegate } from '../permission-prompt.js';
7
7
  interface WireContainerDeps {
@@ -1,19 +1,3 @@
1
- /**
2
- * WebUI dispatch — extracted from the tail of `execute()`.
3
- *
4
- * PR 6 of Issue #29 (partial). The TUI-vs-REPL-vs-WebUI fork at the
5
- * end of `execute()` is a ~1,600-line `if/else if/else if/else`
6
- * chain. The WebUI branch is the most self-contained of the four: it
7
- * constructs a `runWebUI` options object from already-available deps,
8
- * wires SIGINT handling, and returns an exit code. Extracting it
9
- * first lets `execute()` shrink by ~100 lines and isolates the
10
- * WebUI-specific wiring (port resolution, browser banner and autonomy
11
- * forwarding) in a single named module.
12
- *
13
- * The TUI branch (~1,388 lines) and the single-shot branch are left
14
- * inline — they are too deeply coupled to local mutable state for a
15
- * single-PR extraction.
16
- */
17
1
  import type { Agent } from '@wrongstack/core/agent';
18
2
  import type { BrainArbiter } from '@wrongstack/core/coordination';
19
3
  import type { JournalEntry } from '@wrongstack/core/goal';
@@ -23,6 +7,7 @@ import type { MCPRegistry } from '@wrongstack/mcp';
23
7
  import type { TerminalRenderer } from '../renderer.js';
24
8
  import type { AutonomyMode } from '../services/autonomy-mode.js';
25
9
  import type { CliWebUIOptions } from '../webui-server-options.js';
10
+ import { type WebuiSessionChildOptions } from './webui-session-child.js';
26
11
  export interface WebUIDispatchContext {
27
12
  agent: Agent;
28
13
  events: EventBus;
@@ -99,6 +84,8 @@ export interface WebUIDispatchContext {
99
84
  }) => Promise<string>) | undefined;
100
85
  /** Live fleet budget for WebUI concurrency/spawn gauges (issue #323). */
101
86
  getFleetBudget?: CliWebUIOptions['getFleetBudget'];
87
+ /** Internal one-session child launch metadata, when --webui-session-child is active. */
88
+ webuiSessionChild?: WebuiSessionChildOptions | undefined;
102
89
  }
103
90
  /**
104
91
  * Run the WebUI server and block until it shuts down.
@@ -1,6 +1,5 @@
1
- import type { Config, Logger, ModelsRegistry } from '@wrongstack/core/types';
2
1
  import type { ProviderRegistry } from '@wrongstack/core/registry';
3
- import type { ResolvedProvider } from '@wrongstack/core/types';
2
+ import type { Config, Logger, ModelsRegistry, ResolvedProvider } from '@wrongstack/core/types';
4
3
  export type ModeId = string;
5
4
  export type ModePrompt = string;
6
5
  export interface ModelCapabilities {
@@ -1,8 +1,8 @@
1
1
  /** CLI boot adapter for canonical runtime tool registration and host policies. */
2
2
  import type { EventBus } from '@wrongstack/core/kernel';
3
+ import type { ToolRegistry } from '@wrongstack/core/registry';
3
4
  import type { MemoryPort, TokenSavingTier, ToolDescriptionModeConfig, ToolResultRenderModeConfig } from '@wrongstack/core/types';
4
5
  import type { WstackPaths } from '@wrongstack/core/utils';
5
- import type { ToolRegistry } from '@wrongstack/core/registry';
6
6
  interface RegisterBuiltinToolsDeps {
7
7
  toolRegistry: ToolRegistry;
8
8
  compactor: unknown;
@@ -1,5 +1,5 @@
1
- import { AutonomousCoordinator, type Director } from '@wrongstack/core/coordination';
2
1
  import type { Context } from '@wrongstack/core/agent';
2
+ import { AutonomousCoordinator, type Director } from '@wrongstack/core/coordination';
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';
@@ -1,7 +1,7 @@
1
1
  import type { Director } from '@wrongstack/core/coordination';
2
2
  import type { TerminalRenderer } from '../renderer.js';
3
- import type { TuiRuntimeState } from './tui-runtime-state.js';
4
3
  import type { ProjectSwitchContext } from './tui-project-switch.js';
4
+ import type { TuiRuntimeState } from './tui-runtime-state.js';
5
5
  export interface ProjectPickerContext {
6
6
  state: TuiRuntimeState;
7
7
  renderer: TerminalRenderer;
@@ -0,0 +1,91 @@
1
+ export declare const WEBUI_SESSION_CHILD_PROTOCOL_VERSION = 1;
2
+ export declare const WEBUI_SESSION_CHILD_CAPABILITIES: readonly ['multi-session-child', 'single-port-http-ws', 'session-affinity', 'graceful-shutdown'];
3
+ export type WebuiSessionChildPhase = 'validate_args' | 'boot_config' | 'claim_session' | 'create_session' | 'resume_session' | 'bind_port' | 'register_instance' | 'register_session' | 'start_server' | 'unknown';
4
+ export interface WebuiSessionChildOptions {
5
+ enabled: boolean;
6
+ projectRoot: string;
7
+ workingDir: string;
8
+ sessionId?: string | undefined;
9
+ resume: boolean;
10
+ host?: string | undefined;
11
+ port?: number | undefined;
12
+ token?: string | undefined;
13
+ publicUrl?: string | undefined;
14
+ publicWsUrl?: string | undefined;
15
+ requireToken?: boolean | undefined;
16
+ strictPort: boolean;
17
+ parentPid: number;
18
+ parentShellId: string;
19
+ runtimeId: string;
20
+ readyFile: string;
21
+ attachable: boolean;
22
+ protocolVersion: number;
23
+ }
24
+ export interface WebuiSessionChildReadyPayload {
25
+ type: 'webui.session_child.ready';
26
+ protocolVersion: number;
27
+ runtime: {
28
+ role: 'session-child';
29
+ runtimeId: string;
30
+ pid: number;
31
+ parentPid: number;
32
+ parentShellId: string;
33
+ startedAt: string;
34
+ };
35
+ project: {
36
+ projectRoot: string;
37
+ workingDir: string;
38
+ projectSlug: string;
39
+ projectName: string;
40
+ };
41
+ session: {
42
+ sessionId: string;
43
+ created: boolean;
44
+ resumed: boolean;
45
+ title?: string | undefined;
46
+ provider?: string | undefined;
47
+ model?: string | undefined;
48
+ };
49
+ endpoint: {
50
+ surface: 'webui';
51
+ host: string;
52
+ httpPort: number;
53
+ url: string;
54
+ publicUrl?: string | undefined;
55
+ publicWsUrl?: string | undefined;
56
+ requireToken: boolean;
57
+ auth: {
58
+ scheme: 'registry-token' | 'cookie-bootstrap' | 'none';
59
+ tokenPresent: boolean;
60
+ token?: string | undefined;
61
+ };
62
+ };
63
+ registry: {
64
+ webuiInstanceRegistered: boolean;
65
+ sessionRegistered: boolean;
66
+ };
67
+ capabilities: string[];
68
+ }
69
+ export interface WebuiSessionChildErrorPayload {
70
+ type: 'webui.session_child.error';
71
+ protocolVersion: number;
72
+ runtimeId?: string | undefined;
73
+ parentShellId?: string | undefined;
74
+ pid: number;
75
+ phase: WebuiSessionChildPhase;
76
+ recoverable: boolean;
77
+ message: string;
78
+ details?: Record<string, unknown> | undefined;
79
+ }
80
+ export declare function parseWebuiSessionChildOptions(flags: Record<string, string | boolean>): WebuiSessionChildOptions | null;
81
+ export declare function writeWebuiSessionChildReady(readyFile: string, payload: WebuiSessionChildReadyPayload): Promise<void>;
82
+ export declare function writeWebuiSessionChildError(readyFile: string, input: {
83
+ protocolVersion?: number | undefined;
84
+ runtimeId?: string | undefined;
85
+ parentShellId?: string | undefined;
86
+ phase: WebuiSessionChildPhase;
87
+ recoverable: boolean;
88
+ error: unknown;
89
+ details?: Record<string, unknown> | undefined;
90
+ }): Promise<void>;
91
+ //# sourceMappingURL=webui-session-child.d.ts.map
@@ -1,7 +1,7 @@
1
- import type { Config } from '@wrongstack/core/types';
1
+ import type { DefaultPathResolver } from '@wrongstack/core/infrastructure';
2
2
  import { bootConfig as coreBootConfig } from '@wrongstack/core/infrastructure';
3
+ import type { Config } from '@wrongstack/core/types';
3
4
  import type { WstackPaths } from '@wrongstack/core/utils';
4
- import type { DefaultPathResolver } from '@wrongstack/core/infrastructure';
5
5
  export interface BootPaths {
6
6
  cwd: string;
7
7
  projectRoot: string;
package/dist/boot.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { DefaultLogger } from '@wrongstack/core/infrastructure';
1
2
  import type { Config, ModelsRegistry, SecretVault } from '@wrongstack/core/types';
2
3
  import { type WstackPaths } from '@wrongstack/core/utils';
3
- import { DefaultLogger } from '@wrongstack/core/infrastructure';
4
4
  import { ReadlineInputReader } from './input-reader.js';
5
5
  import { TerminalRenderer } from './renderer.js';
6
6
  import type { UpdateInfo } from './update-check.js';
@@ -66,7 +66,12 @@ async function buildPickableProviders(modelsRegistry, config) {
66
66
  const inherited = catalogById.get(catalogType) ?? catalogById.get(cfg.type ?? id);
67
67
  const family = cfg.family ?? inherited?.family ?? "unsupported";
68
68
  if (family === "unsupported") continue;
69
- const models = visibleModelIds(id, config, (inherited?.models ?? []).map((m) => m.id), cfg);
69
+ const models = visibleModelIds(
70
+ id,
71
+ config,
72
+ (inherited?.models ?? []).map((m) => m.id),
73
+ cfg
74
+ );
70
75
  out.push({ id, family, models });
71
76
  }
72
77
  for (const p of catalog) {
@@ -84,4 +89,4 @@ export {
84
89
  hasApiKey,
85
90
  buildPickableProviders
86
91
  };
87
- //# sourceMappingURL=chunk-ETOEGL3V.js.map
92
+ //# sourceMappingURL=chunk-3IC4IEZC.js.map
@@ -0,0 +1,128 @@
1
+
2
+ // src/boot/webui-session-child.ts
3
+ import * as fs from "node:fs/promises";
4
+ import * as path from "node:path";
5
+ import { atomicWrite, toErrorMessage } from "@wrongstack/core/utils";
6
+ var WEBUI_SESSION_CHILD_PROTOCOL_VERSION = 1;
7
+ var WEBUI_SESSION_CHILD_CAPABILITIES = [
8
+ "multi-session-child",
9
+ "single-port-http-ws",
10
+ "session-affinity",
11
+ "graceful-shutdown"
12
+ ];
13
+ function flagValue(flags, names) {
14
+ for (const name of names) {
15
+ if (!Object.hasOwn(flags, name)) continue;
16
+ const value = flags[name];
17
+ if (typeof value === "string" && value.trim() !== "") return value.trim();
18
+ throw new Error(`--${name} requires a value`);
19
+ }
20
+ return void 0;
21
+ }
22
+ function boolFlag(flags, names) {
23
+ for (const name of names) {
24
+ if (!Object.hasOwn(flags, name)) continue;
25
+ const value = flags[name];
26
+ if (typeof value === "boolean") return value;
27
+ const normalized = String(value).trim().toLowerCase();
28
+ if (["1", "true", "yes", "on"].includes(normalized)) return true;
29
+ if (["0", "false", "no", "off"].includes(normalized)) return false;
30
+ throw new Error(`--${name} must be a boolean value`);
31
+ }
32
+ return void 0;
33
+ }
34
+ function parsePositiveInteger(value, label) {
35
+ if (value === void 0) throw new Error(`${label} is required`);
36
+ const parsed = Number.parseInt(value, 10);
37
+ if (!Number.isInteger(parsed) || parsed <= 0)
38
+ throw new Error(`${label} must be a positive integer`);
39
+ return parsed;
40
+ }
41
+ function parsePort(value) {
42
+ if (value === void 0) return void 0;
43
+ const parsed = Number.parseInt(value, 10);
44
+ if (!Number.isInteger(parsed) || parsed <= 0 || parsed > 65535) {
45
+ throw new Error("--port must be a port between 1 and 65535");
46
+ }
47
+ return parsed;
48
+ }
49
+ function requiredString(value, label) {
50
+ if (!value || value.trim() === "") throw new Error(`${label} is required`);
51
+ return value.trim();
52
+ }
53
+ function requireAbsolutePath(value, label) {
54
+ const resolved = requiredString(value, label);
55
+ if (!path.isAbsolute(resolved)) throw new Error(`${label} must be an absolute path`);
56
+ return path.resolve(resolved);
57
+ }
58
+ function parseWebuiSessionChildOptions(flags) {
59
+ if (flags["webui-session-child"] !== true) return null;
60
+ const projectRoot = requireAbsolutePath(flagValue(flags, ["project-root"]), "--project-root");
61
+ const workingDir = requireAbsolutePath(flagValue(flags, ["working-dir"]), "--working-dir");
62
+ const relativeWorkingDir = path.relative(projectRoot, workingDir);
63
+ if (relativeWorkingDir.startsWith("..") || path.isAbsolute(relativeWorkingDir)) {
64
+ throw new Error("--working-dir must be inside --project-root");
65
+ }
66
+ const sessionId = flagValue(flags, ["session-id"]);
67
+ const resume = boolFlag(flags, ["resume"]) ?? false;
68
+ if (sessionId && !resume) throw new Error("--session-id requires --resume");
69
+ if (resume && !sessionId) throw new Error("--resume requires --session-id in child mode");
70
+ const host = flagValue(flags, ["webui-host", "host"]);
71
+ const port = parsePort(flagValue(flags, ["webui-port", "http-port", "port", "ws-port"]));
72
+ const token = flagValue(flags, ["webui-token", "token"]);
73
+ const publicUrl = flagValue(flags, ["webui-public-url", "public-url"]);
74
+ const publicWsUrl = flagValue(flags, ["webui-public-ws-url", "public-ws-url"]);
75
+ const requireToken = boolFlag(flags, ["webui-require-token", "require-token"]);
76
+ return {
77
+ enabled: true,
78
+ projectRoot,
79
+ workingDir,
80
+ ...sessionId ? { sessionId } : {},
81
+ resume,
82
+ ...host ? { host } : {},
83
+ ...port !== void 0 ? { port } : {},
84
+ ...token ? { token } : {},
85
+ ...publicUrl ? { publicUrl } : {},
86
+ ...publicWsUrl ? { publicWsUrl } : {},
87
+ ...requireToken !== void 0 ? { requireToken } : {},
88
+ strictPort: boolFlag(flags, ["strict-port"]) ?? false,
89
+ parentPid: parsePositiveInteger(flagValue(flags, ["parent-pid"]), "--parent-pid"),
90
+ parentShellId: requiredString(flagValue(flags, ["parent-shell-id"]), "--parent-shell-id"),
91
+ runtimeId: requiredString(flagValue(flags, ["runtime-id"]), "--runtime-id"),
92
+ readyFile: requireAbsolutePath(flagValue(flags, ["ready-file"]), "--ready-file"),
93
+ attachable: boolFlag(flags, ["attachable"]) ?? true,
94
+ protocolVersion: parsePositiveInteger(
95
+ flagValue(flags, ["protocol-version"]) ?? String(WEBUI_SESSION_CHILD_PROTOCOL_VERSION),
96
+ "--protocol-version"
97
+ )
98
+ };
99
+ }
100
+ async function writeWebuiSessionChildReady(readyFile, payload) {
101
+ await fs.mkdir(path.dirname(readyFile), { recursive: true });
102
+ await atomicWrite(readyFile, `${JSON.stringify(payload, null, 2)}
103
+ `, { mode: 384 });
104
+ }
105
+ async function writeWebuiSessionChildError(readyFile, input) {
106
+ const payload = {
107
+ type: "webui.session_child.error",
108
+ protocolVersion: input.protocolVersion ?? WEBUI_SESSION_CHILD_PROTOCOL_VERSION,
109
+ ...input.runtimeId ? { runtimeId: input.runtimeId } : {},
110
+ ...input.parentShellId ? { parentShellId: input.parentShellId } : {},
111
+ pid: process.pid,
112
+ phase: input.phase,
113
+ recoverable: input.recoverable,
114
+ message: toErrorMessage(input.error),
115
+ ...input.details ? { details: input.details } : {}
116
+ };
117
+ await fs.mkdir(path.dirname(readyFile), { recursive: true });
118
+ await atomicWrite(readyFile, `${JSON.stringify(payload, null, 2)}
119
+ `, { mode: 384 });
120
+ }
121
+
122
+ export {
123
+ WEBUI_SESSION_CHILD_CAPABILITIES,
124
+ parseWebuiSessionChildOptions,
125
+ writeWebuiSessionChildReady,
126
+ writeWebuiSessionChildError
127
+ };
128
+ //# sourceMappingURL=chunk-3JPTNADJ.js.map
@@ -58,4 +58,4 @@ async function discoverAndMergeProviders(opts) {
58
58
  export {
59
59
  discoverAndMergeProviders
60
60
  };
61
- //# sourceMappingURL=chunk-4GVH7V3S.js.map
61
+ //# sourceMappingURL=chunk-52C7PD2H.js.map
@@ -4,7 +4,12 @@ function createHqCommandDispatcher(controller) {
4
4
  return async (command) => {
5
5
  const cmd = command;
6
6
  try {
7
- const result = await dispatch(controller, cmd.commandId, cmd.type, cmd.payload);
7
+ const result = await dispatch(
8
+ controller,
9
+ cmd.commandId,
10
+ cmd.type,
11
+ cmd.payload
12
+ );
8
13
  return result;
9
14
  } catch (err) {
10
15
  return {
@@ -139,4 +144,4 @@ ${command}
139
144
  export {
140
145
  createHqCommandDispatcher
141
146
  };
142
- //# sourceMappingURL=chunk-OP47B3IX.js.map
147
+ //# sourceMappingURL=chunk-7YLN7YUA.js.map
@@ -4,10 +4,9 @@ import { randomUUID } from "node:crypto";
4
4
  import * as fs from "node:fs/promises";
5
5
  import os from "node:os";
6
6
  import * as path from "node:path";
7
- import { atomicWrite, resolveWstackPaths, writeErr } from "@wrongstack/core/utils";
8
- import { ERROR_CODES, FsError } from "@wrongstack/core/types";
9
7
  import { isSecretField } from "@wrongstack/core/security";
10
- import { toErrorMessage } from "@wrongstack/core/utils";
8
+ import { ERROR_CODES, FsError } from "@wrongstack/core/types";
9
+ import { atomicWrite, resolveWstackPaths, toErrorMessage, writeErr } from "@wrongstack/core/utils";
11
10
  var defaultUidFn = () => os.userInfo().uid;
12
11
  async function getFileUid(filePath) {
13
12
  try {
@@ -141,7 +140,11 @@ function historyDir(homeFn = defaultHomeDir, targetConfigPath) {
141
140
  return path.join(path.dirname(configPath(homeFn, targetConfigPath)), "config.history", "entries");
142
141
  }
143
142
  function historyIndexPath(homeFn = defaultHomeDir, targetConfigPath) {
144
- return path.join(path.dirname(configPath(homeFn, targetConfigPath)), "config.history", "index.json");
143
+ return path.join(
144
+ path.dirname(configPath(homeFn, targetConfigPath)),
145
+ "config.history",
146
+ "index.json"
147
+ );
145
148
  }
146
149
  function configPath(homeFn = defaultHomeDir, targetConfigPath) {
147
150
  return targetConfigPath ?? activeProfileConfigPath(homeFn);
@@ -221,9 +224,7 @@ async function backupCurrent(homeFn = defaultHomeDir, targetConfigPath) {
221
224
  try {
222
225
  await atomicWrite(last, content, { mode: 384 });
223
226
  } catch (err) {
224
- writeErr(
225
- `[config-history] .last backup failed: ${toErrorMessage(err)}`
226
- );
227
+ writeErr(`[config-history] .last backup failed: ${toErrorMessage(err)}`);
227
228
  }
228
229
  }
229
230
  if (content !== void 0) {
@@ -231,9 +232,7 @@ async function backupCurrent(homeFn = defaultHomeDir, targetConfigPath) {
231
232
  const bakPath = `${cfg}.${ts}.bak`;
232
233
  await atomicWrite(bakPath, content, { mode: 384 });
233
234
  } catch (err) {
234
- writeErr(
235
- `[config-history] timestamped backup failed: ${toErrorMessage(err)}`
236
- );
235
+ writeErr(`[config-history] timestamped backup failed: ${toErrorMessage(err)}`);
237
236
  }
238
237
  }
239
238
  try {
@@ -244,9 +243,7 @@ async function backupCurrent(homeFn = defaultHomeDir, targetConfigPath) {
244
243
  await safeDelete(path.join(dir, f));
245
244
  }
246
245
  } catch (err) {
247
- writeErr(
248
- `[config-history] backup prune failed: ${toErrorMessage(err)}`
249
- );
246
+ writeErr(`[config-history] backup prune failed: ${toErrorMessage(err)}`);
250
247
  }
251
248
  }
252
249
  async function appendHistory(oldCfg, newCfg, description, homeFn = defaultHomeDir, targetConfigPath) {
@@ -366,4 +363,4 @@ export {
366
363
  restoreFromHistory,
367
364
  restoreLast
368
365
  };
369
- //# sourceMappingURL=chunk-263G3FMB.js.map
366
+ //# sourceMappingURL=chunk-B4JLSXZB.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-U3SS4NRH.js";
4
4
  import {
5
5
  checkForUpdate
6
- } from "./chunk-F4PEGAJZ.js";
6
+ } from "./chunk-NUIHRGPY.js";
7
7
 
8
8
  // src/subcommands/handlers/update.ts
9
9
  import { spawn } from "node:child_process";
@@ -197,7 +197,12 @@ function parseUpdateArgs(args) {
197
197
  if (pmEq) {
198
198
  const pm = parsePackageManager(pmEq);
199
199
  if (!pm)
200
- return { checkOnly, packageManager, allowScripts, error: `Invalid package manager: ${pmEq}` };
200
+ return {
201
+ checkOnly,
202
+ packageManager,
203
+ allowScripts,
204
+ error: `Invalid package manager: ${pmEq}`
205
+ };
201
206
  packageManager = pm;
202
207
  continue;
203
208
  }
@@ -303,4 +308,4 @@ export {
303
308
  detectUpdatePackageManager,
304
309
  detectUpdatePackageName
305
310
  };
306
- //# sourceMappingURL=chunk-I5MEUFDI.js.map
311
+ //# sourceMappingURL=chunk-BXQG3H2Y.js.map
@@ -2,11 +2,11 @@ import {
2
2
  hasApiKey,
3
3
  isKeylessLocalProvider,
4
4
  visibleModelIds
5
- } from "./chunk-ETOEGL3V.js";
5
+ } from "./chunk-3IC4IEZC.js";
6
6
  import {
7
7
  appendHistory,
8
8
  backupCurrent
9
- } from "./chunk-263G3FMB.js";
9
+ } from "./chunk-B4JLSXZB.js";
10
10
 
11
11
  // src/arg-parser.ts
12
12
  var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
@@ -33,6 +33,7 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
33
33
  "prompt",
34
34
  "metrics",
35
35
  "webui",
36
+ "webui-session-child",
36
37
  "simpleui",
37
38
  "full-auto",
38
39
  "desktop",
@@ -137,6 +138,7 @@ function parseArgs(argv) {
137
138
  }
138
139
  function normalizeSurfaceAliases(flags, positional) {
139
140
  if (flags["simpleui"]) flags["webui"] = true;
141
+ if (flags["webui-session-child"]) flags["webui"] = true;
140
142
  const first = positional[0];
141
143
  if (first === "simpleui") {
142
144
  flags["simpleui"] = true;
@@ -228,8 +230,15 @@ var LOCAL_LLM_PRESETS = projectLocalProviderPresets();
228
230
 
229
231
  // src/picker.ts
230
232
  import os from "node:os";
231
- import { color as color3, expectDefined as expectDefined2, setOutputLineGuard as setOutputLineGuard2, setRawMode as setRawMode2, stripAnsi as stripAnsi2, writeOut as writeOut2 } from "@wrongstack/core/utils";
232
- import { toErrorMessage } from "@wrongstack/core/utils";
233
+ import {
234
+ color as color3,
235
+ expectDefined as expectDefined2,
236
+ setOutputLineGuard as setOutputLineGuard2,
237
+ setRawMode as setRawMode2,
238
+ stripAnsi as stripAnsi2,
239
+ toErrorMessage,
240
+ writeOut as writeOut2
241
+ } from "@wrongstack/core/utils";
233
242
 
234
243
  // src/picker-key-state.ts
235
244
  function applyPickerKey(state, chunk, matchCount) {
@@ -265,7 +274,13 @@ function applyPickerKey(state, chunk, matchCount) {
265
274
  }
266
275
 
267
276
  // src/picker-model-picker.ts
268
- import { color as color2, expectDefined, setOutputLineGuard, setRawMode, writeOut } from "@wrongstack/core/utils";
277
+ import {
278
+ color as color2,
279
+ expectDefined,
280
+ setOutputLineGuard,
281
+ setRawMode,
282
+ writeOut
283
+ } from "@wrongstack/core/utils";
269
284
 
270
285
  // src/picker-ui.ts
271
286
  import { color, stripAnsi } from "@wrongstack/core/utils";
@@ -1037,4 +1052,4 @@ export {
1037
1052
  runLiveProviderPicker,
1038
1053
  runPicker
1039
1054
  };
1040
- //# sourceMappingURL=chunk-MHF2IJDE.js.map
1055
+ //# sourceMappingURL=chunk-C5NXM2SI.js.map
@@ -435,4 +435,4 @@ export {
435
435
  getTaskGraphId,
436
436
  getTaskTrackerExport
437
437
  };
438
- //# sourceMappingURL=chunk-XTIXVJXP.js.map
438
+ //# sourceMappingURL=chunk-DGXNL7OT.js.map