@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
@@ -1,3 +1,6 @@
1
+ import {
2
+ providerCloudConfig
3
+ } from "./chunk-TXAFIERF.js";
1
4
  import {
2
5
  addCustomProvider,
3
6
  addFromCatalog,
@@ -5,6 +8,7 @@ import {
5
8
  confirm,
6
9
  createAuthAuditLogger,
7
10
  loadProviders,
11
+ parseAuthMenuIndex,
8
12
  providerAuthStrategiesFor,
9
13
  readKeyInput,
10
14
  renderActions,
@@ -16,13 +20,12 @@ import {
16
20
  runOAuthLoginKind,
17
21
  runOAuthLoginMenu,
18
22
  validateFamily
19
- } from "./chunk-2ERX3RPN.js";
23
+ } from "./chunk-P3GRLV47.js";
20
24
  import {
21
25
  renderAuthLocalHelpToString,
22
26
  wantsLocalHelp
23
27
  } from "./chunk-YTEOAWOJ.js";
24
28
  import "./chunk-5UZBUV2H.js";
25
- import "./chunk-SIGUWXAA.js";
26
29
  import {
27
30
  loadConfigProviders,
28
31
  maskedKey,
@@ -30,21 +33,21 @@ import {
30
33
  normalizeKeys,
31
34
  nowIso,
32
35
  writeKeysBack
33
- } from "./chunk-LUMETJFO.js";
34
- import "./chunk-DAKVBMD4.js";
36
+ } from "./chunk-ZYACRPLN.js";
35
37
  import {
36
38
  activeProfileConfigPath
37
39
  } from "./chunk-YMXXOOFN.js";
40
+ import "./chunk-4BX2YDTQ.js";
38
41
  import {
39
42
  restoreFlags
40
43
  } from "./chunk-CSAPOCBP.js";
41
- import "./chunk-WSTVGC2C.js";
44
+ import "./chunk-DAKVBMD4.js";
42
45
  import {
43
46
  parseAuthFlags
44
- } from "./chunk-Q4INH2DG.js";
47
+ } from "./chunk-MPQCHBDJ.js";
45
48
 
46
49
  // src/subcommands/handlers/auth.ts
47
- import { color as color5 } from "@wrongstack/core/utils";
50
+ import { color as color6 } from "@wrongstack/core/utils";
48
51
  import { authProfileAliasError as authProfileAliasError2 } from "@wrongstack/providers";
49
52
 
50
53
  // src/auth-menu/anthropic-oauth.ts
@@ -143,12 +146,50 @@ import {
143
146
  } from "@wrongstack/core/types";
144
147
  import { color as color2 } from "@wrongstack/core/utils";
145
148
  import { copilotBaseUrlFromToken, refreshCopilotToken } from "@wrongstack/providers";
149
+ import { fetchCopilotModels as fetchAccountCopilotModels } from "@wrongstack/providers/oauth";
150
+ import { isUsableCopilotChatModel } from "@wrongstack/providers/oauth";
151
+
152
+ // src/auth-menu/openai-codex-oauth.ts
153
+ import { color as color3 } from "@wrongstack/core/utils";
154
+ import {
155
+ buildCodexAuthorizeUrl,
156
+ CODEX_BASE_URL,
157
+ CODEX_FALLBACK_REDIRECT_PORT,
158
+ CODEX_PROVIDER_ID,
159
+ CODEX_REDIRECT_HOST,
160
+ CODEX_REDIRECT_PATH,
161
+ CODEX_REDIRECT_PORT,
162
+ CODEX_SCOPE,
163
+ codexRedirectUri,
164
+ createState,
165
+ exchangeCodexAuthorizationCode,
166
+ extractAccountId,
167
+ generatePkce,
168
+ parseAuthorizationInput,
169
+ refreshCodexTokens,
170
+ resolveCodexModels
171
+ } from "@wrongstack/providers/oauth";
172
+ import {
173
+ CODEX_BASE_URL as CODEX_BASE_URL2,
174
+ CODEX_CATALOG_FAMILIES,
175
+ CODEX_PROVIDER_ID as CODEX_PROVIDER_ID2,
176
+ extractAccountId as extractAccountId2,
177
+ FALLBACK_CODEX_MODELS,
178
+ fallbackCodexModelIds,
179
+ fallbackCodexProviderModels,
180
+ fetchCodexModels,
181
+ filterCurrentCodexModelIds,
182
+ generatePkce as generatePkce2,
183
+ isCodexCatalogModel,
184
+ parseAuthorizationInput as parseAuthorizationInput2,
185
+ resolveCodexModels as resolveCodexModels2
186
+ } from "@wrongstack/providers/oauth";
146
187
 
