@wrongstack/cli 1.0.17 → 1.0.24

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 (125) hide show
  1. package/dist/{acp-INCNOH42.js → acp-AJWSKWE5.js} +18 -7
  2. package/dist/arg-parser.d.ts +1 -0
  3. package/dist/{auth-YXK3EDUL.js → auth-GRBZ7Y3D.js} +61 -15
  4. package/dist/auth-menu/direct.d.ts +1 -0
  5. package/dist/auth-menu/local.d.ts +2 -0
  6. package/dist/auth-menu/oauth-menu.d.ts +3 -1
  7. package/dist/auth-menu/panel-service.d.ts +20 -0
  8. package/dist/{bench-YBU6BVQP.js → bench-N5K7Z5O3.js} +2 -2
  9. package/dist/boot/config-backup-recovery.d.ts +2 -1
  10. package/dist/boot/dispatch-webui.d.ts +11 -0
  11. package/dist/boot/short-circuit-desktop.d.ts +1 -0
  12. package/dist/boot/tui-project-picker-callback.d.ts +1 -1
  13. package/dist/boot/tui-settings-adapter.d.ts +15 -2
  14. package/dist/{boot-auto-thin-MANHOYHE.js → boot-auto-thin-6Q56FY3F.js} +3 -2
  15. package/dist/{chunk-6WRKAACA.js → chunk-2BKFWIER.js} +4 -2
  16. package/dist/{chunk-JY52HWL6.js → chunk-2EBVTYJR.js} +2 -2
  17. package/dist/chunk-3OCUS3VN.js +46 -0
  18. package/dist/chunk-424ORSE7.js +56 -0
  19. package/dist/{chunk-KEPABQYT.js → chunk-5SEYGOCH.js} +8 -82
  20. package/dist/chunk-BBHWW6LR.js +549 -0
  21. package/dist/{chunk-CJTBLTS4.js → chunk-BLD5DSVA.js} +4 -3
  22. package/dist/{chunk-K5PAL6KR.js → chunk-DRM7PSW7.js} +75 -29
  23. package/dist/{chunk-XJ7K67PP.js → chunk-JF2MULWF.js} +17 -10
  24. package/dist/{chunk-SIS37L3W.js → chunk-L2RVEQWO.js} +211 -193
  25. package/dist/{chunk-RDHFXOJM.js → chunk-LFMVHT3R.js} +106 -57
  26. package/dist/chunk-LUMETJFO.js +171 -0
  27. package/dist/{chunk-C3Z4N6A6.js → chunk-MHEBWVXL.js} +6 -2
  28. package/dist/{chunk-VGER3HYZ.js → chunk-PGKJ2OQP.js} +5 -5
  29. package/dist/{chunk-672UXYL3.js → chunk-QBBF7GIK.js} +2 -2
  30. package/dist/{chunk-DE7BZDNK.js → chunk-QFPQXKCG.js} +11 -3
  31. package/dist/chunk-R4QGL6GB.js +10 -0
  32. package/dist/chunk-S4FFHDJG.js +93 -0
  33. package/dist/chunk-SFBFYIOW.js +271 -0
  34. package/dist/{chunk-JX6KL7OF.js → chunk-SKPDE62W.js} +4 -3
  35. package/dist/{chunk-RMQNCHGO.js → chunk-U46QR4WR.js} +5 -9
  36. package/dist/{chunk-B4JLSXZB.js → chunk-WSTVGC2C.js} +73 -45
  37. package/dist/chunk-YBUCXXYZ.js +36 -0
  38. package/dist/{chunk-2VMJ3E5Z.js → chunk-YTEOAWOJ.js} +6 -2
  39. package/dist/{chunk-GPPRNAKW.js → chunk-ZMX5HRLI.js} +2 -2
  40. package/dist/{chunk-YLQEGYV4.js → chunk-ZZRSG7VK.js} +14 -4
  41. package/dist/{cli-context-4PTWEK52.js → cli-context-34Q5IJRA.js} +121 -89
  42. package/dist/cli-entry-point.d.ts +2 -0
  43. package/dist/{cli-main-DQ2GBY7M.js → cli-main-AELJDBGU.js} +1471 -1293
  44. package/dist/config-doctor.d.ts +10 -2
  45. package/dist/{config-transfer-2YF3CRTN.js → config-transfer-RUWLDCNK.js} +34 -13
  46. package/dist/{diag-doctor-ANPRUYFM.js → diag-doctor-WIFJH3XH.js} +2 -2
  47. package/dist/execute-deps.d.ts +2 -1
  48. package/dist/{execution-A6WJLSOC.js → execution-PYC5FCS4.js} +303 -256
  49. package/dist/{hq-NU75W3SE.js → hq-JTUTFI4L.js} +274 -258
  50. package/dist/hq-command-controller.d.ts +1 -1
  51. package/dist/hq-server/project-root.d.ts +35 -1
  52. package/dist/{hq-server-M2JWVW4D.js → hq-server-PC7GZMPT.js} +2 -2
  53. package/dist/{hq-service-L5INQFM4.js → hq-service-NW56MUP2.js} +11 -4
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.js +17 -12
  56. package/dist/kanban-supervisor-67ECABTD.js +7 -0
  57. package/dist/live-settings-input.d.ts +7 -0
  58. package/dist/{mailbox-serve-3GFOK2I7.js → mailbox-serve-WDOCH6KR.js} +3 -3
  59. package/dist/{mcp-DC5WSBOO.js → mcp-LBS45HWZ.js} +4 -4
  60. package/dist/modeldiag-36OGAL5C.js +828 -0
  61. package/dist/{per-subcommand-help-DHTYU524.js → per-subcommand-help-XE77MTGJ.js} +3 -3
  62. package/dist/permission-prompt-mirror.d.ts +1 -1
  63. package/dist/permission-prompt.d.ts +2 -2
  64. package/dist/plugin-config.d.ts +12 -0
  65. package/dist/plugin-management-types.d.ts +31 -0
  66. package/dist/plugin-management.d.ts +2 -30
  67. package/dist/plugin-package-install.d.ts +3 -0
  68. package/dist/{plugin-usage-M6KET4OZ.js → plugin-usage-S5LVGMBW.js} +6 -5
  69. package/dist/{plugins-WJLW6ULV.js → plugins-RHBIVLI7.js} +4 -3
  70. package/dist/provider-config-utils.d.ts +1 -6
  71. package/dist/{providers-models-LFNZ5WI7.js → providers-models-2CFG46RD.js} +41 -31
  72. package/dist/release-asset-download.d.ts +3 -0
  73. package/dist/services/dispatch-classifier.d.ts +39 -5
  74. package/dist/{sessions-config-UL45XKX7.js → sessions-config-IQUH2GXT.js} +13 -5
  75. package/dist/settings-menu.d.ts +2 -0
  76. package/dist/short-circuit-flags-SDT53OML.js +10 -0
  77. package/dist/{simpleui-dist-CXSIDAXZ.js → simpleui-dist-7BQISSEP.js} +7 -3
  78. package/dist/skill-suggest-L2EVWB6R.js +290 -0
  79. package/dist/slash-commands/effort.d.ts +1 -1
  80. package/dist/slash-commands/fallback.d.ts +1 -1
  81. package/dist/slash-commands/gitid.d.ts +1 -1
  82. package/dist/slash-commands/jev.d.ts +4 -0
  83. package/dist/slash-commands/openai-quota.d.ts +15 -0
  84. package/dist/slash-commands/sdd-task-mutations.d.ts +4 -0
  85. package/dist/slash-commands/settings-keys.d.ts +2 -0
  86. package/dist/slash-commands/settings-reset.d.ts +6 -0
  87. package/dist/standalone-update-MW47J3AK.js +164 -0
  88. package/dist/standalone-update.d.ts +19 -0
  89. package/dist/subcommands/handlers/hq-alerts.d.ts +3 -0
  90. package/dist/subcommands/handlers/hq-audit.d.ts +46 -0
  91. package/dist/subcommands/handlers/hq-data-dir.d.ts +13 -0
  92. package/dist/subcommands/handlers/skill-suggest.d.ts +21 -0
  93. package/dist/subcommands/handlers/typesafe-brain-replay.d.ts +26 -0
  94. package/dist/subcommands/handlers/typesafe-judgment-check.d.ts +3 -0
  95. package/dist/subcommands/handlers/typesafe-topic-replay.d.ts +19 -0
  96. package/dist/subcommands/handlers/typesafe-triage-replay.d.ts +18 -0
  97. package/dist/subcommands/handlers/typesafe.d.ts +23 -0
  98. package/dist/{subcommands-ERDDIJ3L.js → subcommands-ZTSIN7LG.js} +2 -2
  99. package/dist/typesafe-HVEVPA6R.js +316 -0
  100. package/dist/typesafe-brain-replay-C5276FVR.js +222 -0
  101. package/dist/typesafe-judgment-check-GGYYV5UF.js +29 -0
  102. package/dist/typesafe-topic-replay-4W73BOLV.js +218 -0
  103. package/dist/typesafe-triage-replay-FGAW7QM7.js +215 -0
  104. package/dist/{update-5DPB4YD4.js → update-7XIOEXTD.js} +4 -3
  105. package/dist/{update-check-BS3DHTSI.js → update-check-2POMBHFB.js} +3 -2
  106. package/dist/update-check.d.ts +1 -1
  107. package/dist/version-help-WZ623NWM.js +10 -0
  108. package/dist/version.d.ts +3 -2
  109. package/dist/webui-client-observability.d.ts +7 -0
  110. package/dist/{webui-server-MRPGTTKL.js → webui-server-L2SICPTB.js} +158 -94
  111. package/dist/webui-server-options.d.ts +11 -0
  112. package/dist/webui-server.d.ts +15 -1
  113. package/dist/wiring/domain-glossary.d.ts +5 -4
  114. package/dist/wiring/plugins.d.ts +1 -1
  115. package/dist/wiring/provider-persisters.d.ts +24 -0
  116. package/dist/wiring/provider-runtime.d.ts +9 -1
  117. package/dist/wiring/runtime-dispatch-state.d.ts +3 -1
  118. package/package.json +28 -28
  119. package/dist/chunk-DR2OXU46.js +0 -174
  120. package/dist/chunk-JACOMTIH.js +0 -275
  121. package/dist/chunk-M4W3QLQW.js +0 -54
  122. package/dist/chunk-XJXDOF63.js +0 -28
  123. package/dist/modeldiag-CJSFHZ3J.js +0 -1356
  124. package/dist/short-circuit-flags-SJQBJ33I.js +0 -10
  125. package/dist/version-help-WXI42PZ3.js +0 -10
