@wrongstack/cli 0.299.0 → 0.301.0

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 (82) hide show
  1. package/dist/{acp-S4LZQB66.js → acp-DATHHPNT.js} +36 -17
  2. package/dist/acp-server-agent.d.ts +1 -1
  3. package/dist/{audit-2ZSFGNIF.js → audit-QRCLEHHW.js} +5 -1
  4. package/dist/{auth-G5YKKSRH.js → auth-JASC4K3F.js} +151 -38
  5. package/dist/auth-menu/loopback-server.d.ts +41 -55
  6. package/dist/auth-menu/openai-codex-oauth.d.ts +36 -123
  7. package/dist/auto-discover-providers-DRW4OZHG.js +8 -0
  8. package/dist/boot/dispatch-webui.d.ts +3 -0
  9. package/dist/boot/launch-menu.d.ts +2 -4
  10. package/dist/boot/tool-registry.d.ts +3 -0
  11. package/dist/chimera-reviewer-policy.d.ts +10 -3
  12. package/dist/chimera-work-registry.d.ts +19 -0
  13. package/dist/{chronicle-QQEQFSSE.js → chronicle-63MFCZN6.js} +26 -5
  14. package/dist/{chunk-YWUPHRGB.js → chunk-263G3FMB.js} +33 -10
  15. package/dist/{chunk-2SLSUDYS.js → chunk-2KDOFTTM.js} +312 -211
  16. package/dist/{chunk-TGDHN4LM.js → chunk-4GVH7V3S.js} +4 -24
  17. package/dist/chunk-CSAPOCBP.js +24 -0
  18. package/dist/{chunk-66T43Q4Y.js → chunk-ETOEGL3V.js} +6 -9
  19. package/dist/{chunk-PEKUKUCH.js → chunk-GUHQQG63.js} +32 -14
  20. package/dist/chunk-KE7E7DPX.js +38 -0
  21. package/dist/{chunk-ZNZJ34RF.js → chunk-MHF2IJDE.js} +21 -4
  22. package/dist/{chunk-4HH3YGG4.js → chunk-MRLYDHQ7.js} +8 -5
  23. package/dist/{chunk-L5CE52XW.js → chunk-O7XNGCRT.js} +317 -309
  24. package/dist/chunk-PYTFS4MC.js +238 -0
  25. package/dist/{chunk-DPJZQCVP.js → chunk-YMXXOOFN.js} +1 -1
  26. package/dist/{chunk-4U3DMA2Y.js → chunk-ZECLGUTF.js} +28 -21
  27. package/dist/{cli-main-3MQDFSYK.js → cli-main-XWC57MGE.js} +849 -242
  28. package/dist/{execution-ANOYMWPO.js → execution-LHMSMDHB.js} +174 -55
  29. package/dist/execution-chimera-cascade.d.ts +3 -4
  30. package/dist/execution-chimera-review.d.ts +2 -3
  31. package/dist/execution-cleanup.d.ts +3 -2
  32. package/dist/execution.d.ts +1 -1
  33. package/dist/{export-TPORYVRZ.js → export-DOBGPY23.js} +12 -1
  34. package/dist/fleet/budget-source.d.ts +18 -0
  35. package/dist/fleet/host-context.d.ts +1 -1
  36. package/dist/fleet/host-helpers.d.ts +14 -0
  37. package/dist/fleet/host-status.d.ts +31 -0
  38. package/dist/fleet/host-types.d.ts +8 -0
  39. package/dist/fleet/host.d.ts +5 -0
  40. package/dist/fleet/status-broadcast.d.ts +1 -1
  41. package/dist/{hq-BDO56CX6.js → hq-LN5CJHCM.js} +22 -3
  42. package/dist/hq-server/auth-state.d.ts +29 -1
  43. package/dist/hq-server/auth.d.ts +16 -0
  44. package/dist/hq-server/client-address.d.ts +56 -0
  45. package/dist/hq-server/login-attempt-store.d.ts +30 -10
  46. package/dist/hq-server/routes/auth-handlers.d.ts +66 -26
  47. package/dist/hq-server/routes.d.ts +23 -1
  48. package/dist/hq-server/types.d.ts +10 -0
  49. package/dist/hq-server/ws.d.ts +17 -6
  50. package/dist/{hq-server-RJLJJZU7.js → hq-server-S7HZG3PA.js} +3 -2
  51. package/dist/hq-server.d.ts +19 -0
  52. package/dist/index.js +69 -104
  53. package/dist/live-settings-input.d.ts +5 -0
  54. package/dist/{mcp-CYLPUEHC.js → mcp-OHPJH73U.js} +6 -2
  55. package/dist/{modeldiag-HENYJ4N7.js → modeldiag-3DOK4BWW.js} +3 -3
  56. package/dist/{plugin-usage-VTL7ZTVC.js → plugin-usage-YEVLOR33.js} +7 -3
  57. package/dist/{plugins-ETY6W3DC.js → plugins-K3BAUP4D.js} +3 -3
  58. package/dist/profile-config-path.d.ts +0 -2
  59. package/dist/provider-helpers.d.ts +0 -5
  60. package/dist/{providers-models-GDELBHZK.js → providers-models-WEZ4EGLL.js} +38 -12
  61. package/dist/{replay-KCTXNMZQ.js → replay-FCBNHW3K.js} +5 -1
  62. package/dist/{rewind-EJMVFVLS.js → rewind-AOD3JIYX.js} +5 -1
  63. package/dist/{sessions-config-NLCMK3BY.js → sessions-config-XXN7267N.js} +8 -3
  64. package/dist/slash-commands/command-context.d.ts +19 -0
  65. package/dist/subcommands/flags.d.ts +23 -0
  66. package/dist/terminal-format.d.ts +15 -0
  67. package/dist/webui-server/setup-events.d.ts +17 -0
  68. package/dist/webui-server/terminal-log-view.d.ts +29 -12
  69. package/dist/{webui-server-PCLSXX6L.js → webui-server-DD35QFNO.js} +113 -50
  70. package/dist/webui-server-options.d.ts +16 -0
  71. package/dist/wiring/brain-and-orchestration.d.ts +4 -1
  72. package/dist/wiring/director-setup.d.ts +4 -0
  73. package/dist/wiring/fallback-gate.d.ts +31 -0
  74. package/dist/wiring/fleet-command-handlers.d.ts +1 -1
  75. package/dist/wiring/mailbox-bridge-bootstrap.d.ts +3 -1
  76. package/dist/wiring/management-tools.d.ts +9 -1
  77. package/dist/wiring/pipeline.d.ts +5 -5
  78. package/dist/wiring/plugins.d.ts +3 -10
  79. package/dist/wiring/provider-utility-tools.d.ts +27 -1
  80. package/dist/wiring/tools.d.ts +4 -5
  81. package/package.json +23 -23
  82. package/dist/chunk-GO3TJICK.js +0 -489
