@cortexkit/anthropic-auth-core 2.16.1 → 2.16.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/dist/index.js
CHANGED
|
@@ -3673,22 +3673,22 @@ function credentialTypeOf(row, family) {
|
|
|
3673
3673
|
return notMine;
|
|
3674
3674
|
if ("classify" in family) {
|
|
3675
3675
|
const metadata = rowFactsOf(row);
|
|
3676
|
-
let
|
|
3676
|
+
let type2;
|
|
3677
3677
|
switch (metadata.authMethod) {
|
|
3678
3678
|
case "apikey":
|
|
3679
|
-
|
|
3679
|
+
type2 = "api_key";
|
|
3680
3680
|
break;
|
|
3681
3681
|
case "chatgpt":
|
|
3682
3682
|
case "antigravity":
|
|
3683
3683
|
case "oauth":
|
|
3684
|
-
|
|
3684
|
+
type2 = "oauth";
|
|
3685
3685
|
break;
|
|
3686
3686
|
default:
|
|
3687
3687
|
return { kind: "refused", code: "unknown-auth-method" };
|
|
3688
3688
|
}
|
|
3689
3689
|
const facts = {
|
|
3690
3690
|
credentialId: row.id,
|
|
3691
|
-
credentialType:
|
|
3691
|
+
credentialType: type2,
|
|
3692
3692
|
categories: row.categories,
|
|
3693
3693
|
refreshAdapter: row.refreshAdapter,
|
|
3694
3694
|
...metadata
|
|
@@ -3700,24 +3700,37 @@ function credentialTypeOf(row, family) {
|
|
|
3700
3700
|
if (result.kind === "not-mine")
|
|
3701
3701
|
return notMine;
|
|
3702
3702
|
if (result.kind === "mine" && typeof result.member === "string")
|
|
3703
|
-
return { kind: "mine", type, member: result.member };
|
|
3703
|
+
return { kind: "mine", type: type2, member: result.member };
|
|
3704
3704
|
if (result.kind === "refused" && typeof result.code === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(result.code) && !result.code.includes(`
|
|
3705
3705
|
`) && family.refusalCodes.includes(result.code))
|
|
3706
3706
|
return { kind: "refused", code: result.code };
|
|
3707
3707
|
} catch {}
|
|
3708
3708
|
return { kind: "refused", code: "unclassified" };
|
|
3709
3709
|
}
|
|
3710
|
-
|
|
3710
|
+
const type = row.credentialType;
|
|
3711
|
+
if (type === "oauth") {
|
|
3712
|
+
if (row.refreshAdapter !== family.refreshAdapter)
|
|
3713
|
+
return notMine;
|
|
3714
|
+
} else if (type === "api_key") {
|
|
3715
|
+
if (!family.apiKeys || row.refreshAdapter !== undefined)
|
|
3716
|
+
return notMine;
|
|
3717
|
+
} else {
|
|
3711
3718
|
return notMine;
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
if (
|
|
3715
|
-
|
|
3716
|
-
|
|
3719
|
+
}
|
|
3720
|
+
const { authMethod } = rowFactsOf(row, { includeProviderIds: false });
|
|
3721
|
+
if (authMethod !== undefined) {
|
|
3722
|
+
const matchesType = type === "oauth" ? authMethod === "chatgpt" || authMethod === "antigravity" || authMethod === "oauth" : authMethod === "apikey";
|
|
3723
|
+
if (!matchesType)
|
|
3724
|
+
return { kind: "refused", code: "unknown-auth-method" };
|
|
3725
|
+
}
|
|
3726
|
+
return { kind: "mine", type };
|
|
3717
3727
|
}
|
|
3718
|
-
function rowFactsOf(row) {
|
|
3728
|
+
function rowFactsOf(row, { includeProviderIds = true } = {}) {
|
|
3719
3729
|
const metadata = row;
|
|
3720
|
-
return {
|
|
3730
|
+
return {
|
|
3731
|
+
providerIds: includeProviderIds ? metadata.providerIds : undefined,
|
|
3732
|
+
authMethod: metadata.authMethod
|
|
3733
|
+
};
|
|
3721
3734
|
}
|
|
3722
3735
|
function grantReachOf(listed) {
|
|
3723
3736
|
const { grants, grantTuples } = listed;
|
|
@@ -4013,14 +4026,15 @@ class ClaustrumScopedCustody {
|
|
|
4013
4026
|
for (const record2 of skipped)
|
|
4014
4027
|
this.#logger.warn("skipped malformed vault record", record2);
|
|
4015
4028
|
const grantReach = grantReachOf(inventory);
|
|
4029
|
+
const classifying = "classify" in this.#family;
|
|
4016
4030
|
return {
|
|
4017
4031
|
view: inventory.view,
|
|
4018
4032
|
credentials: Object.freeze(credentials),
|
|
4019
4033
|
skipped: Object.freeze(skipped),
|
|
4020
|
-
...
|
|
4021
|
-
refused: Object.freeze(refused)
|
|
4022
|
-
notMine
|
|
4034
|
+
...(classifying || refused.length > 0) && {
|
|
4035
|
+
refused: Object.freeze(refused)
|
|
4023
4036
|
},
|
|
4037
|
+
...classifying && { notMine },
|
|
4024
4038
|
...grantReach && { grantReach }
|
|
4025
4039
|
};
|
|
4026
4040
|
}
|
|
@@ -7362,6 +7376,9 @@ async function connectClaustrumScopedClient(options) {
|
|
|
7362
7376
|
clearTimeout(timer);
|
|
7363
7377
|
}
|
|
7364
7378
|
}
|
|
7379
|
+
// ../../node_modules/@cortexkit/common-auth/dist/routing-accessor/index.js
|
|
7380
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
7381
|
+
|
|
7365
7382
|
// ../../node_modules/@cortexkit/common-auth/dist/routing-accessor/handle.js
|
|
7366
7383
|
function routingHandle(sessionId) {
|
|
7367
7384
|
const routing = Reflect.get(globalThis, Symbol.for("cortexkit.routing"));
|
|
@@ -7502,6 +7519,39 @@ function isObject(value) {
|
|
|
7502
7519
|
function isNonEmptyString(value) {
|
|
7503
7520
|
return typeof value === "string" && value.length > 0;
|
|
7504
7521
|
}
|
|
7522
|
+
function isBoundedControlFreeString(value, maxLength) {
|
|
7523
|
+
return isNonEmptyString(value) && value.length <= maxLength && !/\p{Cc}/u.test(value);
|
|
7524
|
+
}
|
|
7525
|
+
function isRoutingCode(value) {
|
|
7526
|
+
return typeof value === "string" && /^[a-z0-9._-]{1,64}$/.test(value);
|
|
7527
|
+
}
|
|
7528
|
+
function continueExhaustion(value) {
|
|
7529
|
+
if (!isObject(value) || Array.isArray(value))
|
|
7530
|
+
return;
|
|
7531
|
+
const { accountId, credentialId, limitWindow, observedAtMs } = value;
|
|
7532
|
+
if (!isBoundedControlFreeString(accountId, 256) || !isBoundedControlFreeString(credentialId, 256) || typeof observedAtMs !== "number" || !Number.isSafeInteger(observedAtMs) || observedAtMs <= 0 || limitWindow !== "five_hour" && limitWindow !== "seven_day" && limitWindow !== "signed_out")
|
|
7533
|
+
return;
|
|
7534
|
+
const exhausted = {
|
|
7535
|
+
account: accountId,
|
|
7536
|
+
credential_id: credentialId,
|
|
7537
|
+
limit_window: limitWindow,
|
|
7538
|
+
observed_at_ms: observedAtMs
|
|
7539
|
+
};
|
|
7540
|
+
if (limitWindow === "signed_out") {
|
|
7541
|
+
if ("pool" in value || "resetsAtMs" in value || "retryAfterS" in value)
|
|
7542
|
+
return;
|
|
7543
|
+
return exhausted;
|
|
7544
|
+
}
|
|
7545
|
+
const { pool, resetsAtMs, retryAfterS } = value;
|
|
7546
|
+
if (pool !== undefined && !isRoutingCode(pool) || resetsAtMs !== undefined && (typeof resetsAtMs !== "number" || !Number.isSafeInteger(resetsAtMs) || resetsAtMs <= 0) || retryAfterS !== undefined && (typeof retryAfterS !== "number" || !Number.isFinite(retryAfterS) || retryAfterS < 0))
|
|
7547
|
+
return;
|
|
7548
|
+
return {
|
|
7549
|
+
...exhausted,
|
|
7550
|
+
...pool !== undefined ? { pool } : {},
|
|
7551
|
+
...resetsAtMs !== undefined ? { resets_at_ms: resetsAtMs } : {},
|
|
7552
|
+
...retryAfterS !== undefined ? { retry_after_s: Math.floor(retryAfterS) } : {}
|
|
7553
|
+
};
|
|
7554
|
+
}
|
|
7505
7555
|
function billingCache(value) {
|
|
7506
7556
|
if (!isObject(value) || Array.isArray(value))
|
|
7507
7557
|
return;
|
|
@@ -7582,6 +7632,22 @@ function turnNotes(sessionId) {
|
|
|
7582
7632
|
return [];
|
|
7583
7633
|
}
|
|
7584
7634
|
}
|
|
7635
|
+
function candidateView(candidates) {
|
|
7636
|
+
const accounts = [];
|
|
7637
|
+
for (const { accountId, credentialId } of candidates) {
|
|
7638
|
+
if (isNonEmptyString(accountId) && isBoundedControlFreeString(credentialId, 256)) {
|
|
7639
|
+
accounts.push({ account_id: accountId, credential_id: credentialId });
|
|
7640
|
+
}
|
|
7641
|
+
}
|
|
7642
|
+
if (accounts.length === 0)
|
|
7643
|
+
return;
|
|
7644
|
+
const lines = accounts.map(({ account_id, credential_id }) => Buffer.from(`${account_id} ${credential_id}
|
|
7645
|
+
`, "utf8")).sort(Buffer.compare);
|
|
7646
|
+
const hash2 = createHash4("sha256");
|
|
7647
|
+
for (const line of lines)
|
|
7648
|
+
hash2.update(line);
|
|
7649
|
+
return { view_digest: hash2.digest("hex"), accounts };
|
|
7650
|
+
}
|
|
7585
7651
|
function selectionFor(answer, candidates) {
|
|
7586
7652
|
if (!isObject(answer))
|
|
7587
7653
|
return;
|
|
@@ -7610,10 +7676,11 @@ function refusalFor(value) {
|
|
|
7610
7676
|
return;
|
|
7611
7677
|
}
|
|
7612
7678
|
const refused = { code };
|
|
7613
|
-
const routingCode = value
|
|
7614
|
-
if (
|
|
7679
|
+
const { routing_code: routingCode, reason } = value;
|
|
7680
|
+
if (isRoutingCode(routingCode))
|
|
7615
7681
|
refused.routingCode = routingCode;
|
|
7616
|
-
|
|
7682
|
+
if (isRoutingCode(reason))
|
|
7683
|
+
refused.reason = reason;
|
|
7617
7684
|
const retryAfterSecs = value.retry_after_secs;
|
|
7618
7685
|
if (typeof retryAfterSecs === "number" && Number.isFinite(retryAfterSecs) && retryAfterSecs >= 0) {
|
|
7619
7686
|
refused.retryAfterSecs = retryAfterSecs;
|
|
@@ -7627,6 +7694,21 @@ function refusalFor(value) {
|
|
|
7627
7694
|
async function askRouting(input) {
|
|
7628
7695
|
let timer;
|
|
7629
7696
|
try {
|
|
7697
|
+
const request2 = {
|
|
7698
|
+
provider: input.provider,
|
|
7699
|
+
modelId: input.modelId
|
|
7700
|
+
};
|
|
7701
|
+
if (input.mode === "continue") {
|
|
7702
|
+
const { requestId } = input;
|
|
7703
|
+
if (!isBoundedControlFreeString(requestId, 128))
|
|
7704
|
+
return;
|
|
7705
|
+
const exhausted = continueExhaustion(input.exhausted);
|
|
7706
|
+
if (!exhausted)
|
|
7707
|
+
return;
|
|
7708
|
+
request2.mode = "continue";
|
|
7709
|
+
request2.request_id = requestId;
|
|
7710
|
+
request2.exhausted = exhausted;
|
|
7711
|
+
}
|
|
7630
7712
|
const handle = routingHandle(input.sessionId);
|
|
7631
7713
|
if (!handle)
|
|
7632
7714
|
return;
|
|
@@ -7639,10 +7721,6 @@ async function askRouting(input) {
|
|
|
7639
7721
|
timer = setTimeout(() => resolve12(undefined), deadlineMs);
|
|
7640
7722
|
timer.unref();
|
|
7641
7723
|
});
|
|
7642
|
-
const request2 = {
|
|
7643
|
-
provider: input.provider,
|
|
7644
|
-
modelId: input.modelId
|
|
7645
|
-
};
|
|
7646
7724
|
const cap = input.holdWaitMaxS;
|
|
7647
7725
|
if (typeof cap === "number" && Number.isFinite(cap)) {
|
|
7648
7726
|
request2.hold_wait_max_s = Math.max(0, Math.floor(cap));
|
|
@@ -7650,9 +7728,12 @@ async function askRouting(input) {
|
|
|
7650
7728
|
if (input.refusals === true)
|
|
7651
7729
|
request2.refusals = true;
|
|
7652
7730
|
const warmCredentialId = input.warmCredentialId;
|
|
7653
|
-
if (
|
|
7731
|
+
if (isBoundedControlFreeString(warmCredentialId, 256) && input.candidates.some((candidate) => candidate.credentialId === warmCredentialId)) {
|
|
7654
7732
|
request2.warm_credential = warmCredentialId;
|
|
7655
7733
|
}
|
|
7734
|
+
const candidates = candidateView(input.candidates);
|
|
7735
|
+
if (candidates)
|
|
7736
|
+
request2.candidates = candidates;
|
|
7656
7737
|
const pending = accountFor.call(handle, request2, { deadlineMs });
|
|
7657
7738
|
if (!isObject(pending) || typeof pending.then !== "function")
|
|
7658
7739
|
return;
|
|
@@ -7679,6 +7760,19 @@ function reportRouting(input) {
|
|
|
7679
7760
|
let payload;
|
|
7680
7761
|
if ("kind" in input) {
|
|
7681
7762
|
switch (input.kind) {
|
|
7763
|
+
case "transient_backoff": {
|
|
7764
|
+
const { accountId, credentialId, retryAtMs, providerCode } = input;
|
|
7765
|
+
if (!isNonEmptyString(sessionId) || !isNonEmptyString(accountId) || !Number.isSafeInteger(retryAtMs) || retryAtMs <= 0 || credentialId !== undefined && !isBoundedControlFreeString(credentialId, 256) || providerCode !== undefined && !isBoundedControlFreeString(providerCode, 128))
|
|
7766
|
+
return;
|
|
7767
|
+
payload = {
|
|
7768
|
+
kind: "transient_backoff",
|
|
7769
|
+
account_id: accountId,
|
|
7770
|
+
...credentialId !== undefined ? { credential_id: credentialId } : {},
|
|
7771
|
+
retry_at_ms: retryAtMs,
|
|
7772
|
+
...providerCode !== undefined ? { provider_code: providerCode } : {}
|
|
7773
|
+
};
|
|
7774
|
+
break;
|
|
7775
|
+
}
|
|
7682
7776
|
case "wait": {
|
|
7683
7777
|
const { phase, waitId, reason, nextMs, attempt, message, outcome } = input;
|
|
7684
7778
|
if (!isNonEmptyString(sessionId) || phase !== "start" && phase !== "end" || !isNonEmptyString(waitId) || waitId.length > 64 || /[^A-Za-z0-9._:-]/.test(waitId) || !PLUGIN_WAIT_REASONS.includes(reason))
|
|
@@ -7774,7 +7868,7 @@ function reportRouting(input) {
|
|
|
7774
7868
|
const { window, pool } = input;
|
|
7775
7869
|
if (window !== "5h" && window !== "7d")
|
|
7776
7870
|
return;
|
|
7777
|
-
if (pool !== undefined && (
|
|
7871
|
+
if (pool !== undefined && !isRoutingCode(pool))
|
|
7778
7872
|
return;
|
|
7779
7873
|
payload = {
|
|
7780
7874
|
...identity2,
|
|
@@ -8551,6 +8645,7 @@ import { writeEnrollmentTokenFile as writeEnrollmentTokenFile2 } from "@cortexki
|
|
|
8551
8645
|
import { statSync as statSync3 } from "node:fs";
|
|
8552
8646
|
import { win32 as win322 } from "node:path";
|
|
8553
8647
|
var WINDOWS_CIM_TIMEOUT_MS = 45000;
|
|
8648
|
+
var log = createLogger("setup-process-fence");
|
|
8554
8649
|
var WINDOWS_ARM_POWERSHELL_TIMEOUT_MS = 90000;
|
|
8555
8650
|
function isFile(file) {
|
|
8556
8651
|
try {
|
|
@@ -8713,14 +8808,23 @@ async function listSetupProcesses(runner = defaultCommandRunner, options = {}) {
|
|
|
8713
8808
|
options.onStep?.({ ...inspection });
|
|
8714
8809
|
}
|
|
8715
8810
|
};
|
|
8716
|
-
const inspectCim = (args) => {
|
|
8811
|
+
const inspectCim = async (args) => {
|
|
8717
8812
|
const pwsh = win322.resolve(windowsEnv(env, "ProgramFiles") ?? "C:\\Program Files", "PowerShell", "7", "pwsh.exe");
|
|
8718
8813
|
const program = (options.isFile ?? isFile)(pwsh) ? "pwsh" : "powershell";
|
|
8719
8814
|
const arm64 = (windowsEnv(env, "PROCESSOR_ARCHITEW6432") ?? windowsEnv(env, "PROCESSOR_ARCHITECTURE"))?.toUpperCase() === "ARM64";
|
|
8720
8815
|
const slow = program === "powershell" && arm64;
|
|
8721
8816
|
if (slow)
|
|
8722
8817
|
options.onProgress?.("Checking that OpenCode and Pi are not running. Without PowerShell 7 this can take up to a minute on Windows ARM; installing PowerShell 7 makes it fast.");
|
|
8723
|
-
|
|
8818
|
+
const file = program === "pwsh" ? pwsh : win322.resolve(system32, "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
8819
|
+
const timeoutMs = slow ? WINDOWS_ARM_POWERSHELL_TIMEOUT_MS : WINDOWS_CIM_TIMEOUT_MS;
|
|
8820
|
+
const started = performance.now();
|
|
8821
|
+
const result = await inspect("CIM", file, args, timeoutMs, program);
|
|
8822
|
+
const remaining = Math.floor(timeoutMs - (performance.now() - started));
|
|
8823
|
+
if ((result.exitCode === 3221225477 || result.exitCode === -1073741819) && !result.timedOut && !result.signal && !result.spawnError && remaining > 0) {
|
|
8824
|
+
log.warn("Windows process query crashed with an access violation; retrying once");
|
|
8825
|
+
return inspect("CIM", file, args, remaining, program);
|
|
8826
|
+
}
|
|
8827
|
+
return result;
|
|
8724
8828
|
};
|
|
8725
8829
|
try {
|
|
8726
8830
|
if (windows && options.hostImagesOnly) {
|
|
@@ -9622,7 +9726,7 @@ ${write.content}`);
|
|
|
9622
9726
|
return { hosts, dryRun: options.dryRun, mode, detection };
|
|
9623
9727
|
}
|
|
9624
9728
|
// src/accounts.ts
|
|
9625
|
-
import { createHash as
|
|
9729
|
+
import { createHash as createHash5, randomUUID as randomUUID8 } from "node:crypto";
|
|
9626
9730
|
import { mkdir as mkdir6, readFile as readFile7, rename as rename8, rm as rm4, stat as stat10, writeFile } from "node:fs/promises";
|
|
9627
9731
|
import { homedir as homedir3 } from "node:os";
|
|
9628
9732
|
import { join as join13 } from "node:path";
|
|
@@ -11912,7 +12016,7 @@ async function exists(path) {
|
|
|
11912
12016
|
throw error;
|
|
11913
12017
|
}
|
|
11914
12018
|
}
|
|
11915
|
-
function
|
|
12019
|
+
function log2(options, level, message, data) {
|
|
11916
12020
|
try {
|
|
11917
12021
|
options.log[level](message, data);
|
|
11918
12022
|
} catch {}
|
|
@@ -11982,7 +12086,7 @@ function merge(options, legacy, mapped, result) {
|
|
|
11982
12086
|
}));
|
|
11983
12087
|
if (values.some(({ host, value }) => !isDeepStrictEqual2(hosts.has(host) ? hosts.get(host) : primary.value, value))) {
|
|
11984
12088
|
result.differing.push({ setting, values });
|
|
11985
|
-
|
|
12089
|
+
log2(options, "info", `Differing legacy settings: ${setting}`, { values });
|
|
11986
12090
|
}
|
|
11987
12091
|
}
|
|
11988
12092
|
return document;
|
|
@@ -12019,7 +12123,7 @@ A rollback loses changes made after the move.
|
|
|
12019
12123
|
}
|
|
12020
12124
|
} catch (error) {
|
|
12021
12125
|
result.noteFailures.push({ path, error });
|
|
12022
|
-
|
|
12126
|
+
log2(options, "warn", "Could not write settings move note", {
|
|
12023
12127
|
path,
|
|
12024
12128
|
error
|
|
12025
12129
|
});
|
|
@@ -12064,7 +12168,7 @@ ${JSON.stringify(document, null, 2)}
|
|
|
12064
12168
|
staged = false;
|
|
12065
12169
|
} catch (error) {
|
|
12066
12170
|
result.postPublishFailures.push({ step: "temp-unlink", error });
|
|
12067
|
-
|
|
12171
|
+
log2(options, "warn", "Settings move temp cleanup failed", { temp, error });
|
|
12068
12172
|
}
|
|
12069
12173
|
if (process.platform !== "win32") {
|
|
12070
12174
|
try {
|
|
@@ -12076,7 +12180,7 @@ ${JSON.stringify(document, null, 2)}
|
|
|
12076
12180
|
}
|
|
12077
12181
|
} catch (error) {
|
|
12078
12182
|
result.postPublishFailures.push({ step: "directory-sync", error });
|
|
12079
|
-
|
|
12183
|
+
log2(options, "warn", "Settings move directory sync failed", {
|
|
12080
12184
|
target,
|
|
12081
12185
|
error
|
|
12082
12186
|
});
|
|
@@ -12184,7 +12288,7 @@ async function moveSettingsOnce(options) {
|
|
|
12184
12288
|
if (settled.outcome === "moved") {
|
|
12185
12289
|
settled.postPublishFailures.push({ step: "lock-release", error });
|
|
12186
12290
|
}
|
|
12187
|
-
|
|
12291
|
+
log2(options, "warn", "Settings move lock release failed", { error });
|
|
12188
12292
|
return settled;
|
|
12189
12293
|
}
|
|
12190
12294
|
} catch (cause) {
|
|
@@ -12806,7 +12910,7 @@ function getRefreshIntervalMs(storage) {
|
|
|
12806
12910
|
return Math.max(1, minutes) * 60000;
|
|
12807
12911
|
}
|
|
12808
12912
|
function hashRefreshToken(refreshToken) {
|
|
12809
|
-
return
|
|
12913
|
+
return createHash5("sha256").update(refreshToken).digest("hex");
|
|
12810
12914
|
}
|
|
12811
12915
|
function isTransientRefreshError(error) {
|
|
12812
12916
|
const status = error.status;
|
|
@@ -13111,7 +13215,7 @@ function quotaRefusalTiming(input) {
|
|
|
13111
13215
|
}
|
|
13112
13216
|
const earliest = resetTimes.sort((a, b) => a.resetAt - b.resetAt)[0];
|
|
13113
13217
|
const resetAt = earliest?.resetAt;
|
|
13114
|
-
const resetWaitMs = input.waitForReset && getWaitForReset(storage) && resetAt !== undefined && input.readings.length > 0 && resetTimes.length === input.readings.length ? (Math.ceil((resetAt - now) / 1000) +
|
|
13218
|
+
const resetWaitMs = input.waitForReset && getWaitForReset(storage) && resetAt !== undefined && input.readings.length > 0 && resetTimes.length === input.readings.length ? (Math.ceil((resetAt - now) / 1000) + createHash5("sha256").update(input.sessionId ?? "").digest().readUInt32BE(0) % 21) * 1000 : undefined;
|
|
13115
13219
|
return {
|
|
13116
13220
|
resetAt,
|
|
13117
13221
|
...resetWaitMs === undefined ? {} : { resetWaitMs },
|
|
@@ -13570,7 +13674,7 @@ function scheduleFlush() {
|
|
|
13570
13674
|
}, FLUSH_INTERVAL_MS);
|
|
13571
13675
|
}
|
|
13572
13676
|
var CHANNEL_REGEX = /^\[([\w-]+)\]\s*/;
|
|
13573
|
-
function
|
|
13677
|
+
function log3(message, data) {
|
|
13574
13678
|
if (!shouldEmit("debug"))
|
|
13575
13679
|
return;
|
|
13576
13680
|
if (isTestEnv)
|
|
@@ -14372,7 +14476,7 @@ function executeCache1hCommand(input) {
|
|
|
14372
14476
|
}
|
|
14373
14477
|
// src/cachekeep.ts
|
|
14374
14478
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
|
|
14375
|
-
import { createHash as
|
|
14479
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
14376
14480
|
|
|
14377
14481
|
// ../../node_modules/@cortexkit/common-auth/dist/cachekeep/decision.js
|
|
14378
14482
|
function withinHours(hours, at) {
|
|
@@ -15089,7 +15193,7 @@ class CacheKeepManager {
|
|
|
15089
15193
|
}
|
|
15090
15194
|
}
|
|
15091
15195
|
// src/claustrum-enrollment.ts
|
|
15092
|
-
import { createHash as
|
|
15196
|
+
import { createHash as createHash7, randomBytes as randomBytes2, randomUUID as randomUUID10 } from "node:crypto";
|
|
15093
15197
|
import { constants as fsConstants2 } from "node:fs";
|
|
15094
15198
|
import {
|
|
15095
15199
|
chmod as chmod2,
|
|
@@ -15250,7 +15354,7 @@ async function ensureWindowsOwnerOnlyDirectory(path2, options = {}) {
|
|
|
15250
15354
|
}
|
|
15251
15355
|
|
|
15252
15356
|
// src/state-layout-paths.ts
|
|
15253
|
-
import { createHash as
|
|
15357
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
15254
15358
|
import { realpathSync as realpathSync3 } from "node:fs";
|
|
15255
15359
|
import { open as open7 } from "node:fs/promises";
|
|
15256
15360
|
import { homedir as homedir4 } from "node:os";
|
|
@@ -15301,7 +15405,7 @@ function homeDefaultConfigDir(home = homedir4(), pathApi = nodePath) {
|
|
|
15301
15405
|
function stateSubfolderName(identity4, homeDefaultIdentity) {
|
|
15302
15406
|
if (identity4 === homeDefaultIdentity)
|
|
15303
15407
|
return "opencode";
|
|
15304
|
-
const hash2 =
|
|
15408
|
+
const hash2 = createHash6("sha256").update(identity4).digest("hex");
|
|
15305
15409
|
return `opencode-${hash2.slice(0, 16)}`;
|
|
15306
15410
|
}
|
|
15307
15411
|
function resolveStateHomeTarget(options = {}) {
|
|
@@ -15870,7 +15974,7 @@ class ClaustrumEnrollmentManager2 {
|
|
|
15870
15974
|
}
|
|
15871
15975
|
if (!state.requestId) {
|
|
15872
15976
|
try {
|
|
15873
|
-
const requestSecretHash =
|
|
15977
|
+
const requestSecretHash = createHash7("sha256").update(Buffer.from(state.requestSecret, "hex")).digest("hex");
|
|
15874
15978
|
const proposed = await this.#client.enrollPropose({
|
|
15875
15979
|
name: state.proposedName,
|
|
15876
15980
|
requestSecretHash
|
|
@@ -16669,7 +16773,7 @@ class CacheKeepPrewarmError extends Error {
|
|
|
16669
16773
|
}
|
|
16670
16774
|
|
|
16671
16775
|
// src/cch.ts
|
|
16672
|
-
import { createHash as
|
|
16776
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
16673
16777
|
import xxhashInit from "xxhash-wasm";
|
|
16674
16778
|
var ANTHROPIC_REQUEST_ID_PATTERN = /^req_[A-Za-z0-9_-]{8,128}$/;
|
|
16675
16779
|
var PROMPT_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -16779,7 +16883,7 @@ async function signRequestBody(bodyString) {
|
|
|
16779
16883
|
}
|
|
16780
16884
|
function computeCcVersionSuffix(firstUserText, version = CLAUDE_CODE_VERSION) {
|
|
16781
16885
|
const sampledText = CCH_POSITIONS.map((position) => firstUserText[position] ?? "0").join("");
|
|
16782
|
-
return
|
|
16886
|
+
return createHash8("sha256").update(`${CCH_SALT}${sampledText}${version}`).digest("hex").slice(0, 3);
|
|
16783
16887
|
}
|
|
16784
16888
|
function countUserPrompts(messages) {
|
|
16785
16889
|
if (!Array.isArray(messages))
|
|
@@ -17263,7 +17367,7 @@ function claudeCodeEntrypoint() {
|
|
|
17263
17367
|
}
|
|
17264
17368
|
|
|
17265
17369
|
// src/dump.ts
|
|
17266
|
-
import { createHash as
|
|
17370
|
+
import { createHash as createHash9, randomBytes as randomBytes4 } from "node:crypto";
|
|
17267
17371
|
import {
|
|
17268
17372
|
lstat as lstat6,
|
|
17269
17373
|
mkdir as mkdir8,
|
|
@@ -18071,7 +18175,7 @@ function headersToRecord(headers) {
|
|
|
18071
18175
|
return Object.fromEntries(new Headers(headers).entries());
|
|
18072
18176
|
}
|
|
18073
18177
|
function hashText(value) {
|
|
18074
|
-
return
|
|
18178
|
+
return createHash9("sha256").update(value).digest("hex");
|
|
18075
18179
|
}
|
|
18076
18180
|
function cchToken(bodyText) {
|
|
18077
18181
|
return extractBillingHeaderCCH(bodyText);
|
|
@@ -20337,7 +20441,7 @@ function cacheWarmCacheablePrefixFingerprint(bodyText) {
|
|
|
20337
20441
|
system,
|
|
20338
20442
|
messages: messages.slice(0, lastBreakpoint + 1)
|
|
20339
20443
|
});
|
|
20340
|
-
return
|
|
20444
|
+
return createHash10("sha256").update(JSON.stringify(prefix)).digest("hex");
|
|
20341
20445
|
}
|
|
20342
20446
|
function cacheKeepSourceWarmIdleCap(modelId) {
|
|
20343
20447
|
let pricing;
|
|
@@ -21876,16 +21980,16 @@ function observeNativeLocks(acquire, observer) {
|
|
|
21876
21980
|
}
|
|
21877
21981
|
|
|
21878
21982
|
// src/native-vault-paths.ts
|
|
21879
|
-
import { createHash as
|
|
21983
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
21880
21984
|
import { basename as basename12, dirname as dirname18, join as join22 } from "node:path";
|
|
21881
21985
|
|
|
21882
21986
|
// src/pool-paths.ts
|
|
21883
|
-
import { createHash as
|
|
21987
|
+
import { createHash as createHash19 } from "node:crypto";
|
|
21884
21988
|
import * as fsPromises from "node:fs/promises";
|
|
21885
21989
|
import { basename as basename11, dirname as dirname17, join as join21 } from "node:path";
|
|
21886
21990
|
|
|
21887
21991
|
// src/sticky-routing.ts
|
|
21888
|
-
import { createHash as
|
|
21992
|
+
import { createHash as createHash18, randomUUID as randomUUID15 } from "node:crypto";
|
|
21889
21993
|
import { mkdir as mkdir10, readFile as readFile11, rename as rename13, rm as rm6, stat as stat12, writeFile as writeFile3 } from "node:fs/promises";
|
|
21890
21994
|
import { basename as basename10, dirname as dirname16, join as join20 } from "node:path";
|
|
21891
21995
|
|
|
@@ -21893,7 +21997,7 @@ import { basename as basename10, dirname as dirname16, join as join20 } from "no
|
|
|
21893
21997
|
import { lstat as lstat9, readFile as readFile10 } from "node:fs/promises";
|
|
21894
21998
|
|
|
21895
21999
|
// src/native-migration-source.ts
|
|
21896
|
-
import { createHash as
|
|
22000
|
+
import { createHash as createHash17 } from "node:crypto";
|
|
21897
22001
|
|
|
21898
22002
|
// ../../node_modules/@cortexkit/common-auth/dist/store/errors.js
|
|
21899
22003
|
class PoolOperationError extends Error {
|
|
@@ -22018,7 +22122,7 @@ function assertNotReserved(operation, id, reservation) {
|
|
|
22018
22122
|
}
|
|
22019
22123
|
|
|
22020
22124
|
// ../../node_modules/@cortexkit/common-auth/dist/store/schema.js
|
|
22021
|
-
import { createHash as
|
|
22125
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
22022
22126
|
var POOL_KEY = "commonAuthPool";
|
|
22023
22127
|
var POOL_SCHEMA_VERSION = 1;
|
|
22024
22128
|
var POOL_ROWS_KEY = "rows";
|
|
@@ -22038,7 +22142,7 @@ function canonicalJson2(value) {
|
|
|
22038
22142
|
return encode(normalized);
|
|
22039
22143
|
}
|
|
22040
22144
|
function canonicalDigest(value) {
|
|
22041
|
-
return
|
|
22145
|
+
return createHash11("sha256").update(canonicalJson2(value)).digest("hex");
|
|
22042
22146
|
}
|
|
22043
22147
|
function parseReservation(raw) {
|
|
22044
22148
|
if (!isRecord11(raw) || Object.keys(raw).length !== 1 || typeof raw.reservation !== "string" || !raw.reservation)
|
|
@@ -22085,10 +22189,10 @@ function secretOf(credential) {
|
|
|
22085
22189
|
return credential.type === "oauth" ? `oauth\x00${credential.refresh}` : `api\x00${credential.apiKey}`;
|
|
22086
22190
|
}
|
|
22087
22191
|
function fingerprintOf(credential) {
|
|
22088
|
-
return
|
|
22192
|
+
return createHash11("sha256").update(secretOf(credential)).digest("hex");
|
|
22089
22193
|
}
|
|
22090
22194
|
function credentialDigest(credential) {
|
|
22091
|
-
return
|
|
22195
|
+
return createHash11("sha256").update(`credential-stamp\x00${secretOf(credential)}`).digest("hex");
|
|
22092
22196
|
}
|
|
22093
22197
|
function dispatchDigest(credential) {
|
|
22094
22198
|
const parts = credential.type === "oauth" ? [
|
|
@@ -22102,7 +22206,7 @@ function dispatchDigest(credential) {
|
|
|
22102
22206
|
credential.baseURL.trim(),
|
|
22103
22207
|
credential.authHeader ?? "authorization-bearer"
|
|
22104
22208
|
];
|
|
22105
|
-
return
|
|
22209
|
+
return createHash11("sha256").update(`credential-dispatch\x00${JSON.stringify(parts)}`).digest("hex");
|
|
22106
22210
|
}
|
|
22107
22211
|
function stampFor(credential, credentialEpoch, binding, options = {}) {
|
|
22108
22212
|
return {
|
|
@@ -22116,7 +22220,7 @@ function stampFor(credential, credentialEpoch, binding, options = {}) {
|
|
|
22116
22220
|
}
|
|
22117
22221
|
function providerStateDigest(codec, value) {
|
|
22118
22222
|
const bound = codec?.credentialBound ? runInsideCodec(() => codec.credentialBound?.(value)) : value;
|
|
22119
|
-
return
|
|
22223
|
+
return createHash11("sha256").update(`provider-state\x00${JSON.stringify(bound ?? null)}`).digest("hex");
|
|
22120
22224
|
}
|
|
22121
22225
|
function boundProviderStateDigest(account, credential, credentialEpoch, identity4) {
|
|
22122
22226
|
if (!credential || credentialEpoch === undefined)
|
|
@@ -25234,7 +25338,7 @@ function openPoolStore(options) {
|
|
|
25234
25338
|
};
|
|
25235
25339
|
}
|
|
25236
25340
|
// src/native-host-auth.ts
|
|
25237
|
-
import { createHash as
|
|
25341
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
25238
25342
|
class NativeHostAuthError extends Error {
|
|
25239
25343
|
code;
|
|
25240
25344
|
constructor(code) {
|
|
@@ -25360,7 +25464,7 @@ function inspectNativeHostAuthEntry(host, hostAuth) {
|
|
|
25360
25464
|
}
|
|
25361
25465
|
return Object.freeze({
|
|
25362
25466
|
kind,
|
|
25363
|
-
digest:
|
|
25467
|
+
digest: createHash12("sha256").update(canonical2, "utf8").digest("hex")
|
|
25364
25468
|
});
|
|
25365
25469
|
} catch {
|
|
25366
25470
|
throw new NativeHostAuthError("invalid-source");
|
|
@@ -25368,7 +25472,7 @@ function inspectNativeHostAuthEntry(host, hostAuth) {
|
|
|
25368
25472
|
}
|
|
25369
25473
|
|
|
25370
25474
|
// src/native-migration-proof.ts
|
|
25371
|
-
import { createHash as
|
|
25475
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
25372
25476
|
import { types } from "node:util";
|
|
25373
25477
|
|
|
25374
25478
|
class NativeMigrationProofError extends Error {
|
|
@@ -25442,7 +25546,7 @@ function nativeMigrationCanonicalJson(value) {
|
|
|
25442
25546
|
return JSON.stringify(captureNativeMigrationJson(value));
|
|
25443
25547
|
}
|
|
25444
25548
|
function nativeMigrationDigest(value) {
|
|
25445
|
-
return
|
|
25549
|
+
return createHash13("sha256").update(nativeMigrationCanonicalJson(value)).digest("hex");
|
|
25446
25550
|
}
|
|
25447
25551
|
function record6(value) {
|
|
25448
25552
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -25790,7 +25894,7 @@ import { basename as basename9, dirname as dirname15, isAbsolute as isAbsolute4,
|
|
|
25790
25894
|
import { types as utilTypes5 } from "node:util";
|
|
25791
25895
|
|
|
25792
25896
|
// src/pool-binding.ts
|
|
25793
|
-
import { createHash as
|
|
25897
|
+
import { createHash as createHash14 } from "node:crypto";
|
|
25794
25898
|
|
|
25795
25899
|
class NativePoolBindingError extends Error {
|
|
25796
25900
|
constructor() {
|
|
@@ -25834,7 +25938,7 @@ function nativeLocalPoolBindingMatches(binding, paths, row) {
|
|
|
25834
25938
|
function nativeLocalRefreshJobKey(binding) {
|
|
25835
25939
|
if (!isNativeLocalPoolBinding(binding))
|
|
25836
25940
|
throw new NativePoolBindingError;
|
|
25837
|
-
return
|
|
25941
|
+
return createHash14("sha256").update(JSON.stringify([
|
|
25838
25942
|
"anthropic-local-refresh",
|
|
25839
25943
|
binding.storageId,
|
|
25840
25944
|
binding.credentialEpoch,
|
|
@@ -25843,9 +25947,9 @@ function nativeLocalRefreshJobKey(binding) {
|
|
|
25843
25947
|
}
|
|
25844
25948
|
|
|
25845
25949
|
// src/token-fingerprint.ts
|
|
25846
|
-
import { createHash as
|
|
25950
|
+
import { createHash as createHash15 } from "node:crypto";
|
|
25847
25951
|
function tokenFingerprint(token) {
|
|
25848
|
-
return
|
|
25952
|
+
return createHash15("sha256").update(token).digest("hex").slice(0, 16);
|
|
25849
25953
|
}
|
|
25850
25954
|
|
|
25851
25955
|
// src/native-credential-validation.ts
|
|
@@ -26029,7 +26133,7 @@ import { join as join18 } from "node:path";
|
|
|
26029
26133
|
|
|
26030
26134
|
// src/relay.ts
|
|
26031
26135
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
26032
|
-
import { createHash as
|
|
26136
|
+
import { createHash as createHash16, randomBytes as randomBytes5 } from "node:crypto";
|
|
26033
26137
|
var WEBSOCKET_RELAY_URL = /^wss?:\/\//i;
|
|
26034
26138
|
function effectiveRelayTransport(stored, url) {
|
|
26035
26139
|
if (stored === "http" || stored === "websocket")
|
|
@@ -26183,7 +26287,7 @@ function generateRelayToken() {
|
|
|
26183
26287
|
return randomBytes5(32).toString("base64url");
|
|
26184
26288
|
}
|
|
26185
26289
|
function hashBody(body) {
|
|
26186
|
-
return `sha256:${
|
|
26290
|
+
return `sha256:${createHash16("sha256").update(body).digest("hex")}`;
|
|
26187
26291
|
}
|
|
26188
26292
|
function createStringPatch(previous, next) {
|
|
26189
26293
|
let start = 0;
|
|
@@ -27148,7 +27252,7 @@ function websocketSessionKey(config, affinity) {
|
|
|
27148
27252
|
return JSON.stringify([
|
|
27149
27253
|
affinity,
|
|
27150
27254
|
config.url,
|
|
27151
|
-
|
|
27255
|
+
createHash16("sha256").update(config.token).digest("hex")
|
|
27152
27256
|
]);
|
|
27153
27257
|
}
|
|
27154
27258
|
function getPersistentRelaySession(config, affinity, timers) {
|
|
@@ -28866,7 +28970,7 @@ function runtime(source2, accountIdentity, current) {
|
|
|
28866
28970
|
"permanent"
|
|
28867
28971
|
]);
|
|
28868
28972
|
safe.message = field === "lastRefreshError" ? "Imported refresh failure" : "Imported quota failure";
|
|
28869
|
-
if (field === "lastRefreshError" && current?.type === "oauth" && error.tokenHash ===
|
|
28973
|
+
if (field === "lastRefreshError" && current?.type === "oauth" && error.tokenHash === createHash17("sha256").update(current.refresh).digest("hex"))
|
|
28870
28974
|
safe.credentialFingerprint = fingerprintOf(current);
|
|
28871
28975
|
result[field] = safe;
|
|
28872
28976
|
}
|
|
@@ -28890,7 +28994,7 @@ function projectNativeMigrationSource(input) {
|
|
|
28890
28994
|
const hostEntry = inspectNativeHostAuthEntry(input.host, auth);
|
|
28891
28995
|
if (config.version !== undefined && config.version !== 1 || state.version !== undefined && state.version !== 1)
|
|
28892
28996
|
refuse2();
|
|
28893
|
-
const formerMain =
|
|
28997
|
+
const formerMain = createHash17("sha256").update(JSON.stringify([input.storageId, input.configDigest, "former-main"])).digest("hex");
|
|
28894
28998
|
const mainRouteId = config.mainAccountId === undefined ? `${formerMain.slice(0, 8)}-${formerMain.slice(8, 12)}-${formerMain.slice(12, 16)}-${formerMain.slice(16, 20)}-${formerMain.slice(20, 32)}` : id(config.mainAccountId);
|
|
28895
28999
|
const settings = {
|
|
28896
29000
|
mainAccountId: mainRouteId,
|
|
@@ -29645,7 +29749,7 @@ function emptyState(now) {
|
|
|
29645
29749
|
return { version: 1, updatedAt: now, assignments: {} };
|
|
29646
29750
|
}
|
|
29647
29751
|
function sessionKey(sessionId) {
|
|
29648
|
-
return
|
|
29752
|
+
return createHash18("sha256").update(sessionId).digest("hex");
|
|
29649
29753
|
}
|
|
29650
29754
|
function stickyQuotaSnapshotIsFresh(quota2, storage, now = Date.now(), modelId) {
|
|
29651
29755
|
const maxAge = getQuotaCheckIntervalMs(storage);
|
|
@@ -29872,7 +29976,7 @@ function getStickyRoutingStatePath(accountStoragePath) {
|
|
|
29872
29976
|
return join20(dirname16(accountStoragePath), `${stem}-routing-state.json`);
|
|
29873
29977
|
}
|
|
29874
29978
|
function stickyRetryAfterWithJitter(sessionId, retryAfterSeconds) {
|
|
29875
|
-
const hash2 =
|
|
29979
|
+
const hash2 = createHash18("sha256").update(sessionId).digest().readUInt32BE(0);
|
|
29876
29980
|
return Math.max(1, Math.ceil(retryAfterSeconds)) + hash2 % 21;
|
|
29877
29981
|
}
|
|
29878
29982
|
var localRecoveries = new Map;
|
|
@@ -30199,22 +30303,23 @@ class StickySessionRouter {
|
|
|
30199
30303
|
} while (pending !== this.publicationChain);
|
|
30200
30304
|
}
|
|
30201
30305
|
selectCandidate(input) {
|
|
30202
|
-
|
|
30203
|
-
|
|
30204
|
-
|
|
30205
|
-
if (depleted.length > 0)
|
|
30206
|
-
candidates = depleted;
|
|
30207
|
-
}
|
|
30208
|
-
const weighted = candidates.flatMap((candidate) => {
|
|
30306
|
+
const { candidates } = input;
|
|
30307
|
+
const now = this.now();
|
|
30308
|
+
let weighted = candidates.flatMap((candidate) => {
|
|
30209
30309
|
const weight = stickyRouteCandidateWeight({
|
|
30210
30310
|
candidate,
|
|
30211
30311
|
family: input.family,
|
|
30212
30312
|
modelId: input.modelId,
|
|
30213
30313
|
storage: input.storage,
|
|
30214
|
-
now
|
|
30314
|
+
now
|
|
30215
30315
|
});
|
|
30216
30316
|
return weight > 0 ? [{ candidate, weight }] : [];
|
|
30217
30317
|
});
|
|
30318
|
+
if (input.family === "opus") {
|
|
30319
|
+
const depleted = weighted.filter(({ candidate }) => stickyRouteKnownFableExhausted(candidate, input.storage, now));
|
|
30320
|
+
if (depleted.length > 0)
|
|
30321
|
+
weighted = depleted;
|
|
30322
|
+
}
|
|
30218
30323
|
if (weighted.length === 0 && candidates.every((candidate) => !knownQuota(candidate.quota))) {
|
|
30219
30324
|
return [...candidates].sort((left, right) => left.order - right.order || left.accountId.localeCompare(right.accountId))[0];
|
|
30220
30325
|
}
|
|
@@ -30412,7 +30517,7 @@ async function resolveNativePoolPaths(legacyConfig = getAccountStoragePath(), le
|
|
|
30412
30517
|
if (new Set(paths).size !== paths.length) {
|
|
30413
30518
|
throw new Error("Anthropic account storage paths overlap; migration requires separate files");
|
|
30414
30519
|
}
|
|
30415
|
-
const storageId =
|
|
30520
|
+
const storageId = createHash19("sha256").update(JSON.stringify(["anthropic", config, legacyLayoutState])).digest("hex");
|
|
30416
30521
|
return {
|
|
30417
30522
|
legacyConfig: sourceConfig,
|
|
30418
30523
|
legacyState: sourceState,
|
|
@@ -30462,7 +30567,7 @@ function nativeVaultPaths(local, layout = stateLayoutOfPaths(local)) {
|
|
|
30462
30567
|
runtime: runtime2,
|
|
30463
30568
|
roster,
|
|
30464
30569
|
routing,
|
|
30465
|
-
storageId:
|
|
30570
|
+
storageId: createHash20("sha256").update(JSON.stringify(["anthropic-vault", config, legacyLayoutState])).digest("hex")
|
|
30466
30571
|
};
|
|
30467
30572
|
}
|
|
30468
30573
|
|
|
@@ -30520,7 +30625,7 @@ function stateLayoutMovedElsewhere(configDir, relocatedTo, stateRoot) {
|
|
|
30520
30625
|
}
|
|
30521
30626
|
|
|
30522
30627
|
// src/state-layout-io.ts
|
|
30523
|
-
import { createHash as
|
|
30628
|
+
import { createHash as createHash21 } from "node:crypto";
|
|
30524
30629
|
import {
|
|
30525
30630
|
lstat as lstat10,
|
|
30526
30631
|
open as open10,
|
|
@@ -30560,7 +30665,7 @@ function errorCode3(error) {
|
|
|
30560
30665
|
return error instanceof Error && "code" in error ? error.code : undefined;
|
|
30561
30666
|
}
|
|
30562
30667
|
function sha256Hex(bytes) {
|
|
30563
|
-
return
|
|
30668
|
+
return createHash21("sha256").update(bytes).digest("hex");
|
|
30564
30669
|
}
|
|
30565
30670
|
async function digestFile(path2) {
|
|
30566
30671
|
try {
|
|
@@ -31973,7 +32078,7 @@ class CacheKeepSessionRegistry {
|
|
|
31973
32078
|
}
|
|
31974
32079
|
}
|
|
31975
32080
|
// src/cachekeep-store.ts
|
|
31976
|
-
import { createHash as
|
|
32081
|
+
import { createHash as createHash22, randomUUID as randomUUID19 } from "node:crypto";
|
|
31977
32082
|
import { constants as constants3 } from "node:fs";
|
|
31978
32083
|
import { lstat as lstat16, mkdir as mkdir13, open as open11, readdir as readdir6, rm as rm8, writeFile as writeFile5 } from "node:fs/promises";
|
|
31979
32084
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
@@ -31982,7 +32087,7 @@ import { promisify } from "node:util";
|
|
|
31982
32087
|
import { gunzip, gzip } from "node:zlib";
|
|
31983
32088
|
var compress = promisify(gzip);
|
|
31984
32089
|
var decompress = promisify(gunzip);
|
|
31985
|
-
var hash3 = (value) =>
|
|
32090
|
+
var hash3 = (value) => createHash22("sha256").update(value).digest("hex");
|
|
31986
32091
|
var FILE = /^[a-f0-9]{64}\.json\.gz$/;
|
|
31987
32092
|
var TEMP = /^[a-f0-9]{64}\.json\.gz\.[a-f0-9-]+\.tmp$/;
|
|
31988
32093
|
var MAX_RECORD_BYTES = 2 * CACHE_KEEP_MAX_BODY_BYTES + 64 * 1024;
|
|
@@ -33020,7 +33125,7 @@ function executeLoggingCommand(input) {
|
|
|
33020
33125
|
`);
|
|
33021
33126
|
}
|
|
33022
33127
|
// src/message-threads.ts
|
|
33023
|
-
import { createHash as
|
|
33128
|
+
import { createHash as createHash23, randomUUID as randomUUID20 } from "node:crypto";
|
|
33024
33129
|
var MESSAGE_THREADS_BETA = "message-threads-2026-08-12";
|
|
33025
33130
|
var MAX_AGE_MS = 5 * 60000;
|
|
33026
33131
|
var MAX_SESSIONS = 2048;
|
|
@@ -33034,7 +33139,7 @@ function localMessageThreadCredential(binding2) {
|
|
|
33034
33139
|
]);
|
|
33035
33140
|
}
|
|
33036
33141
|
function hash4(value) {
|
|
33037
|
-
return
|
|
33142
|
+
return createHash23("sha256").update(JSON.stringify(value)).digest("hex");
|
|
33038
33143
|
}
|
|
33039
33144
|
function normalizedReplyName(name) {
|
|
33040
33145
|
const bare = name.startsWith("mcp_") ? name.slice(4) : name;
|
|
@@ -33081,7 +33186,7 @@ class ReplyFingerprint {
|
|
|
33081
33186
|
layout = new Map;
|
|
33082
33187
|
textBlocks = new Map;
|
|
33083
33188
|
signatures = new Map;
|
|
33084
|
-
text =
|
|
33189
|
+
text = createHash23("sha256");
|
|
33085
33190
|
committedText = this.text.copy();
|
|
33086
33191
|
hasText = false;
|
|
33087
33192
|
activeText;
|
|
@@ -33103,7 +33208,7 @@ class ReplyFingerprint {
|
|
|
33103
33208
|
this.text.update(part.slice(visible.length));
|
|
33104
33209
|
}
|
|
33105
33210
|
appendBlockText(state, value) {
|
|
33106
|
-
state.text ??=
|
|
33211
|
+
state.text ??= createHash23("sha256");
|
|
33107
33212
|
state.committedText ??= state.text.copy();
|
|
33108
33213
|
const part = state.textHasContent ? value : value.trimStart();
|
|
33109
33214
|
const visible = part.trimEnd();
|
|
@@ -33154,7 +33259,7 @@ class ReplyFingerprint {
|
|
|
33154
33259
|
state.input = block.input;
|
|
33155
33260
|
}
|
|
33156
33261
|
if (block.type === "thinking" || block.type === "redacted_thinking") {
|
|
33157
|
-
state.signature =
|
|
33262
|
+
state.signature = createHash23("sha256");
|
|
33158
33263
|
const signature = block.type === "redacted_thinking" ? block.data : block.signature;
|
|
33159
33264
|
if (typeof signature === "string") {
|
|
33160
33265
|
state.signature.update(signature);
|
|
@@ -35102,7 +35207,7 @@ function createNativeLocalRuntimeReaders(options) {
|
|
|
35102
35207
|
}
|
|
35103
35208
|
|
|
35104
35209
|
// src/native-refresh-coordinator.ts
|
|
35105
|
-
import { createHash as
|
|
35210
|
+
import { createHash as createHash24 } from "node:crypto";
|
|
35106
35211
|
|
|
35107
35212
|
// src/native-transient-account.ts
|
|
35108
35213
|
var TRANSIENT_ACCOUNT_MESSAGE = "Anthropic account update in progress; retry the request";
|
|
@@ -35220,7 +35325,7 @@ function pause(ms, signals) {
|
|
|
35220
35325
|
var NATIVE_REFRESH_MAX_ATTEMPTS = 3;
|
|
35221
35326
|
var NATIVE_REFRESH_JOIN_BUDGET_MS = 2000;
|
|
35222
35327
|
function nativeAccountProviderLock(paths, identity5) {
|
|
35223
|
-
const key =
|
|
35328
|
+
const key = createHash24("sha256").update(JSON.stringify([paths.storageId, identity5])).digest("hex");
|
|
35224
35329
|
return {
|
|
35225
35330
|
path: paths.state,
|
|
35226
35331
|
name: `native-account-provider-${key}`,
|
|
@@ -36034,7 +36139,7 @@ function createNativeRefreshCoordinator(options) {
|
|
|
36034
36139
|
import { isAbsolute as isAbsolute5, normalize, parse as parse3, sep } from "node:path";
|
|
36035
36140
|
|
|
36036
36141
|
// src/migration-source.ts
|
|
36037
|
-
import { createHash as
|
|
36142
|
+
import { createHash as createHash25 } from "node:crypto";
|
|
36038
36143
|
import { constants as constants4 } from "node:fs";
|
|
36039
36144
|
import { lstat as lstat17, open as open12 } from "node:fs/promises";
|
|
36040
36145
|
class NativeMigrationSourceError extends Error {
|
|
@@ -36133,7 +36238,7 @@ async function readNativeMigrationSource(role, path2, hooks = {}) {
|
|
|
36133
36238
|
return sourceSnapshot({
|
|
36134
36239
|
role,
|
|
36135
36240
|
path: path2,
|
|
36136
|
-
digest:
|
|
36241
|
+
digest: createHash25("sha256").update(content).digest("hex"),
|
|
36137
36242
|
data: freezeJson(data),
|
|
36138
36243
|
metadata: Object.freeze({
|
|
36139
36244
|
uid: Number(before.uid),
|
|
@@ -43745,7 +43850,7 @@ async function writeNativeHostAuth(input, hooks = {}) {
|
|
|
43745
43850
|
}
|
|
43746
43851
|
|
|
43747
43852
|
// src/native-migration.ts
|
|
43748
|
-
import { createHash as
|
|
43853
|
+
import { createHash as createHash26 } from "node:crypto";
|
|
43749
43854
|
import { lstat as lstat20, mkdir as mkdir15, unlink as unlink10 } from "node:fs/promises";
|
|
43750
43855
|
import { dirname as dirname23, isAbsolute as isAbsolute7 } from "node:path";
|
|
43751
43856
|
class NativeMigrationError extends Error {
|
|
@@ -44137,7 +44242,7 @@ function routingBytes(captured) {
|
|
|
44137
44242
|
`;
|
|
44138
44243
|
}
|
|
44139
44244
|
function bytesDigest(bytes) {
|
|
44140
|
-
return bytes === undefined ? null :
|
|
44245
|
+
return bytes === undefined ? null : createHash26("sha256").update(bytes).digest("hex");
|
|
44141
44246
|
}
|
|
44142
44247
|
function expectedAuth(input, snapshot) {
|
|
44143
44248
|
const entry2 = inspectNativeHostAuthEntry(input.host, snapshot.data);
|
|
@@ -48070,7 +48175,7 @@ function requestMethod(input) {
|
|
|
48070
48175
|
return input instanceof Request ? input.method : "GET";
|
|
48071
48176
|
}
|
|
48072
48177
|
// src/prime.ts
|
|
48073
|
-
import { createHash as
|
|
48178
|
+
import { createHash as createHash27 } from "node:crypto";
|
|
48074
48179
|
import * as fs4 from "node:fs";
|
|
48075
48180
|
import { mkdir as mkdir18, readdir as readdir7, rm as rm10, stat as stat14, writeFile as writeFile6 } from "node:fs/promises";
|
|
48076
48181
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
@@ -48279,7 +48384,7 @@ function primeStorageFingerprint(storagePath) {
|
|
|
48279
48384
|
throw error;
|
|
48280
48385
|
canonicalPath3 = absolutePath;
|
|
48281
48386
|
}
|
|
48282
|
-
return
|
|
48387
|
+
return createHash27("sha256").update(canonicalPath3).digest("hex").slice(0, 12);
|
|
48283
48388
|
}
|
|
48284
48389
|
function primeMarkerNamespaceDir(markerDir, storagePath) {
|
|
48285
48390
|
return join30(markerDir, primeStorageFingerprint(storagePath));
|
|
@@ -48602,7 +48707,7 @@ class PrimeManager {
|
|
|
48602
48707
|
return [markerPath];
|
|
48603
48708
|
const verifiedPath = this.verifiedMarkerPath(accountIdentity, resetsAtEpochMs);
|
|
48604
48709
|
if (resetsAtEpochMs === undefined) {
|
|
48605
|
-
const digest2 =
|
|
48710
|
+
const digest2 = createHash27("sha256").update(accountIdentity).digest("hex");
|
|
48606
48711
|
if ((await this.readMarkerNames(this.verifiedMarkerDir())).some((name) => name.startsWith(`${digest2}-`)))
|
|
48607
48712
|
return null;
|
|
48608
48713
|
}
|
|
@@ -48614,7 +48719,7 @@ class PrimeManager {
|
|
|
48614
48719
|
return join30(this.options.markerDir ?? defaultMarkerDir(), "accounts");
|
|
48615
48720
|
}
|
|
48616
48721
|
verifiedMarkerPath(accountIdentity, resetsAtEpochMs) {
|
|
48617
|
-
const digest2 =
|
|
48722
|
+
const digest2 = createHash27("sha256").update(accountIdentity).digest("hex");
|
|
48618
48723
|
return join30(this.verifiedMarkerDir(), `${digest2}-${resetsAtEpochMs ?? "bootstrap"}`);
|
|
48619
48724
|
}
|
|
48620
48725
|
async readMarkerNames(dir) {
|
|
@@ -52388,9 +52493,9 @@ async function registerLegacyHeld(oldDir, paths2, identity5, options, ctx) {
|
|
|
52388
52493
|
return deferLegacyRegistration(paths2, oldDir, options, error);
|
|
52389
52494
|
}
|
|
52390
52495
|
}
|
|
52391
|
-
function chooseLegacy(paths2, reasons2,
|
|
52496
|
+
function chooseLegacy(paths2, reasons2, log4, registration) {
|
|
52392
52497
|
recordProcessStateLayout(paths2.legacyConfig, LEGACY_STATE_LAYOUT);
|
|
52393
|
-
if (reasons2.length &&
|
|
52498
|
+
if (reasons2.length && log4)
|
|
52394
52499
|
logger2.info("state-layout", "anthropic-auth keeps its runtime files in OpenCode’s config folder until every running OpenCode or Pi using them has restarted on this version", { reasons: reasons2 });
|
|
52395
52500
|
return {
|
|
52396
52501
|
kind: "legacy",
|
|
@@ -52460,7 +52565,7 @@ async function readPointers(dataset) {
|
|
|
52460
52565
|
}
|
|
52461
52566
|
return pointed;
|
|
52462
52567
|
}
|
|
52463
|
-
async function legacyHeld(dataset, options, ctx, reasons2,
|
|
52568
|
+
async function legacyHeld(dataset, options, ctx, reasons2, log4 = true) {
|
|
52464
52569
|
const pointed = await readPointers(dataset);
|
|
52465
52570
|
const record17 = await readRecord2(dataset.sub);
|
|
52466
52571
|
if (record17)
|
|
@@ -52470,7 +52575,7 @@ async function legacyHeld(dataset, options, ctx, reasons2, log3 = true) {
|
|
|
52470
52575
|
if (pointed || !noMoveRecord(record17))
|
|
52471
52576
|
return "changed";
|
|
52472
52577
|
const registration = await registerLegacyHeld(dataset.oldDir, dataset.oldPaths, dataset.identity, options, ctx);
|
|
52473
|
-
return chooseLegacy(dataset.oldPaths, reasons2,
|
|
52578
|
+
return chooseLegacy(dataset.oldPaths, reasons2, log4, registration);
|
|
52474
52579
|
}
|
|
52475
52580
|
async function oldFolderTransition(old, recordedMovingJournal) {
|
|
52476
52581
|
for (const runtime2 of [old.oldPaths.runtime, old.oldVault.runtime])
|
|
@@ -52785,8 +52890,8 @@ async function underLayoutLock(dataset, options, ctx, overrides, neverMove) {
|
|
|
52785
52890
|
await rollbackPreparing(record17, dataset, ctx);
|
|
52786
52891
|
return "again";
|
|
52787
52892
|
}
|
|
52788
|
-
const stay = async (reasons2,
|
|
52789
|
-
const decided = await legacyHeld(dataset, options, ctx, reasons2,
|
|
52893
|
+
const stay = async (reasons2, log4 = true) => {
|
|
52894
|
+
const decided = await legacyHeld(dataset, options, ctx, reasons2, log4);
|
|
52790
52895
|
return decided === "changed" ? "again" : decided;
|
|
52791
52896
|
};
|
|
52792
52897
|
if (overrides.length || neverMove.length) {
|
|
@@ -53334,7 +53439,7 @@ export {
|
|
|
53334
53439
|
lookupGatewaySettingsFile,
|
|
53335
53440
|
lookupAccountHome,
|
|
53336
53441
|
logger2 as logger,
|
|
53337
|
-
|
|
53442
|
+
log3 as log,
|
|
53338
53443
|
localMessageThreadCredential,
|
|
53339
53444
|
localDayKey,
|
|
53340
53445
|
legacySettingsProtection,
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { type ClaustrumClient, type ClaustrumReporterSource, type EnrollmentTokenFile } from '@cortexkit/claustrum-client';
|
|
1
|
+
import { type ClaustrumClient, type ClaustrumReporterSource, type EnrollmentTokenFile, type ScopedInventoryRow } from '@cortexkit/claustrum-client';
|
|
2
2
|
import { type ClaustrumLogger } from './errors.js';
|
|
3
3
|
import type { InsulaUsageTransport } from './insula.js';
|
|
4
4
|
import { type ClaustrumUsageReading, type ClaustrumUsageReportState, type ScopedUsageSource } from './usage.js';
|
|
5
5
|
import { type ScopedWatchSource, type WatchMode } from './watch.js';
|
|
6
|
+
type ScopedRow = Omit<ScopedInventoryRow, 'authMethod'> & {
|
|
7
|
+
readonly authMethod?: string;
|
|
8
|
+
};
|
|
9
|
+
type ScopedInventory = Omit<Awaited<ReturnType<ClaustrumClient['listScoped']>>, 'rows'> & {
|
|
10
|
+
readonly rows: readonly ScopedRow[];
|
|
11
|
+
};
|
|
6
12
|
/**
|
|
7
13
|
* claustrum-client adds watchScoped in 0.12.0 and reportUsageScoped in 0.14.0.
|
|
8
14
|
* Older clients keep polling and simply do not send reply quota readings.
|
|
9
15
|
*/
|
|
10
|
-
export type ClaustrumScopedClient = Pick<ClaustrumClient, '
|
|
16
|
+
export type ClaustrumScopedClient = Pick<ClaustrumClient, 'getScoped' | 'reportAuthFailureScoped' | 'close'> & {
|
|
17
|
+
listScoped(enrollmentToken?: string): Promise<ScopedInventory>;
|
|
11
18
|
insula?: InsulaUsageTransport;
|
|
12
19
|
} & ScopedWatchSource & ScopedUsageSource;
|
|
13
20
|
/** The two credential types a plugin's family can hold; routing differs by type. */
|
|
@@ -16,7 +23,8 @@ export type VaultCredentialType = 'oauth' | 'api_key';
|
|
|
16
23
|
* Which vault rows belong to this plugin. `refreshAdapter` classifies an OAuth
|
|
17
24
|
* row by the protocol it speaks; `category` is the grant that authorizes this
|
|
18
25
|
* consumer to read it. Static API keys carry no refresh adapter, so they are
|
|
19
|
-
* admitted only when `apiKeys` is set
|
|
26
|
+
* admitted only when `apiKeys` is set. If a row declares an auth method, it
|
|
27
|
+
* must agree with the credential type.
|
|
20
28
|
*/
|
|
21
29
|
export interface ClaustrumFamily {
|
|
22
30
|
refreshAdapter: string;
|
|
@@ -111,8 +119,10 @@ export interface VaultInventory {
|
|
|
111
119
|
readonly credentials: readonly VaultCredential[];
|
|
112
120
|
readonly skipped: readonly SkippedVaultRecord[];
|
|
113
121
|
/**
|
|
114
|
-
*
|
|
115
|
-
* `unknown-auth-method
|
|
122
|
+
* Refused rows and their codes, never classifier errors. Category families
|
|
123
|
+
* omit this field if no rows were refused and use only `unknown-auth-method`.
|
|
124
|
+
* Classifying families can also use declared policy codes, `unmapped` and
|
|
125
|
+
* `unclassified`.
|
|
116
126
|
*/
|
|
117
127
|
readonly refused?: readonly {
|
|
118
128
|
credentialId?: string;
|
|
@@ -364,3 +374,4 @@ export declare class ClaustrumScopedCustody {
|
|
|
364
374
|
/** Stop accepting work; give token reads and reply reports one shared 2 s drain. */
|
|
365
375
|
dispose(onTimeout?: (pendingOperations: number) => void): Promise<void>;
|
|
366
376
|
}
|
|
377
|
+
export {};
|
|
@@ -13,11 +13,36 @@ export interface RoutingCandidate {
|
|
|
13
13
|
accountId: string;
|
|
14
14
|
credentialId: string;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
type ContinueExhaustion = {
|
|
17
|
+
/** Vault account id, not the plugin's route id. */
|
|
18
|
+
accountId: string;
|
|
19
|
+
credentialId: string;
|
|
20
|
+
/** When the limit or sign-in signal was observed, in Unix milliseconds. */
|
|
21
|
+
observedAtMs: number;
|
|
22
|
+
} & ({
|
|
23
|
+
limitWindow: 'five_hour' | 'seven_day';
|
|
24
|
+
/** Scoped quota group matching `^[a-z0-9._-]{1,64}$`. */
|
|
25
|
+
pool?: string;
|
|
26
|
+
/** Reset time in Unix milliseconds. */
|
|
27
|
+
resetsAtMs?: number;
|
|
28
|
+
/** Non-negative seconds until retry, rounded down. */
|
|
29
|
+
retryAfterS?: number;
|
|
30
|
+
} | {
|
|
31
|
+
limitWindow: 'signed_out';
|
|
32
|
+
pool?: never;
|
|
33
|
+
resetsAtMs?: never;
|
|
34
|
+
retryAfterS?: never;
|
|
35
|
+
});
|
|
36
|
+
export type AskRoutingInput<Candidate extends RoutingCandidate = RoutingCandidate, Refusals extends boolean = false> = {
|
|
17
37
|
sessionId: string;
|
|
18
38
|
provider: string;
|
|
19
39
|
modelId: string;
|
|
20
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* The routable set: routes the vault allows, minus any the user's own rules
|
|
42
|
+
* exclude. It is not the account the plugin's local selection would choose,
|
|
43
|
+
* so it can include routes that selection would skip for model or quota
|
|
44
|
+
* reasons; routing picks among them.
|
|
45
|
+
*/
|
|
21
46
|
candidates: readonly Candidate[];
|
|
22
47
|
/** Defaults to 1500 ms, above routing's normal tail; clamped to 1–2000 ms. */
|
|
23
48
|
deadlineMs?: number;
|
|
@@ -33,7 +58,24 @@ export interface AskRoutingInput<Candidate extends RoutingCandidate = RoutingCan
|
|
|
33
58
|
holdWaitMaxS?: number;
|
|
34
59
|
/** Plugin sticky choice's vault credential id; an eligible-account hint, not a pin. */
|
|
35
60
|
warmCredentialId?: string;
|
|
36
|
-
}
|
|
61
|
+
} & ({
|
|
62
|
+
mode?: never;
|
|
63
|
+
requestId?: never;
|
|
64
|
+
exhausted?: never;
|
|
65
|
+
} | {
|
|
66
|
+
/**
|
|
67
|
+
* Ask routing whether a run should move off its pinned account. Send to
|
|
68
|
+
* the selected account, or wait on it if the answer includes a hold.
|
|
69
|
+
* With `refusals: true`, a `{refused}` answer means keep the run paused
|
|
70
|
+
* on its account until the reset or, for `signed_out`, until the user
|
|
71
|
+
* signs in. Do not ask again while paused.
|
|
72
|
+
*/
|
|
73
|
+
mode: 'continue';
|
|
74
|
+
/** One id per question (e.g. a fresh UUID); reuse it only to retry that same question. */
|
|
75
|
+
requestId: string;
|
|
76
|
+
/** Required on a continue: a proved usage limit or a definite sign-in signal. */
|
|
77
|
+
exhausted: ContinueExhaustion;
|
|
78
|
+
});
|
|
37
79
|
export interface RoutingHold {
|
|
38
80
|
/** Uncapped advice from routing. The plugin must apply its own hold cap. */
|
|
39
81
|
retry_after_ms: number;
|
|
@@ -47,6 +89,7 @@ export type RoutingRefusal = {
|
|
|
47
89
|
refused: {
|
|
48
90
|
code: 'account_limit_exhausted' | 'account_selection_refused' | 'account_selection_final';
|
|
49
91
|
routingCode?: string;
|
|
92
|
+
reason?: string;
|
|
50
93
|
retryAfterSecs?: number;
|
|
51
94
|
resetsAtMs?: number;
|
|
52
95
|
};
|
|
@@ -110,7 +153,21 @@ export type ReportRoutingInput = (RoutingReportIdentity & ({
|
|
|
110
153
|
* as 403 or 429. Must match `^[a-z0-9._-]{1,64}$`.
|
|
111
154
|
*/
|
|
112
155
|
providerCode: string;
|
|
113
|
-
})) | {
|
|
156
|
+
})) | (RoutingReportIdentity & {
|
|
157
|
+
/**
|
|
158
|
+
* Report a 429 or similar response that isn't a proved quota limit. With
|
|
159
|
+
* no provider retry time, use the final attempt's receipt time + 5,000 ms.
|
|
160
|
+
* Routing blocks only new admissions on the account until `retryAtMs`.
|
|
161
|
+
* The session's pin stays: wait until `retryAtMs` and retry the run on
|
|
162
|
+
* the same account. For a proved quota limit, report `exhausted` and ask
|
|
163
|
+
* routing to continue with the exhausted window. Use `credential_refused`
|
|
164
|
+
* for an API key refused for any use.
|
|
165
|
+
*/
|
|
166
|
+
kind: 'transient_backoff';
|
|
167
|
+
/** Absolute retry time in Unix milliseconds. */
|
|
168
|
+
retryAtMs: number;
|
|
169
|
+
providerCode?: string;
|
|
170
|
+
}) | {
|
|
114
171
|
sessionId: string;
|
|
115
172
|
kind: 'turn_notes_supported';
|
|
116
173
|
model: string;
|
|
@@ -175,20 +232,18 @@ export declare function turnNotes(sessionId: string): readonly {
|
|
|
175
232
|
* Ask routing for an eligible vault route. Any failure or unfamiliar answer
|
|
176
233
|
* yields undefined so the plugin can keep its own choice. Opted-in routing
|
|
177
234
|
* refusals instead stop the request. This does not admit routes. Callers never
|
|
178
|
-
* pass an account the vault refused.
|
|
179
|
-
* user
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* floor, and don't add floors of the plugin's own that duplicate routing's
|
|
185
|
-
* reserves.
|
|
235
|
+
* pass an account the vault refused. Beyond that, a plugin may leave accounts
|
|
236
|
+
* out only under a user-configured eligibility rule, such as a killswitch floor
|
|
237
|
+
* the user turned on (the minimum share of a quota window an account must keep
|
|
238
|
+
* to be offered) or a per-model account list. Plugins ship no floors of
|
|
239
|
+
* their own by default. Routing's pick is final: never reject it under a local
|
|
240
|
+
* floor or choose another account afterwards.
|
|
186
241
|
*/
|
|
187
242
|
export declare function askRouting<Candidate extends RoutingCandidate, Refusals extends boolean = false>(input: AskRoutingInput<Candidate, Refusals>): Promise<RoutingSelection<Candidate> | (Refusals extends true ? RoutingRefusal : never) | undefined>;
|
|
188
243
|
/**
|
|
189
|
-
* Report a vault request, billing result, plugin wait or
|
|
190
|
-
* waiting for routing. Only contract fields are sent,
|
|
191
|
-
* are ignored. Headers must already be limited to
|
|
192
|
-
* caller; values are not filtered or redacted here.
|
|
244
|
+
* Report a vault request, account backoff, billing result, plugin wait or
|
|
245
|
+
* turn-note event without waiting for routing. Only contract fields are sent,
|
|
246
|
+
* and all accessor failures are ignored. Headers must already be limited to
|
|
247
|
+
* rate-limit headers by the caller; values are not filtered or redacted here.
|
|
193
248
|
*/
|
|
194
249
|
export declare function reportRouting(input: ReportRoutingInput): void;
|
package/dist/native-custody.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface NativeCustodyClient {
|
|
|
22
22
|
readonly credentialType: string;
|
|
23
23
|
readonly serves: readonly string[];
|
|
24
24
|
readonly providerIds: readonly string[];
|
|
25
|
-
readonly authMethod?:
|
|
25
|
+
readonly authMethod?: string;
|
|
26
26
|
readonly refreshAdapter?: string;
|
|
27
27
|
readonly state: string;
|
|
28
28
|
readonly recordVersion: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/anthropic-auth-core",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"prepublishOnly": "bun run build"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@cortexkit/common-auth": "0.
|
|
34
|
+
"@cortexkit/common-auth": "0.55.1"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@cortexkit/claustrum-client": "0.
|
|
37
|
+
"@cortexkit/claustrum-client": "0.20.0",
|
|
38
38
|
"@cortexkit/private-files": "0.2.2",
|
|
39
39
|
"@cortexkit/subc-client": "^0.24",
|
|
40
40
|
"jsonc-parser": "^3.3.1",
|