147
188
  // src/auth-menu/top-menu.ts
148
- import { color as color4 } from "@wrongstack/core/utils";
189
+ import { color as color5 } from "@wrongstack/core/utils";
149
190
 
150
191
  // src/auth-menu/provider-menu.ts
151
- import { color as color3, expectDefined } from "@wrongstack/core/utils";
192
+ import { color as color4, expectDefined } from "@wrongstack/core/utils";
152
193
  async function manageProvider(providerId, deps) {
153
194
  for (; ; ) {
154
195
  const providers = await loadProviders(deps);
@@ -161,12 +202,12 @@ async function manageProvider(providerId, deps) {
161
202
  renderProviderHeader(deps.renderer, providerId, cfg);
162
203
  renderActions(deps.renderer, keys.length);
163
204
  const raw = (await deps.reader.readLine(`
164
- ${color3.amber("?")} ${providerId} > `)).trim();
205
+ ${color4.amber("?")} ${providerId} > `)).trim();
165
206
  if (!raw || raw === "b" || raw === "back" || raw === "q" || raw === "quit") {
166
207
  return;
167
208
  }
168
209
  const [verb = "", argRaw = ""] = raw.split(/\s+/, 2);
169
- const arg = argRaw ? Number.parseInt(argRaw, 10) : Number.NaN;
210
+ const arg = parseAuthMenuIndex(argRaw);
170
211
  const handled = await dispatchAction(verb, arg, providerId, keys, cfg, deps);
171
212
  if (handled === "exit") return;
172
213
  if (handled === "continue") continue;
@@ -192,7 +233,7 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
192
233
  },
193
234
  deps.profileConfigPath
194
235
  );
195
- deps.renderer.write(` ${color3.green("\u2713")} Removed ${providerId}.
236
+ deps.renderer.write(` ${color4.green("\u2713")} Removed ${providerId}.
196
237
  `);
197
238
  return "exit";
198
239
  }
@@ -216,7 +257,7 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
216
257
  },
217
258
  deps.profileConfigPath
218
259
  );
219
- deps.renderer.write(` ${color3.green("\u2713")} Updated ${providerId}/${target.label}.
260
+ deps.renderer.write(` ${color4.green("\u2713")} Updated ${providerId}/${target.label}.
220
261
  `);
221
262
  return "continue";
222
263
  }
@@ -243,7 +284,7 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
243
284
  },
244
285
  deps.profileConfigPath
245
286
  );
246
- deps.renderer.write(` ${color3.green("\u2713")} Deleted ${providerId}/${target.label}.
287
+ deps.renderer.write(` ${color4.green("\u2713")} Deleted ${providerId}/${target.label}.
247
288
  `);
248
289
  return "continue";
249
290
  }
@@ -262,14 +303,14 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
262
303
  },
263
304
  deps.profileConfigPath
264
305
  );
265
- deps.renderer.write(` ${color3.green("\u2713")} Active key \u2192 ${color3.bold(target.label)}.
306
+ deps.renderer.write(` ${color4.green("\u2713")} Active key \u2192 ${color4.bold(target.label)}.
266
307
  `);
267
308
  return "continue";
268
309
  }
269
310
  if (verb === "f" || verb === "family") {
270
311
  const current = cfg.family ?? "";
271
312
  const ans = (await deps.reader.readLine(
272
- ` ${color3.amber("?")} Family ${color3.dim(`(anthropic | openai | openai-compatible | google, empty = unset, current: ${current || "unset"})`)}: `
313
+ ` ${color4.amber("?")} Family ${color4.dim(`(anthropic | openai | openai-compatible | google, empty = unset, current: ${current || "unset"})`)}: `
273
314
  )).trim();
274
315
  if (ans !== "") {
275
316
  const validated = validateFamily(ans);
@@ -289,7 +330,7 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
289
330
  },
290
331
  deps.profileConfigPath
291
332
  );
292
- deps.renderer.write(` ${color3.green("\u2713")} family \u2192 ${validated}
333
+ deps.renderer.write(` ${color4.green("\u2713")} family \u2192 ${validated}
293
334
  `);
294
335
  } else {
295
336
  await mutateConfigProviders(
@@ -302,7 +343,7 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
302
343
  },
303
344
  deps.profileConfigPath
304
345
  );
