@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
@@ -6,7 +6,7 @@ import {
6
6
  listHistory,
7
7
  restoreFromHistory,
8
8
  restoreLast
9
- } from "./chunk-263G3FMB.js";
9
+ } from "./chunk-B4JLSXZB.js";
10
10
  import {
11
11
  activeProfileConfigPath
12
12
  } from "./chunk-YMXXOOFN.js";
@@ -50,35 +50,37 @@ async function listFleetRuns(deps) {
50
50
  }
51
51
  const runs = [];
52
52
  const perEntry = await Promise.all(
53
- entries.map(async (id) => {
54
- const runDir = path.join(deps.paths.projectSessions, id);
55
- try {
56
- const stat2 = await fsp.stat(runDir);
57
- if (!stat2.isDirectory()) return null;
58
- } catch {
59
- return null;
53
+ entries.map(
54
+ async (id) => {
55
+ const runDir = path.join(deps.paths.projectSessions, id);
56
+ try {
57
+ const stat2 = await fsp.stat(runDir);
58
+ if (!stat2.isDirectory()) return null;
59
+ } catch {
60
+ return null;
61
+ }
62
+ const [manifestResult, checkpointResult, subagentFilesResult] = await Promise.all([
63
+ fsp.access(path.join(runDir, "fleet.json")).then(
64
+ () => true,
65
+ () => false
66
+ ),
67
+ fsp.access(path.join(runDir, "checkpoint.json")).then(
68
+ () => true,
69
+ () => false
70
+ ),
71
+ fsp.readdir(path.join(runDir, "subagents")).then(
72
+ (files) => files.filter((f) => f.endsWith(".jsonl")).length,
73
+ () => 0
74
+ )
75
+ ]);
76
+ return {
77
+ id,
78
+ manifest: manifestResult,
79
+ checkpoint: checkpointResult,
80
+ subagents: subagentFilesResult
81
+ };
60
82
  }
61
- const [manifestResult, checkpointResult, subagentFilesResult] = await Promise.all([
62
- fsp.access(path.join(runDir, "fleet.json")).then(
63
- () => true,
64
- () => false
65
- ),
66
- fsp.access(path.join(runDir, "checkpoint.json")).then(
67
- () => true,
68
- () => false
69
- ),
70
- fsp.readdir(path.join(runDir, "subagents")).then(
71
- (files) => files.filter((f) => f.endsWith(".jsonl")).length,
72
- () => 0
73
- )
74
- ]);
75
- return {
76
- id,
77
- manifest: manifestResult,
78
- checkpoint: checkpointResult,
79
- subagents: subagentFilesResult
80
- };
81
- })
83
+ )
82
84
  );
83
85
  for (const r of perEntry) if (r) runs.push(r);
84
86
  if (runs.length === 0) {
@@ -288,8 +290,10 @@ var sessionsCmd = async (args, deps) => {
288
290
  );
289
291
  return 0;
290
292
  } catch (err) {
291
- deps.renderer.writeError(`Fork failed: ${err instanceof Error ? err.message : String(err)}
292
- `);
293
+ deps.renderer.writeError(
294
+ `Fork failed: ${err instanceof Error ? err.message : String(err)}
295
+ `
296
+ );
293
297
  return 1;
294
298
  }
295
299
  }
@@ -411,4 +415,4 @@ export {
411
415
  configCmd,
412
416
  sessionsCmd
413
417
  };
414
- //# sourceMappingURL=sessions-config-XXN7267N.js.map
418
+ //# sourceMappingURL=sessions-config-YX2ZPAFM.js.map
@@ -51,7 +51,14 @@ async function ensureSimpleUiDistDir(deps = {}) {
51
51
  return path.resolve(pkgDir, "..", "..");
52
52
  });
53
53
  const workspaceRoot = findRoot(packageDir);
54
- console.warn(JSON.stringify({ level: "warn", event: "simpleui.auto_build", message: "Frontend not built \u2014 building now", timestamp: (/* @__PURE__ */ new Date()).toISOString() }));
54
+ console.warn(
55
+ JSON.stringify({
56
+ level: "warn",
57
+ event: "simpleui.auto_build",
58
+ message: "Frontend not built \u2014 building now",
59
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
60
+ })
61
+ );
55
62
  const runBuild = deps.runBuild ?? ((cwd) => runPnpmBuild(cwd, "@wrongstack/simpleui", 12e4));
