@wrongstack/cli 1.0.1 → 1.0.3
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/data/providers.json +21 -21
- package/dist/{acp-3LARESEO.js → acp-JK4ZQO3R.js} +4 -3
- package/dist/{auth-ZUMCDNE5.js → auth-XD3GN5RJ.js} +78 -54
- package/dist/auth-menu/index.d.ts +1 -0
- package/dist/auth-menu/oauth-menu.d.ts +3 -1
- package/dist/auth-menu/panel-service.d.ts +2 -0
- package/dist/auth-menu/provider-auth-login.d.ts +12 -0
- package/dist/auth-menu/types.d.ts +3 -0
- package/dist/auto-discover-providers-DXR25GTG.js +7 -0
- package/dist/boot/dispatch-webui.d.ts +1 -0
- package/dist/boot/system-prompt-builder.d.ts +7 -0
- package/dist/boot/system-prompt.d.ts +2 -1
- package/dist/chimera-reviewer-policy.d.ts +1 -1
- package/dist/{chunk-KHWDTNBZ.js → chunk-4NHD5OXJ.js} +2 -2
- package/dist/chunk-D5GB5MHA.js +87 -0
- package/dist/chunk-DAKVBMD4.js +36 -0
- package/dist/{chunk-ZSZ3EYWH.js → chunk-GMY45LO6.js} +9 -5
- package/dist/{chunk-D2VCUN7M.js → chunk-IUEKNHPT.js} +10 -10
- package/dist/{chunk-MNQQ4ZNF.js → chunk-ONOT5OJ2.js} +290 -687
- package/dist/chunk-SIGUWXAA.js +43 -0
- package/dist/{chunk-TEBMCYZN.js → chunk-SIS37L3W.js} +58 -2
- package/dist/{chunk-5IA5337I.js → chunk-U6KCWRMC.js} +4 -2
- package/dist/{cli-context-7X3M6U73.js → cli-context-Q6QP534K.js} +18 -7
- package/dist/{cli-main-53KG6HAV.js → cli-main-JQXCDZEA.js} +2909 -2277
- package/dist/execute-deps.d.ts +1 -0
- package/dist/{execution-MIBWBYB6.js → execution-KH7WJNAX.js} +11 -4
- package/dist/index.js +3 -3
- package/dist/live-settings-input.d.ts +2 -0
- package/dist/{mailbox-serve-VUCWZ2SJ.js → mailbox-serve-X3CR6VFW.js} +4 -3
- package/dist/{modeldiag-FMJT37SN.js → modeldiag-46CMWUNM.js} +31 -24
- package/dist/{plugin-usage-HFBI3TFT.js → plugin-usage-M6KET4OZ.js} +2 -2
- package/dist/{plugins-PZ2VZL7V.js → plugins-U7KGQAUG.js} +3 -3
- package/dist/{providers-models-YVMVYWRS.js → providers-models-6MOGAOVK.js} +2 -2
- package/dist/{short-circuit-flags-UREFSYBL.js → short-circuit-flags-ZNZX44MC.js} +2 -2
- package/dist/slash-commands/codebase-map.d.ts +11 -0
- package/dist/slash-commands/command-context.d.ts +7 -0
- package/dist/slash-commands/context.d.ts +10 -0
- package/dist/slash-commands/openai-quota.d.ts +31 -0
- package/dist/{subcommands-WJLBHVKC.js → subcommands-CUTGBDKP.js} +2 -2
- package/dist/{webui-server-5R35BHWZ.js → webui-server-QWBUT7BO.js} +19 -2
- package/dist/webui-server-options.d.ts +1 -0
- package/dist/wiring/atlas-prompt-contributor.d.ts +54 -0
- package/dist/wiring/cli-execute-builder.d.ts +1 -0
- package/dist/wiring/codebase-embeddings.d.ts +31 -0
- package/dist/wiring/command-host-state.d.ts +2 -0
- package/dist/wiring/concept-summarizer.d.ts +32 -0
- package/dist/wiring/external-plugins.d.ts +1 -0
- package/dist/wiring/lifecycle-plugins.d.ts +2 -1
- package/dist/wiring/plugins.d.ts +2 -1
- package/dist/wiring/provider.d.ts +2 -1
- package/package.json +29 -29
- package/dist/auto-discover-providers-VQU3IZMR.js +0 -7
- package/dist/chunk-52C7PD2H.js +0 -61
- package/dist/chunk-TNK6237M.js +0 -262
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
// src/boot/auto-discover-providers.ts
|
|
3
|
+
import * as fs from "node:fs/promises";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { discoverOpenAICompatibleModels, resolveDiscoveryTargets } from "@wrongstack/providers";
|
|
6
|
+
async function readCache(file) {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(await fs.readFile(file, "utf8"));
|
|
9
|
+
} catch {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
async function discoverAndMergeProviders(opts) {
|
|
14
|
+
const targets = resolveDiscoveryTargets(opts.config);
|
|
15
|
+
if (targets.length === 0) return;
|
|
16
|
+
const cacheFile = path.join(opts.cacheDir, "discovered-models-cache.json");
|
|
17
|
+
const cache = await readCache(cacheFile);
|
|
18
|
+
let cacheDirty = false;
|
|
19
|
+
await Promise.all(
|
|
20
|
+
targets.map(
|
|
21
|
+
async ({
|
|
22
|
+
id,
|
|
23
|
+
cfg,
|
|
24
|
+
baseUrl,
|
|
25
|
+
apiKey,
|
|
26
|
+
cacheKey,
|
|
27
|
+
modelDiscoveryPath,
|
|
28
|
+
modelDiscoveryAuthoritative
|
|
29
|
+
}) => {
|
|
30
|
+
const provider = await discoverOpenAICompatibleModels(id, {
|
|
31
|
+
baseUrl,
|
|
32
|
+
apiKey,
|
|
33
|
+
headers: cfg.headers,
|
|
34
|
+
providerName: id,
|
|
35
|
+
modelDiscoveryPath,
|
|
36
|
+
fetchImpl: opts.fetchImpl
|
|
37
|
+
});
|
|
38
|
+
if (provider) {
|
|
39
|
+
const fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
40
|
+
cache[cacheKey] = { fetchedAt, provider };
|
|
41
|
+
cacheDirty = true;
|
|
42
|
+
if (modelDiscoveryAuthoritative) {
|
|
43
|
+
opts.registry.mergeOverlay(
|
|
44
|
+
{ [id]: provider },
|
|
45
|
+
{ observedAt: fetchedAt, authoritativeProviderIds: [id] }
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
opts.registry.mergeOverlay({ [id]: provider });
|
|
49
|
+
}
|
|
50
|
+
opts.logger?.info(
|
|
51
|
+
`auto-discovered ${Object.keys(provider.models).length} models for "${id}" from ${baseUrl}`
|
|
52
|
+
);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const cached = cache[cacheKey];
|
|
56
|
+
if (cached) {
|
|
57
|
+
if (modelDiscoveryAuthoritative) {
|
|
58
|
+
opts.registry.mergeOverlay(
|
|
59
|
+
{ [id]: cached.provider },
|
|
60
|
+
{ observedAt: cached.fetchedAt, authoritativeProviderIds: [id] }
|
|
61
|
+
);
|
|
62
|
+
} else {
|
|
63
|
+
opts.registry.mergeOverlay({ [id]: cached.provider });
|
|
64
|
+
}
|
|
65
|
+
opts.logger?.warn(
|
|
66
|
+
`auto-discovery for "${id}" failed; using ${Object.keys(cached.provider.models).length} cached models from ${cached.fetchedAt}`
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
opts.logger?.warn(
|
|
70
|
+
`auto-discovery for "${id}" failed and no cache available (server at ${baseUrl} unreachable?)`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
if (cacheDirty) {
|
|
77
|
+
try {
|
|
78
|
+
await fs.writeFile(cacheFile, JSON.stringify(cache), "utf8");
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
discoverAndMergeProviders
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=chunk-D5GB5MHA.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
// src/auth-menu/loopback-server.ts
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import {
|
|
5
|
+
startLoopbackServer as startSharedLoopbackServer
|
|
6
|
+
} from "@wrongstack/providers/oauth";
|
|
7
|
+
import { callbackHtml } from "@wrongstack/providers/oauth";
|
|
8
|
+
var URL_METACHAR_REGEX = /[&|;<>(){}^"'`%\n\r\0]/;
|
|
9
|
+
function isSafeBrowserUrl(url) {
|
|
10
|
+
if (URL_METACHAR_REGEX.test(url)) return false;
|
|
11
|
+
try {
|
|
12
|
+
const parsed = new URL(url);
|
|
13
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function openBrowser(url) {
|
|
19
|
+
if (!isSafeBrowserUrl(url)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const platform = process.platform;
|
|
24
|
+
const { command, args } = platform === "win32" ? { command: "cmd", args: ["/c", "start", "", url] } : platform === "darwin" ? { command: "open", args: [url] } : { command: "xdg-open", args: [url] };
|
|
25
|
+
const child = spawn(command, args, { stdio: "ignore", windowsHide: true });
|
|
26
|
+
child.on("error", () => {
|
|
27
|
+
});
|
|
28
|
+
child.unref();
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
openBrowser
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=chunk-DAKVBMD4.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
fallbackCodexProviderModels,
|
|
3
3
|
filterCurrentCodexModelIds,
|
|
4
4
|
isCodexCatalogModel
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SIGUWXAA.js";
|
|
6
6
|
|
|
7
7
|
// src/acp-registry-cache.ts
|
|
8
8
|
import * as fs from "node:fs/promises";
|
|
@@ -163,7 +163,7 @@ function createGracefulShutdown(cleanup) {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
// src/wiring/provider.ts
|
|
166
|
-
import { ProviderRegistry } from "@wrongstack/core/registry";
|
|
166
|
+
import { ProviderAuthRegistry, ProviderRegistry } from "@wrongstack/core/registry";
|
|
167
167
|
import { ConfigError } from "@wrongstack/core/types";
|
|
168
168
|
import {
|
|
169
169
|
buildProviderFactoriesFromRegistry,
|
|
@@ -175,15 +175,19 @@ import {
|
|
|
175
175
|
setupProviderResolved,
|
|
176
176
|
withCatalogCapabilities
|
|
177
177
|
} from "@wrongstack/providers";
|
|
178
|
+
import { registerBuiltinProviderAuthStrategies } from "@wrongstack/providers/oauth";
|
|
178
179
|
async function setupProvider(params) {
|
|
179
180
|
const { config, modelsRegistry, logger } = params;
|
|
181
|
+
const providerAuthRegistry = new ProviderAuthRegistry();
|
|
182
|
+
registerBuiltinProviderAuthStrategies(providerAuthRegistry);
|
|
180
183
|
if (isSetupProvider(config.provider)) {
|
|
181
184
|
const providerRegistry2 = new ProviderRegistry();
|
|
182
185
|
providerRegistry2.register(createSetupProviderFactory());
|
|
183
186
|
return {
|
|
184
187
|
resolvedProvider: setupProviderResolved(),
|
|
185
188
|
provider: providerRegistry2.create({ type: config.provider }),
|
|
186
|
-
providerRegistry: providerRegistry2
|
|
189
|
+
providerRegistry: providerRegistry2,
|
|
190
|
+
providerAuthRegistry
|
|
187
191
|
};
|
|
188
192
|
}
|
|
189
193
|
const savedProviderCfg = config.providers?.[config.provider];
|
|
@@ -296,7 +300,7 @@ Try \`wstack models refresh\` once you have network access, or run with --no-fea
|
|
|
296
300
|
logger
|
|
297
301
|
);
|
|
298
302
|
}
|
|
299
|
-
return { resolvedProvider, provider, providerRegistry };
|
|
303
|
+
return { resolvedProvider, provider, providerRegistry, providerAuthRegistry };
|
|
300
304
|
}
|
|
301
305
|
|
|
302
306
|
export {
|
|
@@ -307,4 +311,4 @@ export {
|
|
|
307
311
|
setupProvider,
|
|
308
312
|
createGracefulShutdown
|
|
309
313
|
};
|
|
310
|
-
//# sourceMappingURL=chunk-
|
|
314
|
+
//# sourceMappingURL=chunk-GMY45LO6.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
// src/subcommands/index.ts
|
|
3
3
|
var loaders = {
|
|
4
|
-
acp: async () => (await import("./acp-
|
|
4
|
+
acp: async () => (await import("./acp-JK4ZQO3R.js")).acpCmd,
|
|
5
5
|
init: async () => (await import("./init-DRMMFG2G.js")).initCmd,
|
|
6
|
-
auth: async () => (await import("./auth-
|
|
6
|
+
auth: async () => (await import("./auth-XD3GN5RJ.js")).authCmd,
|
|
7
7
|
update: async () => (await import("./update-5DPB4YD4.js")).updateCmd,
|
|
8
8
|
sessions: async () => (await import("./sessions-config-UL45XKX7.js")).sessionsCmd,
|
|
9
9
|
config: async () => (await import("./sessions-config-UL45XKX7.js")).configCmd,
|
|
@@ -14,25 +14,25 @@ var loaders = {
|
|
|
14
14
|
audit: async () => (await import("./audit-46YK5DSC.js")).auditCmd,
|
|
15
15
|
tools: async () => (await import("./tools-skills-GH24UCBY.js")).toolsCmd,
|
|
16
16
|
skills: async () => (await import("./tools-skills-GH24UCBY.js")).skillsCmd,
|
|
17
|
-
providers: async () => (await import("./providers-models-
|
|
18
|
-
models: async () => (await import("./providers-models-
|
|
17
|
+
providers: async () => (await import("./providers-models-6MOGAOVK.js")).providersCmd,
|
|
18
|
+
models: async () => (await import("./providers-models-6MOGAOVK.js")).modelsCmd,
|
|
19
19
|
mcp: async () => (await import("./mcp-HOMLC4WE.js")).mcpCmd,
|
|
20
|
-
plugin: async () => (await import("./plugin-usage-
|
|
21
|
-
plugins: async () => (await import("./plugin-usage-
|
|
20
|
+
plugin: async () => (await import("./plugin-usage-M6KET4OZ.js")).pluginCmd,
|
|
21
|
+
plugins: async () => (await import("./plugin-usage-M6KET4OZ.js")).pluginCmd,
|
|
22
22
|
diag: async () => (await import("./diag-doctor-7LYUYU35.js")).diagCmd,
|
|
23
23
|
doctor: async () => (await import("./diag-doctor-7LYUYU35.js")).doctorCmd,
|
|
24
24
|
"proxy-status": async () => (await import("./diag-doctor-7LYUYU35.js")).proxyCmd,
|
|
25
25
|
export: async () => (await import("./export-VVRIOWFV.js")).exportCmd,
|
|
26
|
-
usage: async () => (await import("./plugin-usage-
|
|
26
|
+
usage: async () => (await import("./plugin-usage-M6KET4OZ.js")).usageCmd,
|
|
27
27
|
version: async () => (await import("./version-help-MYKF724O.js")).versionCmd,
|
|
28
28
|
help: async () => (await import("./version-help-MYKF724O.js")).helpCmd,
|
|
29
29
|
projects: async () => (await import("./projects-L6C6XLDY.js")).projectsCmd,
|
|
30
|
-
modeldiag: async () => (await import("./modeldiag-
|
|
30
|
+
modeldiag: async () => (await import("./modeldiag-46CMWUNM.js")).modeldiagCmd,
|
|
31
31
|
quick: async () => (await import("./quick-CNB4Z3HS.js")).quickCmd,
|
|
32
32
|
bench: async () => (await import("./bench-YBU6BVQP.js")).benchCmd,
|
|
33
33
|
chronicle: async () => (await import("./chronicle-UTFETHP6.js")).chronicleCmd,
|
|
34
34
|
hq: async () => (await import("./hq-IG3YRGCO.js")).hqCmd,
|
|
35
|
-
mailbox: async () => (await import("./mailbox-serve-
|
|
35
|
+
mailbox: async () => (await import("./mailbox-serve-X3CR6VFW.js")).mailboxServeCmd,
|
|
36
36
|
permissions: async () => (await import("./permissions-CFDLXETM.js")).permissionsCmd,
|
|
37
37
|
project: async () => (await import("./project-AOQI5XTK.js")).projectCmd,
|
|
38
38
|
governance: async () => (await import("./governance-RYSHV675.js")).governanceCmd
|
|
@@ -51,4 +51,4 @@ export {
|
|
|
51
51
|
subcommands,
|
|
52
52
|
subcommandNames
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-IUEKNHPT.js.map
|