305
- deps.renderer.write(` ${color3.green("\u2713")} family \u2192 (unset)
346
+ deps.renderer.write(` ${color4.green("\u2713")} family \u2192 (unset)
306
347
  `);
307
348
  }
308
349
  return "continue";
@@ -310,7 +351,7 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
310
351
  if (verb === "B" || verb === "baseurl" || verb === "base-url" || verb === "url") {
311
352
  const current = cfg.baseUrl ?? "";
312
353
  const ans = (await deps.reader.readLine(
313
- ` ${color3.amber("?")} Base URL ${color3.dim(`(empty = unset, current: ${current || "unset"})`)}: `
354
+ ` ${color4.amber("?")} Base URL ${color4.dim(`(empty = unset, current: ${current || "unset"})`)}: `
314
355
  )).trim();
315
356
  await mutateConfigProviders(
316
357
  deps.profileConfigPath,
@@ -323,14 +364,14 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
323
364
  },
324
365
  deps.profileConfigPath
325
366
  );
326
- deps.renderer.write(` ${color3.green("\u2713")} baseUrl \u2192 ${ans || "(unset)"}
367
+ deps.renderer.write(` ${color4.green("\u2713")} baseUrl \u2192 ${ans || "(unset)"}
327
368
  `);
328
369
  return "continue";
329
370
  }
330
371
  if (verb === "m" || verb === "models") {
331
372
  const current = (cfg.models ?? []).join(", ");
332
373
  const ans = (await deps.reader.readLine(
333
- ` ${color3.amber("?")} Model ids ${color3.dim(`(comma-separated, empty = catalog default, current: ${current || "none"})`)}: `
374
+ ` ${color4.amber("?")} Model ids ${color4.dim(`(comma-separated, empty = catalog default, current: ${current || "none"})`)}: `
334
375
  )).trim();
335
376
  const list = ans ? ans.split(",").map((s) => s.trim()).filter(Boolean) : [];
336
377
  await mutateConfigProviders(
@@ -345,7 +386,7 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
345
386
  deps.profileConfigPath
346
387
  );
347
388
  deps.renderer.write(
348
- ` ${color3.green("\u2713")} models \u2192 ${list.length === 0 ? "(catalog default)" : list.join(", ")}
389
+ ` ${color4.green("\u2713")} models \u2192 ${list.length === 0 ? "(catalog default)" : list.join(", ")}
349
390
  `
350
391
  );
351
392
  return "continue";
@@ -354,7 +395,7 @@ async function dispatchAction(verb, arg, providerId, keys, cfg, deps) {
354
395
  return "unknown";
355
396
  }
356
397
  function validKeyIndex(arg, max, deps, verb) {
357
- if (!Number.isFinite(arg) || arg < 1 || arg > max) {
398
+ if (arg === void 0 || arg > max) {
358
399
  deps.renderer.writeError(`Usage: ${verb} <1-${max}>`);
359
400
  return false;
360
401
  }
@@ -368,9 +409,9 @@ async function runTopMenu(deps) {
368
409
  renderTopMenu(deps.renderer, providers);
369
410
  const ids = Object.keys(providers).sort();
370
411
  const choice = (await deps.reader.readLine(`
371
- ${color4.amber("?")} Pick: `)).trim().toLowerCase();
412
+ ${color5.amber("?")} Pick: `)).trim().toLowerCase();
372
413
  if (!choice || choice === "q" || choice === "quit" || choice === "exit") {
373
- deps.renderer.write(color4.dim("Done.\n"));
414
+ deps.renderer.write(color5.dim("Done.\n"));
374
415
  return 0;
375
416
  }
