@wrongstack/cli 1.0.24 → 1.0.26

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 (124) hide show
  1. package/data/providers.json +44 -0
  2. package/dist/{acp-AJWSKWE5.js → acp-LI665LO2.js} +5 -5
  3. package/dist/ascii-mode-SG4PRNLP.js +7 -0
  4. package/dist/{auth-GRBZ7Y3D.js → auth-TE55JF4Z.js} +14 -14
  5. package/dist/{bench-N5K7Z5O3.js → bench-GTLPM22B.js} +2 -2
  6. package/dist/boot/append-system-prompt.d.ts +10 -0
  7. package/dist/boot/ascii-mode.d.ts +12 -0
  8. package/dist/boot/container-wiring.d.ts +4 -2
  9. package/dist/boot/dispatch-singleshot.d.ts +4 -1
  10. package/dist/boot/mcp-config-flag.d.ts +22 -0
  11. package/dist/boot/piped-stdin.d.ts +40 -0
  12. package/dist/boot/restricted-mode.d.ts +15 -0
  13. package/dist/boot/safe-mode.d.ts +30 -0
  14. package/dist/boot/single-shot-budget.d.ts +30 -0
  15. package/dist/boot/stream-json.d.ts +36 -0
  16. package/dist/boot/structured-output.d.ts +16 -0
  17. package/dist/boot/system-prompt-builder.d.ts +2 -0
  18. package/dist/boot/tool-restriction-flags.d.ts +36 -0
  19. package/dist/boot/worktree-sessions.d.ts +21 -0
  20. package/dist/boot-provider-selection.d.ts +67 -0
  21. package/dist/boot.d.ts +1 -38
  22. package/dist/{chunk-LFMVHT3R.js → chunk-2ERX3RPN.js} +11 -13
  23. package/dist/chunk-4TVYGG6G.js +62 -0
  24. package/dist/chunk-5JYDKG5B.js +154 -0
  25. package/dist/{chunk-3VXYY5JC.js → chunk-5UZBUV2H.js} +3 -19
  26. package/dist/chunk-BEHGRNOQ.js +58 -0
  27. package/dist/chunk-CZTXF6HY.js +140 -0
  28. package/dist/{chunk-SKPDE62W.js → chunk-EPR42SWM.js} +36 -6
  29. package/dist/{chunk-YBUCXXYZ.js → chunk-F5DCFAKI.js} +1 -1
  30. package/dist/chunk-HLSHFXTO.js +97 -0
  31. package/dist/{chunk-BLD5DSVA.js → chunk-KJS5543T.js} +2 -2
  32. package/dist/{chunk-QFPQXKCG.js → chunk-KOEO4CJG.js} +21 -6
  33. package/dist/chunk-LBPLTTZ6.js +105 -0
  34. package/dist/{chunk-3OCUS3VN.js → chunk-LDCGZJTC.js} +4 -4
  35. package/dist/chunk-LKPEBZBE.js +143 -0
  36. package/dist/{chunk-DRM7PSW7.js → chunk-OAVBM55Q.js} +3 -3
  37. package/dist/chunk-PZQBGUVZ.js +18 -0
  38. package/dist/{chunk-MHEBWVXL.js → chunk-Q4INH2DG.js} +46 -2
  39. package/dist/{chunk-ZZRSG7VK.js → chunk-RZ4ZDRYA.js} +3 -3
  40. package/dist/{chunk-U46QR4WR.js → chunk-TI7KLHYX.js} +132 -3
  41. package/dist/{chunk-PGKJ2OQP.js → chunk-WQV2NP57.js} +5 -5
  42. package/dist/chunk-X756ZS72.js +329 -0
  43. package/dist/{chunk-JF2MULWF.js → chunk-YHYINL47.js} +47 -15
  44. package/dist/{cli-context-34Q5IJRA.js → cli-context-UVGAN3NO.js} +407 -327
  45. package/dist/{cli-main-AELJDBGU.js → cli-main-TN3KZ2P6.js} +2652 -1978
  46. package/dist/cli-update-notice.d.ts +2 -1
  47. package/dist/config-doctor.d.ts +1 -1
  48. package/dist/{diag-doctor-WIFJH3XH.js → diag-doctor-BIZAFIAT.js} +2 -2
  49. package/dist/{execution-PYC5FCS4.js → execution-7QIP6GRY.js} +1948 -1666
  50. package/dist/fleet/host-types.d.ts +3 -1
  51. package/dist/goal-commands.d.ts +47 -0
  52. package/dist/goal-host.d.ts +1 -14
  53. package/dist/{hq-JTUTFI4L.js → hq-GLZ7QESM.js} +6 -6
  54. package/dist/{hq-server-PC7GZMPT.js → hq-server-YTKDVQPY.js} +2 -2
  55. package/dist/{hq-service-NW56MUP2.js → hq-service-BMMJAHRT.js} +4 -4
  56. package/dist/import-claude-code-32PCSIQI.js +236 -0
  57. package/dist/index.js +12 -8
  58. package/dist/{mailbox-serve-WDOCH6KR.js → mailbox-serve-NW5VZG7R.js} +3 -3
  59. package/dist/{modeldiag-36OGAL5C.js → modeldiag-36VODVIH.js} +8 -8
  60. package/dist/{per-subcommand-help-XE77MTGJ.js → per-subcommand-help-QDAQASPZ.js} +2 -2
  61. package/dist/permission-prompt.d.ts +14 -0
  62. package/dist/permission-rules-view.d.ts +18 -0
  63. package/dist/{permissions-CFDLXETM.js → permissions-PL27UHYD.js} +67 -45
  64. package/dist/{plugin-usage-S5LVGMBW.js → plugin-usage-CIGOOTX3.js} +2 -2
  65. package/dist/{plugins-RHBIVLI7.js → plugins-HQTXUD6A.js} +4 -2
  66. package/dist/preflight.d.ts +1 -1
  67. package/dist/{projects-LMNAGGEU.js → projects-T4CZCA25.js} +3 -6
  68. package/dist/provider-helpers.d.ts +7 -11
  69. package/dist/{providers-models-2CFG46RD.js → providers-models-5Z2PJTEW.js} +5 -5
  70. package/dist/release-asset-download.d.ts +10 -0
  71. package/dist/release-attestation.d.ts +28 -0
  72. package/dist/remote/remote-session.d.ts +64 -0
  73. package/dist/remote/remote-target.d.ts +69 -0
  74. package/dist/remote-O5WXHLWV.js +561 -0
  75. package/dist/{replay-Z3FTJEMM.js → replay-DEI566CW.js} +2 -2
  76. package/dist/services/commit-message.d.ts +2 -1
  77. package/dist/session-move-P2EC2COA.js +44 -0
  78. package/dist/session-move.d.ts +20 -0
  79. package/dist/session-stats.d.ts +10 -0
  80. package/dist/{sessions-config-IQUH2GXT.js → sessions-config-SXTTLNXA.js} +35 -5
  81. package/dist/short-circuit-flags-74Y5N6CF.js +10 -0
  82. package/dist/slash-commands/command-context.d.ts +15 -5
  83. package/dist/slash-commands/goal-refiner.d.ts +4 -49
  84. package/dist/slash-commands/mcp.d.ts +2 -1
  85. package/dist/slash-commands/permissions.d.ts +4 -0
  86. package/dist/slash-commands/settings-context-mutations.d.ts +5 -0
  87. package/dist/slash-commands/settings-limits-mutations.d.ts +12 -0
  88. package/dist/standalone-auto-update-TOTRGCSA.js +249 -0
  89. package/dist/standalone-auto-update.d.ts +65 -0
  90. package/dist/standalone-update-LZO3MNLH.js +24 -0
  91. package/dist/standalone-update.d.ts +37 -1
  92. package/dist/subcommands/handlers/import-claude-code.d.ts +42 -0
  93. package/dist/subcommands/handlers/permissions.d.ts +9 -3
  94. package/dist/subcommands/handlers/remote.d.ts +6 -0
  95. package/dist/subcommands/handlers/version-help.d.ts +5 -0
  96. package/dist/{subcommands-ZTSIN7LG.js → subcommands-Q6ORSB2E.js} +2 -2
  97. package/dist/tui-resume-callback.d.ts +18 -0
  98. package/dist/{typesafe-HVEVPA6R.js → typesafe-U7YB2RRV.js} +5 -5
  99. package/dist/{typesafe-topic-replay-4W73BOLV.js → typesafe-topic-replay-ZILIU3WS.js} +18 -2
  100. package/dist/{update-7XIOEXTD.js → update-TDZX4IL2.js} +4 -4
  101. package/dist/{update-check-2POMBHFB.js → update-check-J5ZVKS73.js} +3 -3
  102. package/dist/version-JB2UAV2A.js +11 -0
  103. package/dist/version-help-XJJQ7YSH.js +10 -0
  104. package/dist/webui-server/route-contexts.d.ts +1 -1
  105. package/dist/webui-server/session-start-payload.d.ts +5 -1
  106. package/dist/{webui-server-L2SICPTB.js → webui-server-YTHLRFD2.js} +509 -366
  107. package/dist/webui-server-lifecycle.d.ts +57 -0
  108. package/dist/webui-server.d.ts +0 -14
  109. package/dist/wiring/brain-and-orchestration.d.ts +3 -1
  110. package/dist/wiring/cli-prompt-and-tools-setup.d.ts +9 -0
  111. package/dist/wiring/cli-slash-commands-setup.d.ts +1 -0
  112. package/dist/wiring/lifecycle-plugins.d.ts +4 -2
  113. package/dist/wiring/metrics.d.ts +9 -1
  114. package/dist/wiring/pipeline.d.ts +2 -7
  115. package/dist/wiring/plugins.d.ts +3 -0
  116. package/dist/wiring/provider-status.d.ts +1 -0
  117. package/dist/wiring/provider-utility-tools.d.ts +3 -1
  118. package/package.json +28 -28
  119. package/dist/chunk-2BKFWIER.js +0 -98
  120. package/dist/chunk-424ORSE7.js +0 -56
  121. package/dist/chunk-QBBF7GIK.js +0 -65
  122. package/dist/short-circuit-flags-SDT53OML.js +0 -10
  123. package/dist/standalone-update-MW47J3AK.js +0 -164
  124. package/dist/version-help-WZ623NWM.js +0 -10
