@tormentalabs/claude-code-wire-compat 0.1.0-rc.17 → 0.2.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 (80) hide show
  1. package/CHANGELOG.md +101 -2
  2. package/README.md +67 -2
  3. package/dist/betas.d.ts +37 -0
  4. package/dist/betas.d.ts.map +1 -1
  5. package/dist/betas.js +55 -23
  6. package/dist/betas.js.map +1 -1
  7. package/dist/build-request.d.ts +11 -0
  8. package/dist/build-request.d.ts.map +1 -1
  9. package/dist/build-request.js +133 -11
  10. package/dist/build-request.js.map +1 -1
  11. package/dist/contracts.d.ts +53 -0
  12. package/dist/contracts.d.ts.map +1 -1
  13. package/dist/contracts.js.map +1 -1
  14. package/dist/fingerprint.d.ts +29 -2
  15. package/dist/fingerprint.d.ts.map +1 -1
  16. package/dist/fingerprint.js +60 -7
  17. package/dist/fingerprint.js.map +1 -1
  18. package/dist/headers.d.ts.map +1 -1
  19. package/dist/headers.js +12 -4
  20. package/dist/headers.js.map +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/model-capabilities.d.ts +31 -3
  26. package/dist/model-capabilities.d.ts.map +1 -1
  27. package/dist/model-capabilities.js +145 -12
  28. package/dist/model-capabilities.js.map +1 -1
  29. package/dist/models.d.ts.map +1 -1
  30. package/dist/models.js +8 -4
  31. package/dist/models.js.map +1 -1
  32. package/dist/profile-behaviors.d.ts +61 -0
  33. package/dist/profile-behaviors.d.ts.map +1 -0
  34. package/dist/profile-behaviors.js +53 -0
  35. package/dist/profile-behaviors.js.map +1 -0
  36. package/dist/profiles/beta-registry-2.1.233.d.ts +140 -0
  37. package/dist/profiles/beta-registry-2.1.233.d.ts.map +1 -0
  38. package/dist/profiles/beta-registry-2.1.233.js +183 -0
  39. package/dist/profiles/beta-registry-2.1.233.js.map +1 -0
  40. package/dist/profiles/claude-code-2.1.195.d.ts.map +1 -1
  41. package/dist/profiles/claude-code-2.1.195.js +14 -0
  42. package/dist/profiles/claude-code-2.1.195.js.map +1 -1
  43. package/dist/profiles/claude-code-2.1.233.d.ts +3 -0
  44. package/dist/profiles/claude-code-2.1.233.d.ts.map +1 -0
  45. package/dist/profiles/claude-code-2.1.233.js +235 -0
  46. package/dist/profiles/claude-code-2.1.233.js.map +1 -0
  47. package/dist/redaction.d.ts.map +1 -1
  48. package/dist/redaction.js +14 -1
  49. package/dist/redaction.js.map +1 -1
  50. package/dist/request-body.d.ts.map +1 -1
  51. package/dist/request-body.js +12 -10
  52. package/dist/request-body.js.map +1 -1
  53. package/dist/thinking.d.ts +33 -7
  54. package/dist/thinking.d.ts.map +1 -1
  55. package/dist/thinking.js +105 -36
  56. package/dist/thinking.js.map +1 -1
  57. package/package.json +10 -2
  58. package/src/anti-verbosity.ts +219 -0
  59. package/src/beta-registry.ts +140 -0
  60. package/src/betas.ts +302 -0
  61. package/src/build-request.ts +1799 -0
  62. package/src/contracts.ts +1286 -0
  63. package/src/count-tokens.ts +84 -0
  64. package/src/fingerprint.ts +155 -0
  65. package/src/headers.ts +448 -0
  66. package/src/index.ts +63 -0
  67. package/src/metadata.ts +331 -0
  68. package/src/model-capabilities.ts +453 -0
  69. package/src/model-identity.ts +45 -0
  70. package/src/models.ts +50 -0
  71. package/src/profile-behaviors.ts +114 -0
  72. package/src/profiles/beta-registry-2.1.233.ts +200 -0
  73. package/src/profiles/claude-code-2.1.195.ts +168 -0
  74. package/src/profiles/claude-code-2.1.233.ts +240 -0
  75. package/src/redaction.ts +536 -0
  76. package/src/request-body.ts +1931 -0
  77. package/src/sha256.ts +114 -0
  78. package/src/system-prompt.ts +222 -0
  79. package/src/thinking.ts +346 -0
  80. package/src/unicode.ts +24 -0
