@wrongstack/cli 1.1.1 → 1.1.4
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.
- package/dist/{acp-HCGUTFNE.js → acp-MZ5MQBFN.js} +13 -5
- package/dist/acp-leader/acp-leader-confirm.d.ts +18 -0
- package/dist/acp-leader/acp-leader-context.d.ts +29 -0
- package/dist/acp-leader/acp-leader-fleet.d.ts +26 -0
- package/dist/acp-leader/acp-leader-host-binding.d.ts +16 -0
- package/dist/acp-leader/acp-leader-host.d.ts +80 -0
- package/dist/acp-leader/acp-leader-picker.d.ts +21 -0
- package/dist/acp-leader/acp-leader-provider.d.ts +85 -0
- package/dist/acp-leader/acp-leader-resume.d.ts +10 -0
- package/dist/acp-leader/acp-leader-stream.d.ts +82 -0
- package/dist/{auth-ANOVZVHE.js → auth-IHQS6AFW.js} +60 -64
- package/dist/auth-menu/index.d.ts +1 -2
- package/dist/boot/dispatch-webui.d.ts +16 -0
- package/dist/{chunk-GRAGMA4B.js → chunk-2LTHDKZX.js} +4 -4
- package/dist/chunk-3LEIFO5D.js +65 -0
- package/dist/chunk-COGI7EQU.js +1458 -0
- package/dist/chunk-GKGWPFW2.js +50 -0
- package/dist/{chunk-RAWHRRUJ.js → chunk-I5LJLKA3.js} +198 -197
- package/dist/{chunk-5TRZZHMN.js → chunk-JCZ2D3VV.js} +4 -65
- package/dist/{chunk-XT3NAHRX.js → chunk-JKTJSLUT.js} +192 -1
- package/dist/{chunk-NMXQFQ26.js → chunk-TAE3EGBM.js} +3 -3
- package/dist/{chunk-3R3OADC5.js → chunk-ZF4HRR5F.js} +7 -3
- package/dist/{cli-context-A6XDEXN5.js → cli-context-E44HQ4ZO.js} +17 -8
- package/dist/{cli-main-5UGSW4TO.js → cli-main-OT63I2FX.js} +490 -228
- package/dist/{execution-BAP566QC.js → execution-OK34CJKJ.js} +7 -2
- package/dist/fleet/acp-live-steer.d.ts +28 -0
- package/dist/fleet/acp-permission-bridge.d.ts +49 -0
- package/dist/fleet/acp-quota-hold.d.ts +3 -0
- package/dist/fleet/acp-quota-reading.d.ts +3 -0
- package/dist/fleet/acp-turn-reminders.d.ts +15 -0
- package/dist/fleet/acp-wrongstack-bridge.d.ts +42 -0
- package/dist/fleet/host-acp.d.ts +20 -2
- package/dist/index.js +7 -4
- package/dist/{mcp-2XWBJEQN.js → mcp-W7A5HUXV.js} +97 -1
- package/dist/mcp-serve-project.d.ts +18 -0
- package/dist/{per-subcommand-help-D6J4ZXW2.js → per-subcommand-help-4GYSCMLU.js} +2 -2
- package/dist/{short-circuit-flags-CPCT5MWB.js → short-circuit-flags-QEXUS3BY.js} +2 -2
- package/dist/{subcommands-VTMIZQBP.js → subcommands-YADUV7IJ.js} +2 -2
- package/dist/{webui-server-HIUY3RHD.js → webui-server-CB64CFDG.js} +41 -3
- package/package.json +34 -30
- package/dist/auth-menu/anthropic-oauth.d.ts +0 -43
- package/dist/chunk-ZNNFEKDZ.js +0 -319
package/dist/chunk-ZNNFEKDZ.js
DELETED
|
@@ -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
|