@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
@@ -2,14 +2,7 @@ import {
2
2
  hasApiKey,
3
3
  isKeylessLocalProvider,
4
4
  visibleModelIds
5
- } from "./chunk-3VXYY5JC.js";
6
- import {
7
- appendHistory,
8
- backupCurrent
9
- } from "./chunk-WSTVGC2C.js";
10
- import {
11
- openBrowser
12
- } from "./chunk-DAKVBMD4.js";
5
+ } from "./chunk-5UZBUV2H.js";
13
6
  import {
14
7
  activeLabel,
15
8
  loadConfigProviders,
@@ -20,6 +13,13 @@ import {
20
13
  resolveActiveApiKey,
21
14
  writeKeysBack
22
15
  } from "./chunk-LUMETJFO.js";
16
+ import {
17
+ openBrowser
18
+ } from "./chunk-DAKVBMD4.js";
19
+ import {
20
+ appendHistory,
21
+ backupCurrent
22
+ } from "./chunk-WSTVGC2C.js";
23
23
 
24
24
  // src/auth-menu/auth-menu-audit.ts
25
25
  import { appendFileSync } from "node:fs";
@@ -427,10 +427,8 @@ ${color2.bold("WrongStack")} ${color2.dim("\u2014 API key manager")}
427
427
  );
428
428
  renderer.write(` ${color2.bold("c")} Add a custom provider
429
429
  `);
