@wrongstack/cli 0.309.0 → 0.310.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/{acp-5ZLGFHWP.js → acp-EA57GUFB.js} +6 -4
  2. package/dist/acp-server-agent.d.ts +1 -1
  3. package/dist/{audit-BBR22QH3.js → audit-ZPCLCC3C.js} +1 -1
  4. package/dist/{auth-WOKC2RVG.js → auth-VQMSZGKE.js} +4 -4
  5. package/dist/auth-menu/loopback-server.d.ts +0 -12
  6. package/dist/{bench-XNDUJOSZ.js → bench-XYG56AMO.js} +1 -1
  7. package/dist/boot/tui-session-stub-enrich.d.ts +20 -0
  8. package/dist/{chronicle-63MFCZN6.js → chronicle-6EPPMUC5.js} +1 -1
  9. package/dist/{chunk-53STH6CX.js → chunk-63GFD62R.js} +3 -2
  10. package/dist/{chunk-SZ42FYPT.js → chunk-BXFYBQKR.js} +4 -6
  11. package/dist/{chunk-JQURRYU4.js → chunk-CHZZEEIP.js} +2 -2
  12. package/dist/{chunk-CB35UVXO.js → chunk-KQNYSZG2.js} +34 -9
  13. package/dist/{chunk-XSG33WHN.js → chunk-QAC263FZ.js} +4 -2
  14. package/dist/{chunk-SSSJQVUY.js → chunk-QYIIOMLE.js} +15 -2
  15. package/dist/{chunk-7JOMY3HO.js → chunk-USYOJIV2.js} +3 -3
  16. package/dist/{chunk-DOJLAULS.js → chunk-WOTGMHAH.js} +36 -26
  17. package/dist/{chunk-T6YAVFXA.js → chunk-X3N5TS2S.js} +2 -1
  18. package/dist/{cli-main-RG2PTQ6S.js → cli-main-RFEZAJ4U.js} +3190 -2839
  19. package/dist/{diag-doctor-WTBHPOMB.js → diag-doctor-HJKFUY6B.js} +1 -1
  20. package/dist/diff-renderer.d.ts +17 -0
  21. package/dist/{execution-TYUXABWI.js → execution-WA2UCXNM.js} +180 -61
  22. package/dist/{export-CCUXRJOU.js → export-ROG3DKTZ.js} +1 -1
  23. package/dist/{hq-PA6RH2UW.js → hq-AG4VW4XO.js} +18 -10
  24. package/dist/hq-server/handle-types.d.ts +32 -0
  25. package/dist/hq-server/login-attempt-store.d.ts +5 -0
  26. package/dist/{hq-server-PBRU275L.js → hq-server-GZGM4BHA.js} +2 -2
  27. package/dist/hq-server.d.ts +2 -20
  28. package/dist/index.js +105 -76
  29. package/dist/{init-E2NDDOHI.js → init-4JQSG66Q.js} +1 -1
  30. package/dist/{mailbox-serve-V3QIJBDH.js → mailbox-serve-5S3PHG5D.js} +1 -1
  31. package/dist/{mcp-CMLFHRG2.js → mcp-RRPKNRSN.js} +3 -1
  32. package/dist/mcp-serve.d.ts +1 -1
  33. package/dist/{modeldiag-ICMPHT5L.js → modeldiag-H6DKWJ2N.js} +6 -12
  34. package/dist/{plugin-usage-26LIIW3P.js → plugin-usage-GCTYOZPH.js} +1 -1
  35. package/dist/{projects-XE76NFNZ.js → projects-5J727S4L.js} +1 -1
  36. package/dist/provider-config-utils.d.ts +1 -2
  37. package/dist/{providers-models-D23WUD74.js → providers-models-663NDPRQ.js} +2 -2
  38. package/dist/{quick-VIO2BEHS.js → quick-XLYLZX4B.js} +1 -1
  39. package/dist/{replay-WBRMEWQ5.js → replay-RZXZKP2U.js} +1 -1
  40. package/dist/{rewind-7RE6ONIC.js → rewind-2FFNOOKS.js} +1 -1
  41. package/dist/{sessions-config-YX2ZPAFM.js → sessions-config-7Q7QJBKJ.js} +1 -1
  42. package/dist/slash-commands/dev.d.ts +50 -0
  43. package/dist/subcommands/handlers/acp.d.ts +1 -1
  44. package/dist/subcommands/handlers/audit.d.ts +1 -1
  45. package/dist/subcommands/handlers/auth.d.ts +1 -1
  46. package/dist/subcommands/handlers/bench.d.ts +1 -1
  47. package/dist/subcommands/handlers/chronicle.d.ts +1 -1
  48. package/dist/subcommands/handlers/config-history.d.ts +1 -1
  49. package/dist/subcommands/handlers/diag-doctor.d.ts +1 -1
  50. package/dist/subcommands/handlers/export.d.ts +1 -1
  51. package/dist/subcommands/handlers/hq.d.ts +1 -1
  52. package/dist/subcommands/handlers/init.d.ts +1 -1
  53. package/dist/subcommands/handlers/mailbox-serve.d.ts +1 -1
  54. package/dist/subcommands/handlers/mcp.d.ts +1 -1
  55. package/dist/subcommands/handlers/modeldiag-bench.d.ts +1 -1
  56. package/dist/subcommands/handlers/modeldiag-eval.d.ts +1 -1
  57. package/dist/subcommands/handlers/modeldiag-test.d.ts +1 -1
  58. package/dist/subcommands/handlers/modeldiag.d.ts +1 -1
  59. package/dist/subcommands/handlers/plugin-usage.d.ts +1 -1
  60. package/dist/subcommands/handlers/projects.d.ts +1 -1
  61. package/dist/subcommands/handlers/providers-models.d.ts +1 -1
  62. package/dist/subcommands/handlers/quick.d.ts +1 -1
  63. package/dist/subcommands/handlers/replay.d.ts +1 -1
  64. package/dist/subcommands/handlers/rewind.d.ts +1 -1
  65. package/dist/subcommands/handlers/sessions-config.d.ts +1 -1
  66. package/dist/subcommands/handlers/sessions-fleet.d.ts +1 -1
  67. package/dist/subcommands/handlers/tools-skills.d.ts +1 -1
  68. package/dist/subcommands/handlers/update.d.ts +1 -1
  69. package/dist/subcommands/handlers/version-help.d.ts +1 -1
  70. package/dist/subcommands/index.d.ts +2 -3
  71. package/dist/{tools-skills-UNKLOB7M.js → tools-skills-Q4P27URS.js} +1 -1
  72. package/dist/{update-VZSOZGYC.js → update-RATFF63M.js} +2 -2
  73. package/dist/{version-help-TFD6VPF3.js → version-help-WMPSEL4U.js} +2 -2
  74. package/dist/{webui-server-JXJ4CGIX.js → webui-server-3DU6BVTB.js} +7 -10
  75. package/dist/wiring/cli-execute-builder.d.ts +110 -85
  76. package/dist/wiring/cli-slash-commands-setup.d.ts +102 -72
  77. package/dist/wiring/director-announcement.d.ts +31 -0
  78. package/dist/wiring/session-establishment.d.ts +45 -0
  79. package/dist/wiring/session-registry.d.ts +1 -1
  80. package/dist/wiring/session-runtime.d.ts +64 -0
  81. package/dist/wiring/teardown-registrar.d.ts +41 -0
  82. package/dist/wiring/vector-memory-setup.d.ts +30 -0
  83. package/package.json +27 -25
