@tormentalabs/claude-code-wire-compat 0.5.0 → 0.7.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +226 -0
- package/README.md +19 -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 +93 -50
- 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 +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +3 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +4 -0
- package/dist/limits.js.map +1 -0
- 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 +19 -1
- package/dist/model-identity.js.map +1 -1
- package/dist/model-queries.d.ts +17 -5
- package/dist/model-queries.d.ts.map +1 -1
- package/dist/model-queries.js +33 -6
- package/dist/model-queries.js.map +1 -1
- 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 +48 -2
- package/dist/redaction.js.map +1 -1
- package/dist/request-body.d.ts +4 -2
- package/dist/request-body.d.ts.map +1 -1
- package/dist/request-body.js +77 -48
- package/dist/request-body.js.map +1 -1
- package/dist/system-prompt.d.ts.map +1 -1
- package/dist/system-prompt.js +23 -22
- package/dist/system-prompt.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/dist/unicode.d.ts +41 -0
- package/dist/unicode.d.ts.map +1 -1
- package/dist/unicode.js +37 -0
- package/dist/unicode.js.map +1 -1
- package/dist/violation.d.ts +23 -0
- package/dist/violation.d.ts.map +1 -0
- package/dist/violation.js +210 -0
- package/dist/violation.js.map +1 -0
- package/package.json +6 -2
- package/src/betas.ts +208 -9
- package/src/build-request.ts +120 -56
- package/src/contracts.ts +7 -2
- package/src/fingerprint.ts +5 -0
- package/src/headers.ts +4 -2
- package/src/index.ts +2 -0
- package/src/limits.ts +4 -0
- package/src/model-capabilities.ts +55 -19
- package/src/model-identity.ts +14 -1
- package/src/model-queries.ts +38 -6
- 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 +65 -2
- package/src/request-body.ts +107 -49
- package/src/system-prompt.ts +32 -24
- package/src/thinking.ts +148 -26
- package/src/unicode.ts +71 -0
- package/src/violation.ts +226 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
import type { ClaudeCodeProtocolProfile } from "../contracts.js";
|
|
4
|
+
import { COUNT_TOKENS_ENDPOINT } from "../count-tokens.js";
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Protocol profile for genuine client 2.1.280.
|
|
8
|
+
*
|
|
9
|
+
* Provenance: extracted from the official 2.1.280 win32-x64 binary. The
|
|
10
|
+
* catalogue and every scalar below are transcribed from
|
|
11
|
+
* `docs/protocol/versions/claude-code-2.1.280-analysis.md`, which records the
|
|
12
|
+
* byte offsets they came from. The catalogue was additionally re-extracted
|
|
13
|
+
* from the carved bundle independently of that document (cluster bytes
|
|
14
|
+
* 5941320-5955961) and agreed on every field of all twenty entries; that
|
|
15
|
+
* re-extraction is not a claim you have to take on trust, because the method
|
|
16
|
+
* it used is written down in section 5.2.1 of the analysis document and can be
|
|
17
|
+
* re-run against the same dump.
|
|
18
|
+
*
|
|
19
|
+
* `effort_cost_index` is deliberately omitted, as in the 2.1.233 profile, and
|
|
20
|
+
* so are the other nine static-catalogue fields the package does not model
|
|
21
|
+
* (analysis document section 5.1).
|
|
22
|
+
*
|
|
23
|
+
* Context modelling follows 2.1.233 exactly. `supports_1m_suffix` is not
|
|
24
|
+
* modelled, so an entry declaring a 200000 window with nothing but that flag
|
|
25
|
+
* carries no `context` object here. `native_1m_3p` on `claude-sonnet-5` names
|
|
26
|
+
* bedrock, vertex and foundry; this package is anthropic-only, so that flag is
|
|
27
|
+
* not modelled either.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
function deepFreeze<T>(value: T): T {
|
|
31
|
+
if (value !== null && typeof value === "object") {
|
|
32
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
33
|
+
deepFreeze(Reflect.get(value, key));
|
|
34
|
+
}
|
|
35
|
+
Object.freeze(value);
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const CLAUDE_CODE_2_1_280_PROFILE: ClaudeCodeProtocolProfile =
|
|
41
|
+
deepFreeze({
|
|
42
|
+
id: "claude-code-2.1.280-sdk-0.112.1",
|
|
43
|
+
cliVersion: "2.1.280",
|
|
44
|
+
sdkVersion: "0.112.1",
|
|
45
|
+
endpoint: "https://api.anthropic.com/v1/messages?beta=true",
|
|
46
|
+
countTokensEndpoint: COUNT_TOKENS_ENDPOINT,
|
|
47
|
+
entrypoint: "cli",
|
|
48
|
+
userAgent: "claude-cli/2.1.280 (external, cli)",
|
|
49
|
+
buildTime: "2026-09-21T20:40:17Z",
|
|
50
|
+
gitSha: "80abbfe7d7232280011ff01a21ae3338f4c6e372",
|
|
51
|
+
// RETAINED from 2.1.233, not asserted. The 2.1.280 analysis document does
|
|
52
|
+
// not examine the billing block at all -- it contains no occurrence of
|
|
53
|
+
// "attribution" -- so this is silence, which is not the same as evidence of
|
|
54
|
+
// no change. The only indirect support is that the salt behind the
|
|
55
|
+
// fingerprint is unchanged (section 13); the fingerprint it produces, not
|
|
56
|
+
// the salt, is what appears on the billing line. Section 13.2 draws this
|
|
57
|
+
// exact distinction for the beta policy and it applies here too: where the
|
|
58
|
+
// evidence is absent the previous release's value is retained rather than
|
|
59
|
+
// re-derived, and a later release that captures live traffic should settle
|
|
60
|
+
// it.
|
|
61
|
+
attributionHeaderEnabled: true,
|
|
62
|
+
provider: "anthropic",
|
|
63
|
+
anthropicVersion: "2023-06-01",
|
|
64
|
+
// Section 9.2: `context_hint` remains off for 2.1.280. Section 7.6 agrees
|
|
65
|
+
// -- its fourteen-identifier default-path `anthropic-beta` literal contains
|
|
66
|
+
// no `context-hint` identifier -- but that is the same gate restated, not a
|
|
67
|
+
// second line of evidence, because the 7.6 row cites the gate 9.2 resolves.
|
|
68
|
+
// Only two things put that identifier into an emitted list: this flag,
|
|
69
|
+
// which also emits a `context_hint` body field, and a caller passing the
|
|
70
|
+
// identifier explicitly through the `additionalBetas` request seam.
|
|
71
|
+
contextHintEnabled: false,
|
|
72
|
+
/*
|
|
73
|
+
* The eleven flags of analysis document section 13.2, which grades each
|
|
74
|
+
* one. That grading is carried here per flag, because two of the eleven are
|
|
75
|
+
* *retained* from 2.1.233 rather than resolved from this build -- their
|
|
76
|
+
* upstream gates gave no answer -- and nothing in the value itself
|
|
77
|
+
* distinguishes a retained flag from a derived one. A later release that
|
|
78
|
+
* resolves a retained gate changes that flag on evidence; a later release
|
|
79
|
+
* that merely repeats it has learned nothing.
|
|
80
|
+
*/
|
|
81
|
+
betaPolicy: {
|
|
82
|
+
// RETAINED. The gate reduces to a predicate whose own gate is
|
|
83
|
+
// unresolved. What it decides is position rather than presence: the SDK
|
|
84
|
+
// appends the OAuth beta unconditionally on a token-cache session
|
|
85
|
+
// (section 8.3), so the choice is slot 2 versus appended last, and this
|
|
86
|
+
// profile pins slot 2 as 2.1.195 and 2.1.233 do.
|
|
87
|
+
oauthAuthenticated: true,
|
|
88
|
+
// Derived.
|
|
89
|
+
experimentalBetasEnabled: true,
|
|
90
|
+
// From the bundle: the gate reads an opt-out environment variable that is
|
|
91
|
+
// unset by default.
|
|
92
|
+
oneMillionContextEnabled: true,
|
|
93
|
+
// Derived.
|
|
94
|
+
interleavedThinkingEnabled: true,
|
|
95
|
+
// Derived.
|
|
96
|
+
interactive: true,
|
|
97
|
+
// Derived.
|
|
98
|
+
thinkingSummariesShown: false,
|
|
99
|
+
// Derived.
|
|
100
|
+
thinkingTokenCountEnabled: true,
|
|
101
|
+
// From the bundle, and inert for this profile either way: the 2.1.280
|
|
102
|
+
// registry slot that would carry `narration_summaries` is null in this
|
|
103
|
+
// build, so there is no entry for this flag to gate.
|
|
104
|
+
narrationSummariesEnabled: false,
|
|
105
|
+
// Derived.
|
|
106
|
+
structuredOutputsEnabled: false,
|
|
107
|
+
// RETAINED. Its gates are unresolved in this build.
|
|
108
|
+
afkModeEnabled: false,
|
|
109
|
+
// Changed from 2.1.233, where the 2.1.233 profile pins `false`. Section
|
|
110
|
+
// 7.6.2 resolves all three legs of the 2.1.280 gate to true. Whether the
|
|
111
|
+
// 2.1.233 value was always wrong cannot be settled without the 2.1.233
|
|
112
|
+
// binary, and inferring one release's value from another's is exactly
|
|
113
|
+
// what the tracking runbook forbids, so that profile is deliberately left
|
|
114
|
+
// alone.
|
|
115
|
+
cacheDiagnosisEnabled: true,
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* Verbatim genuine-client catalogue, 20 entries in the catalogue's own
|
|
119
|
+
* order. `defaultEffort` is policy exposed as catalogue data; this package
|
|
120
|
+
* must never apply it to a request.
|
|
121
|
+
*/
|
|
122
|
+
supportedModels: {
|
|
123
|
+
"claude-3-5-haiku": {
|
|
124
|
+
family: "haiku",
|
|
125
|
+
capabilities: [],
|
|
126
|
+
maxOutputTokens: { default: 8192, upper: 8192 },
|
|
127
|
+
},
|
|
128
|
+
"claude-haiku-4-5": {
|
|
129
|
+
family: "haiku",
|
|
130
|
+
capabilities: ["context_management"],
|
|
131
|
+
maxOutputTokens: { default: 32000, upper: 64000 },
|
|
132
|
+
},
|
|
133
|
+
"claude-3-5-sonnet": {
|
|
134
|
+
family: "sonnet",
|
|
135
|
+
capabilities: [],
|
|
136
|
+
maxOutputTokens: { default: 8192, upper: 8192 },
|
|
137
|
+
},
|
|
138
|
+
"claude-3-7-sonnet": {
|
|
139
|
+
family: "sonnet",
|
|
140
|
+
capabilities: [],
|
|
141
|
+
maxOutputTokens: { default: 32000, upper: 64000 },
|
|
142
|
+
},
|
|
143
|
+
"claude-sonnet-4-0": {
|
|
144
|
+
family: "sonnet",
|
|
145
|
+
context: { window: 200000, supports1mBeta: true },
|
|
146
|
+
capabilities: ["context_management"],
|
|
147
|
+
maxOutputTokens: { default: 32000, upper: 64000 },
|
|
148
|
+
},
|
|
149
|
+
"claude-sonnet-4-5": {
|
|
150
|
+
family: "sonnet",
|
|
151
|
+
context: { window: 200000, supports1mBeta: true },
|
|
152
|
+
capabilities: ["context_management"],
|
|
153
|
+
maxOutputTokens: { default: 32000, upper: 64000 },
|
|
154
|
+
},
|
|
155
|
+
"claude-sonnet-4-6": {
|
|
156
|
+
family: "sonnet",
|
|
157
|
+
context: { window: 200000, supports1mBeta: true },
|
|
158
|
+
maxOutputTokens: { default: 32000, upper: 128000 },
|
|
159
|
+
capabilities: [
|
|
160
|
+
"effort",
|
|
161
|
+
"max_effort",
|
|
162
|
+
"adaptive_thinking",
|
|
163
|
+
"context_management",
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
// The entry also declares `native_1m_3p` for bedrock/vertex/foundry;
|
|
167
|
+
// this package is anthropic-only, so that flag is not modelled.
|
|
168
|
+
"claude-sonnet-5": {
|
|
169
|
+
family: "sonnet",
|
|
170
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
171
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
172
|
+
capabilities: [
|
|
173
|
+
"effort",
|
|
174
|
+
"max_effort",
|
|
175
|
+
"xhigh_effort",
|
|
176
|
+
"adaptive_thinking",
|
|
177
|
+
"mid_conv_system",
|
|
178
|
+
"context_management",
|
|
179
|
+
],
|
|
180
|
+
defaultEffort: "high",
|
|
181
|
+
},
|
|
182
|
+
"claude-opus-4-0": {
|
|
183
|
+
family: "opus",
|
|
184
|
+
capabilities: ["context_management"],
|
|
185
|
+
maxOutputTokens: { default: 32000, upper: 32000 },
|
|
186
|
+
},
|
|
187
|
+
"claude-opus-4-1": {
|
|
188
|
+
family: "opus",
|
|
189
|
+
capabilities: ["context_management"],
|
|
190
|
+
maxOutputTokens: { default: 32000, upper: 32000 },
|
|
191
|
+
},
|
|
192
|
+
"claude-opus-4-5": {
|
|
193
|
+
family: "opus",
|
|
194
|
+
capabilities: ["context_management"],
|
|
195
|
+
maxOutputTokens: { default: 32000, upper: 64000 },
|
|
196
|
+
},
|
|
197
|
+
"claude-opus-4-6": {
|
|
198
|
+
family: "opus",
|
|
199
|
+
context: { window: 200000, supports1mBeta: true },
|
|
200
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
201
|
+
capabilities: [
|
|
202
|
+
"effort",
|
|
203
|
+
"max_effort",
|
|
204
|
+
"adaptive_thinking",
|
|
205
|
+
"context_management",
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
"claude-opus-4-7": {
|
|
209
|
+
family: "opus",
|
|
210
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
211
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
212
|
+
capabilities: [
|
|
213
|
+
"effort",
|
|
214
|
+
"max_effort",
|
|
215
|
+
"xhigh_effort",
|
|
216
|
+
"adaptive_thinking",
|
|
217
|
+
"context_management",
|
|
218
|
+
],
|
|
219
|
+
defaultEffort: "xhigh",
|
|
220
|
+
},
|
|
221
|
+
// Gains `mid_conv_tool_change` since 2.1.233. That key is mapped by
|
|
222
|
+
// `deriveCapabilitiesFromCatalogue` to `midConvToolChange`, and it
|
|
223
|
+
// drives the `mid-conversation-tool-changes-2026-07-01` beta header
|
|
224
|
+
// (section 7.6) through the guard transcribed in section 13.3.
|
|
225
|
+
"claude-opus-4-8": {
|
|
226
|
+
family: "opus",
|
|
227
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
228
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
229
|
+
capabilities: [
|
|
230
|
+
"effort",
|
|
231
|
+
"max_effort",
|
|
232
|
+
"xhigh_effort",
|
|
233
|
+
"adaptive_thinking",
|
|
234
|
+
"mid_conv_system",
|
|
235
|
+
"mid_conv_tool_change",
|
|
236
|
+
"context_management",
|
|
237
|
+
"fast_mode",
|
|
238
|
+
"lean_prompt",
|
|
239
|
+
],
|
|
240
|
+
defaultEffort: "high",
|
|
241
|
+
},
|
|
242
|
+
// Gains `mid_conv_tool_change` and `thinking_disabled_effort_cap` since
|
|
243
|
+
// 2.1.233.
|
|
244
|
+
"claude-opus-5": {
|
|
245
|
+
family: "opus",
|
|
246
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
247
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
248
|
+
capabilities: [
|
|
249
|
+
"effort",
|
|
250
|
+
"max_effort",
|
|
251
|
+
"xhigh_effort",
|
|
252
|
+
"adaptive_thinking",
|
|
253
|
+
"mid_conv_system",
|
|
254
|
+
"mid_conv_tool_change",
|
|
255
|
+
"context_management",
|
|
256
|
+
"thinking_disabled_effort_cap",
|
|
257
|
+
"fast_mode",
|
|
258
|
+
"lean_prompt",
|
|
259
|
+
"refusal_fallback",
|
|
260
|
+
"opus_5_prompt_bundle",
|
|
261
|
+
],
|
|
262
|
+
defaultEffort: "high",
|
|
263
|
+
},
|
|
264
|
+
// New at 2.1.280, and the only catalogue entry in any ported profile
|
|
265
|
+
// whose `default_effort` is `medium`. It is also the only entry whose
|
|
266
|
+
// default and upper output-token limits are both 128000.
|
|
267
|
+
"claude-opus-5-5": {
|
|
268
|
+
family: "opus",
|
|
269
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
270
|
+
maxOutputTokens: { default: 128000, upper: 128000 },
|
|
271
|
+
capabilities: [
|
|
272
|
+
"effort",
|
|
273
|
+
"max_effort",
|
|
274
|
+
"xhigh_effort",
|
|
275
|
+
"adaptive_thinking",
|
|
276
|
+
"rejects_disabled_thinking",
|
|
277
|
+
"mid_conv_system",
|
|
278
|
+
"mid_conv_tool_change",
|
|
279
|
+
"per_turn_effort",
|
|
280
|
+
"per_turn_timing",
|
|
281
|
+
"context_management",
|
|
282
|
+
"fast_mode",
|
|
283
|
+
"lean_prompt",
|
|
284
|
+
"refusal_fallback",
|
|
285
|
+
"opus_5_5_prompt_bundle",
|
|
286
|
+
],
|
|
287
|
+
defaultEffort: "medium",
|
|
288
|
+
},
|
|
289
|
+
// Gains `mid_conv_tool_change` since 2.1.233. Carries no `fast_mode`,
|
|
290
|
+
// as in 2.1.233.
|
|
291
|
+
"claude-fable-5": {
|
|
292
|
+
family: "fable",
|
|
293
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
294
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
295
|
+
capabilities: [
|
|
296
|
+
"effort",
|
|
297
|
+
"max_effort",
|
|
298
|
+
"xhigh_effort",
|
|
299
|
+
"adaptive_thinking",
|
|
300
|
+
"rejects_disabled_thinking",
|
|
301
|
+
"mid_conv_system",
|
|
302
|
+
"mid_conv_tool_change",
|
|
303
|
+
"context_management",
|
|
304
|
+
"lean_prompt",
|
|
305
|
+
"fable_5_mitigations",
|
|
306
|
+
"refusal_fallback",
|
|
307
|
+
],
|
|
308
|
+
defaultEffort: "high",
|
|
309
|
+
},
|
|
310
|
+
// New at 2.1.280.
|
|
311
|
+
"claude-fable-5-1": {
|
|
312
|
+
family: "fable",
|
|
313
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
314
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
315
|
+
capabilities: [
|
|
316
|
+
"effort",
|
|
317
|
+
"max_effort",
|
|
318
|
+
"xhigh_effort",
|
|
319
|
+
"adaptive_thinking",
|
|
320
|
+
"rejects_disabled_thinking",
|
|
321
|
+
"mid_conv_system",
|
|
322
|
+
"mid_conv_tool_change",
|
|
323
|
+
"per_turn_effort",
|
|
324
|
+
"per_turn_timing",
|
|
325
|
+
"context_management",
|
|
326
|
+
"lean_prompt",
|
|
327
|
+
"fable_5_mitigations",
|
|
328
|
+
"refusal_fallback",
|
|
329
|
+
"fable_5_1_prompt_bundle",
|
|
330
|
+
],
|
|
331
|
+
defaultEffort: "high",
|
|
332
|
+
},
|
|
333
|
+
// Keeps the empty capability array it was catalogued with at 2.1.233.
|
|
334
|
+
// That is a denial, not a gap.
|
|
335
|
+
"claude-mythos-5": {
|
|
336
|
+
family: "mythos",
|
|
337
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
338
|
+
capabilities: [],
|
|
339
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
340
|
+
},
|
|
341
|
+
// New at 2.1.280. Unlike `claude-fable-5-1` it carries no
|
|
342
|
+
// `per_turn_effort` and no `refusal_fallback`.
|
|
343
|
+
"claude-mythos-5-1": {
|
|
344
|
+
family: "mythos",
|
|
345
|
+
context: { window: 1e6, native1m: true, supports1mBeta: true },
|
|
346
|
+
maxOutputTokens: { default: 64000, upper: 128000 },
|
|
347
|
+
capabilities: [
|
|
348
|
+
"effort",
|
|
349
|
+
"max_effort",
|
|
350
|
+
"xhigh_effort",
|
|
351
|
+
"adaptive_thinking",
|
|
352
|
+
"rejects_disabled_thinking",
|
|
353
|
+
"mid_conv_system",
|
|
354
|
+
"mid_conv_tool_change",
|
|
355
|
+
"per_turn_timing",
|
|
356
|
+
"context_management",
|
|
357
|
+
"lean_prompt",
|
|
358
|
+
"fable_5_mitigations",
|
|
359
|
+
"fable_5_1_prompt_bundle",
|
|
360
|
+
],
|
|
361
|
+
defaultEffort: "high",
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
});
|
package/src/redaction.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
|
|
3
|
+
import { MAX_INPUT_SIZE } from "./limits.js";
|
|
4
|
+
|
|
3
5
|
import type {
|
|
4
6
|
ClaudeCodeCapabilityDecisions,
|
|
5
7
|
ClaudeCodeModelFamily,
|
|
@@ -10,6 +12,11 @@ import type {
|
|
|
10
12
|
} from "./contracts.js";
|
|
11
13
|
import { ClaudeCodeWireError } from "./contracts.js";
|
|
12
14
|
import { classifySurrogateAt } from "./unicode.js";
|
|
15
|
+
import {
|
|
16
|
+
isValidViolationCodeUnit,
|
|
17
|
+
isValidViolationPath,
|
|
18
|
+
isValidViolationReason,
|
|
19
|
+
} from "./violation.js";
|
|
13
20
|
|
|
14
21
|
/** Excludes values used only while validating and assembling the request. */
|
|
15
22
|
export type NormalizedRequestInput = Omit<
|
|
@@ -63,7 +70,6 @@ export interface BuildRedactedEvidenceInput {
|
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
const MAX_INPUT_DEPTH = 100;
|
|
66
|
-
const MAX_INPUT_SIZE = 1_000_000;
|
|
67
73
|
const ENDPOINT = "https://api.anthropic.com/v1/messages?beta=true";
|
|
68
74
|
/**
|
|
69
75
|
* The profile ids evidence may claim, spelled out here for the same reason
|
|
@@ -75,6 +81,7 @@ const ENDPOINT = "https://api.anthropic.com/v1/messages?beta=true";
|
|
|
75
81
|
const PINNED_PROFILE_IDS: ReadonlySet<string> = new Set([
|
|
76
82
|
"claude-code-2.1.195-sdk-0.94.0",
|
|
77
83
|
"claude-code-2.1.233-sdk-0.112.1",
|
|
84
|
+
"claude-code-2.1.280-sdk-0.112.1",
|
|
78
85
|
]);
|
|
79
86
|
const FORBIDDEN_KEYS = new Set(["__proto__", "prototype", "constructor"]);
|
|
80
87
|
const SAFE_ERROR_CODES = new Set([
|
|
@@ -267,6 +274,8 @@ function capabilityDecisions(
|
|
|
267
274
|
contextManagement: requested?.contextManagement ?? false,
|
|
268
275
|
temperature: requested?.temperature ?? false,
|
|
269
276
|
rejectsDisabledThinking: requested?.rejectsDisabledThinking ?? false,
|
|
277
|
+
midConvToolChange: requested?.midConvToolChange ?? false,
|
|
278
|
+
perTurnEffort: requested?.perTurnEffort ?? false,
|
|
270
279
|
});
|
|
271
280
|
}
|
|
272
281
|
|
|
@@ -392,7 +401,7 @@ export function toSafeErrorDetails(
|
|
|
392
401
|
"maximumDepth",
|
|
393
402
|
"maximumSize",
|
|
394
403
|
] as const;
|
|
395
|
-
const booleanKeys = ["hasSystem", "hasTools"] as const;
|
|
404
|
+
const booleanKeys = ["hasSystem", "hasTools", "violationInKey"] as const;
|
|
396
405
|
|
|
397
406
|
for (const key of numericKeys) {
|
|
398
407
|
const descriptor = Object.getOwnPropertyDescriptor(safeDetails, key);
|
|
@@ -412,6 +421,60 @@ export function toSafeErrorDetails(
|
|
|
412
421
|
: undefined;
|
|
413
422
|
if (typeof detail === "boolean") details[key] = detail;
|
|
414
423
|
}
|
|
424
|
+
|
|
425
|
+
// Violation diagnostics (P1.T1, D4): strings pass only through closed-set
|
|
426
|
+
// or pattern validators, and numbers only through integer/range guards, so
|
|
427
|
+
// no caller text, key name or excerpt can ride these fields out of an error.
|
|
428
|
+
const stringValidators: Readonly<Record<string, (value: string) => boolean>> =
|
|
429
|
+
{
|
|
430
|
+
violationReason: isValidViolationReason,
|
|
431
|
+
violationPath: isValidViolationPath,
|
|
432
|
+
};
|
|
433
|
+
for (const [key, validator] of Object.entries(stringValidators)) {
|
|
434
|
+
const descriptor = Object.getOwnPropertyDescriptor(safeDetails, key);
|
|
435
|
+
const detail: unknown =
|
|
436
|
+
descriptor !== undefined && "value" in descriptor
|
|
437
|
+
? descriptor.value
|
|
438
|
+
: undefined;
|
|
439
|
+
if (typeof detail === "string" && validator(detail)) {
|
|
440
|
+
details[key] = detail;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const integerKeys = ["violationOffset", "violationTextLength"] as const;
|
|
444
|
+
for (const key of integerKeys) {
|
|
445
|
+
const descriptor = Object.getOwnPropertyDescriptor(safeDetails, key);
|
|
446
|
+
const detail: unknown =
|
|
447
|
+
descriptor !== undefined && "value" in descriptor
|
|
448
|
+
? descriptor.value
|
|
449
|
+
: undefined;
|
|
450
|
+
if (
|
|
451
|
+
typeof detail === "number" &&
|
|
452
|
+
Number.isSafeInteger(detail) &&
|
|
453
|
+
!Object.is(detail, -0) &&
|
|
454
|
+
detail >= 0 &&
|
|
455
|
+
detail <= MAX_INPUT_SIZE
|
|
456
|
+
) {
|
|
457
|
+
details[key] = detail;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
{
|
|
461
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
462
|
+
safeDetails,
|
|
463
|
+
"violationCodeUnit",
|
|
464
|
+
);
|
|
465
|
+
const detail: unknown =
|
|
466
|
+
descriptor !== undefined && "value" in descriptor
|
|
467
|
+
? descriptor.value
|
|
468
|
+
: undefined;
|
|
469
|
+
if (
|
|
470
|
+
typeof detail === "number" &&
|
|
471
|
+
isValidViolationCodeUnit(detail) &&
|
|
472
|
+
((details["violationReason"] === "lone-surrogate" && detail >= 0xd800) ||
|
|
473
|
+
(details["violationReason"] === "control-char" && detail <= 0x9f))
|
|
474
|
+
) {
|
|
475
|
+
details["violationCodeUnit"] = detail;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
415
478
|
return Object.freeze(details);
|
|
416
479
|
}
|
|
417
480
|
|