@wrongstack/cli 1.0.4 → 1.0.7

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 (44) hide show
  1. package/dist/{acp-AB54FWM2.js → acp-A5EQEXQO.js} +69 -11
  2. package/dist/{auth-WDMSNZ3S.js → auth-3K6EN5JP.js} +3 -3
  3. package/dist/boot/container-wiring.d.ts +2 -0
  4. package/dist/boot/short-circuit-desktop.d.ts +1 -0
  5. package/dist/{chunk-VUVOMXWP.js → chunk-3VXYY5JC.js} +8 -1
  6. package/dist/{chunk-U6PGWDMZ.js → chunk-4OLAZIIN.js} +2 -2
  7. package/dist/{chunk-I7V2OYVH.js → chunk-5EA6OTLJ.js} +3 -6
  8. package/dist/{chunk-O4A3HHKD.js → chunk-672UXYL3.js} +2 -2
  9. package/dist/{chunk-ONOT5OJ2.js → chunk-FSZ5QU3M.js} +2 -2
  10. package/dist/{chunk-KNMIBKLV.js → chunk-JY52HWL6.js} +47 -1
  11. package/dist/{chunk-BIWE22O5.js → chunk-RLCKKLJA.js} +8 -8
  12. package/dist/{chunk-VFCJOWJB.js → chunk-RMQNCHGO.js} +8 -7
  13. package/dist/{chunk-3I5ZJXM5.js → chunk-XIZZ2EXG.js} +161 -62
  14. package/dist/{cli-context-WFC3BNGM.js → cli-context-TIAP6YQK.js} +95 -15
  15. package/dist/cli-context.d.ts +2 -0
  16. package/dist/{cli-main-GU3YZLMO.js → cli-main-AKJHDSHX.js} +1111 -721
  17. package/dist/config-doctor.d.ts +1 -1
  18. package/dist/execute-deps.d.ts +3 -1
  19. package/dist/{execution-RAZDDQFC.js → execution-FJE27VQ6.js} +105 -28
  20. package/dist/{hq-5XHEIIH6.js → hq-G5PCP325.js} +8 -6
  21. package/dist/hq-command-controller.d.ts +15 -0
  22. package/dist/hq-server/auth-state.d.ts +6 -0
  23. package/dist/hq-server/auth.d.ts +10 -1
  24. package/dist/hq-server/routes/auth/common.d.ts +34 -0
  25. package/dist/hq-server/routes/auth/password-routes.d.ts +4 -2
  26. package/dist/hq-server/types.d.ts +18 -0
  27. package/dist/{hq-server-CNUTBWTK.js → hq-server-G3VVVMIG.js} +3 -3
  28. package/dist/index.js +8 -5
  29. package/dist/input-reader.d.ts +2 -2
  30. package/dist/{mcp-HOMLC4WE.js → mcp-FX7TKPTV.js} +10 -8
  31. package/dist/mcp-serve.d.ts +31 -0
  32. package/dist/{modeldiag-46CMWUNM.js → modeldiag-CJSFHZ3J.js} +55 -31
  33. package/dist/permission-prompt-mirror.d.ts +70 -0
  34. package/dist/permission-prompt.d.ts +10 -1
  35. package/dist/{providers-models-6MOGAOVK.js → providers-models-LFNZ5WI7.js} +2 -2
  36. package/dist/{short-circuit-flags-YDMLAQ5R.js → short-circuit-flags-RAT6UZVI.js} +2 -2
  37. package/dist/slash-commands/subagent-models.d.ts +4 -0
  38. package/dist/subagent-models/panel-service.d.ts +28 -0
  39. package/dist/subcommands/handlers/modeldiag-test.d.ts +7 -0
  40. package/dist/{subcommands-7N4RIK6H.js → subcommands-VFVUTYAV.js} +2 -2
  41. package/dist/webui-server/prefs-seeding.d.ts +8 -0
  42. package/dist/{webui-server-OBV5JYJV.js → webui-server-3NYXBZHX.js} +36 -12
  43. package/dist/wiring/hq-telemetry.d.ts +7 -0
  44. package/package.json +28 -28
