@cortexkit/anthropic-auth-core 1.22.0 → 2.0.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.
Files changed (133) hide show
  1. package/README.md +2 -0
  2. package/dist/accounts.d.ts +52 -8
  3. package/dist/cachekeep.d.ts +27 -1
  4. package/dist/cch.d.ts +11 -1
  5. package/dist/claude-code.d.ts +23 -1
  6. package/dist/claustrum-enrollment.d.ts +72 -0
  7. package/dist/claustrum-scoped-roster.d.ts +27 -0
  8. package/dist/claustrum-scoped-runtime.d.ts +31 -0
  9. package/dist/claustrum-scoped.d.ts +53 -0
  10. package/dist/claustrum.d.ts +16 -82
  11. package/dist/commands/account.d.ts +38 -11
  12. package/dist/constants.d.ts +3 -2
  13. package/dist/custom-headers.d.ts +3 -0
  14. package/dist/index.d.ts +50 -0
  15. package/dist/index.js +29700 -31
  16. package/dist/internal-types/LICENSE +21 -0
  17. package/dist/internal-types/commands/builtins.d.ts +71 -0
  18. package/dist/internal-types/commands/index.d.ts +10 -0
  19. package/dist/internal-types/commands/menu.d.ts +61 -0
  20. package/dist/internal-types/commands/model.d.ts +238 -0
  21. package/dist/internal-types/commands/pi.d.ts +23 -0
  22. package/dist/internal-types/commands/seam.d.ts +72 -0
  23. package/dist/internal-types/fs/refresh-file-lock.d.ts +33 -0
  24. package/dist/internal-types/logger/capture-sink.d.ts +14 -0
  25. package/dist/internal-types/logger/engine.d.ts +100 -0
  26. package/dist/internal-types/logger/index.d.ts +6 -0
  27. package/dist/internal-types/logger/redact.d.ts +11 -0
  28. package/dist/internal-types/pi-slot/index.d.ts +3 -0
  29. package/dist/internal-types/pi-slot/slot.d.ts +49 -0
  30. package/dist/internal-types/quota/codec.d.ts +11 -0
  31. package/dist/internal-types/quota/format.d.ts +46 -0
  32. package/dist/internal-types/quota/index.d.ts +10 -0
  33. package/dist/internal-types/quota/map.d.ts +63 -0
  34. package/dist/internal-types/quota/merge.d.ts +48 -0
  35. package/dist/internal-types/quota/projection.d.ts +64 -0
  36. package/dist/internal-types/store/attribution.d.ts +28 -0
  37. package/dist/internal-types/store/errors.d.ts +55 -0
  38. package/dist/internal-types/store/hooks.d.ts +12 -0
  39. package/dist/internal-types/store/identity.d.ts +39 -0
  40. package/dist/internal-types/store/index.d.ts +21 -0
  41. package/dist/internal-types/store/mutate.d.ts +189 -0
  42. package/dist/internal-types/store/pool.d.ts +196 -0
  43. package/dist/internal-types/store/provider-state.d.ts +131 -0
  44. package/dist/internal-types/store/publication.d.ts +47 -0
  45. package/dist/internal-types/store/pull.d.ts +36 -0
  46. package/dist/internal-types/store/refresh-lock.d.ts +63 -0
  47. package/dist/internal-types/store/refresh.d.ts +72 -0
  48. package/dist/internal-types/store/rows.d.ts +313 -0
  49. package/dist/internal-types/store/runtime.d.ts +36 -0
  50. package/dist/internal-types/store/schema.d.ts +443 -0
  51. package/dist/internal-types/store/settings.d.ts +63 -0
  52. package/dist/internal-types/store/torn.d.ts +78 -0
  53. package/dist/migration-source.d.ts +33 -0
  54. package/dist/model-remap.d.ts +27 -0
  55. package/dist/models.d.ts +60 -0
  56. package/dist/native-account-runtime.d.ts +121 -0
  57. package/dist/native-account-view.d.ts +126 -0
  58. package/dist/native-command-effects.d.ts +59 -0
  59. package/dist/native-credential-validation.d.ts +42 -0
  60. package/dist/native-custody-activation.d.ts +45 -0
  61. package/dist/native-custody.d.ts +114 -0
  62. package/dist/native-enrollment-authority.d.ts +2 -0
  63. package/dist/native-host-auth-read.d.ts +3 -0
  64. package/dist/native-host-auth-write.d.ts +51 -0
  65. package/dist/native-host-auth.d.ts +12 -0
  66. package/dist/native-local-credential-service.d.ts +76 -0
  67. package/dist/native-local-runtime-readers.d.ts +22 -0
  68. package/dist/native-lock-observer.d.ts +12 -0
  69. package/dist/native-menu-executor.d.ts +243 -0
  70. package/dist/native-menu-model.d.ts +142 -0
  71. package/dist/native-migration-proof.d.ts +28 -0
  72. package/dist/native-migration-source.d.ts +47 -0
  73. package/dist/native-migration.d.ts +66 -0
  74. package/dist/native-quota-codec.d.ts +32 -0
  75. package/dist/native-refresh-coordinator.d.ts +240 -0
  76. package/dist/native-roster-seed.d.ts +115 -0
  77. package/dist/native-runtime-registry.d.ts +19 -0
  78. package/dist/native-runtime.d.ts +204 -0
  79. package/dist/native-transient-account.d.ts +38 -0
  80. package/dist/native-ui.d.ts +45 -0
  81. package/dist/native-usage-publication.d.ts +11 -0
  82. package/dist/native-vault-admission.d.ts +8 -0
  83. package/dist/native-vault-connection.d.ts +33 -0
  84. package/dist/native-vault-paths.d.ts +13 -0
  85. package/dist/native-vault-runtime.d.ts +102 -0
  86. package/dist/native-vault-seed.d.ts +16 -0
  87. package/dist/oauth-profile.d.ts +2 -1
  88. package/dist/pool-authority.d.ts +159 -0
  89. package/dist/pool-binding.d.ts +32 -0
  90. package/dist/pool-paths.d.ts +21 -0
  91. package/dist/pool-store.d.ts +32 -0
  92. package/dist/prime.d.ts +11 -3
  93. package/dist/provider-error.d.ts +139 -0
  94. package/dist/quota-header-feed.d.ts +13 -0
  95. package/dist/quota-manager.d.ts +30 -5
  96. package/dist/relay.d.ts +22 -1
  97. package/dist/request-history.d.ts +34 -0
  98. package/dist/sse.d.ts +81 -0
  99. package/dist/sticky-routing.d.ts +29 -0
  100. package/package.json +9 -3
  101. package/dist/accounts.js +0 -3330
  102. package/dist/auth.js +0 -182
  103. package/dist/cache1h.js +0 -97
  104. package/dist/cachekeep-registry.js +0 -124
  105. package/dist/cachekeep.js +0 -578
  106. package/dist/cch.js +0 -127
  107. package/dist/claude-code.js +0 -388
  108. package/dist/claustrum.js +0 -529
  109. package/dist/commands/account.js +0 -239
  110. package/dist/constants.js +0 -82
  111. package/dist/dump.js +0 -616
  112. package/dist/fast.js +0 -66
  113. package/dist/json.js +0 -10
  114. package/dist/killswitch.js +0 -132
  115. package/dist/logger.js +0 -286
  116. package/dist/logging.js +0 -59
  117. package/dist/mid-conversation-output-config.js +0 -89
  118. package/dist/models.js +0 -141
  119. package/dist/network-errors.js +0 -27
  120. package/dist/oauth-profile.js +0 -54
  121. package/dist/pkce.js +0 -17
  122. package/dist/prime.js +0 -823
  123. package/dist/provider.js +0 -0
  124. package/dist/quota-header-feed.js +0 -279
  125. package/dist/quota-headers.js +0 -121
  126. package/dist/quota-manager.js +0 -805
  127. package/dist/quotas.js +0 -141
  128. package/dist/relay.js +0 -1243
  129. package/dist/routing.js +0 -94
  130. package/dist/start.js +0 -29
  131. package/dist/sticky-routing.js +0 -523
  132. package/dist/thinking-binding.js +0 -54
  133. package/dist/token-fingerprint.js +0 -8
