@wrongstack/cli 1.0.29 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/data/providers.json +206 -77
  2. package/dist/{acp-QWCBMQSO.js → acp-EDGUWU7N.js} +3 -6
  3. package/dist/{audit-46YK5DSC.js → audit-KCBTHUQI.js} +1 -1
  4. package/dist/{auth-TE55JF4Z.js → auth-SUHKFFO4.js} +136 -59
  5. package/dist/auth-menu/github-copilot-oauth.d.ts +1 -35
  6. package/dist/auth-menu/index-input.d.ts +3 -0
  7. package/dist/auth-menu/panel-flow-bridge.d.ts +29 -0
  8. package/dist/auth-menu/panel-service.d.ts +3 -34
  9. package/dist/auth-menu/provider-auth-login.d.ts +1 -1
  10. package/dist/auto-discover-providers-JX346GOM.js +7 -0
  11. package/dist/automation-MCDFCIMV.js +369 -0
  12. package/dist/{bench-GTLPM22B.js → bench-MMZHFHDL.js} +152 -43
  13. package/dist/boot/brain-decision-log.d.ts +1 -1
  14. package/dist/boot/system-prompt-builder.d.ts +1 -1
  15. package/dist/boot/system-prompt-menu.d.ts +11 -2
  16. package/dist/boot/tui-coordinator-setup.d.ts +2 -0
  17. package/dist/boot/tui-startup-output.d.ts +11 -0
  18. package/dist/{boot-auto-thin-6Q56FY3F.js → boot-auto-thin-K2DHHYIW.js} +3 -3
  19. package/dist/{chronicle-UTFETHP6.js → chronicle-PBJS7BN6.js} +5 -3
  20. package/dist/{chunk-KT34LWIS.js → chunk-24C6VVLM.js} +28 -26
  21. package/dist/{chunk-WRYZLEXP.js → chunk-2EZ2DHOW.js} +41 -7
  22. package/dist/{chunk-7IQWQCBH.js → chunk-3LEFXLAW.js} +39 -39
  23. package/dist/{chunk-WSTVGC2C.js → chunk-4BX2YDTQ.js} +13 -6
  24. package/dist/{chunk-SFBFYIOW.js → chunk-4MDRHMX4.js} +3 -2
  25. package/dist/{chunk-RDGGWMTI.js → chunk-65VNCAF6.js} +2 -22
  26. package/dist/{chunk-WQZW3RDP.js → chunk-7BNBD4PE.js} +2 -2
  27. package/dist/{chunk-RZ4ZDRYA.js → chunk-DIOODAYM.js} +2 -2
  28. package/dist/{chunk-L2RVEQWO.js → chunk-HHRYIDOW.js} +2 -2
  29. package/dist/{chunk-YHYINL47.js → chunk-LKFKO4JW.js} +2 -2
  30. package/dist/{chunk-Q4INH2DG.js → chunk-MPQCHBDJ.js} +2 -1
  31. package/dist/{chunk-2ERX3RPN.js → chunk-P3GRLV47.js} +30 -17
  32. package/dist/{chunk-ZMX5HRLI.js → chunk-P3Q3KMFH.js} +6 -4
  33. package/dist/chunk-PA4VBCXS.js +115 -0
  34. package/dist/{chunk-KOEO4CJG.js → chunk-PGNERAZL.js} +4 -4
  35. package/dist/{chunk-6A7URMWN.js → chunk-RQ4UBKYH.js} +3 -3
  36. package/dist/{chunk-X756ZS72.js → chunk-SUDNPYWD.js} +2 -2
  37. package/dist/{chunk-IFQ6NQPL.js → chunk-SWOPJHXI.js} +7 -7
  38. package/dist/{chunk-LDCGZJTC.js → chunk-TWSQTQKR.js} +12 -4
  39. package/dist/chunk-TXAFIERF.js +37 -0
  40. package/dist/{chunk-BZHT5GPF.js → chunk-WHEYHDIE.js} +2 -2
  41. package/dist/{chunk-LBPLTTZ6.js → chunk-WTJDSTYD.js} +4 -4
  42. package/dist/{chunk-IS2PPBQV.js → chunk-X4LW5CZM.js} +8 -4
  43. package/dist/{chunk-BBHWW6LR.js → chunk-YL4KCHZG.js} +18 -6
  44. package/dist/{chunk-LUMETJFO.js → chunk-ZYACRPLN.js} +2 -2
  45. package/dist/{cli-context-6RONY47P.js → cli-context-7HK67B2Z.js} +83 -76
  46. package/dist/cli-context.d.ts +3 -1
  47. package/dist/cli-infrastructure.d.ts +33 -0
  48. package/dist/{cli-main-YS3HIOSD.js → cli-main-TQGLKB6D.js} +3768 -2748
  49. package/dist/config-doctor.d.ts +1 -1
  50. package/dist/{config-transfer-RUWLDCNK.js → config-transfer-UE37X4B5.js} +2 -2
  51. package/dist/{execution-JEYF2L7O.js → execution-C2IECWF7.js} +4981 -4836
  52. package/dist/execution-chimera-handlers.d.ts +6 -0
  53. package/dist/execution-session-callbacks.d.ts +36 -0
  54. package/dist/execution-webui.d.ts +3 -0
  55. package/dist/execution.d.ts +1 -1
  56. package/dist/fleet/host-acp-runner.d.ts +15 -0
  57. package/dist/fleet/host-budget.d.ts +13 -0
  58. package/dist/fleet/host-context.d.ts +5 -0
  59. package/dist/fleet/host-explore-companion.d.ts +6 -15
  60. package/dist/fleet/host.d.ts +2 -0
  61. package/dist/fleet/status-broadcast.d.ts +1 -1
  62. package/dist/{hq-BNK67HOE.js → hq-KBFDKTDD.js} +13 -7
  63. package/dist/{hq-server-PCQACV7Y.js → hq-server-AVNKZ2PV.js} +2 -2
  64. package/dist/{hq-service-BMMJAHRT.js → hq-service-FGB7BY2D.js} +3 -3
  65. package/dist/index.js +126 -10
  66. package/dist/{mailbox-serve-FW3JCCPK.js → mailbox-serve-S536N66F.js} +3 -2
  67. package/dist/{modeldiag-W7XAE625.js → modeldiag-NEPTLFZW.js} +26 -8
  68. package/dist/{per-subcommand-help-MWQWFIAV.js → per-subcommand-help-VKPV3OEY.js} +2 -2
  69. package/dist/{plugin-usage-CIGOOTX3.js → plugin-usage-3TZGROK7.js} +3 -3
  70. package/dist/{plugins-HQTXUD6A.js → plugins-ITH4SLO6.js} +4 -4
  71. package/dist/pre-launch/project-check.d.ts +2 -8
  72. package/dist/pre-launch.d.ts +1 -1
  73. package/dist/{project-manifest-7NSFVBM3.js → project-manifest-FTFDCCTZ.js} +2 -2
  74. package/dist/{project-picker-SVBXMPKX.js → project-picker-NZYJKQQC.js} +3 -3
  75. package/dist/provider-cloud-config.d.ts +4 -0
  76. package/dist/provider-config-utils.d.ts +1 -1
  77. package/dist/{providers-models-5Z2PJTEW.js → providers-models-O75MKLN2.js} +52 -18
  78. package/dist/{remote-GB5VXCCT.js → remote-C74BCNND.js} +5 -5
  79. package/dist/{rewind-JA3ZLCNM.js → rewind-7AULJS7F.js} +7 -5
  80. package/dist/sandbox-TYGD6FI2.js +131 -0
  81. package/dist/services/sdd/project-context.d.ts +1 -1
  82. package/dist/{sessions-config-JGIZRNT6.js → sessions-config-VE26SB56.js} +5 -5
  83. package/dist/short-circuit-flags-D6VAG47Y.js +10 -0
  84. package/dist/slash-commands/openai-quota.d.ts +12 -6
  85. package/dist/slash-commands/sandbox.d.ts +5 -0
  86. package/dist/slash-commands/scout-stats.d.ts +46 -0
  87. package/dist/slash-commands/sdd-inspect-commands.d.ts +9 -0
  88. package/dist/slash-commands/sdd-session-commands.d.ts +19 -0
  89. package/dist/slash-commands/sdd.d.ts +1 -1
  90. package/dist/slash-commands/zai-plan.d.ts +26 -0
  91. package/dist/{standalone-auto-update-TOTRGCSA.js → standalone-auto-update-VQC4GYCM.js} +3 -3
  92. package/dist/{standalone-update-LZO3MNLH.js → standalone-update-HZHDZZOR.js} +2 -2
  93. package/dist/subcommands/handlers/automation-credentials.d.ts +8 -0
  94. package/dist/subcommands/handlers/automation.d.ts +3 -0
  95. package/dist/subcommands/handlers/bench-experiments.d.ts +5 -0
  96. package/dist/subcommands/handlers/sandbox.d.ts +5 -0
  97. package/dist/{subcommands-WX4GDMWB.js → subcommands-CLI6QTLU.js} +2 -2
  98. package/dist/{tools-skills-GH24UCBY.js → tools-skills-33AI6K6S.js} +2 -2
  99. package/dist/tui-provider-quota-menu.d.ts +5 -0
  100. package/dist/{typesafe-WA5O3KVS.js → typesafe-NHC322W5.js} +27 -8
  101. package/dist/{typesafe-topic-replay-ZILIU3WS.js → typesafe-topic-replay-DB2AYL7V.js} +2 -2
  102. package/dist/{typesafe-triage-replay-FGAW7QM7.js → typesafe-triage-replay-27NDAZ3V.js} +2 -2
  103. package/dist/{update-TDZX4IL2.js → update-J5WHAFPE.js} +3 -3
  104. package/dist/{update-check-J5ZVKS73.js → update-check-VLVT4IV2.js} +2 -2
  105. package/dist/{version-help-HN32QYQN.js → version-help-ATOKGMTK.js} +2 -2
  106. package/dist/webui-server/prefs-seeding.d.ts +1 -0
  107. package/dist/webui-server/route-contexts.d.ts +1 -0
  108. package/dist/{webui-server-EXJWLB3X.js → webui-server-GQOVLQS3.js} +71 -34
  109. package/dist/webui-session-retirement.d.ts +10 -0
  110. package/dist/wiring/command-host-state.d.ts +2 -0
  111. package/dist/wiring/director-announcement.d.ts +3 -1
  112. package/dist/wiring/session-establishment.d.ts +10 -8
  113. package/dist/wiring/session-runtime.d.ts +1 -1
  114. package/dist/wiring/session.d.ts +3 -0
  115. package/package.json +30 -30
  116. package/dist/auto-discover-providers-DXR25GTG.js +0 -7
  117. package/dist/chunk-D5GB5MHA.js +0 -87
  118. package/dist/chunk-SIGUWXAA.js +0 -43
  119. package/dist/short-circuit-flags-5N2LPK4R.js +0 -10
