@mrciphersmith/keryx 0.4.10 → 0.4.11
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/cli.js +55 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24244,7 +24244,7 @@ var package_default;
|
|
|
24244
24244
|
var init_package = __esm(() => {
|
|
24245
24245
|
package_default = {
|
|
24246
24246
|
name: "@mrciphersmith/keryx",
|
|
24247
|
-
version: "0.4.
|
|
24247
|
+
version: "0.4.11",
|
|
24248
24248
|
description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
24249
24249
|
private: false,
|
|
24250
24250
|
publishConfig: {
|
|
@@ -96105,7 +96105,12 @@ function providerByName(name, dir) {
|
|
|
96105
96105
|
return allOpenAiCompatProviders(dir).find((p) => p.name === name);
|
|
96106
96106
|
}
|
|
96107
96107
|
function connectionProviderByName(name, dir) {
|
|
96108
|
-
|
|
96108
|
+
if (name === "openai-codex")
|
|
96109
|
+
return OPENAI_CODEX_PICKER;
|
|
96110
|
+
const registered = providerByName(name, dir);
|
|
96111
|
+
if (registered === undefined && name === "anthropic")
|
|
96112
|
+
return ANTHROPIC_PICKER;
|
|
96113
|
+
return registered;
|
|
96109
96114
|
}
|
|
96110
96115
|
function customCompatProviders(dir) {
|
|
96111
96116
|
const builtinNames = new Set([...OPENAI_COMPAT_PROVIDERS.map((p) => p.name), "openai-codex"]);
|
|
@@ -96285,10 +96290,46 @@ async function fetchOpenAiCompatModelsDetailed(fetchFn, provider, apiKey, opts)
|
|
|
96285
96290
|
clearTimeout(timer);
|
|
96286
96291
|
}
|
|
96287
96292
|
}
|
|
96293
|
+
async function fetchAnthropicModels(fetchFn, apiKey, opts) {
|
|
96294
|
+
const timeoutMs = opts?.timeoutMs ?? MODELS_FETCH_TIMEOUT_MS;
|
|
96295
|
+
const fallback = (failure) => ({ models: [], source: "fallback", failure });
|
|
96296
|
+
const url = `${(opts?.baseUrl ?? ANTHROPIC_PICKER.baseUrl).replace(/\/+$/, "")}/v1/models?limit=1000`;
|
|
96297
|
+
const controller = new AbortController;
|
|
96298
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
96299
|
+
try {
|
|
96300
|
+
const headers = { "anthropic-version": ANTHROPIC_API_VERSION };
|
|
96301
|
+
if (apiKey !== undefined && apiKey.length > 0)
|
|
96302
|
+
headers["x-api-key"] = apiKey;
|
|
96303
|
+
const res = await fetchFn(url, { headers, signal: controller.signal, redirect: "error" });
|
|
96304
|
+
if (!res.ok) {
|
|
96305
|
+
const detail = modelsErrorDetail(await res.text().catch(() => ""));
|
|
96306
|
+
const kind = res.status === 401 || res.status === 403 ? "rejected" : "http";
|
|
96307
|
+
return fallback({ kind, status: res.status, ...detail === undefined ? {} : { detail } });
|
|
96308
|
+
}
|
|
96309
|
+
const bounded = await boundedJsonBody(res, MODELS_RESPONSE_BODY_LIMIT_BYTES);
|
|
96310
|
+
if (!bounded.ok) {
|
|
96311
|
+
return fallback({ kind: "http", status: res.status, detail: "response too large or malformed" });
|
|
96312
|
+
}
|
|
96313
|
+
const data = bounded.value?.data;
|
|
96314
|
+
const ids = Array.isArray(data) ? data.flatMap((m) => typeof m?.id === "string" && m.id.length > 0 ? [m.id] : []) : [];
|
|
96315
|
+
return ids.length === 0 ? fallback({ kind: "empty" }) : { models: Array.from(new Set(ids)), source: "live" };
|
|
96316
|
+
} catch (err) {
|
|
96317
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
96318
|
+
return fallback({ kind: "unreachable", detail: controller.signal.aborted ? `timed out after ${timeoutMs}ms` : message });
|
|
96319
|
+
} finally {
|
|
96320
|
+
clearTimeout(timer);
|
|
96321
|
+
}
|
|
96322
|
+
}
|
|
96288
96323
|
async function resolveModelsForPicker(fetchFn, provider, env = process.env, opts) {
|
|
96289
96324
|
if (provider.name === "openai-codex")
|
|
96290
96325
|
return fetchOpenAiCodexModels(fetchFn, opts);
|
|
96291
96326
|
const compat = providerByName(provider.name, opts?.configDir);
|
|
96327
|
+
if (compat === undefined && provider.name === "anthropic") {
|
|
96328
|
+
const raw = envWithSavedApiKeys(env, opts?.configDir)[provider.envKey ?? "ANTHROPIC_API_KEY"];
|
|
96329
|
+
if (typeof raw !== "string" || raw.length === 0)
|
|
96330
|
+
return { models: [...provider.models], source: "fallback" };
|
|
96331
|
+
return fetchAnthropicModels(fetchFn, raw, opts?.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : {});
|
|
96332
|
+
}
|
|
96292
96333
|
if (compat === undefined) {
|
|
96293
96334
|
return { models: [...provider.models], source: "fallback" };
|
|
96294
96335
|
}
|
|
@@ -96422,6 +96463,9 @@ async function testProviderConnection(provider, fetchFn = globalThis.fetch, env
|
|
|
96422
96463
|
refreshCatalogVersion: true,
|
|
96423
96464
|
...profiles?.dir !== undefined ? { configDir: profiles.dir } : {}
|
|
96424
96465
|
});
|
|
96466
|
+
if (provider === ANTHROPIC_PICKER) {
|
|
96467
|
+
return fetchAnthropicModels(fetchFn, envWithSavedApiKeys(env, profiles?.dir)[ANTHROPIC_PICKER.envKey ?? "ANTHROPIC_API_KEY"], { timeoutMs: MODELS_FETCH_TIMEOUT_MS });
|
|
96468
|
+
}
|
|
96425
96469
|
const apiKey = providerApiKey(provider, envWithSavedApiKeys(env, profiles?.dir)) ?? provider.apiKey;
|
|
96426
96470
|
return fetchOpenAiCompatModelsDetailed(fetchFn, provider, apiKey, {
|
|
96427
96471
|
timeoutMs: MODELS_FETCH_TIMEOUT_MS,
|
|
@@ -96820,7 +96864,7 @@ auth.json only (no revoke call), and a saved API key simply stops being read \u2
|
|
|
96820
96864
|
the key itself is still valid until you revoke it yourself with the vendor.
|
|
96821
96865
|
`);
|
|
96822
96866
|
}
|
|
96823
|
-
var DEFAULT_MODELS_PATH = "/v1/models", MINIMAX_REASONING_PRESET_HOSTS, DEEPSEEK_REASONING_PRESET_HOSTS, OPENAI_COMPAT_PROVIDERS, MODELS_FETCH_TIMEOUT_MS = 1e4, MODELS_ERROR_BODY_LIMIT = 4096, MODELS_RESPONSE_BODY_LIMIT_BYTES = 4000000, BALANCE_FETCH_TIMEOUT_MS = 8000, BALANCE_RESPONSE_BODY_LIMIT_BYTES = 1e6;
|
|
96867
|
+
var DEFAULT_MODELS_PATH = "/v1/models", MINIMAX_REASONING_PRESET_HOSTS, DEEPSEEK_REASONING_PRESET_HOSTS, OPENAI_COMPAT_PROVIDERS, MODELS_FETCH_TIMEOUT_MS = 1e4, MODELS_ERROR_BODY_LIMIT = 4096, MODELS_RESPONSE_BODY_LIMIT_BYTES = 4000000, ANTHROPIC_PICKER, ANTHROPIC_API_VERSION = "2023-06-01", BALANCE_FETCH_TIMEOUT_MS = 8000, BALANCE_RESPONSE_BODY_LIMIT_BYTES = 1e6;
|
|
96824
96868
|
var init_providers = __esm(() => {
|
|
96825
96869
|
init_provider_config();
|
|
96826
96870
|
init_catalog3();
|
|
@@ -96949,6 +96993,14 @@ var init_providers = __esm(() => {
|
|
|
96949
96993
|
note: "Copilot \xB7 device login"
|
|
96950
96994
|
}
|
|
96951
96995
|
];
|
|
96996
|
+
ANTHROPIC_PICKER = {
|
|
96997
|
+
name: "anthropic",
|
|
96998
|
+
label: "Anthropic",
|
|
96999
|
+
baseUrl: "https://api.anthropic.com",
|
|
97000
|
+
envKey: "ANTHROPIC_API_KEY",
|
|
97001
|
+
models: [...ANTHROPIC_MODELS],
|
|
97002
|
+
note: "Claude \xB7 API key"
|
|
97003
|
+
};
|
|
96952
97004
|
});
|
|
96953
97005
|
|
|
96954
97006
|
// src/harness/provider/tool-call-linking.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrciphersmith/keryx",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
4
4
|
"description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|