@tormentalabs/claude-code-wire-compat 0.4.0 → 0.6.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 (72) hide show
  1. package/CHANGELOG.md +217 -0
  2. package/README.md +51 -7
  3. package/dist/betas.d.ts +65 -7
  4. package/dist/betas.d.ts.map +1 -1
  5. package/dist/betas.js +143 -2
  6. package/dist/betas.js.map +1 -1
  7. package/dist/build-request.d.ts +12 -6
  8. package/dist/build-request.d.ts.map +1 -1
  9. package/dist/build-request.js +44 -15
  10. package/dist/build-request.js.map +1 -1
  11. package/dist/contracts.d.ts +7 -2
  12. package/dist/contracts.d.ts.map +1 -1
  13. package/dist/contracts.js.map +1 -1
  14. package/dist/fingerprint.d.ts.map +1 -1
  15. package/dist/fingerprint.js +5 -0
  16. package/dist/fingerprint.js.map +1 -1
  17. package/dist/headers.d.ts.map +1 -1
  18. package/dist/headers.js +5 -2
  19. package/dist/headers.js.map +1 -1
  20. package/dist/index.d.ts +10 -3
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +6 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/model-capabilities.d.ts +3 -3
  25. package/dist/model-capabilities.d.ts.map +1 -1
  26. package/dist/model-capabilities.js +55 -19
  27. package/dist/model-capabilities.js.map +1 -1
  28. package/dist/model-identity.d.ts +9 -1
  29. package/dist/model-identity.d.ts.map +1 -1
  30. package/dist/model-identity.js +33 -2
  31. package/dist/model-identity.js.map +1 -1
  32. package/dist/model-queries.d.ts +89 -0
  33. package/dist/model-queries.d.ts.map +1 -0
  34. package/dist/model-queries.js +232 -0
  35. package/dist/model-queries.js.map +1 -0
  36. package/dist/models.js +1 -1
  37. package/dist/models.js.map +1 -1
  38. package/dist/profiles/beta-registry-2.1.280.d.ts +211 -0
  39. package/dist/profiles/beta-registry-2.1.280.d.ts.map +1 -0
  40. package/dist/profiles/beta-registry-2.1.280.js +292 -0
  41. package/dist/profiles/beta-registry-2.1.280.js.map +1 -0
  42. package/dist/profiles/claude-code-2.1.280.d.ts +3 -0
  43. package/dist/profiles/claude-code-2.1.280.d.ts.map +1 -0
  44. package/dist/profiles/claude-code-2.1.280.js +359 -0
  45. package/dist/profiles/claude-code-2.1.280.js.map +1 -0
  46. package/dist/redaction.d.ts.map +1 -1
  47. package/dist/redaction.js +3 -0
  48. package/dist/redaction.js.map +1 -1
  49. package/dist/request-body.d.ts +1 -1
  50. package/dist/request-body.d.ts.map +1 -1
  51. package/dist/request-body.js +16 -5
  52. package/dist/request-body.js.map +1 -1
  53. package/dist/thinking.d.ts +53 -2
  54. package/dist/thinking.d.ts.map +1 -1
  55. package/dist/thinking.js +124 -26
  56. package/dist/thinking.js.map +1 -1
  57. package/package.json +6 -3
  58. package/src/betas.ts +208 -9
  59. package/src/build-request.ts +54 -21
  60. package/src/contracts.ts +7 -2
  61. package/src/fingerprint.ts +5 -0
  62. package/src/headers.ts +4 -2
  63. package/src/index.ts +28 -3
  64. package/src/model-capabilities.ts +55 -19
  65. package/src/model-identity.ts +29 -2
  66. package/src/model-queries.ts +273 -0
  67. package/src/models.ts +1 -1
  68. package/src/profiles/beta-registry-2.1.280.ts +309 -0
  69. package/src/profiles/claude-code-2.1.280.ts +364 -0
  70. package/src/redaction.ts +3 -0
  71. package/src/request-body.ts +25 -3
  72. package/src/thinking.ts +148 -26