376
417
  if (choice === "a" || choice === "add") {
@@ -389,8 +430,8 @@ ${color4.amber("?")} Pick: `)).trim().toLowerCase();
389
430
  await runOAuthLoginMenu(deps);
390
431
  continue;
391
432
  }
392
- const idx = Number.parseInt(choice, 10);
393
- if (!Number.isNaN(idx) && idx >= 1 && idx <= ids.length) {
433
+ const idx = parseAuthMenuIndex(choice);
434
+ if (idx !== void 0 && idx <= ids.length) {
394
435
  const pid = ids[idx - 1];
395
436
  await manageProvider(pid, deps);
396
437
  continue;
@@ -442,6 +483,7 @@ var authCmd = async (args, deps) => {
442
483
  " wstack auth login <strategy> --alias <account> Sign in to an auth profile",
443
484
  " wstack auth <saved-alias> --label <key-label> Add a key inside an existing profile",
444
485
  " wstack auth list | status <alias> | remove <alias>",
486
+ " wstack auth cloud <alias> [--region|--project|--location|--resource-name <value>] [clear]",
445
487
  "",
446
488
  "Fallback targets are <auth-profile-alias>/<model-id>; provider type chooses the transport.",
447
489
  "Direct flags: --alias, --label, --family, --base-url, --env",
@@ -461,6 +503,41 @@ var authCmd = async (args, deps) => {
461
503
  return runTopMenu(menuDeps);
462
504
  }
463
505
  const first = flags.positional[0];
506
+ if (first === "cloud") {
507
+ try {
508
+ const id = flags.positional[1];
509
+ if (!id)
510
+ throw new Error(
511
+ "Usage: wstack auth cloud <saved-provider> [--region value|--project value|--location value|--resource-name value] [clear]"
512
+ );
513
+ const updates = {};
514
+ for (const [flag, field] of [
515
+ ["region", "region"],
516
+ ["project", "project"],
517
+ ["location", "location"],
518
+ ["resource-name", "resourceName"]
519
+ ]) {
520
+ const value = deps.flags?.[flag];
521
+ if (value !== void 0 && typeof value !== "string")
522
+ throw new Error(`--${flag} requires a value`);
523
+ if (typeof value === "string") updates[field] = value;
524
+ }
525
+ const cloud = await providerCloudConfig(
526
+ id,
527
+ flags.positional[2] === "clear" ? null : Object.keys(updates).length ? updates : void 0,
528
+ profileConfigPath,
529
+ deps.vault
530
+ );
531
+ deps.renderer.write(`${JSON.stringify({ provider: id, cloud }, null, 2)}
532
+ `);
533
+ return 0;
534
+ } catch (error) {
535
+ deps.renderer.writeError(
536
+ error instanceof Error ? error.message : "Cloud configuration failed"
537
+ );
538
+ return 1;
539
+ }
540
+ }
464
541
  if (first === "list" || first === "ls") {
465
542
  return runAuthList(menuDeps);
466
543
  }
@@ -517,11 +594,11 @@ var authCmd = async (args, deps) => {
517
594
  deps.renderer.writeError(`Unknown OAuth login strategy "${pid}".`);
518
595
  for (const strategy of available) {
519
596
  deps.renderer.write(
520
- color5.dim(` Sign in with ${strategy.label}: `) + color5.bold(`wstack auth login ${strategy.id}`) + "\n"
597
+ color6.dim(` Sign in with ${strategy.label}: `) + color6.bold(`wstack auth login ${strategy.id}`) + "\n"
521
598
  );
522
599
  }
523
600
  deps.renderer.write(
524
- color5.dim(" For an API key instead: ") + color5.bold(`wstack auth ${pid}`) + "\n"
601
+ color6.dim(" For an API key instead: ") + color6.bold(`wstack auth ${pid}`) + "\n"
525
602
  );
526
603
  return 1;
527
604
  }
@@ -545,14 +622,14 @@ async function runAuthList(deps) {
545
622
  const ids = Object.keys(providers).sort();
546
623
  if (ids.length === 0) {
547
624
  deps.renderer.write(
548
- `${color5.dim("No providers configured.")}
549
- ${color5.dim("Run")} ${color5.bold("wstack auth")} ${color5.dim("to add one.")}
625
+ `${color6.dim("No providers configured.")}
626
+ ${color6.dim("Run")} ${color6.bold("wstack auth")} ${color6.dim("to add one.")}
550
627
  `
551
628
  );
552
629
  return 0;
553
630
  }
554
631
  deps.renderer.write(`
555
- ${color5.bold("Saved providers")} ${color5.dim(`(${ids.length})`)}
632
+ ${color6.bold("Saved providers")} ${color6.dim(`(${ids.length})`)}
556
633
 
557
634
  `);
