@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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,116 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.8.0] - 2026-11-20
|
|
6
|
+
|
|
7
|
+
Ports Claude Code 2.1.329 (SDK 0.128.0) and makes it the default profile. The
|
|
8
|
+
`0.8.0-rc.1` prerelease was never published; its notes are folded into this
|
|
9
|
+
release.
|
|
10
|
+
|
|
11
|
+
### Breaking
|
|
12
|
+
|
|
13
|
+
- **The default profile is now `CLAUDE_CODE_2_1_329_PROFILE`.** A caller that
|
|
14
|
+
passes no profile gets 2.1.329 bytes. Rollback: pass
|
|
15
|
+
`CLAUDE_CODE_2_1_280_PROFILE` explicitly to `buildClaudeCodeRequest`,
|
|
16
|
+
`buildClaudeCodeCountTokensRequest` and `parseBuiltClaudeCodeRequest` (the
|
|
17
|
+
parser recomputes the expected headers under the profile it is given, so
|
|
18
|
+
pinning the builders alone is not enough). The 2.1.195, 2.1.233 and 2.1.280
|
|
19
|
+
profiles are byte-for-byte unchanged and their frozen digests did not move.
|
|
20
|
+
- **What changes on the wire for 2.1.329:**
|
|
21
|
+
- Header names use the genuine capitalisation (`Accept`, `Authorization`,
|
|
22
|
+
`Content-Type`, `User-Agent`, `X-Stainless-*`, `X-Claude-Code-Session-Id`)
|
|
23
|
+
and every header is sorted by UTF-16 code unit. Capitalisation survives
|
|
24
|
+
only on a case-preserving transport; Node's `fetch` lowercases it.
|
|
25
|
+
- A new `Accept: application/json` header, plus `x-claude-1p-request-class`,
|
|
26
|
+
`x-claude-code-request-class`, `x-claude-code-sandy-plover` (`[]` by
|
|
27
|
+
default) and, when a valid prompt id is supplied, `x-claude-code-prompt-id`.
|
|
28
|
+
Count-tokens requests omit the request-class, prompt-id and sandy-plover
|
|
29
|
+
headers.
|
|
30
|
+
- The body follows the genuine key order, carries a generated
|
|
31
|
+
`context_management` (`clear_thinking_20251015`, keep all) when the
|
|
32
|
+
context-management beta composes with thinking, and carries `diagnostics`
|
|
33
|
+
(`previous_message_id`, `null` by default) whenever cache-diagnosis
|
|
34
|
+
composes.
|
|
35
|
+
- `mid-conversation-system-2026-04-07` is no longer sent (retired upstream);
|
|
36
|
+
its condition still gates clear-at and tool-changes.
|
|
37
|
+
- `thinking-token-count` is pushed after the per-request betas instead of
|
|
38
|
+
before them, so its position in `anthropic-beta` moves.
|
|
39
|
+
- `context-1m` is no longer sent for natively-1M models.
|
|
40
|
+
- The billing block gains `cc_turn_origin`, `cc_prompt_index` and
|
|
41
|
+
`cc_turn_index` when the caller supplies them.
|
|
42
|
+
- Existing callers' extra headers named `accept`, `anthropic-dispatch-id` or
|
|
43
|
+
any `x-claude-*` header that the new layout owns are now reserved and
|
|
44
|
+
rejected on 2.1.329.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- `isFable5Model` and `isMythos5Model` now hold for `claude-fable-5-2` and
|
|
49
|
+
`claude-mythos-5-2`, and `isAdaptiveThinkingModel` is true for
|
|
50
|
+
`claude-haiku-5-5`. The model-id normalizer has a second, extended ladder
|
|
51
|
+
(the four 5.5/5.2 rungs transcribed from the 2.1.329 bundle) that only the
|
|
52
|
+
2.1.329 profile follows; under the earlier profiles `claude-sonnet-5-5` still
|
|
53
|
+
folds to `claude-sonnet-5`.
|
|
54
|
+
- The mid-conversation-system registry key is optional and 2.1.329's registry
|
|
55
|
+
omits it; behaviour sets are split into legacy, catalogue-era and
|
|
56
|
+
wire-faithful, and any profile id the port does not name keeps the pre-329
|
|
57
|
+
behaviour.
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
|
|
61
|
+
- Profile `CLAUDE_CODE_2_1_329_PROFILE` (id `claude-code-2.1.329-sdk-0.128.0`,
|
|
62
|
+
24 models, a 45-entry beta registry) and the subpath export
|
|
63
|
+
`./profiles/claude-code-2.1.329`. Optional profile data `runtimeVersion` and
|
|
64
|
+
`oauthAuthorizeScopes`.
|
|
65
|
+
- Request inputs, validated on every profile and honoured only by 2.1.329
|
|
66
|
+
(except `cch`, which every profile honours): `cch`, `turnOrigin`,
|
|
67
|
+
`turnPosition`, `toolsUsed`, `previousMessageId`, `accountFeatures`
|
|
68
|
+
(`dispatchId`, `inlineTools`, `toolProvenance`, `thread`), `sideQuery` and
|
|
69
|
+
`agenticQuery`. `toolProvenance` is opt-in and off by default.
|
|
70
|
+
- Types `ClaudeCodeDispatchId`, `ClaudeCodeThreadInput`,
|
|
71
|
+
`ClaudeCodeAccountFeatures`, `ClaudeCodeToolUsed`, `ClaudeCodeTurnPosition`
|
|
72
|
+
and `ClaudeCodeControlMessage`.
|
|
73
|
+
- Per-turn control messages (`{role: "system", content: [], output_config}`)
|
|
74
|
+
are accepted in `messages` as pass-through on 2.1.329.
|
|
75
|
+
- `modelCatalogueEntry(model, profile)`.
|
|
76
|
+
- New beta sites for 2.1.329: inline-tools, tool-provenance, advisor-tool,
|
|
77
|
+
side-query and message-threads, plus the thinking-token-count re-push.
|
|
78
|
+
|
|
79
|
+
## [0.7.1] - 2026-09-26
|
|
80
|
+
|
|
81
|
+
### Fixed
|
|
82
|
+
|
|
83
|
+
- **Long sessions no longer fail locally with `INPUT_TOO_LARGE`.** The
|
|
84
|
+
aggregate graph budget was 1,000,000 units, a library-local defensive limit
|
|
85
|
+
with no upstream provenance, so requests for 1M-token-context models were
|
|
86
|
+
refused before fetch (`INPUT_TOO_LARGE`, `maximumSize=1000000`). The shared
|
|
87
|
+
budget in `src/limits.ts` is now 33,554,432 units: the Messages API's 32 MB
|
|
88
|
+
request limit in its binary reading (32 MiB), the larger of the two readings.
|
|
89
|
+
Each walker measures string lengths plus structural overhead, never more
|
|
90
|
+
than the serialized size of what it inspects, so a request the API accepts
|
|
91
|
+
is not refused locally. The builder, count-tokens builder, canonical body,
|
|
92
|
+
`system` field and the parser's decoded body share this one constant.
|
|
93
|
+
- The canonical-body container ceiling rises from 100,000 to 3,355,443
|
|
94
|
+
objects and arrays (one per ten budget units, the previous ratio). Its
|
|
95
|
+
failure now carries the additive `safeDetails.maximumItems`.
|
|
96
|
+
- Graphs that carry the serialized body beside other material get three
|
|
97
|
+
times the budget (100,663,296): redaction evidence, which holds both the
|
|
98
|
+
normalized request and its body, and the built-request wrapper handed to
|
|
99
|
+
`parseBuiltClaudeCodeRequest`. Under a single ceiling, evidence would have
|
|
100
|
+
capped inputs near 16 MiB. `safeDetails.maximumSize` on an evidence failure
|
|
101
|
+
now reports 100,663,296.
|
|
102
|
+
- Every size failure now carries `safeDetails.maximumSize` naming the budget
|
|
103
|
+
that applied; builder, canonical-body and `system` failures previously
|
|
104
|
+
carried no details. Violation offsets and text lengths in `safeDetails` are
|
|
105
|
+
now bounded by 33,554,432 instead of 1,000,000.
|
|
106
|
+
|
|
107
|
+
Building a realistic 30 MB multi-message request takes about two seconds on
|
|
108
|
+
Node 24 and scales linearly. Depth limits, cycle and prototype guards, and
|
|
109
|
+
header, identifier and metadata field limits are unchanged. Bytes for every
|
|
110
|
+
input accepted before this change are unchanged; no golden fixture or digest
|
|
111
|
+
was resealed.
|
|
112
|
+
|
|
113
|
+
Rollback: pin `0.7.0`.
|
|
114
|
+
|
|
5
115
|
## [0.7.0] - 2026-09-26
|
|
6
116
|
|
|
7
117
|
### Breaking
|
package/README.md
CHANGED
|
@@ -18,8 +18,9 @@ The package targets Node.js 20 or newer and is designed to remain portable to Bu
|
|
|
18
18
|
|
|
19
19
|
The pinned profiles are exported:
|
|
20
20
|
|
|
21
|
-
- `
|
|
22
|
-
- `
|
|
21
|
+
- `CLAUDE_CODE_2_1_329_PROFILE` — Claude Code 2.1.329 with SDK 0.128.0. This is the profile the request-building entry points use when `profile` is omitted.
|
|
22
|
+
- `CLAUDE_CODE_2_1_280_PROFILE` — the previous pin, Claude Code 2.1.280 with SDK 0.112.1.
|
|
23
|
+
- `CLAUDE_CODE_2_1_233_PROFILE` — Claude Code 2.1.233 with SDK 0.112.1.
|
|
23
24
|
- `CLAUDE_CODE_2_1_195_PROFILE` — the oldest pin, Claude Code 2.1.195 with SDK 0.94.0.
|
|
24
25
|
|
|
25
26
|
The model-query helpers (`modelCapability`, `isEligibleFor1MContext`) and the anti-verbosity helpers (`antiVerbosityText`, `selectAntiVerbositySection`) keep their own separately declared default and are not governed by that seam; a caller relying on them for a newer model must pass the profile explicitly.
|
|
@@ -30,12 +31,32 @@ Any of them can be selected explicitly by passing the singleton as the `profile`
|
|
|
30
31
|
import { CLAUDE_CODE_2_1_195_PROFILE } from "@tormentalabs/claude-code-wire-compat/profiles/claude-code-2.1.195";
|
|
31
32
|
import { CLAUDE_CODE_2_1_233_PROFILE } from "@tormentalabs/claude-code-wire-compat/profiles/claude-code-2.1.233";
|
|
32
33
|
import { CLAUDE_CODE_2_1_280_PROFILE } from "@tormentalabs/claude-code-wire-compat/profiles/claude-code-2.1.280";
|
|
34
|
+
import { CLAUDE_CODE_2_1_329_PROFILE } from "@tormentalabs/claude-code-wire-compat/profiles/claude-code-2.1.329";
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
Rollback: a consumer who wants the previous default's bytes must pass `
|
|
37
|
+
Rollback: a consumer who wants the previous default's bytes must pass `CLAUDE_CODE_2_1_280_PROFILE` explicitly on every call to each entry point that reads the default seam — `buildClaudeCodeRequest`, `buildClaudeCodeCountTokensRequest`, and `parseBuiltClaudeCodeRequest`. Pinning the builders alone is not enough: `parseBuiltClaudeCodeRequest` recomputes the expected headers under the profile it is given, so a request built under the old default and parsed unpinned after upgrading is rejected with `ClaudeCodeWireError` code `INVALID_INPUT`.
|
|
36
38
|
|
|
37
39
|
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.
|
|
38
40
|
|
|
41
|
+
## Inputs honoured by the 2.1.329 profile
|
|
42
|
+
|
|
43
|
+
Every input below is optional and is validated on **every** profile, so a malformed value fails the same way regardless of the pinned profile. Only the 2.1.329 profile acts on them (except `cch`, which every profile honours); the older profiles ignore the rest, which is why their bytes and frozen digests do not move. A host that omits all of them gets the modelled defaults.
|
|
44
|
+
|
|
45
|
+
- `cch` — five lowercase hex characters that replace the `cch=00000` placeholder in the billing block. The package only places the value; it does not compute it. Anything else is `INVALID_INPUT`. A host that hashes the request body builds twice: once without `cch` to obtain the body bytes, then again with the value it derived. Only the five placeholder characters differ between the two passes.
|
|
46
|
+
- `turnOrigin`, `turnPosition` — the `cc_turn_origin`, `cc_prompt_index` and `cc_turn_index` billing segments. A value outside the upstream format guard is dropped silently, as upstream does; a value of the wrong type is `INVALID_INPUT`.
|
|
47
|
+
- `toolsUsed` — the tools the conversation has used, serialised into the always-present `x-claude-code-sandy-plover` header (`[]` by default). At most 64 entries, names up to 256 bytes, a serialised size of at most 7168 bytes. The package rejects an over-size value instead of truncating it, because the upstream truncation sentinel is not transcribed. Ordering of built-in tools relative to the rest is the host's job.
|
|
48
|
+
- `previousMessageId` — the previous response's message id, or `null` for the first request, carried in the body's `diagnostics` object whenever the cache-diagnosis beta is composed.
|
|
49
|
+
- `accountFeatures` — opt-in switches for features the genuine client enables per account. `dispatchId` (`v2d`, `v2s` or `v2p`) adds the `anthropic-dispatch-id` header. `inlineTools` composes the inline-tools beta (header only; see below). `toolProvenance` composes the tool-provenance beta and is **off by default**. `thread` (`{type: "create"}` or `{type: "continue", previousMessageId}`) composes message-threads and the body's `thread`.
|
|
50
|
+
- `sideQuery`, `agenticQuery` — `sideQuery` composes the side-query beta (the host sets it on session-title requests). `agenticQuery` re-adds the `claude-code` beta for a model the per-model table excludes it from (the haiku models).
|
|
51
|
+
- Per-turn control messages — a `messages` entry of the shape `{role: "system", content: [], output_config: {effort?, timing?}}` is accepted as pass-through on 2.1.329, which is how the genuine client changes effort mid-conversation. Other profiles keep rejecting it. Exported as the type `ClaudeCodeControlMessage`.
|
|
52
|
+
|
|
53
|
+
Two limits to know about. `inlineTools` is a header-only half port: the genuine client also inserts `role: "system"` messages carrying `tool_addition` blocks into the conversation, and this package does not model them. And header casing survives only on case-preserving transports: the 2.1.329 layout emits `Accept`, `Authorization`, `Content-Type`, `User-Agent`, the `X-Stainless-*` headers and `X-Claude-Code-Session-Id` with their genuine capitalisation and sorts every header by UTF-16 code unit, but Node's `fetch` lowercases header names on the way out, so only a transport that keeps case (Bun, for one) reproduces the capitalisation.
|
|
54
|
+
|
|
55
|
+
Profile data and queries added alongside:
|
|
56
|
+
|
|
57
|
+
- The 2.1.329 profile carries two optional, data-only fields: `runtimeVersion` (the `X-Stainless-Runtime-Version` the genuine client reports) and `oauthAuthorizeScopes` (the scopes of its authorize URL). The package neither reads `runtimeVersion` into a request (the caller still supplies `runtime.runtimeVersion`) nor builds an authorize URL; a host reads the fields.
|
|
58
|
+
- `modelCatalogueEntry(model, profile)` returns the catalogue entry the profile's own normalizer resolves `model` to, or `undefined`. It is folding-consistent: under a profile whose normalizer does not know `claude-sonnet-5-5`, that id resolves to the `claude-sonnet-5` entry, as the request builder does.
|
|
59
|
+
|
|
39
60
|
## Endpoint URL and custom base URLs
|
|
40
61
|
|
|
41
62
|
`built.url` is the **pinned endpoint of the profile**, not a suggestion. It is literal-typed, so the type is part of the contract:
|
|
@@ -68,6 +89,10 @@ await fetch(target, {
|
|
|
68
89
|
2. Speculative surface is not added to this package. A host that has a base URL already has a URL library; a package field would be a second way to do the same thing, with a validation and normalisation burden this package would then own.
|
|
69
90
|
3. The only real consumer case observed is an origin override, which the four lines above express exactly — including the case where the base URL carries a path prefix, which a naive `baseUrl + pathname` concatenation gets wrong.
|
|
70
91
|
|
|
92
|
+
## Input limits
|
|
93
|
+
|
|
94
|
+
Local ceilings exist only as defensive bounds and never sit below what the Messages API accepts. A caller's input graph, the canonical body, the `system` field and the decoded body inside `parseBuiltClaudeCodeRequest` share one aggregate budget of 33,554,432 units (32 MiB, the API's 32 MB request limit in its larger binary reading); units are string lengths plus structural overhead, not serialized bytes. The canonical body also allows at most 3,355,443 objects and arrays. Graphs that carry the serialized body beside other material (redaction evidence, the built-request wrapper) get three times the budget. Nesting depth, header, identifier and metadata field limits are separate and unchanged. Exceeding a size budget raises `ClaudeCodeWireError` code `INPUT_TOO_LARGE` with `safeDetails.maximumSize` naming the budget that applied; exceeding the container ceiling raises the same code with `safeDetails.maximumItems`.
|
|
95
|
+
|
|
71
96
|
## Protocol documentation
|
|
72
97
|
|
|
73
98
|
The wire contract this package pins was reverse engineered before it was
|
|
@@ -123,9 +148,11 @@ required](./docs/protocol/versions/README.md):
|
|
|
123
148
|
- [Claude Code 2.1.233](./docs/protocol/versions/claude-code-2.1.233-analysis.md)
|
|
124
149
|
— the previous pin; its profile is still exported and selectable.
|
|
125
150
|
- [Claude Code 2.1.280](./docs/protocol/versions/claude-code-2.1.280-analysis.md)
|
|
126
|
-
— the
|
|
151
|
+
— the previous pin; its profile is still exported and selectable. Records the build-shape
|
|
127
152
|
change that breaks the old carving rule, nine new betas, three new models,
|
|
128
153
|
and the first wire-visible `thinking` sub-fields since 2.1.222.
|
|
154
|
+
- [Claude Code 2.1.329](./docs/protocol/versions/claude-code-2.1.329-analysis.md)
|
|
155
|
+
— the release this package's default profile pins.
|
|
129
156
|
|
|
130
157
|
## Development
|
|
131
158
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClaudeCodeAccountFeatures } from "./contracts.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validates the `accountFeatures` input and returns a normalised, frozen copy.
|
|
4
|
+
*
|
|
5
|
+
* Throws `INVALID_INPUT` for a non-record, an unknown key, a `dispatchId` other
|
|
6
|
+
* than `v2d`/`v2s`/`v2p`, a non-boolean `inlineTools` or `toolProvenance`, or a
|
|
7
|
+
* `thread` that is not `{type:"create"}` or `{type:"continue",
|
|
8
|
+
* previousMessageId}` with a well-formed message id.
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateAccountFeatures(value: unknown): ClaudeCodeAccountFeatures;
|
|
11
|
+
//# sourceMappingURL=account-features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-features.d.ts","sourceRoot":"","sources":["../src/account-features.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EAG1B,MAAM,gBAAgB,CAAC;AA8ExB;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,yBAAyB,CAmB3B"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
import { ClaudeCodeWireError } from "./contracts.js";
|
|
3
|
+
import { validatePreviousMessageId } from "./request-body.js";
|
|
4
|
+
/**
|
|
5
|
+
* Account-served features: switches the genuine client flips from a
|
|
6
|
+
* server-served account entitlement this package cannot observe, so the caller
|
|
7
|
+
* states each one explicitly.
|
|
8
|
+
*
|
|
9
|
+
* Every member is validated on every profile, so a malformed value fails the
|
|
10
|
+
* same way everywhere; only a profile whose behaviour set declares
|
|
11
|
+
* `accountServedInputs` acts on a validated value.
|
|
12
|
+
*/
|
|
13
|
+
const ACCOUNT_FEATURE_KEYS = new Set([
|
|
14
|
+
"dispatchId",
|
|
15
|
+
"inlineTools",
|
|
16
|
+
"toolProvenance",
|
|
17
|
+
"thread",
|
|
18
|
+
]);
|
|
19
|
+
const DISPATCH_IDS = new Set(["v2d", "v2s", "v2p"]);
|
|
20
|
+
const THREAD_CREATE_KEYS = new Set(["type"]);
|
|
21
|
+
const THREAD_CONTINUE_KEYS = new Set([
|
|
22
|
+
"type",
|
|
23
|
+
"previousMessageId",
|
|
24
|
+
]);
|
|
25
|
+
function invalid() {
|
|
26
|
+
throw new ClaudeCodeWireError("INVALID_INPUT");
|
|
27
|
+
}
|
|
28
|
+
function isPlainRecord(value) {
|
|
29
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30
|
+
}
|
|
31
|
+
function assertKeys(value, allowed) {
|
|
32
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
33
|
+
if (typeof key !== "string" || !allowed.has(key))
|
|
34
|
+
invalid();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function validateDispatchId(value) {
|
|
38
|
+
if (typeof value !== "string" || !DISPATCH_IDS.has(value))
|
|
39
|
+
return invalid();
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function validateBoolean(value) {
|
|
43
|
+
if (typeof value !== "boolean")
|
|
44
|
+
return invalid();
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function validateThread(value) {
|
|
48
|
+
if (!isPlainRecord(value))
|
|
49
|
+
return invalid();
|
|
50
|
+
const type = Object.hasOwn(value, "type") ? value["type"] : undefined;
|
|
51
|
+
if (type === "create") {
|
|
52
|
+
assertKeys(value, THREAD_CREATE_KEYS);
|
|
53
|
+
return Object.freeze({ type: "create" });
|
|
54
|
+
}
|
|
55
|
+
if (type !== "continue")
|
|
56
|
+
return invalid();
|
|
57
|
+
assertKeys(value, THREAD_CONTINUE_KEYS);
|
|
58
|
+
const previousMessageId = Object.hasOwn(value, "previousMessageId")
|
|
59
|
+
? value["previousMessageId"]
|
|
60
|
+
: undefined;
|
|
61
|
+
// `null` is a legal `previousMessageId` elsewhere; a continued thread has a
|
|
62
|
+
// message to continue from, so it is not one here.
|
|
63
|
+
const validated = previousMessageId === undefined
|
|
64
|
+
? null
|
|
65
|
+
: validatePreviousMessageId(previousMessageId);
|
|
66
|
+
if (validated === null)
|
|
67
|
+
return invalid();
|
|
68
|
+
return Object.freeze({ type: "continue", previousMessageId: validated });
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Validates the `accountFeatures` input and returns a normalised, frozen copy.
|
|
72
|
+
*
|
|
73
|
+
* Throws `INVALID_INPUT` for a non-record, an unknown key, a `dispatchId` other
|
|
74
|
+
* than `v2d`/`v2s`/`v2p`, a non-boolean `inlineTools` or `toolProvenance`, or a
|
|
75
|
+
* `thread` that is not `{type:"create"}` or `{type:"continue",
|
|
76
|
+
* previousMessageId}` with a well-formed message id.
|
|
77
|
+
*/
|
|
78
|
+
export function validateAccountFeatures(value) {
|
|
79
|
+
if (!isPlainRecord(value))
|
|
80
|
+
return invalid();
|
|
81
|
+
assertKeys(value, ACCOUNT_FEATURE_KEYS);
|
|
82
|
+
const own = (key) => Object.hasOwn(value, key) ? value[key] : undefined;
|
|
83
|
+
return Object.freeze({
|
|
84
|
+
...(Object.hasOwn(value, "dispatchId")
|
|
85
|
+
? { dispatchId: validateDispatchId(own("dispatchId")) }
|
|
86
|
+
: {}),
|
|
87
|
+
...(Object.hasOwn(value, "inlineTools")
|
|
88
|
+
? { inlineTools: validateBoolean(own("inlineTools")) }
|
|
89
|
+
: {}),
|
|
90
|
+
...(Object.hasOwn(value, "toolProvenance")
|
|
91
|
+
? { toolProvenance: validateBoolean(own("toolProvenance")) }
|
|
92
|
+
: {}),
|
|
93
|
+
...(Object.hasOwn(value, "thread")
|
|
94
|
+
? { thread: validateThread(own("thread")) }
|
|
95
|
+
: {}),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=account-features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-features.js","sourceRoot":"","sources":["../src/account-features.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAO5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;;;;;;;GAQG;AAEH,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC;IACxD,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,QAAQ;CACT,CAAC,CAAC;AACH,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACzE,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAClE,M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AAE,MAAM,EAChB,OAAO,GAAE,yBAAuD,GAC/D,oBAAoB,
|
|
1
|
+
{"version":3,"file":"anti-verbosity.d.ts","sourceRoot":"","sources":["../src/anti-verbosity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;AAKxB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,EAAE,mBAK3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,QAc8N,CAAC;AAE5Q,mFAAmF;AACnF,eAAO,MAAM,qCAAqC,QAYyN,CAAC;AAE5Q,0DAA0D;AAC1D,eAAO,MAAM,YAAY,mGACyE,CAAC;AAEnG,iCAAiC;AACjC,eAAO,MAAM,mBAAmB,QAYqP,CAAC;AAEtR;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;EAQjC,CAAC;AA+DH;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,yBAAuD,GAC/D,oBAAoB,CAatB;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,mBAAmD,EAC3D,OAAO,GAAE,yBAAuD,GAC/D,MAAM,CAqBR"}
|
package/dist/anti-verbosity.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
import { ClaudeCodeWireError } from "./contracts.js";
|
|
3
|
-
import { normalizeModelId } from "./model-identity.js";
|
|
3
|
+
import { 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
|
* The genuine client's anti-verbosity system-prompt section, and the three-way
|
|
@@ -117,7 +117,7 @@ function hasFableMitigations(normalizedId, profile) {
|
|
|
117
117
|
function usesTextOutputSection(rawModel, profile) {
|
|
118
118
|
if (EAP_PATTERN.test(rawModel))
|
|
119
119
|
return false;
|
|
120
|
-
const id = normalizeModelId(rawModel);
|
|
120
|
+
const id = normalizeModelId(rawModel, modelIdLadder(profile));
|
|
121
121
|
if (catalogueCapability(id, "lean_prompt", profile))
|
|
122
122
|
return false;
|
|
123
123
|
return (id.includes("claude-3-") ||
|
|
@@ -141,7 +141,7 @@ export function selectAntiVerbositySection(rawModel, profile = CLAUDE_CODE_2_1_1
|
|
|
141
141
|
if (typeof rawModel !== "string" || rawModel.length === 0) {
|
|
142
142
|
throw new ClaudeCodeWireError("INVALID_INPUT");
|
|
143
143
|
}
|
|
144
|
-
if (hasFableMitigations(normalizeModelId(rawModel), profile)) {
|
|
144
|
+
if (hasFableMitigations(normalizeModelId(rawModel, modelIdLadder(profile)), profile)) {
|
|
145
145
|
return "communicating-with-the-user";
|
|
146
146
|
}
|
|
147
147
|
return usesTextOutputSection(rawModel, profile) ? "text-output" : "lean";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anti-verbosity.js","sourceRoot":"","sources":["../src/anti-verbosity.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAO5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"anti-verbosity.js","sourceRoot":"","sources":["../src/anti-verbosity.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAO5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iFAAiF;AACjF,MAAM,CAAC,M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1,4 +1,4 @@
|
|
|
1
|
-
import type { ClaudeCodeCapabilities, ClaudeCodeProtocolProfile } from "./contracts.js";
|
|
1
|
+
import type { ClaudeCodeAccountFeatures, ClaudeCodeCapabilities, ClaudeCodeProtocolProfile } from "./contracts.js";
|
|
2
2
|
/** Structural shape of a registry entry, shared by every registry version. */
|
|
3
3
|
interface BetaRegistryEntry {
|
|
4
4
|
readonly featureKey: string;
|
|
@@ -24,6 +24,21 @@ interface BetaRegistryEntry {
|
|
|
24
24
|
* registry absence does not keep its site inert there; what does is the
|
|
25
25
|
* catalogue, because no 2.1.233 model declares the backing capability. The two
|
|
26
26
|
* mechanisms are not interchangeable and both are load-bearing.
|
|
27
|
+
*
|
|
28
|
+
* The account-served members (`INLINE_TOOLS`, `TOOL_PROVENANCE`,
|
|
29
|
+
* `ADVISOR_TOOL`, `CLAUDE_CODE_SIDE_QUERY`, `MESSAGE_THREADS`) are a third
|
|
30
|
+
* case: several older registries DO declare them, so registry presence cannot
|
|
31
|
+
* keep their sites inert. Their sites additionally require the profile's
|
|
32
|
+
* `accountServedInputs` behaviour, which only 2.1.329 sets, and a caller input
|
|
33
|
+
* that states the feature explicitly.
|
|
34
|
+
*
|
|
35
|
+
* `MID_CONVERSATION_SYSTEM` is the one key that went from required to optional.
|
|
36
|
+
* Registries up to 2.1.280 carry it with a header. A later registry may carry
|
|
37
|
+
* it header-less upstream (the slot exists but no identifier is sent), in which
|
|
38
|
+
* case it is simply omitted from that registry. The push site then emits no
|
|
39
|
+
* header, while the two sites that read "the mid-conversation-system site is
|
|
40
|
+
* active" (11b and 11c) keep keying on the activity outcome and not on the
|
|
41
|
+
* registry entry, exactly as upstream keys on the composed state.
|
|
27
42
|
*/
|
|
28
43
|
export interface ComposableBetaRegistry {
|
|
29
44
|
readonly CLAUDE_CODE: BetaRegistryEntry;
|
|
@@ -35,10 +50,15 @@ export interface ComposableBetaRegistry {
|
|
|
35
50
|
readonly CONTEXT_MANAGEMENT: BetaRegistryEntry;
|
|
36
51
|
readonly STRUCTURED_OUTPUTS: BetaRegistryEntry;
|
|
37
52
|
readonly PROMPT_CACHING_SCOPE: BetaRegistryEntry;
|
|
38
|
-
readonly MID_CONVERSATION_SYSTEM
|
|
53
|
+
readonly MID_CONVERSATION_SYSTEM?: BetaRegistryEntry;
|
|
39
54
|
readonly PER_MESSAGE_EFFORT?: BetaRegistryEntry;
|
|
40
55
|
readonly MID_CONV_TOOL_CHANGE?: BetaRegistryEntry;
|
|
56
|
+
readonly INLINE_TOOLS?: BetaRegistryEntry;
|
|
57
|
+
readonly TOOL_PROVENANCE?: BetaRegistryEntry;
|
|
58
|
+
readonly ADVISOR_TOOL?: BetaRegistryEntry;
|
|
41
59
|
readonly MID_CONVERSATION_SYSTEM_CLEAR_AT?: BetaRegistryEntry;
|
|
60
|
+
readonly CLAUDE_CODE_SIDE_QUERY?: BetaRegistryEntry;
|
|
61
|
+
readonly MESSAGE_THREADS?: BetaRegistryEntry;
|
|
42
62
|
readonly EFFORT: BetaRegistryEntry;
|
|
43
63
|
readonly THINKING_BINDING_CONTROLS?: BetaRegistryEntry;
|
|
44
64
|
readonly THINKING_DISPLAY_UPDATES?: BetaRegistryEntry;
|
|
@@ -107,6 +127,29 @@ export interface ComposeBetasInput {
|
|
|
107
127
|
* `[1m]` model marker. See `docs/source-trace.md`, governance ledger L10.
|
|
108
128
|
*/
|
|
109
129
|
readonly use1MContextOverride?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Validated caller opt-ins for features the genuine client enables per
|
|
132
|
+
* account. Read only under the profile's `accountServedInputs` behaviour.
|
|
133
|
+
*/
|
|
134
|
+
readonly accountFeatures?: ClaudeCodeAccountFeatures;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the request's tools include the advisor tool
|
|
137
|
+
* (`type: "advisor_20260301"`). Compute it at the call site from the caller's
|
|
138
|
+
* tool list; read only under `accountServedInputs`.
|
|
139
|
+
*/
|
|
140
|
+
readonly hasAdvisorTool?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Marks a side query (the plugin uses it for session-title requests), which
|
|
143
|
+
* adds the claude-code-side-query beta. Read only under
|
|
144
|
+
* `accountServedInputs`.
|
|
145
|
+
*/
|
|
146
|
+
readonly sideQuery?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Marks an agentic query, which restores the claude-code beta for a model
|
|
149
|
+
* the per-model table excludes it from (haiku). Read only under
|
|
150
|
+
* `accountServedInputs`.
|
|
151
|
+
*/
|
|
152
|
+
readonly agenticQuery?: boolean;
|
|
110
153
|
}
|
|
111
154
|
/**
|
|
112
155
|
* Reports the emitted beta set together with the identifiers `suppressBetas`
|
|
@@ -130,7 +173,36 @@ export interface ComposedBetas {
|
|
|
130
173
|
* `output_config.effort` in the body.
|
|
131
174
|
*/
|
|
132
175
|
readonly thinkingDisplayOverride?: "updates";
|
|
176
|
+
/**
|
|
177
|
+
* Whether the context-management site (push site 7) fired, i.e. the
|
|
178
|
+
* experimental gate held and the model declares the capability. Body-side
|
|
179
|
+
* half of a beta/body pair, like `thinkingDisplayOverride`: the body builder
|
|
180
|
+
* generates `context_management` from it under
|
|
181
|
+
* `generatedContextManagement`. Not touched by `suppressBetas`: suppressing
|
|
182
|
+
* the identifier removes the HEADER only (MEMORY #4).
|
|
183
|
+
*/
|
|
184
|
+
readonly contextManagementComposed: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Whether the cache-diagnosis site fired (the profile policy enables it).
|
|
187
|
+
* Body-side half of the pair: the body builder emits `diagnostics` from it
|
|
188
|
+
* under `cacheDiagnosisBody`. Not touched by `suppressBetas`.
|
|
189
|
+
*/
|
|
190
|
+
readonly cacheDiagnosisComposed: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* The thread the body should carry, present only when the message-threads
|
|
193
|
+
* site fired AND the identifier survived `suppressBetas`. Unlike the other
|
|
194
|
+
* body-side halves, a caller who suppresses this beta also loses the body
|
|
195
|
+
* field: sending `thread` without its beta is a request the server rejects.
|
|
196
|
+
*/
|
|
197
|
+
readonly thread?: ClaudeCodeThreadBody;
|
|
133
198
|
}
|
|
199
|
+
/** The wire shape of the body's `thread` object. */
|
|
200
|
+
export type ClaudeCodeThreadBody = {
|
|
201
|
+
readonly type: "create";
|
|
202
|
+
} | {
|
|
203
|
+
readonly type: "continue";
|
|
204
|
+
readonly previous_message_id: string;
|
|
205
|
+
};
|
|
134
206
|
export declare function composeBetas(input: ComposeBetasInput, profile?: ClaudeCodeProtocolProfile): readonly string[];
|
|
135
207
|
export declare function composeBetasWithAudit(input: ComposeBetasInput, profile?: ClaudeCodeProtocolProfile): ComposedBetas;
|
|
136
208
|
export {};
|
package/dist/betas.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"betas.d.ts","sourceRoot":"","sources":["../src/betas.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;AAgCxB,8EAA8E;AAC9E,UAAU,iBAAiB;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,oBAAoB,EAAE,iBAAiB,CAAC;IACjD,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC;IAC5C,QAAQ,CAAC,oBAAoB,EAAE,iBAAiB,CA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