package/CHANGELOG.md CHANGED
@@ -2,7 +2,106 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.1.0-rc.17] - Unreleased
5
+ ## [0.2.0] - 2026-08-15
6
+
7
+ ### Breaking
8
+
9
+ - **The default protocol profile is now Claude Code 2.1.233 (SDK 0.112.1).** Any
10
+ call to `buildClaudeCodeRequest`, `buildClaudeCodeCountTokensRequest` or
11
+ `parseBuiltClaudeCodeRequest` that does not pass `profile` explicitly now
12
+ produces the 2.1.233 wire shape instead of the 2.1.195 one. Concretely, a
13
+ default-profile request changes in all of the following ways:
14
+
15
+ - the user agent becomes `claude-cli/2.1.233 (external, cli)`;
16
+ - `x-stainless-package-version` becomes `0.112.1`;
17
+ - `anthropic-beta` is selected from the 2.1.233 beta registry (31 entries).
18
+ `summarize-connector-text-2026-03-13` no longer exists upstream, so
19
+ `betaPolicy.narrationSummariesEnabled` is inert under the default profile —
20
+ it is still accepted, and still effective under the 2.1.195 profile;
21
+ - the model catalogue has 17 entries, adding `claude-sonnet-5`,
22
+ `claude-opus-5` and `claude-mythos-5`;
23
+ - the canonical billing block announces `cc_version=2.1.233.<fp>`.
24
+
25
+ **To keep the previous behaviour, pass the exported
26
+ `CLAUDE_CODE_2_1_195_PROFILE` singleton as `profile`.** Its output is
27
+ byte-identical to `0.1.0` — headers, body and evidence digest — so pinning it
28
+ is a complete rollback of this change with no other edit required.
29
+
30
+ ### Added
31
+
32
+ - **`CLAUDE_CODE_2_1_233_PROFILE`**, exported from the package root and from the
33
+ new `./profiles/claude-code-2.1.233` subpath, alongside the existing
34
+ `CLAUDE_CODE_2_1_195_PROFILE` and `./profiles/claude-code-2.1.195`. Both are
35
+ pinned singletons: the fail-closed rule is unchanged, and any other object —
36
+ including a structurally identical clone — is still rejected with
37
+ `INVALID_INPUT`.
38
+ - **`ClaudeCodeRequestInput.previousRequestId` and
39
+ `ClaudeCodeRequestInput.promptId`**, both optional. Under the 2.1.233 profile
40
+ they are emitted as the `cc_prev_req` and `cc_prompt_id` segments of the
41
+ canonical billing block. A value whose format is not recognised is omitted
42
+ silently rather than rejected, matching the genuine client, and neither field
43
+ is emitted under the 2.1.195 profile.
44
+ - **A request-derived upper bound on output tokens under 2.1.233.** A request
45
+ asking for `maxTokens >= 4096` raises the ceiling applied to `max_tokens`
46
+ instead of being clamped to the model's default limit, mirroring upstream.
47
+ The 2.1.195 profile keeps the previous clamp.
48
+ - **`maxOutputTokens` on catalogue entries.** Every model entry now carries its
49
+ own output-token limit, so the limit a request is clamped against is readable
50
+ from the profile rather than implied.
51
+ - Per-version behaviour is data-driven: a profile is data, and the behaviour it
52
+ selects is internal. Selecting a profile is therefore the only supported way
53
+ to select a protocol version, and adding a version does not change any
54
+ existing one.
55
+
56
+ ### Changed
57
+
58
+ - **Capabilities and token limits are resolved from the active profile's
59
+ catalogue** rather than from a single pinned table. Requests built with
60
+ `CLAUDE_CODE_2_1_195_PROFILE` are byte-identical to `0.1.0`, which
61
+ `npm run test:pack` confirms by an unchanged consumer digest.
62
+
63
+ ### Fixed
64
+
65
+ - **Evidence parsing follows the profile it was given.** `parseBuiltClaudeCodeRequest`
66
+ validated evidence against the pinned profile regardless of which profile
67
+ built the request, so a round trip through a non-default profile failed. It
68
+ now reads the validated profile, and every profile round-trips.
69
+
70
+ ## [0.1.0] - 2026-07-28
71
+
72
+ First stable release.
73
+
74
+ There is NO runtime code change relative to `0.1.0-rc.17`:
75
+ `git diff --stat 5c6881b d7e2901 -- src package.json` is empty, so `dist/` is
76
+ byte-identical to the `0.1.0-rc.17` build. Everything this release contains is
77
+ described in the release candidate entries below; they are not repeated here.
78
+ The packed content differs from `0.1.0-rc.17` by `README.md` and by the added
79
+ TypeScript sources described below — the executed code is unchanged, which
80
+ `npm run test:pack` confirms by an unchanged consumer digest.
81
+
82
+ ### Added
83
+
84
+ - **The tarball now ships the TypeScript sources.** `src` is added to the
85
+ `files` allowlist. The build emits 40 `.js.map` and `.d.ts.map` files that
86
+ reference `../src/*.ts` and carry no `sourcesContent`, so every source map in
87
+ the published package resolved to nothing in a consumer's debugger. Shipping
88
+ the sources is also the coherent option for a GPL-3.0-or-later package whose
89
+ `NOTICE` already offers corresponding source: the offer and the tarball now
90
+ agree. Only `.ts` files are packed under `src/`, pinned exactly by
91
+ `test/pack/pack-policy.test.ts`; the allowlist itself is pinned by
92
+ `test/governance/release-policy.test.ts` and
93
+ `test/governance/package-policy.test.ts`.
94
+ - The ported protocol-documentation corpus and `docs/ATTRIBUTION.md` are now in
95
+ the repository. Neither is packed into the tarball.
96
+
97
+ ### Changed
98
+
99
+ - `README.md` no longer describes the package as a bootstrap release candidate
100
+ whose request-building behavior arrives later. That statement was false — the
101
+ package builds and parses requests — and it was the text rendered on the
102
+ npmjs.com package page.
103
+
104
+ ## [0.1.0-rc.17] - 2026-07-28
6
105
 