@@ -5,7 +5,7 @@ import {
5
5
  makePromptDelegate,
6
6
  renderAgentsTemplate,
7
7
  renderDiff
8
- } from "./chunk-VFCJOWJB.js";
8
+ } from "./chunk-RMQNCHGO.js";
9
9
  import {
10
10
  theme as theme2
11
11
  } from "./chunk-QD544J2B.js";
@@ -19,24 +19,24 @@ import {
19
19
  } from "./chunk-GPPRNAKW.js";
20
20
  import {
21
21
  subcommands
22
- } from "./chunk-BIWE22O5.js";
22
+ } from "./chunk-RLCKKLJA.js";
23
23
  import {
24
24
  renderDeepHelp,
25
25
  renderFocusedHelp
26
26
  } from "./chunk-JX6KL7OF.js";
27
27
  import {
28
28
  handleHelpVersionShortCircuit
29
- } from "./chunk-U6PGWDMZ.js";
29
+ } from "./chunk-4OLAZIIN.js";
30
30
  import {
31
31
  DEFAULT_PORT
32
- } from "./chunk-3I5ZJXM5.js";
32
+ } from "./chunk-XIZZ2EXG.js";
33
33
  import "./chunk-HXJYHAR4.js";
34
34
  import {
35
35
  resolveHqPasswordInput
36
36
  } from "./chunk-AUQDGU5D.js";
37
37
  import {
38
38
  normalizeHqPublicOrigin
39
- } from "./chunk-I7V2OYVH.js";
39
+ } from "./chunk-5EA6OTLJ.js";
40
40
  import {
41
41
  parseHqIpAllowlist
42
42
  } from "./chunk-Q7E3BPDU.js";
@@ -47,7 +47,7 @@ import {
47
47
  applyNodeEnvDefault,
48
48
  applySessionShellDefault,
49
49
  runPreflight
50
- } from "./chunk-O4A3HHKD.js";
50
+ } from "./chunk-672UXYL3.js";
51
51
  import "./chunk-6WRKAACA.js";
52
52
  import {
53
53
  CLI_VERSION
@@ -63,13 +63,13 @@ import {
63
63
  runPicker,
64
64
  saveToGlobalConfig,
65
65
  theme
66
- } from "./chunk-ONOT5OJ2.js";
66
+ } from "./chunk-FSZ5QU3M.js";
67
67
  import "./chunk-2VMJ3E5Z.js";
68
68
  import "./chunk-B4JLSXZB.js";
69
69
  import {
70
70
  isKeylessLocalProvider,
71
71
  visibleModelIds
72
- } from "./chunk-VUVOMXWP.js";
72
+ } from "./chunk-3VXYY5JC.js";
73
73
  import {
74
74
  activeProfileConfigPath
75
75
  } from "./chunk-YMXXOOFN.js";
@@ -125,11 +125,64 @@ function resolveBundledSkillsDir() {
125
125
  }
126
126
  }
127
127
 