@@ -1,8 +1,12 @@
1
- import type { AccountStorage } from '../accounts.ts';
1
+ import type { AccountStorage, ClaustrumMode } from '../accounts.ts';
2
2
  import type { ClaustrumDetection } from '../claustrum.ts';
3
+ import type { ClaustrumEnrollmentStatus } from '../claustrum-enrollment.ts';
3
4
  export declare const CLAUDE_ACCOUNT_COMMAND_NAME = "claude-account";
4
5
  export type AccountCommandAction = {
5
6
  type: 'status';
7
+ } | {
8
+ type: 'claustrum-mode';
9
+ mode: ClaustrumMode;
6
10
  } | {
7
11
  type: 'enable';
8
12
  id: string;
@@ -20,6 +24,8 @@ export type AccountCommandAction = {
20
24
  id: string;
21
25
  } | {
22
26
  type: 'reset-backoff';
27
+ } | {
28
+ type: 'enrollment-reset';
23
29
  } | {
24
30
  type: 'add-apikey';
25
31
  apiKey: string;
@@ -35,6 +41,17 @@ export type AccountCommandAction = {
35
41
  } | {
36
42
  type: 'usage';
37
43
  };
44
+ export type AccountCommandResult = {
45
+ text: string;
46
+ updated?: {
47
+ id: string;
48
+ action: 'enable' | 'disable' | 'remove' | 'reorder' | 'reset-backoff';
49
+ enabled?: boolean;
50
+ previousOrder?: string[];
51
+ newOrder?: string[];
52
+ };
53
+ };
54
+ export type ClaustrumModeTransition = (mode: ClaustrumMode) => Promise<AccountCommandResult>;
38
55
  export declare function parseAccountCommandAction(argumentsText: string): AccountCommandAction;
39
56
  export interface AccountListItem {
40
57
  id: string;
@@ -44,18 +61,28 @@ export interface AccountListItem {
44
61
  quotaPercent: number | null;
45
62
  tierLabel?: string;
46
63
  }
64
+ export type CustodyStatusState = 'na' | 'off' | 'on-vault-served' | 'on-vault-reauth' | 'on-cold' | 'unknown-identity' | 'on-identity-mismatch' | 'on-corrupt-binding';
65
+ export declare function custodyStatusLabel(state: CustodyStatusState): string;
66
+ export declare function formatEnrollmentStatus(status: ClaustrumEnrollmentStatus, scopedServing?: boolean): string[];
67
+ export type AccountCommandStatusProjection = {
68
+ claustrumDetection: string;
69
+ claustrumEnrollment?: ClaustrumEnrollmentStatus;
70
+ custodyMode?: 'local' | 'claustrum';
71
+ custodyModeKnown?: boolean;
72
+ accounts: Array<AccountListItem & {
73
+ claustrumGate: 'on' | 'off' | 'na';
74
+ vaultServed: boolean;
75
+ vaultReauth: boolean;
76
+ custodyState: CustodyStatusState;
77
+ }>;
78
+ };
47
79
  export declare function buildAccountList(storage: AccountStorage): AccountListItem[];
48
80
  export declare function executeAccountCommand(input: {
49
81
  argumentsText: string;
50
82
  storage: AccountStorage;
51
83
  claustrum?: ClaustrumDetection;
52
- }): {
53
- text: string;
54
- updated?: {
55
- id: string;
56
- action: 'enable' | 'disable' | 'remove' | 'reorder' | 'reset-backoff';
57
- enabled?: boolean;
58
- previousOrder?: string[];
59
- newOrder?: string[];
60
- };
61
- };
84
+ statusProjection?: AccountCommandStatusProjection;
85
+ path?: string;
86
+ transition?: ClaustrumModeTransition;
87
+ resetEnrollment?: () => Promise<AccountCommandResult>;
88
+ }): Promise<AccountCommandResult>;
@@ -5,6 +5,7 @@ export declare const AUTHORIZE_URLS: {
5
5
  };
6
6
  export declare const CODE_CALLBACK_URL = "https://platform.claude.com/oauth/code/callback";
7
7
  export declare const TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
8
+ export declare const CUSTODY_HANDLE_PATTERN: RegExp;
8
9
  export declare const AXIOS_USER_AGENT = "axios/1.15.2";
9
10
  export declare const OAUTH_SCOPES: string[];
10
11
  export declare const REFRESH_SCOPE = "user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";
@@ -18,11 +19,11 @@ export declare const CLAUDE_CODE_IDENTITY = "You are Claude Code, Anthropic's of
18
19
  export declare const PARALLEL_TOOL_CALLS_SYSTEM_PROMPT: string;
19
20
  export declare const CCH_SALT = "59cf53e54c78";
20
21
  export declare const CCH_POSITIONS: number[];
21
- export declare const CLAUDE_CODE_VERSION = "2.1.258";
22
+ export declare const CLAUDE_CODE_VERSION = "2.1.280";
22
23
  export declare const CLAUDE_CODE_ENTRYPOINT = "cli";
23
24
  export declare const CLAUDE_CODE_STAINLESS_PACKAGE_VERSION = "0.112.1";
24
25
  export declare const CLAUDE_CODE_STAINLESS_RUNTIME_VERSION = "v26.3.0";
25
- export declare const USER_AGENT = "claude-cli/2.1.258 (external, cli)";
26
+ export declare const USER_AGENT = "claude-cli/2.1.280 (external, cli)";
26
27
  export declare const CACHE_1H_MODES: readonly ['explicit', 'automatic', 'hybrid'];
27
28
  export type Cache1hMode = (typeof CACHE_1H_MODES)[number];
28
29
  export declare const DEFAULT_CACHE_1H_MODE: Cache1hMode;
@@ -0,0 +1,3 @@
1
+ export declare const ANTHROPIC_CUSTOM_HEADERS_ENV = "ANTHROPIC_CUSTOM_HEADERS";
2
+ export declare function parseCustomHeaders(raw: string | undefined): Headers;
3
+ export declare function applyCustomHeaders(headers: Headers, raw?: string | undefined): Headers;
package/dist/index.d.ts CHANGED
@@ -6,8 +6,13 @@ export * from './cachekeep-registry.ts';
6
6
  export * from './cch.ts';
7
7
  export * from './claude-code.ts';
8
8
  export * from './claustrum.ts';
9
+ export * from './claustrum-enrollment.ts';
10
+ export * from './claustrum-scoped.ts';
11
+ export * from './claustrum-scoped-roster.ts';
12
+ export * from './claustrum-scoped-runtime.ts';
9
13
  export * from './commands/account.ts';
10
14
  export * from './constants.ts';
15
+ export * from './custom-headers.ts';
11
16
  export * from './dump.ts';
12
17
  export * from './fast.ts';
13
18
  export * from './json.ts';
@@ -15,17 +20,62 @@ export * from './killswitch.ts';
15
20
  export * from './logger.ts';
16
21
  export * from './logging.ts';
17
22
  export * from './mid-conversation-output-config.ts';
23
+ export * from './model-remap.ts';
18
24
  export * from './models.ts';
25
+ export type { NativeAccountRuntime, NativeAccountRuntimeOptions, NativeAccountWriteInput, NativeApiSubject, NativeLocalAuthorizeOptions, NativeRelayUpdate, } from './native-account-runtime.ts';
26
+ export { acquireNativeAccountRuntime, createNativeAccountRuntime, nativeAccountPolicy, } from './native-account-runtime.ts';
27
+ export type { NativeAccountMetadataPatch, NativeAccountSnapshot, NativeAccountView, } from './native-account-view.ts';
28
+ export { formatNativeAccountState } from './native-account-view.ts';
29
+ export * from './native-credential-validation.ts';
30
+ export type { NativeCustody, NativeCustodyClient, NativeCustodyErrorCode, NativeCustodyIdentity, NativeCustodyInventory, NativeCustodyLogger, NativeCustodyOptions, NativeCustodyReceipt, NativeCustodyReporterSource, NativeCustodyRetry, } from './native-custody.ts';
31
+ export { createNativeCustody, NativeCustodyError } from './native-custody.ts';
32
+ export type { NativeCustodyActivationErrorCode, NativeCustodyActivationHooks, NativeCustodyActivationOptions, NativeCustodyActivationResult, } from './native-custody-activation.ts';
33
+ export { NativeCustodyActivationError, runNativeCustodyActivation, } from './native-custody-activation.ts';
34
+ export { readNativeEnrollmentMode } from './native-enrollment-authority.ts';
35
+ export { inspectNativeHostAuthEntry, NativeHostAuthError, requireNoSupervisedAuthContentSnapshot, } from './native-host-auth.ts';
36
+ export { readNativeHostAuthKind } from './native-host-auth-read.ts';
37
+ export type { NativeLocalAttributedFailure, NativeLocalCredentialService, NativeLocalCredentialServiceOptions, NativeLocalFailurePolicyInput, } from './native-local-credential-service.ts';
38
+ export { createNativeLocalCredentialService } from './native-local-credential-service.ts';
39
+ export type { NativeLocalExternalPolicy } from './native-local-runtime-readers.ts';
40
+ export type { NativeMenuActionValues, NativeMenuCapabilityOutcome, NativeMenuDispatch, NativeMenuDispatchActionId, NativeMenuDispatchOptions, NativeMenuDispatchRequest, NativeMenuDispatchValues, NativeMenuExecutionContext, NativeMenuExecutionResult, NativeMenuExecutor, NativeMenuExecutorOptions, NativeMenuExecutorRefusalCode, NativeMenuKillswitchEntry, NativeMenuNoValues, NativeMenuRequest, NativeMenuSessionActionId, } from './native-menu-executor.ts';
41
+ export { createNativeMenuExecutor } from './native-menu-executor.ts';
42
+ export type { NativeMenuAction, NativeMenuActionId, NativeMenuCacheMode, NativeMenuChoiceParameter, NativeMenuCommandId, NativeMenuCustodyMode, NativeMenuGroup, NativeMenuGroupId, NativeMenuHost, NativeMenuLogLevel, NativeMenuModel, NativeMenuParameter, NativeMenuParameterId, NativeMenuRefusalCode, NativeMenuRoutingMode, NativeMenuStatus, } from './native-menu-model.ts';
43
+ export { getNativeMenuModel } from './native-menu-model.ts';
44
+ export type { NativeMigrationCustody, NativeMigrationHooks, NativeMigrationOptions, NativeMigrationPreflight, } from './native-migration.ts';
45
+ export { NativeMigrationError, prepareNativeMigration, releaseNativeMigrationPreflight, runNativeMigration, } from './native-migration.ts';
46
+ export type { NativeCommittedMaterial, NativeIdentityBootstrap, NativeRefreshContext, NativeRefreshDispatchVersion, NativeRefreshFailure, NativeRefreshHandoff, NativeRefreshObservation, NativeRefreshRequest, NativeRefreshRestriction, NativeRefreshResult, NativeRefreshSubject, NativeServingAdmission, } from './native-refresh-coordinator.ts';
47
+ export type { NativeLocalFailureAttribution, NativeLocalFailurePolicy, NativeLocalFailureSkipReason, } from './native-runtime.ts';
48
+ export { nativeRuntimeOptionIdentity } from './native-runtime-registry.ts';
49
+ export { isNativeTransientAccountError, NativeTransientAccountError, } from './native-transient-account.ts';
50
+ export type { CommandApplyRequest, CommandApplyResult, CommandDialogPayload, CommandInvocation, CommandMenu, CommandMenuModel, KnobValue, KnobValues, MenuAction, MenuItem, MenuKnob, MenuSection, NativeUiOptions, NotifyKind, SectionSlot, } from './native-ui.ts';
51
+ export { createNativeUi, parseApplyRequest, runPiCommandMenu, } from './native-ui.ts';
52
+ export * from './native-usage-publication.ts';
53
+ export { NATIVE_VAULT_NO_ACCOUNT_MESSAGE, NativeVaultNoAccountError, readNativeAccountsForRequest, } from './native-vault-admission.ts';
54
+ export type { NativePiAuthSlot, NativePiAuthSlotErrorCode, NativePiAuthSlotInspection, NativePiAuthSlotOptions, NativeVaultDisconnectOptions, NativeVaultDisconnectResult, } from './native-vault-connection.ts';
55
+ export { disconnectNativeVaultForHost, NativePiAuthSlotError, nativePiAuthSlotPaths, openNativePiAuthSlot, } from './native-vault-connection.ts';
56
+ export type { NativeVaultRuntime, NativeVaultRuntimeOptions, NativeVaultWatch, NativeVaultWatchOptions, } from './native-vault-runtime.ts';
57
+ export { acquireNativeVaultRuntime, createNativeVaultRuntime, discoverNativeVaultInventory, publishNativeVaultRosterSeed, publishNativeVaultRuntimeSeed, } from './native-vault-runtime.ts';
19
58
  export * from './oauth-profile.ts';
20
59
  export * from './pkce.ts';
60
+ export type { NativeMigrationJournal } from './pool-authority.ts';
61
+ export { nativeMigrationAuthorityPhase, readNativeMigrationJournal, } from './pool-authority.ts';
62
+ export type { NativeLocalPoolBinding } from './pool-binding.ts';
63
+ export { captureNativeLocalPoolBinding } from './pool-binding.ts';
64
+ export * from './pool-paths.ts';
65
+ export * from './pool-store.ts';
21
66
  export * from './prime.ts';
22
67
  export * from './provider.ts';
68
+ export type { ProviderErrorRedactor, ProviderErrorResponseScope, ProviderResponseMode, ProviderResponseSettlement, } from './provider-error.ts';
69
+ export { createProviderErrorRedactor, createProviderErrorResponseScope, } from './provider-error.ts';
23
70
  export * from './quota-header-feed.ts';
24
71
  export * from './quota-headers.ts';
25
72
  export * from './quota-manager.ts';
26
73
  export * from './quotas.ts';
27
74
  export * from './relay.ts';
75
+ export * from './request-history.ts';
28
76
  export * from './routing.ts';
77
+ export type { SseEvent, SseFramer, SseFramerOptions } from './sse.ts';
78
+ export { createSseFramer, DEFAULT_SSE_MAX_FRAME_BYTES, decodeSseFrame, isSseCandidateFrame, isTerminatedSseFrame, parseSseFrame, SseFrameTooLargeError, } from './sse.ts';
29
79
  export * from './start.ts';
30
80
  export * from './sticky-routing.ts';
31
81
  export * from './thinking-binding.ts';