@cortexkit/anthropic-auth-core 2.4.7 → 2.4.8
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 +48 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7555,6 +7555,8 @@ class InsulaQuotaSource {
|
|
|
7555
7555
|
...typeof entry.source === "string" && { source: entry.source }
|
|
7556
7556
|
}
|
|
7557
7557
|
};
|
|
7558
|
+
if (entry.stale !== undefined && (!record(entry.stale) || entry.stale.class !== "local_source_unavailable"))
|
|
7559
|
+
return { miss: "upstream-failed", reading };
|
|
7558
7560
|
return now >= fetchedAt + MAX_AGE || entry.stale !== undefined ? { miss: "stale", reading } : { reading };
|
|
7559
7561
|
}
|
|
7560
7562
|
if (this.#completeProviders.has(provider))
|
|
@@ -7898,6 +7900,7 @@ function combineAbortSignals(signals) {
|
|
|
7898
7900
|
}
|
|
7899
7901
|
|
|
7900
7902
|
// ../../node_modules/@cortexkit/common-auth/dist/claustrum/custody.js
|
|
7903
|
+
import { channel } from "node:diagnostics_channel";
|
|
7901
7904
|
import { ClaustrumCredentialError as ClaustrumCredentialError3 } from "@cortexkit/claustrum-client";
|
|
7902
7905
|
|
|
7903
7906
|
// ../../node_modules/@cortexkit/common-auth/dist/claustrum/host-slot.js
|
|
@@ -7957,6 +7960,7 @@ function scopedRetryReason(served, current) {
|
|
|
7957
7960
|
return "rotated";
|
|
7958
7961
|
}
|
|
7959
7962
|
var defaultLogger = createLogger("claustrum");
|
|
7963
|
+
var phaseDiagnostics = channel("common-auth.claustrum.phases");
|
|
7960
7964
|
function decideScopedRetryAfter401(site, served, current, logger2 = defaultLogger) {
|
|
7961
7965
|
const retry = isScopedCredentialRotation(served, current);
|
|
7962
7966
|
logger2.debug("scoped 401 re-authorized", {
|
|
@@ -8156,6 +8160,11 @@ class ClaustrumScopedCustody {
|
|
|
8156
8160
|
}
|
|
8157
8161
|
async#token(signal) {
|
|
8158
8162
|
this.#check(signal);
|
|
8163
|
+
if (phaseDiagnostics.hasSubscribers)
|
|
8164
|
+
phaseDiagnostics.publish({
|
|
8165
|
+
logger: this.#logger,
|
|
8166
|
+
phase: "token read begin"
|
|
8167
|
+
});
|
|
8159
8168
|
const pending = this.#readToken();
|
|
8160
8169
|
this.#tokenReads.add(pending);
|
|
8161
8170
|
let value;
|
|
@@ -8163,6 +8172,11 @@ class ClaustrumScopedCustody {
|
|
|
8163
8172
|
value = await pending;
|
|
8164
8173
|
} finally {
|
|
8165
8174
|
this.#tokenReads.delete(pending);
|
|
8175
|
+
if (phaseDiagnostics.hasSubscribers)
|
|
8176
|
+
phaseDiagnostics.publish({
|
|
8177
|
+
logger: this.#logger,
|
|
8178
|
+
phase: "token read end"
|
|
8179
|
+
});
|
|
8166
8180
|
}
|
|
8167
8181
|
this.#check(signal);
|
|
8168
8182
|
if (!/^[0-9a-f]{64}$/.test(value.token) || !Number.isSafeInteger(value.token_generation) || value.token_generation < 1) {
|
|
@@ -8218,11 +8232,22 @@ class ClaustrumScopedCustody {
|
|
|
8218
8232
|
this.#kept.clear();
|
|
8219
8233
|
throw error;
|
|
8220
8234
|
}
|
|
8235
|
+
if (phaseDiagnostics.hasSubscribers)
|
|
8236
|
+
phaseDiagnostics.publish({
|
|
8237
|
+
logger: this.#logger,
|
|
8238
|
+
phase: "list scoped begin"
|
|
8239
|
+
});
|
|
8221
8240
|
try {
|
|
8222
8241
|
inventory = await this.#call(() => this.#client.listScoped(token), signal);
|
|
8223
8242
|
} catch (error) {
|
|
8224
8243
|
this.listFailed(error);
|
|
8225
8244
|
throw error;
|
|
8245
|
+
} finally {
|
|
8246
|
+
if (phaseDiagnostics.hasSubscribers)
|
|
8247
|
+
phaseDiagnostics.publish({
|
|
8248
|
+
logger: this.#logger,
|
|
8249
|
+
phase: "list scoped end"
|
|
8250
|
+
});
|
|
8226
8251
|
}
|
|
8227
8252
|
const skipped = [];
|
|
8228
8253
|
const refused = [];
|
|
@@ -10493,6 +10518,7 @@ class ClaustrumConsumer {
|
|
|
10493
10518
|
}
|
|
10494
10519
|
// ../../node_modules/@cortexkit/common-auth/dist/claustrum/hub.js
|
|
10495
10520
|
import { createHash as createHash6 } from "node:crypto";
|
|
10521
|
+
import { channel as channel2 } from "node:diagnostics_channel";
|
|
10496
10522
|
import { readdir as readdir2, stat as stat7 } from "node:fs/promises";
|
|
10497
10523
|
import { dirname as dirname8, join as join10, resolve as resolve9 } from "node:path";
|
|
10498
10524
|
var sharedRosters = new Map;
|
|
@@ -11090,7 +11116,24 @@ class ClaustrumDiscoveryHub {
|
|
|
11090
11116
|
throw closed("Claustrum hub member has no base view");
|
|
11091
11117
|
if (base instanceof Error)
|
|
11092
11118
|
throw base;
|
|
11093
|
-
|
|
11119
|
+
let seed;
|
|
11120
|
+
if (!base.file) {
|
|
11121
|
+
const phaseDiagnostics2 = channel2("common-auth.claustrum.phases");
|
|
11122
|
+
if (phaseDiagnostics2.hasSubscribers)
|
|
11123
|
+
phaseDiagnostics2.publish({
|
|
11124
|
+
logger: this.#logger,
|
|
11125
|
+
phase: `seed read ${entry.provider} begin`
|
|
11126
|
+
});
|
|
11127
|
+
try {
|
|
11128
|
+
seed = await this.#seed(entry);
|
|
11129
|
+
} finally {
|
|
11130
|
+
if (phaseDiagnostics2.hasSubscribers)
|
|
11131
|
+
phaseDiagnostics2.publish({
|
|
11132
|
+
logger: this.#logger,
|
|
11133
|
+
phase: `seed read ${entry.provider} end`
|
|
11134
|
+
});
|
|
11135
|
+
}
|
|
11136
|
+
}
|
|
11094
11137
|
const roster = await refreshVaultRoster({
|
|
11095
11138
|
path: entry.path,
|
|
11096
11139
|
custody: { discover: async () => share },
|
|
@@ -26317,18 +26360,18 @@ function classifySafeErrorForLog(error) {
|
|
|
26317
26360
|
} catch {}
|
|
26318
26361
|
return { name, code };
|
|
26319
26362
|
}
|
|
26320
|
-
function logPublicationFailure(
|
|
26363
|
+
function logPublicationFailure(channel3, error) {
|
|
26321
26364
|
let level = "warn";
|
|
26322
26365
|
try {
|
|
26323
26366
|
if (usagePublicationRefusalIsFatal(error))
|
|
26324
26367
|
level = "error";
|
|
26325
26368
|
} catch {}
|
|
26326
|
-
logger[level](
|
|
26369
|
+
logger[level](channel3, "Account usage publication unavailable", classifySafeErrorForLog(error));
|
|
26327
26370
|
}
|
|
26328
|
-
function createNativeUsagePublisher(
|
|
26371
|
+
function createNativeUsagePublisher(channel3) {
|
|
26329
26372
|
const pending = new Set;
|
|
26330
26373
|
const observe2 = (write) => {
|
|
26331
|
-
const work = write.then(() => {}, (error) => logPublicationFailure(
|
|
26374
|
+
const work = write.then(() => {}, (error) => logPublicationFailure(channel3, error));
|
|
26332
26375
|
pending.add(work);
|
|
26333
26376
|
work.then(() => pending.delete(work), () => pending.delete(work));
|
|
26334
26377
|
return work;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/anthropic-auth-core",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"prepublishOnly": "bun run build"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@cortexkit/common-auth": "0.
|
|
33
|
+
"@cortexkit/common-auth": "0.32.1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@cortexkit/claustrum-client": "0.13.0",
|