@@ -32,6 +32,11 @@ export declare class LoginAttemptStore {
32
32
  /**
33
33
  * Load persisted state from disk and prune stale entries.
34
34
  * Safe to call once at startup; subsequent calls reload from disk.
35
+ *
36
+ * SEC-001: legacy `cred:` entries (per-password hashes persisted by the
37
+ * pre-fix version) are skipped here, not just on write — re-seeding them
38
+ * would keep the hashes in memory and on disk. When any are found, a
39
+ * debounced rewrite scrubs them from the file.
35
40
  */
36
41
  load(): Promise<void>;
37
42
  get(key: string): LoginAttemptEntry | undefined;
@@ -15,7 +15,7 @@ import {
15
15
  readLocalSubagentTranscript,
16
16
  sanitizeApiError,
17
17
  startHqServer
18
- } from "./chunk-CB35UVXO.js";
18
+ } from "./chunk-KQNYSZG2.js";
19
19
  import "./chunk-KE7E7DPX.js";
20
20
  import "./chunk-Q5GTM25S.js";
21
21
  import "./chunk-7OCVIDC7.js";
@@ -37,4 +37,4 @@ export {
37
37
  sanitizeApiError,
38
38
  startHqServer
39
39
  };
40
- //# sourceMappingURL=hq-server-PBRU275L.js.map
40
+ //# sourceMappingURL=hq-server-GZGM4BHA.js.map
@@ -42,25 +42,7 @@ export interface HqServerOptions {
42
42
  tokenTtlMs?: number;
43
43
  trustedProxyHops?: number;
44
44
  }
45
- export interface HqStartupConnectionInfo {
46
- dataDir: string;
47
- browserUrl: string;
48
- clientUrl: string;
49
- clientEnv: {
50
- WRONGSTACK_HQ_URL: string;
51
- WRONGSTACK_HQ_TOKEN?: string;
52
- };
53
- createdAuth: boolean;
54
- browserTokenMode: boolean;
55
- passwordMode: boolean;
56
- }
57
- export type HqFirstRunSetup = HqStartupConnectionInfo;
58
- export interface HqServerHandle {
59
- host: string;
60
- port: number;
61
- firstRunSetup?: HqFirstRunSetup;
62
- trustPublicOrigin(origin: string): void;
63
- close(): Promise<void>;
64
- }
45
+ import type { HqServerHandle } from './hq-server/handle-types.js';
46
+ export type { HqFirstRunSetup, HqServerHandle, HqStartupConnectionInfo, } from './hq-server/handle-types.js';
65
47
  export declare function startHqServer(options?: HqServerOptions): Promise<HqServerHandle>;
66
48
  //# sourceMappingURL=hq-server.d.ts.map
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  makePromptDelegate,
7
7
  renderAgentsTemplate,
8
8
  renderDiff
9
- } from "./chunk-DOJLAULS.js";
9
+ } from "./chunk-WOTGMHAH.js";
10
10
  import {
11
11
  theme
12
12
  } from "./chunk-QD544J2B.js";
@@ -23,18 +23,18 @@ import {
23
23
  } from "./chunk-52C7PD2H.js";
24
24
  import {
25
25
  runUpdateCommand
26
- } from "./chunk-53STH6CX.js";
26
+ } from "./chunk-63GFD62R.js";
27
27
  import "./chunk-U3SS4NRH.js";
28
28
  import "./chunk-NUIHRGPY.js";
