@wrongstack/cli 1.0.29 → 1.0.33

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 (119) hide show
  1. package/data/providers.json +206 -77
  2. package/dist/{acp-QWCBMQSO.js → acp-EDGUWU7N.js} +3 -6
  3. package/dist/{audit-46YK5DSC.js → audit-KCBTHUQI.js} +1 -1
  4. package/dist/{auth-TE55JF4Z.js → auth-SUHKFFO4.js} +136 -59
  5. package/dist/auth-menu/github-copilot-oauth.d.ts +1 -35
  6. package/dist/auth-menu/index-input.d.ts +3 -0
  7. package/dist/auth-menu/panel-flow-bridge.d.ts +29 -0
  8. package/dist/auth-menu/panel-service.d.ts +3 -34
  9. package/dist/auth-menu/provider-auth-login.d.ts +1 -1
  10. package/dist/auto-discover-providers-JX346GOM.js +7 -0
  11. package/dist/automation-MCDFCIMV.js +369 -0
  12. package/dist/{bench-GTLPM22B.js → bench-MMZHFHDL.js} +152 -43
  13. package/dist/boot/brain-decision-log.d.ts +1 -1
  14. package/dist/boot/system-prompt-builder.d.ts +1 -1
  15. package/dist/boot/system-prompt-menu.d.ts +11 -2
  16. package/dist/boot/tui-coordinator-setup.d.ts +2 -0
  17. package/dist/boot/tui-startup-output.d.ts +11 -0
  18. package/dist/{boot-auto-thin-6Q56FY3F.js → boot-auto-thin-K2DHHYIW.js} +3 -3
  19. package/dist/{chronicle-UTFETHP6.js → chronicle-PBJS7BN6.js} +5 -3
  20. package/dist/{chunk-KT34LWIS.js → chunk-24C6VVLM.js} +28 -26
  21. package/dist/{chunk-WRYZLEXP.js → chunk-2EZ2DHOW.js} +41 -7
  22. package/dist/{chunk-7IQWQCBH.js → chunk-3LEFXLAW.js} +39 -39
  23. package/dist/{chunk-WSTVGC2C.js → chunk-4BX2YDTQ.js} +13 -6
  24. package/dist/{chunk-SFBFYIOW.js → chunk-4MDRHMX4.js} +3 -2
  25. package/dist/{chunk-RDGGWMTI.js → chunk-65VNCAF6.js} +2 -22
  26. package/dist/{chunk-WQZW3RDP.js → chunk-7BNBD4PE.js} +2 -2
  27. package/dist/{chunk-RZ4ZDRYA.js → chunk-DIOODAYM.js} +2 -2
  28. package/dist/{chunk-L2RVEQWO.js → chunk-HHRYIDOW.js} +2 -2
  29. package/dist/{chunk-YHYINL47.js → chunk-LKFKO4JW.js} +2 -2
  30. package/dist/{chunk-Q4INH2DG.js → chunk-MPQCHBDJ.js} +2 -1
  31. package/dist/{chunk-2ERX3RPN.js → chunk-P3GRLV47.js} +30 -17
  32. package/dist/{chunk-ZMX5HRLI.js → chunk-P3Q3KMFH.js} +6 -4
  33. package/dist/chunk-PA4VBCXS.js +115 -0
  34. package/dist/{chunk-KOEO4CJG.js → chunk-PGNERAZL.js} +4 -4
  35. package/dist/{chunk-6A7URMWN.js → chunk-RQ4UBKYH.js} +3 -3
  36. package/dist/{chunk-X756ZS72.js → chunk-SUDNPYWD.js} +2 -2
  37. package/dist/{chunk-IFQ6NQPL.js → chunk-SWOPJHXI.js} +7 -7
  38. package/dist/{chunk-LDCGZJTC.js → chunk-TWSQTQKR.js} +12 -4
  39. package/dist/chunk-TXAFIERF.js +37 -0
  40. package/dist/{chunk-BZHT5GPF.js → chunk-WHEYHDIE.js} +2 -2
  41. package/dist/{chunk-LBPLTTZ6.js → chunk-WTJDSTYD.js} +4 -4
  42. package/dist/{chunk-IS2PPBQV.js → chunk-X4LW5CZM.js} +8 -4
  43. package/dist/{chunk-BBHWW6LR.js → chunk-YL4KCHZG.js} +18 -6
  44. package/dist/{chunk-LUMETJFO.js → chunk-ZYACRPLN.js} +2 -2
  45. package/dist/{cli-context-6RONY47P.js → cli-context-7HK67B2Z.js} +83 -76
  46. package/dist/cli-context.d.ts +3 -1
  47. package/dist/cli-infrastructure.d.ts +33 -0
  48. package/dist/{cli-main-YS3HIOSD.js → cli-main-TQGLKB6D.js} +3768 -2748
  49. package/dist/config-doctor.d.ts +1 -1
  50. package/dist/{config-transfer-RUWLDCNK.js → config-transfer-UE37X4B5.js} +2 -2
  51. package/dist/{execution-JEYF2L7O.js → execution-C2IECWF7.js} +4981 -4836
  52. package/dist/execution-chimera-handlers.d.ts +6 -0
  53. package/dist/execution-session-callbacks.d.ts +36 -0
  54. package/dist/execution-webui.d.ts +3 -0
  55. package/dist/execution.d.ts +1 -1
  56. package/dist/fleet/host-acp-runner.d.ts +15 -0
  57. package/dist/fleet/host-budget.d.ts +13 -0
  58. package/dist/fleet/host-context.d.ts +5 -0
  59. package/dist/fleet/host-explore-companion.d.ts +6 -15
  60. package/dist/fleet/host.d.ts +2 -0
  61. package/dist/fleet/status-broadcast.d.ts +1 -1
  62. package/dist/{hq-BNK67HOE.js → hq-KBFDKTDD.js} +13 -7
  63. package/dist/{hq-server-PCQACV7Y.js → hq-server-AVNKZ2PV.js} +2 -2
  64. package/dist/{hq-service-BMMJAHRT.js → hq-service-FGB7BY2D.js} +3 -3
  65. package/dist/index.js +126 -10
  66. package/dist/{mailbox-serve-FW3JCCPK.js → mailbox-serve-S536N66F.js} +3 -2
  67. package/dist/{modeldiag-W7XAE625.js → modeldiag-NEPTLFZW.js} +26 -8
  68. package/dist/{per-subcommand-help-MWQWFIAV.js → per-subcommand-help-VKPV3OEY.js} +2 -2
  69. package/dist/{plugin-usage-CIGOOTX3.js → plugin-usage-3TZGROK7.js} +3 -3
  70. package/dist/{plugins-HQTXUD6A.js → plugins-ITH4SLO6.js} +4 -4
  71. package/dist/pre-launch/project-check.d.ts +2 -8
  72. package/dist/pre-launch.d.ts +1 -1
  73. package/dist/{project-manifest-7NSFVBM3.js → project-manifest-FTFDCCTZ.js} +2 -2
  74. package/dist/{project-picker-SVBXMPKX.js → project-picker-NZYJKQQC.js} +3 -3
  75. package/dist/provider-cloud-config.d.ts +4 -0
  76. package/dist/provider-config-utils.d.ts +1 -1
  77. package/dist/{providers-models-5Z2PJTEW.js → providers-models-O75MKLN2.js} +52 -18
  78. package/dist/{remote-GB5VXCCT.js → remote-C74BCNND.js} +5 -5
  79. package/dist/{rewind-JA3ZLCNM.js → rewind-7AULJS7F.js} +7 -5
  80. package/dist/sandbox-TYGD6FI2.js +131 -0
  81. package/dist/services/sdd/project-context.d.ts +1 -1
  82. package/dist/{sessions-config-JGIZRNT6.js → sessions-config-VE26SB56.js} +5 -5
  83. package/dist/short-circuit-flags-D6VAG47Y.js +10 -0
  84. package/dist/slash-commands/openai-quota.d.ts +12 -6
  85. package/dist/slash-commands/sandbox.d.ts +5 -0
  86. package/dist/slash-commands/scout-stats.d.ts +46 -0
  87. package/dist/slash-commands/sdd-inspect-commands.d.ts +9 -0
  88. package/dist/slash-commands/sdd-session-commands.d.ts +19 -0
  89. package/dist/slash-commands/sdd.d.ts +1 -1
  90. package/dist/slash-commands/zai-plan.d.ts +26 -0
  91. package/dist/{standalone-auto-update-TOTRGCSA.js → standalone-auto-update-VQC4GYCM.js} +3 -3
  92. package/dist/{standalone-update-LZO3MNLH.js → standalone-update-HZHDZZOR.js} +2 -2
  93. package/dist/subcommands/handlers/automation-credentials.d.ts +8 -0
  94. package/dist/subcommands/handlers/automation.d.ts +3 -0
  95. package/dist/subcommands/handlers/bench-experiments.d.ts +5 -0
  96. package/dist/subcommands/handlers/sandbox.d.ts +5 -0
  97. package/dist/{subcommands-WX4GDMWB.js → subcommands-CLI6QTLU.js} +2 -2
  98. package/dist/{tools-skills-GH24UCBY.js → tools-skills-33AI6K6S.js} +2 -2
  99. package/dist/tui-provider-quota-menu.d.ts +5 -0
  100. package/dist/{typesafe-WA5O3KVS.js → typesafe-NHC322W5.js} +27 -8
  101. package/dist/{typesafe-topic-replay-ZILIU3WS.js → typesafe-topic-replay-DB2AYL7V.js} +2 -2
  102. package/dist/{typesafe-triage-replay-FGAW7QM7.js → typesafe-triage-replay-27NDAZ3V.js} +2 -2
  103. package/dist/{update-TDZX4IL2.js → update-J5WHAFPE.js} +3 -3
  104. package/dist/{update-check-J5ZVKS73.js → update-check-VLVT4IV2.js} +2 -2
  105. package/dist/{version-help-HN32QYQN.js → version-help-ATOKGMTK.js} +2 -2
  106. package/dist/webui-server/prefs-seeding.d.ts +1 -0
  107. package/dist/webui-server/route-contexts.d.ts +1 -0
  108. package/dist/{webui-server-EXJWLB3X.js → webui-server-GQOVLQS3.js} +71 -34
  109. package/dist/webui-session-retirement.d.ts +10 -0
  110. package/dist/wiring/command-host-state.d.ts +2 -0
  111. package/dist/wiring/director-announcement.d.ts +3 -1
  112. package/dist/wiring/session-establishment.d.ts +10 -8
  113. package/dist/wiring/session-runtime.d.ts +1 -1
  114. package/dist/wiring/session.d.ts +3 -0
  115. package/package.json +30 -30
  116. package/dist/auto-discover-providers-DXR25GTG.js +0 -7
  117. package/dist/chunk-D5GB5MHA.js +0 -87
  118. package/dist/chunk-SIGUWXAA.js +0 -43
  119. package/dist/short-circuit-flags-5N2LPK4R.js +0 -10
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-5UZBUV2H.js";
4
4
  import {
5
5
  mutateConfigProviders
6
- } from "./chunk-LUMETJFO.js";
6
+ } from "./chunk-ZYACRPLN.js";
7
7
  import {
8
8
  activeProfileConfigPath
9
9
  } from "./chunk-YMXXOOFN.js";
