@cortexkit/anthropic-auth-core 2.16.4 → 2.16.5
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/accounts.d.ts +2 -0
- package/dist/index.js +446 -206
- package/dist/insula-quota.d.ts +2 -1
- package/dist/message-thread-tail-store.d.ts +36 -0
- package/dist/message-threads.d.ts +8 -13
- package/dist/native-account-runtime.d.ts +1 -1
- package/dist/native-vault-runtime.d.ts +3 -1
- package/package.json +1 -1
package/dist/insula-quota.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare function normalizeInsulaClaudeQuota(entry: InsulaUsageEntry, cont
|
|
|
19
19
|
* a window read after insula's fetch (a response header, or our own poll).
|
|
20
20
|
* Stored quota is replaced as one snapshot, newest wins, so publishing the
|
|
21
21
|
* older insula reading as is would be refused and lose its other windows.
|
|
22
|
-
* Keep
|
|
22
|
+
* Keep newer standard windows, but take scoped limits and credits together
|
|
23
|
+
* from the newest poll, including fields it no longer reports.
|
|
23
24
|
*/
|
|
24
25
|
export declare function mergeInsulaQuota(reading: InsulaClaudeQuota, stored: OAuthQuotaSnapshot | undefined): OAuthQuotaSnapshot;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type MessageThreadTailHost = 'opencode2' | 'pi';
|
|
2
|
+
export interface FullCacheTail {
|
|
3
|
+
identity: string;
|
|
4
|
+
messageIndex: number;
|
|
5
|
+
blockPath: number[];
|
|
6
|
+
prefix: string;
|
|
7
|
+
control: {
|
|
8
|
+
type: 'ephemeral';
|
|
9
|
+
ttl?: '1h' | '5m';
|
|
10
|
+
};
|
|
11
|
+
acceptedAt: number;
|
|
12
|
+
}
|
|
13
|
+
interface Entry {
|
|
14
|
+
continued: boolean;
|
|
15
|
+
tail: FullCacheTail;
|
|
16
|
+
}
|
|
17
|
+
export declare function fullCacheTailExpired(tail: FullCacheTail, now: number): boolean;
|
|
18
|
+
/** Saves where each accepted full request marked its prefix, without saving the request. */
|
|
19
|
+
export declare class MessageThreadTailStore {
|
|
20
|
+
private readonly now;
|
|
21
|
+
readonly directory: string;
|
|
22
|
+
private writes;
|
|
23
|
+
private nextSweep;
|
|
24
|
+
constructor(host: MessageThreadTailHost, root?: string, now?: () => number);
|
|
25
|
+
private pathFor;
|
|
26
|
+
private directoryReady;
|
|
27
|
+
private read;
|
|
28
|
+
load(session: string): Promise<Entry | undefined>;
|
|
29
|
+
private enqueue;
|
|
30
|
+
changed(session: string, tail: FullCacheTail | undefined, continued: boolean): void;
|
|
31
|
+
private publish;
|
|
32
|
+
private removeUnchanged;
|
|
33
|
+
private prune;
|
|
34
|
+
drain(): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FullCacheTail, type MessageThreadTailHost, MessageThreadTailStore } from './message-thread-tail-store.ts';
|
|
1
2
|
import type { NativeLocalPoolBinding } from './pool-binding.ts';
|
|
2
3
|
export declare const MESSAGE_THREADS_BETA = "message-threads-2026-08-12";
|
|
3
4
|
type Body = Record<string, unknown>;
|
|
@@ -34,7 +35,7 @@ export type MessageThreadDecision = {
|
|
|
34
35
|
deltaMessages: unknown[];
|
|
35
36
|
};
|
|
36
37
|
export type MessageThreadCreateReason = 'no_anchor' | 'clock_rollback' | 'expired' | 'identity_changed' | 'too_few_messages' | 'assistant_missing' | 'extra_assistant' | 'reply_invalid' | 'reply_changed' | 'fixed_changed' | 'prefix_changed' | 'ttl_order' | 'stateless';
|
|
37
|
-
export type MessageThreadDisposition = 'never_seen' | 'superseded' | 'stream_cancelled' | 'stream_error' | 'signal_aborted' | 'invalid_completion' | 'invalid_reply' | 'response_refusal' | 'response_fallback' | 'response_rewritten' | 'thread_rejected' | 'account_disabled' | 'evicted' | 'session_deleted';
|
|
38
|
+
export type MessageThreadDisposition = 'never_seen' | 'superseded' | 'stream_cancelled' | 'stream_error' | 'signal_aborted' | 'invalid_completion' | 'invalid_reply' | 'response_refusal' | 'response_fallback' | 'response_rewritten' | 'thread_rejected' | 'account_disabled' | 'evicted' | 'session_closed' | 'session_deleted';
|
|
38
39
|
/** Refresh preserves the local epoch; replacing a login advances it even when the row id is reused. */
|
|
39
40
|
export declare function localMessageThreadCredential(binding: NativeLocalPoolBinding): string;
|
|
40
41
|
type ReplyToolName = (name: unknown) => string | undefined;
|
|
@@ -53,17 +54,6 @@ export interface MessageThreadCompletion {
|
|
|
53
54
|
replyFingerprint?: string;
|
|
54
55
|
reply?: unknown;
|
|
55
56
|
}
|
|
56
|
-
interface FullCacheTail {
|
|
57
|
-
identity: string;
|
|
58
|
-
messageIndex: number;
|
|
59
|
-
blockPath: number[];
|
|
60
|
-
prefix: string;
|
|
61
|
-
control: {
|
|
62
|
-
type: 'ephemeral';
|
|
63
|
-
ttl?: '1h' | '5m';
|
|
64
|
-
};
|
|
65
|
-
acceptedAt: number;
|
|
66
|
-
}
|
|
67
57
|
interface FixedCacheLayout {
|
|
68
58
|
lifetime: string;
|
|
69
59
|
system: Array<{
|
|
@@ -76,6 +66,7 @@ interface FixedCacheLayout {
|
|
|
76
66
|
}>;
|
|
77
67
|
}
|
|
78
68
|
export declare class MessageThreadTracker {
|
|
69
|
+
#private;
|
|
79
70
|
private readonly capacity;
|
|
80
71
|
private readonly now;
|
|
81
72
|
private readonly hashBudget;
|
|
@@ -84,7 +75,11 @@ export declare class MessageThreadTracker {
|
|
|
84
75
|
private readonly dispositions;
|
|
85
76
|
private readonly instance;
|
|
86
77
|
private readonly fullTails;
|
|
87
|
-
constructor(capacity?: number, now?: () => number, hashBudget?: number);
|
|
78
|
+
constructor(capacity?: number, now?: () => number, hashBudget?: number, tailStore?: MessageThreadTailStore);
|
|
79
|
+
static withTailPersistence(host: MessageThreadTailHost): MessageThreadTracker;
|
|
80
|
+
private canLoadFullTail;
|
|
81
|
+
loadFullTail(session: string): Promise<void> | undefined;
|
|
82
|
+
private rememberFullTail;
|
|
88
83
|
forget(session: string, disposition?: MessageThreadDisposition): void;
|
|
89
84
|
private prune;
|
|
90
85
|
private failureFor;
|
|
@@ -13,7 +13,7 @@ import { type NativeRuntimeSettingsOptions, type NativeRuntimeSettingsStatus } f
|
|
|
13
13
|
import { type NativeDisplayProfile, type NativeVaultQuotaPurpose, type NativeVaultRuntime, type NativeVaultRuntimeOptions } from './native-vault-runtime.ts';
|
|
14
14
|
import { type NativeLocalPoolBinding } from './pool-binding.ts';
|
|
15
15
|
import { type NativePoolPaths } from './pool-paths.ts';
|
|
16
|
-
import type
|
|
16
|
+
import { type QuotaRequestDispatch } from './quota-manager.ts';
|
|
17
17
|
import { type RelayConfig } from './relay.ts';
|
|
18
18
|
import { type RelocationGuard } from './relocation-guard.ts';
|
|
19
19
|
import type { SettingsMoveDiagnostic } from './settings-mode-status.ts';
|
|
@@ -45,6 +45,8 @@ export interface NativeVaultRuntimeOptions {
|
|
|
45
45
|
* minute per daemon and enrollment), look the route's account up in it,
|
|
46
46
|
* and skip the usage GET for a current reading, a cold cache or an upstream
|
|
47
47
|
* failure. Skipped misses leave the account due for the next sweep.
|
|
48
|
+
* - 'background-cache': apply a current reading from the already-warmed
|
|
49
|
+
* cache even if recent headers mean a provider poll is not due.
|
|
48
50
|
* - 'admission': a request needs a reading. Look the served credential's
|
|
49
51
|
* account up in insula's cache only, never refreshing it, then poll on a
|
|
50
52
|
* miss except an upstream failure, which uses a dated reading if attached
|
|
@@ -52,7 +54,7 @@ export interface NativeVaultRuntimeOptions {
|
|
|
52
54
|
* Omitted: poll Anthropic directly (explicit user refreshes and other
|
|
53
55
|
* callers that must see the provider's own reading).
|
|
54
56
|
*/
|
|
55
|
-
export type NativeVaultQuotaPurpose = QuotaReadingPurpose;
|
|
57
|
+
export type NativeVaultQuotaPurpose = QuotaReadingPurpose | 'background-cache';
|
|
56
58
|
export interface NativeVaultWatchOptions {
|
|
57
59
|
intervalMs: number;
|
|
58
60
|
onRefresh?: () => void | Promise<void>;
|