@wrongstack/cli 0.299.0 → 0.301.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/{acp-S4LZQB66.js → acp-DATHHPNT.js} +36 -17
  2. package/dist/acp-server-agent.d.ts +1 -1
  3. package/dist/{audit-2ZSFGNIF.js → audit-QRCLEHHW.js} +5 -1
  4. package/dist/{auth-G5YKKSRH.js → auth-JASC4K3F.js} +151 -38
  5. package/dist/auth-menu/loopback-server.d.ts +41 -55
  6. package/dist/auth-menu/openai-codex-oauth.d.ts +36 -123
  7. package/dist/auto-discover-providers-DRW4OZHG.js +8 -0
  8. package/dist/boot/dispatch-webui.d.ts +3 -0
  9. package/dist/boot/launch-menu.d.ts +2 -4
  10. package/dist/boot/tool-registry.d.ts +3 -0
  11. package/dist/chimera-reviewer-policy.d.ts +10 -3
  12. package/dist/chimera-work-registry.d.ts +19 -0
  13. package/dist/{chronicle-QQEQFSSE.js → chronicle-63MFCZN6.js} +26 -5
  14. package/dist/{chunk-YWUPHRGB.js → chunk-263G3FMB.js} +33 -10
  15. package/dist/{chunk-2SLSUDYS.js → chunk-2KDOFTTM.js} +312 -211
  16. package/dist/{chunk-TGDHN4LM.js → chunk-4GVH7V3S.js} +4 -24
  17. package/dist/chunk-CSAPOCBP.js +24 -0
  18. package/dist/{chunk-66T43Q4Y.js → chunk-ETOEGL3V.js} +6 -9
  19. package/dist/{chunk-PEKUKUCH.js → chunk-GUHQQG63.js} +32 -14
  20. package/dist/chunk-KE7E7DPX.js +38 -0
  21. package/dist/{chunk-ZNZJ34RF.js → chunk-MHF2IJDE.js} +21 -4
  22. package/dist/{chunk-4HH3YGG4.js → chunk-MRLYDHQ7.js} +8 -5
  23. package/dist/{chunk-L5CE52XW.js → chunk-O7XNGCRT.js} +317 -309
  24. package/dist/chunk-PYTFS4MC.js +238 -0
  25. package/dist/{chunk-DPJZQCVP.js → chunk-YMXXOOFN.js} +1 -1
  26. package/dist/{chunk-4U3DMA2Y.js → chunk-ZECLGUTF.js} +28 -21
  27. package/dist/{cli-main-3MQDFSYK.js → cli-main-XWC57MGE.js} +849 -242
  28. package/dist/{execution-ANOYMWPO.js → execution-LHMSMDHB.js} +174 -55
  29. package/dist/execution-chimera-cascade.d.ts +3 -4
  30. package/dist/execution-chimera-review.d.ts +2 -3
  31. package/dist/execution-cleanup.d.ts +3 -2
  32. package/dist/execution.d.ts +1 -1
  33. package/dist/{export-TPORYVRZ.js → export-DOBGPY23.js} +12 -1
  34. package/dist/fleet/budget-source.d.ts +18 -0
  35. package/dist/fleet/host-context.d.ts +1 -1
  36. package/dist/fleet/host-helpers.d.ts +14 -0
  37. package/dist/fleet/host-status.d.ts +31 -0
  38. package/dist/fleet/host-types.d.ts +8 -0
  39. package/dist/fleet/host.d.ts +5 -0
  40. package/dist/fleet/status-broadcast.d.ts +1 -1
  41. package/dist/{hq-BDO56CX6.js → hq-LN5CJHCM.js} +22 -3
  42. package/dist/hq-server/auth-state.d.ts +29 -1
  43. package/dist/hq-server/auth.d.ts +16 -0
  44. package/dist/hq-server/client-address.d.ts +56 -0
  45. package/dist/hq-server/login-attempt-store.d.ts +30 -10
  46. package/dist/hq-server/routes/auth-handlers.d.ts +66 -26
  47. package/dist/hq-server/routes.d.ts +23 -1
  48. package/dist/hq-server/types.d.ts +10 -0
  49. package/dist/hq-server/ws.d.ts +17 -6
  50. package/dist/{hq-server-RJLJJZU7.js → hq-server-S7HZG3PA.js} +3 -2
  51. package/dist/hq-server.d.ts +19 -0
  52. package/dist/index.js +69 -104
  53. package/dist/live-settings-input.d.ts +5 -0
  54. package/dist/{mcp-CYLPUEHC.js → mcp-OHPJH73U.js} +6 -2
  55. package/dist/{modeldiag-HENYJ4N7.js → modeldiag-3DOK4BWW.js} +3 -3
  56. package/dist/{plugin-usage-VTL7ZTVC.js → plugin-usage-YEVLOR33.js} +7 -3
  57. package/dist/{plugins-ETY6W3DC.js → plugins-K3BAUP4D.js} +3 -3
  58. package/dist/profile-config-path.d.ts +0 -2
  59. package/dist/provider-helpers.d.ts +0 -5
  60. package/dist/{providers-models-GDELBHZK.js → providers-models-WEZ4EGLL.js} +38 -12
  61. package/dist/{replay-KCTXNMZQ.js → replay-FCBNHW3K.js} +5 -1
  62. package/dist/{rewind-EJMVFVLS.js → rewind-AOD3JIYX.js} +5 -1
  63. package/dist/{sessions-config-NLCMK3BY.js → sessions-config-XXN7267N.js} +8 -3
  64. package/dist/slash-commands/command-context.d.ts +19 -0
  65. package/dist/subcommands/flags.d.ts +23 -0
  66. package/dist/terminal-format.d.ts +15 -0
  67. package/dist/webui-server/setup-events.d.ts +17 -0
  68. package/dist/webui-server/terminal-log-view.d.ts +29 -12
  69. package/dist/{webui-server-PCLSXX6L.js → webui-server-DD35QFNO.js} +113 -50
  70. package/dist/webui-server-options.d.ts +16 -0
  71. package/dist/wiring/brain-and-orchestration.d.ts +4 -1
  72. package/dist/wiring/director-setup.d.ts +4 -0
  73. package/dist/wiring/fallback-gate.d.ts +31 -0
  74. package/dist/wiring/fleet-command-handlers.d.ts +1 -1
  75. package/dist/wiring/mailbox-bridge-bootstrap.d.ts +3 -1
  76. package/dist/wiring/management-tools.d.ts +9 -1
  77. package/dist/wiring/pipeline.d.ts +5 -5
  78. package/dist/wiring/plugins.d.ts +3 -10
  79. package/dist/wiring/provider-utility-tools.d.ts +27 -1
  80. package/dist/wiring/tools.d.ts +4 -5
  81. package/package.json +23 -23
  82. package/dist/chunk-GO3TJICK.js +0 -489