558
635
  for (const id of ids) {
@@ -560,34 +637,34 @@ ${color5.bold("Saved providers")} ${color5.dim(`(${ids.length})`)}
560
637
  if (!cfg) continue;
561
638
  const keys = normalizeKeys(cfg);
562
639
  const active = cfg.activeKey ?? keys[0]?.label;
563
- const famTag = cfg.family ? `${cfg.family}` : color5.amber("no-family");
564
- const aliasHint = cfg.type && cfg.type !== id ? color5.dim(` (\u2192 ${cfg.type})`) : "";
565
- const modelHint = cfg.models && cfg.models.length > 0 ? color5.dim(` [${cfg.models.length} models]`) : "";
566
- deps.renderer.write(` ${color5.bold(id)}${aliasHint}
640
+ const famTag = cfg.family ? `${cfg.family}` : color6.amber("no-family");
641
+ const aliasHint = cfg.type && cfg.type !== id ? color6.dim(` (\u2192 ${cfg.type})`) : "";
642
+ const modelHint = cfg.models && cfg.models.length > 0 ? color6.dim(` [${cfg.models.length} models]`) : "";
643
+ deps.renderer.write(` ${color6.bold(id)}${aliasHint}
567
644
  `);
568
645
  deps.renderer.write(
569
- ` family: ${famTag} baseUrl: ${cfg.baseUrl ?? color5.dim("unset")}${modelHint}
646
+ ` family: ${famTag} baseUrl: ${cfg.baseUrl ?? color6.dim("unset")}${modelHint}
570
647
  `
571
648
  );
572
649
  if (keys.length === 0) {
573
- deps.renderer.write(` ${color5.amber("no keys")}
650
+ deps.renderer.write(` ${color6.amber("no keys")}
574
651
  `);
575
652
  } else {
576
653
  deps.renderer.write(
577
- ` ${color5.dim(`${keys.length} key${keys.length === 1 ? "" : "s"}:`)}
654
+ ` ${color6.dim(`${keys.length} key${keys.length === 1 ? "" : "s"}:`)}
578
655
  `
579
656
  );
580
657
  for (const k of keys) {
581
- const marker = k.label === active ? color5.green("\u25CF") : color5.dim("\u25CB");
658
+ const marker = k.label === active ? color6.green("\u25CF") : color6.dim("\u25CB");
582
659
  deps.renderer.write(
583
- ` ${marker} ${k.label.padEnd(18)} ${maskedKey(k.apiKey)} ${color5.dim(k.createdAt)}
660
+ ` ${marker} ${k.label.padEnd(18)} ${maskedKey(k.apiKey)} ${color6.dim(k.createdAt)}
584
661
  `
585
662
  );
586
663
  }
587
664
  }
588
665
  deps.renderer.write("\n");
589
666
  }
590
- deps.renderer.write(color5.dim(`Manage: wstack auth Add key: wstack auth <provider>
667
+ deps.renderer.write(color6.dim(`Manage: wstack auth Add key: wstack auth <provider>
591
668
  `));
592
669
  return 0;
593
670
  }
@@ -603,7 +680,7 @@ async function runAuthStatus(deps, providerId) {
603
680
  if (!cfg) {
604
681
  deps.renderer.writeError(`Provider "${providerId}" not found in config.`);
605
682
  deps.renderer.write(
606
- color5.dim(`Run ${color5.bold("wstack auth list")} to see saved providers.
683
+ color6.dim(`Run ${color6.bold("wstack auth list")} to see saved providers.
607
684
  `)
608
685
  );
609
686
  return 1;
@@ -612,32 +689,32 @@ async function runAuthStatus(deps, providerId) {
612
689
  const active = cfg.activeKey ?? keys[0]?.label;
613
690
  const lines = [
614
691
  `
615
- ${color5.bold(providerId)} ${cfg.family ? color5.dim(`[${cfg.family}]`) : color5.amber("[no family]")}`,
692
+ ${color6.bold(providerId)} ${cfg.family ? color6.dim(`[${cfg.family}]`) : color6.amber("[no family]")}`,
616
693
  "",
617
- ` type: ${color5.cyan(cfg.type ?? providerId)}`,
618
- ` family: ${cfg.family ? color5.cyan(cfg.family) : color5.dim("unset")}`,
619
- ` baseUrl: ${cfg.baseUrl ? color5.cyan(cfg.baseUrl) : color5.dim("unset")}`
694
+ ` type: ${color6.cyan(cfg.type ?? providerId)}`,
695
+ ` family: ${cfg.family ? color6.cyan(cfg.family) : color6.dim("unset")}`,
696
+ ` baseUrl: ${cfg.baseUrl ? color6.cyan(cfg.baseUrl) : color6.dim("unset")}`
620
697
  ];
621
698
  if (cfg.models?.length) {
622
- lines.push(` models: ${color5.cyan(cfg.models.join(", "))}`);
699
+ lines.push(` models: ${color6.cyan(cfg.models.join(", "))}`);
623
700
  }
624
701
  if (cfg.envVars?.length) {
625
- lines.push(` envVars: ${color5.cyan(cfg.envVars.join(", "))}`);
702
+ lines.push(` envVars: ${color6.cyan(cfg.envVars.join(", "))}`);
626
703
  }
627
704
  lines.push("");
628
705
  if (keys.length === 0) {
629
- lines.push(color5.amber(" (no keys saved)"));
706
+ lines.push(color6.amber(" (no keys saved)"));
630
707
  } else {
631
- lines.push(` ${color5.dim("Keys:")}`);
708
+ lines.push(` ${color6.dim("Keys:")}`);
632
709
  for (const k of keys) {
633
- const marker = k.label === active ? color5.green("\u25CF") : color5.dim("\u25CB");
710
+ const marker = k.label === active ? color6.green("\u25CF") : color6.dim("\u25CB");
634
711
  lines.push(
635
- ` ${marker} ${color5.bold(k.label.padEnd(18))} ${maskedKey(k.apiKey)} ${color5.dim(k.createdAt)}`
712
+ ` ${marker} ${color6.bold(k.label.padEnd(18))} ${maskedKey(k.apiKey)} ${color6.dim(k.createdAt)}`
636
713
  );
637
714
  }
638
715
  }
639
716
  lines.push("");
640
- lines.push(color5.dim(`Manage: wstack auth \u2192 pick ${providerId}`));
717
+ lines.push(color6.dim(`Manage: wstack auth \u2192 pick ${providerId}`));
641
718
  deps.renderer.write(lines.join("\n") + "\n");
642
719
  return 0;
643
720
  }
@@ -648,19 +725,19 @@ async function runAuthRemove(deps, providerId) {
648
725
  return 1;
649
726
  }
650
727
  deps.renderer.write(
651
- `${color5.amber("!")} This will remove "${providerId}" and all its saved keys.
728
+ `${color6.amber("!")} This will remove "${providerId}" and all its saved keys.
652
729
  `
653
730
  );
654
- const answer = (await deps.reader.readLine(` ${color5.amber("?")} Confirm removal? ${color5.dim("[y/N]")} `)).trim().toLowerCase();
731
+ const answer = (await deps.reader.readLine(` ${color6.amber("?")} Confirm removal? ${color6.dim("[y/N]")} `)).trim().toLowerCase();
655
732
  if (answer !== "y" && answer !== "yes") {
656
- deps.renderer.write(color5.dim("Cancelled.\n"));
733
+ deps.renderer.write(color6.dim("Cancelled.\n"));
657
734
  return 0;
658
735
  }
659
736
  try {
660
737
  await mutateConfigProviders(deps.profileConfigPath, deps.vault, (all) => {
661
738
  delete all[providerId];
662
739
  });
663
- deps.renderer.write(` ${color5.green("\u2713")} Removed ${color5.bold(providerId)}.
740
+ deps.renderer.write(` ${color6.green("\u2713")} Removed ${color6.bold(providerId)}.
664
741
  `);
665
742
  return 0;
666
743
  } catch (err) {
@@ -671,4 +748,4 @@ async function runAuthRemove(deps, providerId) {
671
748
  export {
672
749
  authCmd
673
750
  };
674
- //# sourceMappingURL=auth-TE55JF4Z.js.map
751
+ //# sourceMappingURL=auth-SUHKFFO4.js.map
@@ -25,40 +25,7 @@ export declare function startDeviceFlow(signal?: AbortSignal): Promise<DeviceCod
25
25
  /** Poll until the user authorizes; returns the GitHub OAuth token. */
26
26
  export declare function pollForGitHubToken(device: DeviceCode, signal: AbortSignal): Promise<string>;
27
27
  /** Shape of the fields we read from a `/models` entry (everything optional). */
28
- interface CopilotModelEntry {
29
- id?: unknown;
30
- model_picker_enabled?: unknown;
31
- is_chat_default?: unknown;
32
- is_chat_fallback?: unknown;
33
- vendor?: unknown;
34
- supported_endpoints?: unknown;
35
- policy?: {
36
- state?: unknown;
37
- } | undefined;
38
- capabilities?: {
39
- type?: unknown;
40
- supports?: {
41
- tool_calls?: unknown;
42
- } | undefined;
43
- } | undefined;
44
- }
45
- /**
46
- * Decide whether a Copilot `/models` entry is a chat model we can actually
47
- * drive over this provider's wire.
48
- *
49
- * The provider POSTs to `…/chat/completions`, so the discriminators are:
50
- * - `capabilities.type === 'chat'` — drops embeddings and completion-only ids.
51
- * - `capabilities.supports.tool_calls` — the agent loop needs tool calling.
52
- * - `supported_endpoints` (when present) must include `/chat/completions`.
53
- * This is the key fix: `/responses`-only ids (the `*-picker` router models,
54
- * `gpt-5.4-mini-free-auto`, `mai-code-1-flash*`) advertise themselves in the
55
- * model picker but 400 on `/chat/completions`. Absent field ⇒ legacy chat
56
- * model (gpt-4o, gpt-4.1) ⇒ allowed.
57
- * - `policy.state !== 'disabled'` — disabled means the user hasn't enabled the
58
- * model in their GitHub Copilot settings; calling it would 403.
59
- * - `vendor !== 'Experimental'` — drops internal previews (trajectory-compaction).
60
- */
61
- export declare function isUsableCopilotChatModel(item: CopilotModelEntry): boolean;
28
+ export { isUsableCopilotChatModel } from '@wrongstack/providers/oauth';
62
29
  export interface CopilotLoginOptions {
63
30
  providerId?: string;
64
31
  /**
@@ -69,5 +36,4 @@ export interface CopilotLoginOptions {
69
36
  signal?: AbortSignal | undefined;
70
37
  }
71
38
  export declare function runCopilotOAuthLogin(deps: AuthMenuDeps, opts?: CopilotLoginOptions): Promise<number>;
72
- export {};
73
39
  //# sourceMappingURL=github-copilot-oauth.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Parse a one-based menu index, rejecting numeric prefixes with trailing text. */
2
+ export declare function parseAuthMenuIndex(raw: string): number | undefined;
3
+ //# sourceMappingURL=index-input.d.ts.map
@@ -0,0 +1,29 @@
1
+ import type { ModelsRegistry, ProviderConfig, SecretScrubber, SecretVault } from '@wrongstack/core/types';
2
+ import type { AuthFlowIo, AuthFlowResult } from '@wrongstack/tui';
3
+ import type { AuthMenuDeps } from './types.js';
4
+ export interface AuthPanelServiceDeps {
5
+ vault: SecretVault;
6
+ modelsRegistry: ModelsRegistry;
7
+ /** The sole config file read or written by auth operations. */
8
+ profileConfigPath: string;
9
+ secretScrubber?: SecretScrubber | undefined;
10
+ providerAuthRegistry?: AuthMenuDeps['providerAuthRegistry'];
11
+ /** Re-read the live provider snapshot after a successful auth mutation. */
12
+ onProvidersChanged?: (() => Promise<void>) | undefined;
13
+ }
14
+ export declare const ANSI_RE: RegExp;
15
+ export declare function stripAnsi(text: string): string;
16
+ /** Normalise a flow prompt (" ? Label for this key [default]: ") for the modal. */
17
+ export declare function cleanPrompt(prompt: string): string;
18
+ /** Fan a multi-line renderer write out into individual trimmed log lines. */
19
+ export declare function emitLines(io: AuthFlowIo, raw: string, prefix?: string): void;
20
+ /** Adapt an {@link AuthFlowIo} bridge into the deps shape the flows expect. */
21
+ export declare function flowDeps(base: AuthPanelServiceDeps, io: AuthFlowIo): AuthMenuDeps;
22
+ export declare function isCancel(err: unknown): boolean;
23
+ /** Run a flow, translating throws (Esc-cancel, I/O errors) into a result. */
24
+ export declare function runFlow(run: () => Promise<boolean>, onSuccess?: (() => Promise<void>) | undefined): Promise<AuthFlowResult>;
25
+ /** Plain (color-free) key mask: first 4 + last 4 characters. */
26
+ export declare function plainMaskedKey(key: string): string;
27
+ /** A model is editable when the provider lists it or defines it in `customModels`. */
28
+ export declare function hasEditableModel(provider: ProviderConfig, modelId: string): boolean;
29
+ //# sourceMappingURL=panel-flow-bridge.d.ts.map
@@ -1,37 +1,6 @@
1
- /**
2
- * TUI auth-panel host — the structured, UI-agnostic surface behind the
3
- * interactive `/auth` panel in the Ink TUI.
4
- *
5
- * Two kinds of operations:
6
- *
7
- * - **Direct mutations** (set active key, delete key, remove provider):
8
- * plain async methods that mutate the config atomically and return an
9
- * error string or `null`.
10
- *
11
- * - **Flows** (add key, add from catalog, add custom, add local, OAuth
12
- * sign-in, field edits): the existing battle-tested readline flows from
13
- * this package, driven through an {@link AuthFlowIo} bridge. The bridge
14
- * adapts `renderer.write*` → panel log lines (ANSI-stripped) and
15
- * `reader.readLine/readSecret` → the panel's modal prompt. A rejected
16
- * prompt (TUI Esc) aborts the flow before anything is saved.
17
- *
18
- * Secrets never cross into the TUI: key values are masked here, and the
19
- * modal prompt sends the plaintext only INTO the flow (never back out).
20
- */
21
- import type { ModelsRegistry, SecretScrubber, SecretVault } from '@wrongstack/core/types';
1
+ import type { AuthPanelServiceDeps } from './panel-flow-bridge.js';
2
+ export type { AuthPanelServiceDeps } from './panel-flow-bridge.js';
3
+ export { plainMaskedKey } from './panel-flow-bridge.js';
22
4
  import type { AuthPanelHost } from '@wrongstack/tui';
23
- import type { AuthMenuDeps } from './types.js';
24
- export interface AuthPanelServiceDeps {
25
- vault: SecretVault;
26
- modelsRegistry: ModelsRegistry;
27
- /** The sole config file read or written by auth operations. */
28
- profileConfigPath: string;
29
- secretScrubber?: SecretScrubber | undefined;
30
- providerAuthRegistry?: AuthMenuDeps['providerAuthRegistry'];
31
- /** Re-read the live provider snapshot after a successful auth mutation. */
32
- onProvidersChanged?: (() => Promise<void>) | undefined;
33
- }
34
- /** Plain (color-free) key mask: first 4 + last 4 characters. */
35
- export declare function plainMaskedKey(key: string): string;
36
5
  export declare function createAuthPanelHost(deps: AuthPanelServiceDeps): AuthPanelHost;
37
6
  //# sourceMappingURL=panel-service.d.ts.map
@@ -3,7 +3,7 @@ import type { AuthMenuDeps } from './types.js';
3
3
  type ProviderAuthRegistrySource = Pick<AuthMenuDeps, 'providerAuthRegistry'>;
4
4
  export declare function providerAuthRegistryFor(deps: ProviderAuthRegistrySource): ProviderAuthRegistry;
5
5
  /** UI-safe strategy metadata shared by the TUI auth panel and CLI menus. */
6
- export declare function providerAuthStrategiesFor(deps: ProviderAuthRegistrySource): import("@wrongstack/core").ProviderAuthStrategyMetadata[];
6
+ export declare function providerAuthStrategiesFor(deps: ProviderAuthRegistrySource): import("@wrongstack/core/types").ProviderAuthStrategyMetadata[];
7
7
  export declare function runProviderAuthLogin(deps: AuthMenuDeps, strategyId: string, opts?: {
8
8
  providerId?: string | undefined;
9
9
  signal?: AbortSignal | undefined;
@@ -0,0 +1,7 @@
1
+ import {
2
+ discoverAndMergeProviders
3
+ } from "./chunk-CFHWIFXL.js";
4
+ export {
5
+ discoverAndMergeProviders
6
+ };
7
+ //# sourceMappingURL=auto-discover-providers-QIL34K3U.js.map