@wrongstack/cli 1.1.2 → 1.1.5

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 (117) hide show
  1. package/dist/{acp-HCGUTFNE.js → acp-NKUEYJDZ.js} +14 -5
  2. package/dist/acp-leader/acp-leader-confirm.d.ts +20 -0
  3. package/dist/acp-leader/acp-leader-context.d.ts +29 -0
  4. package/dist/acp-leader/acp-leader-fleet.d.ts +26 -0
  5. package/dist/acp-leader/acp-leader-host-binding.d.ts +17 -0
  6. package/dist/acp-leader/acp-leader-host.d.ts +82 -0
  7. package/dist/acp-leader/acp-leader-picker.d.ts +24 -0
  8. package/dist/acp-leader/acp-leader-provider.d.ts +85 -0
  9. package/dist/acp-leader/acp-leader-resume.d.ts +10 -0
  10. package/dist/acp-leader/acp-leader-stream.d.ts +83 -0
  11. package/dist/{auth-ANOVZVHE.js → auth-2ZG5DBHS.js} +62 -66
  12. package/dist/auth-menu/index.d.ts +1 -2
  13. package/dist/boot/dispatch-webui.d.ts +16 -0
  14. package/dist/boot/launch-menu-arrow.d.ts +20 -0
  15. package/dist/boot/launch-menu-types.d.ts +36 -0
  16. package/dist/boot/launch-menu.d.ts +1 -57
  17. package/dist/boot/tui-session-resume-rollback.d.ts +31 -0
  18. package/dist/{boot-auto-thin-7D4OVEWA.js → boot-auto-thin-N2CIGTXE.js} +3 -3
  19. package/dist/{chunk-TZPKOS5G.js → chunk-2XQ6SRKG.js} +2 -2
  20. package/dist/chunk-3LEIFO5D.js +65 -0
  21. package/dist/chunk-5SGMUDP5.js +752 -0
  22. package/dist/{chunk-3EXRPTAU.js → chunk-5TQ65PXQ.js} +17 -17
  23. package/dist/{chunk-GRAGMA4B.js → chunk-7BM4LGKQ.js} +18 -18
  24. package/dist/{chunk-VAQXOZKP.js → chunk-AJM4EFCM.js} +139 -136
  25. package/dist/{chunk-C2BBH4S4.js → chunk-E3MJFAFR.js} +2 -2
  26. package/dist/{chunk-5TRZZHMN.js → chunk-JCZ2D3VV.js} +4 -65
  27. package/dist/{chunk-AWRZWPJ3.js → chunk-JFYQGMMM.js} +99 -75
  28. package/dist/{chunk-BIGSVBPI.js → chunk-KNYIEQAY.js} +64 -61
  29. package/dist/chunk-LUEO5HLZ.js +50 -0
  30. package/dist/chunk-LYWOV4OX.js +252 -0
  31. package/dist/chunk-M7FNHCE3.js +2070 -0
  32. package/dist/{chunk-75OLD563.js → chunk-M7PSENGF.js} +3 -1
  33. package/dist/{chunk-NMXQFQ26.js → chunk-MEBXWI7U.js} +5 -5
  34. package/dist/{chunk-RAWHRRUJ.js → chunk-MKMM5RIW.js} +209 -201
  35. package/dist/{chunk-3R3OADC5.js → chunk-P7MEEUGT.js} +281 -252
  36. package/dist/chunk-QLYPIJ7X.js +258 -0
  37. package/dist/chunk-RN5CFAVQ.js +292 -0
  38. package/dist/{chunk-WDXNBYGD.js → chunk-TDP7CZGE.js} +6 -1
  39. package/dist/{chunk-6VPWQ4TG.js → chunk-UROB7MK5.js} +2 -1
  40. package/dist/chunk-VEESMPTX.js +254 -0
  41. package/dist/{chunk-IJLIAPCW.js → chunk-VPSAKGLK.js} +47 -47
  42. package/dist/{cli-context-YIT4FEDM.js → cli-context-CQYGIWOU.js} +254 -237
  43. package/dist/{cli-main-JIADJ5OL.js → cli-main-VRUJNUBX.js} +2081 -1594
  44. package/dist/cli-main-boot.d.ts +1 -1
  45. package/dist/config-doctor-known-keys.d.ts +33 -0
  46. package/dist/config-doctor.d.ts +2 -47
  47. package/dist/config-history-support.d.ts +36 -0
  48. package/dist/config-history.d.ts +1 -1
  49. package/dist/{config-transfer-Y7XJMJRN.js → config-transfer-B4GOZTFC.js} +2 -2
  50. package/dist/{execution-BAP566QC.js → execution-IV72RUSM.js} +5354 -5258
  51. package/dist/execution-tui.d.ts +30 -0
  52. package/dist/fleet/acp-live-steer.d.ts +28 -0
  53. package/dist/fleet/acp-permission-bridge.d.ts +49 -0
  54. package/dist/fleet/acp-quota-hold.d.ts +3 -0
  55. package/dist/fleet/acp-quota-reading.d.ts +3 -0
  56. package/dist/fleet/acp-turn-reminders.d.ts +15 -0
  57. package/dist/fleet/acp-wrongstack-bridge.d.ts +50 -0
  58. package/dist/fleet/host-acp.d.ts +23 -2
  59. package/dist/fleet/wrongforge-client.d.ts +116 -0
  60. package/dist/fleet/wrongforge-gateway.d.ts +20 -0
  61. package/dist/fleet/wrongforge-info.d.ts +32 -0
  62. package/dist/fleet/wrongforge-quota.d.ts +10 -0
  63. package/dist/fleet/wrongforge-runner.d.ts +37 -0
  64. package/dist/fleet/wrongforge-runtime.d.ts +10 -0
  65. package/dist/{hq-JD5AZVMG.js → hq-54PQYR5O.js} +311 -307
  66. package/dist/hq-server/sweeps.d.ts +28 -0
  67. package/dist/{hq-server-BI23EPM7.js → hq-server-YK7FBLL6.js} +3 -3
  68. package/dist/index.js +8 -5
  69. package/dist/mcp-22CFBX4H.js +236 -0
  70. package/dist/mcp-serve-project.d.ts +18 -0
  71. package/dist/mcp-serve.d.ts +0 -63
  72. package/dist/{modeldiag-HDIKG37X.js → modeldiag-5PBB777J.js} +4 -4
  73. package/dist/{per-subcommand-help-D6J4ZXW2.js → per-subcommand-help-MQGERD4E.js} +2 -2
  74. package/dist/plugin-llm-command.d.ts +9 -0
  75. package/dist/{plugin-usage-TYF5HY4K.js → plugin-usage-UWKYMNQU.js} +3 -3
  76. package/dist/{plugins-XGAXDLPT.js → plugins-VP7JQH47.js} +4 -4
  77. package/dist/{sdd-runtime-6MFUXWJK.js → sdd-runtime-HIJ4Z5TF.js} +2 -2
  78. package/dist/services/sdd/state.d.ts +2 -0
  79. package/dist/session-event-wiring-types.d.ts +62 -0
  80. package/dist/session-event-wiring.d.ts +2 -52
  81. package/dist/{sessions-config-SJVQXCIE.js → sessions-config-7MK742OW.js} +2 -2
  82. package/dist/short-circuit-flags-AGHURHMQ.js +11 -0
  83. package/dist/slash-commands/command-context-fleet.d.ts +187 -0
  84. package/dist/slash-commands/command-context-sdd-goal.d.ts +102 -0
  85. package/dist/slash-commands/command-context.d.ts +3 -282
  86. package/dist/slash-commands/project-switch-interactive.d.ts +11 -0
  87. package/dist/slash-commands/setmodel-helpers.d.ts +36 -0
  88. package/dist/subcommands/handlers/hq-token.d.ts +3 -0
  89. package/dist/subcommands/handlers/hq.d.ts +0 -21
  90. package/dist/subcommands/handlers/per-subcommand-help-operations.d.ts +8 -0
  91. package/dist/subcommands/handlers/tools-cli-args.d.ts +57 -0
  92. package/dist/subcommands/handlers/tools-cli.d.ts +5 -0
  93. package/dist/subcommands/handlers/tools-serve.d.ts +4 -0
  94. package/dist/{subcommands-VTMIZQBP.js → subcommands-OCJNO57E.js} +2 -2
  95. package/dist/tool-gateway-http.d.ts +30 -0
  96. package/dist/tool-gateway.d.ts +185 -0
  97. package/dist/tools-cli-44MLIUQO.js +509 -0
  98. package/dist/tools-serve-TRCET2M7.js +102 -0
  99. package/dist/{tools-skills-55QVTMSK.js → tools-skills-WDTMCE46.js} +7 -2
  100. package/dist/tuneup-runtime-checks.d.ts +7 -0
  101. package/dist/tuneup-types.d.ts +118 -0
  102. package/dist/tuneup.d.ts +3 -122
  103. package/dist/{typesafe-YBEADNAH.js → typesafe-QLSMFU7J.js} +1 -1
  104. package/dist/{version-help-RBZC5GZZ.js → version-help-X6CC4CFY.js} +2 -2
  105. package/dist/{webui-server-HIUY3RHD.js → webui-server-V2R5WQUK.js} +79 -3
  106. package/dist/wiring/provider-runtime-setup.d.ts +3 -1
  107. package/dist/wiring/session-runtime.d.ts +1 -1
  108. package/dist/wrongforge-gateway-UOFBK56J.js +92 -0
  109. package/dist/wrongforge-leader/wrongforge-leader-gateway.d.ts +9 -0
  110. package/dist/wrongforge-leader/wrongforge-leader-picker.d.ts +12 -0
  111. package/dist/wrongforge-leader/wrongforge-leader-provider.d.ts +49 -0
  112. package/package.json +34 -30
  113. package/dist/auth-menu/anthropic-oauth.d.ts +0 -43
  114. package/dist/chunk-XT3NAHRX.js +0 -337
  115. package/dist/chunk-ZNNFEKDZ.js +0 -319
  116. package/dist/mcp-2XWBJEQN.js +0 -464
  117. package/dist/short-circuit-flags-CPCT5MWB.js +0 -11
