@cortexkit/anthropic-auth-core 2.0.2 → 2.1.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 (73) hide show
  1. package/dist/accounts.d.ts +7 -1
  2. package/dist/cache1h.d.ts +2 -0
  3. package/dist/cachekeep-registry.d.ts +3 -0
  4. package/dist/cachekeep.d.ts +2 -0
  5. package/dist/cch.d.ts +19 -0
  6. package/dist/claude-code.d.ts +8 -2
  7. package/dist/claustrum-enrollment.d.ts +5 -1
  8. package/dist/constants.d.ts +15 -3
  9. package/dist/dump.d.ts +4 -0
  10. package/dist/fast.d.ts +2 -0
  11. package/dist/index.d.ts +15 -8
  12. package/dist/index.js +29647 -25296
  13. package/dist/insula-quota.d.ts +25 -0
  14. package/dist/internal-types/auth-menu/terminal.d.ts +43 -0
  15. package/dist/internal-types/claustrum/availability.d.ts +89 -0
  16. package/dist/internal-types/claustrum/consumer.d.ts +172 -0
  17. package/dist/internal-types/claustrum/custody.d.ts +299 -0
  18. package/dist/internal-types/claustrum/enrollment.d.ts +164 -0
  19. package/dist/internal-types/claustrum/errors.d.ts +17 -0
  20. package/dist/internal-types/claustrum/host-slot.d.ts +39 -0
  21. package/dist/internal-types/claustrum/index.d.ts +21 -0
  22. package/dist/internal-types/claustrum/insula.d.ts +117 -0
  23. package/dist/internal-types/claustrum/interlock.d.ts +27 -0
  24. package/dist/internal-types/claustrum/roster.d.ts +221 -0
  25. package/dist/internal-types/claustrum/watch.d.ts +141 -0
  26. package/dist/internal-types/fs/refresh-file-lock.d.ts +8 -2
  27. package/dist/internal-types/quota/format.d.ts +43 -3
  28. package/dist/internal-types/quota/index.d.ts +3 -3
  29. package/dist/internal-types/quota/projection.d.ts +16 -0
  30. package/dist/internal-types/routing/admission.d.ts +93 -0
  31. package/dist/internal-types/routing/index.d.ts +8 -0
  32. package/dist/internal-types/routing/ordered.d.ts +47 -0
  33. package/dist/internal-types/routing/pins.d.ts +22 -0
  34. package/dist/internal-types/routing/sticky.d.ts +158 -0
  35. package/dist/internal-types/setup/command-error.d.ts +32 -0
  36. package/dist/internal-types/setup/command.d.ts +3 -0
  37. package/dist/internal-types/setup/detect.d.ts +6 -0
  38. package/dist/internal-types/setup/index.d.ts +6 -0
  39. package/dist/internal-types/setup/process-fence.d.ts +43 -0
  40. package/dist/internal-types/setup/register.d.ts +11 -0
  41. package/dist/internal-types/setup/types.d.ts +150 -0
  42. package/dist/internal-types/store/pool.d.ts +1 -1
  43. package/dist/internal-types/store/refresh-lock.d.ts +0 -1
  44. package/dist/logging.d.ts +2 -0
  45. package/dist/mid-conversation-output-config.d.ts +34 -2
  46. package/dist/migration-source.d.ts +2 -0
  47. package/dist/native-account-runtime.d.ts +9 -4
  48. package/dist/native-account-view.d.ts +19 -3
  49. package/dist/native-custody-activation.d.ts +1 -1
  50. package/dist/native-custody.d.ts +130 -0
  51. package/dist/native-enrollment-authority.d.ts +5 -1
  52. package/dist/native-host-auth-read.d.ts +2 -1
  53. package/dist/native-host-auth-write.d.ts +2 -0
  54. package/dist/native-menu-executor.d.ts +1 -1
  55. package/dist/native-migration.d.ts +25 -4
  56. package/dist/native-quota-observations.d.ts +26 -0
  57. package/dist/native-runtime.d.ts +5 -1
  58. package/dist/native-transient-account.d.ts +3 -4
  59. package/dist/native-ui.d.ts +2 -0
  60. package/dist/native-usage-publication.d.ts +5 -0
  61. package/dist/native-vault-invalidation.d.ts +9 -0
  62. package/dist/native-vault-runtime.d.ts +36 -3
  63. package/dist/network-errors.d.ts +1 -0
  64. package/dist/owner-only.d.ts +19 -0
  65. package/dist/pool-authority.d.ts +27 -8
  66. package/dist/pool-paths.d.ts +2 -0
  67. package/dist/provider-error.d.ts +34 -0
  68. package/dist/publication-rename.d.ts +11 -0
  69. package/dist/quota-manager.d.ts +21 -4
  70. package/dist/quotas.d.ts +31 -2
  71. package/dist/relay.d.ts +20 -0
  72. package/dist/request-gzip.d.ts +99 -0
  73. package/package.json +4 -4
