@cortexkit/anthropic-auth-core 2.4.8 → 2.4.9
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.
|
@@ -30,6 +30,8 @@ export interface QuotaTextOptions {
|
|
|
30
30
|
}
|
|
31
31
|
export interface QuotaWindowPart {
|
|
32
32
|
kind: 'window' | 'budget';
|
|
33
|
+
/** Unknown windows have no dated percentage; budgets retain their own wording. */
|
|
34
|
+
reading: 'known' | 'unknown';
|
|
33
35
|
/** The display name of a quota window, or `credits` for the budget. */
|
|
34
36
|
name: string;
|
|
35
37
|
/**
|
|
@@ -45,7 +47,8 @@ export interface QuotaWindowPart {
|
|
|
45
47
|
remainingPercent?: number;
|
|
46
48
|
/** A bare relative reset span such as `4d`, only when the reset is future. */
|
|
47
49
|
resetIn?: string;
|
|
48
|
-
|
|
50
|
+
/** The reading time, omitted for a window with no reading. */
|
|
51
|
+
checkedAt?: number;
|
|
49
52
|
/** Whether the reset followed this reading and has arrived by `now`. */
|
|
50
53
|
resetSinceReading: boolean;
|
|
51
54
|
}
|
|
@@ -64,9 +67,11 @@ export interface QuotaParts {
|
|
|
64
67
|
*/
|
|
65
68
|
export declare function quotaWindowName(limit: Pick<ProjectedLimit, 'scope' | 'label' | 'windowMinutes'>): string;
|
|
66
69
|
/**
|
|
67
|
-
* Structured quota wording for layouts that need one row per window.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
+
* Structured quota wording for layouts that need one row per window.
|
|
71
|
+
* Windows without a dated percentage remain as explicit unknown parts. Limits
|
|
72
|
+
* marked absent (not reported) or retired (no longer tracked) remain omitted.
|
|
73
|
+
* Reported windows, future resets and the optional age keep the shared
|
|
74
|
+
* formatter's wording and order.
|
|
70
75
|
*/
|
|
71
76
|
export declare function quotaWindowParts(quota: ProjectedQuota | undefined, options: QuotaTextOptions): QuotaParts;
|
|
72
77
|
/**
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** An eligible vault route, not a local pool row. */
|
|
2
|
+
export interface RoutingCandidate {
|
|
3
|
+
/** Vault account id, not the plugin's route id. */
|
|
4
|
+
accountId: string;
|
|
5
|
+
credentialId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AskRoutingInput<Candidate extends RoutingCandidate = RoutingCandidate> {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
provider: string;
|
|
10
|
+
modelId: string;
|
|
11
|
+
/** Only routes already eligible under the plugin's vault and killswitch rules. */
|
|
12
|
+
candidates: readonly Candidate[];
|
|
13
|
+
/** Defaults to 500 ms, clamped to 1–2000 ms. */
|
|
14
|
+
deadlineMs?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface RoutingHold {
|
|
17
|
+
/** Uncapped advice from routing. The plugin must apply its own hold cap. */
|
|
18
|
+
retry_after_ms: number;
|
|
19
|
+
}
|
|
20
|
+
export interface RoutingSelection<Candidate extends RoutingCandidate = RoutingCandidate> {
|
|
21
|
+
/** The original eligible candidate, including any plugin-specific metadata. */
|
|
22
|
+
candidate: Candidate;
|
|
23
|
+
hold?: RoutingHold;
|
|
24
|
+
}
|
|
25
|
+
interface RoutingReportIdentity {
|
|
26
|
+
sessionId: string;
|
|
27
|
+
accountId: string;
|
|
28
|
+
credentialId?: string;
|
|
29
|
+
}
|
|
30
|
+
export type ReportRoutingInput = RoutingReportIdentity & ({
|
|
31
|
+
outcome: 'served';
|
|
32
|
+
/**
|
|
33
|
+
* Pass only rate-limit headers, never the whole response headers.
|
|
34
|
+
* Values are forwarded unchanged; do not include tokens, emails or labels.
|
|
35
|
+
*/
|
|
36
|
+
headers: Readonly<Record<string, string>>;
|
|
37
|
+
} | {
|
|
38
|
+
outcome: 'exhausted';
|
|
39
|
+
/** The exhausted quota window; keep scoped quota groups in `pool`. */
|
|
40
|
+
window: '5h' | '7d';
|
|
41
|
+
/**
|
|
42
|
+
* Scoped quota group, such as `non-gemini`.
|
|
43
|
+
* Must be a non-empty string without `:`. Omit to block the whole
|
|
44
|
+
* account; include to block only this pool.
|
|
45
|
+
*/
|
|
46
|
+
pool?: string;
|
|
47
|
+
/** Optional reset time in epoch milliseconds. */
|
|
48
|
+
resetsAt?: number;
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Ask routing for an eligible vault route. Any failure or unfamiliar answer
|
|
52
|
+
* yields undefined so the plugin can keep its own choice. This does not admit
|
|
53
|
+
* routes: callers must exclude vault refusals and killswitch-blocked accounts.
|
|
54
|
+
*/
|
|
55
|
+
export declare function askRouting<Candidate extends RoutingCandidate>(input: AskRoutingInput<Candidate>): Promise<RoutingSelection<Candidate> | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* Report a vault request without waiting for routing. Only contract fields are
|
|
58
|
+
* sent, and all accessor failures are ignored. Headers must already be limited
|
|
59
|
+
* to rate-limit headers by the caller; values are not filtered or redacted here.
|
|
60
|
+
*/
|
|
61
|
+
export declare function reportRouting(input: ReportRoutingInput): void;
|
|
62
|
+
export {};
|
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.9",
|
|
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.33.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@cortexkit/claustrum-client": "0.13.0",
|