@@ -1,319 +0,0 @@
1
- import {
2
- resolveProviderCfgWithProxy
3
- } from "./chunk-UFRVTBV6.js";
4
-
5
- // src/acp-agent-list.ts
6
- import { REGISTRY_ID_ALIASES } from "@wrongstack/acp";
7
- function reverseAliases(aliases = REGISTRY_ID_ALIASES) {
8
- const out = {};
9
- for (const [ours, theirs] of Object.entries(aliases)) {
10
- if (ours !== theirs) out[theirs] = ours;
11
- }
12
- return out;
13
- }
14
- function distKind(command) {
15
- if (command === "npx") return "npx";
16
- if (command === "uvx") return "uvx";
17
- return "local";
18
- }
19
- function localProbe(registryId, alias, detectedById) {
20
- return detectedById.get(registryId) ?? (alias ? detectedById.get(alias) : void 0);
21
- }
22
- function formatRegistryRow(agent, alias, local, idWidth) {
23
- const kind = distKind(agent.acp.command);
24
- const aliasBit = alias ? ` (also ${alias})` : "";
25
- if (kind === "local") {
26
- if (local?.installed) {
27
- const ver = local.version?.split("\n")[0]?.trim();
28
- const note2 = ver ? ` ${ver}` : " on PATH";
29
- return ` \u2713 ${agent.id.padEnd(idWidth)} ${agent.displayName}${aliasBit}${note2}`;
30
- }
31
- const reason = local?.reason ?? "not on PATH";
32
- return ` \u2717 ${agent.id.padEnd(idWidth)} ${agent.displayName}${aliasBit} (${reason})`;
33
- }
34
- const pkg = (agent.acp.args ?? []).find((a) => a !== "-y" && !a.startsWith("--"));
35
- const note = pkg ? `${kind} ${pkg}` : kind;
36
- return ` \u25B8 ${agent.id.padEnd(idWidth)} ${agent.displayName}${aliasBit} ${note}`;
37
- }
38
- function formatAcpAgentList(opts) {
39
- const { live, detected } = opts;
40
- const detectedById = new Map(detected.map((d) => [d.id, d]));
41
- if (live && live.agents.length > 0) {
42
- const aliasOf = reverseAliases();
43
- const when = live.fetchedAt ? live.fetchedAt.slice(0, 19).replace("T", " ") : "locally";
44
- const rows = [...live.agents].sort((a, b) => {
45
- const rank = (command) => {
46
- const k = distKind(command);
47
- return k === "local" ? 0 : k === "uvx" ? 1 : 2;
48
- };
49
- const r = rank(a.acp.command) - rank(b.acp.command);
50
- return r !== 0 ? r : a.id.localeCompare(b.id);
51
- });
52
- const idWidth = Math.max(16, ...rows.map((a) => a.id.length));
53
- const lines2 = [
54
- `Official ACP registry \u2014 ${live.agents.length} agents (synced ${when}).`,
55
- "Spawn ids below are what `/acp <id> <task>` and `/acp <id> --bg` accept.",
56
- ""
57
- ];
58
- for (const agent of rows) {
59
- const alias = aliasOf[agent.id];
60
- lines2.push(
61
- formatRegistryRow(agent, alias, localProbe(agent.id, alias, detectedById), idWidth)
62
- );
63
- }
64
- const leftover = detected.filter((d) => {
65
- if (live.byId[d.id]) return false;
66
- const mapped = REGISTRY_ID_ALIASES[d.id];
67
- return !(mapped && live.byId[mapped]);
68
- });
69
- if (leftover.length > 0) {
70
- lines2.push("");
71
- lines2.push("Bundled extras (not in the official registry \u2014 experimental):");
72
- for (const d of leftover) {
73
- const mark = d.installed ? "\u2713" : "\u2717";
74
- const extra = d.installed ? d.version?.split("\n")[0] ?? "" : d.reason ?? "not installed";
75
- lines2.push(` ${mark} ${d.id.padEnd(16)} ${d.displayName} (${extra})`);
76
- }
77
- }
78
- lines2.push("");
79
- lines2.push(
80
- "Spawn: /acp <id> <task> Background: /acp <id> --bg <task> Probe: /acp probe <id>"
81
- );
82
- return lines2.join("\n");
83
- }
84
- const installed = detected.filter((a) => a.installed);
85
- const missing = detected.filter((a) => !a.installed);
86
- const lines = [
87
- "Bundled offline catalog (not the official registry).",
88
- "Run `/acp sync` to replace this list with agentclientprotocol/registry.",
89
- ""
90
- ];
91
- for (const a of installed) {
92
- const ver = a.version ? ` (${a.version.split("\n")[0]})` : "";
93
- lines.push(` \u2713 ${a.id.padEnd(16)} ${a.displayName}${ver}`);
94
- }
95
- for (const a of missing) {
96
- lines.push(` \u2717 ${a.id.padEnd(16)} ${a.displayName} (${a.reason ?? "not installed"})`);
97
- }
98
- lines.push("");
99
- lines.push(`${installed.length} of ${detected.length} bundled agents installed locally.`);
100
- return lines.join("\n");
101
- }
102
-
103
- // src/acp-registry-cache.ts
104
- import * as fs from "node:fs/promises";
105
- import * as path from "node:path";
106
- import { fetchAcpRegistry } from "@wrongstack/acp";
107
- function acpRegistryCachePath(paths) {
108
- return path.join(paths.cacheDir, "acp-registry.json");
109
- }
110
- async function loadCachedAcpRegistry(paths) {
111
- try {
112
- const raw = await fs.readFile(acpRegistryCachePath(paths), "utf8");
113
- const env = JSON.parse(raw);
114
- if (!Array.isArray(env.agents)) return null;
115
- const byId = /* @__PURE__ */ Object.create(null);
116
- for (const a of env.agents) {
117
- if (!a?.id || !a.acp?.command) continue;
118
- byId[a.id] = {
119
- command: a.acp.command,
120
- args: a.acp.args ?? [],
121
- ...a.acp.env ? { env: a.acp.env } : {}
122
- };
123
- }
124
- return { fetchedAt: env.fetchedAt ?? "", byId, agents: env.agents };
125
- } catch {
126
- return null;
127
- }
128
- }
129
- async function refreshAcpRegistry(paths, opts) {
130
- const result = await fetchAcpRegistry({
131
- ...opts?.signal ? { signal: opts.signal } : {},
132
- ...opts?.timeoutMs ? { timeoutMs: opts.timeoutMs } : {}
133
- });
134
- const location = acpRegistryCachePath(paths);
135
- await fs.mkdir(path.dirname(location), { recursive: true });
136
- const env = { fetchedAt: result.fetchedAt, agents: result.agents };
137
- await fs.writeFile(location, JSON.stringify(env), "utf8");
138
- return { count: result.agents.length, location, fetchedAt: result.fetchedAt };
139
- }
140
-
141
- // src/shutdown-cleanup.ts
142
- function createGracefulShutdown(cleanup) {
143
- const exitCode = cleanup.exitCode ?? 0;
144
- let started = false;
145
- let installed = false;
146
- const runOnce = (force) => {
147
- if (started) {
148
- if (force) process.exit(exitCode);
149
- return;
150
- }
151
- started = true;
152
- void cleanup.run().catch(() => {
153
- }).finally(() => {
154
- if (force) {
155
- process.exitCode = exitCode;
156
- const t = setTimeout(() => process.exit(exitCode), 500);
157
- t.unref();
158
- }
159
- });
160
- };
161
- const signalHandler = () => runOnce(true);
162
- const beforeExitHandler = () => runOnce(false);
163
- return {
164
- install() {
165
- if (installed) return;
166
- installed = true;
167
- process.once("SIGINT", signalHandler);
168
- process.once("SIGTERM", signalHandler);
169
- process.once("beforeExit", beforeExitHandler);
170
- },
171
- uninstall() {
172
- if (!installed) return;
173
- installed = false;
174
- process.removeListener("SIGINT", signalHandler);
175
- process.removeListener("SIGTERM", signalHandler);
176
- process.removeListener("beforeExit", beforeExitHandler);
177
- },
178
- get cleanupStarted() {
179
- return started;
180
- }
181
- };
182
- }
183
-
184
- // src/wiring/provider.ts
185
- import { ProviderAuthRegistry, ProviderRegistry } from "@wrongstack/core/registry";
186
- import { ConfigError } from "@wrongstack/core/types";
187
- import {
188
- buildProviderFactoriesFromRegistry,
189
- createAiGatewayProviderFactory,
190
- createSetupProviderFactory,
191
- installCatalogModelOutputLimits,
192
- isSetupProvider,
193
- makeProviderFromConfig,
194
- setStreamTimeoutDefaults,
195
- setupProviderResolved,
196
- withCatalogCapabilities
197
- } from "@wrongstack/providers";
198
- import { registerBuiltinProviderAuthStrategies } from "@wrongstack/providers/oauth";
199
- async function setupProvider(params) {
200
- const { config, modelsRegistry, logger } = params;
201
- const providerAuthRegistry = new ProviderAuthRegistry();
202
- registerBuiltinProviderAuthStrategies(providerAuthRegistry);
203
- if (isSetupProvider(config.provider)) {
204
- const providerRegistry2 = new ProviderRegistry();
205
- providerRegistry2.register(createSetupProviderFactory());
206
- return {
207
- resolvedProvider: setupProviderResolved(),
208
- provider: providerRegistry2.create({ type: config.provider }),
209
- providerRegistry: providerRegistry2,
210
- providerAuthRegistry
211
- };
212
- }
213
- const savedProviderCfg = config.providers?.[config.provider];
214
- let resolvedProvider = await modelsRegistry.getProvider(config.provider).catch(() => void 0);
215
- if (!resolvedProvider && savedProviderCfg?.type && savedProviderCfg.type !== config.provider) {
216
- resolvedProvider = await modelsRegistry.getProvider(savedProviderCfg.type).catch(() => void 0);
217
- }
218
- if (!resolvedProvider) {
219
- if (savedProviderCfg?.family) {
220
- const family = savedProviderCfg.family;
221
- const savedModels = savedProviderCfg.models;
222
- let models;
223
- if (savedModels && savedModels.length > 0) {
224
- models = savedModels.map((m) => ({ id: m, name: m }));
225
- } else {
226
- models = [];
227
- }
228
- resolvedProvider = {
229
- id: config.provider,
230
- name: config.provider,
231
- family,
232
- apiBase: savedProviderCfg.baseUrl,
233
- envVars: savedProviderCfg.envVars ?? [],
234
- models,
235
- npm: void 0
236
- };
237
- } else {
238
- logger.warn(
239
- `Provider "${config.provider}" not found in models.dev. Continuing with raw config.`
240
- );
241
- }
242
- } else if (resolvedProvider.family === "unsupported" && !savedProviderCfg?.family) {
243
- throw new ConfigError({
244
- message: `Provider "${config.provider}" uses an unsupported wire family (${resolvedProvider.npm}). Install a plugin to enable it, or pick a different provider.`,
245
- code: "CONFIG_INVALID",
246
- context: { provider: config.provider, family: resolvedProvider.npm, kind: "unsupported" }
247
- });
248
- }
249
- setStreamTimeoutDefaults(config.modelRuntime?.streaming);
250
- if (config.features.modelsRegistry) {
251
- await installCatalogModelOutputLimits({
252
- registry: modelsRegistry,
253
- getConfig: () => config,
254
- log: (message) => logger.debug(message)
255
- });
256
- }
257
- const providerRegistry = new ProviderRegistry();
258
- providerRegistry.register(createAiGatewayProviderFactory());
259
- providerRegistry.register(createSetupProviderFactory());
260
- if (config.features.modelsRegistry) {
261
- try {
262
- const factories = await buildProviderFactoriesFromRegistry({
263
- registry: modelsRegistry,
264
- log: logger
265
- });
266
- for (const f of factories) providerRegistry.register(f);
267
- } catch (err) {
268
- throw new ConfigError({
269
- message: `Failed to load models.dev registry: ${err instanceof Error ? err.message : err}
270
- Try \`wstack models refresh\` once you have network access.`,
271
- code: "CONFIG_INVALID",
272
- context: { phase: "registry-build", provider: config.provider },
273
- cause: err
274
- });
275
- }
276
- }
277
- const { cfg: providerConfig, factoryType } = resolveProviderCfgWithProxy(
278
- config,
279
- config.provider,
280
- // Boot-time rewrite decision — the first "is traffic proxied?" line in
281
- // wrongstack.log. info-level only; skips log too (they answer WHY).
282
- { logger }
283
- );
284
- let provider;
285
- try {
286
- const cfgWithType = { ...providerConfig, type: config.provider };
287
- if (providerRegistry.has(factoryType)) {
288
- provider = providerRegistry.create(cfgWithType, factoryType);
289
- } else {
290
- provider = makeProviderFromConfig(config.provider, { ...cfgWithType, type: factoryType });
291
- }
292
- } catch (err) {
293
- throw new ConfigError({
294
- message: `Failed to create provider: ${err instanceof Error ? err.message : err}`,
295
- code: "CONFIG_INVALID",
296
- context: { phase: "provider-create", provider: config.provider },
297
- cause: err
298
- });
299
- }
300
- if (config.features.modelsRegistry) {
301
- provider = await withCatalogCapabilities(
302
- modelsRegistry,
303
- config.provider,
304
- provider,
305
- { ...providerConfig, type: config.provider, model: config.model },
306
- logger
307
- );
308
- }
309
- return { resolvedProvider, provider, providerRegistry, providerAuthRegistry };
310
- }
311
-
312
- export {
313
- formatAcpAgentList,
314
- loadCachedAcpRegistry,
315
- refreshAcpRegistry,
316
- setupProvider,
317
- createGracefulShutdown
318
- };
319
- //# sourceMappingURL=chunk-ZNNFEKDZ.js.map