@@ -0,0 +1,99 @@
1
+ /** Claude Code's own opt-out: `0`/`false` turns gzip off, `1`/`true` forces it. */
2
+ export declare const GZIP_REQUEST_BODIES_ENV = "CLAUDE_CODE_GZIP_REQUEST_BODIES";
3
+ /** How long a persisted latch keeps gzip off. */
4
+ export declare const GZIP_LATCH_TTL_MS: number;
5
+ export type RequestGzipSkipReason = 'version' | 'host' | 'env_off' | 'below_min_size' | 'proxy' | 'mtls' | 'custom_ca' | 'latched_off';
6
+ export type RequestGzipDecision = {
7
+ gzip: true;
8
+ forced: boolean;
9
+ } | {
10
+ gzip: false;
11
+ reason: RequestGzipSkipReason;
12
+ };
13
+ export type GzipRejectionKind = 'non_anthropic_rejection' | 'invalid_json_at_origin';
14
+ /**
15
+ * What the caller's transport adds beyond the environment: a proxy, a custom
16
+ * certificate authority or a client certificate the caller passes to fetch
17
+ * itself. Claude Code sends uncompressed bodies through any of these.
18
+ */
19
+ export interface RequestGzipTransport {
20
+ proxy?: boolean;
21
+ customCa?: boolean;
22
+ mtls?: boolean;
23
+ }
24
+ type Env = Record<string, string | undefined>;
25
+ /**
26
+ * Remembers that a gzipped body was rejected. Any rejection turns gzip off
27
+ * for this process; a proxy rejection followed by an accepted uncompressed
28
+ * resend also writes `{latchedAt, status}` to `path`, which keeps gzip off
29
+ * for seven days in later processes. The file belongs to this plugin, not to
30
+ * the user's settings. An expired, future-dated or unreadable record is
31
+ * removed when read.
32
+ */
33
+ export declare class RequestGzipLatch {
34
+ #private;
35
+ readonly path?: string | undefined;
36
+ readonly now: () => number;
37
+ constructor(path?: string | undefined, now?: () => number);
38
+ get latchedThisProcess(): boolean;
39
+ latchProcess(): void;
40
+ /** Whether the latch file holds a record younger than seven days (read once). */
41
+ persistedInEffect(): Promise<boolean>;
42
+ persist(status: number): Promise<void>;
43
+ }
44
+ /** One latch per storage path, shared by every send path in this process. */
45
+ export declare function getRequestGzipLatch(path?: string): RequestGzipLatch;
46
+ /** The latch file path: `<stem>-request-gzip.json` beside the account storage file. */
47
+ export declare function getRequestGzipLatchPath(accountStoragePath: string): string;
48
+ /** Decide, in Claude Code's order, whether this request body goes out gzipped. */
49
+ export declare function decideRequestGzip(options: {
50
+ url: string | URL;
51
+ body: unknown;
52
+ latch: RequestGzipLatch;
53
+ env?: Env;
54
+ transport?: RequestGzipTransport;
55
+ }): Promise<RequestGzipDecision>;
56
+ /** A newline and 0 to 256 random spaces and tabs, as Claude Code appends. */
57
+ export declare function requestGzipPadding(random?: () => number): string;
58
+ /**
59
+ * The gzipped wire bytes for a signed identity body: `cch` reset to `00000`,
60
+ * padding appended, one gzip member at level 6. Never sign the result.
61
+ */
62
+ export declare function encodeGzipRequestBody(identityBody: string, random?: () => number): Promise<Uint8Array>;
63
+ /**
64
+ * Claude Code's test for a rejected gzipped body: a 400, 403 or 415 that
65
+ * either did not come from Anthropic (no `req_` request id and no `cf-ray`)
66
+ * or, for a 400, says the JSON could not be parsed. Any other response,
67
+ * including an ordinary API 400, is not a gzip problem. Reads at most 8 KiB
68
+ * from a clone, so the response itself stays unread.
69
+ */
70
+ export declare function classifyGzipRejection(response: Response): Promise<GzipRejectionKind | null>;
71
+ export interface RequestGzipEvent {
72
+ decision: RequestGzipDecision;
73
+ rejection?: {
74
+ kind: GzipRejectionKind;
75
+ status: number;
76
+ };
77
+ resendStatus?: number;
78
+ persisted?: boolean;
79
+ }
80
+ /**
81
+ * Send a signed identity body, gzipped when Claude Code would gzip it.
82
+ *
83
+ * `send` performs one physical request with the given body and headers; it is
84
+ * called once, or twice when the gzipped body is rejected: the second call
85
+ * gets the identity body and the same headers (same `x-client-request-id`,
86
+ * same retry count) minus `content-encoding`. That resend is not a retry.
87
+ */
88
+ export declare function sendWithRequestGzip(options: {
89
+ url: string | URL;
90
+ body: string;
91
+ headers: Headers;
92
+ send: (body: string | Uint8Array, headers: Headers) => Promise<Response>;
93
+ latch: RequestGzipLatch;
94
+ env?: Env;
95
+ transport?: RequestGzipTransport;
96
+ random?: () => number;
97
+ onEvent?: (event: RequestGzipEvent) => void;
98
+ }): Promise<Response>;
99
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/anthropic-auth-core",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,12 +30,12 @@
30
30
  "prepublishOnly": "bun run build"
31
31
  },
32
32
  "devDependencies": {
33
- "@cortexkit/common-auth": "0.17.0"
33
+ "@cortexkit/common-auth": "0.21.1"
34
34
  },
35
35
  "dependencies": {
36
- "@cortexkit/claustrum-client": "0.9.0",
36
+ "@cortexkit/claustrum-client": "0.12.0",
37
37
  "@cortexkit/private-files": "0.2.1",
38
- "@cortexkit/subc-client": "^0.16.0",
38
+ "@cortexkit/subc-client": "^0.22.0",
39
39
  "jsonc-parser": "^3.3.1",
40
40
  "xxhash-wasm": "^1.1.0"
41
41
  }