@tormentalabs/claude-code-wire-compat 0.7.0 → 0.8.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 +110 -0
- package/README.md +31 -4
- package/dist/account-features.d.ts +11 -0
- package/dist/account-features.d.ts.map +1 -0
- package/dist/account-features.js +98 -0
- package/dist/account-features.js.map +1 -0
- package/dist/anti-verbosity.d.ts.map +1 -1
- package/dist/anti-verbosity.js +3 -3
- package/dist/anti-verbosity.js.map +1 -1
- package/dist/betas.d.ts +74 -2
- package/dist/betas.d.ts.map +1 -1
- package/dist/betas.js +158 -18
- package/dist/betas.js.map +1 -1
- package/dist/build-request.d.ts.map +1 -1
- package/dist/build-request.js +208 -24
- package/dist/build-request.js.map +1 -1
- package/dist/contracts.d.ts +181 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/fingerprint.d.ts +28 -5
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +63 -5
- package/dist/fingerprint.js.map +1 -1
- package/dist/headers.d.ts +60 -1
- package/dist/headers.d.ts.map +1 -1
- package/dist/headers.js +176 -23
- package/dist/headers.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +29 -2
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +29 -2
- package/dist/limits.js.map +1 -1
- package/dist/model-capabilities.d.ts +8 -4
- package/dist/model-capabilities.d.ts.map +1 -1
- package/dist/model-capabilities.js +14 -7
- package/dist/model-capabilities.js.map +1 -1
- package/dist/model-identity.d.ts +15 -2
- package/dist/model-identity.d.ts.map +1 -1
- package/dist/model-identity.js +44 -1
- package/dist/model-identity.js.map +1 -1
- package/dist/model-queries.d.ts +11 -1
- package/dist/model-queries.d.ts.map +1 -1
- package/dist/model-queries.js +51 -7
- package/dist/model-queries.js.map +1 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +2 -2
- package/dist/models.js.map +1 -1
- package/dist/profile-behaviors.d.ts +72 -0
- package/dist/profile-behaviors.d.ts.map +1 -1
- package/dist/profile-behaviors.js +66 -15
- package/dist/profile-behaviors.js.map +1 -1
- package/dist/profiles/beta-registry-2.1.329.d.ts +229 -0
- package/dist/profiles/beta-registry-2.1.329.d.ts.map +1 -0
- package/dist/profiles/beta-registry-2.1.329.js +281 -0
- package/dist/profiles/beta-registry-2.1.329.js.map +1 -0
- package/dist/profiles/claude-code-2.1.329.d.ts +3 -0
- package/dist/profiles/claude-code-2.1.329.d.ts.map +1 -0
- package/dist/profiles/claude-code-2.1.329.js +466 -0
- package/dist/profiles/claude-code-2.1.329.js.map +1 -0
- package/dist/redaction.d.ts.map +1 -1
- package/dist/redaction.js +7 -3
- package/dist/redaction.js.map +1 -1
- package/dist/request-body.d.ts +27 -1
- package/dist/request-body.d.ts.map +1 -1
- package/dist/request-body.js +192 -23
- package/dist/request-body.js.map +1 -1
- package/dist/system-prompt.d.ts.map +1 -1
- package/dist/system-prompt.js +6 -4
- package/dist/system-prompt.js.map +1 -1
- package/dist/tools-used.d.ts +52 -0
- package/dist/tools-used.d.ts.map +1 -0
- package/dist/tools-used.js +116 -0
- package/dist/tools-used.js.map +1 -0
- package/package.json +5 -1
- package/src/account-features.ts +114 -0
- package/src/anti-verbosity.ts +8 -3
- package/src/betas.ts +252 -22
- package/src/build-request.ts +251 -26
- package/src/contracts.ts +185 -3
- package/src/fingerprint.ts +84 -7
- package/src/headers.ts +221 -21
- package/src/index.ts +10 -0
- package/src/limits.ts +31 -2
- package/src/model-capabilities.ts +16 -7
- package/src/model-identity.ts +62 -2
- package/src/model-queries.ts +71 -8
- package/src/models.ts +2 -1
- package/src/profile-behaviors.ts +150 -16
- package/src/profiles/beta-registry-2.1.329.ts +298 -0
- package/src/profiles/claude-code-2.1.329.ts +471 -0
- package/src/redaction.ts +7 -3
- package/src/request-body.ts +253 -22
- package/src/system-prompt.ts +6 -2
- package/src/tools-used.ts +134 -0
package/dist/model-identity.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
import { profileBehaviors } from "./profile-behaviors.js";
|
|
2
3
|
/** Ports upstream `dp` (binary offset 226644497). */
|
|
3
4
|
export function stripModelMarkers(model) {
|
|
4
5
|
return model.replace(/\[(1|2)m\]/gi, "");
|
|
@@ -16,6 +17,29 @@ export function stripModelMarkers(model) {
|
|
|
16
17
|
function dottedToDashedVersion(model) {
|
|
17
18
|
return model.replace(/(\d)\.(\d)/g, "$1-$2");
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the ladder a profile's own normalizer follows, from the behaviour
|
|
22
|
+
* flag rather than from the profile id.
|
|
23
|
+
*/
|
|
24
|
+
export function modelIdLadder(profile) {
|
|
25
|
+
return profileBehaviors(profile).extendedModelIdLadder ? "extended" : "base";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Ports upstream `V2e` (2.1.329 bundle, view line 101880, byte offset
|
|
29
|
+
* 5753662): whether `needle` occurs in `haystack` as an undated id. When the
|
|
30
|
+
* needle ends in a `-`/`_` plus a digit, an occurrence directly followed by
|
|
31
|
+
* three more digits is a date suffix on the shorter id (`claude-fable-5-` +
|
|
32
|
+
* `20260101`) and does not count.
|
|
33
|
+
*/
|
|
34
|
+
function matchesUndated(haystack, needle) {
|
|
35
|
+
const endsInDigit = /[-_]\d$/.test(needle);
|
|
36
|
+
for (let at = haystack.indexOf(needle); at !== -1; at = haystack.indexOf(needle, at + 1)) {
|
|
37
|
+
if (!endsInDigit || !/^\d{3}/.test(haystack.slice(at + needle.length))) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
19
43
|
/**
|
|
20
44
|
* Ports upstream `$_` (binary offset 226639025); in the 2.1.280 bundle the
|
|
21
45
|
* function is `GF` at byte offset 7413751. The two offsets are in different
|
|
@@ -24,13 +48,26 @@ function dottedToDashedVersion(model) {
|
|
|
24
48
|
*
|
|
25
49
|
* Rung order is load-bearing: each test is a substring test, so a longer id
|
|
26
50
|
* must precede the shorter id it contains or the shorter rung swallows it.
|
|
51
|
+
*
|
|
52
|
+
* Two ladders. `"base"` is the ladder every profile through 2.1.280 follows.
|
|
53
|
+
* `"extended"` adds four rungs transcribed from the 2.1.329 bundle (`NK`, view
|
|
54
|
+
* lines 113702-113708): `claude-fable-5-2`, `claude-mythos-5-2`,
|
|
55
|
+
* `claude-sonnet-5-5` and `claude-haiku-5-5`, each placed before the shorter id
|
|
56
|
+
* it contains. Which ladder a profile follows is decided by `modelIdLadder`.
|
|
27
57
|
*/
|
|
28
|
-
export function normalizeModelId(model) {
|
|
58
|
+
export function normalizeModelId(model, ladder = "base") {
|
|
29
59
|
model = dottedToDashedVersion(model.toLowerCase());
|
|
60
|
+
const extended = ladder === "extended";
|
|
61
|
+
if (extended && matchesUndated(model, "claude-fable-5-2")) {
|
|
62
|
+
return "claude-fable-5-2";
|
|
63
|
+
}
|
|
30
64
|
if (model.includes("claude-fable-5-1"))
|
|
31
65
|
return "claude-fable-5-1";
|
|
32
66
|
if (model.includes("claude-fable-5"))
|
|
33
67
|
return "claude-fable-5";
|
|
68
|
+
if (extended && matchesUndated(model, "claude-mythos-5-2")) {
|
|
69
|
+
return "claude-mythos-5-2";
|
|
70
|
+
}
|
|
34
71
|
if (model.includes("claude-mythos-5-1"))
|
|
35
72
|
return "claude-mythos-5-1";
|
|
36
73
|
if (model.includes("claude-mythos-5"))
|
|
@@ -51,6 +88,9 @@ export function normalizeModelId(model) {
|
|
|
51
88
|
return "claude-opus-4-1";
|
|
52
89
|
if (/claude-opus-4(?!-\d(?!\d))/.test(model))
|
|
53
90
|
return "claude-opus-4-0";
|
|
91
|
+
if (extended && model.includes("claude-sonnet-5-5")) {
|
|
92
|
+
return "claude-sonnet-5-5";
|
|
93
|
+
}
|
|
54
94
|
if (model.includes("claude-sonnet-5"))
|
|
55
95
|
return "claude-sonnet-5";
|
|
56
96
|
if (model.includes("claude-sonnet-4-6"))
|
|
@@ -59,6 +99,9 @@ export function normalizeModelId(model) {
|
|
|
59
99
|
return "claude-sonnet-4-5";
|
|
60
100
|
if (/claude-sonnet-4(?!-\d(?!\d))/.test(model))
|
|
61
101
|
return "claude-sonnet-4-0";
|
|
102
|
+
if (extended && model.includes("claude-haiku-5-5")) {
|
|
103
|
+
return "claude-haiku-5-5";
|
|
104
|
+
}
|
|
62
105
|
if (model.includes("claude-haiku-4-5"))
|
|
63
106
|
return "claude-haiku-4-5";
|
|
64
107
|
if (model.includes("claude-3-7-sonnet"))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-identity.js","sourceRoot":"","sources":["../src/model-identity.ts"],"names":[],"mappings":"AAAA,4CAA4C;
|
|
1
|
+
{"version":3,"file":"model-identity.js","sourceRoot":"","sources":["../src/model-identity.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAM5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,qDAAqD;AACrD,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,qBAAqB,CAAC,KAAa;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAKD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAkC;IAElC,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;AAC/E,CAAC;AAED;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,QAAgB,EAAE,MAAc;IACtD,MAAM,WAAW,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AAC,QAAQ,CAAC,mBAAmB,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACpE,IAAI,KAAK,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACpE,IAAI,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAAE,OAAO,kBAAkB,CAAC;IAClE,IAAI,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC;QAAE,OAAO,eAAe,CAAC;IAC5D,IAAI,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAChE,IAAI,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAAE,OAAO,gBAAgB,CAAC;IAC9D,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,YAAoB;IAChD,IAAI,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACnD,IAAI,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IACrD,IAAI,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACnD,IAAI,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IACrD,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/model-queries.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClaudeCodeProtocolProfile } from "./contracts.js";
|
|
1
|
+
import type { ClaudeCodeCatalogueEntry, ClaudeCodeProtocolProfile } from "./contracts.js";
|
|
2
2
|
/**
|
|
3
3
|
* Whether the active profile's catalogue records `capability` for `model`.
|
|
4
4
|
*
|
|
@@ -9,6 +9,16 @@ import type { ClaudeCodeProtocolProfile } from "./contracts.js";
|
|
|
9
9
|
* to the ported predicates for uncatalogued ids -- want `resolveModel`.
|
|
10
10
|
*/
|
|
11
11
|
export declare function modelCapability(model: string, capability: string, profile?: ClaudeCodeProtocolProfile): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The catalogue entry the profile's own normalizer resolves `model` to, or
|
|
14
|
+
* `undefined` when the model is not a string, is empty, or the profile does not
|
|
15
|
+
* catalogue the resolved id.
|
|
16
|
+
*
|
|
17
|
+
* Folding-consistent: under a profile that follows the base ladder,
|
|
18
|
+
* `claude-sonnet-5-5` resolves to the `claude-sonnet-5` entry, exactly as the
|
|
19
|
+
* request builder resolves it for that profile.
|
|
20
|
+
*/
|
|
21
|
+
export declare function modelCatalogueEntry(model: string, profile?: ClaudeCodeProtocolProfile): ClaudeCodeCatalogueEntry | undefined;
|
|
12
22
|
/** Whether `model` normalizes to `claude-opus-4-6`. */
|
|
13
23
|
export declare function isOpus46Model(model: string): boolean;
|
|
14
24
|
/** Whether `model` normalizes to `claude-opus-4-7`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-queries.d.ts","sourceRoot":"","sources":["../src/model-queries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"model-queries.d.ts","sourceRoot":"","sources":["../src/model-queries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;AA4FxB;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,yBAAuD,GAC/D,OAAO,CAcT;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,yBAAuD,GAC/D,wBAAwB,GAAG,SAAS,CAMtC;AAED,uDAAuD;AACvD,w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AM,GAAG,OAAO,CAGhE;AAED,oDAAoD;AACpD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAKxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAkB9D"}
|
package/dist/model-queries.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
import { supportsStructuredOutputs as portedStructuredOutputs } from "./model-capabilities.js";
|
|
3
|
-
import { modelFamilyOf, normalizeModelId } from "./model-identity.js";
|
|
3
|
+
import { modelFamilyOf, modelIdLadder, normalizeModelId, } from "./model-identity.js";
|
|
4
4
|
import { CLAUDE_CODE_2_1_195_PROFILE } from "./profiles/claude-code-2.1.195.js";
|
|
5
5
|
/*
|
|
6
6
|
* Read-only model queries.
|
|
@@ -38,12 +38,20 @@ import { CLAUDE_CODE_2_1_195_PROFILE } from "./profiles/claude-code-2.1.195.js";
|
|
|
38
38
|
*
|
|
39
39
|
* RUNTIME NEUTRALITY. No builtins, no clock, no randomness, no I/O.
|
|
40
40
|
*/
|
|
41
|
-
/**
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Lowercased + dotted-to-dashed id, or `null` for input no predicate can answer
|
|
43
|
+
* for.
|
|
44
|
+
*
|
|
45
|
+
* Profile-less identity predicates use the extended ladder (the widest the
|
|
46
|
+
* package knows), so `isSonnet5Model("claude-sonnet-5-5")` is false: the 5.5
|
|
47
|
+
* ids are their own models. Queries that take a profile pass that profile's
|
|
48
|
+
* own ladder instead, so 2.1.280 keeps its folding.
|
|
49
|
+
*/
|
|
50
|
+
function normalizedOrNull(model, ladder = "extended") {
|
|
43
51
|
if (typeof model !== "string" || model.length === 0) {
|
|
44
52
|
return null;
|
|
45
53
|
}
|
|
46
|
-
return normalizeModelId(model);
|
|
54
|
+
return normalizeModelId(model, ladder);
|
|
47
55
|
}
|
|
48
56
|
/**
|
|
49
57
|
* Explicit 1M markers a caller can spell into the model id.
|
|
@@ -77,7 +85,7 @@ const WEB_SEARCH_VENDOR_TOKENS = Object.freeze([
|
|
|
77
85
|
* to the ported predicates for uncatalogued ids -- want `resolveModel`.
|
|
78
86
|
*/
|
|
79
87
|
export function modelCapability(model, capability, profile = CLAUDE_CODE_2_1_195_PROFILE) {
|
|
80
|
-
const id = normalizedOrNull(model);
|
|
88
|
+
const id = normalizedOrNull(model, modelIdLadder(profile));
|
|
81
89
|
if (id === null ||
|
|
82
90
|
typeof capability !== "string" ||
|
|
83
91
|
capability.length === 0) {
|
|
@@ -89,6 +97,22 @@ export function modelCapability(model, capability, profile = CLAUDE_CODE_2_1_195
|
|
|
89
97
|
}
|
|
90
98
|
return entry.capabilities.includes(capability);
|
|
91
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* The catalogue entry the profile's own normalizer resolves `model` to, or
|
|
102
|
+
* `undefined` when the model is not a string, is empty, or the profile does not
|
|
103
|
+
* catalogue the resolved id.
|
|
104
|
+
*
|
|
105
|
+
* Folding-consistent: under a profile that follows the base ladder,
|
|
106
|
+
* `claude-sonnet-5-5` resolves to the `claude-sonnet-5` entry, exactly as the
|
|
107
|
+
* request builder resolves it for that profile.
|
|
108
|
+
*/
|
|
109
|
+
export function modelCatalogueEntry(model, profile = CLAUDE_CODE_2_1_195_PROFILE) {
|
|
110
|
+
const id = normalizedOrNull(model, modelIdLadder(profile));
|
|
111
|
+
if (id === null || !Object.hasOwn(profile.supportedModels, id)) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
return profile.supportedModels[id];
|
|
115
|
+
}
|
|
92
116
|
/** Whether `model` normalizes to `claude-opus-4-6`. */
|
|
93
117
|
export function isOpus46Model(model) {
|
|
94
118
|
return normalizedOrNull(model) === "claude-opus-4-6";
|
|
@@ -117,6 +141,22 @@ export function isSonnet46Model(model) {
|
|
|
117
141
|
export function isSonnet5Model(model) {
|
|
118
142
|
return normalizedOrNull(model) === "claude-sonnet-5";
|
|
119
143
|
}
|
|
144
|
+
/** Whether `model` normalizes to `claude-sonnet-5-5` (internal). */
|
|
145
|
+
function isSonnet55Model(model) {
|
|
146
|
+
return normalizedOrNull(model) === "claude-sonnet-5-5";
|
|
147
|
+
}
|
|
148
|
+
/** Whether `model` normalizes to `claude-haiku-5-5` (internal). */
|
|
149
|
+
function isHaiku55Model(model) {
|
|
150
|
+
return normalizedOrNull(model) === "claude-haiku-5-5";
|
|
151
|
+
}
|
|
152
|
+
/** Whether `model` normalizes to `claude-fable-5-2` (internal). */
|
|
153
|
+
function isFable52Model(model) {
|
|
154
|
+
return normalizedOrNull(model) === "claude-fable-5-2";
|
|
155
|
+
}
|
|
156
|
+
/** Whether `model` normalizes to `claude-mythos-5-2` (internal). */
|
|
157
|
+
function isMythos52Model(model) {
|
|
158
|
+
return normalizedOrNull(model) === "claude-mythos-5-2";
|
|
159
|
+
}
|
|
120
160
|
/** Whether `model` normalizes to `claude-fable-5`. */
|
|
121
161
|
export function isFable5Model(model) {
|
|
122
162
|
return normalizedOrNull(model) === "claude-fable-5";
|
|
@@ -162,7 +202,7 @@ export function isClaude3Model(model) {
|
|
|
162
202
|
* catalogue -- the ported family set (`claude-sonnet-4*`, Opus 4.6/4.7/4.8).
|
|
163
203
|
*/
|
|
164
204
|
export function isEligibleFor1MContext(model, profile = CLAUDE_CODE_2_1_195_PROFILE) {
|
|
165
|
-
const id = normalizedOrNull(model);
|
|
205
|
+
const id = normalizedOrNull(model, modelIdLadder(profile));
|
|
166
206
|
if (id === null) {
|
|
167
207
|
return false;
|
|
168
208
|
}
|
|
@@ -224,9 +264,13 @@ export function isAdaptiveThinkingModel(model) {
|
|
|
224
264
|
isOpus55Model(model) ||
|
|
225
265
|
isSonnet46Model(model) ||
|
|
226
266
|
isSonnet5Model(model) ||
|
|
267
|
+
isSonnet55Model(model) ||
|
|
268
|
+
isHaiku55Model(model) ||
|
|
227
269
|
isFable5Model(model) ||
|
|
228
270
|
isFable51Model(model) ||
|
|
271
|
+
isFable52Model(model) ||
|
|
229
272
|
isMythos5Model(model) ||
|
|
230
|
-
isMythos51Model(model)
|
|
273
|
+
isMythos51Model(model) ||
|
|
274
|
+
isMythos52Model(model));
|
|
231
275
|
}
|
|
232
276
|
//# sourceMappingURL=model-queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-queries.js","sourceRoot":"","sources":["../src/model-queries.ts"],"names":[],"mappings":"AAAA,4CAA4C;
|
|
1
|
+
{"version":3,"file":"model-queries.js","sourceRoot":"","sources":["../src/model-queries.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAM5C,OAAO,EAAE,yBAAyB,IAAI,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CACvB,KAAa,EACb,SAAwB,UAAU;IAElC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,uCAAuC,CAAC;AAEtE,0EAA0E;AAC1E,MAAM,8BAA8B,GAClC,8CAA8C,CAAC;AAEjD;;;;GAIG;AACH,MAAM,wBAAwB,GAAsB,MAAM,CAAC,MAAM,CAAC;IAChE,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,KA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version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;AAWxB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;CAC/C;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,yBAAuD,GAC/D,uBAAuB,CAuBzB"}
|
package/dist/models.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
import { ClaudeCodeWireError } from "./contracts.js";
|
|
3
3
|
import { deriveCapabilities } from "./model-capabilities.js";
|
|
4
|
-
import { modelFamilyOf, normalizeModelId, stripModelMarkers, } from "./model-identity.js";
|
|
4
|
+
import { modelFamilyOf, modelIdLadder, normalizeModelId, stripModelMarkers, } from "./model-identity.js";
|
|
5
5
|
import { CLAUDE_CODE_2_1_195_PROFILE } from "./profiles/claude-code-2.1.195.js";
|
|
6
6
|
export function resolveModel(model, profile = CLAUDE_CODE_2_1_195_PROFILE) {
|
|
7
7
|
if (typeof model !== "string" || model.length === 0) {
|
|
8
8
|
throw new ClaudeCodeWireError("INVALID_INPUT", { model });
|
|
9
9
|
}
|
|
10
10
|
const wireId = stripModelMarkers(model);
|
|
11
|
-
const id = normalizeModelId(model);
|
|
11
|
+
const id = normalizeModelId(model, modelIdLadder(profile));
|
|
12
12
|
const entry = Object.hasOwn(profile.supportedModels, id)
|
|
13
13
|
? profile.supportedModels[id]
|
|
14
14
|
: undefined;
|
package/dist/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAO5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAShF,MAAM,UAAU,YAAY,CAC1B,KAAa,EACb,UAAqC,2BAA2B;IAEhE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAO5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAShF,MAAM,UAAU,YAAY,CAC1B,KAAa,EACb,UAAqC,2BAA2B;IAEhE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,mBAAmB,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;QACtD,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7B,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE;QACF,MAAM;QACN,sEAAsE;QACtE,mEAAmE;QACnE,uEAAuE;QACvE,iEAAiE;QACjE,yEAAyE;QACzE,iEAAiE;QACjE,4DAA4D;QAC5D,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,aAAa,CAAC,EAAE,CAAC;QAC1C,YAAY,EAAE,kBAAkB,CAAC,EAAE,EAAE,OAAO,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -50,6 +50,78 @@ export interface ClaudeCodeProfileBehaviors {
|
|
|
50
50
|
* predicate is wire-authoritative for that profile alone.
|
|
51
51
|
*/
|
|
52
52
|
readonly opus45EffortException: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether `messages` may carry `role: "system"` control messages with an
|
|
55
|
+
* `output_config` (the per-turn effort and timing statements).
|
|
56
|
+
*
|
|
57
|
+
* Consumed by the message canonicaliser in `request-body.ts`. False means
|
|
58
|
+
* such a message is refused with `INVALID_INPUT`, which is what every
|
|
59
|
+
* profile did before the shape was transcribed.
|
|
60
|
+
*/
|
|
61
|
+
readonly perTurnControlMessages: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether `supportsMidConversationSystem` reads the profile's catalogue
|
|
64
|
+
* (`mid_conv_system` capability string) before falling back to the
|
|
65
|
+
* predicate. False means the predicate alone decides, which is what a client
|
|
66
|
+
* that retired the catalogue string does.
|
|
67
|
+
*
|
|
68
|
+
* Consumed by `supportsMidConversationSystem` in `model-capabilities.ts`.
|
|
69
|
+
*/
|
|
70
|
+
readonly midConversationSystemFromCatalogue: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the thinking-token-count beta is pushed after the per-request
|
|
73
|
+
* sites (site 6′) instead of at its historical position (site 6).
|
|
74
|
+
*
|
|
75
|
+
* Consumed by `composeBetasWithAudit` in `betas.ts`.
|
|
76
|
+
*/
|
|
77
|
+
readonly thinkingTokenCountAfterRequestTable: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the 1M-context beta is withheld for a model whose catalogue entry
|
|
80
|
+
* already declares a native 1M window.
|
|
81
|
+
*
|
|
82
|
+
* Consumed by site 3 of `composeBetasWithAudit` in `betas.ts`.
|
|
83
|
+
*/
|
|
84
|
+
readonly longContextExcludesNative1m: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the model-id normalizer uses the extended ladder (the 5.5 and 5.2
|
|
87
|
+
* rungs). Declared ahead of its reader; inert until the normalizer reads it.
|
|
88
|
+
*/
|
|
89
|
+
readonly extendedModelIdLadder: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Whether headers use the genuine client's layout (names, casing, ordering
|
|
92
|
+
* and the request-class set). Declared ahead of its reader; inert until the
|
|
93
|
+
* header builder reads it.
|
|
94
|
+
*/
|
|
95
|
+
readonly genuineHeaderLayout: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the billing block carries the turn-origin and turn-position
|
|
98
|
+
* segments. Declared ahead of its reader; inert until the fingerprint
|
|
99
|
+
* module reads it.
|
|
100
|
+
*/
|
|
101
|
+
readonly billingTurnSegments: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the request body carries a generated `context_management` when
|
|
104
|
+
* the beta fires. Consumed by `buildCanonicalBody` in `request-body.ts`.
|
|
105
|
+
*/
|
|
106
|
+
readonly generatedContextManagement: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Whether the request body carries `diagnostics` alongside the cache
|
|
109
|
+
* diagnosis beta. Consumed by `buildCanonicalBody` in `request-body.ts`.
|
|
110
|
+
*/
|
|
111
|
+
readonly cacheDiagnosisBody: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Whether body keys are emitted in the genuine client's order. Consumed by
|
|
114
|
+
* `buildCanonicalBody` in `request-body.ts`.
|
|
115
|
+
*/
|
|
116
|
+
readonly genuineBodyKeyOrder: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Whether caller-supplied account-served inputs (dispatch id, inline tools,
|
|
119
|
+
* threads, side-query and agentic-query markers) are honoured. The dispatch
|
|
120
|
+
* id is read by the header builder in `headers.ts`; the others by the beta
|
|
121
|
+
* composer in `betas.ts` and, for the thread body, the body builder in
|
|
122
|
+
* `request-body.ts`.
|
|
123
|
+
*/
|
|
124
|
+
readonly accountServedInputs: boolean;
|
|
53
125
|
}
|
|
54
126
|
/**
|
|
55
127
|
* Resolves the behaviour set a profile follows.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-behaviors.d.ts","sourceRoot":"","sources":["../src/profile-behaviors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"profile-behaviors.d.ts","sourceRoot":"","sources":["../src/profile-behaviors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAIhE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAE7C;;;;;;;OAOG;IACH,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAEvC;;;;;;;;OAQG;IACH,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IAExC;;;;;;;OAOG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAEzC;;;;;;;OAOG;IACH,QAAQ,CAAC,kCAAkC,EAAE,OAAO,CAAC;IAErD;;;;;OAKG;IACH,QAAQ,CAAC,mCAAmC,EAAE,OAAO,CAAC;IAEtD;;;;;OAKG;IACH,QAAQ,CAAC,2BAA2B,EAAE,OAAO,CAAC;IAE9C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IAExC;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IAEtC;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IAEtC;;;OAGG;IACH,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAE7C;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IAEtC;;;;;;OAMG;IACH,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;CACvC;AAsED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,yBAAyB,GACjC,0BAA0B,CA2B5B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
import { CLAUDE_CODE_2_1_195_PROFILE } from "./profiles/claude-code-2.1.195.js";
|
|
3
|
+
import { CLAUDE_CODE_2_1_329_PROFILE } from "./profiles/claude-code-2.1.329.js";
|
|
3
4
|
/**
|
|
4
5
|
* Upstream 2.1.195: derivation is predicate-driven, the request builder has no
|
|
5
6
|
* request-derived token ceiling, and the billing block has no parameter for
|
|
@@ -9,16 +10,61 @@ const LEGACY_BEHAVIORS = Object.freeze({
|
|
|
9
10
|
requestDerivedTokenCeiling: false,
|
|
10
11
|
billingChainSegments: false,
|
|
11
12
|
opus45EffortException: true,
|
|
13
|
+
perTurnControlMessages: false,
|
|
14
|
+
midConversationSystemFromCatalogue: true,
|
|
15
|
+
thinkingTokenCountAfterRequestTable: false,
|
|
16
|
+
longContextExcludesNative1m: false,
|
|
17
|
+
extendedModelIdLadder: false,
|
|
18
|
+
genuineHeaderLayout: false,
|
|
19
|
+
billingTurnSegments: false,
|
|
20
|
+
generatedContextManagement: false,
|
|
21
|
+
cacheDiagnosisBody: false,
|
|
22
|
+
genuineBodyKeyOrder: false,
|
|
23
|
+
accountServedInputs: false,
|
|
12
24
|
});
|
|
13
25
|
/**
|
|
14
|
-
* Upstream 2.1.222
|
|
26
|
+
* Upstream 2.1.222 through 2.1.280: derivation is catalogue-first, so the
|
|
15
27
|
* `claude-opus-4-5` exception does not apply, and both of the newer request
|
|
16
|
-
* behaviours are present.
|
|
28
|
+
* behaviours are present. This is also where a profile with an unrecognised id
|
|
29
|
+
* lands.
|
|
17
30
|
*/
|
|
18
|
-
const
|
|
31
|
+
const CATALOGUE_ERA_BEHAVIORS = Object.freeze({
|
|
19
32
|
requestDerivedTokenCeiling: true,
|
|
20
33
|
billingChainSegments: true,
|
|
21
34
|
opus45EffortException: false,
|
|
35
|
+
perTurnControlMessages: false,
|
|
36
|
+
midConversationSystemFromCatalogue: true,
|
|
37
|
+
thinkingTokenCountAfterRequestTable: false,
|
|
38
|
+
longContextExcludesNative1m: false,
|
|
39
|
+
extendedModelIdLadder: false,
|
|
40
|
+
genuineHeaderLayout: false,
|
|
41
|
+
billingTurnSegments: false,
|
|
42
|
+
generatedContextManagement: false,
|
|
43
|
+
cacheDiagnosisBody: false,
|
|
44
|
+
genuineBodyKeyOrder: false,
|
|
45
|
+
accountServedInputs: false,
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Upstream 2.1.329: the catalogue-era set with the wire-level differences the
|
|
49
|
+
* 2.1.329 analysis records. Every flag that is true here and false in the other
|
|
50
|
+
* two sets is a behaviour the older clients do not have; the flags declared
|
|
51
|
+
* ahead of their readers are inert until a later change reads them.
|
|
52
|
+
*/
|
|
53
|
+
const WIRE_FAITHFUL_BEHAVIORS = Object.freeze({
|
|
54
|
+
requestDerivedTokenCeiling: true,
|
|
55
|
+
billingChainSegments: true,
|
|
56
|
+
opus45EffortException: false,
|
|
57
|
+
perTurnControlMessages: true,
|
|
58
|
+
midConversationSystemFromCatalogue: false,
|
|
59
|
+
thinkingTokenCountAfterRequestTable: true,
|
|
60
|
+
longContextExcludesNative1m: true,
|
|
61
|
+
extendedModelIdLadder: true,
|
|
62
|
+
genuineHeaderLayout: true,
|
|
63
|
+
billingTurnSegments: true,
|
|
64
|
+
generatedContextManagement: true,
|
|
65
|
+
cacheDiagnosisBody: true,
|
|
66
|
+
genuineBodyKeyOrder: true,
|
|
67
|
+
accountServedInputs: true,
|
|
22
68
|
});
|
|
23
69
|
/**
|
|
24
70
|
* Resolves the behaviour set a profile follows.
|
|
@@ -30,24 +76,29 @@ export function profileBehaviors(profile) {
|
|
|
30
76
|
/*
|
|
31
77
|
* ---- Demarcated: the ONLY per-version identity comparison in `src/`. ----
|
|
32
78
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
79
|
+
* Three sets, two named identities. 2.1.195 is the one profile ported from
|
|
80
|
+
* the older builder; 2.1.329 is the one profile whose wire behaviour was
|
|
81
|
+
* transcribed from a client that no longer reads the catalogue for
|
|
82
|
+
* everything the earlier ones did. Both are named here because each differs
|
|
83
|
+
* in what the upstream builder is written to do, not in values it reads
|
|
84
|
+
* from a catalogue.
|
|
37
85
|
*
|
|
38
|
-
* The
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* — every new profile would silently regress to
|
|
86
|
+
* The fallthrough is deliberately the CATALOGUE-ERA side, and it stays
|
|
87
|
+
* pre-329: a profile whose id is unrecognised (an overridden id, a synthetic
|
|
88
|
+
* profile) keeps the bytes it had before 2.1.329 existed. Adopting the
|
|
89
|
+
* wire-faithful set is something a profile must opt into by being named
|
|
90
|
+
* here, never something it can inherit by accident. Written the other way
|
|
91
|
+
* round — defaulting to legacy — every new profile would silently regress to
|
|
92
|
+
* 2.1.195 semantics.
|
|
44
93
|
*
|
|
45
94
|
* `test/governance/version-dispatch.test.ts` asserts this comparison is
|
|
46
95
|
* here, and that it is nowhere else.
|
|
47
96
|
*/
|
|
48
|
-
if (profile.id === CLAUDE_CODE_2_1_195_PROFILE.id)
|
|
97
|
+
if (profile.id === CLAUDE_CODE_2_1_195_PROFILE.id)
|
|
49
98
|
return LEGACY_BEHAVIORS;
|
|
99
|
+
if (profile.id === CLAUDE_CODE_2_1_329_PROFILE.id) {
|
|
100
|
+
return WIRE_FAITHFUL_BEHAVIORS;
|
|
50
101
|
}
|
|
51
|
-
return
|
|
102
|
+
return CATALOGUE_ERA_BEHAVIORS;
|
|
52
103
|
}
|
|
53
104
|
//# sourceMappingURL=profile-behaviors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-behaviors.js","sourceRoot":"","sources":["../src/profile-behaviors.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAG5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"profile-behaviors.js","sourceRoot":"","sources":["../src/profile-behaviors.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAG5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AA4IhF;;;;GAIG;AACH,MAAM,gBAAgB,GAA+B,MAAM,CAAC,MAAM,CAAC;IACjE,0BAA0B,EAAE,KAAK;IACjC,oBAAoB,EAAE,KAAK;IAC3B,qBAAqB,EAAE,IAAI;IAC3B,sBAAsB,EAAE,KAAK;IAC7B,kCAAkC,EAAE,IAAI;IACxC,mCAA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