@@ -243,12 +243,13 @@ ${navLines.join(" \xB7 ")}
243
243
  function aliasProviderId(configProviderId, cfg) {
244
244
  return cfg?.type && cfg.type !== configProviderId ? cfg.type : configProviderId;
245
245
  }
246
- async function discoverProviderModels(deps, ids) {
246
+ async function discoverProviderModels(deps, ids, onlyProviderId) {
247
247
  if (!("mergeOverlay" in deps.modelsRegistry)) return void 0;
248
248
  try {
249
- const { discoverAndMergeProviders } = await import("./auto-discover-providers-DXR25GTG.js");
249
+ const { discoverAndMergeProviders } = await import("./auto-discover-providers-JX346GOM.js");
250
+ const only = onlyProviderId ? deps.config.providers?.[onlyProviderId] : void 0;
250
251
  await discoverAndMergeProviders({
251
- config: deps.config,
252
+ config: only ? { ...deps.config, providers: { [onlyProviderId]: only } } : deps.config,
252
253
  registry: deps.modelsRegistry,
253
254
  cacheDir: deps.paths.cacheDir
254
255
  });
@@ -263,6 +264,10 @@ async function discoverProviderModels(deps, ids) {
263
264
  }
264
265
  async function getCatalogProviderForConfigProvider(providerId, deps) {
265
266
  const cfg = deps.config.providers?.[providerId];
267
+ if (usesAccountCatalog(cfg)) {
268
+ const found = await discoverProviderModels(deps, [providerId], providerId);
269
+ if (found) return { providerId, provider: found };
270
+ }
266
271
  const lookupId = aliasProviderId(providerId, cfg);
267
272
  const provider = await deps.modelsRegistry.getProvider(lookupId);
268
273
  if (provider) return { providerId: lookupId, provider };
@@ -271,6 +276,10 @@ async function getCatalogProviderForConfigProvider(providerId, deps) {
271
276
  provider: await discoverProviderModels(deps, [lookupId, providerId])
272
277
  };
273
278
  }
279
+ function usesAccountCatalog(cfg) {
280
+ const active = cfg?.apiKeys?.find((key) => key.label === cfg.activeKey) ?? cfg?.apiKeys?.[0];
281
+ return active?.authMethod === "oauth";
282
+ }
274
283
  function uniqueStrings(values) {
275
284
  return [...new Set(values.map((v) => v.trim()).filter(Boolean))];
276
285
  }
@@ -312,10 +321,7 @@ async function modelsHide(args, deps) {
312
321
  p.models = nextVisible;
313
322
  }
314
323
  );
315
- deps.config.providers = {
316
- ...deps.config.providers ?? {},
317
- [providerId]: { ...saved, models: nextVisible }
318
- };
324
+ publishProviderConfig(deps, providerId, { ...saved, models: nextVisible });
319
325
  deps.renderer.writeInfo(
320
326
  `Hidden ${providerId}/${modelId}. Visible: ${nextVisible.length}, hidden: ${Math.max(0, knownIds.length - nextVisible.length)}.`
321
327
  );
@@ -365,10 +371,7 @@ async function modelsShow(args, deps) {
365
371
  p.models = nextVisible;
366
372
  }
367
373
  );
368
- deps.config.providers = {
369
- ...deps.config.providers ?? {},
370
- [providerId]: { ...saved, models: nextVisible }
371
- };
374
+ publishProviderConfig(deps, providerId, { ...saved, models: nextVisible });
372
375
  const isKnown = knownIds.includes(modelId);
373
376
  deps.renderer.writeInfo(
374
377
  `Visible ${providerId}/${modelId}${isKnown ? "" : " (not in current catalog)"}. Visible: ${nextVisible.length}.`
@@ -414,10 +417,40 @@ Restore: wstack models show ${providerId} <model> \xB7 reset ${providerId}
414
417
  );
415
418
  return 0;
416
419
  }