@@ -0,0 +1,97 @@
1
+
2
+ // src/boot/mcp-config-flag.ts
3
+ import * as fs from "node:fs/promises";
4
+ import * as path from "node:path";
5
+ function isRecord(value) {
6
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7
+ }
8
+ function stringRecord(value, where) {
9
+ if (value === void 0) return void 0;
10
+ if (!isRecord(value) || Object.values(value).some((v) => typeof v !== "string")) {
11
+ throw new Error(`${where} must be an object of strings`);
12
+ }
13
+ return value;
14
+ }
15
+ function normalizeMcpServerEntry(name, raw) {
16
+ if (!isRecord(raw)) throw new Error(`server "${name}" must be an object`);
17
+ const where = `server "${name}"`;
18
+ const { type, transport: rawTransport, ...rest } = raw;
19
+ let transport;
20
+ if (rawTransport !== void 0) {
21
+ if (rawTransport !== "stdio" && rawTransport !== "sse" && rawTransport !== "streamable-http") {
22
+ throw new Error(`${where}: unknown transport "${String(rawTransport)}"`);
23
+ }
24
+ transport = rawTransport;
25
+ } else if (type !== void 0) {
26
+ if (type === "http") transport = "streamable-http";
27
+ else if (type === "sse" || type === "stdio") transport = type;
28
+ else throw new Error(`${where}: unknown type "${String(type)}"`);
29
+ } else if (typeof rest["command"] === "string") {
30
+ transport = "stdio";
31
+ }
32
+ if (transport === "stdio" && typeof rest["command"] !== "string") {
33
+ throw new Error(`${where}: stdio needs a "command"`);
34
+ }
35
+ if ((transport === "sse" || transport === "streamable-http") && typeof rest["url"] !== "string") {
36
+ throw new Error(`${where}: ${transport} needs a "url"`);
37
+ }
38
+ if (rest["args"] !== void 0 && !Array.isArray(rest["args"])) {
39
+ throw new Error(`${where}: "args" must be an array`);
40
+ }
41
+ const env = stringRecord(rest["env"], `${where} "env"`);
42
+ const headers = stringRecord(rest["headers"], `${where} "headers"`);
43
+ return {
44
+ ...rest,
45
+ ...transport ? { transport } : {},
46
+ ...env ? { env } : {},
47
+ ...headers ? { headers } : {}
48
+ };
49
+ }
50
+ function parseLaunchMcpServers(text, source) {
51
+ let doc;
52
+ try {
53
+ doc = JSON.parse(text);
54
+ } catch (err) {
55
+ throw new Error(`--mcp-config: ${source} is not valid JSON (${err.message})`);
56
+ }
57
+ if (!isRecord(doc)) throw new Error(`--mcp-config: ${source} must be a JSON object`);
58
+ const servers = isRecord(doc["mcpServers"]) ? doc["mcpServers"] : doc;
59
+ const out = {};
60
+ for (const [name, raw] of Object.entries(servers)) {
61
+ try {
62
+ out[name] = { ...normalizeMcpServerEntry(name, raw), enabled: true };
63
+ } catch (err) {
64
+ throw new Error(`--mcp-config: ${source}: ${err.message}`);
65
+ }
66
+ }
67
+ return out;
68
+ }
69
+ async function resolveLaunchMcpServers(flags, cwd) {
70
+ const value = flags["mcp-config"];
71
+ if (value === void 0) return void 0;
72
+ if (typeof value !== "string" || !value.trim()) {
73
+ throw new Error("--mcp-config needs a JSON file path or an inline JSON object");
74
+ }
75
+ const trimmed = value.trim();
76
+ if (trimmed.startsWith("{")) return parseLaunchMcpServers(trimmed, "inline JSON");
77
+ const file = path.resolve(cwd, trimmed);
78
+ let text;
79
+ try {
80
+ text = await fs.readFile(file, "utf8");
81
+ } catch (err) {
82
+ const reason = err.code ?? String(err);
83
+ throw new Error(`--mcp-config: cannot read ${file} (${reason})`);
84
+ }
85
+ return parseLaunchMcpServers(text, file);
86
+ }
87
+ function effectiveMcpServers(configured, launch, strict) {
88
+ return { ...strict ? {} : configured ?? {}, ...launch ?? {} };
89
+ }
90
+
91
+ export {
92
+ normalizeMcpServerEntry,
93
+ parseLaunchMcpServers,
94
+ resolveLaunchMcpServers,
95
+ effectiveMcpServers
96
+ };
97
+ //# sourceMappingURL=chunk-HLSHFXTO.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CLI_VERSION
3
- } from "./chunk-YBUCXXYZ.js";
3
+ } from "./chunk-F5DCFAKI.js";
4
4
 
