@cortexkit/anthropic-auth-core 1.23.0 → 2.0.1
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/README.md +18 -1
- package/dist/accounts.d.ts +4 -163
- package/dist/cachekeep.d.ts +9 -0
- package/dist/claude-code.d.ts +16 -0
- package/dist/claustrum-enrollment.d.ts +2 -0
- package/dist/claustrum.d.ts +0 -209
- package/dist/commands/account.d.ts +2 -3
- package/dist/index.d.ts +45 -4
- package/dist/index.js +27569 -38
- package/dist/internal-types/LICENSE +21 -0
- package/dist/internal-types/commands/builtins.d.ts +71 -0
- package/dist/internal-types/commands/index.d.ts +10 -0
- package/dist/internal-types/commands/menu.d.ts +61 -0
- package/dist/internal-types/commands/model.d.ts +238 -0
- package/dist/internal-types/commands/pi.d.ts +23 -0
- package/dist/internal-types/commands/seam.d.ts +72 -0
- package/dist/internal-types/fs/refresh-file-lock.d.ts +33 -0
- package/dist/internal-types/logger/capture-sink.d.ts +14 -0
- package/dist/internal-types/logger/engine.d.ts +98 -0
- package/dist/internal-types/logger/index.d.ts +6 -0
- package/dist/internal-types/logger/redact.d.ts +11 -0
- package/dist/internal-types/pi-slot/index.d.ts +3 -0
- package/dist/internal-types/pi-slot/slot.d.ts +51 -0
- package/dist/internal-types/quota/codec.d.ts +11 -0
- package/dist/internal-types/quota/format.d.ts +46 -0
- package/dist/internal-types/quota/index.d.ts +10 -0
- package/dist/internal-types/quota/map.d.ts +63 -0
- package/dist/internal-types/quota/merge.d.ts +48 -0
- package/dist/internal-types/quota/projection.d.ts +64 -0
- package/dist/internal-types/store/attribution.d.ts +28 -0
- package/dist/internal-types/store/errors.d.ts +55 -0
- package/dist/internal-types/store/hooks.d.ts +12 -0
- package/dist/internal-types/store/identity.d.ts +39 -0
- package/dist/internal-types/store/index.d.ts +21 -0
- package/dist/internal-types/store/mutate.d.ts +189 -0
- package/dist/internal-types/store/pool.d.ts +197 -0
- package/dist/internal-types/store/provider-state.d.ts +131 -0
- package/dist/internal-types/store/publication.d.ts +47 -0
- package/dist/internal-types/store/pull.d.ts +36 -0
- package/dist/internal-types/store/refresh-lock.d.ts +67 -0
- package/dist/internal-types/store/refresh.d.ts +72 -0
- package/dist/internal-types/store/rows.d.ts +313 -0
- package/dist/internal-types/store/runtime.d.ts +36 -0
- package/dist/internal-types/store/schema.d.ts +443 -0
- package/dist/internal-types/store/settings.d.ts +63 -0
- package/dist/internal-types/store/torn.d.ts +78 -0
- package/dist/migration-source.d.ts +33 -0
- package/dist/models.d.ts +41 -0
- package/dist/native-account-runtime.d.ts +121 -0
- package/dist/native-account-view.d.ts +126 -0
- package/dist/native-command-effects.d.ts +59 -0
- package/dist/native-credential-validation.d.ts +42 -0
- package/dist/native-custody-activation.d.ts +45 -0
- package/dist/native-custody.d.ts +114 -0
- package/dist/native-enrollment-authority.d.ts +2 -0
- package/dist/native-host-auth-read.d.ts +3 -0
- package/dist/native-host-auth-write.d.ts +51 -0
- package/dist/native-host-auth.d.ts +12 -0
- package/dist/native-local-credential-service.d.ts +76 -0
- package/dist/native-local-runtime-readers.d.ts +22 -0
- package/dist/native-lock-observer.d.ts +12 -0
- package/dist/native-menu-executor.d.ts +243 -0
- package/dist/native-menu-model.d.ts +142 -0
- package/dist/native-migration-proof.d.ts +28 -0
- package/dist/native-migration-source.d.ts +47 -0
- package/dist/native-migration.d.ts +66 -0
- package/dist/native-quota-codec.d.ts +32 -0
- package/dist/native-refresh-coordinator.d.ts +240 -0
- package/dist/native-roster-seed.d.ts +115 -0
- package/dist/native-runtime-registry.d.ts +19 -0
- package/dist/native-runtime.d.ts +204 -0
- package/dist/native-settings.d.ts +6 -0
- package/dist/native-transient-account.d.ts +38 -0
- package/dist/native-ui.d.ts +45 -0
- package/dist/native-usage-publication.d.ts +12 -0
- package/dist/native-vault-admission.d.ts +8 -0
- package/dist/native-vault-connection.d.ts +33 -0
- package/dist/native-vault-paths.d.ts +13 -0
- package/dist/native-vault-runtime.d.ts +102 -0
- package/dist/native-vault-seed.d.ts +16 -0
- package/dist/pool-authority.d.ts +159 -0
- package/dist/pool-binding.d.ts +32 -0
- package/dist/pool-paths.d.ts +21 -0
- package/dist/pool-store.d.ts +32 -0
- package/dist/provider-error.d.ts +139 -0
- package/dist/quota-manager.d.ts +18 -7
- package/dist/relay.d.ts +14 -1
- package/dist/request-history.d.ts +34 -0
- package/dist/routing.d.ts +1 -2
- package/dist/sse.d.ts +81 -0
- package/dist/sticky-routing.d.ts +28 -0
- package/package.json +10 -4
- package/dist/accounts.js +0 -3881
- package/dist/auth.js +0 -185
- package/dist/cache1h.js +0 -97
- package/dist/cachekeep-registry.js +0 -124
- package/dist/cachekeep.js +0 -604
- package/dist/cch.js +0 -172
- package/dist/claude-code.js +0 -403
- package/dist/claustrum-enrollment-registry.d.ts +0 -17
- package/dist/claustrum-enrollment-registry.js +0 -194
- package/dist/claustrum-enrollment.js +0 -485
- package/dist/claustrum-scoped-roster.d.ts +0 -23
- package/dist/claustrum-scoped-roster.js +0 -194
- package/dist/claustrum-scoped-runtime.d.ts +0 -28
- package/dist/claustrum-scoped-runtime.js +0 -230
- package/dist/claustrum-scoped.d.ts +0 -39
- package/dist/claustrum-scoped.js +0 -193
- package/dist/claustrum.js +0 -1471
- package/dist/commands/account.js +0 -368
- package/dist/constants.js +0 -83
- package/dist/custom-headers.js +0 -102
- package/dist/dump.js +0 -616
- package/dist/fast.js +0 -66
- package/dist/json.js +0 -10
- package/dist/killswitch.js +0 -132
- package/dist/logger.js +0 -288
- package/dist/logging.js +0 -59
- package/dist/mid-conversation-output-config.js +0 -89
- package/dist/model-remap.js +0 -72
- package/dist/models.js +0 -177
- package/dist/network-errors.js +0 -27
- package/dist/oauth-profile.js +0 -60
- package/dist/pkce.js +0 -17
- package/dist/prime.js +0 -841
- package/dist/provider.js +0 -0
- package/dist/quota-header-feed.js +0 -331
- package/dist/quota-headers.js +0 -121
- package/dist/quota-manager.js +0 -856
- package/dist/quotas.js +0 -141
- package/dist/relay.js +0 -1303
- package/dist/routing.js +0 -94
- package/dist/start.js +0 -29
- package/dist/sticky-routing.js +0 -541
- package/dist/thinking-binding.js +0 -54
- package/dist/token-fingerprint.js +0 -8
package/README.md
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
# @cortexkit/anthropic-auth-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Internal implementation package for CortexKit's OpenCode and Pi integrations. Apart from the named public surface below, exports are internal host-support APIs with **no stability promise**.
|
|
4
|
+
|
|
5
|
+
## Public, stable surface
|
|
6
|
+
|
|
7
|
+
These root exports are public and stable for external callers, including Synapse's Anthropic request client:
|
|
8
|
+
|
|
9
|
+
- `resolveClaudeCodeIdentity`
|
|
10
|
+
- `buildBillingHeaderValue`
|
|
11
|
+
- `CLAUDE_CODE_ENTRYPOINT`
|
|
12
|
+
- `CLAUDE_CODE_IDENTITY`
|
|
13
|
+
- `applyClaudeCodeMetadata`
|
|
14
|
+
- `applyClaudeCodeHeaders`
|
|
15
|
+
- `signRequestBody`
|
|
16
|
+
- `orderClaudeCodeBody`
|
|
17
|
+
|
|
18
|
+
The export-manifest test pins these names to the actual root barrel. Legacy sidecar writers and pre-native scoped runtime APIs are removed; host credentials and settings use native storage. Upgrade migration and one-time vault seeding still read the old sidecar format.
|
|
4
19
|
|
|
5
20
|
User-facing packages:
|
|
6
21
|
|
|
7
22
|
- `@cortexkit/opencode-anthropic-auth` for OpenCode
|
|
8
23
|
- `@cortexkit/pi-anthropic-auth` for Pi
|
|
24
|
+
|
|
25
|
+
Claude Haiku 5.5 (`claude-haiku-5-5`) has a 1M-token context window and 128K max output. Standard input/output rates are $0.10/$0.50 per million tokens; all rates increase fivefold above 100K total input, including cached tokens. Optional quota priming continues to send a minimal Haiku 4.5 request to start a new quota window.
|
package/dist/accounts.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ProviderAccountUuid } from './claude-code.ts';
|
|
2
|
-
import { type CustodyHandleResolution } from './claustrum.ts';
|
|
3
2
|
import { type Cache1hMode } from './constants.ts';
|
|
4
|
-
import {
|
|
3
|
+
import type { LogLevel } from './logger.ts';
|
|
5
4
|
export type { ProviderAccountUuid } from './claude-code.ts';
|
|
6
5
|
export declare const ACCOUNT_FILE_NAME = "anthropic-auth.json";
|
|
7
6
|
export declare const ACCOUNT_STATE_FILE_NAME = "anthropic-auth-state.json";
|
|
@@ -22,7 +21,6 @@ export type OAuthAccount = AccountBase & {
|
|
|
22
21
|
type: 'oauth';
|
|
23
22
|
authLineageId?: string;
|
|
24
23
|
anthropicAccountUuid?: ProviderAccountUuid;
|
|
25
|
-
claustrumHandle?: string;
|
|
26
24
|
/** Non-secret scoped identity; never a capability handle or bearer token. */
|
|
27
25
|
claustrumScopedCredentialId?: string;
|
|
28
26
|
claustrumScopedState?: string;
|
|
@@ -51,15 +49,13 @@ export type ApiKeyAccount = AccountBase & {
|
|
|
51
49
|
authHeader?: 'authorization-bearer' | 'x-api-key';
|
|
52
50
|
};
|
|
53
51
|
export type FallbackAccount = OAuthAccount | ApiKeyAccount;
|
|
54
|
-
export type ClaustrumAccountGate = {
|
|
55
|
-
enabled?: boolean;
|
|
56
|
-
};
|
|
57
52
|
export type ClaustrumMode = 'local' | 'claustrum';
|
|
58
53
|
export type ClaustrumConfig = {
|
|
59
54
|
mode?: ClaustrumMode;
|
|
60
|
-
handlesFile?: string;
|
|
61
55
|
/** Set by authoritative scoped discovery, not an authentication toggle. */
|
|
62
56
|
scopedRoster?: true;
|
|
57
|
+
/** Producer inventory cursor committed with the roster; never a bearer. */
|
|
58
|
+
rosterView?: string;
|
|
63
59
|
/** Authoritative, non-secret primary identity from scoped discovery. */
|
|
64
60
|
primaryAccount?: {
|
|
65
61
|
credentialId: string;
|
|
@@ -68,7 +64,6 @@ export type ClaustrumConfig = {
|
|
|
68
64
|
};
|
|
69
65
|
/** Preserve explicit exclusions when a vaulted account disappears and returns. */
|
|
70
66
|
disabledAccountIdentities?: string[];
|
|
71
|
-
accounts?: Record<string, ClaustrumAccountGate>;
|
|
72
67
|
};
|
|
73
68
|
export declare function isOAuthAccount(account: FallbackAccount): account is OAuthAccount;
|
|
74
69
|
export declare function isApiKeyAccount(account: FallbackAccount): account is ApiKeyAccount;
|
|
@@ -269,7 +264,7 @@ export type AccountStorage = {
|
|
|
269
264
|
* (to display the provider's real model costs).
|
|
270
265
|
*/
|
|
271
266
|
export declare function isCostZeroingEnabled(storage: Pick<AccountStorage, 'costZeroing'>): boolean;
|
|
272
|
-
export type AccountRuntimeEntry = Partial<Pick<OAuthAccount, 'access' | 'authLineageId' | 'anthropicAccountUuid' | 'claustrumScopedCredentialId' | 'claustrumScopedState' | '
|
|
267
|
+
export type AccountRuntimeEntry = Partial<Pick<OAuthAccount, 'access' | 'authLineageId' | 'anthropicAccountUuid' | 'claustrumScopedCredentialId' | 'claustrumScopedState' | 'refresh' | 'expires' | 'lastUsed' | 'lastRefreshedAt' | 'lastRefreshError' | 'lastQuotaRefreshError' | 'quota' | 'profile' | 'prime'> & Pick<ApiKeyAccount, 'apiKey' | 'lastUsed'>>;
|
|
273
268
|
export type AccountRuntimeState = {
|
|
274
269
|
version: 1;
|
|
275
270
|
main?: {
|
|
@@ -299,27 +294,6 @@ export type AccountStateSaveScope = {
|
|
|
299
294
|
mainRefresh?: boolean;
|
|
300
295
|
mainPrime?: boolean;
|
|
301
296
|
accounts?: true | string[];
|
|
302
|
-
setClaustrumHandleAccountIds?: readonly string[];
|
|
303
|
-
};
|
|
304
|
-
export type AccountManagerOptions = {
|
|
305
|
-
now?: () => number;
|
|
306
|
-
fetchImpl?: typeof fetch;
|
|
307
|
-
configPath?: string;
|
|
308
|
-
quotaManager?: import('./quota-manager.ts').QuotaManager;
|
|
309
|
-
isFallbackAccountVaultServed?: (accountId: string, storage: AccountStorage) => boolean;
|
|
310
|
-
isFallbackAccountVaultEnabled?: (accountId: string, storage: AccountStorage) => boolean;
|
|
311
|
-
resolveFallbackAccessToken?: (account: OAuthAccount, storage: AccountStorage) => {
|
|
312
|
-
token: string;
|
|
313
|
-
source: 'vault' | 'sidecar';
|
|
314
|
-
} | undefined;
|
|
315
|
-
onBackgroundRefresh?: (initial?: boolean) => Promise<void> | void;
|
|
316
|
-
onFallbackStorageChanged?: () => void;
|
|
317
|
-
setIntervalImpl?: typeof globalThis.setInterval;
|
|
318
|
-
clearIntervalImpl?: typeof globalThis.clearInterval;
|
|
319
|
-
};
|
|
320
|
-
export type AccountRefreshError = {
|
|
321
|
-
accountId: string;
|
|
322
|
-
message: string;
|
|
323
297
|
};
|
|
324
298
|
export declare const FALLBACK_BACKGROUND_TICK_MS = 60000;
|
|
325
299
|
export declare function getAccountStoragePath(): string;
|
|
@@ -327,47 +301,11 @@ export declare function getAccountStatePath(configPath?: string): string;
|
|
|
327
301
|
export declare function createEmptyStorage(): AccountStorage;
|
|
328
302
|
export declare function mergeMainQuotaErrorClearedAt(existing: number | undefined, incoming: number | undefined): number | undefined;
|
|
329
303
|
export declare function mergeMainRefreshErrorClearedAt(existing: number | undefined, incoming: number | undefined): number | undefined;
|
|
330
|
-
export declare function loadAccounts(path?: string): Promise<AccountStorage | null>;
|
|
331
304
|
/** Returns the latest timestamp carried by any quota snapshot window. */
|
|
332
305
|
export declare function quotaSnapshotCheckedAt(quota: OAuthQuotaSnapshot | undefined): number;
|
|
333
306
|
export declare function quotaFieldSource(snapshot: OAuthQuotaSnapshot | undefined, field: QuotaFieldName): QuotaFieldSource | undefined;
|
|
334
307
|
export declare function mergeHeaderQuotaForPersistence(existing: OAuthQuotaSnapshot | undefined, incoming: OAuthQuotaSnapshot): OAuthQuotaSnapshot;
|
|
335
308
|
export declare function getClaustrumMode(storage: AccountStorage | null): ClaustrumMode;
|
|
336
|
-
export declare function isOAuthAccountVaultOwned(storage: AccountStorage | null, account: FallbackAccount, binding?: CustodyHandleResolution | undefined): boolean;
|
|
337
|
-
export declare function setClaustrumModePersistent(mode: ClaustrumMode, path?: string): Promise<'changed' | 'unchanged'>;
|
|
338
|
-
export declare function clearClaustrumHandlePersistent(input: {
|
|
339
|
-
id: string;
|
|
340
|
-
path?: string;
|
|
341
|
-
}): Promise<'updated' | 'missing' | 'ineligible'>;
|
|
342
|
-
export interface SaveAccountsOptions {
|
|
343
|
-
/** Account ids intentionally removed by this mutation. */
|
|
344
|
-
removedAccountIds?: readonly string[];
|
|
345
|
-
/** Preserve disk order when a stale snapshot is missing newer accounts. */
|
|
346
|
-
preserveExistingAccountOrder?: boolean;
|
|
347
|
-
setClaustrumHandleAccountIds?: readonly string[];
|
|
348
|
-
}
|
|
349
|
-
export declare function saveAccounts(storage: AccountStorage, path?: string, options?: SaveAccountsOptions): Promise<void>;
|
|
350
|
-
/** Read-modify-write account configuration under the existing config/state lock order.
|
|
351
|
-
* The callback is synchronous: network discovery must happen under its own outer
|
|
352
|
-
* lease, never while holding the config lock. Do not call another persistence API
|
|
353
|
-
* from the callback.
|
|
354
|
-
*/
|
|
355
|
-
export declare function mutateAccountsPersistent<T>(path: string, mutate: (storage: AccountStorage) => {
|
|
356
|
-
storage: AccountStorage;
|
|
357
|
-
result: T;
|
|
358
|
-
options?: SaveAccountsOptions;
|
|
359
|
-
save?: boolean;
|
|
360
|
-
}, options?: {
|
|
361
|
-
assertAuthority?: () => Promise<void>;
|
|
362
|
-
}): Promise<T>;
|
|
363
|
-
export declare function getOrCreateMainAccountId(path?: string, createId?: () => string): Promise<string>;
|
|
364
|
-
export declare function saveAccountState(storage: AccountStorage, path?: string, scope?: AccountStateSaveScope): Promise<void>;
|
|
365
|
-
export declare function saveOAuthProfileState(input: {
|
|
366
|
-
accountId: 'main' | string;
|
|
367
|
-
profile: OAuthAccountProfile | undefined;
|
|
368
|
-
accountIdentity?: string;
|
|
369
|
-
}, path?: string): Promise<boolean>;
|
|
370
|
-
export declare function clearClaustrumRefreshErrorPersistent(accountId: string, handle: string, path?: string): Promise<boolean>;
|
|
371
309
|
export declare function acquireRefreshFileLock(options: {
|
|
372
310
|
name: string;
|
|
373
311
|
ttlMs: number;
|
|
@@ -382,30 +320,10 @@ export declare function acquireRefreshFileLock(options: {
|
|
|
382
320
|
} | null>;
|
|
383
321
|
export declare function isCache1hPersistentlyEnabled(storage: AccountStorage | null): boolean;
|
|
384
322
|
export declare function getCache1hPersistentMode(storage: AccountStorage | null): Cache1hMode;
|
|
385
|
-
export declare function setCache1hPersistentEnabled(enabled: boolean, mode?: Cache1hMode, path?: string): Promise<AccountStorage>;
|
|
386
|
-
export declare function setCache1hPersistentMode(mode: Cache1hMode, path?: string): Promise<AccountStorage>;
|
|
387
323
|
export declare function isDumpPersistentlyEnabled(storage: AccountStorage | null): boolean;
|
|
388
|
-
export declare function setDumpPersistentEnabled(enabled: boolean, path?: string): Promise<AccountStorage>;
|
|
389
324
|
export declare function isFastModePersistentlyEnabled(storage: AccountStorage | null): boolean;
|
|
390
|
-
export declare function setFastModePersistentEnabled(enabled: boolean, path?: string): Promise<AccountStorage>;
|
|
391
|
-
export declare function setCacheKeepPersistentWindow(startHour: number, endHour: number, path?: string): Promise<AccountStorage>;
|
|
392
|
-
export declare function setCacheKeepPersistentAlways(path?: string): Promise<AccountStorage>;
|
|
393
|
-
export declare function setCacheKeepPersistentEnabled(enabled: boolean, path?: string): Promise<AccountStorage>;
|
|
394
325
|
export declare function isCacheKeepSubagentsEnabled(storage: AccountStorage | null): boolean;
|
|
395
|
-
export declare function setCacheKeepSubagentsEnabled(enabled: boolean, path?: string): Promise<AccountStorage>;
|
|
396
326
|
export declare function isPrimePersistentlyEnabled(storage: AccountStorage | null): boolean;
|
|
397
|
-
export declare function setPrimePersistentEnabled(enabled: boolean, path?: string): Promise<AccountStorage>;
|
|
398
|
-
/** Return the stable prime marker identity for an OAuth account. */
|
|
399
|
-
export declare function getOrCreatePrimeAuthLineageId(accountId: 'main' | string, path?: string): Promise<string | undefined>;
|
|
400
|
-
/**
|
|
401
|
-
* Atomically increment an account's cumulative prime counters and persist via
|
|
402
|
-
* the scoped runtime-state path. The `main` account lives at state.main.prime;
|
|
403
|
-
* every other account lives at state.accounts[id].prime. Config-side writes
|
|
404
|
-
* are intentionally NOT triggered so prime counters cannot leak into
|
|
405
|
-
* `anthropic-auth.json`. Callers should not depend on this function to mutate
|
|
406
|
-
* the caller's storage object.
|
|
407
|
-
*/
|
|
408
|
-
export declare function incrementPrimeUsagePersistent(accountId: 'main' | string, usage: PrimeUsageDelta, path?: string, now?: number): Promise<PrimeUsageCounters>;
|
|
409
327
|
export declare function shouldFallbackStatus(status: number, storage: AccountStorage | null): boolean;
|
|
410
328
|
export declare function getQuotaMinimumRemainingThresholds(storage: AccountStorage | null): {
|
|
411
329
|
five_hour: number;
|
|
@@ -451,7 +369,6 @@ export declare function quotaBackoffActive(error: AccountOperationError | undefi
|
|
|
451
369
|
export declare function formatQuotaBackoffMessage(error: AccountOperationError, now: number): string;
|
|
452
370
|
export declare function getQuotaCheckIntervalMs(storage: AccountStorage | null): number;
|
|
453
371
|
export declare function getPersistedLogLevel(storage: AccountStorage | null): LogLevel | undefined;
|
|
454
|
-
export declare function setLogLevelPersistent(level: LogLevel, path?: string): Promise<void>;
|
|
455
372
|
export declare function getPersistedMainQuota(storage: AccountStorage | null): {
|
|
456
373
|
quota: OAuthQuotaSnapshot;
|
|
457
374
|
checkedAt: number;
|
|
@@ -495,86 +412,10 @@ export declare function killswitchRetryAfterSeconds(mainQuota: OAuthQuotaSnapsho
|
|
|
495
412
|
quota?: OAuthQuotaSnapshot;
|
|
496
413
|
}>, now: number, scopedModelId?: string): number;
|
|
497
414
|
export declare function getKillswitchConfig(storage: AccountStorage | null): KillswitchConfig;
|
|
498
|
-
export declare function setKillswitchPersistent(config: KillswitchConfig, path?: string): Promise<AccountStorage>;
|
|
499
|
-
export declare function removeAccountPersistent(id: string, path?: string): Promise<boolean>;
|
|
500
|
-
export declare function reorderAccountsPersistent(orderedIds: string[], path?: string): Promise<void>;
|
|
501
|
-
export declare function setAccountEnabledPersistent(id: string, enabled: boolean, path?: string): Promise<boolean>;
|
|
502
|
-
export declare function addAccountPersistent(account: FallbackAccount, path?: string): Promise<void>;
|
|
503
415
|
export declare function getQuotaNextRefreshAt(quota: OAuthQuotaSnapshot | undefined, storage: AccountStorage | null, now: number): number;
|
|
504
416
|
export declare function fetchOAuthQuotaSnapshot(input: {
|
|
505
417
|
accessToken: string;
|
|
506
418
|
fetchImpl?: typeof fetch;
|
|
507
419
|
now?: () => number;
|
|
508
420
|
}): Promise<OAuthQuotaSnapshot>;
|
|
509
|
-
export declare function upsertAccount(storage: AccountStorage, account: FallbackAccount): void;
|
|
510
|
-
export declare function persistFallbackQuotaHeaderPersistent(input: {
|
|
511
|
-
accountId: string;
|
|
512
|
-
authLineageId?: string;
|
|
513
|
-
quota: OAuthQuotaSnapshot;
|
|
514
|
-
anthropicAccountUuid?: ProviderAccountUuid;
|
|
515
|
-
}, path?: string): Promise<boolean>;
|
|
516
421
|
export declare function fallbackAccountUuidForLineage(account: OAuthAccount | undefined, authLineageId?: string): string | null;
|
|
517
|
-
export declare function removeAccount(storage: AccountStorage, id: string): boolean;
|
|
518
|
-
export declare function reorderAccounts(storage: AccountStorage, orderedIds: string[]): void;
|
|
519
|
-
export declare function setAccountEnabled(storage: AccountStorage, id: string, enabled: boolean): boolean;
|
|
520
|
-
export declare class FallbackAccountManager {
|
|
521
|
-
private readonly now;
|
|
522
|
-
private readonly fetchImpl;
|
|
523
|
-
private readonly configPath;
|
|
524
|
-
private readonly refreshPromises;
|
|
525
|
-
private readonly custodyVerificationAccounts;
|
|
526
|
-
private refreshTimer;
|
|
527
|
-
private quotaTimer;
|
|
528
|
-
readonly quotaManager: import('./quota-manager.ts').QuotaManager | null;
|
|
529
|
-
private readonly isFallbackAccountVaultServed;
|
|
530
|
-
private readonly isFallbackAccountVaultEnabled;
|
|
531
|
-
private readonly resolveFallbackAccessToken;
|
|
532
|
-
private readonly onBackgroundRefresh;
|
|
533
|
-
private readonly onFallbackStorageChanged;
|
|
534
|
-
private readonly setIntervalImpl;
|
|
535
|
-
private readonly clearIntervalImpl;
|
|
536
|
-
constructor(options?: AccountManagerOptions);
|
|
537
|
-
/**
|
|
538
|
-
* Seed QuotaManager from persisted account.quota if no cache entry exists
|
|
539
|
-
* yet. Prevents unnecessary API calls when the on-disk snapshot is fresh.
|
|
540
|
-
*/
|
|
541
|
-
private seedFallbackQuota;
|
|
542
|
-
load(): Promise<AccountStorage | null>;
|
|
543
|
-
save(storage: AccountStorage, accountIds?: string[]): Promise<void>;
|
|
544
|
-
startBackgroundRefresh(): Promise<void>;
|
|
545
|
-
stopBackgroundRefresh(): void;
|
|
546
|
-
withAccountRefreshLock<T>(accountId: string, fn: () => Promise<T>): Promise<T>;
|
|
547
|
-
getUsableFallbackAccounts(existingStorage?: AccountStorage | null, options?: {
|
|
548
|
-
modelId?: string;
|
|
549
|
-
}): Promise<OAuthAccount[]>;
|
|
550
|
-
markUsed(account: FallbackAccount): Promise<void>;
|
|
551
|
-
accountPassesQuotaPolicy(account: OAuthAccount, storage: AccountStorage | null, options?: {
|
|
552
|
-
modelId?: string;
|
|
553
|
-
}): boolean;
|
|
554
|
-
/**
|
|
555
|
-
* Return the account with its quota overlaid from the unified QuotaManager
|
|
556
|
-
* cache (token-bound) when available, so quota-policy decisions use the same
|
|
557
|
-
* source of truth as the staleness check. Falls back to the stored
|
|
558
|
-
* account.quota when no manager is wired or the cache has no entry.
|
|
559
|
-
*/
|
|
560
|
-
private quotaPolicyAccount;
|
|
561
|
-
refreshDueAccounts(): Promise<void>;
|
|
562
|
-
refreshQuotaForDueAccounts(): Promise<void>;
|
|
563
|
-
refreshQuotaForAllAccounts(options?: {
|
|
564
|
-
force?: boolean;
|
|
565
|
-
}): Promise<{
|
|
566
|
-
storage: AccountStorage | null;
|
|
567
|
-
errors: AccountRefreshError[];
|
|
568
|
-
}>;
|
|
569
|
-
refreshAccount(account: OAuthAccount, storage: AccountStorage, options?: {
|
|
570
|
-
force?: boolean;
|
|
571
|
-
persistError?: boolean;
|
|
572
|
-
}): Promise<OAuthAccount>;
|
|
573
|
-
private waitForConcurrentFallbackRefresh;
|
|
574
|
-
private refreshAccountNow;
|
|
575
|
-
refreshAccountQuota(account: OAuthAccount, storage: AccountStorage): Promise<{
|
|
576
|
-
account: OAuthAccount;
|
|
577
|
-
fetched: boolean;
|
|
578
|
-
changed: boolean;
|
|
579
|
-
}>;
|
|
580
|
-
}
|
package/dist/cachekeep.d.ts
CHANGED
|
@@ -112,6 +112,15 @@ export declare class CacheKeepManager {
|
|
|
112
112
|
setIntervalImpl?: typeof globalThis.setInterval;
|
|
113
113
|
clearIntervalImpl?: typeof globalThis.clearInterval;
|
|
114
114
|
prepareHeaders?: (headers: Headers, target: CacheKeepTarget, attempt: CacheKeepPrewarmAttempt) => Promise<Headers | undefined> | Headers | undefined;
|
|
115
|
+
/** Optionally reauthorize a replayable prewarm after a genuine 401.
|
|
116
|
+
* Return headers only for a verified newer version of the same account;
|
|
117
|
+
* onResponse observes only the final physical attempt. */
|
|
118
|
+
retryOnUnauthorized?: (input: {
|
|
119
|
+
target: CacheKeepTarget;
|
|
120
|
+
headers: Headers;
|
|
121
|
+
bodyText: string;
|
|
122
|
+
attempt: CacheKeepPrewarmAttempt;
|
|
123
|
+
}) => Promise<Headers | undefined> | Headers | undefined;
|
|
115
124
|
onTrackedSessionsChanged?: (sessions: readonly CacheKeepTrackedSession[]) => Promise<void> | void;
|
|
116
125
|
prepareBody?: (bodyText: string, target: CacheKeepTarget) => string | Promise<string>;
|
|
117
126
|
onResponse?: (input: {
|
package/dist/claude-code.d.ts
CHANGED
|
@@ -14,6 +14,22 @@ export declare function resetClaudeCodeIdentityCachesForTest(): void;
|
|
|
14
14
|
* additional bootstrap request carrying a previously authorized token. */
|
|
15
15
|
export declare function getClaudeCodeIdentityForVerifiedAccount(accountIdentity: string, accountUuid: ProviderAccountUuid): ClaudeCodeIdentity;
|
|
16
16
|
export declare function resolveClaudeCodeIdentity(accessToken: string, model: string | undefined, accountIdentity: string | undefined): Promise<ClaudeCodeIdentity>;
|
|
17
|
+
/**
|
|
18
|
+
* The access value is not a Claude OAuth access token, so Claude cannot
|
|
19
|
+
* identify its account. Asking again will not help; only a new sign-in
|
|
20
|
+
* replaces it. The message never includes the rejected value.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ClaudeUnsupportedAccessError extends Error {
|
|
23
|
+
readonly code = "unsupported-access";
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Account lookup for credentials that must belong to a Claude account.
|
|
28
|
+
* Unlike resolveClaudeCodeIdentity, which returns an identity without an
|
|
29
|
+
* account UUID for any other access value, this rejects such a value with
|
|
30
|
+
* ClaudeUnsupportedAccessError before any network request.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveClaudeCodeAccountIdentity(accessToken: string, model: string | undefined, accountIdentity: string | undefined): Promise<ClaudeCodeIdentity>;
|
|
17
33
|
export declare function buildClaudeCodeMetadataUserId(identity: ClaudeCodeIdentity): string | null;
|
|
18
34
|
export declare function applyClaudeCodeMetadata(body: Record<string, unknown>, identity: ClaudeCodeIdentity): boolean;
|
|
19
35
|
export declare const CLAUDE_CODE_FULL_AGENT_BETAS: readonly ['oauth-2025-04-20', 'interleaved-thinking-2025-05-14', 'thinking-token-count-2026-05-13', 'context-management-2025-06-27', 'prompt-caching-scope-2026-01-05', 'claude-code-20250219', 'advisor-tool-2026-03-01', 'advanced-tool-use-2025-11-20', 'mid-conversation-system-2026-04-07', 'effort-2025-11-24', 'fallback-credit-2026-06-01', 'extended-cache-ttl-2025-04-11', 'cache-diagnosis-2026-04-07'];
|
|
@@ -48,6 +48,8 @@ export interface ClaustrumEnrollmentPaths {
|
|
|
48
48
|
tokenPath: string;
|
|
49
49
|
}
|
|
50
50
|
export declare function getClaustrumEnrollmentPaths(tokenPath: string): ClaustrumEnrollmentPaths;
|
|
51
|
+
/** Resolve the independently enrolled host's owner-only token and state paths. */
|
|
52
|
+
export declare function getHostClaustrumEnrollmentPaths(host: 'opencode' | 'pi', env?: NodeJS.ProcessEnv, cwd?: string): ClaustrumEnrollmentPaths;
|
|
51
53
|
export declare function readClaustrumEnrollmentStatus(paths: ClaustrumEnrollmentPaths, proposedName?: string): Promise<ClaustrumEnrollmentStatus>;
|
|
52
54
|
/** Read fresh bearer material for a scoped operation; never publish this value. */
|
|
53
55
|
export declare function readClaustrumEnrollmentToken(tokenPath: string): Promise<EnrollmentTokenFile>;
|
package/dist/claustrum.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { type BindIdentity, type CatalogEntry, type CloseRouteOptions, type ManagedCallOptions, type ManagedCloseRouteOptions, type RequestOptions, type RouteHandle, type RouteOpenOptions, type RouteTarget, SubcClient, type SubscribeOptions, type Subscription } from '@cortexkit/subc-client';
|
|
2
|
-
import type { ClaustrumConfig, OAuthAccount } from './accounts.ts';
|
|
3
1
|
export type ClaustrumEndpoint = {
|
|
4
2
|
host: string;
|
|
5
3
|
port: number;
|
|
@@ -21,9 +19,6 @@ export declare const PRODUCTION_CLAUSTRUM_CONNECTION_FILE_NAME = "subc-connectio
|
|
|
21
19
|
export declare function findExistingClaustrumConnectionPath(env?: NodeJS.ProcessEnv): string | undefined;
|
|
22
20
|
export declare function getDefaultClaustrumConnectionPath(env?: NodeJS.ProcessEnv): string;
|
|
23
21
|
export declare function resolveClaustrumConnectionPath(explicit?: string, env?: NodeJS.ProcessEnv): string;
|
|
24
|
-
type CustodyHandlesEnvironment = Readonly<Record<string, string | undefined>>;
|
|
25
|
-
export declare function resolveCustodyHandlesPath(config: Pick<ClaustrumConfig, 'handlesFile'> | undefined, env: CustodyHandlesEnvironment): string;
|
|
26
|
-
export declare function getDefaultClaustrumHandlesPath(): string;
|
|
27
22
|
export declare function detectClaustrumConnection(explicitPath?: string): Promise<ClaustrumDetection>;
|
|
28
23
|
export declare const CUSTODY_TOMBSTONE_PREFIX = "claustrum-tombstone:v1:";
|
|
29
24
|
export declare function custodyTombstoneKey(provider: string): string;
|
|
@@ -46,207 +41,3 @@ export declare class CustodyTombstoneLoginError extends Error {
|
|
|
46
41
|
constructor(provider: string);
|
|
47
42
|
}
|
|
48
43
|
export declare function assertNotCustodyTombstone(refreshToken: unknown, provider: string): void;
|
|
49
|
-
export type CustodyHandleAccount = {
|
|
50
|
-
label: string;
|
|
51
|
-
handle: string;
|
|
52
|
-
credentialId: string;
|
|
53
|
-
};
|
|
54
|
-
export type CustodyHandleManifest = {
|
|
55
|
-
version: 1;
|
|
56
|
-
provider: 'anthropic';
|
|
57
|
-
serve: 'anthropic-auth';
|
|
58
|
-
accounts: ReadonlyArray<CustodyHandleAccount>;
|
|
59
|
-
superseded: ReadonlySet<string>;
|
|
60
|
-
corruptLabels?: ReadonlySet<string>;
|
|
61
|
-
};
|
|
62
|
-
export type CustodyHandleResolution = {
|
|
63
|
-
status: 'resolved';
|
|
64
|
-
source: 'manifest';
|
|
65
|
-
handle: string;
|
|
66
|
-
credentialId: string;
|
|
67
|
-
} | {
|
|
68
|
-
status: 'resolved';
|
|
69
|
-
source: 'legacy';
|
|
70
|
-
handle: string;
|
|
71
|
-
} | {
|
|
72
|
-
status: 'unresolved';
|
|
73
|
-
reason: 'missing-label' | 'invalid-label' | 'duplicate-label' | 'missing-entry' | 'foreign-serve' | 'superseded' | 'corrupt-binding' | 'unknown-identity';
|
|
74
|
-
};
|
|
75
|
-
type ParsedCustodyHandleManifest = {
|
|
76
|
-
version: 1;
|
|
77
|
-
provider: string;
|
|
78
|
-
serve: string;
|
|
79
|
-
accounts: ReadonlyArray<CustodyHandleAccount>;
|
|
80
|
-
superseded: ReadonlySet<string>;
|
|
81
|
-
corruptLabels: ReadonlySet<string>;
|
|
82
|
-
};
|
|
83
|
-
export declare function isValidCustodyLabel(value: unknown): value is string;
|
|
84
|
-
export declare function isValidCustodyHandle(value: unknown): value is string;
|
|
85
|
-
export declare function custodyCredentialId(label: string): string;
|
|
86
|
-
export declare function custodyCredentialIdFromResolution(resolution: CustodyHandleResolution, label: string): string;
|
|
87
|
-
/**
|
|
88
|
-
* | manifest state | legacy handle | result |
|
|
89
|
-
* | --- | --- | --- |
|
|
90
|
-
* | matching ready entry | any | manifest handle |
|
|
91
|
-
* | absent or invalid | present | legacy handle |
|
|
92
|
-
* | no matching ready entry | present | legacy handle |
|
|
93
|
-
* | foreign serve | any | unresolved |
|
|
94
|
-
* | superseded matching entry | any | unresolved |
|
|
95
|
-
*/
|
|
96
|
-
export declare function resolveCustodyHandle(input: {
|
|
97
|
-
account: OAuthAccount;
|
|
98
|
-
manifest: CustodyHandleManifest | undefined;
|
|
99
|
-
duplicateOAuthLabels?: ReadonlySet<string>;
|
|
100
|
-
}): CustodyHandleResolution;
|
|
101
|
-
export declare function readCustodyHandles(json: unknown, provider: string, serve: string): ParsedCustodyHandleManifest;
|
|
102
|
-
type CustodyHandleManifestReadResult = {
|
|
103
|
-
status: 'ready';
|
|
104
|
-
manifest: CustodyHandleManifest;
|
|
105
|
-
} | {
|
|
106
|
-
status: 'absent';
|
|
107
|
-
} | {
|
|
108
|
-
status: 'ignored';
|
|
109
|
-
reason: 'foreign-serve' | 'missing-provider';
|
|
110
|
-
} | {
|
|
111
|
-
status: 'invalid';
|
|
112
|
-
reason: string;
|
|
113
|
-
};
|
|
114
|
-
export declare const CUSTODY_MANIFEST_SELECTION_ERROR_CODES: readonly ['foreign-serve', 'invalid-label', 'missing-provider'];
|
|
115
|
-
type CustodyManifestSelectionErrorCode = (typeof CUSTODY_MANIFEST_SELECTION_ERROR_CODES)[number];
|
|
116
|
-
export declare class CustodyManifestSelectionError extends Error {
|
|
117
|
-
readonly code: CustodyManifestSelectionErrorCode;
|
|
118
|
-
constructor(code: CustodyManifestSelectionErrorCode);
|
|
119
|
-
}
|
|
120
|
-
export declare class CustodyHandleManifestReader {
|
|
121
|
-
#private;
|
|
122
|
-
constructor(options: {
|
|
123
|
-
path: string;
|
|
124
|
-
provider: 'anthropic';
|
|
125
|
-
serve: 'anthropic-auth';
|
|
126
|
-
expectedUid?: number;
|
|
127
|
-
});
|
|
128
|
-
read(): Promise<CustodyHandleManifestReadResult>;
|
|
129
|
-
}
|
|
130
|
-
export type CustodyHandleManifestWriteResult = {
|
|
131
|
-
status: 'written' | 'unchanged';
|
|
132
|
-
} | {
|
|
133
|
-
status: 'refused';
|
|
134
|
-
reason: string;
|
|
135
|
-
code?: CustodyManifestLockErrorCode;
|
|
136
|
-
};
|
|
137
|
-
export type CustodyHandleManifestRemovalResult = 'removed' | 'missing' | {
|
|
138
|
-
status: 'refused';
|
|
139
|
-
code?: CustodyManifestLockErrorCode;
|
|
140
|
-
};
|
|
141
|
-
export declare const CUSTODY_MANIFEST_LOCK_TTL_MS = 30000;
|
|
142
|
-
export declare const CUSTODY_MANIFEST_LOCK_RENEW_MS = 10000;
|
|
143
|
-
export declare const CUSTODY_MANIFEST_LOCK_RETRY_MIN_MS = 50;
|
|
144
|
-
export declare const CUSTODY_MANIFEST_LOCK_RETRY_MAX_MS = 150;
|
|
145
|
-
export type CustodyManifestLockTestOptions = Partial<{
|
|
146
|
-
ttlMs: number;
|
|
147
|
-
retryMinMs: number;
|
|
148
|
-
retryMaxMs: number;
|
|
149
|
-
renewalIntervalMs: number;
|
|
150
|
-
now: () => number;
|
|
151
|
-
setIntervalImpl: typeof globalThis.setInterval;
|
|
152
|
-
clearIntervalImpl: typeof globalThis.clearInterval;
|
|
153
|
-
afterStaleOwnerRead: () => void | Promise<void>;
|
|
154
|
-
beforeRename: () => void | Promise<void>;
|
|
155
|
-
}>;
|
|
156
|
-
export declare function __setCustodyManifestLockTestOptions(options?: CustodyManifestLockTestOptions): void;
|
|
157
|
-
export declare const CUSTODY_MANIFEST_LOCK_ERROR_CODES: readonly ['lock_busy', 'owner_invalid', 'renewal_failed'];
|
|
158
|
-
export type CustodyManifestLockErrorCode = (typeof CUSTODY_MANIFEST_LOCK_ERROR_CODES)[number];
|
|
159
|
-
export declare class CustodyManifestLockError extends Error {
|
|
160
|
-
readonly code: CustodyManifestLockErrorCode;
|
|
161
|
-
constructor(message: string, code: CustodyManifestLockErrorCode);
|
|
162
|
-
}
|
|
163
|
-
export declare class CustodyManifestLockBusyError extends CustodyManifestLockError {
|
|
164
|
-
constructor(message: string);
|
|
165
|
-
}
|
|
166
|
-
export declare class CustodyManifestLockOwnerInvalidError extends CustodyManifestLockError {
|
|
167
|
-
constructor(message: string);
|
|
168
|
-
}
|
|
169
|
-
export declare class CustodyManifestLockLeaseLostError extends CustodyManifestLockError {
|
|
170
|
-
constructor(message: string);
|
|
171
|
-
}
|
|
172
|
-
export declare function __deriveCustodyManifestStaleLockPrefix(lockPath: string, pathBasename: (path: string) => string): string;
|
|
173
|
-
export declare function withCustodyManifestLock<T>(path: string, fn: (assertLease: () => Promise<void>, nonce: string) => Promise<T>): Promise<T>;
|
|
174
|
-
type CustodyHandleManifestWriteInput = {
|
|
175
|
-
path: string;
|
|
176
|
-
entry: CustodyHandleAccount;
|
|
177
|
-
expectedUid?: number;
|
|
178
|
-
};
|
|
179
|
-
export declare function writeCustodyHandleManifestEntry(input: CustodyHandleManifestWriteInput): Promise<CustodyHandleManifestWriteResult>;
|
|
180
|
-
export declare function removeCustodyHandleManifestEntry(input: CustodyHandleManifestWriteInput): Promise<CustodyHandleManifestRemovalResult>;
|
|
181
|
-
export declare function writeCustodyHandleManifestEntryLocked(input: CustodyHandleManifestWriteInput, assertLease: () => Promise<void>, lockNonce: string): Promise<CustodyHandleManifestWriteResult>;
|
|
182
|
-
export type ClaustrumClientOptions = {
|
|
183
|
-
connectionFile?: string;
|
|
184
|
-
handshakeTimeoutMs?: number;
|
|
185
|
-
connector?: ClaustrumConnector;
|
|
186
|
-
};
|
|
187
|
-
export type ClaustrumConnector = (options: {
|
|
188
|
-
connectionFile: string;
|
|
189
|
-
handshakeTimeoutMs?: number;
|
|
190
|
-
}) => Promise<SubcClient>;
|
|
191
|
-
export declare class ClaustrumClient {
|
|
192
|
-
#private;
|
|
193
|
-
private constructor();
|
|
194
|
-
static connect(options?: ClaustrumClientOptions): Promise<ClaustrumClient>;
|
|
195
|
-
catalogList(moduleId?: string): Promise<CatalogEntry[]>;
|
|
196
|
-
routeOpen(target: RouteTarget, identity: BindIdentity, options?: Omit<RouteOpenOptions, 'consumerIdentity'>): Promise<RouteHandle>;
|
|
197
|
-
request(handle: RouteHandle, body: unknown, options?: RequestOptions): Promise<unknown>;
|
|
198
|
-
call<Response = unknown>(moduleId: string, method: string, params?: unknown, options?: Omit<ManagedCallOptions, 'consumerIdentity'>): Promise<Response>;
|
|
199
|
-
subscribe(handle: RouteHandle, body: unknown, onEvent: (event: Uint8Array) => void, options?: SubscribeOptions): Subscription;
|
|
200
|
-
closeRoute(handle: RouteHandle, options?: CloseRouteOptions): Promise<void>;
|
|
201
|
-
closeManagedRoute(target: Extract<RouteTarget, {
|
|
202
|
-
kind: 'management_surface' | 'tool_provider';
|
|
203
|
-
}>, identity: BindIdentity, options?: Omit<ManagedCloseRouteOptions, 'consumerIdentity'>): Promise<void>;
|
|
204
|
-
close(): void;
|
|
205
|
-
}
|
|
206
|
-
export declare function connectClaustrumClient(options?: ClaustrumClientOptions): Promise<ClaustrumClient>;
|
|
207
|
-
export declare const CLAUSTRUM_MODULE_ID = "claustrum";
|
|
208
|
-
export declare const DEFAULT_CLAUSTRUM_CREDENTIAL_MIN_TTL_MS = 120000;
|
|
209
|
-
export declare const ERROR_CLASS_WIRE_SET: readonly ['transient', 'permanent', 'auth_required', 'context_overflow'];
|
|
210
|
-
export type ClaustrumCredentialErrorClass = (typeof ERROR_CLASS_WIRE_SET)[number];
|
|
211
|
-
export type ClaustrumCredentialErrorAction = 'gone' | 'reauth' | 'retry' | 'reduce_and_retry';
|
|
212
|
-
export type ClaustrumCredential = {
|
|
213
|
-
payload: string;
|
|
214
|
-
expiresAtMs: number | null;
|
|
215
|
-
recordVersion: number;
|
|
216
|
-
projectId?: string;
|
|
217
|
-
accountId?: string;
|
|
218
|
-
credentialId?: string;
|
|
219
|
-
};
|
|
220
|
-
export type ClaustrumServedCredential = Pick<ClaustrumCredential, 'recordVersion'>;
|
|
221
|
-
export type ClaustrumReporterSource = 'direct' | 'relay_status_field' | 'relay_message_parse';
|
|
222
|
-
export declare class ClaustrumCredentialError extends Error {
|
|
223
|
-
readonly code: string;
|
|
224
|
-
readonly action: ClaustrumCredentialErrorAction;
|
|
225
|
-
readonly errorClass: ClaustrumCredentialErrorClass;
|
|
226
|
-
constructor(message: string, code: string, errorClass: ClaustrumCredentialErrorClass, action: ClaustrumCredentialErrorAction);
|
|
227
|
-
}
|
|
228
|
-
export type ClaustrumCredentialCacheOptions = {
|
|
229
|
-
identity?: BindIdentity;
|
|
230
|
-
now?: () => number;
|
|
231
|
-
minTtlMs?: number;
|
|
232
|
-
};
|
|
233
|
-
export declare class ClaustrumCredentialCache {
|
|
234
|
-
#private;
|
|
235
|
-
constructor(client: ClaustrumClient, options?: ClaustrumCredentialCacheOptions);
|
|
236
|
-
get(handle: string, minTtlMs?: number, options?: {
|
|
237
|
-
cacheIf?: () => boolean;
|
|
238
|
-
}): Promise<ClaustrumCredential>;
|
|
239
|
-
peek(handle: string): ClaustrumCredential | undefined;
|
|
240
|
-
abandonPending(handle: string): void;
|
|
241
|
-
seedForTest(handle: string, credential: ClaustrumCredential): void;
|
|
242
|
-
reduceMinTtlMs(): number;
|
|
243
|
-
reportAuthFailure(handle: string, providerStatus: number, servedCredential: ClaustrumServedCredential, reporterSource?: ClaustrumReporterSource): Promise<void>;
|
|
244
|
-
reportAuthFailure(handle: string, servedCredential: ClaustrumServedCredential, providerStatus?: number, reporterSource?: ClaustrumReporterSource): Promise<void>;
|
|
245
|
-
invalidate(handle: string, recordVersion?: number): void;
|
|
246
|
-
close(): void;
|
|
247
|
-
}
|
|
248
|
-
export type ConnectClaustrumCredentialCacheOptions = ClaustrumClientOptions & ClaustrumCredentialCacheOptions & {
|
|
249
|
-
enabled?: boolean;
|
|
250
|
-
};
|
|
251
|
-
export declare function connectClaustrumCredentialCache(options?: ConnectClaustrumCredentialCacheOptions): Promise<ClaustrumCredentialCache | null>;
|
|
252
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AccountStorage, ClaustrumMode
|
|
2
|
-
import type { ClaustrumDetection
|
|
1
|
+
import type { AccountStorage, ClaustrumMode } from '../accounts.ts';
|
|
2
|
+
import type { ClaustrumDetection } from '../claustrum.ts';
|
|
3
3
|
import type { ClaustrumEnrollmentStatus } from '../claustrum-enrollment.ts';
|
|
4
4
|
export declare const CLAUDE_ACCOUNT_COMMAND_NAME = "claude-account";
|
|
5
5
|
export type AccountCommandAction = {
|
|
@@ -82,7 +82,6 @@ export declare function executeAccountCommand(input: {
|
|
|
82
82
|
storage: AccountStorage;
|
|
83
83
|
claustrum?: ClaustrumDetection;
|
|
84
84
|
statusProjection?: AccountCommandStatusProjection;
|
|
85
|
-
resolveCustodyBinding?: (account: FallbackAccount) => CustodyHandleResolution;
|
|
86
85
|
path?: string;
|
|
87
86
|
transition?: ClaustrumModeTransition;
|
|
88
87
|
resetEnrollment?: () => Promise<AccountCommandResult>;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,6 @@ export * from './cch.ts';
|
|
|
7
7
|
export * from './claude-code.ts';
|
|
8
8
|
export * from './claustrum.ts';
|
|
9
9
|
export * from './claustrum-enrollment.ts';
|
|
10
|
-
export * from './claustrum-enrollment-registry.ts';
|
|
11
|
-
export * from './claustrum-scoped.ts';
|
|
12
|
-
export * from './claustrum-scoped-roster.ts';
|
|
13
|
-
export * from './claustrum-scoped-runtime.ts';
|
|
14
10
|
export * from './commands/account.ts';
|
|
15
11
|
export * from './constants.ts';
|
|
16
12
|
export * from './custom-headers.ts';
|
|
@@ -23,16 +19,61 @@ export * from './logging.ts';
|
|
|
23
19
|
export * from './mid-conversation-output-config.ts';
|
|
24
20
|
export * from './model-remap.ts';
|
|
25
21
|
export * from './models.ts';
|
|
22
|
+
export type { NativeAccountRuntime, NativeAccountRuntimeOptions, NativeAccountWriteInput, NativeApiSubject, NativeLocalAuthorizeOptions, NativeRelayUpdate, } from './native-account-runtime.ts';
|
|
23
|
+
export { acquireNativeAccountRuntime, createNativeAccountRuntime, nativeAccountPolicy, } from './native-account-runtime.ts';
|
|
24
|
+
export type { NativeAccountMetadataPatch, NativeAccountSnapshot, NativeAccountView, } from './native-account-view.ts';
|
|
25
|
+
export { formatNativeAccountState } from './native-account-view.ts';
|
|
26
|
+
export * from './native-credential-validation.ts';
|
|
27
|
+
export type { NativeCustody, NativeCustodyClient, NativeCustodyErrorCode, NativeCustodyIdentity, NativeCustodyInventory, NativeCustodyLogger, NativeCustodyOptions, NativeCustodyReceipt, NativeCustodyReporterSource, NativeCustodyRetry, } from './native-custody.ts';
|
|
28
|
+
export { createNativeCustody, NativeCustodyError } from './native-custody.ts';
|
|
29
|
+
export type { NativeCustodyActivationErrorCode, NativeCustodyActivationHooks, NativeCustodyActivationOptions, NativeCustodyActivationResult, } from './native-custody-activation.ts';
|
|
30
|
+
export { NativeCustodyActivationError, runNativeCustodyActivation, } from './native-custody-activation.ts';
|
|
31
|
+
export { readNativeEnrollmentMode } from './native-enrollment-authority.ts';
|
|
32
|
+
export { inspectNativeHostAuthEntry, NativeHostAuthError, requireNoSupervisedAuthContentSnapshot, } from './native-host-auth.ts';
|
|
33
|
+
export { readNativeHostAuthKind } from './native-host-auth-read.ts';
|
|
34
|
+
export type { NativeLocalAttributedFailure, NativeLocalCredentialService, NativeLocalCredentialServiceOptions, NativeLocalFailurePolicyInput, } from './native-local-credential-service.ts';
|
|
35
|
+
export { createNativeLocalCredentialService } from './native-local-credential-service.ts';
|
|
36
|
+
export type { NativeLocalExternalPolicy } from './native-local-runtime-readers.ts';
|
|
37
|
+
export type { NativeMenuActionValues, NativeMenuCapabilityOutcome, NativeMenuDispatch, NativeMenuDispatchActionId, NativeMenuDispatchOptions, NativeMenuDispatchRequest, NativeMenuDispatchValues, NativeMenuExecutionContext, NativeMenuExecutionResult, NativeMenuExecutor, NativeMenuExecutorOptions, NativeMenuExecutorRefusalCode, NativeMenuKillswitchEntry, NativeMenuNoValues, NativeMenuRequest, NativeMenuSessionActionId, } from './native-menu-executor.ts';
|
|
38
|
+
export { createNativeMenuExecutor } from './native-menu-executor.ts';
|
|
39
|
+
export type { NativeMenuAction, NativeMenuActionId, NativeMenuCacheMode, NativeMenuChoiceParameter, NativeMenuCommandId, NativeMenuCustodyMode, NativeMenuGroup, NativeMenuGroupId, NativeMenuHost, NativeMenuLogLevel, NativeMenuModel, NativeMenuParameter, NativeMenuParameterId, NativeMenuRefusalCode, NativeMenuRoutingMode, NativeMenuStatus, } from './native-menu-model.ts';
|
|
40
|
+
export { getNativeMenuModel } from './native-menu-model.ts';
|
|
41
|
+
export type { NativeMigrationCustody, NativeMigrationHooks, NativeMigrationOptions, NativeMigrationPreflight, } from './native-migration.ts';
|
|
42
|
+
export { NativeMigrationError, prepareNativeMigration, releaseNativeMigrationPreflight, runNativeMigration, } from './native-migration.ts';
|
|
43
|
+
export type { NativeCommittedMaterial, NativeIdentityBootstrap, NativeRefreshContext, NativeRefreshDispatchVersion, NativeRefreshFailure, NativeRefreshHandoff, NativeRefreshObservation, NativeRefreshRequest, NativeRefreshRestriction, NativeRefreshResult, NativeRefreshSubject, NativeServingAdmission, } from './native-refresh-coordinator.ts';
|
|
44
|
+
export type { NativeLocalFailureAttribution, NativeLocalFailurePolicy, NativeLocalFailureSkipReason, } from './native-runtime.ts';
|
|
45
|
+
export { nativeRuntimeOptionIdentity } from './native-runtime-registry.ts';
|
|
46
|
+
export * from './native-settings.ts';
|
|
47
|
+
export { isNativeTransientAccountError, NativeTransientAccountError, } from './native-transient-account.ts';
|
|
48
|
+
export type { CommandApplyRequest, CommandApplyResult, CommandDialogPayload, CommandInvocation, CommandMenu, CommandMenuModel, KnobValue, KnobValues, MenuAction, MenuItem, MenuKnob, MenuSection, NativeUiOptions, NotifyKind, SectionSlot, } from './native-ui.ts';
|
|
49
|
+
export { createNativeUi, parseApplyRequest, runPiCommandMenu, } from './native-ui.ts';
|
|
50
|
+
export * from './native-usage-publication.ts';
|
|
51
|
+
export { NATIVE_VAULT_NO_ACCOUNT_MESSAGE, NativeVaultNoAccountError, readNativeAccountsForRequest, } from './native-vault-admission.ts';
|
|
52
|
+
export type { NativePiAuthSlot, NativePiAuthSlotErrorCode, NativePiAuthSlotInspection, NativePiAuthSlotOptions, NativeVaultDisconnectOptions, NativeVaultDisconnectResult, } from './native-vault-connection.ts';
|
|
53
|
+
export { disconnectNativeVaultForHost, NativePiAuthSlotError, nativePiAuthSlotPaths, openNativePiAuthSlot, } from './native-vault-connection.ts';
|
|
54
|
+
export type { NativeVaultRuntime, NativeVaultRuntimeOptions, NativeVaultWatch, NativeVaultWatchOptions, } from './native-vault-runtime.ts';
|
|
55
|
+
export { acquireNativeVaultRuntime, createNativeVaultRuntime, discoverNativeVaultInventory, publishNativeVaultRosterSeed, publishNativeVaultRuntimeSeed, } from './native-vault-runtime.ts';
|
|
26
56
|
export * from './oauth-profile.ts';
|
|
27
57
|
export * from './pkce.ts';
|
|
58
|
+
export type { NativeMigrationJournal } from './pool-authority.ts';
|
|
59
|
+
export { nativeMigrationAuthorityPhase, readNativeMigrationJournal, } from './pool-authority.ts';
|
|
60
|
+
export type { NativeLocalPoolBinding } from './pool-binding.ts';
|
|
61
|
+
export { captureNativeLocalPoolBinding } from './pool-binding.ts';
|
|
62
|
+
export * from './pool-paths.ts';
|
|
63
|
+
export * from './pool-store.ts';
|
|
28
64
|
export * from './prime.ts';
|
|
29
65
|
export * from './provider.ts';
|
|
66
|
+
export type { ProviderErrorRedactor, ProviderErrorResponseScope, ProviderResponseMode, ProviderResponseSettlement, } from './provider-error.ts';
|
|
67
|
+
export { createProviderErrorRedactor, createProviderErrorResponseScope, } from './provider-error.ts';
|
|
30
68
|
export * from './quota-header-feed.ts';
|
|
31
69
|
export * from './quota-headers.ts';
|
|
32
70
|
export * from './quota-manager.ts';
|
|
33
71
|
export * from './quotas.ts';
|
|
34
72
|
export * from './relay.ts';
|
|
73
|
+
export * from './request-history.ts';
|
|
35
74
|
export * from './routing.ts';
|
|
75
|
+
export type { SseEvent, SseFramer, SseFramerOptions } from './sse.ts';
|
|
76
|
+
export { createSseFramer, DEFAULT_SSE_MAX_FRAME_BYTES, decodeSseFrame, isSseCandidateFrame, isTerminatedSseFrame, parseSseFrame, SseFrameTooLargeError, } from './sse.ts';
|
|
36
77
|
export * from './start.ts';
|
|
37
78
|
export * from './sticky-routing.ts';
|
|
38
79
|
export * from './thinking-binding.ts';
|