420
+ function publishProviderConfig(deps, providerId, next) {
421
+ deps.config = {
422
+ ...deps.config,
423
+ providers: { ...deps.config.providers ?? {}, [providerId]: next }
424
+ };
425
+ }
426
+ async function modelsResetCustomModel(providerId, modelId, saved, deps) {
427
+ if (!saved.customModels || !Object.hasOwn(saved.customModels, modelId)) {
428
+ deps.renderer.writeInfo(`${providerId}/${modelId} has no custom definition; nothing to reset.`);
429
+ return 0;
430
+ }
431
+ await mutateConfigProviders(
432
+ activeProfileConfigPath(deps.paths, deps.config),
433
+ deps.vault,
434
+ (providers) => {
435
+ const p = providers[providerId];
436
+ if (!p?.customModels) return;
437
+ delete p.customModels[modelId];
438
+ if (Object.keys(p.customModels).length === 0) delete p.customModels;
439
+ }
440
+ );
441
+ const { [modelId]: _dropped, ...rest } = saved.customModels;
442
+ const next = { ...saved };
443
+ if (Object.keys(rest).length > 0) next.customModels = rest;
444
+ else delete next.customModels;
445
+ publishProviderConfig(deps, providerId, next);
446
+ deps.renderer.writeInfo(`Reset ${providerId}/${modelId} to the catalog definition.`);
447
+ return 0;
448
+ }
417
449
  async function modelsReset(args, deps) {
418
450
  const providerId = args[0];
451
+ const modelId = args[1];
419
452
  if (!providerId) {
420
- deps.renderer.writeError("Usage: wstack models reset <provider>");
453
+ deps.renderer.writeError("Usage: wstack models reset <provider> [model]");
421
454
  return 1;
422
455
  }
423
456
  const saved = deps.config.providers?.[providerId];
@@ -425,6 +458,7 @@ async function modelsReset(args, deps) {
425
458
  deps.renderer.writeError(`Provider "${providerId}" is not configured.`);
426
459
  return 1;
427
460
  }
461
+ if (modelId) return modelsResetCustomModel(providerId, modelId, saved, deps);
428
462
  if (saved.models === void 0) {
429
463
  deps.renderer.writeInfo(`${providerId} already shows the full catalog model list.`);
430
464
  return 0;
@@ -440,10 +474,7 @@ async function modelsReset(args, deps) {
440
474
  );
441
475
  const nextProvider = { ...saved };
442
476
  delete nextProvider.models;
443
- deps.config.providers = {
444
- ...deps.config.providers ?? {},
445
- [providerId]: nextProvider
446
- };
477
+ publishProviderConfig(deps, providerId, nextProvider);
447
478
  deps.renderer.writeInfo(
448
479
  `Reset visible model list for ${providerId} to the full catalog default.`
449
480
  );
@@ -457,6 +488,9 @@ async function modelsCaps(args, deps) {
457
488
  deps.renderer.write(color.dim("Defaults to current configured provider/model when omitted.\n"));
458
489
  return 1;
459
490
  }
491
+ if (usesAccountCatalog(deps.config.providers?.[providerId])) {
492
+ await discoverProviderModels(deps, [providerId], providerId);
493
+ }
460
494
  const resolved = await deps.modelsRegistry.getModel(providerId, modelId);
461
495
  if (!resolved) {
462
496
  deps.renderer.writeError("Model not found in catalog: " + providerId + "/" + modelId);
@@ -670,4 +704,4 @@ export {
670
704
  modelsCmd,
671
705
  providersCmd
672
706
  };
673
- //# sourceMappingURL=providers-models-5Z2PJTEW.js.map
707
+ //# sourceMappingURL=providers-models-O75MKLN2.js.map
@@ -1,16 +1,16 @@
1
+ import {
2
+ openBrowser
3
+ } from "./chunk-DAKVBMD4.js";
1
4
  import {
2
5
  MAX_BINARY_BYTES,
3
6
  downloadReleaseAssetToFile,
4
7
  findStandaloneRelease,
5
8
  verifyStandaloneDigest
6
- } from "./chunk-X756ZS72.js";
9
+ } from "./chunk-SUDNPYWD.js";
7
10
  import {
8
11
  CLI_VERSION,
9
12
  STANDALONE_TARGET
10
13
  } from "./chunk-F5DCFAKI.js";
11
- import {
12
- openBrowser
13
- } from "./chunk-DAKVBMD4.js";
14
14
 
15
15
  // src/subcommands/handlers/remote.ts
16
16
  import * as fsp2 from "node:fs/promises";
@@ -573,4 +573,4 @@ export {
573
573
  remoteCmd,
574
574
  runRemoteCommand
575
575
  };
576
- //# sourceMappingURL=remote-GB5VXCCT.js.map
576
+ //# sourceMappingURL=remote-C74BCNND.js.map
@@ -94,8 +94,9 @@ var rewindCmd = async (args, deps) => {
94
94
  deps.renderer.write("Rewinding to session start...\n");
95
95
  result = await rewind.rewindToStart(targetSessionId);
96
96
  } else if (flags.last) {
97
- const n = Number.parseInt(flags.last, 10);
98
- if (Number.isNaN(n) || n < 1) {
97
+ const raw = flags.last.trim();
98
+ const n = /^\d+$/.test(raw) ? Number(raw) : Number.NaN;
99
+ if (!Number.isSafeInteger(n) || n < 1) {
99
100
  deps.renderer.writeError("--last requires a positive number");
100
101
  return 1;
101
102
  }
@@ -104,8 +105,9 @@ var rewindCmd = async (args, deps) => {
104
105
  `);
105
106
  result = await rewind.rewindLastN(targetSessionId, n);
106
107
  } else if (flags.to) {
107
- const idx = Number.parseInt(flags.to, 10);
108
- if (Number.isNaN(idx) || idx < 0) {
108
+ const raw = flags.to.trim();
109
+ const idx = /^\d+$/.test(raw) ? Number(raw) : Number.NaN;
110
+ if (!Number.isSafeInteger(idx) || idx < 0) {
109
111
  deps.renderer.writeError("--to requires a non-negative number");
110
112
  return 1;
111
113
  }
@@ -185,4 +187,4 @@ ${result.errors.length} error(s):
185
187
  export {
186
188
  rewindCmd
187
189
  };
188
- //# sourceMappingURL=rewind-JA3ZLCNM.js.map
190
+ //# sourceMappingURL=rewind-7AULJS7F.js.map
@@ -0,0 +1,131 @@
1
+
2
+ // src/subcommands/handlers/sandbox.ts
3
+ import { mkdir } from "node:fs/promises";
4
+ import * as path from "node:path";
5
+ import { atomicWrite, toErrorMessage } from "@wrongstack/core/utils";
6
+ import { createHeadlessLaunchPlan, runDockerWorkspace } from "@wrongstack/runtime";
7
+ var sandboxCmd = (args, deps) => runSandboxCommand(args, deps.flags ?? {}, deps.renderer);
8
+ var USAGE = `Usage: wstack sandbox docker --image <trusted-image> --prompt <task> [options]
9
+
10
+ Runs the entire WrongStack agent in a copied Docker workspace. Your local project
11
+ and home are not mounted. Returns a patch against the imported snapshot; nothing
12
+ is automatically applied to your working tree.
13
+
14
+ Build the supplied runtime image from a published version:
15
+ docker build --build-arg WRONGSTACK_VERSION=<version> -t wrongstack-sandbox containers/sandbox
16
+
17
+ Options:
18
+ --image <image> Required image with wstack, git and sh installed
19
+ --prompt <task> Required task for the isolated agent
20
+ --provider <id> Provider to use inside the container
21
+ --model <id> Model to use inside the container
22
+ --env <NAME,...> Explicit host env names to forward (no values on argv)
23
+ --network <bridge|none> Docker networking (default bridge)
24
+ --timeout <seconds> Entire agent command limit (default 600)
25
+ --out <directory> Patch and run metadata directory
26
+ --yolo Enable YOLO inside this container only
27
+ --max-iterations <n> Agent iteration limit (default 40, maximum 1000)
28
+ --dry-run Validate and print a plan without starting Docker
29
+ --help Show this help
30
+
31
+ Binary/image previews and OAuth credential-file import are not part of this
32
+ launcher. Use API credentials forwarded explicitly, or a separately configured
33
+ trusted image. The default image and packages are never silently selected.
34
+ `;
35
+ async function runSandboxCommand(args, flags, renderer) {
36
+ if (flags["help"] || args[0] === "help") {
37
+ renderer.write(USAGE);
38
+ return 0;
39
+ }
40
+ const image = typeof flags["image"] === "string" ? flags["image"] : "";
41
+ const prompt = typeof flags["prompt"] === "string" ? flags["prompt"] : "";
42
+ if (args[0] !== "docker" || !image || !prompt) {
43
+ renderer.write(USAGE);
44
+ return 2;
45
+ }
46
+ const network = flags["network"] ?? "bridge";
47
+ if (network !== "bridge" && network !== "none") {
48
+ renderer.write("sandbox: network must be bridge or none\n");
49
+ return 2;
50
+ }
51
+ const timeoutMs = Number(flags["timeout"] ?? 600) * 1e3;
52
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1e3 || timeoutMs > 864e5) {
53
+ renderer.write("sandbox: timeout must be 1 to 86400 seconds\n");
54
+ return 2;
55
+ }
56
+ const envNames = typeof flags["env"] === "string" ? flags["env"].split(",").map((name) => name.trim()).filter(Boolean) : [];
57
+ const abort = new AbortController();
58
+ const cancel = () => abort.abort();
59
+ process.once("SIGINT", cancel);
60
+ process.once("SIGTERM", cancel);
61
+ try {
62
+ const plan = createHeadlessLaunchPlan({
63
+ name: "sandbox",
64
+ projectRoot: process.cwd(),
65
+ image,
66
+ prompt,
67
+ provider: typeof flags["provider"] === "string" ? flags["provider"] : void 0,
68
+ model: typeof flags["model"] === "string" ? flags["model"] : void 0,
69
+ envNames,
70
+ yolo: flags["yolo"] === true,
71
+ enabled: true,
72
+ timeoutMs,
73
+ maxIterations: flags["max-iterations"] === void 0 ? 40 : Number(flags["max-iterations"])
74
+ });
75
+ if (flags["dry-run"] === true) {
76
+ renderer.write(
77
+ `${JSON.stringify({ ...plan, network, missingEnvironment: envNames.filter((name) => !process.env[name]) }, null, 2)}
78
+ `
79
+ );
80
+ return 0;
81
+ }
82
+ const result = await runDockerWorkspace({
83
+ projectRoot: process.cwd(),
84
+ image,
85
+ command: "wstack",
86
+ args: plan.args,
87
+ envNames,
88
+ network,
89
+ timeoutMs,
90
+ signal: abort.signal,
91
+ onOutput: (text) => renderer.write(text)
92
+ });
93
+ const out = path.resolve(
94
+ typeof flags["out"] === "string" ? flags["out"] : path.join(process.cwd(), ".wrongstack", "sandbox-runs", result.id)
95
+ );
96
+ await mkdir(out, { recursive: true });
97
+ if (result.patch !== null) await atomicWrite(path.join(out, "changes.patch"), result.patch);
98
+ const { patch: _patch, output: _output, ...metadata } = result;
99
+ await atomicWrite(
100
+ path.join(out, "run.json"),
101
+ `${JSON.stringify({ ...metadata, image, projectRoot: process.cwd(), network }, null, 2)}
102
+ `
103
+ );
104
+ renderer.write(
105
+ `
106
+ Sandbox exit: ${result.exitCode}
107
+ ${result.patch !== null ? `Patch: ${path.join(out, "changes.patch")}
108
+ ` : `Partial workspace: wrongstack-${result.id}
109
+ `}Metadata: ${path.join(out, "run.json")}
110
+ `
111
+ );
112
+ if (result.cleanup === "retained")
113
+ renderer.write("Stopped container retained for recovery; no patch was claimed.\n");
114
+ if (result.cleanup === "unverified")
115
+ renderer.write(`Container cleanup could not be verified: wrongstack-${result.id}
116
+ `);
117
+ return result.exitCode;
118
+ } catch (error) {
119
+ renderer.write(`sandbox: ${toErrorMessage(error)}
120
+ `);
121
+ return abort.signal.aborted ? 130 : 1;
122
+ } finally {
123
+ process.removeListener("SIGINT", cancel);
124
+ process.removeListener("SIGTERM", cancel);
125
+ }
126
+ }
127
+ export {
128
+ runSandboxCommand,
129
+ sandboxCmd
130
+ };
131
+ //# sourceMappingURL=sandbox-TYGD6FI2.js.map
@@ -3,5 +3,5 @@ export { gatherProjectContext } from '@wrongstack/sdd';
3
3
  export declare function getActiveBuilder(): AISpecBuilder | null;
4
4
  export declare function getActiveSDDContext(): string | null;
5
5
  export declare function getActiveSDDPhase(): AISpecPhase | null;
6
- export declare function findSpec(store: SpecStore, idOrTitle: string): Promise<import("@wrongstack/core").Specification | null>;
6
+ export declare function findSpec(store: SpecStore, idOrTitle: string): Promise<import("@wrongstack/core/types").Specification | null>;
7
7
  //# sourceMappingURL=project-context.d.ts.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  activeProfileConfigPath
3
3
  } from "./chunk-YMXXOOFN.js";
4
- import {
5
- restoreFlags
6
- } from "./chunk-CSAPOCBP.js";
7
4
  import {
8
5
  backupCurrent,
9
6
  getHistoryEntry,
10
7
  listHistory,
11
8
  restoreFromHistory,
12
9
  restoreLast
13
- } from "./chunk-WSTVGC2C.js";
10
+ } from "./chunk-4BX2YDTQ.js";
11
+ import {
12
+ restoreFlags
13
+ } from "./chunk-CSAPOCBP.js";
14
14
 
15
15
  // src/subcommands/handlers/sessions-config.ts
16
16
  import * as path2 from "node:path";
@@ -536,4 +536,4 @@ export {
536
536
  configCmd,
537
537
  sessionsCmd
538
538
  };
539
- //# sourceMappingURL=sessions-config-JGIZRNT6.js.map
539
+ //# sourceMappingURL=sessions-config-VE26SB56.js.map
@@ -0,0 +1,10 @@
1
+ import {
2
+ handleHelpVersionShortCircuit
3
+ } from "./chunk-SWOPJHXI.js";
4
+ import "./chunk-MPQCHBDJ.js";
5
+ import "./chunk-WHEYHDIE.js";
6
+ import "./chunk-F5DCFAKI.js";
7
+ export {
8
+ handleHelpVersionShortCircuit
9
+ };
10
+ //# sourceMappingURL=short-circuit-flags-D6VAG47Y.js.map
@@ -13,21 +13,27 @@
13
13
  * below reads only the neutral shape. A second metered provider needs a
14
14
  * reporter and a one-line command, not a second copy of this file.
15
15
  *
16
- * The reading is observational: it appears after the first request of the
17
- * session, not before, and it is never fetched on its own — spending a request
18
- * to ask "how much have I spent" is exactly the wrong trade on a metered plan.
16
+ * Two sources feed it. The headers keep it current as turns run; before any
17
+ * turn, the command asks the account usage endpoint (`/wham/usage`, the read
18
+ * behind the official client's `/status`) through the active ChatGPT
19
+ * transport. That read is a status call, not a model call — it spends none of
20
+ * the plan it reports.
19
21
  *
20
22
  * Usage:
21
23
  * /openai-quota Show the latest reading for every metered window
22
24
  */
23
25
  import { type ProviderQuotaSnapshot } from '@wrongstack/core/quota';
24
- import type { SlashCommand } from '@wrongstack/core/types';
26
+ import type { ProviderConfig, SlashCommand } from '@wrongstack/core/types';
27
+ /** Where the saved providers come from — the live config in a session. */
28
+ export interface QuotaCommandDeps {
29
+ providers?: () => Readonly<Record<string, ProviderConfig>> | undefined;
30
+ }
25
31
  /**
26
32
  * Render one meter. Provider-neutral by construction — everything it reads is
27
33
  * on the shared snapshot shape.
28
34
  */
29
35
  export declare function renderQuotaSnapshot(snapshot: ProviderQuotaSnapshot): string[];
30
- export declare function buildOpenAIQuotaCommand(): SlashCommand;
36
+ export declare function buildOpenAIQuotaCommand(deps?: QuotaCommandDeps): SlashCommand;
31
37
  /**
32
38
  * `/provider-quota` — every metered subscription this session has heard from.
33
39
  *
@@ -42,5 +48,5 @@ export declare function buildOpenAIQuotaCommand(): SlashCommand;
42
48
  * and would occupy the name if one is ever built. What this shows is exactly
43
49
  * the provider plane's readings, so that is what it is called.
44
50
  */
45
- export declare function buildProviderQuotaCommand(): SlashCommand;
51
+ export declare function buildProviderQuotaCommand(deps?: QuotaCommandDeps): SlashCommand;
46
52
  //# sourceMappingURL=openai-quota.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { SlashCommand } from '@wrongstack/core/types';
2
+ import type { SlashCommandContext } from './command-context.js';
3
+ /** CLI active-tier indicator (plan 28 T3; TUI/WebUI panels remain T9). */
4
+ export declare function buildSandboxCommand(_opts: SlashCommandContext): SlashCommand;
5
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -0,0 +1,46 @@
1
+ import type { SessionEvent, SlashCommand } from '@wrongstack/core/types';
2
+ import type { SlashCommandContext } from './command-context.js';
3
+ /**
4
+ * `/scout-stats` — does the Scout identity behave the way its prompt asks?
5
+ *
6
+ * Measured from session journals at read time (nothing is recorded for it):
7
+ * every `llm_request` carries the identity variant it ran under, and tool
8
+ * calls are journaled as `tool_call_start` events. Two behaviours are the
9
+ * point of Scout, so they lead the report next to the other variants:
10
+ *
11
+ * - discovery — how often `tool_search` comes back empty, and how often a tool
12
+ * it surfaced is then called through `tool_use`;
13
+ * - delegation — the share of runs that hand work to a subagent, against runs
14
+ * that did a lot of tool work alone.
15
+ */
16
+ /** Tool calls in one run, without a delegation, that count as "worked alone". */
17
+ export declare const SOLO_HEAVY_TOOL_CALLS = 8;
18
+ export interface VariantUsage {
19
+ variant: string;
20
+ sessions: number;
21
+ runs: number;
22
+ requests: number;
23
+ inputTokens: number;
24
+ outputTokens: number;
25
+ toolCalls: number;
26
+ /** Calls routed through the `tool_use` gateway (schema was not direct). */
27
+ lazyCalls: number;
28
+ searches: number;
29
+ emptySearches: number;
30
+ /** `tool_use` calls whose target an earlier search in the run returned. */
31
+ searchedThenUsed: number;
32
+ delegations: number;
33
+ runsWithDelegation: number;
34
+ /** Runs with at least {@link SOLO_HEAVY_TOOL_CALLS} tool calls and no delegation. */
35
+ soloHeavyRuns: number;
36
+ }
37
+ /**
38
+ * Aggregate journals per identity variant. A run starts at each `user_input`
39
+ * and belongs to the variant of its first `llm_request`; a journal written
40
+ * before requests recorded their variant is reported as `unrecorded`.
41
+ */
42
+ export declare function summarizeVariantUsage(sessions: readonly (readonly SessionEvent[])[]): VariantUsage[];
43
+ /** One block per variant; Scout first, since the command exists to judge it. */
44
+ export declare function formatVariantUsage(usage: readonly VariantUsage[], sessionCount: number): string;
45
+ export declare function buildScoutStatsCommand(opts: SlashCommandContext): SlashCommand;
46
+ //# sourceMappingURL=scout-stats.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type { SlashCommand } from '@wrongstack/core/types';
2
+ export declare function runSddInspectCommand(inputs: {
3
+ cmd: string;
4
+ opts: import('./command-context.js').SlashCommandContext;
5
+ specStore: import('@wrongstack/sdd').SpecStore;
6
+ restJoined: string;
7
+ versioning: import('@wrongstack/sdd').SpecVersioning;
8
+ }): ReturnType<SlashCommand['run']>;
9
+ //# sourceMappingURL=sdd-inspect-commands.d.ts.map
@@ -0,0 +1,19 @@
1
+ import type { SlashCommand } from '@wrongstack/core/types';
2
+ export declare function runSddSessionCommand(inputs: {
3
+ cmd: string;
4
+ restArgs: string[];
5
+ sessionState: import('../services/sdd/state.js').SDDState;
6
+ projectRoot: string;
7
+ specStore: import('@wrongstack/sdd').SpecStore;
8
+ sessionPersistenceOptions: {
9
+ sessionPersistence: import('@wrongstack/sdd').AISpecSessionPersistence;
10
+ sessionPath?: never;
11
+ } | {
12
+ sessionPath: string;
13
+ sessionPersistence?: never;
14
+ };
15
+ opts: import('./command-context.js').SlashCommandContext;
16
+ versioning: import('@wrongstack/sdd').SpecVersioning;
17
+ sessionPersistence: import('@wrongstack/sdd').AISpecSessionPersistence | undefined;
18
+ }): ReturnType<SlashCommand['run']>;
19
+ //# sourceMappingURL=sdd-session-commands.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { SlashCommand } from '@wrongstack/core/types';
2
- import { renderProgress, TaskTracker } from '@wrongstack/sdd';
2
+ import { renderProgress, type TaskTracker } from '@wrongstack/sdd';
3
3
  import type { SlashCommandContext } from './command-context.js';
4
4
  export type { TaskProgress } from '@wrongstack/core/types';
5
5
  export { findSpec, gatherProjectContext, getActiveBuilder, getActiveSDDContext, getActiveSDDPhase, } from '../services/sdd/project-context.js';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `/zai-plan` — the Z.AI / BigModel GLM Coding Plan, the way the official
3
+ * ZCode client's usage panel shows it: the subscription in force, the 5-hour
4
+ * and weekly model windows, the monthly MCP tool-call pool, the last days'
5
+ * token usage per model with the cache-hit rate, and the platform's own
6
+ * service health.
7
+ *
8
+ * Unlike `/provider-quota`, which only replays what turns already observed,
9
+ * this asks: every section is an account read on the monitor API. None of
10
+ * them is a model call, so the plan it describes is not spent by looking.
11
+ *
12
+ * It reports on the Z.AI / BigModel providers built in this session (the key
13
+ * lives with the transport, not here). Team plans need organization/project
14
+ * scoping that only ZCode's OAuth login carries; this reads the personal plan
15
+ * the API key belongs to.
16
+ *
17
+ * Usage:
18
+ * /zai-plan Plan, quota and the last 7 days
19
+ * /zai-plan <days> Same, with a 1–30 day usage window
20
+ */
21
+ import type { SlashCommand } from '@wrongstack/core/types';
22
+ import { type ZaiAccountHandle } from '@wrongstack/providers';
23
+ export declare function buildZaiPlanCommand(deps?: {
24
+ accounts?: () => readonly ZaiAccountHandle[];
25
+ }): SlashCommand;
26
+ //# sourceMappingURL=zai-plan.d.ts.map
@@ -4,10 +4,10 @@ import {
4
4
  findStandaloneRelease,
5
5
  installExecutableFrom,
6
6
  verifyStandaloneDigest
7
- } from "./chunk-X756ZS72.js";
7
+ } from "./chunk-SUDNPYWD.js";
8
8
  import {
9
9
  isNewer
10
- } from "./chunk-RZ4ZDRYA.js";
10
+ } from "./chunk-DIOODAYM.js";
11
11
  import {
12
12
  CLI_VERSION,
13
13
  STANDALONE_TARGET
@@ -246,4 +246,4 @@ export {
246
246
  startStandaloneAutoUpdate,
247
247
  takeAppliedUpdate
248
248
  };
249
- //# sourceMappingURL=standalone-auto-update-TOTRGCSA.js.map
249
+ //# sourceMappingURL=standalone-auto-update-VQC4GYCM.js.map
@@ -8,7 +8,7 @@ import {
8
8
  standaloneAssetName,
9
9
  updateStandaloneBinary,
10
10
  verifyStandaloneDigest
11
- } from "./chunk-X756ZS72.js";
11
+ } from "./chunk-SUDNPYWD.js";
12
12
  import "./chunk-F5DCFAKI.js";
13
13
  export {
14
14
  MAX_BINARY_BYTES,
@@ -21,4 +21,4 @@ export {
21
21
  updateStandaloneBinary,
22
22
  verifyStandaloneDigest
23
23
  };
24
- //# sourceMappingURL=standalone-update-LZO3MNLH.js.map
24
+ //# sourceMappingURL=standalone-update-HZHDZZOR.js.map
@@ -0,0 +1,8 @@
1
+ import type { SecretVault } from '@wrongstack/core/types';
2
+ import type { WstackPaths } from '@wrongstack/core/utils';
3
+ import { type CredentialReference, type ResolvedCredentialBundle } from '@wrongstack/runtime';
4
+ /** Read the existing machine profile at use time, so ordinary key rotation is visible. */
5
+ export declare function resolveAutomationCredentials(refs: readonly CredentialReference[], paths: Pick<WstackPaths, 'profileConfig'>, vault: SecretVault): Promise<Readonly<Record<string, string>>>;
6
+ /** Endpoint and key are read from the same atomic profile snapshot. */
7
+ export declare function resolveAutomationCredentialBundle(refs: readonly CredentialReference[], paths: Pick<WstackPaths, 'profileConfig'>, vault: SecretVault): Promise<ResolvedCredentialBundle>;
8
+ //# sourceMappingURL=automation-credentials.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { SubcommandHandler } from '../contracts.js';
2
+ export declare const automationCmd: SubcommandHandler;
3
+ //# sourceMappingURL=automation.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { type QualityReviewPolicy } from '@wrongstack/bench';
2
+ import type { SubcommandDeps } from '../contracts.js';
3
+ export declare function benchExperimentCommand(action: string, args: string[], deps: SubcommandDeps): Promise<number>;
4
+ export declare function readBenchReviewPolicy(file: string): Promise<QualityReviewPolicy>;
5
+ //# sourceMappingURL=bench-experiments.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { TerminalRenderer } from '../../renderer.js';
2
+ import type { SubcommandHandler } from '../contracts.js';
3
+ export declare const sandboxCmd: SubcommandHandler;
4
+ export declare function runSandboxCommand(args: string[], flags: Record<string, string | boolean>, renderer: TerminalRenderer): Promise<number>;
5
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  subcommandNames,
3
3
  subcommands
4
- } from "./chunk-KT34LWIS.js";
4
+ } from "./chunk-24C6VVLM.js";
5
5
  export {
6
6
  subcommandNames,
7
7
  subcommands
8
8
  };
9
- //# sourceMappingURL=subcommands-WX4GDMWB.js.map
9
+ //# sourceMappingURL=subcommands-CLI6QTLU.js.map
@@ -6,7 +6,7 @@ var toolsCmd = async (_args, deps) => {
6
6
  if (!reg) return 0;
7
7
  for (const { tool, owner } of reg.listWithOwner())
8
8
  deps.renderer.write(
9
- ` ${tool.name.padEnd(28)} ${color.dim(`[${owner}]`)} ${tool.permission}
9
+ ` ${(tool.name === "tool_script" ? "tool_script / ToolFlow" : tool.name).padEnd(28)} ${color.dim(`[${owner}]`)} ${tool.permission}
10
10
  `
11
11
  );
12
12
  return 0;
@@ -25,4 +25,4 @@ export {
25
25
  skillsCmd,
26
26
  toolsCmd
27
27
  };
28
- //# sourceMappingURL=tools-skills-GH24UCBY.js.map
28
+ //# sourceMappingURL=tools-skills-33AI6K6S.js.map
@@ -0,0 +1,5 @@
1
+ import type { ProviderConfig } from '@wrongstack/core/types';
2
+ import type { ResourceMenuSnapshot } from '@wrongstack/tui';
3
+ /** One provider per row, with all its meters in the detail pane. */
4
+ export declare function providerQuotaMenu(providers: Readonly<Record<string, ProviderConfig>> | undefined): ResourceMenuSnapshot;
5
+ //# sourceMappingURL=tui-provider-quota-menu.d.ts.map