@wrongstack/cli 1.0.29 → 1.0.32

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 +8 -199
  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-QIL34K3U.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-WRYZLEXP.js → chunk-2EZ2DHOW.js} +41 -7
  21. package/dist/{chunk-7IQWQCBH.js → chunk-3LEFXLAW.js} +39 -39
  22. package/dist/{chunk-WSTVGC2C.js → chunk-4BX2YDTQ.js} +13 -6
  23. package/dist/{chunk-SFBFYIOW.js → chunk-4MDRHMX4.js} +3 -2
  24. package/dist/{chunk-RDGGWMTI.js → chunk-65VNCAF6.js} +2 -22
  25. package/dist/{chunk-WQZW3RDP.js → chunk-7BNBD4PE.js} +2 -2
  26. package/dist/chunk-CFHWIFXL.js +123 -0
  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-KT34LWIS.js → chunk-LIZXJHZQ.js} +28 -26
  30. package/dist/{chunk-YHYINL47.js → chunk-LKFKO4JW.js} +2 -2
  31. package/dist/{chunk-Q4INH2DG.js → chunk-MPQCHBDJ.js} +2 -1
  32. package/dist/{chunk-2ERX3RPN.js → chunk-P3GRLV47.js} +30 -17
  33. package/dist/{chunk-ZMX5HRLI.js → chunk-P3Q3KMFH.js} +6 -4
  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-LDCGZJTC.js → chunk-TWSQTQKR.js} +12 -4
  38. package/dist/chunk-TXAFIERF.js +37 -0
  39. package/dist/{chunk-BZHT5GPF.js → chunk-WHEYHDIE.js} +2 -2
  40. package/dist/{chunk-LBPLTTZ6.js → chunk-WTJDSTYD.js} +4 -4
  41. package/dist/{chunk-IFQ6NQPL.js → chunk-WXJH4F6K.js} +7 -7
  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-ITHGP2CE.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-PQILD7TN.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-W57I3QOA.js} +3 -3
  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-6LB3EGF7.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-QO7VYTSS.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
@@ -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
@@ -0,0 +1,123 @@
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 { discoverOpenAICompatibleModels, resolveDiscoveryTargets } from "@wrongstack/providers";
6
+ async function readCache(file) {
7
+ try {
8
+ return JSON.parse(await fs.readFile(file, "utf8"));
9
+ } catch {
10
+ return {};
11
+ }
12
+ }
13
+ async function discoverAndMergeProviders(opts) {
14
+ const targets = resolveDiscoveryTargets(opts.config);
15
+ if (targets.length === 0) return;
16
+ const cacheFile = path.join(opts.cacheDir, "discovered-models-cache.json");
17
+ const cache = await readCache(cacheFile);
18
+ let cacheDirty = false;
19
+ await Promise.all(
20
+ targets.map(async (target) => {
21
+ const previousCacheKey = target.cacheKey;
22
+ const {
23
+ id,
24
+ cfg,
25
+ baseUrl,
26
+ apiKey,
27
+ modelDiscoveryPath,
28
+ modelDiscoveryAuthoritative,
29
+ accountCatalog,
30
+ copilotCatalog,
31
+ modelsUrl,
32
+ headers,
33
+ prepareApiKey
34
+ } = target;
35
+ let failureReason = "model catalog request failed";
36
+ const provider = await discoverOpenAICompatibleModels(id, {
37
+ baseUrl,
38
+ apiKey,
39
+ headers: { ...cfg.headers, ...headers },
40
+ accountCatalog,
41
+ copilotCatalog,
42
+ modelsUrl,
43
+ providerName: id,
44
+ modelDiscoveryPath,
45
+ fetchImpl: opts.fetchImpl,
46
+ prepareApiKey,
47
+ onFailure: (reason) => {
48
+ failureReason = reason;
49
+ }
50
+ });
51
+ if (target.isCurrent && !target.isCurrent()) return;
52
+ const { cacheKey } = target;
53
+ if (provider) {
54
+ if (accountCatalog) cfg.models = Object.keys(provider.models);
55
+ const fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
56
+ cache[cacheKey] = { fetchedAt, provider };
57
+ cacheDirty = true;
58
+ if (modelDiscoveryAuthoritative) {
59
+ opts.registry.mergeOverlay(
60
+ { [id]: provider },
61
+ { observedAt: fetchedAt, authoritativeProviderIds: [id] }
62
+ );
63
+ } else {
64
+ opts.registry.mergeOverlay({ [id]: provider });
65
+ }
66
+ opts.logger?.info(
67
+ `auto-discovered ${Object.keys(provider.models).length} models for "${id}" from ${baseUrl}`
68
+ );
69
+ return;
70
+ }
71
+ const cached = cache[cacheKey] ?? cache[previousCacheKey];
72
+ if (cached) {
73
+ if (cacheKey !== previousCacheKey) {
74
+ cache[cacheKey] = cached;
75
+ cacheDirty = true;
76
+ }
77
+ if (accountCatalog) cfg.models = Object.keys(cached.provider.models);
78
+ if (modelDiscoveryAuthoritative) {
79
+ opts.registry.mergeOverlay(
80
+ { [id]: cached.provider },
81
+ { observedAt: cached.fetchedAt, authoritativeProviderIds: [id] }
82
+ );
83
+ } else {
84
+ opts.registry.mergeOverlay({ [id]: cached.provider });
85
+ }
86
+ opts.logger?.warn(
87
+ `auto-discovery for "${id}" failed; using ${Object.keys(cached.provider.models).length} cached models from ${cached.fetchedAt} (${failureReason})`
88
+ );
89
+ } else {
90
+ if (accountCatalog) {
91
+ cfg.models = [];
92
+ opts.registry.mergeOverlay(
93
+ {
94
+ [id]: {
95
+ id,
96
+ name: id,
97
+ npm: "@ai-sdk/openai-compatible",
98
+ api: baseUrl,
99
+ env: [],
100
+ models: {}
101
+ }
102
+ },
103
+ { authoritativeProviderIds: [id] }
104
+ );
105
+ }
106
+ opts.logger?.warn(
107
+ `auto-discovery for "${id}" failed and no cache available (${failureReason}; catalog at ${baseUrl})`
108
+ );
109
+ }
110
+ })
111
+ );
112
+ if (cacheDirty) {
113
+ try {
114
+ await fs.writeFile(cacheFile, JSON.stringify(cache), "utf8");
115
+ } catch {
116
+ }
117
+ }
118
+ }
119
+
120
+ export {
121
+ discoverAndMergeProviders
122
+ };
123
+ //# sourceMappingURL=chunk-CFHWIFXL.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
@@ -1,41 +1,43 @@
1
1
 
