@mrciphersmith/keryx 0.4.9 → 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 +77 -9
- 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: {
|
|
@@ -95667,9 +95667,13 @@ async function detectProviders(deps) {
|
|
|
95667
95667
|
detected.push({ name: "ollama", models: ollamaModels, baseUrl });
|
|
95668
95668
|
}
|
|
95669
95669
|
const anthropicKey = deps.env.ANTHROPIC_API_KEY;
|
|
95670
|
-
|
|
95671
|
-
|
|
95672
|
-
|
|
95670
|
+
detected.push({
|
|
95671
|
+
name: "anthropic",
|
|
95672
|
+
label: "Anthropic",
|
|
95673
|
+
envKey: "ANTHROPIC_API_KEY",
|
|
95674
|
+
note: "Claude \xB7 API key",
|
|
95675
|
+
models: [...ANTHROPIC_MODELS]
|
|
95676
|
+
});
|
|
95673
95677
|
detected.push({ name: OPENAI_CODEX_PICKER.name, label: OPENAI_CODEX_PICKER.label, models: [...OPENAI_CODEX_PICKER.models], note: "ChatGPT subscription \xB7 browser device login" });
|
|
95674
95678
|
const geminiKey = deps.env.GEMINI_API_KEY ?? deps.env.GOOGLE_API_KEY;
|
|
95675
95679
|
if (typeof geminiKey === "string" && geminiKey.length > 0) {
|
|
@@ -95892,6 +95896,11 @@ async function buildCatalogEntry(detected, deps, fetchedAt) {
|
|
|
95892
95896
|
}
|
|
95893
95897
|
const registry = providerByName(detected.name, deps.dir);
|
|
95894
95898
|
if (registry === undefined) {
|
|
95899
|
+
if (detected.name === "anthropic") {
|
|
95900
|
+
const key = envWithSavedApiKeys(deps.env, deps.dir)[detected.envKey ?? "ANTHROPIC_API_KEY"];
|
|
95901
|
+
if (key === undefined || key.length === 0)
|
|
95902
|
+
return;
|
|
95903
|
+
}
|
|
95895
95904
|
return {
|
|
95896
95905
|
name: detected.name,
|
|
95897
95906
|
status: "not-supported",
|
|
@@ -96096,7 +96105,12 @@ function providerByName(name, dir) {
|
|
|
96096
96105
|
return allOpenAiCompatProviders(dir).find((p) => p.name === name);
|
|
96097
96106
|
}
|
|
96098
96107
|
function connectionProviderByName(name, dir) {
|
|
96099
|
-
|
|
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;
|
|
96100
96114
|
}
|
|
96101
96115
|
function customCompatProviders(dir) {
|
|
96102
96116
|
const builtinNames = new Set([...OPENAI_COMPAT_PROVIDERS.map((p) => p.name), "openai-codex"]);
|
|
@@ -96276,10 +96290,46 @@ async function fetchOpenAiCompatModelsDetailed(fetchFn, provider, apiKey, opts)
|
|
|
96276
96290
|
clearTimeout(timer);
|
|
96277
96291
|
}
|
|
96278
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
|
+
}
|
|
96279
96323
|
async function resolveModelsForPicker(fetchFn, provider, env = process.env, opts) {
|
|
96280
96324
|
if (provider.name === "openai-codex")
|
|
96281
96325
|
return fetchOpenAiCodexModels(fetchFn, opts);
|
|
96282
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
|
+
}
|
|
96283
96333
|
if (compat === undefined) {
|
|
96284
96334
|
return { models: [...provider.models], source: "fallback" };
|
|
96285
96335
|
}
|
|
@@ -96413,6 +96463,9 @@ async function testProviderConnection(provider, fetchFn = globalThis.fetch, env
|
|
|
96413
96463
|
refreshCatalogVersion: true,
|
|
96414
96464
|
...profiles?.dir !== undefined ? { configDir: profiles.dir } : {}
|
|
96415
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
|
+
}
|
|
96416
96469
|
const apiKey = providerApiKey(provider, envWithSavedApiKeys(env, profiles?.dir)) ?? provider.apiKey;
|
|
96417
96470
|
return fetchOpenAiCompatModelsDetailed(fetchFn, provider, apiKey, {
|
|
96418
96471
|
timeoutMs: MODELS_FETCH_TIMEOUT_MS,
|
|
@@ -96437,7 +96490,7 @@ function classifyProviderConnection(name, env = process.env, dir) {
|
|
|
96437
96490
|
return { kind: "oauth-grant", ...envKey !== undefined ? { envKey } : {}, sharedWith };
|
|
96438
96491
|
}
|
|
96439
96492
|
const registry = providerByName(name, dir);
|
|
96440
|
-
const envKey = registry?.envKey;
|
|
96493
|
+
const envKey = registry?.envKey ?? (name === "anthropic" ? "ANTHROPIC_API_KEY" : undefined);
|
|
96441
96494
|
if (envKey === undefined) {
|
|
96442
96495
|
return { kind: "no-credential", sharedWith: [] };
|
|
96443
96496
|
}
|
|
@@ -96811,7 +96864,7 @@ auth.json only (no revoke call), and a saved API key simply stops being read \u2
|
|
|
96811
96864
|
the key itself is still valid until you revoke it yourself with the vendor.
|
|
96812
96865
|
`);
|
|
96813
96866
|
}
|
|
96814
|
-
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;
|
|
96815
96868
|
var init_providers = __esm(() => {
|
|
96816
96869
|
init_provider_config();
|
|
96817
96870
|
init_catalog3();
|
|
@@ -96940,6 +96993,14 @@ var init_providers = __esm(() => {
|
|
|
96940
96993
|
note: "Copilot \xB7 device login"
|
|
96941
96994
|
}
|
|
96942
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
|
+
};
|
|
96943
97004
|
});
|
|
96944
97005
|
|
|
96945
97006
|
// src/harness/provider/tool-call-linking.ts
|
|
@@ -209678,6 +209739,13 @@ async function filterConnectedDetectedProviders(detected, options = {}) {
|
|
|
209678
209739
|
}
|
|
209679
209740
|
const registry = providerByName(prov.name, options.configDir);
|
|
209680
209741
|
if (registry === undefined) {
|
|
209742
|
+
if (prov.name === "anthropic") {
|
|
209743
|
+
const key = prov.envKey ?? "ANTHROPIC_API_KEY";
|
|
209744
|
+
const have = env[key] ?? loadShellConfig(options.configDir).apiKeys?.[key];
|
|
209745
|
+
if (have !== undefined && have.length > 0)
|
|
209746
|
+
connected.push(prov);
|
|
209747
|
+
continue;
|
|
209748
|
+
}
|
|
209681
209749
|
connected.push(prov);
|
|
209682
209750
|
continue;
|
|
209683
209751
|
}
|
|
@@ -295564,7 +295632,7 @@ var init_native_coverage_generated = __esm(() => {
|
|
|
295564
295632
|
registryDigest: "286041ef4394afd4de97b4da37e31ccb2728c485cd32488c737a2686c244fbca",
|
|
295565
295633
|
contractDigest: "8facd34c5ca8aa53c36146c5b43c4c13dcb306c8a2882dcf2ce4e1afc171cc56",
|
|
295566
295634
|
subjectCatalogueDigest: "470b81d96a56f829db39733fc49d2927fc93f6452d22ef509927540d39efb41d",
|
|
295567
|
-
inventoryDigest: "
|
|
295635
|
+
inventoryDigest: "16afb40037d0495d63fb5cfcfab2ee122708c1a9f4cd44d2b937afef562e8a8c",
|
|
295568
295636
|
releaseReady: true,
|
|
295569
295637
|
counts: {
|
|
295570
295638
|
registeredCommands: 74,
|
|
@@ -295842,7 +295910,7 @@ var init_native_coverage_generated = __esm(() => {
|
|
|
295842
295910
|
"workspace.navigate"
|
|
295843
295911
|
],
|
|
295844
295912
|
otherBlockers: [],
|
|
295845
|
-
descriptorDigest: "
|
|
295913
|
+
descriptorDigest: "19193bd19942f48a9ab05bbb92d495df649451b84e3cdd5c14018e16e27ec346"
|
|
295846
295914
|
};
|
|
295847
295915
|
});
|
|
295848
295916
|
|
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": {
|