package/dist/index.js CHANGED
@@ -13,20 +13,21 @@ import {
13
13
  import {
14
14
  patchConfig
15
15
  } from "./chunk-TYO2OVAD.js";
16
+ import {
17
+ DEFAULT_PORT
18
+ } from "./chunk-2KDOFTTM.js";
19
+ import "./chunk-KE7E7DPX.js";
20
+ import "./chunk-Q5GTM25S.js";
16
21
  import {
17
22
  helpCmd,
18
23
  versionCmd
19
24
  } from "./chunk-ARWGQUB3.js";
20
- import {
21
- discoverAndMergeProviders
22
- } from "./chunk-TGDHN4LM.js";
23
- import {
24
- DEFAULT_PORT
25
- } from "./chunk-2SLSUDYS.js";
26
- import "./chunk-Q5GTM25S.js";
27
25
  import {
28
26
  CLI_VERSION
29
27
  } from "./chunk-XJXDOF63.js";
28
+ import {
29
+ discoverAndMergeProviders
30
+ } from "./chunk-4GVH7V3S.js";
30
31
  import {
31
32
  runUpdateCommand
32
33
  } from "./chunk-I5MEUFDI.js";
@@ -36,21 +37,21 @@ import {
36
37
  parseArgs,
37
38
  runPicker,
38
39
  saveToGlobalConfig
39
- } from "./chunk-ZNZJ34RF.js";
40
+ } from "./chunk-MHF2IJDE.js";
40
41
  import {
41
42
  isKeylessLocalProvider,
42
43
  visibleModelIds
43
- } from "./chunk-66T43Q4Y.js";
44
+ } from "./chunk-ETOEGL3V.js";
44
45
  import {
45
46
  mutateConfigProviders,
46
47
  normalizeKeys,
47
48
  resolveActiveApiKey,
48
49
  writeKeysBack
49
50
  } from "./chunk-PJHET45A.js";
50
- import "./chunk-YWUPHRGB.js";
51
+ import "./chunk-263G3FMB.js";
51
52
  import {
52
53
  activeProfileConfigPath
53
- } from "./chunk-DPJZQCVP.js";
54
+ } from "./chunk-YMXXOOFN.js";
54
55
  import "./chunk-7OCVIDC7.js";
55
56
 
56
57
  // src/cli-entry-point.ts
@@ -316,15 +317,15 @@ var ReadlineInputReader = class {
316
317
  }
317
318
  const fresh = this.ensure();
318
319
  this.installPromptGuard(fresh);