56
63
  try {
57
64
  await runBuild(workspaceRoot);
@@ -90,4 +97,4 @@ export {
90
97
  ensureSimpleUiDistDir,
91
98
  resolveSimpleUiDistDir
92
99
  };
93
- //# sourceMappingURL=simpleui-dist-JIFGUJO7.js.map
100
+ //# sourceMappingURL=simpleui-dist-33VO3QHF.js.map
@@ -1,3 +1,17 @@
1
+ /**
2
+ * `/agents` — agent monitoring and timeline streaming commands.
3
+ *
4
+ * Commands:
5
+ * /agents — Show legacy subagent status
6
+ * /agents help — Show detailed help
7
+ * /agents chat off|full — Fleet-chat verbosity for the main chat
8
+ * /agents chat status — Show current fleet-chat verbosity
9
+ * /agents stream on — Show agent conversations in the main chat timeline
10
+ * /agents stream off — Hide agent conversations from the main chat
11
+ * /agents stream status — Show current stream state
12
+ * /agents list — List all active subagents
13
+ * /agents show <id> — Show transcript for a specific agent
14
+ */
1
15
  import type { SlashCommand } from '@wrongstack/core/types';
2
16
  import type { SlashCommandContext } from './command-context.js';
3
17
  export declare function buildAgentsCommand(opts: SlashCommandContext): SlashCommand;
@@ -1,9 +1,8 @@
1
- import type { CompactReport, HealthRegistry, MemoryPort, MetricsRuntimeStatus, MetricsSink, ModeStore, Renderer, SkillLoader, TokenCounter } from '@wrongstack/core/types';
2
- import type { WstackPaths } from '@wrongstack/core/utils';
3
1
  import type { Context } from '@wrongstack/core/agent';
4
2
  import type { EventBus } from '@wrongstack/core/kernel';
5
- import type { SessionStore } from '@wrongstack/core/types';
6
3
  import type { SlashCommandRegistry, ToolRegistry } from '@wrongstack/core/registry';
4
+ import type { CompactReport, HealthRegistry, MemoryPort, MetricsRuntimeStatus, MetricsSink, ModeStore, Renderer, SessionStore, SkillLoader, TokenCounter } from '@wrongstack/core/types';
5
+ import type { WstackPaths } from '@wrongstack/core/utils';
7
6
  /** Host capabilities supplied to command adapters. */
8
7
  export interface SlashCommandContext {
9
8
  registry: SlashCommandRegistry;
@@ -1,6 +1,6 @@
1
1
  import type { Context } from '@wrongstack/core/agent';
2
- export { detectProjectFacts, renderAgentsTemplate } from '../services/project-facts.js';
3
2
  export type { ProjectFacts } from '../services/project-facts.js';
3
+ export { detectProjectFacts, renderAgentsTemplate } from '../services/project-facts.js';
4
4
  /**
5
5
  * Parse a slash command's args string into subcommand + rest tokens.
6
6
  *
@@ -1,7 +1,7 @@
1
1
  import type { SlashCommand } from '@wrongstack/core/types';
2
2
  import type { SlashCommandContext } from './command-context.js';
3
- export type { TokenCounter } from '@wrongstack/core/types';
4
3
  export type { ToolRegistry } from '@wrongstack/core/registry';
4
+ export type { TokenCounter } from '@wrongstack/core/types';
5
5
  export type { SlashCommandContext } from './command-context.js';
6
6
  export type { ProjectFacts } from './helpers.js';
7
7
  export { detectProjectFacts, renderAgentsTemplate } from './helpers.js';
@@ -1,3 +1,13 @@
1
+ /**
2
+ * `/intake [text]` — create and submit a requirement intake record from the
3
+ * current prompt.
4
+ *
5
+ * With no arguments it uses the most recent user prompt in the live session;
6
+ * with text it uses that verbatim. The exact text becomes the record's
7
+ * immutable `originalRequest`. Records are stored under the project's
8
+ * `.wrongstack` state dir (`~/.wrongstack/projects/<slug>/requirement-intakes`)
9
+ * and are ready for downstream modules (SDD interview kickoff, planning).
10
+ */
1
11
  import type { SlashCommand } from '@wrongstack/core/types';
2
12
  import type { SlashCommandContext } from './command-context.js';
3
13
  export declare function buildIntakeCommand(opts: SlashCommandContext): SlashCommand;
@@ -19,7 +19,7 @@
19
19
  * `/memory compact`. Falls back to a no-op LLM if the provider is absent
20
20
  * (Phase 3 and 4 will degrade to skip-only; report is still useful).
21
21
  */
22
- import type { SageSurface, CreateCandidateInput } from '@wrongstack/sage';
22
+ import type { CreateCandidateInput, SageSurface } from '@wrongstack/sage';
23
23
  import { type TriageReport } from '@wrongstack/sage';
24
24
  import type { SlashCommandContext } from './command-context.js';
25
25
  export declare function runTriageCommand(opts: SlashCommandContext, args: string[]): Promise<{
@@ -17,7 +17,7 @@
17
17
  * /provider-status clear <provider> <model> Reset one pair
18
18
  * /provider-status retry <provider> <model> Release one pair for a half-open probe
19
19
  */
20
- import type { SlashCommand } from '@wrongstack/core/types';
21
20
  import type { ProviderModelStatusTracker } from '@wrongstack/core/coordination';
21
+ import type { SlashCommand } from '@wrongstack/core/types';
22
22
  export declare function buildProviderStatusCommand(tracker: ProviderModelStatusTracker): SlashCommand;
23
23
  //# sourceMappingURL=provider-status.d.ts.map
@@ -1,3 +1,23 @@
1
+ /**
2
+ * `wstack hq` subcommand group — HQ command center lifecycle + browser
3
+ * token management.
4
+ *
5
+ * Subcommand tree:
6
+ * wstack hq → start HQ server (alias for `wstack --hq`)
7
+ * wstack hq serve → start HQ server (explicit form)
8
+ * wstack hq token create [label] [--ttl <duration>] → mint a browser token, write auth.json
9
+ * wstack hq token create --client [label] [--ttl <duration>] → mint a client token (/ws/client)
10
+ * wstack hq token list → list issued browser tokens
11
+ * wstack hq token list --client → list issued client tokens
12
+ * wstack hq token revoke <id> → revoke a browser token (prefix match)
13
+ * wstack hq token revoke --client <id> → revoke a client token
14
+ *
15
+ * All subcommands accept `--data-dir <path>` to override the HQ data
16
+ * directory (default `~/.wrongstack/hq`, honors `WRONGSTACK_HOME` /
17
+ * `WRONGSTACK_HQ_DATA_DIR`).
18
+ *
19
+ * @module subcommands/handlers/hq
20
+ */
1
21
  import type { SubcommandHandler } from '../index.js';
2
22
  export { resolveAuditActor } from '../../hq-server/audit-actor.js';
3
23
  export declare const hqCmd: SubcommandHandler;
@@ -1,3 +1,3 @@
1
- export { helpTable } from './per-subcommand-help-table.js';
2
1
  export { deepHelpTable } from './per-subcommand-deep-help-table.js';
2
+ export { helpTable } from './per-subcommand-help-table.js';
3
3
  //# sourceMappingURL=per-subcommand-help-data.d.ts.map
@@ -3,9 +3,9 @@ import {
3
3
  detectUpdatePackageName,
4
4
  runUpdateCommand,
5
5
  updateCmd
6
- } from "./chunk-I5MEUFDI.js";
6
+ } from "./chunk-BXQG3H2Y.js";
7
7
  import "./chunk-U3SS4NRH.js";
8
- import "./chunk-F4PEGAJZ.js";
8
+ import "./chunk-NUIHRGPY.js";
9
9
  import "./chunk-7OCVIDC7.js";
10
10
  export {
11
11
  detectUpdatePackageManager,
@@ -13,4 +13,4 @@ export {
13
13
  runUpdateCommand,
14
14
  updateCmd
15
15
  };
16
- //# sourceMappingURL=update-MV6TUACD.js.map
16
+ //# sourceMappingURL=update-LTDJGAFU.js.map
@@ -5,7 +5,7 @@ import {
5
5
  fetchLatestFromNpm,
6
6
  getUpdateNotification,
7
7
  isNewer
8
- } from "./chunk-F4PEGAJZ.js";
8
+ } from "./chunk-NUIHRGPY.js";
9
9
  import "./chunk-7OCVIDC7.js";
10
10
  export {
11
11
  cachePath,
@@ -15,4 +15,4 @@ export {
15
15
  getUpdateNotification,
16
16
  isNewer
17
17
  };
18
- //# sourceMappingURL=update-check-UMYTOH7Z.js.map
18
+ //# sourceMappingURL=update-check-WARHSVZA.js.map
@@ -27,7 +27,7 @@ export interface ConnectionHandlerDeps {
27
27
  sessionId: string;
28
28
  };
29
29
  handleMessage: (ws: WebSocket, client: ConnectedClient, msg: WSClientMessage) => Promise<void>;
30
- abortControllers: Map<WebSocket, AbortController>;
30
+ abortControllers: Map<string, AbortController>;
31
31
  pendingConfirms: Map<string, PendingConfirm>;
32
32
  buildSessionStartPayload: (overrides?: Record<string, unknown>, needsSetup?: boolean) => Promise<Record<string, unknown>>;
33
33
  loadReplay?: (() => Promise<{
@@ -1,2 +1,2 @@
1
- export { estimateContextBreakdown, type ContextBreakdown } from '@wrongstack/webui-server';
1
+ export { type ContextBreakdown, estimateContextBreakdown } from '@wrongstack/webui-server';
2
2
  //# sourceMappingURL=context-breakdown.d.ts.map
@@ -1,2 +1,2 @@
1
- export { computeUsageCost, getCostRates, type CostRates, type TokenUsage, } from '@wrongstack/webui-server';
1
+ export { type CostRates, computeUsageCost, getCostRates, type TokenUsage, } from '@wrongstack/webui-server';
2
2
  //# sourceMappingURL=cost-helpers.d.ts.map
@@ -1,3 +1,3 @@
1
- export { announceWebuiReady, createWebuiShutdown, registerWebuiInstance, registerWebuiSignalHandlers, type AnnounceWebuiReadyParams, type RegisterWebuiInstanceDeps, type RegisterWebuiInstanceParams, type WebuiShutdownResources, } from '@wrongstack/webui-server';
2
1
  export type { WebUIInstanceRecord } from '@wrongstack/webui-server';
2
+ export { type AnnounceWebuiReadyParams, announceWebuiReady, createWebuiShutdown, type RegisterWebuiInstanceDeps, type RegisterWebuiInstanceParams, registerWebuiInstance, registerWebuiSignalHandlers, type WebuiShutdownResources, } from '@wrongstack/webui-server';
3
3
  //# sourceMappingURL=lifecycle.d.ts.map
@@ -1,5 +1,5 @@
1
- import type { Config } from '@wrongstack/core/types';
2
1
  import type { ModelBlackoutRule } from '@wrongstack/core/models';
2
+ import type { Config } from '@wrongstack/core/types';
3
3
  import { PREF_KEYS } from '@wrongstack/webui-server';
4
4
  interface CliWebUIOptions {
5
5
  agent: {
@@ -1,6 +1,6 @@
1
1
  import type { Context } from '@wrongstack/core/agent';
2
- import type { EventBus } from '@wrongstack/core/kernel';
3
2
  import type { JournalEntry } from '@wrongstack/core/goal';
3
+ import type { EventBus } from '@wrongstack/core/kernel';
4
4
  import type { SecretScrubber } from '@wrongstack/core/types';
5
5
  import { createEternalSubscription, type PendingConfirm } from '@wrongstack/webui-server';
6
6
  import type { StreamCoalescer } from './stream-coalescer.js';
@@ -1,2 +1,2 @@
1
- export { ensureDistDir, resolveDistDir, startStaticServe, type EnsureDistDeps, type ResolveDistOptions, type StaticServeDeps, type StaticServeHandle, type StaticServeOptions, } from '@wrongstack/webui-server';
1
+ export { type EnsureDistDeps, ensureDistDir, type ResolveDistOptions, resolveDistDir, type StaticServeDeps, type StaticServeHandle, type StaticServeOptions, startStaticServe, } from '@wrongstack/webui-server';
2
2
  //# sourceMappingURL=static-serve.d.ts.map
@@ -3,14 +3,17 @@ import {
3
3
  } from "./chunk-VCYZ3WZV.js";
4
4
  import {
5
5
  createHqCommandDispatcher
6
- } from "./chunk-OP47B3IX.js";
6
+ } from "./chunk-7YLN7YUA.js";
7
7
  import {
8
8
  startCliHqConnection
9
9
  } from "./chunk-JW75HY4F.js";
10
+ import {
11
+ WEBUI_SESSION_CHILD_CAPABILITIES
12
+ } from "./chunk-3JPTNADJ.js";
10
13
  import {
11
14
  loadConfigProviders,
12
15
  mutateConfigProviders
13
- } from "./chunk-PJHET45A.js";
16
+ } from "./chunk-SZ42FYPT.js";
14
17
  import "./chunk-7OCVIDC7.js";
15
18
 
16
19
  // src/webui-server.ts
@@ -41,8 +44,8 @@ import {
41
44
  resolveAuthToken,
42
45
  SddBoardWebSocketHandler,
43
46
  SddWizardWebSocketHandler,
44
- sendSerialized,
45
47
  SpecsWebSocketHandler,
48
+ sendSerialized,
46
49
  TerminalWebSocketHandler,
47
50
  WorktreeWebSocketHandler
48
51
  } from "@wrongstack/webui-server";
@@ -152,7 +155,9 @@ function createConnectionHandler(deps) {
152
155
  send: deps.send,
153
156
  sessionPayload: deps.sessionPayload,
154
157
  rateLimitMax: deps.rateLimitMax,
155
- onClose: (ws) => deps.abortControllers.delete(ws),
158
+ onClose: (_ws, client) => {
159
+ if (client?.sessionId) deps.abortControllers.delete(client.sessionId);
160
+ },
156
161
  buildInitialPayload: async () => {
157
162
  const payload = { ...await deps.buildSessionStartPayload({}, deps.needsSetup) };
158
163
  try {
@@ -460,7 +465,11 @@ function createNodePtyLoader(importMetaUrl, logger) {
460
465
  logger.debug?.(`[terminal] direct require failed: ${err.message}`);
461
466
  }
462
467
  try {
463
- const cliPkgJson = path.join(path.dirname(fileURLToPath(importMetaUrl)), "..", "package.json");
468
+ const cliPkgJson = path.join(
469
+ path.dirname(fileURLToPath(importMetaUrl)),
470
+ "..",
471
+ "package.json"
472
+ );
464
473
  let dir = path.dirname(cliPkgJson);
465
474
  for (let i = 0; i < 6; i++) {
466
475
  const candidate = path.join(dir, "node_modules", "node-pty");
@@ -479,7 +488,9 @@ function createNodePtyLoader(importMetaUrl, logger) {
479
488
  logger.debug?.(`[terminal] workspace-root walk failed: ${err.message}`);
480
489
  }
481
490
  cachedNodePty = null;
482
- logger.debug?.('[terminal] node-pty resolution failed; terminal panel will report "unavailable"');
491
+ logger.debug?.(
492
+ '[terminal] node-pty resolution failed; terminal panel will report "unavailable"'
493
+ );
483
494
  return cachedNodePty;
484
495
  };
485
496
  }
@@ -491,8 +502,8 @@ import { DefaultSecretVault } from "@wrongstack/core/security";
491
502
  import {
492
503
  PREF_KEYS,
493
504
  persistPrefsToConfig,
494
- prefSnapshot as snapshotPrefs,
495
- seedContextMeta
505
+ seedContextMeta,
506
+ prefSnapshot as snapshotPrefs
496
507
  } from "@wrongstack/webui-server";
497
508
  async function seedConfigToMeta(opts) {
498
509
  let config = opts.appConfig;
@@ -872,7 +883,7 @@ async function runWebUI(opts) {
872
883
  const surface = opts.surface ?? "webui";
873
884
  const surfaceDefaults = surface === "simpleui" ? { http: 3466 } : { http: 3456 };
874
885
  const requestedHttpPort = opts.httpPort ?? opts.port ?? surfaceDefaults.http;
875
- const strictPort = process.env["WEBUI_STRICT_PORT"] === "1" || process.env["WEBUI_STRICT_PORT"] === "true";
886
+ const strictPort = opts.strictPort ?? (process.env["WEBUI_STRICT_PORT"] === "1" || process.env["WEBUI_STRICT_PORT"] === "true");
876
887
  let httpPort = requestedHttpPort;
877
888
  if (!strictPort) {
878
889
  httpPort = await findFreePort(host, requestedHttpPort);
@@ -1089,24 +1100,47 @@ async function runWebUI(opts) {
1089
1100
  `[WebUI] Frontend not served (run \`pnpm --filter @wrongstack/webui build\`). WS bridge still active on ws://${host}:${httpPort}.`
1090
1101
  );
1091
1102
  }
1103
+ const currentSessionId = () => opts.agent.ctx.session?.id ?? opts.session.id;
1092
1104
  const registryBaseDir = globalRoot;
1105
+ let webuiInstanceRegistered = false;
1093
1106
  if (opts.projectRoot) {
1094
- registerWebuiInstance({
1095
- pid: process.pid,
1096
- surface,
1097
- host,
1098
- httpPort,
1099
- publicUrl,
1100
- projectRoot: opts.projectRoot,
1101
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
1102
- registryBaseDir,
1103
- // Lets a same-project TUI/REPL authenticate `POST /api/fleet/ping` now
1104
- // that the API requires a token on every bind (H3).
1105
- authToken: wsToken
1106
- });
1107
+ const registration = Promise.resolve(
1108
+ registerWebuiInstance({
1109
+ pid: process.pid,
1110
+ surface,
1111
+ host,
1112
+ httpPort,
1113
+ publicUrl,
1114
+ projectRoot: opts.projectRoot,
1115
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
1116
+ registryBaseDir,
1117
+ // Lets a same-project TUI/REPL authenticate `POST /api/fleet/ping` now
1118
+ // that the API requires a token on every bind (H3).
1119
+ authToken: wsToken,
1120
+ ...opts.webuiSessionChild ? {
1121
+ role: "session-child",
1122
+ sessionId: currentSessionId(),
1123
+ parentPid: opts.webuiSessionChild.parentPid,
1124
+ parentShellId: opts.webuiSessionChild.parentShellId,
1125
+ runtimeId: opts.webuiSessionChild.runtimeId,
1126
+ attachable: opts.webuiSessionChild.attachable,
1127
+ lastReadyAt: (/* @__PURE__ */ new Date()).toISOString(),
1128
+ protocolVersion: opts.webuiSessionChild.protocolVersion,
1129
+ capabilities: [...WEBUI_SESSION_CHILD_CAPABILITIES]
1130
+ } : {}
1131
+ })
1132
+ ).then(
1133
+ (value) => value !== false,
1134
+ () => false
1135
+ );
1136
+ if (opts.webuiSessionChild) {
1137
+ webuiInstanceRegistered = await registration;
1138
+ } else {
1139
+ void registration;
1140
+ webuiInstanceRegistered = true;
1141
+ }
1107
1142
  }
1108
1143
  const eventUnsubscribers = [];
1109
- const currentSessionId = () => opts.agent.ctx.session?.id ?? opts.session.id;
1110
1144
  const sessionPayload = (payload) => {
1111
1145
  const provided = payload["sessionId"];
1112
1146
  const sessionId = typeof provided === "string" && provided.length > 0 ? provided : currentSessionId();
@@ -1406,7 +1440,14 @@ async function runWebUI(opts) {
1406
1440
  console.log(`[WebUI] WebSocket server running on ws://${host}:${httpPort}`);
1407
1441
  try {
1408
1442
  setupEvents();
1409
- opts.onListening?.({ httpPort, wsPort, host, url: accessUrl });
1443
+ opts.onListening?.({
1444
+ httpPort,
1445
+ wsPort,
1446
+ host,
1447
+ url: accessUrl,
1448
+ authToken: wsToken,
1449
+ webuiInstanceRegistered
1450
+ });
1410
1451
  } catch (err) {
1411
1452
  consoleLogger.error("setup_events_failed", { message: toErrorMessage(err) });
1412
1453
  }
@@ -1550,4 +1591,4 @@ async function runWebUI(opts) {
1550
1591
  export {
1551
1592
  runWebUI
1552
1593
  };
1553
- //# sourceMappingURL=webui-server-DD35QFNO.js.map
1594
+ //# sourceMappingURL=webui-server-E3OPEKU5.js.map
@@ -5,6 +5,7 @@ import type { EventBus } from '@wrongstack/core/kernel';
5
5
  import type { TrustBoundary } from '@wrongstack/core/security';
6
6
  import type { MemoryPort, ModelsRegistry, ModeStore, PromptLoader, SessionStore, SessionWriter, SkillLoader } from '@wrongstack/core/types';
7
7
  import type { MCPRegistry } from '@wrongstack/mcp';
8
+ import type { WebuiSessionChildOptions } from './boot/webui-session-child.js';
8
9
  /**
9
10
  * CLI-shaped webui options. Distinct from the standalone
10
11
  * `WebUIOptions` exported by `@wrongstack/webui-server` (which is the
@@ -36,6 +37,10 @@ export interface CliWebUIOptions {
36
37
  surface?: 'webui' | 'simpleui' | undefined;
37
38
  /** Fixed access token/password. Defaults to WEBUI_TOKEN or random per process. */
38
39
  accessToken?: string | undefined;
40
+ /** Fail instead of auto-advancing when the requested HTTP/WS port is busy. */
41
+ strictPort?: boolean | undefined;
42
+ /** Internal one-session child launch metadata for the multi-session parent shell. */
43
+ webuiSessionChild?: WebuiSessionChildOptions | undefined;
39
44
  /**
40
45
  * Live fleet concurrency + lifetime spawn budget for WebUI (issue #323).
41
46
  * Merged into `fleet.concurrency_update` broadcasts.
@@ -81,6 +86,8 @@ export interface CliWebUIOptions {
81
86
  wsPort: number;
82
87
  host: string;
83
88
  url: string;
89
+ authToken: string;
90
+ webuiInstanceRegistered: boolean;
84
91
  }) => void;
85
92
  modelsRegistry?: ModelsRegistry | undefined;
86
93
  globalConfigPath?: string | undefined;
@@ -1,12 +1,12 @@
1
1
  /** Mutable command-host state created after the runtime fleet is available. */
2
- import { type Config, type SessionWriter } from '@wrongstack/core/types';
3
2
  import type { BrainArbiter, Director } from '@wrongstack/core/coordination';
4
3
  import type { EventBus } from '@wrongstack/core/kernel';
4
+ import { type Config, type SessionWriter } from '@wrongstack/core/types';
5
5
  import type { WstackPaths } from '@wrongstack/core/utils';
6
6
  import { SddRunRegistry } from '@wrongstack/sdd';
7
7
  import type { HqCommandController } from '../hq-command-controller.js';
8
- import type { MultiAgentHost } from '../multi-agent.js';
9
8
  import type { ReadlineInputReader } from '../input-reader.js';
9
+ import type { MultiAgentHost } from '../multi-agent.js';
10
10
  import type { TerminalRenderer } from '../renderer.js';
11
11
  export interface CommandHostStateInput {
12
12
  getConfig: () => Config;
@@ -7,8 +7,7 @@
7
7
  * Step 2 of the cli-main/ExecutionDeps refactor plan:
8
8
  * docs/plans/cli-main-executiondeps-refactor.md
9
9
  */
10
- import type { Config } from '@wrongstack/core/types';
11
- import type { FleetChatVerbosity } from '@wrongstack/core/types';
10
+ import type { Config, FleetChatVerbosity } from '@wrongstack/core/types';
12
11
  import type { StatuslineConfigKey } from '../services/statusline-config.js';
13
12
  import { type StatuslineConfig } from '../services/statusline-config.js';
14
13
  export interface FleetStreamController {
@@ -1,5 +1,5 @@
1
- import type { EventBus } from '@wrongstack/core/kernel';
2
1
  import type { DefaultLogger } from '@wrongstack/core/infrastructure';
2
+ import type { EventBus } from '@wrongstack/core/kernel';
3
3
  import type { MultiAgentHost } from '../multi-agent.js';
4
4
  export interface SetupDepWatcherConsumersDeps {
5
5
  dwCfg: Record<string, unknown> | undefined;
@@ -1,8 +1,8 @@
1
- import type { AutonomyStage, Config, SessionWriter } from '@wrongstack/core/types';
2
1
  import type { Director } from '@wrongstack/core/coordination';
3
- import type { EventBus } from '@wrongstack/core/kernel';
4
- import type { EternalAutonomyEngine, ParallelEternalEngine } from '@wrongstack/core/execution';
5
2
  import { type AgentMonitorService } from '@wrongstack/core/coordination';
3
+ import type { EternalAutonomyEngine, ParallelEternalEngine } from '@wrongstack/core/execution';
4
+ import type { EventBus } from '@wrongstack/core/kernel';
5
+ import type { AutonomyStage, Config, SessionWriter } from '@wrongstack/core/types';
6
6
  import type { WstackPaths } from '@wrongstack/core/utils';
7
7
  /**
8
8
  * Persistent ref for autonomy mode — set once here, read elsewhere via
@@ -1,10 +1,10 @@
1
1
  /** Eternal/autonomy slash-command adapters. */
2
2
  import type { Agent } from '@wrongstack/core/agent';
3
- import type { AutonomyStage, Compactor, Config } from '@wrongstack/core/types';
4
3
  import type { BrainArbiter } from '@wrongstack/core/coordination';
5
4
  import { EternalAutonomyEngine, ParallelEternalEngine } from '@wrongstack/core/execution';
6
- import type { EventBus } from '@wrongstack/core/kernel';
7
5
  import type { JournalEntry } from '@wrongstack/core/goal';
6
+ import type { EventBus } from '@wrongstack/core/kernel';
7
+ import type { AutonomyStage, Compactor, Config } from '@wrongstack/core/types';
8
8
  import type { MultiAgentHost } from '../multi-agent.js';
9
9
  import type { AutonomyMode } from '../services/autonomy-mode.js';
10
10
  import type { BuiltinSlashCommandDeps } from './slash-commands.js';
@@ -1,6 +1,6 @@
1
- import type { Config } from '@wrongstack/core/types';
2
- import { type PluginManagerHookRunner } from '@wrongstack/core/tools';
3
1
  import type { ToolRegistry } from '@wrongstack/core/registry';
2
+ import { type PluginManagerHookRunner } from '@wrongstack/core/tools';
3
+ import type { Config } from '@wrongstack/core/types';
4
4
  type ConfigStoreLike = {
5
5
  get(): Config;
6
6
  update(patch: Partial<Config>): void;
@@ -1,5 +1,5 @@
1
- import type { Config, Provider, ProviderConfig } from '@wrongstack/core/types';
2
1
  import type { ProviderRegistry } from '@wrongstack/core/registry';
2
+ import type { Config, Provider, ProviderConfig } from '@wrongstack/core/types';
3
3
  /**
4
4
  * Resolve the user-visible providerId into a runtime cfg + a factory type
5
5
  * for catalog lookups. Single source of truth for how a saved-config
@@ -1,6 +1,6 @@
1
- import type { EventBus } from '@wrongstack/core/kernel';
2
1
  import type { FallbackProfileManager } from '@wrongstack/core/agent';
3
2
  import { ProviderModelStatusTracker } from '@wrongstack/core/coordination';
3
+ import type { EventBus } from '@wrongstack/core/kernel';
4
4
  import type { WstackPaths } from '@wrongstack/core/utils';
5
5
  export interface ProviderStatusInput {
6
6
  events: EventBus;
@@ -1,10 +1,10 @@
1
1
  /** Registers provider-neutral one-shot, council, and context-summary tools. */
2
- import type { Config, CouncilToolConfig, OneShotModelRouter, Provider } from '@wrongstack/core/types';
3
- import { createContextManagerTool } from '@wrongstack/core/infrastructure';
4
2
  import type { FallbackProfileManager } from '@wrongstack/core/agent';
5
- import { type CouncilPersonaRegistry, type CouncilProfileRegistry } from '@wrongstack/core/execution';
6
3
  import type { ProviderModelStatusTracker } from '@wrongstack/core/coordination';
4
+ import { type CouncilPersonaRegistry, type CouncilProfileRegistry } from '@wrongstack/core/execution';
5
+ import { createContextManagerTool } from '@wrongstack/core/infrastructure';
7
6
  import type { ToolRegistry } from '@wrongstack/core/registry';
7
+ import type { Config, CouncilToolConfig, OneShotModelRouter, Provider } from '@wrongstack/core/types';
8
8
  export interface ProviderUtilityToolsInput {
9
9
  toolRegistry: ToolRegistry;
10
10
  buildProvider: (providerId: string) => Provider;
@@ -1,6 +1,6 @@
1
+ import { ProviderRegistry } from '@wrongstack/core/registry';
1
2
  import type { ResolvedProvider } from '@wrongstack/core/types';
2
3
  import { type Config, type Logger, type ModelsRegistry } from '@wrongstack/core/types';
3
- import { ProviderRegistry } from '@wrongstack/core/registry';
4
4
  export interface ProviderSetupResult {
5
5
  resolvedProvider: ResolvedProvider | undefined;
6
6
  provider: ReturnType<ProviderRegistry['create']>;
@@ -1,6 +1,6 @@
1
1
  import { type Container } from '@wrongstack/core/kernel';
2
- import type { Logger } from '@wrongstack/core/types';
3
2
  import { type ReplayMode } from '@wrongstack/core/replay';
3
+ import type { Logger } from '@wrongstack/core/types';
4
4
  import type { WstackPaths } from '@wrongstack/core/utils';
5
5
  /**
6
6
  * Bind a `ReplayProviderRunner` into the container under