@@ -4,17 +4,18 @@ import {
4
4
  loadCachedAcpRegistry,
5
5
  refreshAcpRegistry,
6
6
  setupProvider
7
- } from "./chunk-KEPABQYT.js";
7
+ } from "./chunk-5SEYGOCH.js";
8
8
  import {
9
9
  createHqCommandDispatcher
10
- } from "./chunk-JY52HWL6.js";
10
+ } from "./chunk-2EBVTYJR.js";
11
11
  import {
12
12
  startCliHqConnection
13
- } from "./chunk-CJTBLTS4.js";
14
- import "./chunk-XJXDOF63.js";
13
+ } from "./chunk-BLD5DSVA.js";
14
+ import "./chunk-S4FFHDJG.js";
15
15
  import "./chunk-SIGUWXAA.js";
16
16
  import "./chunk-DAKVBMD4.js";
17
- import "./chunk-DR2OXU46.js";
17
+ import "./chunk-LUMETJFO.js";
18
+ import "./chunk-YBUCXXYZ.js";
18
19
 
19
20
  // src/subcommands/handlers/acp.ts
20
21
  import { randomBytes } from "node:crypto";
@@ -589,6 +590,11 @@ async function loadLive(deps) {
589
590
  }
590
591
  var acpCmd = async (args, deps) => {
591
592
  const sub = args[0];
593
+ const loginIndex = sub === "auth" ? 0 : (sub === "server" || sub === "serve") && args[1] === "auth" ? 1 : -1;
594
+ if (loginIndex >= 0) {
595
+ const { authCmd } = await import("./auth-GRBZ7Y3D.js");
596
+ return authCmd(args.slice(loginIndex + 1), deps);
597
+ }
592
598
  if (!sub || sub === "server" || sub === "serve") {
593
599
  return runACPServer(deps);
594
600
  }
@@ -803,6 +809,12 @@ async function runACPServer(deps) {
803
809
  return runACPWebSocketServer(deps, wsPort);
804
810
  }
805
811
  const echo = deps.flags?.echo === true || deps.flags?.echo === "true";
812
+ if (!echo && (!deps.config.provider || !deps.config.model)) {
813
+ deps.renderer.writeError(
814
+ "No model provider configured. Run `wstack auth` before starting ACP, or use `--echo` for a connectivity test.\n"
815
+ );
816
+ return 1;
817
+ }
806
818
  let stdioHqTelemetry;
807
819
  const server = new WrongStackACPServer(
808
820
  echo ? {} : (() => {
@@ -813,7 +825,6 @@ async function runACPServer(deps) {
813
825
  if (err instanceof AcpServerConfigError) {
814
826
  deps.renderer.writeError(`${err.message}
815
827
  `);
816
- return {};
817
828
  }
818
829
  throw err;
819
830
  }
@@ -1168,4 +1179,4 @@ ${renderAcpBenchText(result)}
1168
1179
  export {
1169
1180
  acpCmd
1170
1181
  };
1171
- //# sourceMappingURL=acp-INCNOH42.js.map
1182
+ //# sourceMappingURL=acp-AJWSKWE5.js.map
@@ -12,6 +12,7 @@ export interface ParsedArgs {
12
12
  export declare function parseArgs(argv: string[]): ParsedArgs;
13
13
  export interface AuthFlags {
14
14
  positional: string[];
15
+ alias?: string | undefined;
15
16
  label?: string | undefined;
16
17
  family?: import('@wrongstack/core/types').WireFamily | undefined;
17
18
  baseUrl?: string | undefined;
@@ -16,22 +16,22 @@ import {
16
16
  runOAuthLoginKind,
17
17
  runOAuthLoginMenu,
18
18
  validateFamily
19
- } from "./chunk-RDHFXOJM.js";
19
+ } from "./chunk-LFMVHT3R.js";
20
20
  import {
21
21
  renderAuthLocalHelpToString,
22
22
  wantsLocalHelp
23
- } from "./chunk-2VMJ3E5Z.js";
24
- import "./chunk-B4JLSXZB.js";
25
- import {
26
- restoreFlags
27
- } from "./chunk-CSAPOCBP.js";
23
+ } from "./chunk-YTEOAWOJ.js";
28
24
  import "./chunk-3VXYY5JC.js";
29
25
  import {
30
26
  activeProfileConfigPath
31
27
  } from "./chunk-YMXXOOFN.js";
28
+ import "./chunk-WSTVGC2C.js";
29
+ import {
30
+ restoreFlags
31
+ } from "./chunk-CSAPOCBP.js";
32
32
  import {
33
33
  parseAuthFlags
34
- } from "./chunk-C3Z4N6A6.js";
34
+ } from "./chunk-MHEBWVXL.js";
35
35
  import "./chunk-SIGUWXAA.js";
36
36
  import "./chunk-DAKVBMD4.js";
37
37
  import {
@@ -41,10 +41,11 @@ import {
41
41
  normalizeKeys,
42
42
  nowIso,
43
43
  writeKeysBack
44
- } from "./chunk-DR2OXU46.js";
44
+ } from "./chunk-LUMETJFO.js";
45
45
 
46
46
  // src/subcommands/handlers/auth.ts
47
47
  import { color as color5 } from "@wrongstack/core/utils";
48
+ import { authProfileAliasError as authProfileAliasError2 } from "@wrongstack/providers";
48
49
 
49
50
  // src/auth-menu/anthropic-oauth.ts
50
51
  import {
@@ -57,16 +58,31 @@ var REDIRECT_PATH = "/callback";
57
58
  var REDIRECT_URI = `http://localhost:${REDIRECT_PORT}${REDIRECT_PATH}`;
58
59
 
59
60
  // src/auth-menu/direct.ts
61
+ import { authProfileAliasError } from "@wrongstack/providers";
60
62
  async function runAuthDirect(deps, opts) {
61
- const { providerId } = opts;
63
+ const sourceId = opts.providerId;
64
+ const providerId = opts.alias?.trim() || sourceId;
65
+ const aliasError = authProfileAliasError(
66
+ opts.alias !== void 0 ? opts.alias.trim() : providerId
67
+ );
68
+ if (aliasError) {
69
+ deps.renderer.writeError(aliasError);
70
+ return 1;
71
+ }
62
72
  const providers = await loadProviders(deps);
63
73
  const existing = providers[providerId];
74
+ if (opts.alias && existing) {
75
+ deps.renderer.writeError(
76
+ `Auth profile "${providerId}" already exists. Choose another alias or manage its keys explicitly.`
77
+ );
78
+ return 1;
79
+ }
64
80
  if (!existing && !opts.family) {
65
81
  let knownFamily;
66
82
  let knownBase;
67
83
  let knownEnv;
68
84
  try {
69
- const k = await deps.modelsRegistry.getProvider(providerId);
85
+ const k = await deps.modelsRegistry.getProvider(sourceId);
70
86
  if (k) {
71
87
  knownFamily = k.family;
72
88
  knownBase = k.apiBase;
@@ -98,8 +114,12 @@ async function runAuthDirect(deps, opts) {
98
114
  deps.profileConfigPath,
99
115
  deps.vault,
100
116
  (all) => {
101
- const p = all[providerId] ?? { type: providerId };
102
- if (!p.type) p.type = providerId;
117
+ if (opts.alias && all[providerId])
118
+ throw new Error(
119
+ `Auth profile "${providerId}" already exists. Choose another alias or manage its keys explicitly.`
120
+ );
121
+ const p = all[providerId] ?? { type: sourceId };
122
+ if (!p.type) p.type = sourceId;
103
123
  if (!p.family && opts.family) p.family = opts.family;
104
124
  if (!p.baseUrl && opts.baseUrl) p.baseUrl = opts.baseUrl;
105
125
  if (!p.envVars && opts.envVars) p.envVars = opts.envVars;
@@ -388,6 +408,7 @@ ${color4.amber("?")} Pick: `)).trim().toLowerCase();
388
408
  var authCmd = async (args, deps) => {
389
409
  args = restoreFlags(args, deps, [
390
410
  "label",
411
+ "alias",
391
412
  "family",
392
413
  "base-url",
393
414
  "env",
@@ -413,6 +434,29 @@ var authCmd = async (args, deps) => {
413
434
  vault: deps.vault,
414
435
  profileConfigPath
415
436
  };
437
+ if (flags.positional[0] !== "local" && (args.includes("--help") || args.includes("-h"))) {
438
+ deps.renderer.write(
439
+ [
440
+ "Usage: wstack auth",
441
+ " wstack auth <provider-type> --alias <account> Create a separately keyed auth profile",
442
+ " wstack auth login <strategy> --alias <account> Sign in to an auth profile",
443
+ " wstack auth <saved-alias> --label <key-label> Add a key inside an existing profile",
444
+ " wstack auth list | status <alias> | remove <alias>",
445
+ "",
446
+ "Fallback targets are <auth-profile-alias>/<model-id>; provider type chooses the transport.",
447
+ "Direct flags: --alias, --label, --family, --base-url, --env",
448
+ ""
449
+ ].join("\n")
450
+ );
451
+ return 0;
452
+ }
453
+ if (flags.alias !== void 0) {
454
+ const invalid = authProfileAliasError2(flags.alias.trim());
455
+ if (invalid) {
456
+ deps.renderer.writeError(invalid);
457
+ return 1;
458
+ }
459
+ }
416
460
  if (flags.positional.length === 0) {
417
461
  return runTopMenu(menuDeps);
418
462
  }
@@ -434,6 +478,7 @@ var authCmd = async (args, deps) => {
434
478
  const modelIdx = args.indexOf("--model") >= 0 ? args.indexOf("--model") : args.indexOf("-m");
435
479
  return runAuthLocal(menuDeps, {
436
480
  name: flags.positional[1] ?? value("name"),
481
+ alias: flags.alias,
437
482
  baseUrl: flags.baseUrl ?? value("base-url"),
438
483
  label: flags.label,
439
484
  skipKey: has("no-key", "skip-key"),
@@ -465,9 +510,9 @@ var authCmd = async (args, deps) => {
465
510
  }
466
511
  if (first === "login") {
467
512
  const pid = (flags.positional[1] ?? "").toLowerCase();
468
- if (!pid) return runOAuthLoginKind(menuDeps, "chatgpt");
513
+ if (!pid) return runOAuthLoginKind(menuDeps, "chatgpt", { providerId: flags.alias });
469
514
  const kind = resolveOAuthKind(pid, { allowNumeric: false, deps: menuDeps });
470
- if (kind) return runOAuthLoginKind(menuDeps, kind);
515
+ if (kind) return runOAuthLoginKind(menuDeps, kind, { providerId: flags.alias });
471
516
  const available = providerAuthStrategiesFor(menuDeps);
472
517
  deps.renderer.writeError(`Unknown OAuth login strategy "${pid}".`);
473
518
  for (const strategy of available) {
@@ -482,6 +527,7 @@ var authCmd = async (args, deps) => {
482
527
  }
483
528
  return runAuthDirect(menuDeps, {
484
529
  providerId: first,
530
+ alias: flags.alias,
485
531
  label: flags.label,
486
532
  family: flags.family,
487
533
  baseUrl: flags.baseUrl,
@@ -625,4 +671,4 @@ async function runAuthRemove(deps, providerId) {
625
671
  export {
626
672
  authCmd
627
673
  };
628
- //# sourceMappingURL=auth-YXK3EDUL.js.map
674
+ //# sourceMappingURL=auth-GRBZ7Y3D.js.map
@@ -7,6 +7,7 @@ import type { AuthMenuDeps } from './types.js';
7
7
  */
8
8
  export declare function runAuthDirect(deps: AuthMenuDeps, opts: {
9
9
  providerId: string;
10
+ alias?: string | undefined;
10
11
  label?: string | undefined;
11
12
  family?: WireFamily | undefined;
12
13
  baseUrl?: string | undefined;
@@ -34,6 +34,8 @@ import { suggestLabel } from './shared.js';
34
34
  import type { AuthMenuDeps } from './types.js';
35
35
  export { LOCAL_LLM_PRESETS, type ProbeOptions, type ProbeResult, probeLocalLlm };
36
36
  export interface RunAuthLocalOptions {
37
+ /** Create a separately routed auth profile for this local provider preset. */
38
+ alias?: string | undefined;
37
39
  /**
38
40
  * Direct pick: skip the interactive menu and configure this preset.
39
41
  * `wstack auth local --name ollama` maps to `{ name: 'ollama' }`.
@@ -17,7 +17,9 @@ export declare function runOAuthLoginChoice(deps: AuthMenuDeps, choice: string,
17
17
  allowNumeric?: boolean;
18
18
  }): Promise<boolean>;
19
19
  /** Run the OAuth login flow for an already-resolved kind. */
20
- export declare function runOAuthLoginKind(deps: AuthMenuDeps, kind: OAuthMenuKind): Promise<number>;
20
+ export declare function runOAuthLoginKind(deps: AuthMenuDeps, kind: OAuthMenuKind, opts?: {
21
+ providerId?: string | undefined;
22
+ }): Promise<number>;
21
23
  /** Sub-menu: pick a subscription to sign in with (OAuth). */
22
24
  export declare function runOAuthLoginMenu(deps: AuthMenuDeps): Promise<void>;
23
25
  //# sourceMappingURL=oauth-menu.d.ts.map
@@ -1,3 +1,23 @@
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
+ */
1
21
  import type { ModelsRegistry, SecretScrubber, SecretVault } from '@wrongstack/core/types';
2
22
  import type { AuthPanelHost } from '@wrongstack/tui';
3
23
  import type { AuthMenuDeps } from './types.js';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CLI_VERSION
3
- } from "./chunk-XJXDOF63.js";
3
+ } from "./chunk-YBUCXXYZ.js";
4
4
 
5
5
  // src/subcommands/handlers/bench.ts
6
6
  import * as fs from "node:fs/promises";
@@ -414,4 +414,4 @@ async function benchList(_args, deps) {
414
414
  export {
415
415
  benchCmd
416
416
  };
417
- //# sourceMappingURL=bench-YBU6BVQP.js.map
417
+ //# sourceMappingURL=bench-N5K7Z5O3.js.map
@@ -18,11 +18,12 @@ export declare function defaultProfileProvidersAreEmpty(profilePath: string): Pr
18
18
  * providers. Profile config history uses names such as
19
19
  * `profiles-default-config-2026-07-19T12-34-56-789.json`.
20
20
  */
21
- export declare function findLatestProviderBackup(globalRoot: string): Promise<ProviderConfigBackup | undefined>;
21
+ export declare function findLatestProviderBackup(globalRoot: string, profileName?: string): Promise<ProviderConfigBackup | undefined>;
22
22
  /** Prompt once during an ordinary interactive boot. Enter accepts recovery. */
23
23
  export declare function maybeRestoreDefaultProfileFromBackup(opts: {
24
24
  globalRoot: string;
25
25
  profilePath: string;
26
+ profileName?: string | undefined;
26
27
  renderer: TerminalRenderer;
27
28
  reader: ReadlineInputReader;
28
29
  }): Promise<boolean>;
@@ -88,6 +88,17 @@ export interface WebUIDispatchContext {
88
88
  role?: string | undefined;
89
89
  skills?: string[] | undefined;
90
90
  tools?: string[] | undefined;
91
+ signal?: AbortSignal | undefined;
92
+ context?: {
93
+ sessionId?: string;
94
+ kanban?: {
95
+ boardId?: string;
96
+ taskId?: string;
97
+ projectRoot?: string;
98
+ leaseId?: string;
99
+ managementToken?: string;
100
+ };
101
+ } | undefined;
91
102
  name?: string | undefined;
92
103
  allowedCapabilities?: readonly string[] | undefined;
93
104
  onDone?: ((result: {
@@ -1,3 +1,4 @@
1
+ export declare function desktopExecutableCandidates(platform: string, home: string, env: NodeJS.ProcessEnv): string[];
1
2
  export declare function stripDesktopLauncherArgs(argv: string[]): string[];
2
3
  export declare function selectDesktopLauncherExecutable(execPath: string, runningUnderBun: boolean, nodeOverride?: string): string;
3
4
  export declare function handleDesktopShortCircuit(flags: Record<string, string | boolean>, argv: string[]): Promise<number | null>;
@@ -26,5 +26,5 @@ export declare function getProjectPickerItems(ctx: ProjectPickerContext): Promis
26
26
  * per-project session writer, rebuilt system prompt, and no spawned
27
27
  * replacement process.
28
28
  */
29
- export declare function onProjectSelect(ctx: ProjectPickerContext, slug: string, kind: 'project' | 'action'): Promise<void>;
29
+ export declare function onProjectSelect(ctx: ProjectPickerContext, slug: string, kind: 'project' | 'action'): Promise<string | null>;
30
30
  //# sourceMappingURL=tui-project-picker-callback.d.ts.map
@@ -1,9 +1,22 @@
1
- import type { ConfigStore, FleetChatVerbosity } from '@wrongstack/core/types';
2
- import { type WstackPaths } from '@wrongstack/core/utils';
1
+ /**
2
+ * TUI Settings adapter — extracted from the runTui() options literal.
3
+ *
4
+ * Phase C step 1. The getSettings/saveSettings pair (~337 lines) reads
5
+ * config from the ConfigStore and persists changes to disk. This module
6
+ * owns both functions, receiving its dependencies through a typed context.
7
+ *
8
+ * `getSettings()` maps the full Config into the flat LiveSettingsInput
9
+ * shape the TUI SettingsPicker consumes. `saveSettings()` does the
10
+ * reverse: read → modify → encrypt → atomic-write for every section,
11
+ * then syncs the in-memory store and applies live runtime effects.
12
+ */
13
+ import type { ConfigStore, FleetChatVerbosity, SecretVault } from '@wrongstack/core/types';
14
+ import type { WstackPaths } from '@wrongstack/core/utils';
3
15
  import type { LiveSettingsInput } from '../live-settings-input.js';
4
16
  interface SettingsAdapterContext {
5
17
  configStore: ConfigStore;
6
18
  wpaths: WstackPaths;
19
+ vault: SecretVault;
7
20
  fleetStreamController: {
8
21
  setMode?: ((mode: FleetChatVerbosity) => void) | undefined;
9
22
  } | undefined;
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  persistConfigSetting
3
- } from "./chunk-JACOMTIH.js";
3
+ } from "./chunk-SFBFYIOW.js";
4
4
  import {
5
5
  activeProfileConfigPath
6
6
  } from "./chunk-YMXXOOFN.js";
7
+ import "./chunk-WSTVGC2C.js";
7
8
 
8
9
  // src/boot/boot-auto-thin.ts
9
10
  import {
@@ -98,4 +99,4 @@ async function runBootAutoThin(deps) {
98
99
  export {
99
100
  runBootAutoThin
100
101
  };
101
- //# sourceMappingURL=boot-auto-thin-MANHOYHE.js.map
102
+ //# sourceMappingURL=boot-auto-thin-6Q56FY3F.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  API_VERSION,
3
3
  CLI_VERSION
4
- } from "./chunk-XJXDOF63.js";
4
+ } from "./chunk-YBUCXXYZ.js";
5
5
 
6
6
  // src/subcommands/handlers/version-help.ts
7
7
  import * as os from "node:os";
@@ -37,6 +37,8 @@ var helpCmd = async (_args, deps) => {
37
37
  " wstack config [show|edit] Show or edit effective config",
38
38
  " wstack tools List registered tools",
39
39
  " wstack skills List discovered skills",
40
+ " wstack typesafe TypeSafe account: status, login, test, lint-conventions",
41
+ " wstack skill-suggest Preview/tune the TypeSafe skill suggester",
40
42
  " wstack providers [--all] List providers from models.dev",
41
43
  " wstack models [<provider>] List models",
42
44
  " wstack models refresh Force-refresh cache",
@@ -93,4 +95,4 @@ export {
93
95
  versionCmd,
94
96
  helpCmd
95
97
  };
96
- //# sourceMappingURL=chunk-6WRKAACA.js.map
98
+ //# sourceMappingURL=chunk-2BKFWIER.js.map
@@ -246,7 +246,7 @@ async function dispatch(controller, commandId, type, payload) {
246
246
  }
247
247
  const toolUseId = typeof payload["toolUseId"] === "string" ? payload["toolUseId"] : "";
248
248
  const decision = payload["decision"];
249
- if (toolUseId.length === 0 || decision !== "yes" && decision !== "no" && decision !== "always" && decision !== "deny") {
249
+ if (toolUseId.length === 0 || decision !== "yes" && decision !== "no" && decision !== "always" && decision !== "always-exact" && decision !== "always-command" && decision !== "always-tool" && decision !== "deny") {
250
250
  return { commandId, status: "rejected", message: "malformed approve command" };
251
251
  }
252
252
  const applied = resolveApproval(toolUseId, decision, sessionId);
@@ -320,4 +320,4 @@ export {
320
320
  createProjectKanbanAssignHandler,
321
321
  createHqCommandDispatcher
322
322
  };
323
- //# sourceMappingURL=chunk-JY52HWL6.js.map
323
+ //# sourceMappingURL=chunk-2EBVTYJR.js.map
@@ -0,0 +1,46 @@
1
+ import {
2
+ activeProfileConfigPath
3
+ } from "./chunk-YMXXOOFN.js";
4
+ import {
5
+ mutateConfigProviders
6
+ } from "./chunk-LUMETJFO.js";
7
+
8
+ // src/wiring/provider-persisters.ts
9
+ import {
10
+ applyProviderOAuthRefresh,
11
+ matchesActiveProviderCredential,
12
+ setOAuthTokenPersister,
13
+ setProviderModelPersister
14
+ } from "@wrongstack/providers";
15
+ import { applyProviderOAuthRefresh as applyProviderOAuthRefresh2 } from "@wrongstack/providers";
16
+ function installProviderPersisters(args) {
17
+ const profileConfigPath = activeProfileConfigPath(args.paths, args.config);
18
+ setOAuthTokenPersister((providerId, creds, source) => {
19
+ void mutateConfigProviders(profileConfigPath, args.vault, (all) => {
20
+ const p = all[providerId];
21
+ if (!p) return;
22
+ applyProviderOAuthRefresh(p, creds, source);
23
+ }).catch(
24
+ () => args.logger?.warn(
25
+ `OAuth token refresh for "${providerId}" could not be saved. Sign-in may be required next session.`
26
+ )
27
+ );
28
+ });
29
+ setProviderModelPersister((providerId, models, source) => {
30
+ if (models.length === 0) return;
31
+ void mutateConfigProviders(profileConfigPath, args.vault, (all) => {
32
+ const p = all[providerId];
33
+ if (!p) return;
34
+ if (source && !matchesActiveProviderCredential(p, source)) return;
35
+ const live = models.map((m) => m.id);
36
+ if (p.models?.length === live.length && p.models.every((id, i) => id === live[i])) return;
37
+ p.models = live;
38
+ }).catch(() => args.logger?.warn(`Model discovery for "${providerId}" could not be saved.`));
39
+ });
40
+ }
41
+
42
+ export {
43
+ installProviderPersisters,
44
+ applyProviderOAuthRefresh2 as applyProviderOAuthRefresh
45
+ };
46
+ //# sourceMappingURL=chunk-3OCUS3VN.js.map
@@ -0,0 +1,56 @@
1
+
2
+ // src/subcommands/index.ts
3
+ var loaders = {
4
+ acp: async () => (await import("./acp-AJWSKWE5.js")).acpCmd,
5
+ init: async () => (await import("./init-DRMMFG2G.js")).initCmd,
6
+ auth: async () => (await import("./auth-GRBZ7Y3D.js")).authCmd,
7
+ update: async () => (await import("./update-7XIOEXTD.js")).updateCmd,
8
+ sessions: async () => (await import("./sessions-config-IQUH2GXT.js")).sessionsCmd,
9
+ config: async () => (await import("./sessions-config-IQUH2GXT.js")).configCmd,
10
+ "config-export": async () => (await import("./config-transfer-RUWLDCNK.js")).configExportCmd,
11
+ "config-import": async () => (await import("./config-transfer-RUWLDCNK.js")).configImportCmd,
12
+ rewind: async () => (await import("./rewind-JA3ZLCNM.js")).rewindCmd,
13
+ replay: async () => (await import("./replay-JJ2NOWD6.js")).replayCmd,
14
+ audit: async () => (await import("./audit-46YK5DSC.js")).auditCmd,
15
+ tools: async () => (await import("./tools-skills-GH24UCBY.js")).toolsCmd,
16
+ skills: async () => (await import("./tools-skills-GH24UCBY.js")).skillsCmd,
17
+ "skill-suggest": async () => (await import("./skill-suggest-L2EVWB6R.js")).skillSuggestCmd,
18
+ typesafe: async () => (await import("./typesafe-HVEVPA6R.js")).typesafeCmd,
19
+ providers: async () => (await import("./providers-models-2CFG46RD.js")).providersCmd,
20
+ models: async () => (await import("./providers-models-2CFG46RD.js")).modelsCmd,
21
+ mcp: async () => (await import("./mcp-LBS45HWZ.js")).mcpCmd,
22
+ plugin: async () => (await import("./plugin-usage-S5LVGMBW.js")).pluginCmd,
23
+ plugins: async () => (await import("./plugin-usage-S5LVGMBW.js")).pluginCmd,
24
+ diag: async () => (await import("./diag-doctor-WIFJH3XH.js")).diagCmd,
25
+ doctor: async () => (await import("./diag-doctor-WIFJH3XH.js")).doctorCmd,
26
+ "proxy-status": async () => (await import("./diag-doctor-WIFJH3XH.js")).proxyCmd,
27
+ export: async () => (await import("./export-VVRIOWFV.js")).exportCmd,
28
+ usage: async () => (await import("./plugin-usage-S5LVGMBW.js")).usageCmd,
29
+ version: async () => (await import("./version-help-WZ623NWM.js")).versionCmd,
30
+ help: async () => (await import("./version-help-WZ623NWM.js")).helpCmd,
31
+ projects: async () => (await import("./projects-LMNAGGEU.js")).projectsCmd,
32
+ modeldiag: async () => (await import("./modeldiag-36OGAL5C.js")).modeldiagCmd,
33
+ quick: async () => (await import("./quick-CNB4Z3HS.js")).quickCmd,
34
+ bench: async () => (await import("./bench-N5K7Z5O3.js")).benchCmd,
35
+ chronicle: async () => (await import("./chronicle-UTFETHP6.js")).chronicleCmd,
36
+ hq: async () => (await import("./hq-JTUTFI4L.js")).hqCmd,
37
+ mailbox: async () => (await import("./mailbox-serve-WDOCH6KR.js")).mailboxServeCmd,
38
+ permissions: async () => (await import("./permissions-CFDLXETM.js")).permissionsCmd,
39
+ project: async () => (await import("./project-AOQI5XTK.js")).projectCmd,
40
+ governance: async () => (await import("./governance-RYSHV675.js")).governanceCmd
41
+ };
42
+ var subcommands = Object.fromEntries(
43
+ Object.entries(loaders).map(
44
+ ([name, load]) => [
45
+ name,
46
+ async (args, deps) => (await load())(args, deps)
47
+ ]
48
+ )
49
+ );
50
+ var subcommandNames = Object.keys(loaders);
51
+
52
+ export {
53
+ subcommands,
54
+ subcommandNames
55
+ };
56
+ //# sourceMappingURL=chunk-424ORSE7.js.map
@@ -1,3 +1,6 @@
1
+ import {
2
+ resolveProviderCfgWithProxy
3
+ } from "./chunk-S4FFHDJG.js";
1
4
  import {
2
5
  fallbackCodexProviderModels,
3
6
  filterCurrentCodexModelIds,
@@ -140,83 +143,6 @@ async function refreshAcpRegistry(paths, opts) {
140
143
  return { count: result.agents.length, location, fetchedAt: result.fetchedAt };
141
144
  }
142
145
 
143
- // src/wiring/provider-runtime.ts
144
- import { makeProviderFromConfig } from "@wrongstack/providers";
145
- import {
146
- getProxyConfig,
147
- isProxyEligible,
148
- rewriteBaseUrl,
149
- sanitizeUrlForLog,
150
- shouldRewriteFor
151
- } from "@wrongstack/core/wiring/proxy-rewrite";
152
- function resolveProviderCfg(config, providerId, opts) {
153
- const savedCfg = config.providers?.[providerId];
154
- const rawBaseUrl = savedCfg?.baseUrl ?? config.baseUrl;
155
- let rewriteReason = "no-base-url";
156
- let baseUrl = rawBaseUrl;
157
- if (rawBaseUrl && shouldRewriteFor(providerId)) {
158
- const rewritten = rewriteBaseUrl(rawBaseUrl, currentProxyBaseUrl());
159
- if (rewritten !== rawBaseUrl) {
160
- rewriteReason = "applied";
161
- baseUrl = rewritten;
162
- } else {
163
- rewriteReason = passthroughReason(rawBaseUrl);
164
- }
165
- } else if (rawBaseUrl) {
166
- rewriteReason = proxySkipReason(providerId);
167
- }
168
- opts?.logger?.info(
169
- `WrongProxy rewrite ${rewriteReason} for provider '${providerId}': ${sanitizeUrlForLog(rawBaseUrl) || "<none>"} -> ${sanitizeUrlForLog(baseUrl) || "<none>"}`
170
- );
171
- const cfg = {
172
- ...savedCfg,
173
- apiKey: savedCfg?.apiKey ?? config.apiKey,
174
- baseUrl,
175
- type: providerId
176
- };
177
- const factoryType = savedCfg?.type ?? providerId;
178
- return { cfg, factoryType };
179
- }
180
- function passthroughReason(rawBaseUrl) {
181
- if (!rawBaseUrl.includes("://")) return "no-scheme";
182
- const proxyRoot = currentProxyBaseUrl().replace(/\/+$/, "");
183
- if (proxyRoot && rawBaseUrl.startsWith(`${proxyRoot}/proxy/`)) {
184
- return "already-rewritten";
185
- }
186
- try {
187
- const parsed = new URL(rawBaseUrl);
188
- const host = parsed.hostname;
189
- const isLoopback = host === "localhost" || host === "127.0.0.1" || host === "[::1]";
190
- if (isLoopback && parsed.port !== "") return "loopback";
191
- } catch {
192
- }
193
- return "ineligible";
194
- }
195
- function proxySkipReason(providerId) {
196
- const cfg = getProxyConfig();
197
- if (!cfg.enabled) return "disabled";
198
- if (!cfg.url) return "no-proxy-url";
199
- if (!cfg.active) return "inactive";
200
- if (!isProxyEligible(providerId)) return "excluded";
201
- return "unknown";
202
- }
203
- function currentProxyBaseUrl() {
204
- return getProxyConfig().url;
205
- }
206
- function resolveProviderCfgWithProxy(config, providerId, opts) {
207
- return resolveProviderCfg(config, providerId, opts);
208
- }
209
- function buildProviderForId(args, providerId) {
210
- const { cfg, factoryType } = resolveProviderCfg(args.config, providerId, {
211
- logger: args.logger
212
- });
213
- const useRegistry = !!args.config.features.modelsRegistry && args.providerRegistry.has(factoryType);
214
- return useRegistry ? args.providerRegistry.create(cfg, factoryType) : makeProviderFromConfig(
215
- providerId,
216
- factoryType === "ai-gateway" ? { ...cfg, type: factoryType } : cfg
217
- );
218
- }
219
-
220
146
  // src/shutdown-cleanup.ts
221
147
  function createGracefulShutdown(cleanup) {
222
148
  const exitCode = cleanup.exitCode ?? 0;
@@ -269,7 +195,8 @@ import {
269
195
  createSetupProviderFactory,
270
196
  installCatalogModelOutputLimits,
271
197
  isSetupProvider,
272
- makeProviderFromConfig as makeProviderFromConfig2,
198
+ makeProviderFromConfig,
199
+ setStreamTimeoutDefaults,
273
200
  setupProviderResolved,
274
201
  withCatalogCapabilities
275
202
  } from "@wrongstack/providers";
@@ -339,6 +266,7 @@ async function setupProvider(params) {
339
266
  context: { provider: config.provider, family: resolvedProvider.npm, kind: "unsupported" }
340
267
  });
341
268
  }
269
+ setStreamTimeoutDefaults(config.modelRuntime?.streaming);
342
270
  if (config.features.modelsRegistry) {
343
271
  await installCatalogModelOutputLimits({
344
272
  registry: modelsRegistry,
@@ -379,7 +307,7 @@ Try \`wstack models refresh\` once you have network access.`,
379
307
  if (providerRegistry.has(factoryType)) {
380
308
  provider = providerRegistry.create(cfgWithType, factoryType);
381
309
  } else {
382
- provider = makeProviderFromConfig2(config.provider, { ...cfgWithType, type: factoryType });
310
+ provider = makeProviderFromConfig(config.provider, { ...cfgWithType, type: factoryType });
383
311
  }
384
312
  } catch (err) {
385
313
  throw new ConfigError({
@@ -405,9 +333,7 @@ export {
405
333
  formatAcpAgentList,
406
334
  loadCachedAcpRegistry,
407
335
  refreshAcpRegistry,
408
- resolveProviderCfg,
409
- buildProviderForId,
410
336
  setupProvider,
411
337
  createGracefulShutdown
412
338
  };
413
- //# sourceMappingURL=chunk-KEPABQYT.js.map
339
+ //# sourceMappingURL=chunk-5SEYGOCH.js.map