7
106
  ### Added
8
107
 
@@ -99,7 +198,7 @@ All notable changes to this project will be documented in this file.
99
198
  together. The build path now subtracts one slot per canonical block that
100
199
  actually survived.
101
200
 
102
- ## [0.1.0-rc.16] - Unreleased
201
+ ## [0.1.0-rc.16] - 2026-07-28
103
202
 
104
203
  ### Added
105
204
 
package/README.md CHANGED
@@ -4,7 +4,7 @@ Claude Wire Compat
4
4
 
5
5
  An ESM-only, runtime-neutral TypeScript package for constructing a pinned Claude Code Messages wire contract.
6
6
 
7
- > **Status:** bootstrap release candidate. Runtime request-building behavior is intentionally introduced in later releases.
7
+ > **Status:** stable. `buildClaudeCodeRequest` and `parseBuiltClaudeCodeRequest` build and read back the pinned wire contract. The package performs no I/O: credentials, transport, persistence, refresh coordination, and retries remain the consumer's responsibility.
8
8
 
9
9
  ## Package
10
10
 
@@ -16,7 +16,72 @@ The package targets Node.js 20 or newer and is designed to remain portable to Bu
16
16
 
17
17
  ## Protocol profile
18
18
 
19
- The only accepted `profile` value is the exported `CLAUDE_CODE_2_1_195_PROFILE` singleton. Any other object, even a structurally identical clone, is rejected with `ClaudeCodeWireError` code `INVALID_INPUT`. This deliberate fail-closed behaviour prevents callers from substituting an unpinned protocol profile.
19
+ Two pinned profiles are exported:
20
+
21
+ - `CLAUDE_CODE_2_1_233_PROFILE` — Claude Code 2.1.233 with SDK 0.112.1. This is the profile used when `profile` is omitted.
22
+ - `CLAUDE_CODE_2_1_195_PROFILE` — the previous pin, Claude Code 2.1.195 with SDK 0.94.0.
23
+
24
+ Either can be selected explicitly by passing the singleton as the `profile` argument, from the package root or from its own subpath export:
25
+
26
+ ```ts
27
+ import { CLAUDE_CODE_2_1_195_PROFILE } from "@tormentalabs/claude-code-wire-compat/profiles/claude-code-2.1.195";
28
+ import { CLAUDE_CODE_2_1_233_PROFILE } from "@tormentalabs/claude-code-wire-compat/profiles/claude-code-2.1.233";
29
+ ```
30
+
31
+ The fail-closed rule is unchanged: only these exported singletons are accepted. Any other object, even a structurally identical clone, is rejected with `ClaudeCodeWireError` code `INVALID_INPUT`. This prevents callers from substituting an unpinned protocol profile.
32
+
33
+ ## Protocol documentation
34
+
35
+ The wire contract this package pins was reverse engineered before it was
36
+ implemented. That research is preserved under [`docs/protocol/`](./docs/protocol)
37
+ so a future maintainer can re-derive the contract when Claude Code ships a new
38
+ version. It is ported verbatim from
39
+ [opencode-anthropic-fix](https://github.com/marco-jardim/opencode-anthropic-fix)
40
+ at commit `466d500` under GPL-3.0-or-later; every file carries a provenance
41
+ header and is listed in [docs/ATTRIBUTION.md](./docs/ATTRIBUTION.md).
42
+
43
+ **These documents describe the upstream plugin and Claude Code itself, not this
44
+ package's API.** The normative mapping from those findings to this package's
45
+ contract is [docs/source-trace.md](./docs/source-trace.md).
46
+
47
+ Protocol knowledge corpus:
48
+
49
+ - [Reverse engineering](./docs/protocol/reverse-engineering.md) — the full
50
+ authentication and API reverse-engineering record.
51
+ - [HTTP headers and system prompt](./docs/protocol/http-headers-and-system-prompt.md)
52
+ — header composition and system-prompt mimicry.
53
+ - [Fingerprint extraction](./docs/protocol/fingerprint-extraction.md) — how the
54
+ client fingerprint and metadata are derived.
55
+ - [Message flow](./docs/protocol/message-flow.md) — end-to-end request and
56
+ response flow.
57
+ - [Tool use examples](./docs/protocol/tool-use-examples.md) — tool_use and
58
+ tool_result pairing in practice.
59
+ - [Code comparison reference](./docs/protocol/code-comparison-reference.md) —
60
+ side-by-side comparison against the genuine client.
61
+ - [Divergence analysis](./docs/protocol/divergence-analysis.md) — every observed
62
+ divergence from the genuine client.
63
+ - [Divergence executive summary](./docs/protocol/divergence-executive-summary.md)
64
+ — the condensed version of that analysis.
65
+ - [Quick reference](./docs/protocol/quick-reference.md) — condensed lookup of
66
+ headers, betas, and switches.
67
+ - [System-prompt search results](./docs/protocol/system-prompt-search-results.md)
68
+ — where each system-prompt fragment was found in the analysed build.
69
+ - [Cache transparency](./docs/protocol/cache-transparency.md) — anti-verbosity
70
+ and prompt-cache observability.
71
+ - [Beta decision table](./docs/protocol/beta-decision-table.md) — which beta
72
+ identifiers are sent under which conditions.
73
+
74
+ Per-version wire analyses — [why they exist and when a new one is
75
+ required](./docs/protocol/versions/README.md):
76
+
77
+ - [Claude Code 2.1.119](./docs/protocol/versions/claude-code-2.1.119-analysis.md)
78
+ - [Claude Code 2.1.133](./docs/protocol/versions/claude-code-2.1.133-analysis.md)
79
+ - [Claude Code 2.1.143](./docs/protocol/versions/claude-code-2.1.143-analysis.md)
80
+ - [Claude Code 2.1.150](./docs/protocol/versions/claude-code-2.1.150-analysis.md)
81
+ - [Claude Code 2.1.159](./docs/protocol/versions/claude-code-2.1.159-analysis.md)
82
+ - [Claude Code 2.1.195](./docs/protocol/versions/claude-code-2.1.195-analysis.md)
83
+ - [Claude Code 2.1.233](./docs/protocol/versions/claude-code-2.1.233-analysis.md)
84
+ — the release this package's profile pins.
20
85
 
21
86
  ## Development
22
87
 
package/dist/betas.d.ts CHANGED
@@ -1,4 +1,40 @@
1
1
  import type { ClaudeCodeCapabilities, ClaudeCodeProtocolProfile } from "./contracts.js";
2
+ /** Structural shape of a registry entry, shared by every registry version. */
3
+ interface BetaRegistryEntry {
4
+ readonly featureKey: string;
5
+ readonly header: string;
6
+ }
7
+ /**
8
+ * The entries the push sites below require, as a structural contract rather
9
+ * than a reference to one concrete registry.
10
+ *
11
+ * Registry versions have different key sets. Every key here except
12
+ * `NARRATION_SUMMARIES` is present in all of them, so those push sites index
13
+ * directly. `NARRATION_SUMMARIES` is optional because upstream removed it after
14
+ * 2.1.195 (see `src/profiles/beta-registry-2.1.233.ts`): its push site survives
15
+ * and becomes inert when the resolved registry has no entry to push. Making the
16
+ * optionality part of the TYPE is what forces every future registry to be
17
+ * checked against the push sites at compile time instead of at runtime.
18
+ */
19
+ export interface ComposableBetaRegistry {
20
+ readonly CLAUDE_CODE: BetaRegistryEntry;
21
+ readonly OAUTH_AUTH: BetaRegistryEntry;
22
+ readonly LONG_CONTEXT: BetaRegistryEntry;
23
+ readonly INTERLEAVED_THINKING: BetaRegistryEntry;
24
+ readonly REDACT_THINKING: BetaRegistryEntry;
25
+ readonly THINKING_TOKEN_COUNT: BetaRegistryEntry;
26
+ readonly CONTEXT_MANAGEMENT: BetaRegistryEntry;
27
+ readonly STRUCTURED_OUTPUTS: BetaRegistryEntry;
28
+ readonly PROMPT_CACHING_SCOPE: BetaRegistryEntry;
29
+ readonly MID_CONVERSATION_SYSTEM: BetaRegistryEntry;
30
+ readonly EFFORT: BetaRegistryEntry;
31
+ readonly SPEED: BetaRegistryEntry;
32
+ readonly AFK_MODE: BetaRegistryEntry;
33
+ readonly EXTENDED_CACHE_TTL: BetaRegistryEntry;
34
+ readonly CONTEXT_HINT: BetaRegistryEntry;
35
+ readonly CACHE_DIAGNOSIS: BetaRegistryEntry;
36
+ readonly NARRATION_SUMMARIES?: BetaRegistryEntry;
37
+ }
2
38
  export interface ComposeBetasInput {
3
39
  readonly rawModel: string;
4
40
  readonly normalizedId: string;
@@ -39,4 +75,5 @@ export interface ComposedBetas {
39
75
  }
40
76
  export declare function composeBetas(input: ComposeBetasInput, profile?: ClaudeCodeProtocolProfile): readonly string[];
41
77
  export declare function composeBetasWithAudit(input: ComposeBetasInput, profile?: ClaudeCodeProtocolProfile): ComposedBetas;
78
+ export {};
42
79
  //# sourceMappingURL=betas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"betas.d.ts","sourceRoot":"","sources":["../src/betas.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;AAmBxB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;IAC9C,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD;AAkCD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,yBAAuD,GAC/D,SAAS,MAAM,EAAE,CAEnB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,yBAAuD,GAC/D,aAAa,CA+Gf"}
1
+ {"version":3,"file":"betas.d.ts","sourceRoot":"","sources":["../src/betas.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,gBAAgB,CA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AQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD;AAkCD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,yBAAuD,GAC/D,SAAS,MAAM,EAAE,CAEnB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,yBAAuD,GAC/D,aAAa,CA8Hf"}
package/dist/betas.js CHANGED
@@ -2,7 +2,26 @@
2
2
  import { BETA_REGISTRY } from "./beta-registry.js";
3
3
  import { ClaudeCodeWireError } from "./contracts.js";
4
4
  import { supportsMidConversationSystem, supportsStructuredOutputs, } from "./model-capabilities.js";
5
+ import { BETA_REGISTRY_2_1_233 } from "./profiles/beta-registry-2.1.233.js";
5
6
  import { CLAUDE_CODE_2_1_195_PROFILE } from "./profiles/claude-code-2.1.195.js";
7
+ import { CLAUDE_CODE_2_1_233_PROFILE } from "./profiles/claude-code-2.1.233.js";
8
+ const PROFILE_BETA_REGISTRIES = new Map([
9
+ [CLAUDE_CODE_2_1_195_PROFILE.id, BETA_REGISTRY],
10
+ [CLAUDE_CODE_2_1_233_PROFILE.id, BETA_REGISTRY_2_1_233],
11
+ ]);
12
+ /**
13
+ * Selects the registry a profile composes against.
14
+ *
15
+ * An unrecognised id falls back to the 2.1.195 registry rather than throwing.
16
+ * Rejecting unknown profiles is the request builder's job -- it validates the
17
+ * profile before any of this runs -- and duplicating that rejection here would
18
+ * give `composeBetas` a second, differently-worded opinion about profile
19
+ * validity. Standalone callers keep the 2.1.195 behaviour they had before
20
+ * profiles were a parameter.
21
+ */
22
+ function resolveBetaRegistry(profile) {
23
+ return PROFILE_BETA_REGISTRIES.get(profile.id) ?? BETA_REGISTRY;
24
+ }
6
25
  /**
7
26
  * Bounds a caller-supplied beta list (`additionalBetas` and `suppressBetas`
8
27
  * share these rules verbatim). The header is a comma-joined single
@@ -37,65 +56,78 @@ export function composeBetasWithAudit(input, profile = CLAUDE_CODE_2_1_195_PROFI
37
56
  const out = [];
38
57
  const policy = profile.betaPolicy;
39
58
  const experimental = policy.experimentalBetasEnabled;
59
+ const registry = resolveBetaRegistry(profile);
40
60
  if (!input.normalizedId.includes("haiku"))
41
- out.push(BETA_REGISTRY.CLAUDE_CODE.header);
61
+ out.push(registry.CLAUDE_CODE.header);
42
62
  if (policy.oauthAuthenticated)
43
- out.push(BETA_REGISTRY.OAUTH_AUTH.header);
63
+ out.push(registry.OAUTH_AUTH.header);
44
64
  // Package extension: `use1MContextOverride` replaces the model-marker gate
45
65
  // for this request. The profile gate still applies, so an override cannot
46
66
  // enable a beta the pinned profile declares unavailable.
47
67
  const oneMillionRequested = input.use1MContextOverride ?? /\[1m\]/iu.test(input.rawModel);
48
68
  if (policy.oneMillionContextEnabled && oneMillionRequested) {
49
- out.push(BETA_REGISTRY.LONG_CONTEXT.header);
69
+ out.push(registry.LONG_CONTEXT.header);
50
70
  }
51
71
  if (policy.interleavedThinkingEnabled &&
52
72
  input.capabilities.interleavedThinking) {
53
- out.push(BETA_REGISTRY.INTERLEAVED_THINKING.header);
73
+ out.push(registry.INTERLEAVED_THINKING.header);
54
74
  }
55
75
  if (experimental &&
56
76
  input.capabilities.interleavedThinking &&
57
77
  policy.interactive &&
58
78
  !policy.thinkingSummariesShown &&
59
79
  !input.thinkingDisplayActive) {
60
- out.push(BETA_REGISTRY.REDACT_THINKING.header);
80
+ out.push(registry.REDACT_THINKING.header);
61
81
  }
62
82
  if (policy.thinkingTokenCountEnabled &&
63
83
  experimental &&
64
84
  input.capabilities.interleavedThinking) {
65
- out.push(BETA_REGISTRY.THINKING_TOKEN_COUNT.header);
85
+ out.push(registry.THINKING_TOKEN_COUNT.header);
86
+ }
87
+ /*
88
+ * The narration push site keeps its position in the sequence even when the
89
+ * resolved registry dropped the entry. Upstream removed the beta after
90
+ * 2.1.195, so a registry without it emits nothing here and the surrounding
91
+ * order closes up with no gap; the gates are still evaluated first so a
92
+ * profile that enables narration against a registry that has it behaves
93
+ * exactly as it did before.
94
+ */
95
+ const narrationSummaries = registry.NARRATION_SUMMARIES;
96
+ if (experimental &&
97
+ policy.narrationSummariesEnabled &&
98
+ narrationSummaries !== undefined) {
99
+ out.push(narrationSummaries.header);
66
100
  }
67
- if (experimental && policy.narrationSummariesEnabled)
68
- out.push(BETA_REGISTRY.NARRATION_SUMMARIES.header);
69
101
  if (experimental && input.capabilities.contextManagement)
70
- out.push(BETA_REGISTRY.CONTEXT_MANAGEMENT.header);
102
+ out.push(registry.CONTEXT_MANAGEMENT.header);
71
103
  if (experimental &&
72
104
  supportsStructuredOutputs(input.normalizedId) &&
73
105
  policy.structuredOutputsEnabled) {
74
- out.push(BETA_REGISTRY.STRUCTURED_OUTPUTS.header);
106
+ out.push(registry.STRUCTURED_OUTPUTS.header);
75
107
  }
76
108
  // No web-search beta: upstream pushes it only for vertex and foundry.
77
109
  if (experimental)
78
- out.push(BETA_REGISTRY.PROMPT_CACHING_SCOPE.header);
79
- if (supportsMidConversationSystem(input.normalizedId))
80
- out.push(BETA_REGISTRY.MID_CONVERSATION_SYSTEM.header);
110
+ out.push(registry.PROMPT_CACHING_SCOPE.header);
111
+ if (supportsMidConversationSystem(input.normalizedId, profile))
112
+ out.push(registry.MID_CONVERSATION_SYSTEM.header);
81
113
  if (input.capabilities.effort)
82
- out.push(BETA_REGISTRY.EFFORT.header);
83
- if (input.speed === "fast" && !out.includes(BETA_REGISTRY.SPEED.header)) {
84
- out.push(BETA_REGISTRY.SPEED.header);
114
+ out.push(registry.EFFORT.header);
115
+ if (input.speed === "fast" && !out.includes(registry.SPEED.header)) {
116
+ out.push(registry.SPEED.header);
85
117
  }
86
- if (policy.afkModeEnabled && !out.includes(BETA_REGISTRY.AFK_MODE.header)) {
87
- out.push(BETA_REGISTRY.AFK_MODE.header);
118
+ if (policy.afkModeEnabled && !out.includes(registry.AFK_MODE.header)) {
119
+ out.push(registry.AFK_MODE.header);
88
120
  }
89
121
  if (input.cacheTtl === "1h" &&
90
122
  experimental &&
91
- !out.includes(BETA_REGISTRY.EXTENDED_CACHE_TTL.header)) {
92
- out.push(BETA_REGISTRY.EXTENDED_CACHE_TTL.header);
123
+ !out.includes(registry.EXTENDED_CACHE_TTL.header)) {
124
+ out.push(registry.EXTENDED_CACHE_TTL.header);
93
125
  }
94
126
  if (profile.contextHintEnabled)
95
- out.push(BETA_REGISTRY.CONTEXT_HINT.header);
127
+ out.push(registry.CONTEXT_HINT.header);
96
128
  if (policy.cacheDiagnosisEnabled &&
97
- !out.includes(BETA_REGISTRY.CACHE_DIAGNOSIS.header)) {
98
- out.push(BETA_REGISTRY.CACHE_DIAGNOSIS.header);
129
+ !out.includes(registry.CACHE_DIAGNOSIS.header)) {
130
+ out.push(registry.CACHE_DIAGNOSIS.header);
99
131
  }
100
132
  // No advisor-tool beta: upstream has no observed unconditional push site.
101
133
  // Package extension. Canonical, upstream-derived identifiers always precede
package/dist/betas.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"betas.js","sourceRoot":"","sources":["../src/betas.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC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AAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1B,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;KAC5C,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,15 @@
1
1
  import type { BuiltClaudeCodeCountTokensRequest, BuiltClaudeCodeRequest, ClaudeCodeProtocolProfile, ClaudeCodeCountTokensInput, ClaudeCodeRequestInput } from "./contracts.js";
2
+ /**
3
+ * The profile every public entry point resolves to when the caller supplies
4
+ * none. Declared once so that the default is a single, greppable seam: a test
5
+ * that means "whatever the default is" reads THIS instead of naming a
6
+ * version, which keeps a default switch to a one-line diff and keeps tests
7
+ * that genuinely mean 2.1.195 honest about saying so.
8
+ *
9
+ * Exported for tests, which deep-import it. It is deliberately NOT re-exported
10
+ * from `src/index.ts`: the public runtime surface stays closed.
11
+ */
12
+ export declare const DEFAULT_PROFILE: ClaudeCodeProtocolProfile;
2
13
  /** Builds a canonical Claude Code count-tokens request. */
3
14
  export declare function buildClaudeCodeCountTokensRequest(input: ClaudeCodeCountTokensInput, profile?: ClaudeCodeProtocolProfile): Promise<BuiltClaudeCodeCountTokensRequest>;
4
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../src/build-request.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iCAAiC,EACjC,sBAAsB,EAMtB,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EAGvB,MAAM,gBAAgB,CAAC;AAwvCxB,2DAA2D;AAC3D,wBAAsB,iCAAiC,CACrD,KAAK,EAAE,0BAA0B,EACjC,OAAO,GAAE,yBAAuD,GAC/D,OAAO,CAAC,iCAAiC,CAAC,CAiF5C;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,sBAAsB,EAC7B,OAAO,GAAE,yBAAuD,GAC/D,OAAO,CAAC,sBAAsB,CAAC,CA8JjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAAuD,GAC/D,sBAAsB,CA+FxB"}
1
+ {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../src/build-request.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iCAAiC,EACjC,sBAAsB,EAMtB,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EAGvB,MAAM,gBAAgB,CAAC;AAsUxB;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,yBACD,CAAC;AAqiC9B,2DAA2D;AAC3D,wBAAsB,iCAAiC,CACrD,KAAK,EAAE,0BAA0B,EACjC,OAAO,GAAE,yBAA2C,GACnD,OAAO,CAAC,iCAAiC,CAAC,CAiF5C;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,sBAAsB,EAC7B,OAAO,GAAE,yBAA2C,GACnD,OAAO,CAAC,sBAAsB,CAAC,CAgLjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA2C,GACnD,sBAAsB,CA+FxB"}