@@ -2,26 +2,7 @@
2
2
  // src/boot/auto-discover-providers.ts
3
3
  import * as fs from "node:fs/promises";
4
4
  import * as path from "node:path";
5
- import { COMPATIBLE_PRESETS, discoverOpenAICompatibleModels } from "@wrongstack/providers";
6
- function resolveKey(cfg) {
7
- if (Array.isArray(cfg.apiKeys) && cfg.apiKeys.length > 0) {
8
- const active = cfg.activeKey ? cfg.apiKeys.find((k) => k.label === cfg.activeKey) : void 0;
9
- return (active ?? cfg.apiKeys[0])?.apiKey;
10
- }
11
- return cfg.apiKey && cfg.apiKey.length > 0 ? cfg.apiKey : void 0;
12
- }
13
- function eligibleProviders(config) {
14
- const out = [];
15
- for (const [id, cfg] of Object.entries(config.providers ?? {})) {
16
- const preset = COMPATIBLE_PRESETS[id];
17
- const enabled = cfg.autoDiscoverModels ?? preset?.autoDiscover ?? false;
18
- if (!enabled) continue;
19
- const baseUrl = cfg.baseUrl ?? preset?.defaultBaseUrl;
20
- if (!baseUrl) continue;
21
- out.push({ id, cfg, baseUrl, apiKey: resolveKey(cfg) });
22
- }
23
- return out;
24
- }
5
+ import { discoverOpenAICompatibleModels, resolveDiscoveryTargets } from "@wrongstack/providers";
25
6
  async function readCache(file) {
26
7
  try {
27
8
  return JSON.parse(await fs.readFile(file, "utf8"));
@@ -30,14 +11,13 @@ async function readCache(file) {
30
11
  }
31
12
  }
32
13
  async function discoverAndMergeProviders(opts) {
33
- const targets = eligibleProviders(opts.config);
14
+ const targets = resolveDiscoveryTargets(opts.config);
34
15
  if (targets.length === 0) return;
35
16
  const cacheFile = path.join(opts.cacheDir, "discovered-models-cache.json");
36
17
  const cache = await readCache(cacheFile);
37
18
  let cacheDirty = false;
38
19
  await Promise.all(
39
- targets.map(async ({ id, cfg, baseUrl, apiKey }) => {
40
- const cacheKey = `${id}\0${baseUrl}`;
20
+ targets.map(async ({ id, cfg, baseUrl, apiKey, cacheKey }) => {
41
21
  const provider = await discoverOpenAICompatibleModels(id, {
42
22
  baseUrl,
43
23
  apiKey,
@@ -78,4 +58,4 @@ async function discoverAndMergeProviders(opts) {
78
58
  export {
79
59
  discoverAndMergeProviders
80
60
  };
81
- //# sourceMappingURL=chunk-TGDHN4LM.js.map
61
+ //# sourceMappingURL=chunk-4GVH7V3S.js.map
@@ -0,0 +1,24 @@
1
+
2
+ // src/subcommands/flags.ts
3
+ function restoreFlags(args, deps, names) {
4
+ const flags = deps.flags;
5
+ if (!flags) return args;
6
+ const alreadyPresent = new Set(
7
+ args.filter((a) => a.startsWith("-")).map((a) => a.replace(/^-+/, "").split("=")[0]).filter((a) => a !== void 0 && a.length > 0)
8
+ );
9
+ const restored = [];
10
+ for (const name of names) {
11
+ if (alreadyPresent.has(name)) continue;
12
+ const value = flags[name];
13
+ if (value === void 0 || value === false) continue;
14
+ const token = name.length === 1 ? `-${name}` : `--${name}`;
15
+ if (value === true) restored.push(token);
16
+ else restored.push(token, value);
17
+ }
18
+ return restored.length > 0 ? [...args, ...restored] : args;
19
+ }
20
+
21
+ export {
22
+ restoreFlags
23
+ };
24
+ //# sourceMappingURL=chunk-CSAPOCBP.js.map
@@ -1,5 +1,7 @@
1
1
 
2
2
  // src/provider-helpers.ts
3
+ import { hasProviderCredential } from "@wrongstack/core/models";
4
+ import { catalogProviderIdFor } from "@wrongstack/providers";
3
5
  function uniqueModelIds(primary, fallback) {
4
6
  const seen = /* @__PURE__ */ new Set();
5
7
  const out = [];
@@ -33,12 +35,7 @@ function isKeylessLocalProvider(provider) {
33
35
  return isLoopbackUrl(provider.apiBase);
34
36
  }
35
37
  function hasApiKey(provider, config) {
36
- if (provider.envVars.some((v) => !!process.env[v])) return true;
37
- const entry = config?.providers?.[provider.id];
38
- if (!entry) return false;
39
- if (typeof entry.apiKey === "string" && entry.apiKey.length > 0) return true;
40
- if (Array.isArray(entry.apiKeys) && entry.apiKeys.some((k) => k?.apiKey)) return true;
41
- return false;
38
+ return hasProviderCredential(provider, config);
42
39
  }
43
40
  async function buildPickableProviders(modelsRegistry, config) {
44
41
  const overlay = config.providers ?? {};
@@ -65,8 +62,8 @@ async function buildPickableProviders(modelsRegistry, config) {
65
62
  for (const [id, cfg] of Object.entries(overlay)) {
66
63
  if (!isSelectable(id)) continue;
67
64
  seen.add(id);
68
- const catalogType = cfg.type && cfg.type !== id ? cfg.type : id;
69
- const inherited = catalogById.get(catalogType);
65
+ const catalogType = catalogProviderIdFor(id, cfg.type);
66
+ const inherited = catalogById.get(catalogType) ?? catalogById.get(cfg.type ?? id);
70
67
  const family = cfg.family ?? inherited?.family ?? "unsupported";
71
68
  if (family === "unsupported") continue;
72
69
  const models = visibleModelIds(id, config, (inherited?.models ?? []).map((m) => m.id), cfg);
@@ -87,4 +84,4 @@ export {
87
84
  hasApiKey,
88
85
  buildPickableProviders
89
86
  };
90
- //# sourceMappingURL=chunk-66T43Q4Y.js.map
87
+ //# sourceMappingURL=chunk-ETOEGL3V.js.map
@@ -2,6 +2,9 @@
2
2
  // src/plugin-management.ts
3
3
  import * as fs from "node:fs/promises";
4
4
  import { atomicWrite } from "@wrongstack/core/utils";
5
+ import {
6
+ resolvePluginEnablement
7
+ } from "@wrongstack/core/plugin";
5
8
  import {
6
9
  PLUGIN_AUDIT_ENTRIES
7
10
  } from "@wrongstack/plugins/plugin-audit-catalog";
@@ -311,6 +314,7 @@ function renderPluginAuditReport(config) {
311
314
  const lines = [
312
315
  "Plugin audit report:",
313
316
  " State shows the effective boot state. Default-active plugins run unless disabled in config.",
317
+ " Source: config = plugins[] entry, ext = extensions.<name>.enabled, feature = features.plugins.",
314
318
  " Built-in audit rows are toggleable unless a future row explicitly marks itself locked.",
315
319
  "",
316
320
  " Built-in audit entries:"
@@ -359,19 +363,22 @@ function pluginMatchesToggleSpec(p, spec) {
359
363
  if (spec === "telegram") return name === "telegram" || name === "@wrongstack/telegram";
360
364
  return name === spec;
361
365
  }
366
+ var AUDIT_STATE_SOURCE_LABEL = {
367
+ "feature-flag": "feature",
368
+ "plugin-entry": "config",
369
+ extension: "ext",
370
+ default: "default"
371
+ };
362
372
  function effectiveAuditState(config, entry) {
363
- const configured = (config.plugins ?? []).find(
364
- (plugin) => pluginMatchesToggleSpec(plugin, entry.name)
365
- );
366
- if (configured) {
367
- return {
368
- state: typeof configured === "object" && configured.enabled === false ? "disabled" : "enabled",
369
- source: "config"
370
- };
371
- }
373
+ const { enabled, source } = resolvePluginEnablement({
374
+ name: entry.name,
375
+ defaultState: entry.defaultState,
376
+ config,
377
+ matches: (spec) => pluginMatchesToggleSpec(spec, entry.name)
378
+ });
372
379
  return {
373
- state: entry.defaultState === "active" ? "enabled" : "disabled",
374
- source: "default"
380
+ state: enabled ? "enabled" : "disabled",
381
+ source: AUDIT_STATE_SOURCE_LABEL[source]
375
382
  };
376
383
  }
377
384
  function lockedReason(entry) {
@@ -387,7 +394,12 @@ function auditEntryFor(spec) {
387
394
  function officialPluginState(config, spec) {
388
395
  const match = (config.plugins ?? []).find((p) => pluginName(p) === spec);
389
396
  if (!match) return "not configured";
390
- return typeof match === "object" && match.enabled === false ? "disabled" : "enabled";
397
+ const { enabled } = resolvePluginEnablement({
398
+ name: spec,
399
+ config,
400
+ matches: (candidate) => pluginMatchesToggleSpec(candidate, spec)
401
+ });
402
+ return enabled ? "enabled" : "disabled";
391
403
  }
392
404
  async function togglePlugin(spec, deps) {
393
405
  const auditEntry = auditEntryFor(spec);
@@ -398,7 +410,13 @@ async function togglePlugin(spec, deps) {
398
410
  const plugins = Array.isArray(existing.plugins) ? existing.plugins : [];
399
411
  const idx = plugins.findIndex((p) => pluginMatchesToggleSpec(p, spec));
400
412
  const configured = idx >= 0 ? plugins[idx] : void 0;
401
- const enabled = configured ? !(typeof configured === "object" && configured.enabled === false) : auditEntry?.defaultState === "active";
413
+ const effectiveConfig = { ...deps.config, ...existing };
414
+ const { enabled } = resolvePluginEnablement({
415
+ name: spec,
416
+ defaultState: auditEntry?.defaultState,
417
+ config: effectiveConfig,
418
+ matches: (candidate) => pluginMatchesToggleSpec(candidate, spec)
419
+ });
402
420
  if (!configured && !auditEntry) {
403
421
  return errorResult(
404
422
  `Plugin "${spec}" is not configured. Use "wstack plugin add ${spec}" first.`
@@ -490,4 +508,4 @@ export {
490
508
  PLUGIN_AUDIT_ENTRIES,
491
509
  runPluginManagementCommand
492
510
  };
493
- //# sourceMappingURL=chunk-PEKUKUCH.js.map
511
+ //# sourceMappingURL=chunk-GUHQQG63.js.map
@@ -0,0 +1,38 @@
1
+
2
+ // src/terminal-format.ts
3
+ var ANSI = {
4
+ blue: "\x1B[34m",
5
+ cyan: "\x1B[36m",
6
+ green: "\x1B[32m",
7
+ magenta: "\x1B[35m",
8
+ muted: "\x1B[90m",
9
+ success: "\x1B[32m",
10
+ yellow: "\x1B[33m"
11
+ };
12
+ var BOLD = "\x1B[1m";
13
+ var RESET = "\x1B[0m";
14
+ function terminalFormattingEnabled(env = process.env, isTty = Boolean(process.stdout.isTTY)) {
15
+ if (env["NO_COLOR"] !== void 0) return false;
16
+ if (env["FORCE_COLOR"] !== void 0) return true;
17
+ return isTty;
18
+ }
19
+ function terminalText(text, tone, options = {}) {
20
+ const enabled = options.enabled ?? terminalFormattingEnabled();
21
+ if (!enabled) return text;
22
+ return `${options.bold ? BOLD : ""}${ANSI[tone]}${text}${RESET}`;
23
+ }
24
+ function terminalLink(url, options = {}) {
25
+ const enabled = options.enabled ?? terminalFormattingEnabled();
26
+ if (!enabled) return url;
27
+ const visible = terminalText(url, options.tone ?? "cyan", {
28
+ ...options.bold === void 0 ? {} : { bold: options.bold },
29
+ enabled: true
30
+ });
31
+ return `\x1B]8;;${url}\x1B\\${visible}\x1B]8;;\x1B\\`;
32
+ }
33
+
34
+ export {
35
+ terminalText,
36
+ terminalLink
37
+ };
38
+ //# sourceMappingURL=chunk-KE7E7DPX.js.map
@@ -2,11 +2,11 @@ import {
2
2
  hasApiKey,
3
3
  isKeylessLocalProvider,
4
4
  visibleModelIds
5
- } from "./chunk-66T43Q4Y.js";
5
+ } from "./chunk-ETOEGL3V.js";
6
6
  import {
7
7
  appendHistory,
8
8
  backupCurrent
9
- } from "./chunk-YWUPHRGB.js";
9
+ } from "./chunk-263G3FMB.js";
10
10
 
11
11
  // src/arg-parser.ts
12
12
  var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
@@ -79,7 +79,24 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
79
79
  // being consumed as the value of one of these switches.
80
80
  "all-models",
81
81
  "plan",
82
- "json"
82
+ "json",
83
+ // Destructive-preview switch (`wstack chronicle prune --dry-run`). It is
84
+ // boolean at every call site, and leaving it out let it consume the next
85
+ // positional — on a command whose whole purpose is to NOT delete.
86
+ "dry-run",
87
+ // Subcommand booleans. A boolean flag missing from this set makes `parseArgs`
88
+ // swallow the FOLLOWING positional as its value (`rewind --all sess123` lost
89
+ // the session id, `export --no-tools out.md` lost the output path), on top of
90
+ // the handler never seeing the flag at all.
91
+ "all",
92
+ "list",
93
+ "latest",
94
+ "disabled",
95
+ "enable",
96
+ "no-tools",
97
+ "no-diagnostics",
98
+ "unsupported",
99
+ "ws"
83
100
  ]);
84
101
  function parseArgs(argv) {
85
102
  const flags = {};
@@ -1020,4 +1037,4 @@ export {
1020
1037
  runLiveProviderPicker,
1021
1038
  runPicker
1022
1039
  };
1023
- //# sourceMappingURL=chunk-ZNZJ34RF.js.map
1040
+ //# sourceMappingURL=chunk-MHF2IJDE.js.map
@@ -2,7 +2,7 @@ import {
2
2
  fallbackCodexProviderModels,
3
3
  filterCurrentCodexModelIds,
4
4
  isCodexCatalogModel
5
- } from "./chunk-GO3TJICK.js";
5
+ } from "./chunk-PYTFS4MC.js";
6
6
 
7
7
  // src/acp-registry-cache.ts
8
8
  import {
@@ -92,6 +92,7 @@ import { ConfigError } from "@wrongstack/core/types";
92
92
  import { ProviderRegistry } from "@wrongstack/core/registry";
93
93
  import {
94
94
  buildProviderFactoriesFromRegistry,
95
+ createAiGatewayProviderFactory,
95
96
  installCatalogModelOutputLimits,
96
97
  makeProviderFromConfig,
97
98
  withCatalogCapabilities
@@ -157,6 +158,7 @@ async function setupProvider(params) {
157
158
  });
158
159
  }
159
160
  const providerRegistry = new ProviderRegistry();
161
+ providerRegistry.register(createAiGatewayProviderFactory());
160
162
  if (config.features.modelsRegistry) {
161
163
  try {
162
164
  const factories = await buildProviderFactoriesFromRegistry({
@@ -181,11 +183,12 @@ Try \`wstack models refresh\` once you have network access, or run with --no-fea
181
183
  };
182
184
  let provider;
183
185
  try {
186
+ const factoryType = providerConfig.type ?? config.provider;
184
187
  const cfgWithType = { ...providerConfig, type: config.provider };
185
- if (config.features.modelsRegistry && providerRegistry.has(config.provider)) {
186
- provider = providerRegistry.create(cfgWithType);
188
+ if (providerRegistry.has(factoryType)) {
189
+ provider = providerRegistry.create(cfgWithType, factoryType);
187
190
  } else {
188
- provider = makeProviderFromConfig(config.provider, cfgWithType);
191
+ provider = makeProviderFromConfig(config.provider, { ...cfgWithType, type: factoryType });
189
192
  }
190
193
  } catch (err) {
191
194
  throw new ConfigError({
@@ -213,4 +216,4 @@ export {
213
216
  setupProvider,
214
217
  createGracefulShutdown
215
218
  };
216
- //# sourceMappingURL=chunk-4HH3YGG4.js.map
219
+ //# sourceMappingURL=chunk-MRLYDHQ7.js.map