430
- renderer.write(
431
- ` ${color2.bold("s")} Login with provider OAuth
432
- `
433
- );
430
+ renderer.write(` ${color2.bold("s")} Login with provider OAuth
431
+ `);
434
432
  if (ids.length > 0) {
435
433
  renderer.write(
436
434
  ` ${color2.dim("1-")}${color2.dim(String(ids.length))} ${color2.bold("Manage a provider")}
@@ -1946,4 +1944,4 @@ export {
1946
1944
  addCustomProvider,
1947
1945
  addKeyForProvider
1948
1946
  };
1949
- //# sourceMappingURL=chunk-LFMVHT3R.js.map
1947
+ //# sourceMappingURL=chunk-2ERX3RPN.js.map
@@ -0,0 +1,62 @@
1
+
2
+ // src/permission-rules-view.ts
3
+ import {
4
+ compilePermissionRules,
5
+ matchedPermissionRule,
6
+ withExecutorGate
7
+ } from "@wrongstack/core/security";
8
+ async function explainCall(policy, tool, input, ctx, yolo) {
9
+ if (!policy.explain) throw new Error("This permission policy cannot explain its decisions.");
10
+ const trace = withExecutorGate(await policy.explain(tool, input, ctx), tool, yolo);
11
+ const rules = await compilePermissionRules(policy, ctx, { yolo });
12
+ return { trace, rules, rule: matchedPermissionRule(rules, trace) };
13
+ }
14
+ function actionText(rule) {
15
+ return rule.action === "*" ? "any tool" : rule.action;
16
+ }
17
+ function resourceText(rule) {
18
+ return rule.resource === "*" ? "any input" : rule.resource;
19
+ }
20
+ function describePermissionRule(rule) {
21
+ return `#${rule.n} ${rule.effect} ${actionText(rule)} \u2192 ${resourceText(rule)} (${rule.source})`;
22
+ }
23
+ function formatPermissionRules(rules) {
24
+ const width = String(rules.length).length;
25
+ const lines = ["Permission rules, in the order they are checked; the first match decides:", ""];
26
+ for (const rule of rules) {
27
+ lines.push(
28
+ ` ${String(rule.n).padStart(width)}. ${rule.effect.padEnd(5)} ${rule.source.padEnd(15)} ${actionText(rule)} \u2192 ${resourceText(rule)}`
29
+ );
30
+ if (rule.note) lines.push(` ${" ".repeat(width)} ${" ".repeat(22)}${rule.note}`);
31
+ }
32
+ return lines.join("\n");
33
+ }
34
+ function formatExplainedCall({ trace, rule }) {
35
+ const lines = [];
36
+ lines.push(`Permission trace for "${trace.toolName}"`);
37
+ lines.push(`Subject: ${trace.subject ?? "(none)"}`);
38
+ lines.push("");
39
+ for (let i = 0; i < trace.steps.length; i++) {
40
+ const step = trace.steps[i];
41
+ if (!step) continue;
42
+ const winner = i === trace.winnerIndex ? " \u2190 WINNER" : "";
43
+ const matched = step.matched ? "\u2713" : " ";
44
+ lines.push(` ${matched} [${i}] ${step.rule}${winner}`);
45
+ lines.push(` decision: ${step.decision} source: ${step.source}`);
46
+ lines.push(` ${step.detail}`);
47
+ if (i < trace.steps.length - 1) lines.push("");
48
+ }
49
+ lines.push("");
50
+ lines.push(`Effective: ${trace.decision.permission} (source: ${trace.decision.source})`);
51
+ if (rule) lines.push(`Rule: ${describePermissionRule(rule)}`);
52
+ if (trace.decision.reason) lines.push(`Reason: ${trace.decision.reason}`);
53
+ if (trace.decision.riskTier) lines.push(`Risk tier: ${trace.decision.riskTier}`);
54
+ return lines.join("\n");
55
+ }
56
+
57
+ export {
58
+ explainCall,
59
+ formatPermissionRules,
60
+ formatExplainedCall
61
+ };
62
+ //# sourceMappingURL=chunk-4TVYGG6G.js.map
@@ -0,0 +1,154 @@
1
+ import {
2
+ API_VERSION,
3
+ CLI_VERSION
4
+ } from "./chunk-F5DCFAKI.js";
5
+
6
+ // src/subcommands/handlers/version-help.ts
7
+ import * as os from "node:os";
8
+ import { color } from "@wrongstack/core/utils";
9
+ var versionCmd = async (_args, deps) => {
10
+ const bunVersion = globalThis.Bun?.version;
11
+ const runtime = bunVersion ? `bun v${bunVersion}` : `node ${process.version}`;
12
+ deps.renderer.write(
13
+ `WrongStack ${CLI_VERSION} (apiVersion ${API_VERSION}, ${runtime}, ${os.platform()})
14
+ `
15
+ );
16
+ return 0;
17
+ };
18
+ function row(left, description) {
19
+ const pad = 31;
20
+ return left.length < pad - 2 ? ` ${left.padEnd(pad - 2)}${description}` : ` ${left}
21
+ ${" ".repeat(pad)}${description}`;
22
+ }
23
+ function section(title, rows) {
24
+ return ["", color.bold(title), ...rows.map(([left, description]) => row(left, description))];
25
+ }
26
+ var helpCmd = async (_args, deps) => {
27
+ const lines = [
28
+ color.bold("WrongStack \u2014 usage"),
29
+ "",
30
+ ' wstack [flags] ["<task>"] With a task: run it and exit. Without: start a session.',
31
+ " wstack <command> --help Details for one command",
32
+ ...section("Start", [
33
+ ["wstack", "Interactive session (REPL or TUI, picked at launch)"],
34
+ ['wstack "<task>"', 'Run one task and exit (also: --prompt "<task>")'],
35
+ ["wstack quick", "Straight into the TUI with saved defaults"],
36
+ ["wstack webui | simpleui", "Browser UI / minimal chat UI for this project"],
37
+ ["wstack desktop", "WrongStack Desktop (requires @wrongstack/desktop)"],
38
+ ["wstack hq", "HQ command center across projects and machines"],
39
+ ["wstack remote <user@host:/path>", "Run on a remote machine over SSH; WebUI tunneled here"],
40
+ ['wstack --eternal "<mission>"', "Eternal-autonomy loop against a goal (Ctrl+C stops)"],
41
+ ["wstack acp [serve]", "Agent Client Protocol server for editors"]
42
+ ]),
43
+ ...section("Sessions", [
44
+ ["wstack sessions", "List recent sessions (also: fork, doctor, fleet)"],
45
+ ["wstack resume [<id>]", "Resume a session (same as -r)"],
46
+ ["wstack rewind [<id>]", "Rewind a session to an earlier point"],
47
+ ["wstack export <id>", "Render a session as markdown, JSON or text"],
48
+ ["wstack audit | replay [<id>]", "Tamper-evident audit log / recorded provider responses"],
49
+ ["wstack chronicle", "Cross-session timeline and metrics"],
50
+ ["wstack usage", "Token and cost summary"]
51
+ ]),
52
+ ...section("Setup", [
53
+ ["wstack auth", "Provider keys: add/edit/remove, list, status, local"],
54
+ ["wstack providers | models", "Browse providers and models; models add|remove|refresh"],
55
+ ["wstack config", "Show, edit, back up or restore the active profile config"],
56
+ ["wstack config-export | config-import", "Move behaviour settings via ./wstack-config.json"],
57
+ ["wstack mcp", "MCP servers: list, add, remove, serve"],
58
+ ["wstack import-claude-code", "Import MCP servers from Claude Code (preview; --apply)"],
59
+ ["wstack plugin", "Plugins: list, install, enable, disable, remove"],
60
+ ["wstack tools | skills", "List registered tools / discovered skills"],
61
+ ["wstack typesafe", "TypeSafe account: status, login, test"],
62
+ ["wstack update", "Self-update (--check-only)"]
63
+ ]),
64
+ ...section("Project & diagnostics", [
65
+ ["wstack project | projects", "Committed project identity / tracked projects"],
66
+ ["wstack permissions explain", "Why a tool call is allowed, asked or denied"],
67
+ ["wstack doctor | diag", "Health checks / full diagnostic dump"],
68
+ ["wstack governance status", "Project-daemon health"],
69
+ ["wstack modeldiag | bench", "Model capability diagnostics / agentic benchmarks"],
70
+ ["wstack mailbox serve", "HTTP bridge for external agents"],
71
+ ["wstack version", "Print version"]
72
+ ]),
73
+ ...section("Session flags", [
74
+ ["-c, --continue", "Resume the most recent session"],
75
+ ["-r, --resume [<id>]", "Resume a session (latest when no id)"],
76
+ ["--recover", "Reopen the last session that never closed (crash, kill)"],
77
+ ["--fork-session", "With -c/-r/--recover: continue a copy, keep the original"],
78
+ ["--provider <id> --model <id>", "Provider and model for this run"],
79
+ ["--fallback-model <a,b,...>", "Models to fall back to when the primary is unavailable"],
80
+ ["--effort <level>", "Reasoning effort: none|minimal|low|medium|high|xhigh|max"],
81
+ ["--system-prompt lite|pro|default", "Bundled system-prompt variant"],
82
+ [
83
+ "--append-system-prompt <text> | --append-system-prompt-file <path>",
84
+ "Add instructions to the host agent prompt for this run"
85
+ ],
86
+ ['--goal "<goal>" | --ask "<q>"', "Open the TUI with a goal or a question queued"]
87
+ ]),
88
+ ...section("Tools & permissions", [
89
+ ["--yolo | --no-yolo", "Auto-approve on or off (gated destructive kinds still ask)"],
90
+ ["--yolo-destructive", "Let YOLO run every destructive kind you may un-gate"],
91
+ ["--restricted", "Untrusted repo: no shell/network/MCP tools, stay in project, no YOLO"],
92
+ ["--safe-mode", "Troubleshoot: no 3rd-party plugins, hooks, MCP, skills, overrides"],
93
+ ["--only-tools <a,b,...>", "Expose only these tools (trailing * = prefix: mcp__gh__*)"],
94
+ ["--disallowed-tools <a,b,...>", "Hide these tools, subagents included"],
95
+ ["--allowed-tools <a,b,...>", "Run these without a prompt (destructive calls still ask)"],
96
+ ["--mcp-config <file|json>", "Extra MCP servers for this run (.mcp.json accepted)"],
97
+ ["--strict-mcp-config", "Start only the --mcp-config servers"],
98
+ ["--no-hooks", "Skip user and plugin hooks (policy hooks still run)"]
99
+ ]),
100
+ ...section("Scripting (with a task)", [
101
+ ["<stdin>", 'Piped input becomes context: git diff | wstack "review this"'],
102
+ ["--output-json", "One JSON result line: status, finalText, sessionId, usage"],
103
+ [
104
+ "--output-format text|json|stream-json",
105
+ "stream-json: init, assistant, tool_result, result lines"
106
+ ],
107
+ ["--include-partial-messages", "stream-json: add text_delta lines"],
108
+ ["--json-schema <file|json>", "Answer must be JSON matching the schema (structuredOutput)"],
109
+ ["--max-budget-usd <amount>", "Stop once spend (leader + subagents) passes the amount"],
110
+ ["", "Exit: 0 done, 1 failed/limit/budget/schema, 130 aborted, 2 usage"]
111
+ ]),
112
+ ...section("Interfaces", [
113
+ ["--tui | --no-tui", "Force or disable the TUI"],
114
+ ["--mouse", "Full mouse mode in the TUI"],
115
+ ["--ascii", "Plain-ASCII symbols, borders and spinners (no emoji or box drawing)"],
116
+ ["--desktop", "Same as wstack desktop"],
117
+ [
118
+ "--webui [--host <h>] [--port <n>] [--open]",
119
+ "Browser UI (+ --webui-token, --webui-public-url, ...)"
120
+ ],
121
+ [
122
+ "--simpleui [same flags] [--full-auto]",
123
+ "Minimal chat UI; --full-auto = YOLO + autonomy for this run only"
124
+ ],
125
+ [
126
+ "--hq [--host <h>] [--port <n>] [--password <p>] [--tunnel] [--open]",
127
+ "HQ server (+ --hq-allowlist, --hq-public-url)"
128
+ ]
129
+ ]),
130
+ ...section("Startup & tuning", [
131
+ ["--skip", "Skip every startup prompt; use saved choices"],
132
+ ["--skip-index", "Skip codebase indexing at startup"],
133
+ ["--no-models-refresh", "Use the cached model catalog"],
134
+ ["--token-saving-tier <tier>", "auto|off|minimal|light|medium|aggressive"],
135
+ ["--max-concurrent <n> | --max-spawns <n>", "Fleet concurrency / lifetime subagent spawns"],
136
+ ["--chimera-auto-fix off|ask|auto", "How to handle Chimera review findings"],
137
+ ["--cwd <dir>", "Run as if started in <dir>"],
138
+ ["--verbose | --trace | --log-level <l>", "Log verbosity"],
139
+ ["--metrics [--metrics-port <n>]", "Metrics and health; Prometheus endpoint on the port"],
140
+ [
141
+ "--record | --replay <session-id>",
142
+ "Record provider responses / serve them back (test harnesses; a changed prompt misses)"
143
+ ]
144
+ ])
145
+ ];
146
+ deps.renderer.write(lines.join("\n") + "\n");
147
+ return 0;
148
+ };
149
+
150
+ export {
151
+ versionCmd,
152
+ helpCmd
153
+ };
154
+ //# sourceMappingURL=chunk-5JYDKG5B.js.map
@@ -1,6 +1,6 @@
1
1
 
2
2
  // src/provider-helpers.ts
3
- import { hasProviderCredential } from "@wrongstack/core/models";
3
+ import { hasProviderCredential, isKeylessLocalProvider } from "@wrongstack/core/models";
4
4
  import { catalogProviderIdFor } from "@wrongstack/providers";
5
5
  function uniqueModelIds(primary, fallback) {
6
6
  const seen = /* @__PURE__ */ new Set();
@@ -18,22 +18,6 @@ function visibleModelIds(providerId, config, catalogModelIds, cfg) {
18
18
  if (entry?.models === void 0) return [...catalogModelIds];
19
19
  return uniqueModelIds(entry.models, catalogModelIds);
20
20
  }
21
- function isLoopbackUrl(apiBase) {
22
- if (!apiBase) return false;
23
- let host;
24
- try {
25
- host = new URL(apiBase).hostname.toLowerCase();
26
- } catch {
27
- return false;
28
- }
29
- host = host.replace(/^\[|\]$/g, "");
30
- if (host === "localhost" || host === "::1" || host === "0.0.0.0") return true;
31
- return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host);
32
- }
33
- function isKeylessLocalProvider(provider) {
34
- if (provider.envVars && provider.envVars.length > 0) return false;
35
- return isLoopbackUrl(provider.apiBase);
36
- }
37
21
  function hasApiKey(provider, config) {
38
22
  return hasProviderCredential(provider, config);
39
23
  }
@@ -122,9 +106,9 @@ function modelDetails(models) {
122
106
  }
123
107
 
124
108
  export {
125
- visibleModelIds,
126
109
  isKeylessLocalProvider,
110
+ visibleModelIds,
127
111
  hasApiKey,
128
112
  buildPickableProviders
129
113
  };
130
- //# sourceMappingURL=chunk-3VXYY5JC.js.map
114
+ //# sourceMappingURL=chunk-5UZBUV2H.js.map
@@ -0,0 +1,58 @@
1
+
2
+ // src/subcommands/index.ts
3
+ var loaders = {
4
+ acp: async () => (await import("./acp-LI665LO2.js")).acpCmd,
5
+ init: async () => (await import("./init-DRMMFG2G.js")).initCmd,
6
+ auth: async () => (await import("./auth-TE55JF4Z.js")).authCmd,
7
+ update: async () => (await import("./update-TDZX4IL2.js")).updateCmd,
8
+ remote: async () => (await import("./remote-O5WXHLWV.js")).remoteCmd,
9
+ sessions: async () => (await import("./sessions-config-SXTTLNXA.js")).sessionsCmd,
10
+ config: async () => (await import("./sessions-config-SXTTLNXA.js")).configCmd,
11
+ "config-export": async () => (await import("./config-transfer-RUWLDCNK.js")).configExportCmd,
12
+ "config-import": async () => (await import("./config-transfer-RUWLDCNK.js")).configImportCmd,
13
+ rewind: async () => (await import("./rewind-JA3ZLCNM.js")).rewindCmd,
14
+ replay: async () => (await import("./replay-JJ2NOWD6.js")).replayCmd,
15
+ audit: async () => (await import("./audit-46YK5DSC.js")).auditCmd,
16
+ tools: async () => (await import("./tools-skills-GH24UCBY.js")).toolsCmd,
17
+ skills: async () => (await import("./tools-skills-GH24UCBY.js")).skillsCmd,
18
+ "skill-suggest": async () => (await import("./skill-suggest-L2EVWB6R.js")).skillSuggestCmd,
19
+ typesafe: async () => (await import("./typesafe-U7YB2RRV.js")).typesafeCmd,
20
+ providers: async () => (await import("./providers-models-5Z2PJTEW.js")).providersCmd,
21
+ models: async () => (await import("./providers-models-5Z2PJTEW.js")).modelsCmd,
22
+ mcp: async () => (await import("./mcp-LBS45HWZ.js")).mcpCmd,
23
+ plugin: async () => (await import("./plugin-usage-CIGOOTX3.js")).pluginCmd,
24
+ plugins: async () => (await import("./plugin-usage-CIGOOTX3.js")).pluginCmd,
25
+ diag: async () => (await import("./diag-doctor-BIZAFIAT.js")).diagCmd,
26
+ doctor: async () => (await import("./diag-doctor-BIZAFIAT.js")).doctorCmd,
27
+ "proxy-status": async () => (await import("./diag-doctor-BIZAFIAT.js")).proxyCmd,
28
+ export: async () => (await import("./export-VVRIOWFV.js")).exportCmd,
29
+ usage: async () => (await import("./plugin-usage-CIGOOTX3.js")).usageCmd,
30
+ version: async () => (await import("./version-help-XJJQ7YSH.js")).versionCmd,
31
+ help: async () => (await import("./version-help-XJJQ7YSH.js")).helpCmd,
32
+ projects: async () => (await import("./projects-T4CZCA25.js")).projectsCmd,
33
+ modeldiag: async () => (await import("./modeldiag-36VODVIH.js")).modeldiagCmd,
34
+ quick: async () => (await import("./quick-CNB4Z3HS.js")).quickCmd,
35
+ bench: async () => (await import("./bench-GTLPM22B.js")).benchCmd,
36
+ chronicle: async () => (await import("./chronicle-UTFETHP6.js")).chronicleCmd,
37
+ hq: async () => (await import("./hq-GLZ7QESM.js")).hqCmd,
38
+ mailbox: async () => (await import("./mailbox-serve-NW5VZG7R.js")).mailboxServeCmd,
39
+ permissions: async () => (await import("./permissions-PL27UHYD.js")).permissionsCmd,
40
+ project: async () => (await import("./project-AOQI5XTK.js")).projectCmd,
41
+ governance: async () => (await import("./governance-RYSHV675.js")).governanceCmd,
42
+ "import-claude-code": async () => (await import("./import-claude-code-32PCSIQI.js")).importClaudeCodeCmd
43
+ };
44
+ var subcommands = Object.fromEntries(
45
+ Object.entries(loaders).map(
46
+ ([name, load]) => [
47
+ name,
48
+ async (args, deps) => (await load())(args, deps)
49
+ ]
50
+ )
51
+ );
52
+ var subcommandNames = Object.keys(loaders);
53
+
54
+ export {
55
+ subcommands,
56
+ subcommandNames
57
+ };
58
+ //# sourceMappingURL=chunk-BEHGRNOQ.js.map
@@ -0,0 +1,140 @@
1
+
2
+ // src/context-limit.ts
3
+ import { refreshCatalogIfStale } from "@wrongstack/core/models";
4
+ import { mergeCustomModelDefs, toErrorMessage } from "@wrongstack/core/utils";
5
+ import { capabilitiesFor } from "@wrongstack/providers";
6
+ var SIBLING_CATALOG = {
7
+ "anthropic-oauth": "anthropic",
8
+ "openai-codex": "openai",
9
+ "github-copilot": "openai",
10
+ "google-antigravity": "google"
11
+ };
12
+ async function resolveRuntimeMaxContextDetailed(input) {
13
+ const providerConfig = input.runtimeProviderConfig ?? input.config.providers?.[input.providerId];
14
+ const providerOverride = positiveNumber(readConfiguredMaxContext(providerConfig));
15
+ if (providerOverride) return { maxContext: providerOverride, branch: "provider-override" };
16
+ const catalogId = providerConfig?.type && providerConfig.type !== input.providerId ? providerConfig.type : input.providerId;
17
+ const sibling = providerConfig?.family ? SIBLING_CATALOG[providerConfig.family] : void 0;
18
+ if (sibling && input.modelsRegistry) {
19
+ const mergedModels = mergeCustomModelDefs(providerConfig?.customModels, input.config.models);
20
+ const ownModel = await input.modelsRegistry.getModel(catalogId, input.modelId).catch(() => void 0);
21
+ if (ownModel) {
22
+ const ownCaps = await capabilitiesFor(
23
+ input.modelsRegistry,
24
+ catalogId,
25
+ input.modelId,
26
+ mergedModels
27
+ ).catch(() => void 0);
28
+ const ownMax = positiveNumber(ownCaps?.maxContext) ?? positiveNumber(ownModel.capabilities.maxContext);
29
+ if (ownMax) return { maxContext: ownMax, branch: "catalog-capabilities" };
30
+ }
31
+ const caps = await capabilitiesFor(
32
+ input.modelsRegistry,
33
+ sibling,
34
+ input.modelId,
35
+ mergedModels
36
+ ).catch(() => void 0);
37
+ const siblingMax = positiveNumber(caps?.maxContext);
38
+ if (siblingMax) return { maxContext: siblingMax, branch: "sibling-capabilities" };
39
+ const directModel = await input.modelsRegistry.getModel(sibling, input.modelId).catch(() => void 0);
40
+ const directMax = positiveNumber(directModel?.capabilities.maxContext);
41
+ if (directMax) return { maxContext: directMax, branch: "sibling-direct-model" };
42
+ }
43
+ let divergedFromCatalog = false;
44
+ if (input.modelsRegistry) {
45
+ const topLevelBaseUrlApplies = input.providerId === input.config.provider;
46
+ const configuredBaseUrl = providerConfig?.baseUrl ?? (topLevelBaseUrlApplies ? input.config.baseUrl : void 0);
47
+ let divergesFromCatalog = false;
48
+ if (configuredBaseUrl) {
49
+ const resolved = await safeGetProvider(input.modelsRegistry, catalogId);
50
+ divergesFromCatalog = normalizeBaseUrl(configuredBaseUrl) !== normalizeBaseUrl(resolved?.apiBase);
51
+ }
52
+ divergedFromCatalog = divergesFromCatalog;
53
+ if (!divergesFromCatalog) {
54
+ const mergedModels = mergeCustomModelDefs(providerConfig?.customModels, input.config.models);
55
+ const caps = await capabilitiesFor(
56
+ input.modelsRegistry,
57
+ catalogId,
58
+ input.modelId,
59
+ mergedModels
60
+ ).catch(() => void 0);
61
+ const catalogMax = positiveNumber(caps?.maxContext);
62
+ if (catalogMax) return { maxContext: catalogMax, branch: "catalog-capabilities" };
63
+ const directModel = await input.modelsRegistry.getModel(catalogId, input.modelId).catch(() => void 0);
64
+ const directMax = positiveNumber(directModel?.capabilities.maxContext);
65
+ if (directMax) return { maxContext: directMax, branch: "catalog-direct-model" };
66
+ }
67
+ }
68
+ const explicitContext = positiveNumber(input.config.context?.effectiveMaxContext);
69
+ if (explicitContext) {
70
+ return { maxContext: explicitContext, branch: "explicit-config-fallback" };
71
+ }
72
+ const familyDefault = positiveNumber(input.provider.capabilities.maxContext) ?? 0;
73
+ const branch = familyDefault === 0 ? "unknown" : divergedFromCatalog ? "diverging-baseurl-family-default" : "family-default";
74
+ return { maxContext: familyDefault, branch };
75
+ }
76
+ async function resolveRuntimeMaxContext(input) {
77
+ const { maxContext } = await resolveRuntimeMaxContextDetailed(input);
78
+ return maxContext;
79
+ }
80
+ var SUSPICIOUS_SHRINK_BRANCHES = /* @__PURE__ */ new Set([
81
+ "family-default",
82
+ "diverging-baseurl-family-default"
83
+ ]);
84
+ function describeMaxContextChange(params) {
85
+ const { previous, current, providerId, modelId } = params;
86
+ if (current === previous) return void 0;
87
+ const branch = params.branch ?? "unknown";
88
+ const shrank = previous > 0 && current > 0 && current < previous;
89
+ const suspicious = SUSPICIOUS_SHRINK_BRANCHES.has(branch);
90
+ const detail = `max-context ${previous} \u2192 ${current} for ${providerId}/${modelId} (branch=${branch}${shrank ? ", DECREASED" : ""})`;
91
+ return shrank && suspicious ? {
92
+ level: "warn",
93
+ message: `Context window shrank via a non-catalog branch: ${detail}`,
94
+ shrank,
95
+ branch
96
+ } : { level: "debug", message: detail, shrank, branch };
97
+ }
98
+ async function refreshRuntimeModelCatalog(input) {
99
+ if (!input.modelsRegistry) return false;
100
+ try {
101
+ if (await refreshCatalogIfStale(input.modelsRegistry) === "recent") return false;
102
+ input.logger?.debug?.(
103
+ `models.dev catalog refreshed${input.reason ? ` (${input.reason})` : ""}`
104
+ );
105
+ return true;
106
+ } catch (err) {
107
+ input.logger?.warn?.(
108
+ `models.dev refresh failed${input.reason ? ` (${input.reason})` : ""}: ${toErrorMessage(err)}; using cached catalog`
109
+ );
110
+ return false;
111
+ }
112
+ }
113
+ async function safeGetProvider(registry, id) {
114
+ try {
115
+ return await registry.getProvider(id);
116
+ } catch {
117
+ return void 0;
118
+ }
119
+ }
120
+ function normalizeBaseUrl(url) {
121
+ if (!url) return "";
122
+ return url.trim().toLowerCase().replace(/\/+$/, "");
123
+ }
124
+ function readConfiguredMaxContext(providerConfig) {
125
+ if (!providerConfig || typeof providerConfig !== "object") return void 0;
126
+ const capabilities = providerConfig.capabilities;
127
+ if (!capabilities || typeof capabilities !== "object") return void 0;
128
+ return capabilities.maxContext;
129
+ }
130
+ function positiveNumber(value) {
131
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
132
+ }
133
+
134
+ export {
135
+ resolveRuntimeMaxContextDetailed,
136
+ resolveRuntimeMaxContext,
137
+ describeMaxContextChange,
138
+ refreshRuntimeModelCatalog
139
+ };
140
+ //# sourceMappingURL=chunk-CZTXF6HY.js.map
@@ -817,7 +817,7 @@ var helpTable = {
817
817
  name: "sessions",
818
818
  title: "wstack sessions \u2014 list and resume recent sessions",
819
819
  description: "List recent sessions, show one session in detail, resume a session, or inspect a session's audit log. The audit log is stored as JSONL next to each session's recording.",
820
- usage: "wstack sessions [list|show|resume|fork|doctor|config|fleet] [...]",
820
+ usage: "wstack sessions [list|show|resume|fork|move|doctor|config|fleet] [...]",
821
821
  subcommands: [
822
822
  { name: "list", description: "List the most recent sessions." },
823
823
  {
@@ -830,6 +830,10 @@ var helpTable = {
830
830
  name: "fork [<id>] [--to N]",
831
831
  description: "Create an isolated child journal at a persisted boundary."
832
832
  },
833
+ {
834
+ name: "move <id> --to <path>",
835
+ description: "Move a closed session to another git worktree of this repository, or to another project (its journal moves to that project)."
836
+ },
833
837
  { name: "config", description: "Show or edit session-specific config." },
834
838
  { name: "fleet", description: "List the active fleet of sessions." }
835
839
  ],
@@ -959,6 +963,13 @@ var helpTable = {
959
963
  usage: "wstack update [--check-only] [--pm <manager>] [--allow-scripts (alias: --lifecycle-scripts)]",
960
964
  seeAlso: "wstack version (read-only version info)"
961
965
  },
966
+ remote: {
967
+ name: "remote",
968
+ title: "wstack remote \u2014 run WrongStack on another machine over SSH",
969
+ description: "Runs WrongStack on the remote machine, in the given project directory, and opens its WebUI here through an SSH tunnel; the agent, its tools and its daemons run remotely. The system ssh is used, so ~/.ssh/config, your agent and known_hosts apply. The matching build is uploaded once per version to ~/.wrongstack/remote and checked by SHA-256. A dropped connection is reopened; the remote host keeps running meanwhile. Nothing from your local configuration is copied: set up a provider in the remote WebUI the first time.",
970
+ usage: "wstack remote <user@host:/path | ssh://user@host:port/path> [--port <n>] [--open] [--keep] [--ssh-config <file>] [--remote-binary <file>]",
971
+ seeAlso: "wstack --remote <target> (same command)"
972
+ },
962
973
  // -- ACP (Agent Client Protocol) --------------------------------------
963
974
  acp: {
964
975
  name: "acp",
@@ -1080,13 +1091,17 @@ var helpTable = {
1080
1091
  // -- Permissions ────────────────────────────────────────────────────
1081
1092
  permissions: {
1082
1093
  name: "permissions",
1083
- title: "wstack permissions \u2014 explain tool permission decisions",
1084
- description: "Side-effect-free permission decision explainer. Evaluates the effective permission rules for a tool and input arguments without prompting, modifying trust files, or mutating state.",
1085
- usage: "wstack permissions explain <tool> [--input '<json>'] [--json]",
1094
+ title: "wstack permissions \u2014 list and explain the permission rules",
1095
+ description: "Side-effect-free views of the permission policy the agent runs under: every rule in the order it is checked, and how one tool call is decided, without prompting, modifying trust files, or mutating state. Inside a session, /permissions also sets allow/deny rules for that session only.",
1096
+ usage: "wstack permissions [rules|explain <tool> [--input '<json>']] [--json]",
1086
1097
  subcommands: [
1098
+ {
1099
+ name: "rules",
1100
+ description: "List every permission rule, in the order they are checked (first match decides)."
1101
+ },
1087
1102
  {
1088
1103
  name: "explain <tool>",
1089
- description: "Explain how the permission policy evaluates a tool call."
1104
+ description: "Explain how the permission policy decides a tool call, and name the rule."
1090
1105
  }
1091
1106
  ],
1092
1107
  seeAlso: "wstack tools (list available tools)"
@@ -1112,6 +1127,21 @@ var helpTable = {
1112
1127
  subcommands: [{ name: "status", description: "Show daemon and attachment-broker health." }],
1113
1128
  seeAlso: "wstack doctor (broader environment diagnostics)"
1114
1129
  },
1130
+ "import-claude-code": {
1131
+ name: "import-claude-code",
1132
+ title: "wstack import-claude-code \u2014 bring a Claude Code setup across",
1133
+ description: "Import MCP servers from ~/.claude.json (user + this project) and the repository's .mcp.json into the active profile. Previews by default. Repository servers arrive disabled unless --enable-project-servers. Skills are read in place; hooks, permission rules and CLAUDE.md are reported with next steps, not translated.",
1134
+ usage: "wstack import-claude-code [--apply] [--overwrite] [--enable-project-servers]",
1135
+ subcommands: [
1136
+ { name: "--apply", description: "Write the plan (default: preview only)." },
1137
+ { name: "--overwrite", description: "Replace servers that already exist by name." },
1138
+ {
1139
+ name: "--enable-project-servers",
1140
+ description: "Enable the repository's .mcp.json servers on import."
1141
+ }
1142
+ ],
1143
+ seeAlso: "wstack mcp list; --mcp-config (one-off servers without importing)"
1144
+ },
1115
1145
  // -- Chronicle ──────────────────────────────────────────────────────
1116
1146
  chronicle: {
1117
1147
  name: "chronicle",
@@ -1213,4 +1243,4 @@ export {
1213
1243
  subcommandsWithFocusedHelp,
1214
1244
  renderGenericHelp
1215
1245
  };
1216
- //# sourceMappingURL=chunk-SKPDE62W.js.map
1246
+ //# sourceMappingURL=chunk-EPR42SWM.js.map
@@ -33,4 +33,4 @@ export {
33
33
  API_VERSION,
34
34
  STANDALONE_TARGET
35
35
  };
36
- //# sourceMappingURL=chunk-YBUCXXYZ.js.map
36
+ //# sourceMappingURL=chunk-F5DCFAKI.js.map