29
29
  import {
30
30
  DEFAULT_PORT
31
- } from "./chunk-CB35UVXO.js";
31
+ } from "./chunk-KQNYSZG2.js";
32
32
  import "./chunk-KE7E7DPX.js";
33
33
  import "./chunk-Q5GTM25S.js";
34
34
  import {
35
35
  helpCmd,
36
36
  versionCmd
37
- } from "./chunk-XSG33WHN.js";
37
+ } from "./chunk-QAC263FZ.js";
38
38
  import {
39
39
  CLI_VERSION
40
40
  } from "./chunk-XJXDOF63.js";
@@ -59,7 +59,7 @@ import {
59
59
  normalizeKeys,
60
60
  resolveActiveApiKey,
61
61
  writeKeysBack
62
- } from "./chunk-SZ42FYPT.js";
62
+ } from "./chunk-BXFYBQKR.js";
63
63
  import "./chunk-7OCVIDC7.js";
64
64
 
65
65
  // src/cli-context.ts
@@ -386,7 +386,7 @@ async function promptModeArrow(deps) {
386
386
  const { renderer } = deps;
387
387
  const stdin = process.stdin;
388
388
  const out = (s) => renderer.write(s);
389
- return await new Promise((resolve2) => {
389
+ return await new Promise((resolve3) => {
390
390
  let index = 0;
391
391
  let drawn = 0;
392
392
  let remaining = Math.round(MENU_TIMEOUT_MS / 1e3);
@@ -441,7 +441,7 @@ async function promptModeArrow(deps) {
441
441
  out("\x1B[0J");
442
442
  out(finalLine);
443
443
  out("\x1B[?25h");
444
- resolve2(result);
444
+ resolve3(result);
445
445
  };
446
446
  const pick = () => {
447
447
  const opt = MODE_OPTIONS[index];
@@ -500,7 +500,7 @@ async function promptModeArrow(deps) {
500
500
  setRawMode(stdin, true);
501
501
  stdin.resume();
502
502
  } catch {
503
- resolve2(null);
503
+ resolve3(null);
504
504
  return;
505
505
  }
506
506
  out("\x1B[?25l");
@@ -712,7 +712,7 @@ async function launchDesktop(args) {
712
712
  );
713
713
  return 1;
714
714
  }
715
- return await new Promise((resolve2) => {
715
+ return await new Promise((resolve3) => {
716
716
  const child = spawn(process.execPath, [launcherPath, ...args], {
717
717
  stdio: "inherit",
718
718
  env: process.env,
@@ -723,11 +723,11 @@ async function launchDesktop(args) {
723
723
  `${color2.red("\u2717 Failed to start WrongStack Desktop:")} ${err.message}
724
724
  `
725
725
  );
726
- resolve2(1);
726
+ resolve3(1);
727
727
  });
728
728
  child.once("exit", (code, signal) => {
729
- if (typeof code === "number") resolve2(code);
730
- else resolve2(signal ? 1 : 0);
729
+ if (typeof code === "number") resolve3(code);
730
+ else resolve3(signal ? 1 : 0);
731
731
  });
732
732
  });
733
733
  }
@@ -1660,7 +1660,10 @@ var helpTable = {
1660
1660
  { name: "list", description: "List available ACP agents from the cache." },
1661
1661
  { name: "sync", description: "Sync the official ACP agent registry into local cache." },
1662
1662
  { name: "spawn <id> <task>", description: "Spawn an ACP agent and wait for results." },
1663
- { name: "parallel <csv> <task>", description: "Fan a task out to multiple ACP agents in parallel." },
1663
+ {
1664
+ name: "parallel <csv> <task>",
1665
+ description: "Fan a task out to multiple ACP agents in parallel."
1666
+ },
1664
1667
  { name: "probe [csv]", description: "Handshake-test installed ACP agents." },
1665
1668
  { name: "bench [csv] [--fs]", description: "End-to-end benchmark and grade ACP agents." }
1666
1669
  ],
@@ -1732,7 +1735,10 @@ var helpTable = {
1732
1735
  usage: "wstack hq [serve] [--port <n>] [--password <secret>] [--tunnel] [--open] | wstack hq token [create|list|revoke]",
1733
1736
  subcommands: [
1734
1737
  { name: "serve", description: "Start the HQ dashboard server (default)." },
1735
- { name: "token create [label]", description: "Mint a browser or client authentication token." },
1738
+ {
1739
+ name: "token create [label]",
1740
+ description: "Mint a browser or client authentication token."
1741
+ },
1736
1742
  { name: "token list", description: "List active HQ authentication tokens." },
1737
1743
  { name: "token revoke <id>", description: "Revoke an issued HQ authentication token." }
1738
1744
  ],
@@ -1792,8 +1798,14 @@ var helpTable = {
1792
1798
  { name: "query [field=value ...]", description: "Query recorded provenance events." },
1793
1799
  { name: "status", description: "Check the Chronicle daemon and pipeline status." },
1794
1800
  { name: "facet <field>", description: "Group and count events across a facet." },
1795
- { name: "metrics [providers|tasks|files|summary]", description: "Query aggregated metrics from metrics.db." },
1796
- { name: "prune [--days N] [--dry-run]", description: "Purge journal entries older than N days." },
1801
+ {
1802
+ name: "metrics [providers|tasks|files|summary]",
1803
+ description: "Query aggregated metrics from metrics.db."
1804
+ },
1805
+ {
1806
+ name: "prune [--days N] [--dry-run]",
1807
+ description: "Purge journal entries older than N days."
1808
+ },
1797
1809
  { name: "compact", description: "Defragment and compact SQLite ledger." }
1798
1810
  ],
1799
1811
  seeAlso: "wstack audit (per-session audit log); wstack usage (cost summary)"
@@ -1849,44 +1861,46 @@ var subcommandsWithFocusedHelp = Object.keys(helpTable);
1849
1861
 
1850
1862
  // src/subcommands/index.ts
1851
1863
  var loaders = {
1852
- acp: async () => (await import("./acp-5ZLGFHWP.js")).acpCmd,
1853
- init: async () => (await import("./init-E2NDDOHI.js")).initCmd,
1854
- auth: async () => (await import("./auth-WOKC2RVG.js")).authCmd,
1855
- update: async () => (await import("./update-VZSOZGYC.js")).updateCmd,
1856
- sessions: async () => (await import("./sessions-config-YX2ZPAFM.js")).sessionsCmd,
1857
- config: async () => (await import("./sessions-config-YX2ZPAFM.js")).configCmd,
1858
- rewind: async () => (await import("./rewind-7RE6ONIC.js")).rewindCmd,
1859
- replay: async () => (await import("./replay-WBRMEWQ5.js")).replayCmd,
1860
- audit: async () => (await import("./audit-BBR22QH3.js")).auditCmd,
1861
- tools: async () => (await import("./tools-skills-UNKLOB7M.js")).toolsCmd,
1862
- skills: async () => (await import("./tools-skills-UNKLOB7M.js")).skillsCmd,
1863
- providers: async () => (await import("./providers-models-D23WUD74.js")).providersCmd,
1864
- models: async () => (await import("./providers-models-D23WUD74.js")).modelsCmd,
1865
- mcp: async () => (await import("./mcp-CMLFHRG2.js")).mcpCmd,
1866
- plugin: async () => (await import("./plugin-usage-26LIIW3P.js")).pluginCmd,
1867
- plugins: async () => (await import("./plugin-usage-26LIIW3P.js")).pluginCmd,
1868
- diag: async () => (await import("./diag-doctor-WTBHPOMB.js")).diagCmd,
1869
- doctor: async () => (await import("./diag-doctor-WTBHPOMB.js")).doctorCmd,
1870
- export: async () => (await import("./export-CCUXRJOU.js")).exportCmd,
1871
- usage: async () => (await import("./plugin-usage-26LIIW3P.js")).usageCmd,
1872
- version: async () => (await import("./version-help-TFD6VPF3.js")).versionCmd,
1873
- help: async () => (await import("./version-help-TFD6VPF3.js")).helpCmd,
1874
- projects: async () => (await import("./projects-XE76NFNZ.js")).projectsCmd,
1875
- modeldiag: async () => (await import("./modeldiag-ICMPHT5L.js")).modeldiagCmd,
1876
- quick: async () => (await import("./quick-VIO2BEHS.js")).quickCmd,
1877
- bench: async () => (await import("./bench-XNDUJOSZ.js")).benchCmd,
1878
- chronicle: async () => (await import("./chronicle-63MFCZN6.js")).chronicleCmd,
1879
- hq: async () => (await import("./hq-PA6RH2UW.js")).hqCmd,
1880
- mailbox: async () => (await import("./mailbox-serve-V3QIJBDH.js")).mailboxServeCmd,
1864
+ acp: async () => (await import("./acp-EA57GUFB.js")).acpCmd,
1865
+ init: async () => (await import("./init-4JQSG66Q.js")).initCmd,
1866
+ auth: async () => (await import("./auth-VQMSZGKE.js")).authCmd,
1867
+ update: async () => (await import("./update-RATFF63M.js")).updateCmd,
1868
+ sessions: async () => (await import("./sessions-config-7Q7QJBKJ.js")).sessionsCmd,
1869
+ config: async () => (await import("./sessions-config-7Q7QJBKJ.js")).configCmd,
1870
+ rewind: async () => (await import("./rewind-2FFNOOKS.js")).rewindCmd,
1871
+ replay: async () => (await import("./replay-RZXZKP2U.js")).replayCmd,
1872
+ audit: async () => (await import("./audit-ZPCLCC3C.js")).auditCmd,
1873
+ tools: async () => (await import("./tools-skills-Q4P27URS.js")).toolsCmd,
1874
+ skills: async () => (await import("./tools-skills-Q4P27URS.js")).skillsCmd,
1875
+ providers: async () => (await import("./providers-models-663NDPRQ.js")).providersCmd,
1876
+ models: async () => (await import("./providers-models-663NDPRQ.js")).modelsCmd,
1877
+ mcp: async () => (await import("./mcp-RRPKNRSN.js")).mcpCmd,
1878
+ plugin: async () => (await import("./plugin-usage-GCTYOZPH.js")).pluginCmd,
1879
+ plugins: async () => (await import("./plugin-usage-GCTYOZPH.js")).pluginCmd,
1880
+ diag: async () => (await import("./diag-doctor-HJKFUY6B.js")).diagCmd,
1881
+ doctor: async () => (await import("./diag-doctor-HJKFUY6B.js")).doctorCmd,
1882
+ export: async () => (await import("./export-ROG3DKTZ.js")).exportCmd,
1883
+ usage: async () => (await import("./plugin-usage-GCTYOZPH.js")).usageCmd,
1884
+ version: async () => (await import("./version-help-WMPSEL4U.js")).versionCmd,
1885
+ help: async () => (await import("./version-help-WMPSEL4U.js")).helpCmd,
1886
+ projects: async () => (await import("./projects-5J727S4L.js")).projectsCmd,
1887
+ modeldiag: async () => (await import("./modeldiag-H6DKWJ2N.js")).modeldiagCmd,
1888
+ quick: async () => (await import("./quick-XLYLZX4B.js")).quickCmd,
1889
+ bench: async () => (await import("./bench-XYG56AMO.js")).benchCmd,
1890
+ chronicle: async () => (await import("./chronicle-6EPPMUC5.js")).chronicleCmd,
1891
+ hq: async () => (await import("./hq-AG4VW4XO.js")).hqCmd,
1892
+ mailbox: async () => (await import("./mailbox-serve-5S3PHG5D.js")).mailboxServeCmd,
1881
1893
  permissions: async () => (await import("./permissions-2PWBL4YU.js")).permissionsCmd,
1882
1894
  project: async () => (await import("./project-BLQ3ALVL.js")).projectCmd,
1883
1895
  governance: async () => (await import("./governance-V2Z42RBE.js")).governanceCmd
1884
1896
  };
1885
1897
  var subcommands = Object.fromEntries(
1886
- Object.entries(loaders).map(([name, load]) => [
1887
- name,
1888
- async (args, deps) => (await load())(args, deps)
1889
- ])
1898
+ Object.entries(loaders).map(
1899
+ ([name, load]) => [
1900
+ name,
1901
+ async (args, deps) => (await load())(args, deps)
1902
+ ]
1903
+ )
1890
1904
  );
1891
1905
  var subcommandNames = Object.keys(loaders);
1892
1906
 
@@ -1936,24 +1950,24 @@ async function isHqAlreadyRunning(dataDir) {
1936
1950
  return null;
1937
1951
  }
1938
1952
  async function isPortInUse(host, port) {
1939
- return new Promise((resolve2) => {
1953
+ return new Promise((resolve3) => {
1940
1954
  const server = net.createServer();
1941
1955
  server.once("error", (err) => {
1942
1956
  if (err.code === "EADDRINUSE") {
1943
- resolve2(true);
1957
+ resolve3(true);
1944
1958
  } else {
1945
- resolve2(false);
1959
+ resolve3(false);
1946
1960
  }
1947
1961
  });
1948
1962
  server.once("listening", () => {
1949
- server.close(() => resolve2(false));
1963
+ server.close(() => resolve3(false));
1950
1964
  });
1951
1965
  server.listen(port, host);
1952
1966
  });
1953
1967
  }
1954
1968
  async function handleHqShortCircuit(flags) {
1955
1969
  if (flags["hq"] !== true) return null;
1956
- const { startHqServer } = await import("./hq-server-PBRU275L.js");
1970
+ const { startHqServer } = await import("./hq-server-GZGM4BHA.js");
1957
1971
  const tunnelRequested = flags["tunnel"] === true;
1958
1972
  const host = typeof flags["host"] === "string" ? flags["host"] : tunnelRequested ? "127.0.0.1" : HQ_CLI_DEFAULT_HOST2;
1959
1973
  if (tunnelRequested && !isLoopbackHost(host)) {
@@ -2084,7 +2098,7 @@ ${color6.green("Cloudflare Quick Tunnel ready:")} ${browserUrl}
2084
2098
  } catch {
2085
2099
  }
2086
2100
  }
2087
- await new Promise((resolve2) => {
2101
+ await new Promise((resolve3) => {
2088
2102
  const shutdown = async () => {
2089
2103
  const results = await Promise.allSettled([
2090
2104
  ...tunnel ? [tunnel.close()] : [],
@@ -2103,7 +2117,7 @@ ${color6.green("Cloudflare Quick Tunnel ready:")} ${browserUrl}
2103
2117
  })
2104
2118
  );
2105
2119
  }
2106
- resolve2();
2120
+ resolve3();
2107
2121
  };
2108
2122
  process.on("SIGINT", shutdown);
2109
2123
  process.on("SIGTERM", shutdown);
@@ -2491,7 +2505,7 @@ async function runProjectCheck(opts) {
2491
2505
  if (answer2 === "y" || answer2 === "yes") {
2492
2506
  try {
2493
2507
  const { spawn: spawn2 } = await import("node:child_process");
2494
- await new Promise((resolve2, reject) => {
2508
+ await new Promise((resolve3, reject) => {
2495
2509
  const child = spawn2("git", ["init"], {
2496
2510
  cwd,
2497
2511
  signal: AbortSignal.timeout(1e4),
@@ -2500,7 +2514,7 @@ async function runProjectCheck(opts) {
2500
2514
  child.on("error", reject);
2501
2515
  child.on(
2502
2516
  "close",
2503
- (code) => code === 0 ? resolve2() : reject(new Error(`git init failed with ${code}`))
2517
+ (code) => code === 0 ? resolve3() : reject(new Error(`git init failed with ${code}`))
2504
2518
  );
2505
2519
  });
2506
2520
  renderer.write(` ${color9.green("\u2713")} Git repository initialized
@@ -2744,25 +2758,25 @@ var ReadlineInputReader = class {
2744
2758
  async readLine(prompt, timeoutOpts) {
2745
2759
  if (this.history.length === 0) await this.loadHistory();
2746
2760
  while (this.pending) {
2747
- await new Promise((resolve2) => setTimeout(resolve2, 50));
2761
+ await new Promise((resolve3) => setTimeout(resolve3, 50));
2748
2762
  }
2749
2763
  this.pending = true;
2750
2764
  try {
2751
2765
  if (this.rl) {
2752
2766
  const old = this.rl;
2753
2767
  this.rl = void 0;
2754
- await new Promise((resolve2) => {
2768
+ await new Promise((resolve3) => {
2755
2769
  if (old.closed) {
2756
- resolve2();
2770
+ resolve3();
2757
2771
  } else {
2758
- old.once("close", resolve2);
2772
+ old.once("close", resolve3);
2759
2773
  old.close();
2760
2774
  }
2761
2775
  });
2762
2776
  }
2763
2777
  const fresh = this.ensure();
2764
2778
  this.installPromptGuard(fresh);
2765
- const line = await new Promise((resolve2) => {
2779
+ const line = await new Promise((resolve3) => {
2766
2780
  let settled = false;
2767
2781
  let timeoutHandle;
2768
2782
  const settle = (line2) => {
@@ -2770,7 +2784,7 @@ var ReadlineInputReader = class {
2770
2784
  settled = true;
2771
2785
  if (timeoutHandle) clearTimeout(timeoutHandle);
2772
2786
  setOutputLineGuard(null);
2773
- resolve2(line2);
2787
+ resolve3(line2);
2774
2788
  };
2775
2789
  if (timeoutOpts) {
2776
2790
  timeoutHandle = setTimeout(() => {
@@ -2835,7 +2849,7 @@ var ReadlineInputReader = class {
2835
2849
  async readKey(prompt, options) {
2836
2850
  setOutputLineGuard(null);
2837
2851
  writeOut(prompt);
2838
- return new Promise((resolve2) => {
2852
+ return new Promise((resolve3) => {
2839
2853
  const stdin = process.stdin;
2840
2854
  const wasRaw = stdin.isRaw;
2841
2855
  const wasPaused = stdin.isPaused();
@@ -2846,7 +2860,7 @@ var ReadlineInputReader = class {
2846
2860
  if (key === "") {
2847
2861
  cleanup();
2848
2862
  writeOut("\n");
2849
- resolve2("");
2863
+ resolve3("");
2850
2864
  return;
2851
2865
  }
2852
2866
  const opt = options.find(
@@ -2856,12 +2870,12 @@ var ReadlineInputReader = class {
2856
2870
  cleanup();
2857
2871
  writeOut(`${opt.key}
2858
2872
  `);
2859
- resolve2(opt.value);
2873
+ resolve3(opt.value);
2860
2874
  }
2861
2875
  };
2862
2876
  const onClose = () => {
2863
2877
  cleanup();
2864
- resolve2("");
2878
+ resolve3("");
2865
2879
  };
2866
2880
  const cleanup = () => {
2867
2881
  stdin.off("data", onData);
@@ -2893,7 +2907,7 @@ var ReadlineInputReader = class {
2893
2907
  this.rl?.close();
2894
2908
  this.rl = void 0;
2895
2909
  writeOut(prompt);
2896
- return new Promise((resolve2) => {
2910
+ return new Promise((resolve3) => {
2897
2911
  let buf = "";
2898
2912
  const wasRaw = stdin.isRaw;
2899
2913
  const cleanup = () => {
@@ -2922,13 +2936,13 @@ var ReadlineInputReader = class {
2922
2936
  cleanup();
2923
2937
  writeOut(` ${dim(`[${buf.length} chars]`)}
2924
2938
  `);
2925
- resolve2(buf);
2939
+ resolve3(buf);
2926
2940
  return;
2927
2941
  }
2928
2942
  if (ch === "") {
2929
2943
  cleanup();
2930
2944
  writeOut("\n");
2931
- resolve2("");
2945
+ resolve3("");
2932
2946
  return;
2933
2947
  }
2934
2948
  if (ch === "") {
@@ -4197,7 +4211,7 @@ async function checkGitInCwd(opts) {
4197
4211
  if (answer === "y" || answer === "yes") {
4198
4212
  try {
4199
4213
  const { spawn: spawn2 } = await import("node:child_process");
4200
- await new Promise((resolve2, reject) => {
4214
+ await new Promise((resolve3, reject) => {
4201
4215
  const child = spawn2("git", ["init"], {
4202
4216
  cwd,
4203
4217
  signal: AbortSignal.timeout(1e4),
@@ -4206,7 +4220,7 @@ async function checkGitInCwd(opts) {
4206
4220
  child.on("error", reject);
4207
4221
  child.on(
4208
4222
  "close",
4209
- (code) => code === 0 ? resolve2() : reject(new Error(`git init failed with ${code}`))
4223
+ (code) => code === 0 ? resolve3() : reject(new Error(`git init failed with ${code}`))
4210
4224
  );
4211
4225
  });
4212
4226
  renderer.write(` ${color13.green("\u2713")} Git repository initialized
@@ -4466,12 +4480,14 @@ async function initializeCli(argv) {
4466
4480
  async function main(argv) {
4467
4481
  const cliCtx = await initializeCli(argv);
4468
4482
  if (typeof cliCtx === "number") return cliCtx;
4469
- const { runInteractive } = await import("./cli-main-RG2PTQ6S.js");
4483
+ const { runInteractive } = await import("./cli-main-RFEZAJ4U.js");
4470
4484
  return runInteractive(cliCtx);
4471
4485
  }
4472
4486
 
4473
4487
  // src/cli-entry-point.ts
4474
- import { installCrashShield, writeErr as writeErr4 } from "@wrongstack/core/utils";
4488
+ import { resolve as resolve2 } from "node:path";
4489
+ import { pathToFileURL } from "node:url";
4490
+ import { installCrashShield, runFatalSalvageSync, writeErr as writeErr4 } from "@wrongstack/core/utils";
4475
4491
  var SQLITE_WARNING_RE = /sqlite is an experimental feature/i;
4476
4492
  function installSqliteWarningFilter() {
4477
4493
  const originalEmit = process.emitWarning.bind(process);
@@ -4485,7 +4501,15 @@ function installSqliteWarningFilter() {
4485
4501
  });
4486
4502
  }
4487
4503
  installSqliteWarningFilter();
4488
- var isMain = import.meta.url === `file://${process.argv[1]?.replace(/\\/g, "/")}` || process.argv[1]?.endsWith("/cli/dist/index.js") || process.argv[1]?.endsWith("\\cli\\dist\\index.js");
4504
+ function isCliMain(moduleUrl, argvEntry = process.argv[1]) {
4505
+ if (!argvEntry) return false;
4506
+ try {
4507
+ if (moduleUrl === pathToFileURL(resolve2(argvEntry)).href) return true;
4508
+ } catch {
4509
+ }
4510
+ return argvEntry.endsWith("/cli/dist/index.js") || argvEntry.endsWith("\\cli\\dist\\index.js");
4511
+ }
4512
+ var isMain = isCliMain(import.meta.url);
4489
4513
  function isBrokenOutputConsumer(error) {
4490
4514
  if (typeof error !== "object" || error === null || !("code" in error)) return false;
4491
4515
  return error.code === "EPIPE" || error.code === "ECONNRESET" || error.code === "ECONNABORTED";
@@ -4498,6 +4522,7 @@ function installBrokenPipeHandlers(options = {}) {
4498
4522
  if (!isBrokenOutputConsumer(error)) throw error;
4499
4523
  if (handled) return;
4500
4524
  handled = true;
4525
+ runFatalSalvageSync();
4501
4526
  exit(0);
4502
4527
  };
4503
4528
  for (const stream of streams) stream.on("error", onError);
@@ -4509,12 +4534,16 @@ function runAsMain(mainFn) {
4509
4534
  if (!isMain) return;
4510
4535
  installBrokenPipeHandlers();
4511
4536
  installCrashShield();
4537
+ process.on("exit", () => {
4538
+ runFatalSalvageSync();
4539
+ });
4512
4540
  mainFn(process.argv.slice(2)).then(
4513
4541
  (c) => {
4514
4542
  process.exitCode = c;
4515
4543
  setTimeout(() => process.exit(c), 500).unref();
4516
4544
  },
4517
4545
  (err) => {
4546
+ runFatalSalvageSync();
4518
4547
  writeErr4((err instanceof Error ? err.stack : String(err)) + "\n");
4519
4548
  process.exitCode = 1;
4520
4549
  setTimeout(() => process.exit(1), 500).unref();
@@ -24,4 +24,4 @@ var initCmd = async (_args, deps) => {
24
24
  export {
25
25
  initCmd
26
26
  };
27
- //# sourceMappingURL=init-E2NDDOHI.js.map
27
+ //# sourceMappingURL=init-4JQSG66Q.js.map
@@ -341,4 +341,4 @@ function printHelp(deps) {
341
341
  export {
342
342
  mailboxServeCmd
343
343
  };
344
- //# sourceMappingURL=mailbox-serve-V3QIJBDH.js.map
344
+ //# sourceMappingURL=mailbox-serve-5S3PHG5D.js.map
@@ -33,6 +33,7 @@ import {
33
33
  serveStdio
34
34
  } from "@wrongstack/mcp";
35
35
  import { registerBuiltinToolTier } from "@wrongstack/tools/tool-tier";
36
+ import { wireKanbanPorts } from "@wrongstack/runtime";
36
37
  var AllowAllPermissionPolicy = class extends AutoApprovePermissionPolicy {
37
38
  async evaluate() {
38
39
  return { permission: "auto", source: "default" };
@@ -210,6 +211,7 @@ async function serveMcpStdio(deps, positional) {
210
211
  log(`wrongstack MCP server: ${err instanceof Error ? err.message : String(err)}`);
211
212
  return 1;
212
213
  }
214
+ wireKanbanPorts();
213
215
  let registry = deps.toolRegistry;
214
216
  if (!registry) {
215
217
  registry = new ToolRegistry();
@@ -439,4 +441,4 @@ function isRecord(value) {
439
441
  export {
440
442
  mcpCmd
441
443
  };
442
- //# sourceMappingURL=mcp-CMLFHRG2.js.map
444
+ //# sourceMappingURL=mcp-RRPKNRSN.js.map
@@ -2,7 +2,7 @@ import { Context } from '@wrongstack/core/agent';
2
2
  import { ToolRegistry } from '@wrongstack/core/registry';
3
3
  import type { PermissionPolicy, Tool } from '@wrongstack/core/types';
4
4
  import { type MCPServerPrompt, type MCPServerResource } from '@wrongstack/mcp';
5
- import type { SubcommandDeps } from './subcommands/index.js';
5
+ import type { SubcommandDeps } from './subcommands/contracts.js';
6
6
  /**
7
7
  * Resolve the `--tools` whitelist for `mcp serve`.
8
8
  *
@@ -8,7 +8,7 @@ import {
8
8
  mutateConfigProviders,
9
9
  normalizeKeys,
10
10
  writeKeysBack
11
- } from "./chunk-SZ42FYPT.js";
11
+ } from "./chunk-BXFYBQKR.js";
12
12
  import "./chunk-7OCVIDC7.js";
13
13
 
14
14
  // src/subcommands/handlers/modeldiag.ts
@@ -19,8 +19,8 @@ import { color as color5 } from "@wrongstack/core/utils";
19
19
  import { color as color3, toErrorMessage } from "@wrongstack/core/utils";
20
20
 
21
21
  // src/subcommands/handlers/modeldiag-eval.ts
22
- import { makeProviderFromConfig } from "@wrongstack/providers";
23
22
  import { color as color2 } from "@wrongstack/core/utils";
23
+ import { makeProviderFromConfig } from "@wrongstack/providers";
24
24
 
25
25
  // src/subcommands/handlers/modeldiag-profiles.ts
26
26
  import { color } from "@wrongstack/core/utils";
@@ -443,9 +443,7 @@ ${color2.dim('Enter numbers or provider IDs (comma-separated, or "all"):')}
443
443
  {
444
444
  model: c.model,
445
445
  system: [{ type: "text", text: "Be thorough and correct." }],
446
- messages: [
447
- { role: "user", content: [{ type: "text", text: task.prompt }] }
448
- ],
446
+ messages: [{ role: "user", content: [{ type: "text", text: task.prompt }] }],
449
447
  maxTokens: 1024
450
448
  },
451
449
  { signal: AbortSignal.timeout(45e3) }
@@ -938,9 +936,7 @@ async function runModeldiagTest(args, deps, config) {
938
936
  }
939
937
  writeLine();
940
938
  writeLine(
941
- color4.dim(
942
- `${targets.length} request(s) would run sequentially. Remove --plan to execute.`
943
- )
939
+ color4.dim(`${targets.length} request(s) would run sequentially. Remove --plan to execute.`)
944
940
  );
945
941
  }
946
942
  return targets.length > 0 ? 0 : 2;
@@ -948,9 +944,7 @@ async function runModeldiagTest(args, deps, config) {
948
944
  if (targets.length === 0) {
949
945
  const message = "No provider/model targets matched. Check the active profile or remove filters.";
950
946
  if (smokeOptions.json) {
951
- writeLine(
952
- JSON.stringify({ results: [], summary: { passed: 0, failed: 0 }, error: message })
953
- );
947
+ writeLine(JSON.stringify({ results: [], summary: { passed: 0, failed: 0 }, error: message }));
954
948
  } else {
955
949
  writeLine(color4.amber(message));
956
950
  }
@@ -1329,4 +1323,4 @@ var modeldiagCmd = async (args, deps) => {
1329
1323
  export {
1330
1324
  modeldiagCmd
1331
1325
  };
1332
- //# sourceMappingURL=modeldiag-ICMPHT5L.js.map
1326
+ //# sourceMappingURL=modeldiag-H6DKWJ2N.js.map
@@ -41,4 +41,4 @@ export {
41
41
  pluginCmd,
42
42
  usageCmd
43
43
  };
44
- //# sourceMappingURL=plugin-usage-26LIIW3P.js.map
44
+ //# sourceMappingURL=plugin-usage-GCTYOZPH.js.map
@@ -35,4 +35,4 @@ var projectsCmd = async (_args, deps) => {
35
35
  export {
36
36
  projectsCmd
37
37
  };
38
- //# sourceMappingURL=projects-XE76NFNZ.js.map
38
+ //# sourceMappingURL=projects-5J727S4L.js.map
@@ -39,8 +39,7 @@ export declare function clearStaleProviderDefaults(config: Record<string, unknow
39
39
  export declare function activeLabel(cfg: ProviderConfig, keys: ProviderApiKey[]): string | undefined;
40
40
  /** Mask an API key for display: show first 4 + last 4 chars. */
41
41
  export declare function maskedKey(key: string): string;
42
- /** ISO-8601 timestamp for key `createdAt` fields. */
43
- export declare function nowIso(): string;
42
+ export { nowIso } from '@wrongstack/primitives';
44
43
  /**
45
44
  * Read the on-disk config file and return its `providers` map, fully
46
45
  * decrypted. Returns `{}` on ENOENT or corrupt JSON (surfacing the error
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-YMXXOOFN.js";
7
7
  import {
8
8
  mutateConfigProviders
9
- } from "./chunk-SZ42FYPT.js";
9
+ } from "./chunk-BXFYBQKR.js";
10
10
  import "./chunk-7OCVIDC7.js";
11
11
 
12
12
  // src/subcommands/handlers/providers-models.ts
@@ -661,4 +661,4 @@ export {
661
661
  modelsCmd,
662
662
  providersCmd
663
663
  };
664
- //# sourceMappingURL=providers-models-D23WUD74.js.map
664
+ //# sourceMappingURL=providers-models-663NDPRQ.js.map
@@ -7,4 +7,4 @@ var quickCmd = (_args, _deps) => {
7
7
  export {
8
8
  quickCmd
9
9
  };
10
- //# sourceMappingURL=quick-VIO2BEHS.js.map
10
+ //# sourceMappingURL=quick-XLYLZX4B.js.map
@@ -76,4 +76,4 @@ Run a session with --record first, then --replay to re-execute it.`
76
76
  export {
77
77
  replayCmd
78
78
  };
79
- //# sourceMappingURL=replay-WBRMEWQ5.js.map
79
+ //# sourceMappingURL=replay-RZXZKP2U.js.map