@@ -79,7 +79,7 @@ var BENCH_RUN_FLAGS = [
79
79
  {
80
80
  name: "limit",
81
81
  flag: "--limit <N>",
82
- description: "Cap the number of tasks per cell (useful for smoke tests).",
82
+ description: "Cap the number of tasks per cell (positive safe integer; useful for smoke tests).",
83
83
  group: "control",
84
84
  kind: "value"
85
85
  },
@@ -94,14 +94,14 @@ var BENCH_RUN_FLAGS = [
94
94
  {
95
95
  name: "concurrency",
96
96
  flag: "--concurrency <N>",
97
- description: "Override the per-cell concurrency from the model config.",
97
+ description: "Override the per-cell concurrency from the model config (positive safe integer).",
98
98
  group: "control",
99
99
  kind: "value"
100
100
  },
101
101
  {
102
102
  name: "repeats",
103
103
  flag: "--repeats <N>",
104
- description: "Attempts per (task x model). >1 adds pass@k and a flakiness count so run-to-run noise is visible.",
104
+ description: "Attempts per (task x model), a positive safe integer. >1 adds pass@k and a flakiness count.",
105
105
  group: "control",
106
106
  kind: "value",
107
107
  defaultValue: "1"
@@ -706,6 +706,20 @@ var deepHelpTable = {
706
706
 
707
707
  // src/subcommands/handlers/per-subcommand-help-table.ts
708
708
  var helpTable = {
709
+ automation: {
710
+ name: "automation",
711
+ title: "wstack automation \u2014 persistent agent jobs",
712
+ description: "Manage persistent schedules, signed GitHub intake, isolated runs and run history.",
713
+ usage: "wstack automation <add|preview|templates|import|export|list|run|enable|disable|cancel|serve|prune> [id] [options]",
714
+ seeAlso: "docs/subcommands/automation.md"
715
+ },
716
+ sandbox: {
717
+ name: "sandbox",
718
+ title: "wstack sandbox \u2014 isolated Docker execution",
719
+ description: "Run the full agent in a copied project workspace and retain a patch without editing the host project.",
720
+ usage: "wstack sandbox docker --image <trusted-image> --prompt <task> [--dry-run] [--env NAME,...] [--provider id] [--model id] [--out directory]",
721
+ seeAlso: "docs/subcommands/sandbox.md"
722
+ },
709
723
  init: {
710
724
  name: "init",
711
725
  title: "wstack init \u2014 DEPRECATED (use wstack auth)",
@@ -795,10 +809,14 @@ var helpTable = {
795
809
  name: "auth",
796
810
  title: "wstack auth \u2014 manage API keys and provider credentials",
797
811
  description: "Add, view, and remove provider API keys. The interactive menu supports a custom-URL path for self-hosted / local servers, a quick-shortcut path for Ollama / vLLM / LM Studio, and a catalog path for the well-known providers.",
798
- usage: "wstack auth [list|status|remove] [...] | wstack auth <provider> | wstack auth local [...]",
812
+ usage: "wstack auth [list|status|remove|cloud] [...] | wstack auth <provider> | wstack auth local [...]",
799
813
  subcommands: [
800
814
  { name: "list", description: "List saved providers and key status." },
801
815
  { name: "status <id>", description: "Show detail for one provider." },
816
+ {
817
+ name: "cloud <id>",
818
+ description: "Read or set native region/project/location/resource routing for a saved profile."
819
+ },
802
820
  { name: "remove <id>", description: "Remove a provider and its keys." },
803
821
  { name: "<provider>", description: "Add a key for a named provider (--label, --family, \u2026)." },
804
822
  {
@@ -995,8 +1013,12 @@ var helpTable = {
995
1013
  name: "modeldiag",
996
1014
  title: "wstack modeldiag \u2014 model benchmarks + heuristic diagnostics",
997
1015
  description: "Read-only diagnostics for the configured model: key check, capability scan (vision / tools / context window), heuristic strengths/weaknesses (bestFor / avoidFor), sequential live provider/model smoke tests, and real benchmarks against a small prompt suite. Smoke tests use tiny prompts and never print credentials.",
998
- usage: "wstack modeldiag [test|eval] [...]",
1016
+ usage: "wstack modeldiag [preflight|test|eval] [...]",
999
1017
  subcommands: [
1018
+ {
1019
+ name: "preflight [provider-profile]",
1020
+ description: "Check native cloud provider setup without model requests or exposing credential values."
1021
+ },
1000
1022
  {
1001
1023
  name: "<no subcommand>",
1002
1024
  description: "Print configured model capabilities, context limits, and recommendations."
@@ -1017,7 +1039,7 @@ var helpTable = {
1017
1039
  name: "bench",
1018
1040
  title: "wstack bench \u2014 run model-independent agentic benchmarks",
1019
1041
  description: "Run WrongStack against the bundled smoke suite, a local manifest, Aider polyglot, or SWE-bench Verified with deterministic graders. Default `bench run` is the bundled core edit-eval; pass --cell provider/model (or a saved model).",
1020
- usage: "wstack bench [run|compare|report|list] [...]",
1042
+ usage: "wstack bench [run|compare|report|list|mine|review|route|experiment] [...]",
1021
1043
  subcommands: [
1022
1044
  { name: "run", description: "Run a suite. Default: bundled smoke + --cell or saved model." },
1023
1045
  {
@@ -1025,6 +1047,18 @@ var helpTable = {
1025
1047
  description: "Diff two finished run directories (fingerprint-aware)."
1026
1048
  },
1027
1049
  { name: "report <dir>", description: "Render the Markdown report for a prior run." },
1050
+ {
1051
+ name: "review --transcript <file>",
1052
+ description: "Read-only transcript behavior/compaction evidence; optional --policy."
1053
+ },
1054
+ {
1055
+ name: "route <dir> --policy <file>",
1056
+ description: "Shadow routing recommendations from graded model-matrix evidence."
1057
+ },
1058
+ {
1059
+ name: "experiment <a> <b> --dimension compaction|behavior",
1060
+ description: "Compare paired task/model/attempt runs with explicit experiment provenance."
1061
+ },
1028
1062
  { name: "list", description: "List available suites and the model configs in the catalog." }
1029
1063
  ],
1030
1064
  seeAlso: "wstack modeldiag (read-only diagnostics; bench actually runs the model)"
@@ -1262,4 +1296,4 @@ export {
1262
1296
  subcommandsWithFocusedHelp,
1263
1297
  renderGenericHelp
1264
1298
  };
1265
- //# sourceMappingURL=chunk-WRYZLEXP.js.map
1299
+ //# sourceMappingURL=chunk-2EZ2DHOW.js.map
@@ -9,6 +9,42 @@ function resolveExecutionMode(positional, flags) {
9
9
  return "repl";
10
10
  }
11
11
 
12
+ // src/services/suggestion-store.ts
13
+ var sharedSuggestions = [];
14
+ var sharedAutoSuggestions = [];
15
+ function setSuggestions(suggestions) {
16
+ sharedSuggestions = suggestions;
17
+ }
18
+ function setAutoSuggestions(suggestions) {
19
+ sharedAutoSuggestions = suggestions;
20
+ }
21
+ function getSuggestions() {
22
+ return sharedSuggestions;
23
+ }
24
+ function removeSuggestions(indices) {
25
+ if (indices.length === 0) return;
26
+ const set = new Set(indices);
27
+ sharedSuggestions = sharedSuggestions.filter((_, i) => !set.has(i));
28
+ sharedAutoSuggestions = [];
29
+ }
30
+ function clearSuggestions() {
31
+ sharedSuggestions = [];
32
+ sharedAutoSuggestions = [];
33
+ }
34
+
35
+ // src/tui-thinking-word.ts
36
+ var DEFAULT_TUI_THINKING_WORD = "thinking";
37
+ var MAX_TUI_THINKING_WORD_LENGTH = 16;
38
+ function normalizeTuiThinkingWord(value) {
39
+ if (typeof value !== "string") return DEFAULT_TUI_THINKING_WORD;
40
+ const word = value.trim();
41
+ if (word.length === 0 || word.length > MAX_TUI_THINKING_WORD_LENGTH) {
42
+ return DEFAULT_TUI_THINKING_WORD;
43
+ }
44
+ if (!/^[\p{L}\p{N}_-]+$/u.test(word)) return DEFAULT_TUI_THINKING_WORD;
45
+ return word;
46
+ }
47
+
12
48
  // src/hq-fleet-control.ts
13
49
  import {
14
50
  areSubagentsAllowedForSession,
@@ -73,42 +109,6 @@ function createHqFleetControl(getDirector, defaultSessionId, scope) {
73
109
  };
74
110
  }
75
111
 
76
- // src/services/suggestion-store.ts
77
- var sharedSuggestions = [];
78
- var sharedAutoSuggestions = [];
79
- function setSuggestions(suggestions) {
80
- sharedSuggestions = suggestions;
81
- }
82
- function setAutoSuggestions(suggestions) {
83
- sharedAutoSuggestions = suggestions;
84
- }
85
- function getSuggestions() {
86
- return sharedSuggestions;
87
- }
88
- function removeSuggestions(indices) {
89
- if (indices.length === 0) return;
90
- const set = new Set(indices);
91
- sharedSuggestions = sharedSuggestions.filter((_, i) => !set.has(i));
92
- sharedAutoSuggestions = [];
93
- }
94
- function clearSuggestions() {
95
- sharedSuggestions = [];
96
- sharedAutoSuggestions = [];
97
- }
98
-
99
- // src/tui-thinking-word.ts
100
- var DEFAULT_TUI_THINKING_WORD = "thinking";
101
- var MAX_TUI_THINKING_WORD_LENGTH = 16;
102
- function normalizeTuiThinkingWord(value) {
103
- if (typeof value !== "string") return DEFAULT_TUI_THINKING_WORD;
104
- const word = value.trim();
105
- if (word.length === 0 || word.length > MAX_TUI_THINKING_WORD_LENGTH) {
106
- return DEFAULT_TUI_THINKING_WORD;
107
- }
108
- if (!/^[\p{L}\p{N}_-]+$/u.test(word)) return DEFAULT_TUI_THINKING_WORD;
109
- return word;
110
- }
111
-
112
112
  // src/services/run-git.ts
113
113
  import { spawn } from "node:child_process";
114
114
  import { toErrorMessage } from "@wrongstack/core/utils";
@@ -149,12 +149,12 @@ export {
149
149
  getSuggestions,
150
150
  removeSuggestions,
151
151
  clearSuggestions,
152
+ MAX_TUI_THINKING_WORD_LENGTH,
153
+ normalizeTuiThinkingWord,
152
154
  killHqSessionFleet,
153
155
  terminateHqAgent,
154
156
  spawnHqAgent,
155
157
  createHqFleetControl,
156
- MAX_TUI_THINKING_WORD_LENGTH,
157
- normalizeTuiThinkingWord,
158
158
  runGit
159
159
  };
160
- //# sourceMappingURL=chunk-7IQWQCBH.js.map
160
+ //# sourceMappingURL=chunk-3LEFXLAW.js.map
@@ -187,7 +187,14 @@ async function ensureHistoryDir(homeFn = defaultHomeDir, targetConfigPath) {
187
187
  async function readIndex(homeFn = defaultHomeDir, targetConfigPath) {
188
188
  try {
189
189
  const raw = await fs.readFile(historyIndexPath(homeFn, targetConfigPath), "utf8");
190
- return JSON.parse(raw);
190
+ const parsed = JSON.parse(raw);
191
+ if (parsed && typeof parsed === "object" && Array.isArray(parsed.entries)) {
192
+ const entries = parsed.entries.filter(
193
+ (e) => e !== null && typeof e === "object" && typeof e.id === "string"
194
+ );
195
+ return { version: 1, entries };
196
+ }
197
+ return { version: 1, entries: [] };
191
198
  } catch {
192
199
  return { version: 1, entries: [] };
193
200
  }
@@ -301,11 +308,11 @@ async function listHistory(homeFn = defaultHomeDir, targetConfigPath) {
301
308
  return idx.entries;
302
309
  }
303
310
  async function getHistoryEntry(id, homeFn = defaultHomeDir, targetConfigPath) {
311
+ const dir = historyDir(homeFn, targetConfigPath);
312
+ const filePath = path.join(dir, `${id}.json`);
313
+ if (path.dirname(path.resolve(filePath)) !== path.resolve(dir)) return null;
304
314
  try {
305
- const raw = await fs.readFile(
306
- path.join(historyDir(homeFn, targetConfigPath), `${id}.json`),
307
- "utf8"
308
- );
315
+ const raw = await fs.readFile(filePath, "utf8");
309
316
  return JSON.parse(raw);
310
317
  } catch {
311
318
  return null;
@@ -391,4 +398,4 @@ export {
391
398
  restoreFromHistory,
392
399
  restoreLast
393
400
  };
394
- //# sourceMappingURL=chunk-WSTVGC2C.js.map
401
+ //# sourceMappingURL=chunk-4BX2YDTQ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  appendHistory,
3
3
  backupCurrent
4
- } from "./chunk-WSTVGC2C.js";
4
+ } from "./chunk-4BX2YDTQ.js";
5
5
 
6
6
  // src/settings-menu.ts
7
7
  import * as fs from "node:fs/promises";
@@ -55,6 +55,7 @@ var PROJECT_SAFE_FIELDS = /* @__PURE__ */ new Set([
55
55
  "fallbackProfile",
56
56
  "favoriteModels",
57
57
  "disabledModels",
58
+ "disabledProviders",
58
59
  "favoriteModelsOnly",
59
60
  "modelAvailabilitySchedule",
60
61
  "fallbackAuto",
@@ -268,4 +269,4 @@ export {
268
269
  persistTelegramConfig,
269
270
  deriveFsAccessPair
270
271
  };
271
- //# sourceMappingURL=chunk-SFBFYIOW.js.map
272
+ //# sourceMappingURL=chunk-4MDRHMX4.js.map
@@ -1,11 +1,6 @@
1
1
  import {
2
2
  resolveProviderCfgWithProxy
3
3
  } from "./chunk-SDJCLEK6.js";
4
- import {
5
- fallbackCodexProviderModels,
6
- filterCurrentCodexModelIds,
7
- isCodexCatalogModel
8
- } from "./chunk-SIGUWXAA.js";
9
4
 
10
5
  // src/acp-agent-list.ts
11
6
  import { REGISTRY_ID_ALIASES } from "@wrongstack/acp";
@@ -117,7 +112,7 @@ async function loadCachedAcpRegistry(paths) {
117
112
  const raw = await fs.readFile(acpRegistryCachePath(paths), "utf8");
118
113
  const env = JSON.parse(raw);
119
114
  if (!Array.isArray(env.agents)) return null;
120
- const byId = {};
115
+ const byId = /* @__PURE__ */ Object.create(null);
121
116
  for (const a of env.agents) {
122
117
  if (!a?.id || !a.acp?.command) continue;
123
118
  byId[a.id] = {
@@ -227,21 +222,6 @@ async function setupProvider(params) {
227
222
  let models;
228
223
  if (savedModels && savedModels.length > 0) {
229
224
  models = savedModels.map((m) => ({ id: m, name: m }));
230
- } else if (family === "openai-codex") {
231
- const openaiProvider = await modelsRegistry.getProvider("openai").catch(() => void 0);
232
- if (openaiProvider) {
233
- const catalogById = new Map(
234
- openaiProvider.models.filter(isCodexCatalogModel).map((m) => [m.id, { id: m.id, name: m.name }])
235
- );
236
- const catalogModels = filterCurrentCodexModelIds(catalogById.keys()).map((id) => catalogById.get(id)).filter((m) => Boolean(m));
237
- if (catalogModels.length > 0) {
238
- models = catalogModels;
239
- } else {
240
- models = fallbackCodexProviderModels();
241
- }
242
- } else {
243
- models = fallbackCodexProviderModels();
244
- }
245
225
  } else {
246
226
  models = [];
247
227
  }
@@ -336,4 +316,4 @@ export {
336
316
  setupProvider,
337
317
  createGracefulShutdown
338
318
  };
339
- //# sourceMappingURL=chunk-RDGGWMTI.js.map
319
+ //# sourceMappingURL=chunk-65VNCAF6.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadManifest
3
- } from "./chunk-IS2PPBQV.js";
3
+ } from "./chunk-X4LW5CZM.js";
4
4
 
5
5
  // src/project-picker.ts
6
6
  import { color } from "@wrongstack/core/utils";
@@ -415,4 +415,4 @@ export {
415
415
  skipDivider,
416
416
  runProjectPicker
417
417
  };
418
- //# sourceMappingURL=chunk-WQZW3RDP.js.map
418
+ //# sourceMappingURL=chunk-7BNBD4PE.js.map
@@ -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-LZO3MNLH.js")).fetchLatestStandaloneVersion(3e3, signal) : await fetchLatestFromNpm(packageName, 3e3, signal);
147
+ const latest = packageName === "standalone-binary" ? await (await import("./standalone-update-HZHDZZOR.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-RZ4ZDRYA.js.map
186
+ //# sourceMappingURL=chunk-DIOODAYM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  backupCurrent
3
- } from "./chunk-WSTVGC2C.js";
3
+ } from "./chunk-4BX2YDTQ.js";
4
4
 
5
5
  // src/wiring/external-plugins.ts
6
6
  import { isAbsolute, join, resolve } from "node:path";
@@ -1109,4 +1109,4 @@ export {
1109
1109
  PLUGIN_AUDIT_ENTRIES,
1110
1110
  runPluginManagementCommand
1111
1111
  };
1112
- //# sourceMappingURL=chunk-L2RVEQWO.js.map
1112
+ //# sourceMappingURL=chunk-HHRYIDOW.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  PLUGIN_AUDIT_ENTRIES,
6
6
  loadExternalPlugins
7
- } from "./chunk-L2RVEQWO.js";
7
+ } from "./chunk-HHRYIDOW.js";
8
8
 
9
9
  // src/wiring/plugins.ts
10
10
  import { join } from "node:path";
@@ -306,4 +306,4 @@ export {
306
306
  BUILTIN_PLUGIN_NAME_HINTS,
307
307
  setupPlugins
308
308
  };
309
- //# sourceMappingURL=chunk-YHYINL47.js.map
309
+ //# sourceMappingURL=chunk-LKFKO4JW.js.map
@@ -74,6 +74,7 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
74
74
  "token-saving-mode",
75
75
  "system-lite",
76
76
  "system-pro",
77
+ "system-scout",
77
78
  "hq",
78
79
  "hq-allow-exec",
79
80
  "tunnel",
@@ -306,4 +307,4 @@ export {
306
307
  parseAuthFlags,
307
308
  parseSpawnFlags
308
309
  };
309
- //# sourceMappingURL=chunk-Q4INH2DG.js.map
310
+ //# sourceMappingURL=chunk-MPQCHBDJ.js.map
@@ -12,14 +12,14 @@ import {
12
12
  nowIso,
13
13
  resolveActiveApiKey,
14
14
  writeKeysBack
15
- } from "./chunk-LUMETJFO.js";
16
- import {
17
- openBrowser
18
- } from "./chunk-DAKVBMD4.js";
15
+ } from "./chunk-ZYACRPLN.js";
19
16
  import {
20
17
  appendHistory,
21
18
  backupCurrent
22
- } from "./chunk-WSTVGC2C.js";
19
+ } from "./chunk-4BX2YDTQ.js";
20
+ import {
21
+ openBrowser
22
+ } from "./chunk-DAKVBMD4.js";
23
23
 
24
24
  // src/auth-menu/auth-menu-audit.ts
25
25
  import { appendFileSync } from "node:fs";
@@ -177,6 +177,16 @@ import {
177
177
  applyProviderAuthOutcome,
178
178
  createBuiltinProviderAuthRegistry
179
179
  } from "@wrongstack/providers/oauth";
180
+
181
+ // src/auth-menu/helpers.ts
182
+ async function loadProviders(deps) {
183
+ return loadConfigProviders(deps.profileConfigPath, deps.vault, {
184
+ warn: (msg) => deps.renderer.writeWarning(msg),
185
+ profileConfigPath: deps.profileConfigPath
186
+ });
187
+ }
188
+
189
+ // src/auth-menu/provider-auth-login.ts
180
190
  var defaultRegistry;
181
191
  function providerAuthRegistryFor(deps) {
182
192
  if (deps.providerAuthRegistry) return deps.providerAuthRegistry;
@@ -223,9 +233,11 @@ async function runProviderAuthLogin(deps, strategyId, opts = {}) {
223
233
  Sign in with ${strategy.label}`) + color.dim(` \u2192 ${opts.providerId ?? strategy.providerId}
224
234
  `)
225
235
  );
236
+ const saved = strategy.id === "chatgpt-api" ? (await loadProviders(deps))[opts.providerId ?? strategy.providerId] : void 0;
237
+ const credential = saved?.apiKeys?.find((key) => key.label === saved.activeKey) ?? saved?.apiKeys?.[0];
226
238
  session = await registry.begin(
227
239
  strategy.id,
228
- { modelsRegistry: deps.modelsRegistry },
240
+ { modelsRegistry: deps.modelsRegistry, ...credential ? { credential } : {} },
229
241
  controller.signal
230
242
  );
231
243
  let outcome;
@@ -293,18 +305,18 @@ import { color as color3 } from "@wrongstack/core/utils";
293
305
  import { authProfileAliasError } from "@wrongstack/providers";
294
306
  import { probeLocalLlm } from "@wrongstack/runtime/probe";
295
307
 
296
- // src/auth-menu/helpers.ts
297
- async function loadProviders(deps) {
298
- return loadConfigProviders(deps.profileConfigPath, deps.vault, {
299
- warn: (msg) => deps.renderer.writeWarning(msg),
300
- profileConfigPath: deps.profileConfigPath
301
- });
302
- }
303
-
304
308
  // src/auth-menu/local-presets.ts
305
309
  import { projectLocalProviderPresets } from "@wrongstack/providers/definitions";
306
310
  var LOCAL_LLM_PRESETS = projectLocalProviderPresets();
307
311
 
312
+ // src/auth-menu/index-input.ts
313
+ function parseAuthMenuIndex(raw) {
314
+ const value = raw.trim();
315
+ if (!/^\d+$/.test(value)) return void 0;
316
+ const index = Number(value);
317
+ return Number.isSafeInteger(index) && index > 0 ? index : void 0;
318
+ }
319
+
308
320
  // src/auth-menu/shared.ts
309
321
  import { color as color2 } from "@wrongstack/core/utils";
310
322
  function renderProviderLine(renderer, id, cfg, idx) {
@@ -726,8 +738,8 @@ ${color3.bold("Local LLM servers")} ${color3.dim("\u2014 pick one to pre-fill th
726
738
  ${color3.amber("?")} Pick ${color3.dim(`(1-${LOCAL_LLM_PRESETS.length}, q to quit)`)}: `
727
739
  )).trim().toLowerCase();
728
740
  if (!answer || answer === "q" || answer === "quit") return void 0;
729
- const num = Number.parseInt(answer, 10);
730
- if (!Number.isNaN(num) && num >= 1 && num <= LOCAL_LLM_PRESETS.length) {
741
+ const num = parseAuthMenuIndex(answer);
742
+ if (num !== void 0 && num <= LOCAL_LLM_PRESETS.length) {
731
743
  return LOCAL_LLM_PRESETS[num - 1];
732
744
  }
733
745
  const byId = LOCAL_LLM_PRESETS.find((p) => p.id === answer);
@@ -1926,6 +1938,7 @@ export {
1926
1938
  providerAuthStrategiesFor,
1927
1939
  runProviderAuthLogin,
1928
1940
  LOCAL_LLM_PRESETS,
1941
+ parseAuthMenuIndex,
1929
1942
  runAuthLocal,
1930
1943
  resolveOAuthKind,
1931
1944
  runOAuthLoginKind,
@@ -1944,4 +1957,4 @@ export {
1944
1957
  addCustomProvider,
1945
1958
  addKeyForProvider
1946
1959
  };
1947
- //# sourceMappingURL=chunk-2ERX3RPN.js.map
1960
+ //# sourceMappingURL=chunk-P3GRLV47.js.map
@@ -33,14 +33,16 @@ function boolFlag(flags, names) {
33
33
  }
34
34
  function parsePositiveInteger(value, label) {
35
35
  if (value === void 0) throw new Error(`${label} is required`);
36
- const parsed = Number.parseInt(value, 10);
37
- if (!Number.isInteger(parsed) || parsed <= 0)
36
+ const trimmed = value.trim();
37
+ const parsed = /^\d+$/.test(trimmed) ? Number(trimmed) : Number.NaN;
38
+ if (!Number.isSafeInteger(parsed) || parsed <= 0)
38
39
  throw new Error(`${label} must be a positive integer`);
39
40
  return parsed;
40
41
  }
41
42
  function parsePort(value) {
42
43
  if (value === void 0) return void 0;
43
- const parsed = Number.parseInt(value, 10);
44
+ const trimmed = value.trim();
45
+ const parsed = /^\d+$/.test(trimmed) ? Number(trimmed) : Number.NaN;
44
46
  if (!Number.isInteger(parsed) || parsed <= 0 || parsed > 65535) {
45
47
  throw new Error("--port must be a port between 1 and 65535");
46
48
  }
@@ -125,4 +127,4 @@ export {
125
127
  writeWebuiSessionChildReady,
126
128
  writeWebuiSessionChildError
127
129
  };
128
- //# sourceMappingURL=chunk-ZMX5HRLI.js.map
130
+ //# sourceMappingURL=chunk-P3Q3KMFH.js.map
@@ -0,0 +1,115 @@
1
+
2
+ // src/boot/auto-discover-providers.ts
3
+ import * as fs from "node:fs/promises";
4
+ import * as path from "node:path";
5
+ import {
6
+ discoverOpenAICompatibleModels,
7
+ discoveryOverlay,
8
+ pruneDiscoveryCache,
9
+ resolveDiscoveryTargets
10
+ } from "@wrongstack/providers";
11
+ async function readCache(file) {
12
+ try {
13
+ return JSON.parse(await fs.readFile(file, "utf8"));
14
+ } catch {
15
+ return {};
16
+ }
17
+ }
18
+ async function discoverAndMergeProviders(opts) {
19
+ const targets = resolveDiscoveryTargets(opts.config);
20
+ if (targets.length === 0) return;
21
+ const cacheFile = path.join(opts.cacheDir, "discovered-models-cache.json");
22
+ const cache = await readCache(cacheFile);
23
+ let cacheDirty = false;
24
+ await Promise.all(
25
+ targets.map(async (target) => {
26
+ const previousCacheKey = target.cacheKey;
27
+ const {
28
+ id,
29
+ cfg,
30
+ baseUrl,
31
+ apiKey,
32
+ modelDiscoveryPath,
33
+ accountCatalog,
34
+ copilotCatalog,
35
+ modelsUrl,
36
+ headers,
37
+ prepareApiKey,
38
+ inheritWireFamily
39
+ } = target;
40
+ let failureReason = "model catalog request failed";
41
+ const provider = await discoverOpenAICompatibleModels(id, {
42
+ baseUrl,
43
+ apiKey,
44
+ headers: { ...cfg.headers, ...headers },
45
+ accountCatalog,
46
+ copilotCatalog,
47
+ modelsUrl,
48
+ providerName: id,
49
+ modelDiscoveryPath,
50
+ inheritWireFamily,
51
+ fetchImpl: opts.fetchImpl,
52
+ prepareApiKey,
53
+ onFailure: (reason) => {
54
+ failureReason = reason;
55
+ }
56
+ });
57
+ if (target.isCurrent && !target.isCurrent()) return;
58
+ const { cacheKey } = target;
59
+ if (provider) {
60
+ if (accountCatalog) cfg.models = Object.keys(provider.models);
61
+ const fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
62
+ cache[cacheKey] = { fetchedAt, provider };
63
+ pruneDiscoveryCache(cache, target);
64
+ cacheDirty = true;
65
+ const merge = discoveryOverlay(target, provider, fetchedAt);
66
+ opts.registry.mergeOverlay(merge.payload, merge.options);
67
+ opts.logger?.info(
68
+ `auto-discovered ${Object.keys(provider.models).length} models for "${id}" from ${baseUrl}`
69
+ );
70
+ return;
71
+ }
72
+ const cached = cache[cacheKey] ?? cache[previousCacheKey];
73
+ if (cached) {
74
+ if (cacheKey !== previousCacheKey) {
75
+ cache[cacheKey] = cached;
76
+ cacheDirty = true;
77
+ }
78
+ if (pruneDiscoveryCache(cache, target)) cacheDirty = true;
79
+ if (accountCatalog) cfg.models = Object.keys(cached.provider.models);
80
+ const merge = discoveryOverlay(target, cached.provider, cached.fetchedAt);
81
+ opts.registry.mergeOverlay(merge.payload, merge.options);
82
+ opts.logger?.warn(
83
+ `auto-discovery for "${id}" failed; using ${Object.keys(cached.provider.models).length} cached models from ${cached.fetchedAt} (${failureReason})`
84
+ );
85
+ } else {
86
+ if (accountCatalog) {
87
+ cfg.models = [];
88
+ const merge = discoveryOverlay(target, {
89
+ id,
90
+ name: id,
91
+ npm: "@ai-sdk/openai-compatible",
92
+ api: baseUrl,
93
+ env: [],
94
+ models: {}
95
+ });
96
+ opts.registry.mergeOverlay(merge.payload, merge.options);
97
+ }
98
+ opts.logger?.warn(
99
+ `auto-discovery for "${id}" failed and no cache available (${failureReason}; catalog at ${baseUrl})`
100
+ );
101
+ }
102
+ })
103
+ );
104
+ if (cacheDirty) {
105
+ try {
106
+ await fs.writeFile(cacheFile, JSON.stringify(cache), "utf8");
107
+ } catch {
108
+ }
109
+ }
110
+ }
111
+
112
+ export {
113
+ discoverAndMergeProviders
114
+ };
115
+ //# sourceMappingURL=chunk-PA4VBCXS.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-U3SS4NRH.js";
4
4
  import {
5
5
  checkForUpdate
6
- } from "./chunk-RZ4ZDRYA.js";
6
+ } from "./chunk-DIOODAYM.js";
7
7
 
8
8
  // src/subcommands/handlers/update.ts
9
9
  import { spawn } from "node:child_process";
@@ -80,8 +80,8 @@ async function runUpdateCommand(args, deps) {
80
80
  }
81
81
  if (isStandaloneBinary()) {
82
82
  const [{ updateStandaloneBinary }, { standaloneUpdater }, { STANDALONE_TARGET }] = await Promise.all([
83
- import("./standalone-update-LZO3MNLH.js"),
84
- import("./standalone-auto-update-TOTRGCSA.js"),
83
+ import("./standalone-update-HZHDZZOR.js"),
84
+ import("./standalone-auto-update-VQC4GYCM.js"),
85
85
  import("./version-JB2UAV2A.js")
86
86
  ]);
87
87
  const updater = standaloneUpdater({
@@ -406,4 +406,4 @@ export {
406
406
  detectUpdatePackageManager,
407
407
  detectUpdatePackageName
408
408
  };
409
- //# sourceMappingURL=chunk-KOEO4CJG.js.map
409
+ //# sourceMappingURL=chunk-PGNERAZL.js.map