@cortexkit/anthropic-auth-core 2.9.0 → 2.10.0
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/billing.d.ts +23 -0
- package/dist/cachekeep-registry.d.ts +1 -1
- package/dist/cachekeep.d.ts +7 -0
- package/dist/dump.d.ts +3 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2534 -1603
- package/dist/internal-types/claustrum/availability.d.ts +7 -1
- package/dist/internal-types/claustrum/custody.d.ts +11 -2
- package/dist/internal-types/claustrum/enrollment.d.ts +29 -4
- package/dist/internal-types/claustrum/index.d.ts +1 -1
- package/dist/internal-types/routing-accessor/cache-policy.d.ts +3 -0
- package/dist/internal-types/routing-accessor/index.d.ts +48 -5
- package/dist/internal-types/setup/command-error.d.ts +1 -1
- package/dist/internal-types/setup/enroll.d.ts +2 -2
- package/dist/internal-types/setup/index.d.ts +1 -1
- package/dist/internal-types/setup/types.d.ts +13 -1
- package/dist/message-threads.d.ts +2 -0
- package/dist/models.d.ts +4 -1
- package/dist/native-account-runtime.d.ts +2 -0
- package/dist/native-custody.d.ts +0 -2
- package/dist/relay.d.ts +2 -0
- package/dist/routing-peek.d.ts +15 -0
- package/dist/sticky-routing.d.ts +12 -0
- package/dist/stream-completion.d.ts +26 -0
- package/package.json +3 -3
|
@@ -85,6 +85,12 @@ export declare const VAULT_FAILURE_CLASSES: Readonly<{
|
|
|
85
85
|
* kind stays `unavailable` for callers handling ClaustrumConsumerError.
|
|
86
86
|
*/
|
|
87
87
|
export declare class ClaustrumUnreachableError extends ClaustrumConsumerError {
|
|
88
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Non-secret host connection diagnostic. A missing accessor can recover
|
|
90
|
+
* once the host bridge installs; a failed accessor could not provide a client.
|
|
91
|
+
* Other unreachable failures leave this unset. Never use adapter error text.
|
|
92
|
+
*/
|
|
93
|
+
readonly reason?: 'host-accessor-missing' | 'host-accessor-failed';
|
|
94
|
+
constructor(reason?: ClaustrumUnreachableError['reason']);
|
|
89
95
|
}
|
|
90
96
|
export declare function classifyVaultFailure(error: unknown): VaultFailureClass;
|
|
@@ -279,6 +279,15 @@ export declare class ClaustrumScopedCustody {
|
|
|
279
279
|
setTimeoutImpl?: typeof setTimeout;
|
|
280
280
|
clearTimeoutImpl?: typeof clearTimeout;
|
|
281
281
|
});
|
|
282
|
+
/**
|
|
283
|
+
* Replace the connection to the same vault without discarding receipts or
|
|
284
|
+
* their enrollment tokens. Open roster watches restart on the new client;
|
|
285
|
+
* their existing handles remain usable. Passing the current client does nothing.
|
|
286
|
+
* Neither client is closed here: the caller closes the old one, and custody's
|
|
287
|
+
* close()/dispose() still closes the client it holds at shutdown.
|
|
288
|
+
* While hosted, next must come from connectVaultHost, as in the constructor.
|
|
289
|
+
*/
|
|
290
|
+
replaceClient(next: ClaustrumScopedClient): void;
|
|
282
291
|
/** A watch losing its transport is the same outage as an unreachable read. */
|
|
283
292
|
transportLost(error?: unknown): void;
|
|
284
293
|
/** Any vault answer ends transport fallback, even when it refuses access. */
|
|
@@ -312,8 +321,8 @@ export declare class ClaustrumScopedCustody {
|
|
|
312
321
|
* Report that a send this consumer actually made was rejected. Only a 401
|
|
313
322
|
* is reported (the vault refuses 429, 402 and 5xx reports), addressed by
|
|
314
323
|
* credential id with the exact record version that send was served, and
|
|
315
|
-
* sent through the client
|
|
316
|
-
* this custody did not issue is refused rather than reported.
|
|
324
|
+
* sent through the current client with the enrollment token that authorized
|
|
325
|
+
* it. A receipt this custody did not issue is refused rather than reported.
|
|
317
326
|
*/
|
|
318
327
|
reportFailure(attempt: ClaustrumScopedAttempt, status: number, reporterSource: ClaustrumReporterSource): Promise<void>;
|
|
319
328
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ClaustrumClientOptions as ClaustrumEnrollmentClientOptions, type EnrollmentPollOutcome, type EnrollmentTokenFile, writeEnrollmentTokenFile } from '@cortexkit/claustrum-client';
|
|
1
|
+
import { type ClaustrumClientOptions as ClaustrumEnrollmentClientOptions, ClaustrumClient as ClaustrumWireClient, type EnrollmentPollOutcome, type EnrollmentTokenFile, writeEnrollmentTokenFile } from '@cortexkit/claustrum-client';
|
|
2
2
|
/**
|
|
3
3
|
* The code a vault without the enrollment ceremony answers a proposal with.
|
|
4
4
|
* Setup reports it as "this vault cannot connect plugins" instead of waiting.
|
|
@@ -29,10 +29,31 @@ export declare function classifyEnrollmentError(error: unknown): {
|
|
|
29
29
|
* Each host enrolls separately so the operator can revoke one without the other.
|
|
30
30
|
*/
|
|
31
31
|
export declare function enrollmentName(plugin: string, host: string): string;
|
|
32
|
+
/** Match the vault's plain-text, code-point limit before proposing a display name. */
|
|
33
|
+
export declare function validEnrollmentDisplayName(displayName: string): boolean;
|
|
34
|
+
export type ClaustrumRequestedGrant = {
|
|
35
|
+
selector: {
|
|
36
|
+
category: string;
|
|
37
|
+
exact?: never;
|
|
38
|
+
} | {
|
|
39
|
+
exact: string;
|
|
40
|
+
category?: never;
|
|
41
|
+
};
|
|
42
|
+
operation: 'read' | 'list';
|
|
43
|
+
};
|
|
44
|
+
/** Reject malformed permissions before a compatibility retry can omit them. */
|
|
45
|
+
export declare function validEnrollmentRequestedGrants(grants: unknown): grants is ReadonlyArray<ClaustrumRequestedGrant>;
|
|
46
|
+
interface EnrollmentGrantProposal {
|
|
47
|
+
requestedGrants?: ReadonlyArray<ClaustrumRequestedGrant>;
|
|
48
|
+
/** Sent is not proof of access: the operator can approve without grants. */
|
|
49
|
+
requestedGrantsStatus?: 'sent' | 'dropped';
|
|
50
|
+
}
|
|
32
51
|
export interface ClaustrumEnrollmentClient {
|
|
33
52
|
enrollPropose(input: {
|
|
34
53
|
name: string;
|
|
35
54
|
requestSecretHash: string;
|
|
55
|
+
displayName?: string;
|
|
56
|
+
requestedGrants?: ReadonlyArray<ClaustrumRequestedGrant>;
|
|
36
57
|
}): Promise<{
|
|
37
58
|
requestId: string;
|
|
38
59
|
}>;
|
|
@@ -43,6 +64,7 @@ export interface ClaustrumEnrollmentClient {
|
|
|
43
64
|
}
|
|
44
65
|
export interface ClaustrumEnrollmentConnection extends ClaustrumEnrollmentClient {
|
|
45
66
|
close(): void;
|
|
67
|
+
listScoped?: ClaustrumWireClient['listScoped'];
|
|
46
68
|
}
|
|
47
69
|
/**
|
|
48
70
|
* Connect the enrollment ceremony. Setup calls this; the request path never
|
|
@@ -54,17 +76,17 @@ export declare function connectClaustrumEnrollmentClient(options: ClaustrumEnrol
|
|
|
54
76
|
}): Promise<ClaustrumEnrollmentConnection>;
|
|
55
77
|
export type ClaustrumEnrollmentStatus = {
|
|
56
78
|
state: 'idle';
|
|
57
|
-
} | {
|
|
79
|
+
} | (EnrollmentGrantProposal & {
|
|
58
80
|
state: 'pending';
|
|
59
81
|
proposedName: string;
|
|
60
82
|
requestId?: string;
|
|
61
83
|
retryCode?: string;
|
|
62
|
-
} | {
|
|
84
|
+
}) | (EnrollmentGrantProposal & {
|
|
63
85
|
state: 'approved';
|
|
64
86
|
proposedName: string;
|
|
65
87
|
approvedName?: string;
|
|
66
88
|
tokenGeneration: number;
|
|
67
|
-
} | {
|
|
89
|
+
}) | {
|
|
68
90
|
state: 'denied';
|
|
69
91
|
proposedName: string;
|
|
70
92
|
} | {
|
|
@@ -142,6 +164,8 @@ export declare class ClaustrumEnrollmentManager {
|
|
|
142
164
|
client: ClaustrumEnrollmentClient;
|
|
143
165
|
paths: ClaustrumEnrollmentPaths;
|
|
144
166
|
proposedName: string;
|
|
167
|
+
displayName?: string;
|
|
168
|
+
requestedGrants?: ReadonlyArray<ClaustrumRequestedGrant>;
|
|
145
169
|
now?: () => number;
|
|
146
170
|
mintSecret?: () => string;
|
|
147
171
|
writeTokenFile?: typeof writeEnrollmentTokenFile;
|
|
@@ -178,3 +202,4 @@ export type ClaustrumEnrollmentDisconnectResult = 'disconnected' | 'idle' | 'bus
|
|
|
178
202
|
* wrong owner, not owner-only) refuses with `unsafe-file` and both files stay.
|
|
179
203
|
*/
|
|
180
204
|
export declare function disconnectClaustrumEnrollment(paths: ClaustrumEnrollmentPaths, proposedName: string): Promise<ClaustrumEnrollmentDisconnectResult>;
|
|
205
|
+
export {};
|
|
@@ -4,7 +4,7 @@ export { ClaustrumCredentialError, type ClaustrumReporterSource, type Enrollment
|
|
|
4
4
|
export { ClaustrumUnreachableError, classifyVaultFailure, VAULT_FAILURE_CLASSES, type VaultFailureClass, } from './availability.js';
|
|
5
5
|
export { ClaustrumConsumer, type ClaustrumConsumerOptions, type ClaustrumWatchState, DEFAULT_CONNECT_TIMEOUT_MS, type SendOptions, } from './consumer.js';
|
|
6
6
|
export { type AccountIdentitySource, type ClassifyingClaustrumFamily, type ClaustrumFamily, type ClaustrumFamilyInput, type ClaustrumRosterWatch, type ClaustrumRosterWatchOptions, type ClaustrumScopedAttempt, type ClaustrumScopedClient, ClaustrumScopedCustody, type ClaustrumScopedIdentity, decideScopedRetryAfter401, type IdentityParser, isScopedCredentialRotation, KEPT_RECEIPT_MARGIN_MS, type KeptReceiptState, type ScopedRetryReason, SERVING_MARGIN_MS, type SkippedVaultReason, type SkippedVaultRecord, type VaultCredential, type VaultCredentialType, type VaultGrantReach, type VaultGrantTuple, type VaultInventory, type VaultRowFacts, } from './custody.js';
|
|
7
|
-
export { type ClaustrumEnrollmentClient, type ClaustrumEnrollmentConnection, type ClaustrumEnrollmentDisconnectResult, ClaustrumEnrollmentManager, type ClaustrumEnrollmentPaths, type ClaustrumEnrollmentResetResult, type ClaustrumEnrollmentStatus, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, type EnrollmentDisposition, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, vaultAuthority, } from './enrollment.js';
|
|
7
|
+
export { type ClaustrumEnrollmentClient, type ClaustrumEnrollmentConnection, type ClaustrumEnrollmentDisconnectResult, ClaustrumEnrollmentManager, type ClaustrumEnrollmentPaths, type ClaustrumEnrollmentResetResult, type ClaustrumEnrollmentStatus, type ClaustrumRequestedGrant, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, type EnrollmentDisposition, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, validEnrollmentDisplayName, validEnrollmentRequestedGrants, vaultAuthority, } from './enrollment.js';
|
|
8
8
|
export { ClaustrumConsumerError, type ClaustrumConsumerFailureKind, type ClaustrumLogger, } from './errors.js';
|
|
9
9
|
export { connectVaultHost, hasVaultHost, VAULT_HOST_CONNECT_REFUSAL, VAULT_HOST_STATUS, } from './host.js';
|
|
10
10
|
export { assertHostSlotMatchesMode, assertNotCustodyPlaceholder, CUSTODY_PLACEHOLDER_PREFIX, classifyHostSlot, custodyPlaceholder, custodyPlaceholderKey, type HostSlotContent, isCustodyPlaceholder, isCustodyPlaceholderValue, } from './host-slot.js';
|
|
@@ -14,6 +14,9 @@ export interface SessionToolWait {
|
|
|
14
14
|
/** Epoch milliseconds when the oldest running plan tool started. */
|
|
15
15
|
since: number;
|
|
16
16
|
}
|
|
17
|
+
export declare const CACHE_WARM_STOP_REASONS: readonly ['cost-cap', 'count-cap', 'outside-hours', 'session-ended', 'unsupported'];
|
|
18
|
+
/** Billing rejects unknown stop reasons; omit them rather than guessing. */
|
|
19
|
+
export declare function isCacheWarmStopReason(value: unknown): value is (typeof CACHE_WARM_STOP_REASONS)[number];
|
|
17
20
|
/**
|
|
18
21
|
* The stop reasons the llm-runner contract defines today; any other string is
|
|
19
22
|
* accepted too, for reasons that contract adds later.
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* shaping. Account ids are vault account ids, not local pool rows. Nothing is
|
|
4
4
|
* persisted here; plugins on routes the runner does not serve get no turn notes.
|
|
5
5
|
*/
|
|
6
|
+
import { type CacheWarmStopReason } from './cache-policy.js';
|
|
6
7
|
export type { CacheTouchInput, CacheWarmStoppedInput, CacheWarmStopReason, SessionCacheHours, SessionCachePolicy, SessionCacheTtl, SessionKeepWarmMode, SessionToolWait, } from './cache-policy.js';
|
|
7
|
-
export { reportCacheTouch, reportCacheWarmStopped, sessionCachePolicy, sessionToolWait, } from './cache-policy.js';
|
|
8
|
+
export { CACHE_WARM_STOP_REASONS, isCacheWarmStopReason, reportCacheTouch, reportCacheWarmStopped, sessionCachePolicy, sessionToolWait, } from './cache-policy.js';
|
|
8
9
|
/** An eligible vault route, not a local pool row. */
|
|
9
10
|
export interface RoutingCandidate {
|
|
10
11
|
/** Vault account id, not the plugin's route id. */
|
|
@@ -42,6 +43,19 @@ interface RoutingReportIdentity {
|
|
|
42
43
|
accountId: string;
|
|
43
44
|
credentialId?: string;
|
|
44
45
|
}
|
|
46
|
+
export type BillingRequestKind = 'primary' | 'title' | 'compaction' | 'generate' | 'keep_warm' | 'prime';
|
|
47
|
+
export type BillingOutcome = 'completed' | 'cut' | 'failed';
|
|
48
|
+
/** Omit unread counts; zero represents a measured count, not a default. */
|
|
49
|
+
export interface BillingUsage {
|
|
50
|
+
input?: number;
|
|
51
|
+
output?: number;
|
|
52
|
+
cacheRead?: number;
|
|
53
|
+
cacheWrite?: number;
|
|
54
|
+
cacheWrite5m?: number;
|
|
55
|
+
cacheWrite1h?: number;
|
|
56
|
+
reasoning?: number;
|
|
57
|
+
reasoningIncludedInOutput?: boolean;
|
|
58
|
+
}
|
|
45
59
|
export type ReportRoutingInput = (RoutingReportIdentity & ({
|
|
46
60
|
outcome: 'served';
|
|
47
61
|
/**
|
|
@@ -73,6 +87,35 @@ export type ReportRoutingInput = (RoutingReportIdentity & ({
|
|
|
73
87
|
kind: 'turn_note_skipped';
|
|
74
88
|
after_tool_use_id: string;
|
|
75
89
|
reason: 'anchor_missing' | 'before_user_message' | 'unsupported_model' | 'not_oauth';
|
|
90
|
+
} | {
|
|
91
|
+
sessionId: string;
|
|
92
|
+
kind: 'billing';
|
|
93
|
+
attemptId: string;
|
|
94
|
+
requestKind: BillingRequestKind;
|
|
95
|
+
credentialId: string;
|
|
96
|
+
accountId?: string;
|
|
97
|
+
provider: string;
|
|
98
|
+
model: string;
|
|
99
|
+
outcome: BillingOutcome;
|
|
100
|
+
providerRequestId?: string;
|
|
101
|
+
providerResponseId?: string;
|
|
102
|
+
userMessageId?: string;
|
|
103
|
+
status?: number;
|
|
104
|
+
attempt?: number;
|
|
105
|
+
chargeBasis?: 'subscription_included' | 'metered_api';
|
|
106
|
+
usage?: BillingUsage;
|
|
107
|
+
usageByModel?: readonly {
|
|
108
|
+
modelUsed: string;
|
|
109
|
+
usage: BillingUsage;
|
|
110
|
+
}[];
|
|
111
|
+
cache?: {
|
|
112
|
+
ttlMs?: number;
|
|
113
|
+
implicit?: true;
|
|
114
|
+
warming?: {
|
|
115
|
+
on: boolean;
|
|
116
|
+
stopReason?: CacheWarmStopReason;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
76
119
|
};
|
|
77
120
|
/**
|
|
78
121
|
* Read advisory input for request shaping, in landing order, without persisting
|
|
@@ -90,9 +133,9 @@ export declare function turnNotes(sessionId: string): readonly {
|
|
|
90
133
|
*/
|
|
91
134
|
export declare function askRouting<Candidate extends RoutingCandidate>(input: AskRoutingInput<Candidate>): Promise<RoutingSelection<Candidate> | undefined>;
|
|
92
135
|
/**
|
|
93
|
-
* Report a vault request or turn-note event without waiting for
|
|
94
|
-
* contract fields are sent, and all accessor failures are ignored.
|
|
95
|
-
* already be limited to rate-limit headers by the caller; values
|
|
96
|
-
* or redacted here.
|
|
136
|
+
* Report a vault request, billing result or turn-note event without waiting for
|
|
137
|
+
* routing. Only contract fields are sent, and all accessor failures are ignored.
|
|
138
|
+
* Headers must already be limited to rate-limit headers by the caller; values
|
|
139
|
+
* are not filtered or redacted here.
|
|
97
140
|
*/
|
|
98
141
|
export declare function reportRouting(input: ReportRoutingInput): void;
|
|
@@ -17,7 +17,7 @@ export declare class SetupCommandError extends Error {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
/** The line setup prints for one host's outcome, e.g. `Pi: not connected`. */
|
|
20
|
-
export declare function setupEnrollmentLine({ host, outcome, }: SetupHostEnrollment): string;
|
|
20
|
+
export declare function setupEnrollmentLine({ host, outcome, access, }: SetupHostEnrollment): string;
|
|
21
21
|
/**
|
|
22
22
|
* Remember which hosts a failed setup left connected to the vault, against the
|
|
23
23
|
* thrown value. Only objects can carry a record; a thrown primitive is left as
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MenuTerminal } from '../auth-menu/terminal.js';
|
|
2
|
-
import type { SetupHost, SetupIO, SetupPlugin } from './types.js';
|
|
2
|
+
import type { SetupEnrollmentAccess, SetupHost, SetupIO, SetupPlugin } from './types.js';
|
|
3
3
|
/** Fixed text: no version, host or account detail, so it is safe to print anywhere. */
|
|
4
4
|
export declare const UNSUPPORTED_VAULT_MESSAGE = "This Claustrum vault is too old to connect plugins. Run ck upgrade to move to Claustrum v0.2.0 or newer (read \"Upgrading from v0.1.3\" in its release notes first), or run setup without --claustrum to use local accounts.";
|
|
5
5
|
/**
|
|
@@ -31,4 +31,4 @@ export declare class HostNotEnrolledError extends Error {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
/** Enroll an independently revocable host; plugin callbacks choose its credential store and account permissions. */
|
|
34
|
-
export declare function connectSetupHost(plugin: SetupPlugin, host: SetupHost, io: SetupIO, terminal: MenuTerminal, fence: () => Promise<void>): Promise<
|
|
34
|
+
export declare function connectSetupHost(plugin: SetupPlugin, host: SetupHost, io: SetupIO, terminal: MenuTerminal, fence: () => Promise<void>): Promise<SetupEnrollmentAccess | undefined>;
|
|
@@ -5,4 +5,4 @@ export { ENROLLMENT_WAIT_MS, HostNotEnrolledError, type HostNotEnrolledReason, U
|
|
|
5
5
|
export { setupUsage } from './flags.js';
|
|
6
6
|
export { assertHostsStopped, createProcessFence, listSetupProcesses, ProcessFenceViolationError, ProcessInspectionError, type ProcessInspectionStep, } from './process-fence.js';
|
|
7
7
|
export { type PlannedWrite, planOpenCodeRegistration, registerOpenCode, registerPi, updatePluginConfig, } from './register.js';
|
|
8
|
-
export type { CommandResult, CommandRunner, HostDetection, OpenCodeGeneration, ProcessFence, SetupCallbackContext, SetupDetection, SetupEnrollmentOutcome, SetupEnvironment, SetupFileSystem, SetupHost, SetupHostEnrollment, SetupIO, SetupPlugin, SetupResult, } from './types.js';
|
|
8
|
+
export type { CommandResult, CommandRunner, HostDetection, OpenCodeGeneration, ProcessFence, SetupCallbackContext, SetupDetection, SetupEnrollmentAccess, SetupEnrollmentOutcome, SetupEnvironment, SetupFileSystem, SetupHost, SetupHostEnrollment, SetupIO, SetupPlugin, SetupResult, } from './types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MenuTerminal } from '../auth-menu/terminal.js';
|
|
2
|
-
import type { ClaustrumEnrollmentConnection, hostEnrollmentPaths } from '../claustrum/index.js';
|
|
2
|
+
import type { ClaustrumEnrollmentConnection, ClaustrumRequestedGrant, hostEnrollmentPaths } from '../claustrum/index.js';
|
|
3
3
|
export type SetupHost = 'opencode' | 'pi';
|
|
4
4
|
export type OpenCodeGeneration = '1' | '2' | 'both';
|
|
5
5
|
export type SetupEnvironment = Record<string, string | undefined>;
|
|
@@ -11,9 +11,19 @@ export type SetupEnvironment = Record<string, string | undefined>;
|
|
|
11
11
|
* flight and the host's token file could not settle it.
|
|
12
12
|
*/
|
|
13
13
|
export type SetupEnrollmentOutcome = 'enrolled' | 'not-enrolled' | 'unknown';
|
|
14
|
+
export interface SetupEnrollmentAccess {
|
|
15
|
+
state: 'reachable' | 'no-logins' | 'partial' | 'older-vault' | 'unconfirmed';
|
|
16
|
+
/** One result per requested grant, in proposal order. No count means unknown. */
|
|
17
|
+
grants: readonly {
|
|
18
|
+
grant: ClaustrumRequestedGrant;
|
|
19
|
+
reachableLogins?: number;
|
|
20
|
+
grantCommand?: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
14
23
|
export interface SetupHostEnrollment {
|
|
15
24
|
host: SetupHost;
|
|
16
25
|
outcome: SetupEnrollmentOutcome;
|
|
26
|
+
access?: SetupEnrollmentAccess;
|
|
17
27
|
}
|
|
18
28
|
/**
|
|
19
29
|
* What setup decided before calling a plugin callback. The OpenCode generation
|
|
@@ -50,6 +60,8 @@ export interface SetupPlugin {
|
|
|
50
60
|
connectionFile: string;
|
|
51
61
|
hosts: Record<SetupHost, {
|
|
52
62
|
name: string;
|
|
63
|
+
displayName?: string;
|
|
64
|
+
requestedGrants?: ReadonlyArray<ClaustrumRequestedGrant>;
|
|
53
65
|
paths: Parameters<typeof hostEnrollmentPaths>[0];
|
|
54
66
|
}>;
|
|
55
67
|
};
|
|
@@ -35,6 +35,8 @@ export type MessageThreadDisposition = 'never_seen' | 'superseded' | 'stream_can
|
|
|
35
35
|
/** Refresh preserves the local epoch; replacing a login advances it even when the row id is reused. */
|
|
36
36
|
export declare function localMessageThreadCredential(binding: NativeLocalPoolBinding): string;
|
|
37
37
|
type ReplyToolName = (name: unknown) => string | undefined;
|
|
38
|
+
/** Canonical cacheable prefix through one content block, using thread history rules. */
|
|
39
|
+
export declare function messageThreadCachePrefix(body: Body, messageIndex: number, blockIndex: number): string | undefined;
|
|
38
40
|
export declare function messageThreadSnapshot(input: MessageThreadInput, identity?: string, fingerprint?: string): MessageThreadSnapshot;
|
|
39
41
|
/** Decide from immutable request facts; no session state or clock is read here. */
|
|
40
42
|
export declare function decideMessageThread(anchor: MessageThreadAnchor | undefined, input: MessageThreadInput, snapshot: MessageThreadSnapshot, now: number): MessageThreadDecision;
|
package/dist/models.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const CLAUDE_MYTHOS_5_MODEL_ID = "claude-mythos-5";
|
|
|
5
5
|
export declare const CLAUDE_FABLE_5_1_MODEL_ID = "claude-fable-5-1";
|
|
6
6
|
export declare const CLAUDE_FABLE_5_2_MODEL_ID = "claude-fable-5-2";
|
|
7
7
|
export declare const CLAUDE_MYTHOS_5_1_MODEL_ID = "claude-mythos-5-1";
|
|
8
|
+
export declare const CLAUDE_MYTHOS_5_2_MODEL_ID = "claude-mythos-5-2";
|
|
8
9
|
/**
|
|
9
10
|
* Haiku 4.5 model identifier used by `/claude-prime` to start each OAuth
|
|
10
11
|
* account's five-hour quota window with a minimal request. Usage is measured
|
|
@@ -22,7 +23,7 @@ export declare const CLAUDE_HAIKU_4_5_PRICING: {
|
|
|
22
23
|
readonly output: 5;
|
|
23
24
|
};
|
|
24
25
|
export declare const CLAUDE_FABLE_MYTHOS_5_1_MODEL_IDS: readonly ["claude-fable-5-1", "claude-mythos-5-1"];
|
|
25
|
-
export declare const CLAUDE_FABLE_MYTHOS_5_MODEL_IDS: readonly ["claude-fable-5", "claude-mythos-5", "claude-fable-5-1", "claude-mythos-5-1", "claude-fable-5-2"];
|
|
26
|
+
export declare const CLAUDE_FABLE_MYTHOS_5_MODEL_IDS: readonly ["claude-fable-5", "claude-mythos-5", "claude-fable-5-1", "claude-mythos-5-1", "claude-fable-5-2", "claude-mythos-5-2"];
|
|
26
27
|
export type ClaudeFableMythos5ModelId = (typeof CLAUDE_FABLE_MYTHOS_5_MODEL_IDS)[number];
|
|
27
28
|
export declare const CLAUDE_FABLE_MYTHOS_5_SUMMARIZED_THINKING: {
|
|
28
29
|
readonly type: 'adaptive';
|
|
@@ -32,6 +33,8 @@ export declare const CLAUDE_FABLE_MYTHOS_5_PRICING: import("./model-capabilities
|
|
|
32
33
|
export declare const CLAUDE_FABLE_MYTHOS_5_1_PRICING: import("./model-capabilities.ts").ClaudeModelPricing;
|
|
33
34
|
export declare const CLAUDE_FABLE_5_2_PRICING: import("./model-capabilities.ts").ClaudeModelPricing;
|
|
34
35
|
export declare const CLAUDE_FABLE_5_2_RELEASE_DATE: string;
|
|
36
|
+
export declare const CLAUDE_MYTHOS_5_2_PRICING: import("./model-capabilities.ts").ClaudeModelPricing;
|
|
37
|
+
export declare const CLAUDE_MYTHOS_5_2_RELEASE_DATE: string;
|
|
35
38
|
export declare const CLAUDE_FABLE_MYTHOS_5_CONTEXT_WINDOW: number;
|
|
36
39
|
export declare const CLAUDE_FABLE_MYTHOS_5_MAX_OUTPUT_TOKENS: number;
|
|
37
40
|
export declare const CLAUDE_FABLE_MYTHOS_5_RELEASE_DATE: string;
|
|
@@ -63,6 +63,8 @@ export interface NativeAccountRuntime {
|
|
|
63
63
|
getRelayConfig(): Promise<RelayConfig | null>;
|
|
64
64
|
updateRelay(patch: NativeRelayUpdate): Promise<void>;
|
|
65
65
|
read(): Promise<NativeAccountSnapshot>;
|
|
66
|
+
/** Last completed read, without disk I/O or credential/quota work. */
|
|
67
|
+
peek?(): NativeAccountSnapshot | undefined;
|
|
66
68
|
authorizeLocal(routeId: string, options?: NativeLocalAuthorizeOptions): Promise<NativeRefreshResult>;
|
|
67
69
|
authorizeApi(routeId: string, signal?: AbortSignal): Promise<{
|
|
68
70
|
type: 'api';
|
package/dist/native-custody.d.ts
CHANGED
|
@@ -223,8 +223,6 @@ export type NativeCustodyRetry = {
|
|
|
223
223
|
code?: NativeCustodyErrorCode;
|
|
224
224
|
};
|
|
225
225
|
export interface NativeCustody {
|
|
226
|
-
/** Whether a 401 needs fresh authorization because a previous relay issued the receipt. */
|
|
227
|
-
isPreviousConnectionReceipt?: (receipt: NativeCustodyReceipt) => boolean;
|
|
228
226
|
/** Authority lifetime only; replacing a relay does not retire issued tokens. */
|
|
229
227
|
readonly generation?: number;
|
|
230
228
|
discover: (signal?: AbortSignal) => Promise<NativeCustodyInventory>;
|
package/dist/relay.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AccountStorage } from './accounts.ts';
|
|
2
|
+
import { type AnthropicBillingRequest } from './billing.ts';
|
|
2
3
|
export type RelayConfig = {
|
|
3
4
|
enabled: boolean;
|
|
4
5
|
url: string;
|
|
@@ -34,6 +35,7 @@ export type RelayPatch = {
|
|
|
34
35
|
type RelayPatchSet = RelayPatch | RelayPatch[];
|
|
35
36
|
export type RelayAttemptAuthorization = {
|
|
36
37
|
headers: Headers;
|
|
38
|
+
billing?: AnthropicBillingRequest;
|
|
37
39
|
/** Called only for a genuine upstream response, never optimistic/transport status. */
|
|
38
40
|
onUpstreamStatus?: (status: number) => void;
|
|
39
41
|
/**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type NativeAccountSnapshot } from './native-account-view.ts';
|
|
2
|
+
import type { StickySessionRouter } from './sticky-routing.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Inspect local routing from already-published memory only. Unknown inventory,
|
|
5
|
+
* quota or affinity is not evidence that a session has moved. In particular,
|
|
6
|
+
* this must never resolve a pin, spend a retry, or ask another service to choose
|
|
7
|
+
* an account.
|
|
8
|
+
*/
|
|
9
|
+
export declare function peekRoutingAccount(input: {
|
|
10
|
+
snapshot: NativeAccountSnapshot | undefined;
|
|
11
|
+
router?: StickySessionRouter;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
modelId?: string;
|
|
14
|
+
affinityModelId?: string;
|
|
15
|
+
}): string | undefined;
|
package/dist/sticky-routing.d.ts
CHANGED
|
@@ -169,6 +169,18 @@ export declare class StickySessionRouter {
|
|
|
169
169
|
/** Wait for owned background publications during host disposal or fixture cleanup. */
|
|
170
170
|
drain(): Promise<void>;
|
|
171
171
|
private selectCandidate;
|
|
172
|
+
/** Read a published pin without loading, touching, pruning or publishing it. */
|
|
173
|
+
peekAssignment(sessionId: string, affinityModelId?: string): {
|
|
174
|
+
/** Verified account UUID for a credential held by the vault. Pins using credentials stored by this host omit the field. */
|
|
175
|
+
accountIdentity?: string;
|
|
176
|
+
family: StickyRouteFamily;
|
|
177
|
+
affinityModelId?: string;
|
|
178
|
+
assignedAt: number;
|
|
179
|
+
lastSeenAt: number;
|
|
180
|
+
initialInputBytes: number;
|
|
181
|
+
quotaCheckedAt: number;
|
|
182
|
+
accountId: string;
|
|
183
|
+
} | undefined;
|
|
172
184
|
resolve(input: {
|
|
173
185
|
sessionId: string;
|
|
174
186
|
family: StickyRouteFamily;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface IncompleteStreamDiagnostics {
|
|
2
|
+
response_headers: Record<string, string>;
|
|
3
|
+
response_bytes: number;
|
|
4
|
+
sse_events: number;
|
|
5
|
+
send_to_headers_ms?: number;
|
|
6
|
+
/**
|
|
7
|
+
* For credential_scope, send_to_headers_ms starts at credential preparation and
|
|
8
|
+
* includes host scheduling and gzip time: an upper bound, not network latency.
|
|
9
|
+
*/
|
|
10
|
+
timing_source?: 'physical_fetch' | 'credential_scope';
|
|
11
|
+
headers_to_eof_ms: number;
|
|
12
|
+
}
|
|
13
|
+
/** Preserve physical-send timing across wrappers without reading or cloning the body. */
|
|
14
|
+
export declare function copyStreamResponseTiming(source: Response, target: Response, sent?: number, timingSource?: 'physical_fetch' | 'credential_scope'): Response;
|
|
15
|
+
export declare function safeIncompleteStreamDiagnostics(input: IncompleteStreamDiagnostics): IncompleteStreamDiagnostics;
|
|
16
|
+
/** EOF requires a complete message_stop or an explicit protocol error. */
|
|
17
|
+
export declare function createAnthropicStreamCompletion(response: Response): {
|
|
18
|
+
end: () => void;
|
|
19
|
+
push(chunk: Uint8Array): void;
|
|
20
|
+
finish(): (Error & {
|
|
21
|
+
code: string;
|
|
22
|
+
diagnostics: IncompleteStreamDiagnostics;
|
|
23
|
+
}) | undefined;
|
|
24
|
+
};
|
|
25
|
+
/** Validate passthrough API streams without rewriting tool names or response bytes. */
|
|
26
|
+
export declare function guardAnthropicStreamResponse(response: Response, onIncomplete?: (diagnostics: IncompleteStreamDiagnostics) => void | Promise<void>): Response;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/anthropic-auth-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"prepublishOnly": "bun run build"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@cortexkit/common-auth": "0.
|
|
33
|
+
"@cortexkit/common-auth": "0.44.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@cortexkit/claustrum-client": "0.
|
|
36
|
+
"@cortexkit/claustrum-client": "0.18.0",
|
|
37
37
|
"@cortexkit/private-files": "0.2.2",
|
|
38
38
|
"@cortexkit/subc-client": "^0.24",
|
|
39
39
|
"jsonc-parser": "^3.3.1",
|