2
2
  // src/subcommands/index.ts
3
3
  var loaders = {
4
- acp: async () => (await import("./acp-QWCBMQSO.js")).acpCmd,
4
+ automation: async () => (await import("./automation-MCDFCIMV.js")).automationCmd,
5
+ sandbox: async () => (await import("./sandbox-TYGD6FI2.js")).sandboxCmd,
6
+ acp: async () => (await import("./acp-EDGUWU7N.js")).acpCmd,
5
7
  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-GB5VXCCT.js")).remoteCmd,
9
- sessions: async () => (await import("./sessions-config-JGIZRNT6.js")).sessionsCmd,
10
- config: async () => (await import("./sessions-config-JGIZRNT6.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,
8
+ auth: async () => (await import("./auth-SUHKFFO4.js")).authCmd,
9
+ update: async () => (await import("./update-J5WHAFPE.js")).updateCmd,
10
+ remote: async () => (await import("./remote-C74BCNND.js")).remoteCmd,
11
+ sessions: async () => (await import("./sessions-config-VE26SB56.js")).sessionsCmd,
12
+ config: async () => (await import("./sessions-config-VE26SB56.js")).configCmd,
13
+ "config-export": async () => (await import("./config-transfer-UE37X4B5.js")).configExportCmd,
14
+ "config-import": async () => (await import("./config-transfer-UE37X4B5.js")).configImportCmd,
15
+ rewind: async () => (await import("./rewind-7AULJS7F.js")).rewindCmd,
14
16
  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,
17
+ audit: async () => (await import("./audit-KCBTHUQI.js")).auditCmd,
18
+ tools: async () => (await import("./tools-skills-33AI6K6S.js")).toolsCmd,
19
+ skills: async () => (await import("./tools-skills-33AI6K6S.js")).skillsCmd,
18
20
  "skill-suggest": async () => (await import("./skill-suggest-L2EVWB6R.js")).skillSuggestCmd,
19
- typesafe: async () => (await import("./typesafe-WA5O3KVS.js")).typesafeCmd,
20
- providers: async () => (await import("./providers-models-5Z2PJTEW.js")).providersCmd,
21
- models: async () => (await import("./providers-models-5Z2PJTEW.js")).modelsCmd,
21
+ typesafe: async () => (await import("./typesafe-NHC322W5.js")).typesafeCmd,
22
+ providers: async () => (await import("./providers-models-W57I3QOA.js")).providersCmd,
23
+ models: async () => (await import("./providers-models-W57I3QOA.js")).modelsCmd,
22
24
  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
+ plugin: async () => (await import("./plugin-usage-3TZGROK7.js")).pluginCmd,
26
+ plugins: async () => (await import("./plugin-usage-3TZGROK7.js")).pluginCmd,
25
27
  diag: async () => (await import("./diag-doctor-BIZAFIAT.js")).diagCmd,
26
28
  doctor: async () => (await import("./diag-doctor-BIZAFIAT.js")).doctorCmd,
27
29
  "proxy-status": async () => (await import("./diag-doctor-BIZAFIAT.js")).proxyCmd,
28
30
  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-HN32QYQN.js")).versionCmd,
31
- help: async () => (await import("./version-help-HN32QYQN.js")).helpCmd,
31
+ usage: async () => (await import("./plugin-usage-3TZGROK7.js")).usageCmd,
32
+ version: async () => (await import("./version-help-ATOKGMTK.js")).versionCmd,
33
+ help: async () => (await import("./version-help-ATOKGMTK.js")).helpCmd,
32
34
  projects: async () => (await import("./projects-T4CZCA25.js")).projectsCmd,
33
- modeldiag: async () => (await import("./modeldiag-W7XAE625.js")).modeldiagCmd,
35
+ modeldiag: async () => (await import("./modeldiag-PQILD7TN.js")).modeldiagCmd,
34
36
  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-BNK67HOE.js")).hqCmd,
38
- mailbox: async () => (await import("./mailbox-serve-FW3JCCPK.js")).mailboxServeCmd,
37
+ bench: async () => (await import("./bench-MMZHFHDL.js")).benchCmd,
38
+ chronicle: async () => (await import("./chronicle-PBJS7BN6.js")).chronicleCmd,
39
+ hq: async () => (await import("./hq-KBFDKTDD.js")).hqCmd,
40
+ mailbox: async () => (await import("./mailbox-serve-S536N66F.js")).mailboxServeCmd,
39
41
  permissions: async () => (await import("./permissions-PL27UHYD.js")).permissionsCmd,
40
42
  project: async () => (await import("./project-AOQI5XTK.js")).projectCmd,
41
43
  sage: async () => (await import("./sage-FFKUOCQL.js")).sageCmd,
@@ -56,4 +58,4 @@ export {
56
58
  subcommands,
57
59
  subcommandNames
58
60
  };
59
- //# sourceMappingURL=chunk-KT34LWIS.js.map
61
+ //# sourceMappingURL=chunk-LIZXJHZQ.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
@@ -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
@@ -2889,8 +2889,8 @@ async function handleApiAgentMessages(req, res, match, agentMessages) {
2889
2889
  // src/hq-server/routes/system-handlers.ts
2890
2890
  async function handleApiSystemUpdate(res) {
2891
2891
  const [{ checkForUpdate }, { detectUpdatePackageName }] = await Promise.all([
2892
- import("./update-check-J5ZVKS73.js"),
2893
- import("./update-TDZX4IL2.js")
2892
+ import("./update-check-VLVT4IV2.js"),
2893
+ import("./update-J5WHAFPE.js")
2894
2894
  ]);
2895
2895
  const packageName = detectUpdatePackageName();
2896
2896
  const info = await checkForUpdate({ packageName });
@@ -5367,4 +5367,4 @@ export {
5367
5367
  startHqServer,
5368
5368
  HqInsecureExposureError2 as HqInsecureExposureError
5369
5369
  };
5370
- //# sourceMappingURL=chunk-6A7URMWN.js.map
5370
+ //# sourceMappingURL=chunk-RQ4UBKYH.js.map
@@ -66,7 +66,7 @@ async function downloadReleaseAssetToFile(url, file, options) {
66
66
  throw new Error(`download ${url} is too large`);
67
67
  }
68
68
  hash.update(value);
69
- await out.write(value);
69
+ await out.writeFile(value);
70
70
  }
71
71
  } finally {
72
72
  reader.releaseLock();
@@ -326,4 +326,4 @@ export {
326
326
  installExecutableFrom,
327
327
  updateStandaloneBinary
328
328
  };
329
- //# sourceMappingURL=chunk-X756ZS72.js.map
329
+ //# sourceMappingURL=chunk-SUDNPYWD.js.map