@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.
- package/CHANGELOG.md +217 -0
- package/README.md +51 -7
- package/dist/betas.d.ts +65 -7
- package/dist/betas.d.ts.map +1 -1
- package/dist/betas.js +143 -2
- package/dist/betas.js.map +1 -1
- package/dist/build-request.d.ts +12 -6
- package/dist/build-request.d.ts.map +1 -1
- package/dist/build-request.js +44 -15
- package/dist/build-request.js.map +1 -1
- package/dist/contracts.d.ts +7 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +5 -0
- package/dist/fingerprint.js.map +1 -1
- package/dist/headers.d.ts.map +1 -1
- package/dist/headers.js +5 -2
- package/dist/headers.js.map +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/model-capabilities.d.ts +3 -3
- package/dist/model-capabilities.d.ts.map +1 -1
- package/dist/model-capabilities.js +55 -19
- package/dist/model-capabilities.js.map +1 -1
- package/dist/model-identity.d.ts +9 -1
- package/dist/model-identity.d.ts.map +1 -1
- package/dist/model-identity.js +33 -2
- package/dist/model-identity.js.map +1 -1
- package/dist/model-queries.d.ts +89 -0
- package/dist/model-queries.d.ts.map +1 -0
- package/dist/model-queries.js +232 -0
- package/dist/model-queries.js.map +1 -0
- package/dist/models.js +1 -1
- package/dist/models.js.map +1 -1
- package/dist/profiles/beta-registry-2.1.280.d.ts +211 -0
- package/dist/profiles/beta-registry-2.1.280.d.ts.map +1 -0
- package/dist/profiles/beta-registry-2.1.280.js +292 -0
- package/dist/profiles/beta-registry-2.1.280.js.map +1 -0
- package/dist/profiles/claude-code-2.1.280.d.ts +3 -0
- package/dist/profiles/claude-code-2.1.280.d.ts.map +1 -0
- package/dist/profiles/claude-code-2.1.280.js +359 -0
- package/dist/profiles/claude-code-2.1.280.js.map +1 -0
- package/dist/redaction.d.ts.map +1 -1
- package/dist/redaction.js +3 -0
- package/dist/redaction.js.map +1 -1
- package/dist/request-body.d.ts +1 -1
- package/dist/request-body.d.ts.map +1 -1
- package/dist/request-body.js +16 -5
- package/dist/request-body.js.map +1 -1
- package/dist/thinking.d.ts +53 -2
- package/dist/thinking.d.ts.map +1 -1
- package/dist/thinking.js +124 -26
- package/dist/thinking.js.map +1 -1
- package/package.json +6 -3
- package/src/betas.ts +208 -9
- package/src/build-request.ts +54 -21
- package/src/contracts.ts +7 -2
- package/src/fingerprint.ts +5 -0
- package/src/headers.ts +4 -2
- package/src/index.ts +28 -3
- package/src/model-capabilities.ts +55 -19
- package/src/model-identity.ts +29 -2
- package/src/model-queries.ts +273 -0
- package/src/models.ts +1 -1
- package/src/profiles/beta-registry-2.1.280.ts +309 -0
- package/src/profiles/claude-code-2.1.280.ts +364 -0
- package/src/redaction.ts +3 -0
- package/src/request-body.ts +25 -3
- package/src/thinking.ts +148 -26
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
import type { ClaudeCodeProtocolProfile } from "./contracts.js";
|
|
4
|
+
import { supportsStructuredOutputs as portedStructuredOutputs } from "./model-capabilities.js";
|
|
5
|
+
import { modelFamilyOf, normalizeModelId } from "./model-identity.js";
|
|
6
|
+
import { CLAUDE_CODE_2_1_195_PROFILE } from "./profiles/claude-code-2.1.195.js";
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Read-only model queries.
|
|
10
|
+
*
|
|
11
|
+
* DESIGN DECISION (Phase 1.1). Two surfaces, deliberately separate:
|
|
12
|
+
*
|
|
13
|
+
* 1. `modelCapability(model, capability, profile)` -- the GENERIC query. The
|
|
14
|
+
* catalogue is the source of truth: it normalizes the id, looks the entry
|
|
15
|
+
* up in `profile.supportedModels` and asks whether the verbatim upstream
|
|
16
|
+
* capability string is present. It invents nothing, maps nothing, and
|
|
17
|
+
* therefore answers for capability strings this package does not model as
|
|
18
|
+
* a `ClaudeCodeCapabilities` field (`fast_mode`, `lean_prompt`,
|
|
19
|
+
* `fable_5_mitigations`, `mid_conv_system`, ...) as readily as for the
|
|
20
|
+
* six that it does.
|
|
21
|
+
*
|
|
22
|
+
* 2. The NAMED family/version predicates below -- `isOpus47Model` and
|
|
23
|
+
* friends. A family is not a catalogue capability; it is an identity
|
|
24
|
+
* question. They are therefore written over `normalizeModelId` and
|
|
25
|
+
* `modelFamilyOf`, NOT over a new family regex and NOT over the
|
|
26
|
+
* catalogue. Consequence, and it is intended: an id normalizing to
|
|
27
|
+
* `claude-opus-4-7` answers `isOpus47Model` true whether or not the
|
|
28
|
+
* active profile catalogues it.
|
|
29
|
+
*
|
|
30
|
+
* Do not fold (2) into (1). Asking `modelCapability(model, "adaptive_thinking")`
|
|
31
|
+
* and asking `isAdaptiveThinkingModel(model)` are different questions with
|
|
32
|
+
* different answers for ids the active profile does not catalogue, and both
|
|
33
|
+
* questions have callers.
|
|
34
|
+
*
|
|
35
|
+
* INVALID INPUT. Every predicate here returns `false` for a non-string or an
|
|
36
|
+
* empty id rather than throwing. This departs from `resolveModel`
|
|
37
|
+
* (`ClaudeCodeWireError("INVALID_INPUT")`) on purpose: these are predicates,
|
|
38
|
+
* their upstream counterparts are total functions returning `false` on a
|
|
39
|
+
* falsy model, and a predicate that throws cannot be used in the boolean
|
|
40
|
+
* position its callers put it in.
|
|
41
|
+
*
|
|
42
|
+
* RUNTIME NEUTRALITY. No builtins, no clock, no randomness, no I/O.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/** Lowercased + dotted-to-dashed id, or `null` for input no predicate can answer for. */
|
|
46
|
+
function normalizedOrNull(model: string): string | null {
|
|
47
|
+
if (typeof model !== "string" || model.length === 0) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return normalizeModelId(model);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Explicit 1M markers a caller can spell into the model id.
|
|
55
|
+
*
|
|
56
|
+
* `\[1m\]` is deliberately absent: it marks a request-time context selection,
|
|
57
|
+
* not an always-1M id, and the upstream marker check does not accept it.
|
|
58
|
+
*/
|
|
59
|
+
const ONE_MILLION_MARKER_RE = /(^|[-_ ])1m($|[-_ ])|context[-_]?1m/iu;
|
|
60
|
+
|
|
61
|
+
/** As `ONE_MILLION_MARKER_RE`, plus the bracketed request-time marker. */
|
|
62
|
+
const ONE_MILLION_ELIGIBLE_MARKER_RE =
|
|
63
|
+
/(^|[-_ ])1m($|[-_ ])|context[-_]?1m|\[1m\]/iu;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Vendor tokens the upstream web-search gate accepts. Transcribed as a token
|
|
67
|
+
* list rather than a regex so it stays a data question, not a pattern-matching
|
|
68
|
+
* one.
|
|
69
|
+
*/
|
|
70
|
+
const WEB_SEARCH_VENDOR_TOKENS: readonly string[] = Object.freeze([
|
|
71
|
+
"claude",
|
|
72
|
+
"sonnet",
|
|
73
|
+
"opus",
|
|
74
|
+
"haiku",
|
|
75
|
+
"gpt",
|
|
76
|
+
"gemini",
|
|
77
|
+
]);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether the active profile's catalogue records `capability` for `model`.
|
|
81
|
+
*
|
|
82
|
+
* `capability` is a verbatim upstream capability string. Ids the profile does
|
|
83
|
+
* not catalogue answer `false` for every capability: the catalogue is the only
|
|
84
|
+
* evidence this query consults, and absence of evidence is reported as
|
|
85
|
+
* absence. Callers wanting the derived nine-boolean view -- which falls back
|
|
86
|
+
* to the ported predicates for uncatalogued ids -- want `resolveModel`.
|
|
87
|
+
*/
|
|
88
|
+
export function modelCapability(
|
|
89
|
+
model: string,
|
|
90
|
+
capability: string,
|
|
91
|
+
profile: ClaudeCodeProtocolProfile = CLAUDE_CODE_2_1_195_PROFILE,
|
|
92
|
+
): boolean {
|
|
93
|
+
const id = normalizedOrNull(model);
|
|
94
|
+
if (
|
|
95
|
+
id === null ||
|
|
96
|
+
typeof capability !== "string" ||
|
|
97
|
+
capability.length === 0
|
|
98
|
+
) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
const entry = profile.supportedModels[id];
|
|
102
|
+
if (entry === undefined) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return entry.capabilities.includes(capability);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Whether `model` normalizes to `claude-opus-4-6`. */
|
|
109
|
+
export function isOpus46Model(model: string): boolean {
|
|
110
|
+
return normalizedOrNull(model) === "claude-opus-4-6";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Whether `model` normalizes to `claude-opus-4-7`. */
|
|
114
|
+
export function isOpus47Model(model: string): boolean {
|
|
115
|
+
return normalizedOrNull(model) === "claude-opus-4-7";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Whether `model` normalizes to `claude-opus-4-8`. */
|
|
119
|
+
export function isOpus48Model(model: string): boolean {
|
|
120
|
+
return normalizedOrNull(model) === "claude-opus-4-8";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Whether `model` normalizes to `claude-opus-5`. */
|
|
124
|
+
export function isOpus5Model(model: string): boolean {
|
|
125
|
+
return normalizedOrNull(model) === "claude-opus-5";
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Whether `model` normalizes to `claude-opus-5-5`. */
|
|
129
|
+
export function isOpus55Model(model: string): boolean {
|
|
130
|
+
return normalizedOrNull(model) === "claude-opus-5-5";
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Whether `model` normalizes to `claude-sonnet-4-6`. */
|
|
134
|
+
export function isSonnet46Model(model: string): boolean {
|
|
135
|
+
return normalizedOrNull(model) === "claude-sonnet-4-6";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Whether `model` normalizes to `claude-sonnet-5`. */
|
|
139
|
+
export function isSonnet5Model(model: string): boolean {
|
|
140
|
+
return normalizedOrNull(model) === "claude-sonnet-5";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Whether `model` normalizes to `claude-fable-5`. */
|
|
144
|
+
export function isFable5Model(model: string): boolean {
|
|
145
|
+
return normalizedOrNull(model) === "claude-fable-5";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Whether `model` normalizes to `claude-fable-5-1`. */
|
|
149
|
+
export function isFable51Model(model: string): boolean {
|
|
150
|
+
return normalizedOrNull(model) === "claude-fable-5-1";
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Whether `model` normalizes to `claude-mythos-5`. */
|
|
154
|
+
export function isMythos5Model(model: string): boolean {
|
|
155
|
+
return normalizedOrNull(model) === "claude-mythos-5";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Whether `model` normalizes to `claude-mythos-5-1`. */
|
|
159
|
+
export function isMythos51Model(model: string): boolean {
|
|
160
|
+
return normalizedOrNull(model) === "claude-mythos-5-1";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Whether `model` belongs to the haiku family.
|
|
165
|
+
*
|
|
166
|
+
* Reuses `modelFamilyOf`, the package's one family classifier, so a new haiku
|
|
167
|
+
* id is classified in exactly one place.
|
|
168
|
+
*/
|
|
169
|
+
export function isHaikuModel(model: string): boolean {
|
|
170
|
+
const id = normalizedOrNull(model);
|
|
171
|
+
return id !== null && modelFamilyOf(id) === "haiku";
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Whether `model` is a Claude 3 generation id.
|
|
176
|
+
*
|
|
177
|
+
* The `claude-3-` substring test is the same one the ported capability
|
|
178
|
+
* predicates open with (`model-capabilities.ts`), applied to the normalized
|
|
179
|
+
* id, so a Claude 3 id spelled with a dotted version (`claude-3.5-sonnet`)
|
|
180
|
+
* classifies with its hyphenated spelling.
|
|
181
|
+
*/
|
|
182
|
+
export function isClaude3Model(model: string): boolean {
|
|
183
|
+
return normalizedOrNull(model)?.includes("claude-3-") ?? false;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Whether `model` may receive the 1M-context beta.
|
|
188
|
+
*
|
|
189
|
+
* Three sources, in order: an explicit 1M marker in the id, the active
|
|
190
|
+
* profile's `context.supports1mBeta`, and -- for ids the profile does not
|
|
191
|
+
* catalogue -- the ported family set (`claude-sonnet-4*`, Opus 4.6/4.7/4.8).
|
|
192
|
+
*/
|
|
193
|
+
export function isEligibleFor1MContext(
|
|
194
|
+
model: string,
|
|
195
|
+
profile: ClaudeCodeProtocolProfile = CLAUDE_CODE_2_1_195_PROFILE,
|
|
196
|
+
): boolean {
|
|
197
|
+
const id = normalizedOrNull(model);
|
|
198
|
+
if (id === null) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
if (ONE_MILLION_ELIGIBLE_MARKER_RE.test(model)) {
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
const entry = profile.supportedModels[id];
|
|
205
|
+
if (entry !== undefined) {
|
|
206
|
+
return entry.context?.supports1mBeta === true;
|
|
207
|
+
}
|
|
208
|
+
return (
|
|
209
|
+
id.startsWith("claude-sonnet-4") ||
|
|
210
|
+
id === "claude-opus-4-6" ||
|
|
211
|
+
id === "claude-opus-4-7" ||
|
|
212
|
+
id === "claude-opus-4-8"
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Whether `model` names 1M context explicitly and therefore always uses it.
|
|
218
|
+
*
|
|
219
|
+
* Marker-only by design. The catalogue's `context.native1m` is a DIFFERENT
|
|
220
|
+
* question -- the model's native window -- and consulting it here would make
|
|
221
|
+
* every natively-1M id answer true, which is not what a static "always send
|
|
222
|
+
* 1M" gate means. Use `modelContextWindow`-shaped catalogue reads for that.
|
|
223
|
+
*/
|
|
224
|
+
export function hasOneMillionContext(model: string): boolean {
|
|
225
|
+
return normalizedOrNull(model) !== null && ONE_MILLION_MARKER_RE.test(model);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Whether `model` supports the structured-outputs beta.
|
|
230
|
+
*
|
|
231
|
+
* Delegates to the predicate ported from the genuine client (`j4e`), which is
|
|
232
|
+
* narrower and better evidenced than a family-shaped heuristic.
|
|
233
|
+
*/
|
|
234
|
+
export function supportsStructuredOutputs(model: string): boolean {
|
|
235
|
+
const id = normalizedOrNull(model);
|
|
236
|
+
return id !== null && portedStructuredOutputs(id);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Whether `model` supports the web-search tool. */
|
|
240
|
+
export function supportsWebSearch(model: string): boolean {
|
|
241
|
+
const id = normalizedOrNull(model);
|
|
242
|
+
return (
|
|
243
|
+
id !== null && WEB_SEARCH_VENDOR_TOKENS.some((token) => id.includes(token))
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Whether `model` uses adaptive thinking (`{type: "adaptive"}`) instead of a
|
|
249
|
+
* manual `budget_tokens`.
|
|
250
|
+
*
|
|
251
|
+
* The union of the named per-model predicates, not a catalogue read: this
|
|
252
|
+
* gates the shape of the emitted `thinking` block, and an uncatalogued id must
|
|
253
|
+
* not inherit adaptive thinking from the permissive capability fallback. The
|
|
254
|
+
* union covers every id any pinned profile's catalogue marks
|
|
255
|
+
* `adaptive_thinking` (the 2.1.280 catalogue is the widest). Ask
|
|
256
|
+
* `modelCapability(model, "adaptive_thinking", profile)` for a specific
|
|
257
|
+
* profile's answer.
|
|
258
|
+
*/
|
|
259
|
+
export function isAdaptiveThinkingModel(model: string): boolean {
|
|
260
|
+
return (
|
|
261
|
+
isOpus46Model(model) ||
|
|
262
|
+
isOpus47Model(model) ||
|
|
263
|
+
isOpus48Model(model) ||
|
|
264
|
+
isOpus5Model(model) ||
|
|
265
|
+
isOpus55Model(model) ||
|
|
266
|
+
isSonnet46Model(model) ||
|
|
267
|
+
isSonnet5Model(model) ||
|
|
268
|
+
isFable5Model(model) ||
|
|
269
|
+
isFable51Model(model) ||
|
|
270
|
+
isMythos5Model(model) ||
|
|
271
|
+
isMythos51Model(model)
|
|
272
|
+
);
|
|
273
|
+
}
|
package/src/models.ts
CHANGED
|
@@ -38,7 +38,7 @@ export function resolveModel(
|
|
|
38
38
|
id,
|
|
39
39
|
wireId,
|
|
40
40
|
// The catalogue supplies the family here, and -- since T1.1.2 -- also
|
|
41
|
-
// supplies the
|
|
41
|
+
// supplies the catalogue-backed capabilities. Both now honour THIS
|
|
42
42
|
// profile: `deriveCapabilities` takes the active profile, so a request
|
|
43
43
|
// built against a non-pinned profile derives from that profile's
|
|
44
44
|
// catalogue rather than from 2.1.195's. Ids with no catalogue entry fall
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
interface BetaRegistryEntry {
|
|
4
|
+
readonly featureKey: string;
|
|
5
|
+
readonly header: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* `deepFreeze` is duplicated from `src/beta-registry.ts` rather than imported,
|
|
10
|
+
* for the same reason the 2.1.233 registry duplicates it: a shared helper
|
|
11
|
+
* module would make every registry import-coupled for four lines of code, and
|
|
12
|
+
* keeping each registry a leaf keeps a version bump from rippling.
|
|
13
|
+
*/
|
|
14
|
+
function deepFreeze<T>(value: T): T {
|
|
15
|
+
if (value !== null && typeof value === "object") {
|
|
16
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
17
|
+
deepFreeze(Reflect.get(value, key));
|
|
18
|
+
}
|
|
19
|
+
Object.freeze(value);
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Genuine-client beta registry as of 2.1.280, upstream factory chain at byte
|
|
26
|
+
* offset 6277485 and ordered array `oy` immediately after it.
|
|
27
|
+
*
|
|
28
|
+
* KEY ORDER IS LOAD-BEARING, and for 2.1.280 it is load-bearing in a way it was
|
|
29
|
+
* not before: upstream's array is NOT append-only. `thinking_resumption` is
|
|
30
|
+
* inserted at position 17, and `per_turn_timing`, `mid_conv_tool_change` and
|
|
31
|
+
* `inline_tools` are inserted at 29-31, ahead of four entries that already
|
|
32
|
+
* existed. A diff that assumes new identifiers only ever land at the end will
|
|
33
|
+
* mis-align fifteen entries: 2.1.233 positions 17-27 shift by one and 28-31
|
|
34
|
+
* shift by four. See
|
|
35
|
+
* `docs/protocol/versions/claude-code-2.1.280-analysis.md` section 4.2.
|
|
36
|
+
*
|
|
37
|
+
* The upstream array carries 42 slots with two explicit `null`s (indices 34 and
|
|
38
|
+
* 37, `kAt` at byte 6279405 and `hZt` at byte 6279537) which `.filter(e => e
|
|
39
|
+
* !== null)` removes, leaving the forty entries below. Both slots are null IN
|
|
40
|
+
* THIS BUILD, which is all the bytes establish: upstream treats registry
|
|
41
|
+
* members as nullable per build -- `Dg` carries `...BR ? [BR] : []` and `hRr`
|
|
42
|
+
* guards on `kAt === null` -- so a compile-time feature gate fits the evidence
|
|
43
|
+
* as well as a removal does, and this file claims neither. `kAt` still has two
|
|
44
|
+
* consumers at byte 14167580: `hRr`, short-circuited by that null check, and
|
|
45
|
+
* `yRr`, which reads `kAt.name` with no null guard and so is either unreachable
|
|
46
|
+
* or a throw path. Neither says WHICH beta the slot held; see the note above
|
|
47
|
+
* `AUTO_MODE_CLASSIFIER`. Neither null slot is transcribed here; a null is not
|
|
48
|
+
* an entry.
|
|
49
|
+
*
|
|
50
|
+
* Two further registry members are deliberately absent:
|
|
51
|
+
* `mid_conv_cache_promotion_latch` and `mid_conv_cache_promotion_ok_latch`
|
|
52
|
+
* (`x-cc-internal-mid-conv-cache-promotion` and its `-ok` sibling). Upstream
|
|
53
|
+
* declares them through the same factory but excludes them from the ordered
|
|
54
|
+
* array, and their "header" values are internal `x-cc-*` names, not beta
|
|
55
|
+
* identifiers. Transcribing them would corrupt the registry.
|
|
56
|
+
*
|
|
57
|
+
* Every one of the nine entries new since 2.1.233 was confirmed against its own
|
|
58
|
+
* `N(alias, header)` declaration in the carved dump rather than against the
|
|
59
|
+
* analysis document alone, so no new header rests on a single reading:
|
|
60
|
+
* `rrt` 6278299, `w$` 6278910, `j_` 6278959, `W_` 6279023, and `qk`, `Aoe`,
|
|
61
|
+
* `cD`, `V1`, `lD` in the window at 6279405.
|
|
62
|
+
*
|
|
63
|
+
* `oauth_auth` is the one entry whose header is NOT a string literal upstream:
|
|
64
|
+
* the declaration reads `swe=N("oauth_auth",Ru)`. `Ru` is an imported binding,
|
|
65
|
+
* re-exported as `OAUTH_BETA_HEADER` at byte 25341943, and the only beta-shaped
|
|
66
|
+
* `oauth-*` literal in the bundle is `"oauth-2025-04-20"` at byte 4418398.
|
|
67
|
+
* Resolved by that binding, not by name similarity.
|
|
68
|
+
*/
|
|
69
|
+
export const BETA_REGISTRY_2_1_280 = deepFreeze({
|
|
70
|
+
CLAUDE_CODE: { featureKey: "claude_code", header: "claude-code-20250219" },
|
|
71
|
+
OAUTH_AUTH: { featureKey: "oauth_auth", header: "oauth-2025-04-20" },
|
|
72
|
+
INTERLEAVED_THINKING: {
|
|
73
|
+
featureKey: "interleaved_thinking",
|
|
74
|
+
header: "interleaved-thinking-2025-05-14",
|
|
75
|
+
},
|
|
76
|
+
LONG_CONTEXT: { featureKey: "long_context", header: "context-1m-2025-08-07" },
|
|
77
|
+
CONTEXT_MANAGEMENT: {
|
|
78
|
+
featureKey: "context_management",
|
|
79
|
+
header: "context-management-2025-06-27",
|
|
80
|
+
},
|
|
81
|
+
STRUCTURED_OUTPUTS: {
|
|
82
|
+
featureKey: "structured_outputs",
|
|
83
|
+
header: "structured-outputs-2025-12-15",
|
|
84
|
+
},
|
|
85
|
+
WEB_SEARCH: { featureKey: "web_search", header: "web-search-2025-03-05" },
|
|
86
|
+
ADVANCED_TOOL_USE: {
|
|
87
|
+
featureKey: "tool_search",
|
|
88
|
+
header: "advanced-tool-use-2025-11-20",
|
|
89
|
+
},
|
|
90
|
+
TOOL_SEARCH: {
|
|
91
|
+
featureKey: "tool_search",
|
|
92
|
+
header: "tool-search-tool-2025-10-19",
|
|
93
|
+
},
|
|
94
|
+
EFFORT: { featureKey: "effort", header: "effort-2025-11-24" },
|
|
95
|
+
TASK_BUDGETS: {
|
|
96
|
+
featureKey: "task_budgets",
|
|
97
|
+
header: "task-budgets-2026-03-13",
|
|
98
|
+
},
|
|
99
|
+
PROMPT_CACHING_SCOPE: {
|
|
100
|
+
featureKey: "prompt_caching_scope",
|
|
101
|
+
header: "prompt-caching-scope-2026-01-05",
|
|
102
|
+
},
|
|
103
|
+
PROMPT_CACHING_EVICT: {
|
|
104
|
+
featureKey: "prompt_caching_evict",
|
|
105
|
+
header: "prompt-caching-evict-2026-05-12",
|
|
106
|
+
},
|
|
107
|
+
EXTENDED_CACHE_TTL: {
|
|
108
|
+
featureKey: "extended_cache_ttl",
|
|
109
|
+
header: "extended-cache-ttl-2025-04-11",
|
|
110
|
+
},
|
|
111
|
+
SPEED: { featureKey: "speed", header: "fast-mode-2026-02-01" },
|
|
112
|
+
REDACT_THINKING: {
|
|
113
|
+
featureKey: "redact_thinking",
|
|
114
|
+
header: "redact-thinking-2026-02-12",
|
|
115
|
+
},
|
|
116
|
+
// New at 2.1.280, and inserted HERE rather than appended. Every entry below
|
|
117
|
+
// this point sat one slot lower in 2.1.233.
|
|
118
|
+
THINKING_RESUMPTION: {
|
|
119
|
+
featureKey: "thinking_resumption",
|
|
120
|
+
header: "thinking-resumption-2026-07-17",
|
|
121
|
+
},
|
|
122
|
+
THINKING_TOKEN_COUNT: {
|
|
123
|
+
featureKey: "thinking_token_count",
|
|
124
|
+
header: "thinking-token-count-2026-05-13",
|
|
125
|
+
},
|
|
126
|
+
AFK_MODE: { featureKey: "afk_mode", header: "afk-mode-2026-01-31" },
|
|
127
|
+
ADVISOR_TOOL: {
|
|
128
|
+
featureKey: "advisor_tool",
|
|
129
|
+
header: "advisor-tool-2026-03-01",
|
|
130
|
+
},
|
|
131
|
+
CACHE_DIAGNOSIS: {
|
|
132
|
+
featureKey: "cache_diagnosis",
|
|
133
|
+
header: "cache-diagnosis-2026-04-07",
|
|
134
|
+
},
|
|
135
|
+
CONTEXT_HINT: {
|
|
136
|
+
featureKey: "context_hint",
|
|
137
|
+
header: "context-hint-2026-04-09",
|
|
138
|
+
},
|
|
139
|
+
MCP_SERVERS: { featureKey: "mcp_servers", header: "mcp-servers-2025-12-04" },
|
|
140
|
+
FILES_API: { featureKey: "files_api", header: "files-api-2025-04-14" },
|
|
141
|
+
ENVIRONMENTS: {
|
|
142
|
+
featureKey: "environments",
|
|
143
|
+
header: "environments-2025-11-01",
|
|
144
|
+
},
|
|
145
|
+
CCR_BYOC: { featureKey: "ccr_byoc", header: "ccr-byoc-2025-07-29" },
|
|
146
|
+
MID_CONVERSATION_SYSTEM: {
|
|
147
|
+
featureKey: "mid_conversation_system",
|
|
148
|
+
header: "mid-conversation-system-2026-04-07",
|
|
149
|
+
},
|
|
150
|
+
PER_MESSAGE_EFFORT: {
|
|
151
|
+
featureKey: "per_message_effort",
|
|
152
|
+
header: "per-turn-control-2026-07-01",
|
|
153
|
+
},
|
|
154
|
+
// New at 2.1.280. Also inserted rather than appended: the four entries below
|
|
155
|
+
// `INLINE_TOOLS` all predate this release.
|
|
156
|
+
PER_TURN_TIMING: {
|
|
157
|
+
featureKey: "per_turn_timing",
|
|
158
|
+
header: "timing-2026-09-09",
|
|
159
|
+
},
|
|
160
|
+
MID_CONV_TOOL_CHANGE: {
|
|
161
|
+
featureKey: "mid_conv_tool_change",
|
|
162
|
+
header: "mid-conversation-tool-changes-2026-07-01",
|
|
163
|
+
},
|
|
164
|
+
INLINE_TOOLS: {
|
|
165
|
+
featureKey: "inline_tools",
|
|
166
|
+
header: "inline-tools-2026-09-15",
|
|
167
|
+
},
|
|
168
|
+
SERVER_SIDE_FALLBACK: {
|
|
169
|
+
featureKey: "server_side_fallback",
|
|
170
|
+
header: "server-side-fallback-2026-06-01",
|
|
171
|
+
},
|
|
172
|
+
SERVER_SIDE_FALLBACK_CATEGORY: {
|
|
173
|
+
featureKey: "server_side_fallback_category",
|
|
174
|
+
header: "server-side-fallback-2026-07-01",
|
|
175
|
+
},
|
|
176
|
+
FALLBACK_CREDIT: {
|
|
177
|
+
featureKey: "fallback_credit",
|
|
178
|
+
header: "fallback-credit-2026-06-01",
|
|
179
|
+
},
|
|
180
|
+
/*
|
|
181
|
+
* NARRATION_SUMMARIES IS DELIBERATELY ABSENT, exactly as in the 2.1.233
|
|
182
|
+
* registry, and re-adding it would reintroduce a header the genuine client no
|
|
183
|
+
* longer sends. Do not "fix" it.
|
|
184
|
+
*
|
|
185
|
+
* This position -- between `FALLBACK_CREDIT` and `AUTO_MODE_CLASSIFIER` -- is
|
|
186
|
+
* where the 2.1.233 registry records the removal, and it is also where array
|
|
187
|
+
* index 34 (`kAt`, null) falls. That correspondence is suggestive and NOT
|
|
188
|
+
* EVIDENCED: the `summarize-connector-text-2026-03-13` header string appears
|
|
189
|
+
* nowhere in the 2.1.280 bundle, so nothing ties it to `kAt` rather than to
|
|
190
|
+
* `hZt`, and `kAt`'s surviving consumer at byte 14167580 reports rejections
|
|
191
|
+
* under an "Auto mode classifier" label, which points the other way. The
|
|
192
|
+
* analysis document asserts only that two slots are null and this file
|
|
193
|
+
* asserts no more. See section 4.2 of
|
|
194
|
+
* `docs/protocol/versions/claude-code-2.1.280-analysis.md`.
|
|
195
|
+
*/
|
|
196
|
+
AUTO_MODE_CLASSIFIER: {
|
|
197
|
+
featureKey: "auto_mode_classifier",
|
|
198
|
+
header: "auto-mode-classifier-2026-07-16",
|
|
199
|
+
},
|
|
200
|
+
// New at 2.1.280.
|
|
201
|
+
DANGEROUS_TOOL_USE: {
|
|
202
|
+
featureKey: "dangerous_tool_use",
|
|
203
|
+
header: "dangerous-tool-use-2026-09-03",
|
|
204
|
+
},
|
|
205
|
+
/*
|
|
206
|
+
* The SECOND null slot (`hZt`, upstream index 37) belongs here. As with the
|
|
207
|
+
* first, what it once held -- if anything -- is unknown: no header string in
|
|
208
|
+
* any analysed release is tied to it by evidence. It is recorded rather than
|
|
209
|
+
* silently closed up, because a future build may reuse the slot.
|
|
210
|
+
*/
|
|
211
|
+
// New at 2.1.280.
|
|
212
|
+
THINKING_DISPLAY_UPDATES: {
|
|
213
|
+
featureKey: "thinking_display_updates",
|
|
214
|
+
header: "thinking-display-updates-2026-08-18",
|
|
215
|
+
},
|
|
216
|
+
MESSAGE_THREADS: {
|
|
217
|
+
featureKey: "message_threads",
|
|
218
|
+
header: "message-threads-2026-08-12",
|
|
219
|
+
},
|
|
220
|
+
MID_CONVERSATION_SYSTEM_CLEAR_AT: {
|
|
221
|
+
featureKey: "mid_conversation_system_clear_at",
|
|
222
|
+
header: "mid-conversation-system-clear-at-2026-08-21",
|
|
223
|
+
},
|
|
224
|
+
/*
|
|
225
|
+
* LAST in the array, though upstream DECLARES it alongside
|
|
226
|
+
* `thinking_display_updates` and `message_threads`. Declaration order and
|
|
227
|
+
* array order differ here and the array is what this transcription follows.
|
|
228
|
+
*/
|
|
229
|
+
THINKING_BINDING_CONTROLS: {
|
|
230
|
+
featureKey: "thinking_binding_controls",
|
|
231
|
+
header: "thinking-binding-controls-2026-08-01",
|
|
232
|
+
},
|
|
233
|
+
} satisfies Record<string, BetaRegistryEntry>);
|
|
234
|
+
|
|
235
|
+
/*
|
|
236
|
+
* Third-party filtering as of 2.1.280, upstream `Dg` at byte 7029997, consumed
|
|
237
|
+
* by `DDn(e) { if (iwe()) return e; return e.filter(n => Dg.has(n)) }` in the
|
|
238
|
+
* same run -- that is, the set is applied only when the request is NOT
|
|
239
|
+
* first-party, which is how it was identified: by call site, not by resemblance
|
|
240
|
+
* to the 2.1.233 set.
|
|
241
|
+
*
|
|
242
|
+
* Upstream writes one member as a conditional spread, `...BR ? [BR] : []`. That
|
|
243
|
+
* is why the extractor reported this set `unresolved` ("a member is neither a
|
|
244
|
+
* string literal nor a single property read"). `BR` is unconditionally defined
|
|
245
|
+
* at byte 6278332 in this build, so the spread always contributes and the set
|
|
246
|
+
* has fourteen members.
|
|
247
|
+
*
|
|
248
|
+
* Delta against the 2.1.233 set: `dangerous_tool_use`, `thinking_token_count`
|
|
249
|
+
* and `thinking_binding_controls` were ADDED; nothing was removed. Order below
|
|
250
|
+
* follows upstream's literal.
|
|
251
|
+
*/
|
|
252
|
+
export const THIRD_PARTY_ALLOWED_BETAS_2_1_280: ReadonlySet<string> =
|
|
253
|
+
Object.freeze(
|
|
254
|
+
new Set([
|
|
255
|
+
BETA_REGISTRY_2_1_280.CLAUDE_CODE.header,
|
|
256
|
+
BETA_REGISTRY_2_1_280.INTERLEAVED_THINKING.header,
|
|
257
|
+
BETA_REGISTRY_2_1_280.LONG_CONTEXT.header,
|
|
258
|
+
BETA_REGISTRY_2_1_280.CONTEXT_MANAGEMENT.header,
|
|
259
|
+
BETA_REGISTRY_2_1_280.STRUCTURED_OUTPUTS.header,
|
|
260
|
+
BETA_REGISTRY_2_1_280.WEB_SEARCH.header,
|
|
261
|
+
BETA_REGISTRY_2_1_280.EFFORT.header,
|
|
262
|
+
BETA_REGISTRY_2_1_280.TOOL_SEARCH.header,
|
|
263
|
+
BETA_REGISTRY_2_1_280.AFK_MODE.header,
|
|
264
|
+
BETA_REGISTRY_2_1_280.DANGEROUS_TOOL_USE.header,
|
|
265
|
+
BETA_REGISTRY_2_1_280.FALLBACK_CREDIT.header,
|
|
266
|
+
BETA_REGISTRY_2_1_280.MID_CONVERSATION_SYSTEM.header,
|
|
267
|
+
BETA_REGISTRY_2_1_280.THINKING_TOKEN_COUNT.header,
|
|
268
|
+
BETA_REGISTRY_2_1_280.THINKING_BINDING_CONTROLS.header,
|
|
269
|
+
]),
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
/*
|
|
273
|
+
* Provider filtering as of 2.1.280, upstream `qbr` at byte 6280270.
|
|
274
|
+
*
|
|
275
|
+
* Identified by behaviour rather than by shape: `Y5` at byte 7029210 reads
|
|
276
|
+
* `if (sc(e) === "bedrock") return n.filter(r => !qbr.has(r))`, and the
|
|
277
|
+
* complementary `lco` at the same site keeps exactly this set as bedrock
|
|
278
|
+
* extra-body parameters. Byte-identical to the 2.1.233 set.
|
|
279
|
+
*
|
|
280
|
+
* A DIFFERENT `qbr` exists at byte 13922760 in another module -- a set of grep
|
|
281
|
+
* flags. Minified names are module-scoped; this entry is the one the beta
|
|
282
|
+
* pipeline consumes.
|
|
283
|
+
*
|
|
284
|
+
* Static reference data with no call site in `src/`, exactly like its 2.1.233
|
|
285
|
+
* counterpart. See `test/governance/provider-scope.test.ts`.
|
|
286
|
+
*/
|
|
287
|
+
export const BEDROCK_UNSUPPORTED_BETAS_2_1_280: ReadonlySet<string> =
|
|
288
|
+
Object.freeze(
|
|
289
|
+
new Set([
|
|
290
|
+
BETA_REGISTRY_2_1_280.INTERLEAVED_THINKING.header,
|
|
291
|
+
BETA_REGISTRY_2_1_280.LONG_CONTEXT.header,
|
|
292
|
+
BETA_REGISTRY_2_1_280.TOOL_SEARCH.header,
|
|
293
|
+
]),
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
/*
|
|
297
|
+
* Count-tokens selection as of 2.1.280, upstream `iNn` at byte 6280282,
|
|
298
|
+
* consumed as `betas: y.filter(he => iNn.has(he))` inside
|
|
299
|
+
* `beta.messages.countTokens` at bytes 12304007, 12304164 and 12305087.
|
|
300
|
+
* Byte-identical to the 2.1.233 set.
|
|
301
|
+
*/
|
|
302
|
+
export const COUNT_TOKENS_BETAS_2_1_280: ReadonlySet<string> = Object.freeze(
|
|
303
|
+
new Set([
|
|
304
|
+
BETA_REGISTRY_2_1_280.CLAUDE_CODE.header,
|
|
305
|
+
BETA_REGISTRY_2_1_280.INTERLEAVED_THINKING.header,
|
|
306
|
+
BETA_REGISTRY_2_1_280.CONTEXT_MANAGEMENT.header,
|
|
307
|
+
BETA_REGISTRY_2_1_280.OAUTH_AUTH.header,
|
|
308
|
+
]),
|
|
309
|
+
);
|