128
+ // src/permission-prompt-mirror.ts
129
+ import { randomUUID } from "node:crypto";
130
+ import { describeWriteTargets } from "@wrongstack/core/security";
131
+ var REPL_MIRROR_TTL_MS = 6e4;
132
+ var REPL_MIRROR_HEARTBEAT_MS = 2e4;
133
+ function makeMirroredPromptDelegate(deps) {
134
+ const now = deps.now ?? Date.now;
135
+ return async (tool, input, suggestedPattern) => {
136
+ const registry = deps.getRegistry();
137
+ const controller = new AbortController();
138
+ if (registry === void 0) {
139
+ return deps.inner(tool, input, suggestedPattern, controller.signal);
140
+ }
141
+ const toolUseId = `repl:${randomUUID()}`;
142
+ let settled = false;
143
+ let remoteDecision;
144
+ const finish = registry.register({
145
+ toolUseId,
146
+ toolName: tool.name,
147
+ sessionId: deps.getSessionId?.(),
148
+ deadlineAt: now() + REPL_MIRROR_TTL_MS,
149
+ input,
150
+ suggestedPattern,
151
+ ...tool.riskTier ? { riskTier: tool.riskTier } : {},
152
+ decisionSource: "default",
153
+ writeTargets: describeWriteTargets(tool, input),
154
+ destructive: tool.riskTier === "destructive",
155
+ resolve: (decision) => {
156
+ if (settled) return;
157
+ settled = true;
158
+ remoteDecision = decision;
159
+ controller.abort();
160
+ }
161
+ });
162
+ const heartbeat = setInterval(() => {
163
+ registry.renew(toolUseId, now() + REPL_MIRROR_TTL_MS);
164
+ }, REPL_MIRROR_HEARTBEAT_MS);
165
+ heartbeat.unref?.();
166
+ try {
167
+ const typed = await deps.inner(tool, input, suggestedPattern, controller.signal);
168
+ if (remoteDecision !== void 0) return remoteDecision;
169
+ settled = true;
170
+ const decision = typed === "yes" || typed === "always" || typed === "deny" ? typed : "no";
171
+ finish(decision);
172
+ return decision;
173
+ } finally {
174
+ clearInterval(heartbeat);
175
+ finish("no");
176
+ }
177
+ };
178
+ }
179
+
128
180
  // src/boot/container-wiring.ts