319
- return new Promise((resolve2) => {
320
+ const line = await new Promise((resolve2) => {
320
321
  let settled = false;
321
322
  let timeoutHandle;
322
- const settle = (line) => {
323
+ const settle = (line2) => {
323
324
  if (settled) return;
324
325
  settled = true;
325
326
  if (timeoutHandle) clearTimeout(timeoutHandle);
326
327
  setOutputLineGuard(null);
327
- resolve2(line);
328
+ resolve2(line2);
328
329
  };
329
330
  if (timeoutOpts) {
330
331
  timeoutHandle = setTimeout(() => {
@@ -334,15 +335,15 @@ var ReadlineInputReader = class {
334
335
  }
335
336
  }, timeoutOpts.timeoutMs);
336
337
  }
337
- fresh.question(prompt ?? "> ", (line) => {
338
- const persistHistory = !this.suppressNextHistory && this.shouldPersistHistory(line);
338
+ fresh.question(prompt ?? "> ", (line2) => {
339
+ const persistHistory = !this.suppressNextHistory && this.shouldPersistHistory(line2);
339
340
  this.suppressNextHistory = false;
340
- if (line.trim() && persistHistory) {
341
- this.history.push(line);
341
+ if (line2.trim() && persistHistory) {
342
+ this.history.push(line2);
342
343
  this.saveHistory().then(void 0, () => {
343
344
  });
344
345
  }
345
- settle(line);
346
+ settle(line2);
346
347
  });
347
348
  fresh.once("close", () => settle(""));
348
349
  fresh.on?.("error", (_e) => settle(""));
@@ -351,6 +352,7 @@ var ReadlineInputReader = class {
351
352
  fresh.close();
352
353
  return result;
353
354
  });
355
+ return line;
354
356
  } finally {
355
357
  this.pending = false;
356
358
  }
@@ -1435,14 +1437,14 @@ function summarize(value, name) {
1435
1437
  if (typeof v === "object" && v !== null) {
1436
1438
  const o = v;
1437
1439
  if (name === "edit") {
1438
- const path10 = typeof o["path"] === "string" ? o["path"] : "";
1440
+ const path9 = typeof o["path"] === "string" ? o["path"] : "";
1439
1441
  const reps = typeof o["replacements"] === "number" ? o["replacements"] : 0;
1440
- return `${path10} ${reps} replacement${reps === 1 ? "" : "s"}`.trim();
1442
+ return `${path9} ${reps} replacement${reps === 1 ? "" : "s"}`.trim();
1441
1443
  }
1442
1444
  if (name === "write") {
1443
- const path10 = typeof o["path"] === "string" ? o["path"] : "";
1445
+ const path9 = typeof o["path"] === "string" ? o["path"] : "";
1444
1446
  const bytes = typeof o["bytes"] === "number" ? o["bytes"] : void 0;
1445
- return bytes !== void 0 ? `${path10} ${bytes}B` : path10;
1447
+ return bytes !== void 0 ? `${path9} ${bytes}B` : path9;
1446
1448
  }
1447
1449
  if (name === "read") {
1448
1450
  return summarizeRead(o);
@@ -1457,13 +1459,13 @@ function summarize(value, name) {
1457
1459
  return "";
1458
1460
  }
1459
1461
  function summarizeRead(o) {
1460
- const path10 = typeof o["path"] === "string" ? o["path"] : "";
1462
+ const path9 = typeof o["path"] === "string" ? o["path"] : "";
1461
1463
  const total = typeof o["total_lines"] === "number" ? o["total_lines"] : void 0;
1462
1464
  const truncated = o["truncated"] === true;
1463
1465
  const cached = o["cached"] === true;
1464
1466
  const note = typeof o["note"] === "string" ? o["note"] : void 0;
1465
1467
  const parts = [];
1466
- if (path10) parts.push(path10);
1468
+ if (path9) parts.push(path9);
1467
1469
  if (total !== void 0) parts.push(`${total} line${total === 1 ? "" : "s"}`);
1468
1470
  const flags = [];
1469
1471
  if (truncated) flags.push("truncated");
@@ -1495,34 +1497,34 @@ function compactSingleLine(text) {
1495
1497
 
1496
1498
  // src/subcommands/index.ts
1497
1499
  var loaders = {
1498
- acp: async () => (await import("./acp-S4LZQB66.js")).acpCmd,
1500
+ acp: async () => (await import("./acp-DATHHPNT.js")).acpCmd,
1499
1501
  init: async () => (await import("./init-E2NDDOHI.js")).initCmd,
1500
- auth: async () => (await import("./auth-G5YKKSRH.js")).authCmd,
1502
+ auth: async () => (await import("./auth-JASC4K3F.js")).authCmd,
1501
1503
  update: async () => (await import("./update-MV6TUACD.js")).updateCmd,
1502
- sessions: async () => (await import("./sessions-config-NLCMK3BY.js")).sessionsCmd,
1503
- config: async () => (await import("./sessions-config-NLCMK3BY.js")).configCmd,
1504
- rewind: async () => (await import("./rewind-EJMVFVLS.js")).rewindCmd,
1505
- replay: async () => (await import("./replay-KCTXNMZQ.js")).replayCmd,
1506
- audit: async () => (await import("./audit-2ZSFGNIF.js")).auditCmd,
1504
+ sessions: async () => (await import("./sessions-config-XXN7267N.js")).sessionsCmd,
1505
+ config: async () => (await import("./sessions-config-XXN7267N.js")).configCmd,
1506
+ rewind: async () => (await import("./rewind-AOD3JIYX.js")).rewindCmd,
1507
+ replay: async () => (await import("./replay-FCBNHW3K.js")).replayCmd,
1508
+ audit: async () => (await import("./audit-QRCLEHHW.js")).auditCmd,
1507
1509
  tools: async () => (await import("./tools-skills-UNKLOB7M.js")).toolsCmd,
1508
1510
  skills: async () => (await import("./tools-skills-UNKLOB7M.js")).skillsCmd,
1509
- providers: async () => (await import("./providers-models-GDELBHZK.js")).providersCmd,
1510
- models: async () => (await import("./providers-models-GDELBHZK.js")).modelsCmd,
1511
- mcp: async () => (await import("./mcp-CYLPUEHC.js")).mcpCmd,
1512
- plugin: async () => (await import("./plugin-usage-VTL7ZTVC.js")).pluginCmd,
1513
- plugins: async () => (await import("./plugin-usage-VTL7ZTVC.js")).pluginCmd,
1511
+ providers: async () => (await import("./providers-models-WEZ4EGLL.js")).providersCmd,
1512
+ models: async () => (await import("./providers-models-WEZ4EGLL.js")).modelsCmd,
1513
+ mcp: async () => (await import("./mcp-OHPJH73U.js")).mcpCmd,
1514
+ plugin: async () => (await import("./plugin-usage-YEVLOR33.js")).pluginCmd,
1515
+ plugins: async () => (await import("./plugin-usage-YEVLOR33.js")).pluginCmd,
1514
1516
  diag: async () => (await import("./diag-doctor-OQ3AA63O.js")).diagCmd,
1515
1517
  doctor: async () => (await import("./diag-doctor-OQ3AA63O.js")).doctorCmd,
1516
- export: async () => (await import("./export-TPORYVRZ.js")).exportCmd,
1517
- usage: async () => (await import("./plugin-usage-VTL7ZTVC.js")).usageCmd,
1518
+ export: async () => (await import("./export-DOBGPY23.js")).exportCmd,
1519
+ usage: async () => (await import("./plugin-usage-YEVLOR33.js")).usageCmd,
1518
1520
  version: async () => (await import("./version-help-ASKQYXDJ.js")).versionCmd,
1519
1521
  help: async () => (await import("./version-help-ASKQYXDJ.js")).helpCmd,
1520
1522
  projects: async () => (await import("./projects-XE76NFNZ.js")).projectsCmd,
1521
- modeldiag: async () => (await import("./modeldiag-HENYJ4N7.js")).modeldiagCmd,
1523
+ modeldiag: async () => (await import("./modeldiag-3DOK4BWW.js")).modeldiagCmd,
1522
1524
  quick: async () => (await import("./quick-VIO2BEHS.js")).quickCmd,
1523
1525
  bench: async () => (await import("./bench-7ZDWSNEF.js")).benchCmd,
1524
- chronicle: async () => (await import("./chronicle-QQEQFSSE.js")).chronicleCmd,
1525
- hq: async () => (await import("./hq-BDO56CX6.js")).hqCmd,
1526
+ chronicle: async () => (await import("./chronicle-63MFCZN6.js")).chronicleCmd,
1527
+ hq: async () => (await import("./hq-LN5CJHCM.js")).hqCmd,
1526
1528
  mailbox: async () => (await import("./mailbox-serve-DBOOOOWZ.js")).mailboxServeCmd,
1527
1529
  permissions: async () => (await import("./permissions-FNYLZIL4.js")).permissionsCmd,
1528
1530
  project: async () => (await import("./project-BLQ3ALVL.js")).projectCmd,
@@ -1639,7 +1641,7 @@ async function boot(argv) {
1639
1641
  return 2;
1640
1642
  }
1641
1643
  let { paths, config, vault } = bootResult;
1642
- const first = positional[0];
1644
+ let first = positional[0];
1643
1645
  const mayOfferConfigRecovery = isStdinTTY() && (positional.length === 0 || first === "quick") && (!config.activeProfile || config.activeProfile === "default") && typeof flags["prompt"] !== "string" && !flags["webui"] && !flags["no-interactive"] && !flags["skip"];
1644
1646
  const renderer = new TerminalRenderer();
1645
1647
  const reader = new ReadlineInputReader({ historyFile: paths.wpaths.historyFile });
@@ -1671,6 +1673,7 @@ async function boot(argv) {
1671
1673
  flags["quick"] = true;
1672
1674
  flags["tui"] = true;
1673
1675
  positional.splice(0, 1);
1676
+ first = void 0;
1674
1677
  const plugins = config?.plugins ?? [];
1675
1678
  if (plugins.length === 0) {
1676
1679
  console.debug("[wrongstack:quick] No plugins configured");
@@ -1705,7 +1708,8 @@ async function boot(argv) {
1705
1708
  overlayFile: resolveBundledOverlayFile(),
1706
1709
  overlayCacheFile: wpaths.modelsOverlayCache
1707
1710
  });
1708
- if (first && subcommands[first]) {
1711
+ const subcommandHandler = first ? subcommands[first] : void 0;
1712
+ if (first && subcommandHandler) {
1709
1713
  const container = createDefaultContainer({
1710
1714
  config,
1711
1715
  wpaths,
@@ -1721,7 +1725,7 @@ async function boot(argv) {
1721
1725
  registry: toolRegistryForSubcmd,
1722
1726
  tier: normalizeTokenSavingTier(config.features.tokenSavingMode)
1723
1727
  });
1724
- const code = await subcommands[first]?.(positional.slice(1), {
1728
+ const code = await subcommandHandler(positional.slice(1), {
1725
1729
  config,
1726
1730
  renderer,
1727
1731
  reader,
@@ -2120,26 +2124,19 @@ async function launchDesktop(args) {
2120
2124
  }
2121
2125
 
2122
2126
  // src/boot/short-circuit-hq.ts
2123
- import * as fs7 from "node:fs/promises";
2124
2127
  import * as net from "node:net";
2125
- import * as path7 from "node:path";
2128
+ import {
2129
+ HQ_CLI_DEFAULT_HOST,
2130
+ isLoopbackHost,
2131
+ readHqRuntimeFileSync,
2132
+ resolveHqDataDir
2133
+ } from "@wrongstack/core/hq";
2126
2134
  import { color as color8, isPidAlive } from "@wrongstack/core/utils";
2127
- import { HQ_CLI_DEFAULT_HOST, isLoopbackHost, resolveHqDataDir } from "@wrongstack/core/hq";
2128
2135
  async function isHqAlreadyRunning(dataDir) {
2129
- const markerPath = path7.join(dataDir, "runtime.json");
2130
- let fd;
2131
- try {
2132
- fd = await fs7.open(markerPath, "r");
2133
- const content = await fd.read().then(({ buffer }) => buffer.toString("utf8"));
2134
- const marker = JSON.parse(content);
2135
- if (marker.pid && isPidAlive(marker.pid)) return marker;
2136
- return null;
2137
- } catch (err) {
2138
- if (err.code === "ENOENT") return null;
2139
- return null;
2140
- } finally {
2141
- if (fd) await fd.close();
2142
- }
2136
+ const marker = readHqRuntimeFileSync(dataDir);
2137
+ if (!marker) return null;
2138
+ if (marker.pid && isPidAlive(marker.pid)) return marker;
2139
+ return null;
2143
2140
  }
2144
2141
  async function isPortInUse(host, port) {
2145
2142
  return new Promise((resolve2) => {
@@ -2159,7 +2156,7 @@ async function isPortInUse(host, port) {
2159
2156
  }
2160
2157
  async function handleHqShortCircuit(flags) {
2161
2158
  if (flags["hq"] !== true) return null;
2162
- const { startHqServer } = await import("./hq-server-RJLJJZU7.js");
2159
+ const { startHqServer } = await import("./hq-server-S7HZG3PA.js");
2163
2160
  const tunnelRequested = flags["tunnel"] === true;
2164
2161
  const host = typeof flags["host"] === "string" ? flags["host"] : tunnelRequested ? "127.0.0.1" : HQ_CLI_DEFAULT_HOST;
2165
2162
  if (tunnelRequested && !isLoopbackHost(host)) {
@@ -2318,7 +2315,7 @@ ${color8.green("Cloudflare Quick Tunnel ready:")} ${browserUrl}
2318
2315
  }
2319
2316
 
2320
2317
  // src/boot/launch-menu.ts
2321
- import * as fs8 from "node:fs/promises";
2318
+ import * as fs7 from "node:fs/promises";
2322
2319
  import { HQ_CLI_DEFAULT_HOST as HQ_CLI_DEFAULT_HOST2 } from "@wrongstack/core/hq";
2323
2320
  import { atomicWrite as atomicWrite3, color as color9, isStdinTTY as isStdinTTY2, setRawMode as setRawMode2 } from "@wrongstack/core/utils";
2324
2321
 
@@ -2487,42 +2484,10 @@ function shouldSkipMenu(argv, flags, positional) {
2487
2484
  if (flags["skip"] === true) return true;
2488
2485
  if (typeof flags["prompt"] === "string") return true;
2489
2486
  if (!isStdinTTY2()) return true;
2490
- if (positional.length > 0) {
2491
- const first = positional[0];
2492
- if (first && KNOWN_SUBCOMMANDS.has(first)) return true;
2493
- }
2487
+ if (positional.length > 0) return true;
2494
2488
  void argv;
2495
2489
  return false;
2496
2490
  }
2497
- var KNOWN_SUBCOMMANDS = /* @__PURE__ */ new Set([
2498
- "auth",
2499
- "init",
2500
- "mcp",
2501
- "plugin",
2502
- "doctor",
2503
- "version",
2504
- "help",
2505
- "provider",
2506
- "project",
2507
- "governance",
2508
- "session",
2509
- "sessions",
2510
- "replay",
2511
- "export",
2512
- "rewind",
2513
- "config-history",
2514
- "modeldiag",
2515
- "models-add",
2516
- "tools",
2517
- "skill",
2518
- "skills",
2519
- "update",
2520
- "quick",
2521
- "audit",
2522
- "bench",
2523
- "mailbox-serve",
2524
- "resume"
2525
- ]);
2526
2491
  async function runLaunchMenu(deps) {
2527
2492
  if (shouldSkipMenu(deps.argv, deps.flags, deps.positional)) {
2528
2493
  return null;
@@ -2854,13 +2819,13 @@ function toPersistedMenuChoice(result) {
2854
2819
  async function persistMenuChoice(globalConfigPath, choice) {
2855
2820
  let fileExists = false;
2856
2821
  try {
2857
- await fs8.access(globalConfigPath);
2822
+ await fs7.access(globalConfigPath);
2858
2823
  fileExists = true;
2859
2824
  } catch {
2860
2825
  }
2861
2826
  let existing = {};
2862
2827
  try {
2863
- const raw = await fs8.readFile(globalConfigPath, "utf8");
2828
+ const raw = await fs7.readFile(globalConfigPath, "utf8");
2864
2829
  existing = JSON.parse(raw);
2865
2830
  } catch (err) {
2866
2831
  if (fileExists) {
@@ -2943,12 +2908,12 @@ import { createDefaultContainer as createDefaultContainer2 } from "@wrongstack/r
2943
2908
 
2944
2909
  // src/cli-bundled-skills.ts
2945
2910
  import { createRequire as createRequire3 } from "node:module";
2946
- import * as path8 from "node:path";
2911
+ import * as path7 from "node:path";
2947
2912
  function resolveBundledSkillsDir2() {
2948
2913
  try {
2949
2914
  const req = createRequire3(import.meta.url);
2950
2915
  const corePkg = req.resolve("@wrongstack/core/package.json");
2951
- return path8.join(path8.dirname(corePkg), "skills");
2916
+ return path7.join(path7.dirname(corePkg), "skills");
2952
2917
  } catch {
2953
2918
  return void 0;
2954
2919
  }
@@ -2956,12 +2921,12 @@ function resolveBundledSkillsDir2() {
2956
2921
 
2957
2922
  // src/cli-bundled-prompts.ts
2958
2923
  import { createRequire as createRequire4 } from "node:module";
2959
- import * as path9 from "node:path";
2924
+ import * as path8 from "node:path";
2960
2925
  function resolveBundledPromptsDir2() {
2961
2926
  try {
2962
2927
  const req = createRequire4(import.meta.url);
2963
2928
  const corePkg = req.resolve("@wrongstack/core/package.json");
2964
- return path9.join(path9.dirname(corePkg), "data", "prompts");
2929
+ return path8.join(path8.dirname(corePkg), "data", "prompts");
2965
2930
  } catch {
2966
2931
  return void 0;
2967
2932
  }
@@ -3149,7 +3114,7 @@ async function initializeCli(argv) {
3149
3114
  async function main(argv) {
3150
3115
  const cliCtx = await initializeCli(argv);
3151
3116
  if (typeof cliCtx === "number") return cliCtx;
3152
- const { runInteractive } = await import("./cli-main-3MQDFSYK.js");
3117
+ const { runInteractive } = await import("./cli-main-XWC57MGE.js");
3153
3118
  return runInteractive(cliCtx);
3154
3119
  }
3155
3120
 
@@ -81,6 +81,11 @@ export interface LiveSettingsInput {
81
81
  * file content. Persisted as `autonomy.readAdvancedMode`.
82
82
  */
83
83
  readSymbols?: boolean | undefined;
84
+ /**
85
+ * Register the leader's agent-callable `nextsteps` tool. Persisted to
86
+ * `tools.nextsteps.enabled`; read at boot, so it applies next session.
87
+ */
88
+ nextStepsTool?: boolean | undefined;
84
89
  /** Minimum relation strength for SAGE memory injection. Default: 0.85. */
85
90
  sageMemoryInjectThreshold?: number | undefined;
86
91
  }
@@ -1,6 +1,9 @@
1
+ import {
2
+ restoreFlags
3
+ } from "./chunk-CSAPOCBP.js";
1
4
  import {
2
5
  activeProfileConfigPath
3
- } from "./chunk-DPJZQCVP.js";
6
+ } from "./chunk-YMXXOOFN.js";
4
7
  import "./chunk-7OCVIDC7.js";
5
8
 
6
9
  // src/subcommands/handlers/mcp.ts
@@ -301,6 +304,7 @@ async function serveMcpStdio(deps) {
301
304
  // src/subcommands/handlers/mcp.ts
302
305
  var BUILT_IN_MCP = allServers();
303
306
  var mcpCmd = async (args, deps) => {
307
+ args = restoreFlags(args, deps, ["enable", "e", "transport", "url", "command"]);
304
308
  const sub = args[0];
305
309
  if (sub === "serve") {
306
310
  return serveMcpStdio(deps);
@@ -410,4 +414,4 @@ function isRecord(value) {
410
414
  export {
411
415
  mcpCmd
412
416
  };
413
- //# sourceMappingURL=mcp-CYLPUEHC.js.map
417
+ //# sourceMappingURL=mcp-OHPJH73U.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  discoverAndMergeProviders
3
- } from "./chunk-TGDHN4LM.js";
3
+ } from "./chunk-4GVH7V3S.js";
4
4
  import {
5
5
  mutateConfigProviders,
6
6
  normalizeKeys,
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-PJHET45A.js";
9
9
  import {
10
10
  activeProfileConfigPath
11
- } from "./chunk-DPJZQCVP.js";
11
+ } from "./chunk-YMXXOOFN.js";
12
12
  import "./chunk-7OCVIDC7.js";
13
13
 
14
14
  // src/subcommands/handlers/modeldiag.ts
@@ -1287,4 +1287,4 @@ ${color2.dim('Enter numbers or provider IDs (comma-separated, or "all"):')}
1287
1287
  export {
1288
1288
  modeldiagCmd
1289
1289
  };
1290
- //# sourceMappingURL=modeldiag-HENYJ4N7.js.map
1290
+ //# sourceMappingURL=modeldiag-3DOK4BWW.js.map
@@ -1,13 +1,17 @@
1
1
  import {
2
2
  runPluginManagementCommand
3
- } from "./chunk-PEKUKUCH.js";
3
+ } from "./chunk-GUHQQG63.js";
4
+ import {
5
+ restoreFlags
6
+ } from "./chunk-CSAPOCBP.js";
4
7
  import {
5
8
  activeProfileConfigPath
6
- } from "./chunk-DPJZQCVP.js";
9
+ } from "./chunk-YMXXOOFN.js";
7
10
  import "./chunk-7OCVIDC7.js";
8
11
 
9
12
  // src/subcommands/handlers/plugin-usage.ts
10
13
  var pluginCmd = async (args, deps) => {
14
+ args = restoreFlags(args, deps, ["disabled", "enable", "e", "json", "all"]);
11
15
  const result = await runPluginManagementCommand(args, {
12
16
  config: deps.config,
13
17
  configPath: activeProfileConfigPath(deps.paths, deps.config)
@@ -37,4 +41,4 @@ export {
37
41
  pluginCmd,
38
42
  usageCmd
39
43
  };
40
- //# sourceMappingURL=plugin-usage-VTL7ZTVC.js.map
44
+ //# sourceMappingURL=plugin-usage-YEVLOR33.js.map
@@ -7,8 +7,8 @@ import {
7
7
  pluginNameFromSpec,
8
8
  setupPlugins,
9
9
  warnIfDeprecatedPluginName
10
- } from "./chunk-4U3DMA2Y.js";
11
- import "./chunk-PEKUKUCH.js";
10
+ } from "./chunk-ZECLGUTF.js";
11
+ import "./chunk-GUHQQG63.js";
12
12
  import "./chunk-TYO2OVAD.js";
13
13
  import "./chunk-7OCVIDC7.js";
14
14
  export {
@@ -21,4 +21,4 @@ export {
21
21
  setupPlugins,
22
22
  warnIfDeprecatedPluginName
23
23
  };
24
- //# sourceMappingURL=plugins-ETY6W3DC.js.map
24
+ //# sourceMappingURL=plugins-K3BAUP4D.js.map
@@ -1,7 +1,5 @@
1
1
  import type { Config } from '@wrongstack/core/types';
2
2
  import type { WstackPaths } from '@wrongstack/core/utils';
3
- /** Resolve the selected profile without ever treating the root bootstrap as settings. */
4
- export declare function activeProfileName(config: Pick<Config, 'activeProfile'>): string;
5
3
  /** Canonical settings file for the currently selected profile. */
6
4
  export declare function activeProfileConfigPath(paths: Pick<WstackPaths, 'profileConfig'>, config: Pick<Config, 'activeProfile'>): string;
7
5
  //# sourceMappingURL=profile-config-path.d.ts.map
@@ -1,8 +1,3 @@
1
- /**
2
- * Shared provider-config helpers used by the picker, main boot sequence,
3
- * and subcommands. Keeps provider key detection and alias resolution in
4
- * one place so the logic doesn't drift between call sites.
5
- */
6
1
  import type { Config, ModelsRegistry, ProviderConfig, ResolvedProvider } from '@wrongstack/core/types';
7
2
  /** Return the provider's visible model ids: models.dev plus anything the saved
8
3
  * config names that the catalog does not carry.
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  visibleModelIds
3
- } from "./chunk-66T43Q4Y.js";
3
+ } from "./chunk-ETOEGL3V.js";
4
4
  import {
5
5
  mutateConfigProviders
6
6
  } from "./chunk-PJHET45A.js";
7
7
  import {
8
8
  activeProfileConfigPath
9
- } from "./chunk-DPJZQCVP.js";
9
+ } from "./chunk-YMXXOOFN.js";
10
10
  import "./chunk-7OCVIDC7.js";
11
11
 
12
12
  // src/subcommands/handlers/providers-models.ts
@@ -15,8 +15,9 @@ import { atomicWrite, color, expectDefined } from "@wrongstack/core/utils";
15
15
  import { decryptConfigSecrets, encryptConfigSecrets } from "@wrongstack/core/security";
16
16
  import { ConfigError } from "@wrongstack/core/types";
17
17
  var providersCmd = async (args, deps) => {
18
- const showAll = args.includes("--all");
19
- const showUnsupported = args.includes("--unsupported");
18
+ const providerFlags = subcommandFlags(args, deps);
19
+ const showAll = providerFlags["all"] === true || providerFlags["all"] === "true";
20
+ const showUnsupported = providerFlags["unsupported"] === true || providerFlags["unsupported"] === "true";
20
21
  try {
21
22
  const all = await deps.modelsRegistry.listProviders();
22
23
  const byFamily = {
@@ -127,7 +128,7 @@ var modelsCmd = async (args, deps) => {
127
128
  return 1;
128
129
  }
129
130
  }
130
- const flags = parseFlags(args);
131
+ const flags = subcommandFlags(args, deps);
131
132
  const search = typeof flags["search"] === "string" ? flags["search"].toLowerCase() : "";
132
133
  const perPage = Number(flags["per-page"]) > 0 ? Number(flags["per-page"]) : DEFAULT_PER_PAGE;
133
134
  const page = Math.max(1, Number(flags["page"]) || 1);
@@ -138,10 +139,10 @@ var modelsCmd = async (args, deps) => {
138
139
  );
139
140
  return 1;
140
141
  }
141
- let lookupId = providerId;
142
- const savedAlias = deps.config.providers?.[providerId];
143
- if (savedAlias?.type && savedAlias.type !== providerId) lookupId = savedAlias.type;
144
- const provider = await deps.modelsRegistry.getProvider(lookupId);
142
+ const { providerId: lookupId, provider } = await getCatalogProviderForConfigProvider(
143
+ providerId,
144
+ deps
145
+ );
145
146
  if (!provider) {
146
147
  deps.renderer.writeError(
147
148
  lookupId !== providerId ? `Alias "${providerId}" points at catalog id "${lookupId}" which is not in the cache.` : `Provider "${providerId}" not in catalog.`
@@ -234,11 +235,33 @@ ${navLines.join(" \xB7 ")}
234
235
  function aliasProviderId(configProviderId, cfg) {
235
236
  return cfg?.type && cfg.type !== configProviderId ? cfg.type : configProviderId;
236
237
  }
238
+ async function discoverProviderModels(deps, ids) {
239
+ if (!("mergeOverlay" in deps.modelsRegistry)) return void 0;
240
+ try {
241
+ const { discoverAndMergeProviders } = await import("./auto-discover-providers-DRW4OZHG.js");
242
+ await discoverAndMergeProviders({
243
+ config: deps.config,
244
+ registry: deps.modelsRegistry,
245
+ cacheDir: deps.paths.cacheDir
246
+ });
247
+ } catch {
248
+ return void 0;
249
+ }
250
+ for (const id of ids) {
251
+ const found = await deps.modelsRegistry.getProvider(id);
252
+ if (found) return found;
253
+ }
254
+ return void 0;
255
+ }
237
256
  async function getCatalogProviderForConfigProvider(providerId, deps) {
238
257
  const cfg = deps.config.providers?.[providerId];
239
258
  const lookupId = aliasProviderId(providerId, cfg);
240
259
  const provider = await deps.modelsRegistry.getProvider(lookupId);
241
- return { providerId: lookupId, provider };
260
+ if (provider) return { providerId: lookupId, provider };
261
+ return {
262
+ providerId: lookupId,
263
+ provider: await discoverProviderModels(deps, [lookupId, providerId])
264
+ };
242
265
  }
243
266
  function uniqueStrings(values) {
244
267
  return [...new Set(values.map((v) => v.trim()).filter(Boolean))];
@@ -478,13 +501,16 @@ function parseSizeFlag(raw) {
478
501
  if (unit === "k") return Math.round(num * 1e3);
479
502
  return Math.round(num);
480
503
  }
504
+ function subcommandFlags(args, deps) {
505
+ return { ...deps.flags ?? {}, ...parseFlags(args) };
506
+ }
481
507
  function parseBoolFlag(flags, key) {
482
508
  if (flags[key] === true || flags[key] === "true") return true;
483
509
  if (flags[`no-${key}`] !== void 0) return false;
484
510
  return void 0;
485
511
  }
486
512
  async function modelsAdd(args, deps) {
487
- const flags = parseFlags(args);
513
+ const flags = subcommandFlags(args, deps);
488
514
  const pos = positionals(args);
489
515
  const modelId = pos[0];
490
516
  if (!modelId) {
@@ -586,4 +612,4 @@ export {
586
612
  modelsCmd,
587
613
  providersCmd
588
614
  };
589
- //# sourceMappingURL=providers-models-GDELBHZK.js.map
615
+ //# sourceMappingURL=providers-models-WEZ4EGLL.js.map
@@ -1,9 +1,13 @@
1
+ import {
2
+ restoreFlags
3
+ } from "./chunk-CSAPOCBP.js";
1
4
  import "./chunk-7OCVIDC7.js";
2
5
 
3
6
  // src/subcommands/handlers/replay.ts
4
7
  import { color, resolveWstackPaths } from "@wrongstack/core/utils";
5
8
  import { ReplayLogStore } from "@wrongstack/core/storage";
6
9
  var replayCmd = async (args, deps) => {
10
+ args = restoreFlags(args, deps, ["list", "l"]);
7
11
  const wpaths = resolveWstackPaths({
8
12
  projectRoot: deps.projectRoot,
9
13
  userHome: deps.userHome
@@ -72,4 +76,4 @@ Run a session with --record first, then --replay to re-execute it.`
72
76
  export {
73
77
  replayCmd
74
78
  };
75
- //# sourceMappingURL=replay-KCTXNMZQ.js.map
79
+ //# sourceMappingURL=replay-FCBNHW3K.js.map
@@ -1,3 +1,6 @@
1
+ import {
2
+ restoreFlags
3
+ } from "./chunk-CSAPOCBP.js";
1
4
  import "./chunk-7OCVIDC7.js";
2
5
 
3
6
  // src/subcommands/handlers/rewind.ts
@@ -32,6 +35,7 @@ function findSessionId(args) {
32
35
  return void 0;
33
36
  }
34
37
  var rewindCmd = async (args, deps) => {
38
+ args = restoreFlags(args, deps, ["all", "last", "to", "list", "resume"]);
35
39
  const flags = parseRewindFlags(args);
36
40
  const wpaths = resolveWstackPaths({ projectRoot: deps.projectRoot });
37
41
  const sessionsDir = wpaths.projectSessions;
@@ -182,4 +186,4 @@ ${result.errors.length} error(s):
182
186
  export {
183
187
  rewindCmd
184
188
  };
185
- //# sourceMappingURL=rewind-EJMVFVLS.js.map
189
+ //# sourceMappingURL=rewind-AOD3JIYX.js.map