5
5
  // src/hq-publisher.ts
6
6
  import { createHqPublisherFromEnv, resolveHqConfig } from "@wrongstack/core/hq";
@@ -518,4 +518,4 @@ function startCliHqConnection(options) {
518
518
  export {
519
519
  startCliHqConnection
520
520
  };
521
- //# sourceMappingURL=chunk-BLD5DSVA.js.map
521
+ //# sourceMappingURL=chunk-KJS5543T.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-U3SS4NRH.js";
4
4
  import {
5
5
  checkForUpdate
6
- } from "./chunk-ZZRSG7VK.js";
6
+ } from "./chunk-RZ4ZDRYA.js";
7
7
 
8
8
  // src/subcommands/handlers/update.ts
9
9
  import { spawn } from "node:child_process";
@@ -21,6 +21,8 @@ async function runUpdateCommand(args, deps) {
21
21
  (flag) => ![
22
22
  "check-only",
23
23
  "c",
24
+ // `-c` after the top-level parser's expansion; see mergeUpdateArgs.
25
+ "continue",
24
26
  "pm",
25
27
  "package-manager",
26
28
  "allow-scripts",
@@ -77,11 +79,24 @@ async function runUpdateCommand(args, deps) {
77
79
  return 0;
78
80
  }
79
81
  if (isStandaloneBinary()) {
80
- const { updateStandaloneBinary } = await import("./standalone-update-MW47J3AK.js");
81
- return updateStandaloneBinary({
82
+ const [{ updateStandaloneBinary }, { standaloneUpdater }, { STANDALONE_TARGET }] = await Promise.all([
83
+ import("./standalone-update-LZO3MNLH.js"),
84
+ import("./standalone-auto-update-TOTRGCSA.js"),
85
+ import("./version-JB2UAV2A.js")
86
+ ]);
87
+ const updater = standaloneUpdater({
88
+ executable: realpathSync(process.execPath),
89
+ target: STANDALONE_TARGET ?? "",
90
+ current: info.current
91
+ });
92
+ const code = await updateStandaloneBinary({
82
93
  current: info.current,
83
- renderer: deps.renderer
94
+ renderer: deps.renderer,
95
+ // A build the background updater already downloaded and verified.
96
+ staged: updater.pending()
84
97
  });
98
+ if (code === 0) updater.clear();
99
+ return code;
85
100
  }
86
101
  const packageManager = parsed.packageManager ?? detectUpdatePackageManager();
87
102
  let updateCommand;
@@ -184,7 +199,7 @@ function mergeUpdateArgs(args, flags) {
184
199
  if (flags[name] === true || flags[name] === "true") merged.push(`--${alias}`);
185
200
  };
186
201
  addBoolean("check-only");
187
- if (flags["c"] === true || flags["c"] === "true") merged.push("-c");
202
+ if (flags["continue"] === true || flags["c"] === true || flags["c"] === "true") merged.push("-c");
188
203
  addBoolean("allow-scripts");
189
204
  addBoolean("lifecycle-scripts");
190
205
  for (const pm of ["npm", "pnpm", "yarn", "bun"]) addBoolean(pm);
@@ -391,4 +406,4 @@ export {
391
406
  detectUpdatePackageManager,
392
407
  detectUpdatePackageName
393
408
  };
394
- //# sourceMappingURL=chunk-QFPQXKCG.js.map
409
+ //# sourceMappingURL=chunk-KOEO4CJG.js.map
@@ -0,0 +1,105 @@
1
+
2
+ // src/preflight.ts
3
+ import { ensureSessionShell } from "@wrongstack/tools/session-shell";
4
+
5
+ // src/cli-update-notice.ts
6
+ import { realpathSync } from "node:fs";
7
+ import { isStandaloneBinary, writeErr } from "@wrongstack/core/utils";
8
+ var NOTICE_FMT = `
9
+ \x1B[33m\u2191 Update available: v%s \u2192 v%s\x1B[0m Run \`wrongstack update\` to upgrade.
10
+
11
+ `;
12
+ var READY_FMT = `
13
+ \x1B[33m\u2191 v%s is downloaded\x1B[0m It replaces this executable when this session exits.
14
+
15
+ `;
16
+ var READY_MANUAL_FMT = `
17
+ \x1B[33m\u2191 v%s is downloaded\x1B[0m Run \`wrongstack update\` to install it.
18
+
19
+ `;
20
+ var APPLIED_FMT = `
21
+ \x1B[32m\u2713 Updated wrongstack v%s \u2192 v%s\x1B[0m
22
+
23
+ `;
24
+ async function printStandaloneUpdateNotice(info, config) {
25
+ const [{ autoUpdateEnabled, standaloneUpdater, takeAppliedUpdate }, { isNewer }, version] = await Promise.all([
26
+ import("./standalone-auto-update-TOTRGCSA.js"),
27
+ import("./update-check-J5ZVKS73.js"),
28
+ import("./version-JB2UAV2A.js")
29
+ ]);
30
+ const applied = takeAppliedUpdate();
31
+ if (applied) writeErr(APPLIED_FMT.replace("%s", applied.from).replace("%s", applied.to));
32
+ const pending = standaloneUpdater({
33
+ executable: realpathSync(process.execPath),
34
+ target: version.STANDALONE_TARGET ?? "",
35
+ current: version.CLI_VERSION
36
+ }).pending();
37
+ if (pending && info && isNewer(pending.version, info.current) && pending.version === info.latest) {
38
+ const fmt = autoUpdateEnabled(config) ? READY_FMT : READY_MANUAL_FMT;
39
+ writeErr(fmt.replace("%s", pending.version));
40
+ return true;
41
+ }
42
+ return false;
43
+ }
44
+ async function printUpdateNotice(initialUpdateInfo, config) {
45
+ let info = initialUpdateInfo;
46
+ if (!info?.outdated) {
47
+ const ac = new AbortController();
48
+ const timer = setTimeout(() => ac.abort(), 2e3);
49
+ try {
50
+ const { checkForUpdate } = await import("./update-check-J5ZVKS73.js");
51
+ info = await checkForUpdate(ac.signal);
52
+ } catch {
53
+ } finally {
54
+ clearTimeout(timer);
55
+ }
56
+ }
57
+ let reported = false;
58
+ if (isStandaloneBinary()) {
59
+ try {
60
+ reported = await printStandaloneUpdateNotice(info, config);
61
+ } catch {
62
+ }
63
+ }
64
+ if (info?.outdated && !reported) {
65
+ writeErr(NOTICE_FMT.replace("%s", info.current).replace("%s", info.latest));
66
+ }
67
+ return info;
68
+ }
69
+
70
+ // src/preflight.ts
71
+ function applyNodeEnvDefault() {
72
+ if (process.env["NODE_ENV"] === void 0) {
73
+ process.env["NODE_ENV"] = "production";
74
+ process.env["WRONGSTACK_NODE_ENV_DEFAULTED"] = "1";
75
+ }
76
+ }
77
+ function applySessionShellDefault() {
78
+ ensureSessionShell();
79
+ }
80
+ async function applyPrintUpdateNotice(initialUpdateInfo, config) {
81
+ return await printUpdateNotice(initialUpdateInfo, config);
82
+ }
83
+ async function applyDebugStreamSeed(config) {
84
+ const { setDebugStreamEnabled } = await import("@wrongstack/providers");
85
+ if (config.debugStream) {
86
+ setDebugStreamEnabled(true);
87
+ }
88
+ }
89
+ async function runPreflight(config, initialUpdateInfo) {
90
+ applyNodeEnvDefault();
91
+ applySessionShellDefault();
92
+ const updateInfo = await applyPrintUpdateNotice(initialUpdateInfo, config);
93
+ await applyDebugStreamSeed(config);
94
+ return {
95
+ updateInfo,
96
+ debugStreamEnabled: Boolean(config.debugStream)
97
+ };
98
+ }
99
+
100
+ export {
101
+ applyNodeEnvDefault,
102
+ applySessionShellDefault,
103
+ runPreflight
104
+ };
105
+ //# sourceMappingURL=chunk-LBPLTTZ6.js.map
@@ -1,9 +1,9 @@
1
- import {
2
- activeProfileConfigPath
3
- } from "./chunk-YMXXOOFN.js";
4
1
  import {
5
2
  mutateConfigProviders
6
3
  } from "./chunk-LUMETJFO.js";
4
+ import {
5
+ activeProfileConfigPath
6
+ } from "./chunk-YMXXOOFN.js";
7
7
 
8
8
  // src/wiring/provider-persisters.ts
9
9
  import {
@@ -43,4 +43,4 @@ export {
43
43
  installProviderPersisters,
44
44
  applyProviderOAuthRefresh2 as applyProviderOAuthRefresh
45
45
  };
46
- //# sourceMappingURL=chunk-3OCUS3VN.js.map
46
+ //# sourceMappingURL=chunk-LDCGZJTC.js.map
@@ -0,0 +1,143 @@
1
+
2
+ // src/boot/stream-json.ts
3
+ function parseOutputFormat(value) {
4
+ if (value === void 0) return void 0;
5
+ if (value === "text" || value === "json" || value === "stream-json") return value;
6
+ throw new Error(
7
+ `--output-format must be text, json or stream-json (got ${value === true ? "nothing" : `"${value}"`})`
8
+ );
9
+ }
10
+ var LEADER = "leader";
11
+ function isLeader(agentId) {
12
+ return agentId === void 0 || agentId === LEADER;
13
+ }
14
+ function simplifyBlocks(content) {
15
+ const out = [];
16
+ for (const block of content ?? []) {
17
+ if (block.type === "text") out.push({ type: "text", text: block.text });
18
+ else if (block.type === "tool_use") {
19
+ out.push({ type: "tool_use", id: block.id, name: block.name, input: block.input });
20
+ }
21
+ }
22
+ return out;
23
+ }
24
+ function startStreamJson(opts) {
25
+ const emit = (payload) => {
26
+ opts.write(`${JSON.stringify(payload)}
27
+ `);
28
+ };
29
+ const offs = [];
30
+ if (opts.includePartialMessages) {
31
+ offs.push(
32
+ opts.events.on("provider.text_delta", (e) => {
33
+ if (isLeader(e.ctx?.agentId)) emit({ type: "text_delta", text: e.text });
34
+ })
35
+ );
36
+ }
37
+ offs.push(
38
+ opts.events.on("provider.response", (e) => {
39
+ if (!isLeader(e.ctx?.agentId)) return;
40
+ emit({
41
+ type: "assistant",
42
+ model: e.model,
43
+ content: simplifyBlocks(e.content),
44
+ stopReason: e.stopReason,
45
+ usage: e.usage
46
+ });
47
+ })
48
+ );
49
+ offs.push(
50
+ opts.events.on("tool.executed", (e) => {
51
+ if (!isLeader(e.agentId)) return;
52
+ emit({
53
+ type: "tool_result",
54
+ id: e.id ?? null,
55
+ name: e.name,
56
+ ok: e.ok,
57
+ durationMs: e.durationMs,
58
+ output: e.output ?? null,
59
+ outputBytes: e.outputBytes ?? null
60
+ });
61
+ })
62
+ );
63
+ return () => {
64
+ for (const off of offs) off();
65
+ };
66
+ }
67
+ function streamJsonInit(info) {
68
+ return `${JSON.stringify({ type: "init", ...info })}
69
+ `;
70
+ }
71
+
72
+ // src/boot/structured-output.ts
73
+ import * as fs from "node:fs/promises";
74
+ import * as path from "node:path";
75
+ import { validateAgainstSchema } from "@wrongstack/core/utils";
76
+ async function resolveJsonSchemaFlag(value, cwd) {
77
+ if (value === void 0) return void 0;
78
+ if (typeof value !== "string" || !value.trim()) {
79
+ throw new Error("--json-schema needs a JSON Schema file path or an inline JSON object");
80
+ }
81
+ const trimmed = value.trim();
82
+ let text = trimmed;
83
+ let source = "inline JSON";
84
+ if (!trimmed.startsWith("{")) {
85
+ const file = path.resolve(cwd, trimmed);
86
+ source = file;
87
+ try {
88
+ text = await fs.readFile(file, "utf8");
89
+ } catch (err) {
90
+ const reason = err.code ?? String(err);
91
+ throw new Error(`--json-schema: cannot read ${file} (${reason})`);
92
+ }
93
+ }
94
+ let schema;
95
+ try {
96
+ schema = JSON.parse(text);
97
+ } catch (err) {
98
+ throw new Error(`--json-schema: ${source} is not valid JSON (${err.message})`);
99
+ }
100
+ if (typeof schema !== "object" || schema === null || Array.isArray(schema)) {
101
+ throw new Error(`--json-schema: ${source} must be a JSON Schema object`);
102
+ }
103
+ return schema;
104
+ }
105
+ function withSchemaInstruction(query, schema) {
106
+ return `${query}
107
+
108
+ When you are done, reply with ONLY a JSON value that validates against this JSON Schema \u2014 no prose, no code fence:
109
+ ${JSON.stringify(schema)}`;
110
+ }
111
+ function checkStructuredAnswer(text, schema) {
112
+ if (!text?.trim()) return { ok: false, errors: ["the answer was empty"] };
113
+ const fenced = text.trim().match(/^```(?:json)?\s*\n([\s\S]*?)\n?```$/);
114
+ const body = (fenced?.[1] ?? text).trim();
115
+ let value;
116
+ try {
117
+ value = JSON.parse(body);
118
+ } catch (err) {
119
+ return { ok: false, errors: [`not valid JSON (${err.message})`] };
120
+ }
121
+ const result = validateAgainstSchema(value, schema);
122
+ if (result.ok) return { ok: true, value };
123
+ return {
124
+ ok: false,
125
+ errors: result.errors.map((e) => `${e.path || "(root)"}: ${e.message}`)
126
+ };
127
+ }
128
+ function repairPrompt(errors) {
129
+ return `Your last answer did not validate against the JSON Schema:
130
+ ${errors.map((e) => `- ${e}`).join("\n")}
131
+ Reply with ONLY the corrected JSON value.`;
132
+ }
133
+
134
+ export {
135
+ parseOutputFormat,
136
+ startStreamJson,
137
+ streamJsonInit,
138
+ resolveJsonSchemaFlag,
139
+ withSchemaInstruction,
140
+ checkStructuredAnswer,
141
+ repairPrompt
142
+ };
143
+ //# sourceMappingURL=chunk-LKPEBZBE.js.map
@@ -2847,8 +2847,8 @@ async function handleApiAgentMessages(req, res, match, agentMessages) {
2847
2847
  // src/hq-server/routes/system-handlers.ts
2848
2848
  async function handleApiSystemUpdate(res) {
2849
2849
  const [{ checkForUpdate }, { detectUpdatePackageName }] = await Promise.all([
2850
- import("./update-check-2POMBHFB.js"),
2851
- import("./update-7XIOEXTD.js")
2850
+ import("./update-check-J5ZVKS73.js"),
2851
+ import("./update-TDZX4IL2.js")
2852
2852
  ]);
2853
2853
  const packageName = detectUpdatePackageName();
2854
2854
  const info = await checkForUpdate({ packageName });
@@ -5150,4 +5150,4 @@ export {
5150
5150
  startHqServer,
5151
5151
  HqInsecureExposureError2 as HqInsecureExposureError
5152
5152
  };
5153
- //# sourceMappingURL=chunk-DRM7PSW7.js.map
5153
+ //# sourceMappingURL=chunk-OAVBM55Q.js.map
@@ -0,0 +1,18 @@
1
+
2
+ // src/boot/ascii-mode.ts
3
+ import { installAsciiOutput, isAsciiMode } from "@wrongstack/core/utils";
4
+ var installed = false;
5
+ function applyAsciiMode(flags, env = process.env, streams = [process.stdout, process.stderr]) {
6
+ if (flags["ascii"] === true) env["WRONGSTACK_TUI_ICON_STYLE"] = "ascii";
7
+ if (!isAsciiMode(env)) return false;
8
+ if (!installed) {
9
+ installed = true;
10
+ for (const stream of streams) installAsciiOutput(stream);
11
+ }
12
+ return true;
13
+ }
14
+
15
+ export {
16
+ applyAsciiMode
17
+ };
18
+ //# sourceMappingURL=chunk-PZQBGUVZ.js.map
@@ -20,6 +20,34 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
20
20
  // Both are boolean so they cannot swallow the next positional token.
21
21
  "no-recovery",
22
22
  "recover",
23
+ // `--continue` / `-c`: resume the most recent session (same pick as a bare
24
+ // `--resume`). Boolean so `wstack -c "next step"` keeps the prompt.
25
+ "continue",
26
+ // `--fork-session` (with --resume/--continue/--recover): branch instead of reopening.
27
+ "fork-session",
28
+ // `--strict-mcp-config`: start only the `--mcp-config` servers.
29
+ "strict-mcp-config",
30
+ // `--include-partial-messages`: add text_delta events to stream-json output.
31
+ "include-partial-messages",
32
+ // `--safe-mode`: start with plugins/hooks/MCP/skills/instruction overrides off.
33
+ "safe-mode",
34
+ // `--restricted`: no code-running/network tools, project-root lock, no YOLO.
35
+ "restricted",
36
+ // `--record` is read as `=== true`; as a value flag it swallowed the task
37
+ // (`wstack --record "fix it"` recorded nothing and ran nothing).
38
+ "record",
39
+ // Same class: switches read only as `=== true` that would otherwise take the
40
+ // next token (`--vector-sync "task"`, `typesafe lint-conventions --staged x`).
41
+ "vector-sync",
42
+ "allow-all",
43
+ "no-llm",
44
+ "staged",
45
+ "sweep",
46
+ "n",
47
+ // `wstack import-claude-code` switches.
48
+ "apply",
49
+ "overwrite",
50
+ "enable-project-servers",
23
51
  "output-json",
24
52
  "metrics",
25
53
  "webui",
@@ -28,6 +56,8 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
28
56
  "full-auto",
29
57
  "desktop",
30
58
  "open",
59
+ // `wstack remote --keep`: leave the remote host running after disconnecting.
60
+ "keep",
31
61
  "webui-require-token",
32
62
  "require-token",
33
63
  "no-check",
@@ -39,6 +69,7 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
39
69
  "skip",
40
70
  "skip-index",
41
71
  "mouse",
72
+ "ascii",
42
73
  "no-interactive",
43
74
  "token-saving-mode",
44
75
  "system-lite",
@@ -139,7 +170,13 @@ function parseArgs(argv) {
139
170
  }
140
171
  } else if (a.startsWith("-") && a.length === 2) {
141
172
  const short = a.slice(1);
142
- const expand = { v: "verbose", y: "yes", h: "help" };
173
+ const expand = {
174
+ v: "verbose",
175
+ y: "yes",
176
+ h: "help",
177
+ c: "continue",
178
+ r: "resume"
179
+ };
143
180
  const name = expand[short] ?? short;
144
181
  if (!BOOLEAN_FLAGS.has(name) && i + 1 < argv.length && !(argv[i + 1] ?? "").startsWith("-")) {
145
182
  flags[name] = argv[++i] ?? "";
@@ -151,6 +188,13 @@ function parseArgs(argv) {
151
188
  }
152
189
  }
153
190
  normalizeSurfaceAliases(flags, positional);
191
+ for (const [camel, kebab] of [
192
+ ["disallowedTools", "disallowed-tools"],
193
+ ["allowedTools", "allowed-tools"]
194
+ ]) {
195
+ if (flags[camel] !== void 0 && flags[kebab] === void 0) flags[kebab] = flags[camel];
196
+ delete flags[camel];
197
+ }
154
198
  return { flags, positional };
155
199
  }
156
200
  function normalizeSurfaceAliases(flags, positional) {
@@ -262,4 +306,4 @@ export {
262
306
  parseAuthFlags,
263
307
  parseSpawnFlags
264
308
  };
265
- //# sourceMappingURL=chunk-MHEBWVXL.js.map
309
+ //# sourceMappingURL=chunk-Q4INH2DG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CLI_VERSION
3
- } from "./chunk-YBUCXXYZ.js";
3
+ } from "./chunk-F5DCFAKI.js";
4
4
 
5
5
  // src/update-check.ts
6
6
  import * as fs from "node:fs/promises";
@@ -144,7 +144,7 @@ async function checkForUpdate(signalOrOptions, legacyHomeFn) {
144
144
  };
145
145
  }
146
146
  try {
147
- const latest = packageName === "standalone-binary" ? await (await import("./standalone-update-MW47J3AK.js")).fetchLatestStandaloneVersion(3e3, signal) : await fetchLatestFromNpm(packageName, 3e3, signal);
147
+ const latest = packageName === "standalone-binary" ? await (await import("./standalone-update-LZO3MNLH.js")).fetchLatestStandaloneVersion(3e3, signal) : await fetchLatestFromNpm(packageName, 3e3, signal);
148
148
  await writeCache({ timestamp: Date.now(), latestVersion: latest, packageName }, hf);
149
149
  return {
150
150
  current,
@@ -183,4 +183,4 @@ export {
183
183
  checkForUpdate,
184
184
  getUpdateNotification
185
185
  };
186
- //# sourceMappingURL=chunk-ZZRSG7VK.js.map
186
+ //# sourceMappingURL=chunk-RZ4ZDRYA.js.map