129
181
  function wireContainer(deps) {
130
182
  const pathResolver = new DefaultPathResolver(deps.cwd);
131
183
  const events = new CoreEventBus();
132
184
  events.setLogger(deps.logger);
185
+ const approvalMirror = { current: void 0 };
133
186
  const container = createDefaultContainer({
134
187
  config: deps.config,
135
188
  wpaths: deps.wpaths,
@@ -138,7 +191,15 @@ function wireContainer(deps) {
138
191
  events,
139
192
  permission: {
140
193
  yolo: deps.config.yolo,
141
- promptDelegate: makePromptDelegate(deps.reader)
194
+ // Wrapped so the REPL's terminal prompt also appears on the HQ
195
+ // dashboard and can be answered from there. The wrapper is a no-op
196
+ // until `approvalMirror.current` is populated (HQ telemetry boot), and
197
+ // the terminal prompt itself behaves exactly as it always has.
198
+ promptDelegate: makeMirroredPromptDelegate({
199
+ inner: makePromptDelegate(deps.reader),
200
+ getRegistry: () => approvalMirror.current,
201
+ getSessionId: () => approvalMirror.sessionId?.()
202
+ })
142
203
  },
143
204
  compactor: {
144
205
  preserveK: deps.config.context.preserveK,
@@ -150,7 +211,7 @@ function wireContainer(deps) {
150
211
  container.bind(TOKENS.PathResolver, () => pathResolver);
151
212
  container.bind(TOKENS.Renderer, () => deps.renderer);
152
213
  container.bind(TOKENS.InputReader, () => deps.reader);
153
- return { pathResolver, events, container };
214
+ return { pathResolver, events, container, approvalMirror };
154
215
  }
155
216
 
156
217
  // src/boot/launch-menu.ts
@@ -714,6 +775,10 @@ function stripDesktopLauncherArgs(argv) {
714
775
  }
715
776
  return out;
716
777
  }
778
+ function selectDesktopLauncherExecutable(execPath, runningUnderBun, nodeOverride) {
779
+ if (!runningUnderBun) return execPath;
780
+ return nodeOverride?.trim() || "node";
781
+ }
717
782
  async function handleDesktopShortCircuit(flags, argv) {
718
783
  if (flags["desktop"] !== true) return null;
719
784
  return launchDesktop(stripDesktopLauncherArgs(argv));
@@ -740,7 +805,12 @@ async function launchDesktop(args) {
740
805
  return 1;
741
806
  }
742
807
  return await new Promise((resolve2) => {
743
- const child = spawn(process.execPath, [launcherPath, ...args], {
808
+ const executable = selectDesktopLauncherExecutable(
809
+ process.execPath,
810
+ typeof globalThis.Bun !== "undefined",
811
+ process.env["NODE"]
812
+ );
813
+ const child = spawn(executable, [launcherPath, ...args], {
744
814
  stdio: "inherit",
745
815
  env: process.env,
746
816
  windowsHide: false
@@ -796,7 +866,7 @@ async function isPortInUse(host, port) {
796
866
  }
797
867
  async function handleHqShortCircuit(flags) {
798
868
  if (flags["hq"] !== true) return null;
799
- const { startHqServer } = await import("./hq-server-CNUTBWTK.js");
869
+ const { startHqServer } = await import("./hq-server-G3VVVMIG.js");
800
870
  const tunnelRequested = flags["tunnel"] === true;
801
871
  const rawPublicUrl = typeof flags["hq-public-url"] === "string" ? flags["hq-public-url"] : process.env.WRONGSTACK_HQ_PUBLIC_URL;
802
872
  let publicOrigin;
@@ -1818,8 +1888,10 @@ var ReadlineInputReader = class {
1818
1888
  }
1819
1889
  });
1820
1890
  }
1821
- async readKey(prompt, options) {
1891
+ async readKey(prompt, options, opts = {}) {
1822
1892
  setOutputLineGuard(null);
1893
+ const signal = opts.signal;
1894
+ if (signal?.aborted) return "";
1823
1895
  writeOut(prompt);
1824
1896
  return new Promise((resolve2) => {
1825
1897
  const stdin = process.stdin;
@@ -1849,14 +1921,21 @@ var ReadlineInputReader = class {
1849
1921
  cleanup();
1850
1922
  resolve2("");
1851
1923
  };
1924
+ const onAbort = () => {
1925
+ cleanup();
1926
+ writeOut("\n");
1927
+ resolve2("");
1928
+ };
1852
1929
  const cleanup = () => {
1853
1930
  stdin.off("data", onData);
1854
1931
  stdin.off("close", onClose);
1932
+ signal?.removeEventListener("abort", onAbort);
1855
1933
  setRawMode2(stdin, wasRaw);
1856
1934
  if (wasPaused) stdin.pause();
1857
1935
  };
1858
1936
  stdin.on("data", onData);
1859
1937
  stdin.on("close", onClose);
1938
+ signal?.addEventListener("abort", onAbort, { once: true });
1860
1939
  });
1861
1940
  }
1862
1941
  /**
@@ -3201,7 +3280,7 @@ async function initializeCli(argv) {
3201
3280
  }).catch(() => {
3202
3281
  });
3203
3282
  });
3204
- const { events, container } = wireContainer({
3283
+ const { events, container, approvalMirror } = wireContainer({
3205
3284
  config,
3206
3285
  wpaths,
3207
3286
  cwd,
@@ -3216,6 +3295,7 @@ async function initializeCli(argv) {
3216
3295
  updateInfo: refreshedUpdateInfo,
3217
3296
  events,
3218
3297
  container,
3298
+ approvalMirror,
3219
3299
  configStore,
3220
3300
  webuiSessionChild
3221
3301
  };
@@ -3223,4 +3303,4 @@ async function initializeCli(argv) {
3223
3303
  export {
3224
3304
  initializeCli
3225
3305
  };
3226
- //# sourceMappingURL=cli-context-WFC3BNGM.js.map
3306
+ //# sourceMappingURL=cli-context-TIAP6YQK.js.map
@@ -22,6 +22,8 @@ import type { BootContext } from './boot.js';
22
22
  export interface CliContext extends BootContext {
23
23
  events: EventBus;
24
24
  container: ReturnType<typeof wireContainer>['container'];
25
+ /** Late-bound handle the REPL prompt uses to mirror approvals to HQ. */
26
+ approvalMirror: ReturnType<typeof wireContainer>['approvalMirror'];
25
27
  configStore: ConfigStore;
26
28
  webuiSessionChild?: WebuiSessionChildOptions | undefined;
27
29
  }