@@ -0,0 +1,292 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ /*
3
+ * `deepFreeze` is duplicated from `src/beta-registry.ts` rather than imported,
4
+ * for the same reason the 2.1.233 registry duplicates it: a shared helper
5
+ * module would make every registry import-coupled for four lines of code, and
6
+ * keeping each registry a leaf keeps a version bump from rippling.
7
+ */
8
+ function deepFreeze(value) {
9
+ if (value !== null && typeof value === "object") {
10
+ for (const key of Reflect.ownKeys(value)) {
11
+ deepFreeze(Reflect.get(value, key));
12
+ }
13
+ Object.freeze(value);
14
+ }
15
+ return value;
16
+ }
17
+ /**
18
+ * Genuine-client beta registry as of 2.1.280, upstream factory chain at byte
19
+ * offset 6277485 and ordered array `oy` immediately after it.
20
+ *
21
+ * KEY ORDER IS LOAD-BEARING, and for 2.1.280 it is load-bearing in a way it was
22
+ * not before: upstream's array is NOT append-only. `thinking_resumption` is
23
+ * inserted at position 17, and `per_turn_timing`, `mid_conv_tool_change` and
24
+ * `inline_tools` are inserted at 29-31, ahead of four entries that already
25
+ * existed. A diff that assumes new identifiers only ever land at the end will
26
+ * mis-align fifteen entries: 2.1.233 positions 17-27 shift by one and 28-31
27
+ * shift by four. See
28
+ * `docs/protocol/versions/claude-code-2.1.280-analysis.md` section 4.2.
29
+ *
30
+ * The upstream array carries 42 slots with two explicit `null`s (indices 34 and
31
+ * 37, `kAt` at byte 6279405 and `hZt` at byte 6279537) which `.filter(e => e
32
+ * !== null)` removes, leaving the forty entries below. Both slots are null IN
33
+ * THIS BUILD, which is all the bytes establish: upstream treats registry
34
+ * members as nullable per build -- `Dg` carries `...BR ? [BR] : []` and `hRr`
35
+ * guards on `kAt === null` -- so a compile-time feature gate fits the evidence
36
+ * as well as a removal does, and this file claims neither. `kAt` still has two
37
+ * consumers at byte 14167580: `hRr`, short-circuited by that null check, and
38
+ * `yRr`, which reads `kAt.name` with no null guard and so is either unreachable
39
+ * or a throw path. Neither says WHICH beta the slot held; see the note above
40
+ * `AUTO_MODE_CLASSIFIER`. Neither null slot is transcribed here; a null is not
41
+ * an entry.
42
+ *
43
+ * Two further registry members are deliberately absent:
44
+ * `mid_conv_cache_promotion_latch` and `mid_conv_cache_promotion_ok_latch`
45
+ * (`x-cc-internal-mid-conv-cache-promotion` and its `-ok` sibling). Upstream
46
+ * declares them through the same factory but excludes them from the ordered
47
+ * array, and their "header" values are internal `x-cc-*` names, not beta
48
+ * identifiers. Transcribing them would corrupt the registry.
49
+ *
50
+ * Every one of the nine entries new since 2.1.233 was confirmed against its own
51
+ * `N(alias, header)` declaration in the carved dump rather than against the
52
+ * analysis document alone, so no new header rests on a single reading:
53
+ * `rrt` 6278299, `w$` 6278910, `j_` 6278959, `W_` 6279023, and `qk`, `Aoe`,
54
+ * `cD`, `V1`, `lD` in the window at 6279405.
55
+ *
56
+ * `oauth_auth` is the one entry whose header is NOT a string literal upstream:
57
+ * the declaration reads `swe=N("oauth_auth",Ru)`. `Ru` is an imported binding,
58
+ * re-exported as `OAUTH_BETA_HEADER` at byte 25341943, and the only beta-shaped
59
+ * `oauth-*` literal in the bundle is `"oauth-2025-04-20"` at byte 4418398.
60
+ * Resolved by that binding, not by name similarity.
61
+ */
62
+ export const BETA_REGISTRY_2_1_280 = deepFreeze({
63
+ CLAUDE_CODE: { featureKey: "claude_code", header: "claude-code-20250219" },
64
+ OAUTH_AUTH: { featureKey: "oauth_auth", header: "oauth-2025-04-20" },
65
+ INTERLEAVED_THINKING: {
66
+ featureKey: "interleaved_thinking",
67
+ header: "interleaved-thinking-2025-05-14",
68
+ },
69
+ LONG_CONTEXT: { featureKey: "long_context", header: "context-1m-2025-08-07" },
70
+ CONTEXT_MANAGEMENT: {
71
+ featureKey: "context_management",
72
+ header: "context-management-2025-06-27",
73
+ },
74
+ STRUCTURED_OUTPUTS: {
75
+ featureKey: "structured_outputs",
76
+ header: "structured-outputs-2025-12-15",
77
+ },
78
+ WEB_SEARCH: { featureKey: "web_search", header: "web-search-2025-03-05" },
79
+ ADVANCED_TOOL_USE: {
80
+ featureKey: "tool_search",
81
+ header: "advanced-tool-use-2025-11-20",
82
+ },
83
+ TOOL_SEARCH: {
84
+ featureKey: "tool_search",
85
+ header: "tool-search-tool-2025-10-19",
86
+ },
87
+ EFFORT: { featureKey: "effort", header: "effort-2025-11-24" },
88
+ TASK_BUDGETS: {
89
+ featureKey: "task_budgets",
90
+ header: "task-budgets-2026-03-13",
91
+ },
92
+ PROMPT_CACHING_SCOPE: {
93
+ featureKey: "prompt_caching_scope",
94
+ header: "prompt-caching-scope-2026-01-05",
95
+ },
96
+ PROMPT_CACHING_EVICT: {
97
+ featureKey: "prompt_caching_evict",
98
+ header: "prompt-caching-evict-2026-05-12",
99
+ },
100
+ EXTENDED_CACHE_TTL: {
101
+ featureKey: "extended_cache_ttl",
102
+ header: "extended-cache-ttl-2025-04-11",
103
+ },
104
+ SPEED: { featureKey: "speed", header: "fast-mode-2026-02-01" },
105
+ REDACT_THINKING: {
106
+ featureKey: "redact_thinking",
107
+ header: "redact-thinking-2026-02-12",
108
+ },
109
+ // New at 2.1.280, and inserted HERE rather than appended. Every entry below
110
+ // this point sat one slot lower in 2.1.233.
111
+ THINKING_RESUMPTION: {
112
+ featureKey: "thinking_resumption",
113
+ header: "thinking-resumption-2026-07-17",
114
+ },
115
+ THINKING_TOKEN_COUNT: {
116
+ featureKey: "thinking_token_count",
117
+ header: "thinking-token-count-2026-05-13",
118
+ },
119
+ AFK_MODE: { featureKey: "afk_mode", header: "afk-mode-2026-01-31" },
120
+ ADVISOR_TOOL: {
121
+ featureKey: "advisor_tool",
122
+ header: "advisor-tool-2026-03-01",
123
+ },
124
+ CACHE_DIAGNOSIS: {
125
+ featureKey: "cache_diagnosis",
126
+ header: "cache-diagnosis-2026-04-07",
127
+ },
128
+ CONTEXT_HINT: {
129
+ featureKey: "context_hint",
130
+ header: "context-hint-2026-04-09",
131
+ },
132
+ MCP_SERVERS: { featureKey: "mcp_servers", header: "mcp-servers-2025-12-04" },
133
+ FILES_API: { featureKey: "files_api", header: "files-api-2025-04-14" },
134
+ ENVIRONMENTS: {
135
+ featureKey: "environments",
136
+ header: "environments-2025-11-01",
137
+ },
138
+ CCR_BYOC: { featureKey: "ccr_byoc", header: "ccr-byoc-2025-07-29" },
139
+ MID_CONVERSATION_SYSTEM: {
140
+ featureKey: "mid_conversation_system",
141
+ header: "mid-conversation-system-2026-04-07",
142
+ },
143
+ PER_MESSAGE_EFFORT: {
144
+ featureKey: "per_message_effort",
145
+ header: "per-turn-control-2026-07-01",
146
+ },
147
+ // New at 2.1.280. Also inserted rather than appended: the four entries below
148
+ // `INLINE_TOOLS` all predate this release.
149
+ PER_TURN_TIMING: {
150
+ featureKey: "per_turn_timing",
151
+ header: "timing-2026-09-09",
152
+ },
153
+ MID_CONV_TOOL_CHANGE: {
154
+ featureKey: "mid_conv_tool_change",
155
+ header: "mid-conversation-tool-changes-2026-07-01",
156
+ },
157
+ INLINE_TOOLS: {
158
+ featureKey: "inline_tools",
159
+ header: "inline-tools-2026-09-15",
160
+ },
161
+ SERVER_SIDE_FALLBACK: {
162
+ featureKey: "server_side_fallback",
163
+ header: "server-side-fallback-2026-06-01",
164
+ },
165
+ SERVER_SIDE_FALLBACK_CATEGORY: {
166
+ featureKey: "server_side_fallback_category",
167
+ header: "server-side-fallback-2026-07-01",
168
+ },
169
+ FALLBACK_CREDIT: {
170
+ featureKey: "fallback_credit",
171
+ header: "fallback-credit-2026-06-01",
172
+ },
173
+ /*
174
+ * NARRATION_SUMMARIES IS DELIBERATELY ABSENT, exactly as in the 2.1.233
175
+ * registry, and re-adding it would reintroduce a header the genuine client no
176
+ * longer sends. Do not "fix" it.
177
+ *
178
+ * This position -- between `FALLBACK_CREDIT` and `AUTO_MODE_CLASSIFIER` -- is
179
+ * where the 2.1.233 registry records the removal, and it is also where array
180
+ * index 34 (`kAt`, null) falls. That correspondence is suggestive and NOT
181
+ * EVIDENCED: the `summarize-connector-text-2026-03-13` header string appears
182
+ * nowhere in the 2.1.280 bundle, so nothing ties it to `kAt` rather than to
183
+ * `hZt`, and `kAt`'s surviving consumer at byte 14167580 reports rejections
184
+ * under an "Auto mode classifier" label, which points the other way. The
185
+ * analysis document asserts only that two slots are null and this file
186
+ * asserts no more. See section 4.2 of
187
+ * `docs/protocol/versions/claude-code-2.1.280-analysis.md`.
188
+ */
189
+ AUTO_MODE_CLASSIFIER: {
190
+ featureKey: "auto_mode_classifier",
191
+ header: "auto-mode-classifier-2026-07-16",
192
+ },
193
+ // New at 2.1.280.
194
+ DANGEROUS_TOOL_USE: {
195
+ featureKey: "dangerous_tool_use",
196
+ header: "dangerous-tool-use-2026-09-03",
197
+ },
198
+ /*
199
+ * The SECOND null slot (`hZt`, upstream index 37) belongs here. As with the
200
+ * first, what it once held -- if anything -- is unknown: no header string in
201
+ * any analysed release is tied to it by evidence. It is recorded rather than
202
+ * silently closed up, because a future build may reuse the slot.
203
+ */
204
+ // New at 2.1.280.
205
+ THINKING_DISPLAY_UPDATES: {
206
+ featureKey: "thinking_display_updates",
207
+ header: "thinking-display-updates-2026-08-18",
208
+ },
209
+ MESSAGE_THREADS: {
210
+ featureKey: "message_threads",
211
+ header: "message-threads-2026-08-12",
212
+ },
213
+ MID_CONVERSATION_SYSTEM_CLEAR_AT: {
214
+ featureKey: "mid_conversation_system_clear_at",
215
+ header: "mid-conversation-system-clear-at-2026-08-21",
216
+ },
217
+ /*
218
+ * LAST in the array, though upstream DECLARES it alongside
219
+ * `thinking_display_updates` and `message_threads`. Declaration order and
220
+ * array order differ here and the array is what this transcription follows.
221
+ */
222
+ THINKING_BINDING_CONTROLS: {
223
+ featureKey: "thinking_binding_controls",
224
+ header: "thinking-binding-controls-2026-08-01",
225
+ },
226
+ });
227
+ /*
228
+ * Third-party filtering as of 2.1.280, upstream `Dg` at byte 7029997, consumed
229
+ * by `DDn(e) { if (iwe()) return e; return e.filter(n => Dg.has(n)) }` in the
230
+ * same run -- that is, the set is applied only when the request is NOT
231
+ * first-party, which is how it was identified: by call site, not by resemblance
232
+ * to the 2.1.233 set.
233
+ *
234
+ * Upstream writes one member as a conditional spread, `...BR ? [BR] : []`. That
235
+ * is why the extractor reported this set `unresolved` ("a member is neither a
236
+ * string literal nor a single property read"). `BR` is unconditionally defined
237
+ * at byte 6278332 in this build, so the spread always contributes and the set
238
+ * has fourteen members.
239
+ *
240
+ * Delta against the 2.1.233 set: `dangerous_tool_use`, `thinking_token_count`
241
+ * and `thinking_binding_controls` were ADDED; nothing was removed. Order below
242
+ * follows upstream's literal.
243
+ */
244
+ export const THIRD_PARTY_ALLOWED_BETAS_2_1_280 = Object.freeze(new Set([
245
+ BETA_REGISTRY_2_1_280.CLAUDE_CODE.header,
246
+ BETA_REGISTRY_2_1_280.INTERLEAVED_THINKING.header,
247
+ BETA_REGISTRY_2_1_280.LONG_CONTEXT.header,
248
+ BETA_REGISTRY_2_1_280.CONTEXT_MANAGEMENT.header,
249
+ BETA_REGISTRY_2_1_280.STRUCTURED_OUTPUTS.header,
250
+ BETA_REGISTRY_2_1_280.WEB_SEARCH.header,
251
+ BETA_REGISTRY_2_1_280.EFFORT.header,
252
+ BETA_REGISTRY_2_1_280.TOOL_SEARCH.header,
253
+ BETA_REGISTRY_2_1_280.AFK_MODE.header,
254
+ BETA_REGISTRY_2_1_280.DANGEROUS_TOOL_USE.header,
255
+ BETA_REGISTRY_2_1_280.FALLBACK_CREDIT.header,
256
+ BETA_REGISTRY_2_1_280.MID_CONVERSATION_SYSTEM.header,
257
+ BETA_REGISTRY_2_1_280.THINKING_TOKEN_COUNT.header,
258
+ BETA_REGISTRY_2_1_280.THINKING_BINDING_CONTROLS.header,
259
+ ]));
260
+ /*
261
+ * Provider filtering as of 2.1.280, upstream `qbr` at byte 6280270.
262
+ *
263
+ * Identified by behaviour rather than by shape: `Y5` at byte 7029210 reads
264
+ * `if (sc(e) === "bedrock") return n.filter(r => !qbr.has(r))`, and the
265
+ * complementary `lco` at the same site keeps exactly this set as bedrock
266
+ * extra-body parameters. Byte-identical to the 2.1.233 set.
267
+ *
268
+ * A DIFFERENT `qbr` exists at byte 13922760 in another module -- a set of grep
269
+ * flags. Minified names are module-scoped; this entry is the one the beta
270
+ * pipeline consumes.
271
+ *
272
+ * Static reference data with no call site in `src/`, exactly like its 2.1.233
273
+ * counterpart. See `test/governance/provider-scope.test.ts`.
274
+ */
275
+ export const BEDROCK_UNSUPPORTED_BETAS_2_1_280 = Object.freeze(new Set([
276
+ BETA_REGISTRY_2_1_280.INTERLEAVED_THINKING.header,
277
+ BETA_REGISTRY_2_1_280.LONG_CONTEXT.header,
278
+ BETA_REGISTRY_2_1_280.TOOL_SEARCH.header,
279
+ ]));
280
+ /*
281
+ * Count-tokens selection as of 2.1.280, upstream `iNn` at byte 6280282,
282
+ * consumed as `betas: y.filter(he => iNn.has(he))` inside
283
+ * `beta.messages.countTokens` at bytes 12304007, 12304164 and 12305087.
284
+ * Byte-identical to the 2.1.233 set.
285
+ */
286
+ export const COUNT_TOKENS_BETAS_2_1_280 = Object.freeze(new Set([
287
+ BETA_REGISTRY_2_1_280.CLAUDE_CODE.header,
288
+ BETA_REGISTRY_2_1_280.INTERLEAVED_THINKING.header,
289
+ BETA_REGISTRY_2_1_280.CONTEXT_MANAGEMENT.header,
290
+ BETA_REGISTRY_2_1_280.OAUTH_AUTH.header,
291
+ ]));
292
+ //# sourceMappingURL=beta-registry-2.1.280.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beta-registry-2.1.280.js","sourceRoot":"","sources":["../../src/profiles/beta-registry-2.1.280.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAO5C;;;;;GAKG;AACH,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;IAC9C,WAAW,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,sBAAsB,EAAE;IAC1E,UAAU,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE;IACpE,oBAAoB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,oBAAoB,CAAC,MAAM;IACjD,qBAAqB,CAAC,yBAAyB,CAAC,MAAM;CACvD,CAAC,CACH,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAC5C,MAAM,CAAC,MAAM,CACX,IAAI,GAAG,CAAC;IACN,qBAAqB,CAAC,oBAAoB,CAAC,MAAM;IACjD,qBAAqB,CAAC,YAAY,CAAC,MAAM;IACzC,qBAAqB,CAAC,WAAW,CAAC,MAAM;CACzC,CAAC,CACH,CAAC;AAEJ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAwB,MAAM,CAAC,MAAM,CAC1E,IAAI,GAAG,CAAC;IACN,qBAAqB,CAAC,WAAW,CAAC,MAAM;IACxC,qBAAqB,CAAC,oBAAoB,CAAC,MAAM;IACjD,qBAAqB,CAAC,kBAAkB,CAAC,MAAM;IAC/C,qBAAqB,CAAC,UAAU,CAAC,MAAM;CACxC,CAAC,CACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ClaudeCodeProtocolProfile } from "../contracts.js";
2
+ export declare const CLAUDE_CODE_2_1_280_PROFILE: ClaudeCodeProtocolProfile;
3
+ //# sourceMappingURL=claude-code-2.1.280.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-code-2.1.280.d.ts","sourceRoot":"","sources":["../../src/profiles/claude-code-2.1.280.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAqCjE,eAAO,MAAM,2BAA2B,EAAE,yBAoUtC,CAAC"}
@@ -0,0 +1,359 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ import { COUNT_TOKENS_ENDPOINT } from "../count-tokens.js";
3
+ /*
4
+ * Protocol profile for genuine client 2.1.280.
5
+ *
6
+ * Provenance: extracted from the official 2.1.280 win32-x64 binary. The
7
+ * catalogue and every scalar below are transcribed from
8
+ * `docs/protocol/versions/claude-code-2.1.280-analysis.md`, which records the
9
+ * byte offsets they came from. The catalogue was additionally re-extracted
10
+ * from the carved bundle independently of that document (cluster bytes
11
+ * 5941320-5955961) and agreed on every field of all twenty entries; that
12
+ * re-extraction is not a claim you have to take on trust, because the method
13
+ * it used is written down in section 5.2.1 of the analysis document and can be
14
+ * re-run against the same dump.
15
+ *
16
+ * `effort_cost_index` is deliberately omitted, as in the 2.1.233 profile, and
17
+ * so are the other nine static-catalogue fields the package does not model
18
+ * (analysis document section 5.1).
19
+ *
20
+ * Context modelling follows 2.1.233 exactly. `supports_1m_suffix` is not
21
+ * modelled, so an entry declaring a 200000 window with nothing but that flag
22
+ * carries no `context` object here. `native_1m_3p` on `claude-sonnet-5` names
23
+ * bedrock, vertex and foundry; this package is anthropic-only, so that flag is
24
+ * not modelled either.
25
+ */
26
+ function deepFreeze(value) {
27
+ if (value !== null && typeof value === "object") {
28
+ for (const key of Reflect.ownKeys(value)) {
29
+ deepFreeze(Reflect.get(value, key));
30
+ }
31
+ Object.freeze(value);
32
+ }
33
+ return value;
34
+ }
35
+ export const CLAUDE_CODE_2_1_280_PROFILE = deepFreeze({
36
+ id: "claude-code-2.1.280-sdk-0.112.1",
37
+ cliVersion: "2.1.280",
38
+ sdkVersion: "0.112.1",
39
+ endpoint: "https://api.anthropic.com/v1/messages?beta=true",
40
+ countTokensEndpoint: COUNT_TOKENS_ENDPOINT,
41
+ entrypoint: "cli",
42
+ userAgent: "claude-cli/2.1.280 (external, cli)",
43
+ buildTime: "2026-09-21T20:40:17Z",
44
+ gitSha: "80abbfe7d7232280011ff01a21ae3338f4c6e372",
45
+ // RETAINED from 2.1.233, not asserted. The 2.1.280 analysis document does
46
+ // not examine the billing block at all -- it contains no occurrence of
47
+ // "attribution" -- so this is silence, which is not the same as evidence of
48
+ // no change. The only indirect support is that the salt behind the
49
+ // fingerprint is unchanged (section 13); the fingerprint it produces, not
50
+ // the salt, is what appears on the billing line. Section 13.2 draws this
51
+ // exact distinction for the beta policy and it applies here too: where the
52
+ // evidence is absent the previous release's value is retained rather than
53
+ // re-derived, and a later release that captures live traffic should settle
54
+ // it.
55
+ attributionHeaderEnabled: true,
56
+ provider: "anthropic",
57
+ anthropicVersion: "2023-06-01",
58
+ // Section 9.2: `context_hint` remains off for 2.1.280. Section 7.6 agrees
59
+ // -- its fourteen-identifier default-path `anthropic-beta` literal contains
60
+ // no `context-hint` identifier -- but that is the same gate restated, not a
61
+ // second line of evidence, because the 7.6 row cites the gate 9.2 resolves.
62
+ // Only two things put that identifier into an emitted list: this flag,
63
+ // which also emits a `context_hint` body field, and a caller passing the
64
+ // identifier explicitly through the `additionalBetas` request seam.
65
+ contextHintEnabled: false,
66
+ /*
67
+ * The eleven flags of analysis document section 13.2, which grades each
68
+ * one. That grading is carried here per flag, because two of the eleven are
69
+ * *retained* from 2.1.233 rather than resolved from this build -- their
70
+ * upstream gates gave no answer -- and nothing in the value itself
71
+ * distinguishes a retained flag from a derived one. A later release that
72
+ * resolves a retained gate changes that flag on evidence; a later release
73
+ * that merely repeats it has learned nothing.
74
+ */
75
+ betaPolicy: {
76
+ // RETAINED. The gate reduces to a predicate whose own gate is
77
+ // unresolved. What it decides is position rather than presence: the SDK
78
+ // appends the OAuth beta unconditionally on a token-cache session
79
+ // (section 8.3), so the choice is slot 2 versus appended last, and this
80
+ // profile pins slot 2 as 2.1.195 and 2.1.233 do.
81
+ oauthAuthenticated: true,
82
+ // Derived.
83
+ experimentalBetasEnabled: true,
84
+ // From the bundle: the gate reads an opt-out environment variable that is
85
+ // unset by default.
86
+ oneMillionContextEnabled: true,
87
+ // Derived.
88
+ interleavedThinkingEnabled: true,
89
+ // Derived.
90
+ interactive: true,
91
+ // Derived.
92
+ thinkingSummariesShown: false,
93
+ // Derived.
94
+ thinkingTokenCountEnabled: true,
95
+ // From the bundle, and inert for this profile either way: the 2.1.280
96
+ // registry slot that would carry `narration_summaries` is null in this
97
+ // build, so there is no entry for this flag to gate.
98
+ narrationSummariesEnabled: false,
99
+ // Derived.
100
+ structuredOutputsEnabled: false,
101
+ // RETAINED. Its gates are unresolved in this build.
102
+ afkModeEnabled: false,
103
+ // Changed from 2.1.233, where the 2.1.233 profile pins `false`. Section
104
+ // 7.6.2 resolves all three legs of the 2.1.280 gate to true. Whether the
105
+ // 2.1.233 value was always wrong cannot be settled without the 2.1.233
106
+ // binary, and inferring one release's value from another's is exactly
107
+ // what the tracking runbook forbids, so that profile is deliberately left
108
+ // alone.
109
+ cacheDiagnosisEnabled: true,
110
+ },
111
+ /**
112
+ * Verbatim genuine-client catalogue, 20 entries in the catalogue's own
113
+ * order. `defaultEffort` is policy exposed as catalogue data; this package
114
+ * must never apply it to a request.
115
+ */
116
+ supportedModels: {
117
+ "claude-3-5-haiku": {
118
+ family: "haiku",
119
+ capabilities: [],
120
+ maxOutputTokens: { default: 8192, upper: 8192 },
121
+ },
122
+ "claude-haiku-4-5": {
123
+ family: "haiku",
124
+ capabilities: ["context_management"],
125
+ maxOutputTokens: { default: 32000, upper: 64000 },
126
+ },
127
+ "claude-3-5-sonnet": {
128
+ family: "sonnet",
129
+ capabilities: [],
130
+ maxOutputTokens: { default: 8192, upper: 8192 },
131
+ },
132
+ "claude-3-7-sonnet": {
133
+ family: "sonnet",
134
+ capabilities: [],
135
+ maxOutputTokens: { default: 32000, upper: 64000 },
136
+ },
137
+ "claude-sonnet-4-0": {
138
+ family: "sonnet",
139
+ context: { window: 200000, supports1mBeta: true },
140
+ capabilities: ["context_management"],
141
+ maxOutputTokens: { default: 32000, upper: 64000 },
142
+ },
143
+ "claude-sonnet-4-5": {
144
+ family: "sonnet",
145
+ context: { window: 200000, supports1mBeta: true },
146
+ capabilities: ["context_management"],
147
+ maxOutputTokens: { default: 32000, upper: 64000 },
148
+ },
149
+ "claude-sonnet-4-6": {
150
+ family: "sonnet",
151
+ context: { window: 200000, supports1mBeta: true },
152
+ maxOutputTokens: { default: 32000, upper: 128000 },
153
+ capabilities: [
154
+ "effort",
155
+ "max_effort",
156
+ "adaptive_thinking",
157
+ "context_management",
158
+ ],
159
+ },
160
+ // The entry also declares `native_1m_3p` for bedrock/vertex/foundry;
161
+ // this package is anthropic-only, so that flag is not modelled.
162
+ "claude-sonnet-5": {
163
+ family: "sonnet",
164
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
165
+ maxOutputTokens: { default: 64000, upper: 128000 },
166
+ capabilities: [
167
+ "effort",
168
+ "max_effort",
169
+ "xhigh_effort",
170
+ "adaptive_thinking",
171
+ "mid_conv_system",
172
+ "context_management",
173
+ ],
174
+ defaultEffort: "high",
175
+ },
176
+ "claude-opus-4-0": {
177
+ family: "opus",
178
+ capabilities: ["context_management"],
179
+ maxOutputTokens: { default: 32000, upper: 32000 },
180
+ },
181
+ "claude-opus-4-1": {
182
+ family: "opus",
183
+ capabilities: ["context_management"],
184
+ maxOutputTokens: { default: 32000, upper: 32000 },
185
+ },
186
+ "claude-opus-4-5": {
187
+ family: "opus",
188
+ capabilities: ["context_management"],
189
+ maxOutputTokens: { default: 32000, upper: 64000 },
190
+ },
191
+ "claude-opus-4-6": {
192
+ family: "opus",
193
+ context: { window: 200000, supports1mBeta: true },
194
+ maxOutputTokens: { default: 64000, upper: 128000 },
195
+ capabilities: [
196
+ "effort",
197
+ "max_effort",
198
+ "adaptive_thinking",
199
+ "context_management",
200
+ ],
201
+ },
202
+ "claude-opus-4-7": {
203
+ family: "opus",
204
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
205
+ maxOutputTokens: { default: 64000, upper: 128000 },
206
+ capabilities: [
207
+ "effort",
208
+ "max_effort",
209
+ "xhigh_effort",
210
+ "adaptive_thinking",
211
+ "context_management",
212
+ ],
213
+ defaultEffort: "xhigh",
214
+ },
215
+ // Gains `mid_conv_tool_change` since 2.1.233. That key is mapped by
216
+ // `deriveCapabilitiesFromCatalogue` to `midConvToolChange`, and it
217
+ // drives the `mid-conversation-tool-changes-2026-07-01` beta header
218
+ // (section 7.6) through the guard transcribed in section 13.3.
219
+ "claude-opus-4-8": {
220
+ family: "opus",
221
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
222
+ maxOutputTokens: { default: 64000, upper: 128000 },
223
+ capabilities: [
224
+ "effort",
225
+ "max_effort",
226
+ "xhigh_effort",
227
+ "adaptive_thinking",
228
+ "mid_conv_system",
229
+ "mid_conv_tool_change",
230
+ "context_management",
231
+ "fast_mode",
232
+ "lean_prompt",
233
+ ],
234
+ defaultEffort: "high",
235
+ },
236
+ // Gains `mid_conv_tool_change` and `thinking_disabled_effort_cap` since
237
+ // 2.1.233.
238
+ "claude-opus-5": {
239
+ family: "opus",
240
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
241
+ maxOutputTokens: { default: 64000, upper: 128000 },
242
+ capabilities: [
243
+ "effort",
244
+ "max_effort",
245
+ "xhigh_effort",
246
+ "adaptive_thinking",
247
+ "mid_conv_system",
248
+ "mid_conv_tool_change",
249
+ "context_management",
250
+ "thinking_disabled_effort_cap",
251
+ "fast_mode",
252
+ "lean_prompt",
253
+ "refusal_fallback",
254
+ "opus_5_prompt_bundle",
255
+ ],
256
+ defaultEffort: "high",
257
+ },
258
+ // New at 2.1.280, and the only catalogue entry in any ported profile
259
+ // whose `default_effort` is `medium`. It is also the only entry whose
260
+ // default and upper output-token limits are both 128000.
261
+ "claude-opus-5-5": {
262
+ family: "opus",
263
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
264
+ maxOutputTokens: { default: 128000, upper: 128000 },
265
+ capabilities: [
266
+ "effort",
267
+ "max_effort",
268
+ "xhigh_effort",
269
+ "adaptive_thinking",
270
+ "rejects_disabled_thinking",
271
+ "mid_conv_system",
272
+ "mid_conv_tool_change",
273
+ "per_turn_effort",
274
+ "per_turn_timing",
275
+ "context_management",
276
+ "fast_mode",
277
+ "lean_prompt",
278
+ "refusal_fallback",
279
+ "opus_5_5_prompt_bundle",
280
+ ],
281
+ defaultEffort: "medium",
282
+ },
283
+ // Gains `mid_conv_tool_change` since 2.1.233. Carries no `fast_mode`,
284
+ // as in 2.1.233.
285
+ "claude-fable-5": {
286
+ family: "fable",
287
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
288
+ maxOutputTokens: { default: 64000, upper: 128000 },
289
+ capabilities: [
290
+ "effort",
291
+ "max_effort",
292
+ "xhigh_effort",
293
+ "adaptive_thinking",
294
+ "rejects_disabled_thinking",
295
+ "mid_conv_system",
296
+ "mid_conv_tool_change",
297
+ "context_management",
298
+ "lean_prompt",
299
+ "fable_5_mitigations",
300
+ "refusal_fallback",
301
+ ],
302
+ defaultEffort: "high",
303
+ },
304
+ // New at 2.1.280.
305
+ "claude-fable-5-1": {
306
+ family: "fable",
307
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
308
+ maxOutputTokens: { default: 64000, upper: 128000 },
309
+ capabilities: [
310
+ "effort",
311
+ "max_effort",
312
+ "xhigh_effort",
313
+ "adaptive_thinking",
314
+ "rejects_disabled_thinking",
315
+ "mid_conv_system",
316
+ "mid_conv_tool_change",
317
+ "per_turn_effort",
318
+ "per_turn_timing",
319
+ "context_management",
320
+ "lean_prompt",
321
+ "fable_5_mitigations",
322
+ "refusal_fallback",
323
+ "fable_5_1_prompt_bundle",
324
+ ],
325
+ defaultEffort: "high",
326
+ },
327
+ // Keeps the empty capability array it was catalogued with at 2.1.233.
328
+ // That is a denial, not a gap.
329
+ "claude-mythos-5": {
330
+ family: "mythos",
331
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
332
+ capabilities: [],
333
+ maxOutputTokens: { default: 64000, upper: 128000 },
334
+ },
335
+ // New at 2.1.280. Unlike `claude-fable-5-1` it carries no
336
+ // `per_turn_effort` and no `refusal_fallback`.
337
+ "claude-mythos-5-1": {
338
+ family: "mythos",
339
+ context: { window: 1e6, native1m: true, supports1mBeta: true },
340
+ maxOutputTokens: { default: 64000, upper: 128000 },
341
+ capabilities: [
342
+ "effort",
343
+ "max_effort",
344
+ "xhigh_effort",
345
+ "adaptive_thinking",
346
+ "rejects_disabled_thinking",
347
+ "mid_conv_system",
348
+ "mid_conv_tool_change",
349
+ "per_turn_timing",
350
+ "context_management",
351
+ "lean_prompt",
352
+ "fable_5_mitigations",
353
+ "fable_5_1_prompt_bundle",
354
+ ],
355
+ defaultEffort: "high",
356
+ },
357
+ },
358
+ });
359
+ //# sourceMappingURL=claude-code-2.1.280.js.map