@tormentalabs/claude-code-wire-compat 0.1.0-rc.10

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 (85) hide show
  1. package/CHANGELOG.md +312 -0
  2. package/LICENSE +674 -0
  3. package/NOTICE +16 -0
  4. package/README.md +39 -0
  5. package/dist/anti-verbosity.d.ts +58 -0
  6. package/dist/anti-verbosity.d.ts.map +1 -0
  7. package/dist/anti-verbosity.js +174 -0
  8. package/dist/anti-verbosity.js.map +1 -0
  9. package/dist/beta-registry.d.ts +119 -0
  10. package/dist/beta-registry.d.ts.map +1 -0
  11. package/dist/beta-registry.js +125 -0
  12. package/dist/beta-registry.js.map +1 -0
  13. package/dist/betas.d.ts +11 -0
  14. package/dist/betas.d.ts.map +1 -0
  15. package/dist/betas.js +68 -0
  16. package/dist/betas.js.map +1 -0
  17. package/dist/build-request.d.ts +24 -0
  18. package/dist/build-request.d.ts.map +1 -0
  19. package/dist/build-request.js +1008 -0
  20. package/dist/build-request.js.map +1 -0
  21. package/dist/contracts.d.ts +717 -0
  22. package/dist/contracts.d.ts.map +1 -0
  23. package/dist/contracts.js +36 -0
  24. package/dist/contracts.js.map +1 -0
  25. package/dist/count-tokens.d.ts +42 -0
  26. package/dist/count-tokens.d.ts.map +1 -0
  27. package/dist/count-tokens.js +61 -0
  28. package/dist/count-tokens.js.map +1 -0
  29. package/dist/fingerprint.d.ts +4 -0
  30. package/dist/fingerprint.d.ts.map +1 -0
  31. package/dist/fingerprint.js +59 -0
  32. package/dist/fingerprint.js.map +1 -0
  33. package/dist/headers.d.ts +4 -0
  34. package/dist/headers.d.ts.map +1 -0
  35. package/dist/headers.js +255 -0
  36. package/dist/headers.js.map +1 -0
  37. package/dist/index.d.ts +17 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +6 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/metadata.d.ts +4 -0
  42. package/dist/metadata.d.ts.map +1 -0
  43. package/dist/metadata.js +192 -0
  44. package/dist/metadata.js.map +1 -0
  45. package/dist/model-capabilities.d.ts +103 -0
  46. package/dist/model-capabilities.d.ts.map +1 -0
  47. package/dist/model-capabilities.js +263 -0
  48. package/dist/model-capabilities.js.map +1 -0
  49. package/dist/model-identity.d.ts +11 -0
  50. package/dist/model-identity.d.ts.map +1 -0
  51. package/dist/model-identity.js +64 -0
  52. package/dist/model-identity.js.map +1 -0
  53. package/dist/models.d.ts +9 -0
  54. package/dist/models.d.ts.map +1 -0
  55. package/dist/models.js +25 -0
  56. package/dist/models.js.map +1 -0
  57. package/dist/profiles/claude-code-2.1.195.d.ts +3 -0
  58. package/dist/profiles/claude-code-2.1.195.d.ts.map +1 -0
  59. package/dist/profiles/claude-code-2.1.195.js +150 -0
  60. package/dist/profiles/claude-code-2.1.195.js.map +1 -0
  61. package/dist/redaction.d.ts +16 -0
  62. package/dist/redaction.d.ts.map +1 -0
  63. package/dist/redaction.js +364 -0
  64. package/dist/redaction.js.map +1 -0
  65. package/dist/request-body.d.ts +19 -0
  66. package/dist/request-body.d.ts.map +1 -0
  67. package/dist/request-body.js +1658 -0
  68. package/dist/request-body.js.map +1 -0
  69. package/dist/sha256.d.ts +9 -0
  70. package/dist/sha256.d.ts.map +1 -0
  71. package/dist/sha256.js +104 -0
  72. package/dist/sha256.js.map +1 -0
  73. package/dist/system-prompt.d.ts +4 -0
  74. package/dist/system-prompt.d.ts.map +1 -0
  75. package/dist/system-prompt.js +157 -0
  76. package/dist/system-prompt.js.map +1 -0
  77. package/dist/thinking.d.ts +91 -0
  78. package/dist/thinking.d.ts.map +1 -0
  79. package/dist/thinking.js +132 -0
  80. package/dist/thinking.js.map +1 -0
  81. package/dist/unicode.d.ts +10 -0
  82. package/dist/unicode.d.ts.map +1 -0
  83. package/dist/unicode.js +19 -0
  84. package/dist/unicode.js.map +1 -0
  85. package/package.json +72 -0
package/NOTICE ADDED
@@ -0,0 +1,16 @@
1
+ claude-code-wire-compat
2
+ Copyright (C) 2026 the claude-code-wire-compat contributors
3
+
4
+ SPDX-License-Identifier: GPL-3.0-or-later
5
+
6
+ This package is a modified work derived from opencode-anthropic-fix:
7
+ https://github.com/marco-jardim/opencode-anthropic-fix
8
+ Upstream commit: 466d500
9
+ Upstream license: GPL-3.0-or-later
10
+
11
+ The modified work extracts and packages selected wire-compatibility behavior into a runtime-neutral TypeScript library. Files in this repository have been changed or newly written for package boundaries, deterministic APIs, portability, tests, documentation, and release governance.
12
+
13
+ The complete corresponding source for this modified work is available at:
14
+ https://github.com/marco-jardim/claude-code-wire-compat
15
+
16
+ The full license text is in LICENSE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # claude-code-wire-compat
2
+
3
+ Claude Wire Compat
4
+
5
+ An ESM-only, runtime-neutral TypeScript package for constructing a pinned Claude Code Messages wire contract.
6
+
7
+ > **Status:** bootstrap release candidate. Runtime request-building behavior is intentionally introduced in later releases.
8
+
9
+ ## Package
10
+
11
+ ```sh
12
+ npm install @tormentalabs/claude-code-wire-compat
13
+ ```
14
+
15
+ The package targets Node.js 20 or newer and is designed to remain portable to Bun and standards-based worker runtimes. Consumers own credentials, transport, persistence, refresh coordination, retries, and deployment policy.
16
+
17
+ ## Protocol profile
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.
20
+
21
+ ## Development
22
+
23
+ ```sh
24
+ npm ci
25
+ npm run lint
26
+ npm run typecheck
27
+ npm test
28
+ npm run build
29
+ ```
30
+
31
+ ## Security
32
+
33
+ Do not include access tokens, account identifiers, session identifiers, or private prompts in bug reports. See [SECURITY.md](./SECURITY.md) for private disclosure instructions.
34
+
35
+ ## License and provenance
36
+
37
+ SPDX-License-Identifier: GPL-3.0-or-later
38
+
39
+ This repository is a modified work derived from [opencode-anthropic-fix](https://github.com/marco-jardim/opencode-anthropic-fix) at upstream commit `466d500`. See [NOTICE](./NOTICE) for attribution and modification details. Corresponding source is available in this public repository.
@@ -0,0 +1,58 @@
1
+ import type { AntiVerbosityPolicy, AntiVerbositySection, ClaudeCodeProtocolProfile } from "./contracts.js";
2
+ /**
3
+ * The genuine client's anti-verbosity system-prompt section, and the three-way
4
+ * selector that chooses between its variants.
5
+ *
6
+ * Upstream this is `ytm(e)` at byte offset 238083640 of the
7
+ * pinned client build. The four strings below were not transcribed by hand: they
8
+ * were produced by executing the client's own template literals against stubbed
9
+ * predicates. The forensic dump tooling collapses non-printable runs and so
10
+ * cannot be trusted for whitespace inside a template literal; the branch-3
11
+ * heading in particular is followed by a newline, not a space, which a
12
+ * dump-based reading got wrong.
13
+ *
14
+ * The package EXPOSES this text and never injects it. `buildClaudeCodeRequest`
15
+ * does not consult this module. The genuine client assembles a large system
16
+ * prompt from many sections and this package models only the protocol envelope,
17
+ * so silently adding one section would produce a body matching neither the
18
+ * client nor the caller's intent. This is the same boundary already settled for
19
+ * `defaultEffort` and for cache-breakpoint placement: expose, let the caller
20
+ * decide.
21
+ */
22
+ /** Mirrors upstream defaults: a stock first-party install reports both false. */
23
+ export declare const DEFAULT_ANTI_VERBOSITY_POLICY: AntiVerbosityPolicy;
24
+ /**
25
+ * Branch 1 with upstream `htm` true, which is the default because `htm` is
26
+ * `!(isBriefEnabled() || pewterOwlTool())`. Carries the extra paragraph about
27
+ * text written between tool calls.
28
+ */
29
+ export declare const COMMUNICATING_WITH_THE_USER_FULL: string;
30
+ /** Branch 1 with upstream `htm` false: brief mode or the pewter-owl tool is on. */
31
+ export declare const COMMUNICATING_WITH_THE_USER_CONDENSED: string;
32
+ /** Branch 2, upstream `ph(e)` true. A single sentence. */
33
+ export declare const LEAN_SECTION = "Write code that reads like the surrounding code: match its comment density, naming, and idiom.";
34
+ /** Branch 3, the fallthrough. */
35
+ export declare const TEXT_OUTPUT_SECTION: string;
36
+ /**
37
+ * SHA-256 of each constant as executed from the genuine client. A test pins
38
+ * these so any edit to the text above fails loudly rather than silently
39
+ * shipping a divergent prompt.
40
+ */
41
+ export declare const ANTI_VERBOSITY_DIGESTS: Readonly<{
42
+ communicatingWithTheUserFull: "41a8a87303e6f6f8224906daf9741fd6be495b79400854d92078991d15e9c56c";
43
+ communicatingWithTheUserCondensed: "7028dc6d1492b7616b9b5f2f58416c09a0db5cd671f1032fbaeb9120ad51437b";
44
+ lean: "ee43af37398581e92bde06d341c98c7b7a9ff6c56023c2bc17b9feaf2d6e31ea";
45
+ textOutput: "c184a5d4b4b6a0fc374a37c69f72937abf38bcccaa2d0cce0427968fcda3ccc7";
46
+ }>;
47
+ /**
48
+ * Reports which branch of upstream `ytm` a model selects.
49
+ *
50
+ * Upstream `gtm` is `return !1`, so branch 1 is gated on `Mte` alone. Note
51
+ * that `ytm` passes the NORMALISED id to `Mte` but the RAW caller string to
52
+ * `ph`, because `ph` reaches `i_e`, which must see an unnormalised
53
+ * `-eap` suffix. That asymmetry is reproduced here.
54
+ */
55
+ export declare function selectAntiVerbositySection(rawModel: string, profile?: ClaudeCodeProtocolProfile): AntiVerbositySection;
56
+ /** Returns the exact section text the genuine client would emit for a model. */
57
+ export declare function antiVerbosityText(rawModel: string, policy?: AntiVerbosityPolicy, profile?: ClaudeCodeProtocolProfile): string;
58
+ //# sourceMappingURL=anti-verbosity.d.ts.map
@@ -0,0 +1 @@
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,CAQtB;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,mBAAmD,EAC3D,OAAO,GAAE,yBAAuD,GAC/D,MAAM,CAqBR"}
@@ -0,0 +1,174 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ import { ClaudeCodeWireError } from "./contracts.js";
3
+ import { normalizeModelId } from "./model-identity.js";
4
+ import { CLAUDE_CODE_2_1_195_PROFILE } from "./profiles/claude-code-2.1.195.js";
5
+ /**
6
+ * The genuine client's anti-verbosity system-prompt section, and the three-way
7
+ * selector that chooses between its variants.
8
+ *
9
+ * Upstream this is `ytm(e)` at byte offset 238083640 of the
10
+ * pinned client build. The four strings below were not transcribed by hand: they
11
+ * were produced by executing the client's own template literals against stubbed
12
+ * predicates. The forensic dump tooling collapses non-printable runs and so
13
+ * cannot be trusted for whitespace inside a template literal; the branch-3
14
+ * heading in particular is followed by a newline, not a space, which a
15
+ * dump-based reading got wrong.
16
+ *
17
+ * The package EXPOSES this text and never injects it. `buildClaudeCodeRequest`
18
+ * does not consult this module. The genuine client assembles a large system
19
+ * prompt from many sections and this package models only the protocol envelope,
20
+ * so silently adding one section would produce a body matching neither the
21
+ * client nor the caller's intent. This is the same boundary already settled for
22
+ * `defaultEffort` and for cache-breakpoint placement: expose, let the caller
23
+ * decide.
24
+ */
25
+ /** Mirrors upstream defaults: a stock first-party install reports both false. */
26
+ export const DEFAULT_ANTI_VERBOSITY_POLICY = Object.freeze({
27
+ briefModeEnabled: false,
28
+ pewterOwlToolEnabled: false,
29
+ });
30
+ /**
31
+ * Branch 1 with upstream `htm` true, which is the default because `htm` is
32
+ * `!(isBriefEnabled() || pewterOwlTool())`. Carries the extra paragraph about
33
+ * text written between tool calls.
34
+ */
35
+ export const COMMUNICATING_WITH_THE_USER_FULL = "# Communicating with the user\n" +
36
+ "\n" +
37
+ "Your text output is what the user reads; they usually can't see your thinking or the raw tool results. Write it for a teammate who stepped away and is catching up, not for a log file: they don't know the codenames or shorthand you created along the way, and they didn't watch your process unfold. Before your first tool call, say in a sentence what you're about to do; while working, give brief updates when you find something load-bearing or change direction.\n" +
38
+ "\n" +
39
+ "Text you write between tool calls may not be shown to the user. Everything the user needs from this turn — answers, summaries, findings, conclusions, deliverables — must be in the final text message of your turn, with no tool calls after it. Keep text between tool calls to brief status notes. If something important appeared only mid-turn or in your thinking, restate it in that final message.\n" +
40
+ "\n" +
41
+ 'Lead with the outcome. Your first sentence after finishing should answer "what happened" or "what did you find" — the thing the user would ask for if they said "just give me the TLDR." Supporting detail and reasoning come after, for readers who want them.\n' +
42
+ "\n" +
43
+ "Being readable and being concise are different things, and readable matters more. If the user has to reread your summary or ask you to explain, any time saved by brevity is gone. The way to keep output short is to be selective about what you include (drop details that don't change what the reader would do next), not to compress the writing into fragments, abbreviations, arrow chains like `A → B → fails`, or jargon. What you do include, write in complete sentences with the technical terms spelled out. Don't make the reader cross-reference labels or numbering you invented earlier; say what you mean in place.\n" +
44
+ "\n" +
45
+ "Match the response to the question: a simple question gets a direct answer in prose, not headers and sections. Use tables only for short enumerable facts, with explanations in the surrounding prose rather than the cells. Calibrate to the user — a bit tighter for an expert, more explanatory for someone newer.\n" +
46
+ "\n" +
47
+ "Write code that reads like the surrounding code: match its comment density, naming, and idiom.\n" +
48
+ "Only write a code comment to state a constraint the code itself can't show — never to say where it came from, what the next line does, or why your change is correct; that's you talking to the reviewer, not the next reader, and it's noise the moment the PR merges.";
49
+ /** Branch 1 with upstream `htm` false: brief mode or the pewter-owl tool is on. */
50
+ export const COMMUNICATING_WITH_THE_USER_CONDENSED = "# Communicating with the user\n" +
51
+ "\n" +
52
+ "Your text output is what the user reads between tool calls; they usually can't see your thinking or the raw tool results. Write it for a teammate who stepped away and is catching up, not for a log file: they don't know the codenames or shorthand you created along the way, and they didn't watch your process unfold. Before your first tool call, say in a sentence what you're about to do; while working, give brief updates when you find something load-bearing or change direction.\n" +
53
+ "\n" +
54
+ 'Lead with the outcome. Your first sentence after finishing should answer "what happened" or "what did you find" — the thing the user would ask for if they said "just give me the TLDR." Supporting detail and reasoning come after, for readers who want them.\n' +
55
+ "\n" +
56
+ "Being readable and being concise are different things, and readable matters more. If the user has to reread your summary or ask you to explain, any time saved by brevity is gone. The way to keep output short is to be selective about what you include (drop details that don't change what the reader would do next), not to compress the writing into fragments, abbreviations, arrow chains like `A → B → fails`, or jargon. What you do include, write in complete sentences with the technical terms spelled out. Don't make the reader cross-reference labels or numbering you invented earlier; say what you mean in place.\n" +
57
+ "\n" +
58
+ "Match the response to the question: a simple question gets a direct answer in prose, not headers and sections. Use tables only for short enumerable facts, with explanations in the surrounding prose rather than the cells. Calibrate to the user — a bit tighter for an expert, more explanatory for someone newer.\n" +
59
+ "\n" +
60
+ "Write code that reads like the surrounding code: match its comment density, naming, and idiom.\n" +
61
+ "Only write a code comment to state a constraint the code itself can't show — never to say where it came from, what the next line does, or why your change is correct; that's you talking to the reviewer, not the next reader, and it's noise the moment the PR merges.";
62
+ /** Branch 2, upstream `ph(e)` true. A single sentence. */
63
+ export const LEAN_SECTION = "Write code that reads like the surrounding code: match its comment density, naming, and idiom.";
64
+ /** Branch 3, the fallthrough. */
65
+ export const TEXT_OUTPUT_SECTION = "# Text output (does not apply to tool calls)\n" +
66
+ "Assume users can't see most tool calls or thinking — only your text output. Before your first tool call, state in one sentence what you're about to do. While working, give short updates at key moments: when you find something, when you change direction, or when you hit a blocker. Brief is good — silent is not. One sentence per update is almost always enough.\n" +
67
+ "\n" +
68
+ "Don't narrate your internal deliberation. User-facing text should be relevant communication to the user, not a running commentary on your thought process. State results and decisions directly, and focus user-facing text on relevant updates for the user.\n" +
69
+ "\n" +
70
+ "When you do write updates, write so the reader can pick up cold: complete sentences, no unexplained jargon or shorthand from earlier in the session. But keep it tight — a clear sentence is better than a clear paragraph.\n" +
71
+ "\n" +
72
+ "End-of-turn summary: one or two sentences. What changed and what's next. Nothing else.\n" +
73
+ "\n" +
74
+ "Match responses to the task: a simple question gets a direct answer, not headers and sections.\n" +
75
+ "\n" +
76
+ "In code: default to writing no comments. Never write multi-paragraph docstrings or multi-line comment blocks — one short line max. Don't create planning, decision, or analysis documents unless the user asks for them — work from conversation context, not intermediate files.";
77
+ /**
78
+ * SHA-256 of each constant as executed from the genuine client. A test pins
79
+ * these so any edit to the text above fails loudly rather than silently
80
+ * shipping a divergent prompt.
81
+ */
82
+ export const ANTI_VERBOSITY_DIGESTS = Object.freeze({
83
+ communicatingWithTheUserFull: "41a8a87303e6f6f8224906daf9741fd6be495b79400854d92078991d15e9c56c",
84
+ communicatingWithTheUserCondensed: "7028dc6d1492b7616b9b5f2f58416c09a0db5cd671f1032fbaeb9120ad51437b",
85
+ lean: "ee43af37398581e92bde06d341c98c7b7a9ff6c56023c2bc17b9feaf2d6e31ea",
86
+ textOutput: "c184a5d4b4b6a0fc374a37c69f72937abf38bcccaa2d0cce0427968fcda3ccc7",
87
+ });
88
+ /** Upstream `i_e`, deliberately applied to the RAW caller string. */
89
+ const EAP_PATTERN = /-eap($|\[)/iu;
90
+ function catalogueCapability(normalizedId, capability, profile) {
91
+ if (!Object.hasOwn(profile.supportedModels, normalizedId))
92
+ return false;
93
+ return (profile.supportedModels[normalizedId]?.capabilities.includes(capability) ===
94
+ true);
95
+ }
96
+ /**
97
+ * Upstream `Mte`. This is one of the few places where the catalogue capability
98
+ * array is genuinely load-bearing: unlike the nine model-capability predicates,
99
+ * `Mte` has no provider fallback, so the membership test decides the result.
100
+ */
101
+ function hasFableMitigations(normalizedId, profile) {
102
+ return (catalogueCapability(normalizedId, "fable_5_mitigations", profile) ||
103
+ normalizedId === "claude-mythos-5");
104
+ }
105
+ /**
106
+ * Upstream `Kkd`. Its trailing `return !td()` is false on the first-party
107
+ * provider this profile pins, so an unrecognised identifier falls through to
108
+ * the lean branch rather than the text-output branch.
109
+ *
110
+ * Upstream also carries `|| t === "claude-mythos-5"` beside the
111
+ * `lean_prompt` test. It is omitted here because it is unreachable: the only
112
+ * caller tests `hasFableMitigations` first, which already claims mythos-5 for
113
+ * the communicating-with-the-user branch. Upstream shares `Kkd` with other
114
+ * call sites and so still needs it. Restore it if this helper ever gains a
115
+ * second caller.
116
+ */
117
+ function usesTextOutputSection(rawModel, profile) {
118
+ if (EAP_PATTERN.test(rawModel))
119
+ return false;
120
+ const id = normalizeModelId(rawModel);
121
+ if (catalogueCapability(id, "lean_prompt", profile))
122
+ return false;
123
+ return (id.includes("claude-3-") ||
124
+ id.includes("haiku") ||
125
+ id.includes("sonnet") ||
126
+ id === "claude-opus-4-0" ||
127
+ id === "claude-opus-4-1" ||
128
+ id === "claude-opus-4-5" ||
129
+ id === "claude-opus-4-6" ||
130
+ id === "claude-opus-4-7");
131
+ }
132
+ /**
133
+ * Reports which branch of upstream `ytm` a model selects.
134
+ *
135
+ * Upstream `gtm` is `return !1`, so branch 1 is gated on `Mte` alone. Note
136
+ * that `ytm` passes the NORMALISED id to `Mte` but the RAW caller string to
137
+ * `ph`, because `ph` reaches `i_e`, which must see an unnormalised
138
+ * `-eap` suffix. That asymmetry is reproduced here.
139
+ */
140
+ export function selectAntiVerbositySection(rawModel, profile = CLAUDE_CODE_2_1_195_PROFILE) {
141
+ if (typeof rawModel !== "string" || rawModel.length === 0) {
142
+ throw new ClaudeCodeWireError("INVALID_INPUT");
143
+ }
144
+ if (hasFableMitigations(normalizeModelId(rawModel), profile)) {
145
+ return "communicating-with-the-user";
146
+ }
147
+ return usesTextOutputSection(rawModel, profile) ? "text-output" : "lean";
148
+ }
149
+ /** Returns the exact section text the genuine client would emit for a model. */
150
+ export function antiVerbosityText(rawModel, policy = DEFAULT_ANTI_VERBOSITY_POLICY, profile = CLAUDE_CODE_2_1_195_PROFILE) {
151
+ // Validated eagerly, and for every section rather than only the one that
152
+ // reads it, so a malformed policy fails the same way regardless of which
153
+ // model it is paired with. `selectAntiVerbositySection` validates its own
154
+ // argument the same way despite the declared types, because callers reach
155
+ // this module across an untyped boundary.
156
+ const candidate = policy;
157
+ if (candidate === null || typeof candidate !== "object") {
158
+ throw new ClaudeCodeWireError("INVALID_INPUT");
159
+ }
160
+ const brief = Reflect.get(candidate, "briefModeEnabled");
161
+ const pewterOwl = Reflect.get(candidate, "pewterOwlToolEnabled");
162
+ if (typeof brief !== "boolean" || typeof pewterOwl !== "boolean") {
163
+ throw new ClaudeCodeWireError("INVALID_INPUT");
164
+ }
165
+ const section = selectAntiVerbositySection(rawModel, profile);
166
+ if (section === "lean")
167
+ return LEAN_SECTION;
168
+ if (section === "text-output")
169
+ return TEXT_OUTPUT_SECTION;
170
+ return brief || pewterOwl
171
+ ? COMMUNICATING_WITH_THE_USER_CONDENSED
172
+ : COMMUNICATING_WITH_THE_USER_FULL;
173
+ }
174
+ //# sourceMappingURL=anti-verbosity.js.map
@@ -0,0 +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;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,6BAA6B,GAAwB,MAAM,CAAC,MAAM,CAC7E;IACE,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,KAAK;CAC5B,CACF,CAAC;AAEF;;;;GAIG;AACH,MAA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,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;AAC3E,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,SAA8B,6BAA6B,EAC3D,UAAqC,2BAA2B;IAEhE,yEAAyE;IACzE,yEAAyE;IACzE,0EAA0E;IAC1E,0EAA0E;IAC1E,0CAA0C;IAC1C,MAAM,SAAS,GAAY,MAAM,CAAC;IAClC,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QACxD,MAAM,IAAI,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAClE,MAAM,SAAS,GAAY,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;IAC1E,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,SAAS,KAAK,SAAS,EAAE,CAAC;QACjE,MAAM,IAAI,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,OAAO,GAAG,0BAA0B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9D,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,YAAY,CAAC;IAC5C,IAAI,OAAO,KAAK,aAAa;QAAE,OAAO,mBAAmB,CAAC;IAC1D,OAAO,KAAK,IAAI,SAAS;QACvB,CAAC,CAAC,qCAAqC;QACvC,CAAC,CAAC,gCAAgC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,119 @@
1
+ /** Genuine-client beta registry, upstream `Udd`. */
2
+ export declare const BETA_REGISTRY: {
3
+ CLAUDE_CODE: {
4
+ featureKey: string;
5
+ header: string;
6
+ };
7
+ OAUTH_AUTH: {
8
+ featureKey: string;
9
+ header: string;
10
+ };
11
+ INTERLEAVED_THINKING: {
12
+ featureKey: string;
13
+ header: string;
14
+ };
15
+ LONG_CONTEXT: {
16
+ featureKey: string;
17
+ header: string;
18
+ };
19
+ CONTEXT_MANAGEMENT: {
20
+ featureKey: string;
21
+ header: string;
22
+ };
23
+ STRUCTURED_OUTPUTS: {
24
+ featureKey: string;
25
+ header: string;
26
+ };
27
+ WEB_SEARCH: {
28
+ featureKey: string;
29
+ header: string;
30
+ };
31
+ ADVANCED_TOOL_USE: {
32
+ featureKey: string;
33
+ header: string;
34
+ };
35
+ TOOL_SEARCH: {
36
+ featureKey: string;
37
+ header: string;
38
+ };
39
+ EFFORT: {
40
+ featureKey: string;
41
+ header: string;
42
+ };
43
+ TASK_BUDGETS: {
44
+ featureKey: string;
45
+ header: string;
46
+ };
47
+ PROMPT_CACHING_SCOPE: {
48
+ featureKey: string;
49
+ header: string;
50
+ };
51
+ EXTENDED_CACHE_TTL: {
52
+ featureKey: string;
53
+ header: string;
54
+ };
55
+ SPEED: {
56
+ featureKey: string;
57
+ header: string;
58
+ };
59
+ REDACT_THINKING: {
60
+ featureKey: string;
61
+ header: string;
62
+ };
63
+ THINKING_TOKEN_COUNT: {
64
+ featureKey: string;
65
+ header: string;
66
+ };
67
+ NARRATION_SUMMARIES: {
68
+ featureKey: string;
69
+ header: string;
70
+ };
71
+ AFK_MODE: {
72
+ featureKey: string;
73
+ header: string;
74
+ };
75
+ ADVISOR_TOOL: {
76
+ featureKey: string;
77
+ header: string;
78
+ };
79
+ CACHE_DIAGNOSIS: {
80
+ featureKey: string;
81
+ header: string;
82
+ };
83
+ CONTEXT_HINT: {
84
+ featureKey: string;
85
+ header: string;
86
+ };
87
+ MCP_SERVERS: {
88
+ featureKey: string;
89
+ header: string;
90
+ };
91
+ FILES_API: {
92
+ featureKey: string;
93
+ header: string;
94
+ };
95
+ ENVIRONMENTS: {
96
+ featureKey: string;
97
+ header: string;
98
+ };
99
+ CCR_BYOC: {
100
+ featureKey: string;
101
+ header: string;
102
+ };
103
+ MID_CONVERSATION_SYSTEM: {
104
+ featureKey: string;
105
+ header: string;
106
+ };
107
+ SERVER_SIDE_FALLBACK: {
108
+ featureKey: string;
109
+ header: string;
110
+ };
111
+ FALLBACK_CREDIT: {
112
+ featureKey: string;
113
+ header: string;
114
+ };
115
+ };
116
+ export declare const THIRD_PARTY_ALLOWED_BETAS: ReadonlySet<string>;
117
+ export declare const BEDROCK_UNSUPPORTED_BETAS: ReadonlySet<string>;
118
+ export declare const COUNT_TOKENS_BETAS: ReadonlySet<string>;
119
+ //# sourceMappingURL=beta-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beta-registry.d.ts","sourceRoot":"","sources":["../src/beta-registry.ts"],"names":[],"mappings":"AAiBA,oDAAoD;AACpD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsFoB,CAAC;AAG/C,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAazD,CAAC;AAGF,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAMzD,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAOlD,CAAC"}
@@ -0,0 +1,125 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ function deepFreeze(value) {
3
+ if (value !== null && typeof value === "object") {
4
+ for (const key of Reflect.ownKeys(value)) {
5
+ deepFreeze(Reflect.get(value, key));
6
+ }
7
+ Object.freeze(value);
8
+ }
9
+ return value;
10
+ }
11
+ /** Genuine-client beta registry, upstream `Udd`. */
12
+ export const BETA_REGISTRY = deepFreeze({
13
+ CLAUDE_CODE: { featureKey: "claude_code", header: "claude-code-20250219" }, // Y2e
14
+ OAUTH_AUTH: { featureKey: "oauth_auth", header: "oauth-2025-04-20" }, // qIe
15
+ INTERLEAVED_THINKING: {
16
+ featureKey: "interleaved_thinking",
17
+ header: "interleaved-thinking-2025-05-14",
18
+ }, // Gnt
19
+ LONG_CONTEXT: { featureKey: "long_context", header: "context-1m-2025-08-07" }, // FY
20
+ CONTEXT_MANAGEMENT: {
21
+ featureKey: "context_management",
22
+ header: "context-management-2025-06-27",
23
+ }, // X2e
24
+ STRUCTURED_OUTPUTS: {
25
+ featureKey: "structured_outputs",
26
+ header: "structured-outputs-2025-12-15",
27
+ }, // lte
28
+ WEB_SEARCH: { featureKey: "web_search", header: "web-search-2025-03-05" }, // IPt
29
+ ADVANCED_TOOL_USE: {
30
+ featureKey: "tool_search",
31
+ header: "advanced-tool-use-2025-11-20",
32
+ }, // p2r
33
+ TOOL_SEARCH: {
34
+ featureKey: "tool_search",
35
+ header: "tool-search-tool-2025-10-19",
36
+ }, // xPt
37
+ EFFORT: { featureKey: "effort", header: "effort-2025-11-24" }, // Wnt
38
+ TASK_BUDGETS: {
39
+ featureKey: "task_budgets",
40
+ header: "task-budgets-2026-03-13",
41
+ }, // lAn
42
+ PROMPT_CACHING_SCOPE: {
43
+ featureKey: "prompt_caching_scope",
44
+ header: "prompt-caching-scope-2026-01-05",
45
+ }, // qnt
46
+ EXTENDED_CACHE_TTL: {
47
+ featureKey: "extended_cache_ttl",
48
+ header: "extended-cache-ttl-2025-04-11",
49
+ }, // J2e
50
+ SPEED: { featureKey: "speed", header: "fast-mode-2026-02-01" }, // Vnt
51
+ REDACT_THINKING: {
52
+ featureKey: "redact_thinking",
53
+ header: "redact-thinking-2026-02-12",
54
+ }, // kPt
55
+ THINKING_TOKEN_COUNT: {
56
+ featureKey: "thinking_token_count",
57
+ header: "thinking-token-count-2026-05-13",
58
+ }, // cAn
59
+ NARRATION_SUMMARIES: {
60
+ featureKey: "narration_summaries",
61
+ header: "summarize-connector-text-2026-03-13",
62
+ }, // RPt
63
+ AFK_MODE: { featureKey: "afk_mode", header: "afk-mode-2026-01-31" }, // T0
64
+ ADVISOR_TOOL: {
65
+ featureKey: "advisor_tool",
66
+ header: "advisor-tool-2026-03-01",
67
+ }, // f2r
68
+ CACHE_DIAGNOSIS: {
69
+ featureKey: "cache_diagnosis",
70
+ header: "cache-diagnosis-2026-04-07",
71
+ }, // fye
72
+ CONTEXT_HINT: {
73
+ featureKey: "context_hint",
74
+ header: "context-hint-2026-04-09",
75
+ }, // m2r
76
+ MCP_SERVERS: {
77
+ featureKey: "mcp_servers",
78
+ header: "mcp-servers-2025-12-04",
79
+ }, // g2r
80
+ FILES_API: { featureKey: "files_api", header: "files-api-2025-04-14" }, // h2r
81
+ ENVIRONMENTS: {
82
+ featureKey: "environments",
83
+ header: "environments-2025-11-01",
84
+ }, // y2r
85
+ CCR_BYOC: { featureKey: "ccr_byoc", header: "ccr-byoc-2025-07-29" }, // _2r
86
+ MID_CONVERSATION_SYSTEM: {
87
+ featureKey: "mid_conversation_system",
88
+ header: "mid-conversation-system-2026-04-07",
89
+ }, // jY
90
+ SERVER_SIDE_FALLBACK: {
91
+ featureKey: "server_side_fallback",
92
+ header: "server-side-fallback-2026-06-01",
93
+ }, // r1
94
+ FALLBACK_CREDIT: {
95
+ featureKey: "fallback_credit",
96
+ header: "fallback-credit-2026-06-01",
97
+ }, // o1
98
+ });
99
+ // Reserved for later work packages; upstream `Pvi` third-party filtering.
100
+ export const THIRD_PARTY_ALLOWED_BETAS = Object.freeze(new Set([
101
+ BETA_REGISTRY.CLAUDE_CODE.header,
102
+ BETA_REGISTRY.INTERLEAVED_THINKING.header,
103
+ BETA_REGISTRY.LONG_CONTEXT.header,
104
+ BETA_REGISTRY.CONTEXT_MANAGEMENT.header,
105
+ BETA_REGISTRY.STRUCTURED_OUTPUTS.header,
106
+ BETA_REGISTRY.WEB_SEARCH.header,
107
+ BETA_REGISTRY.EFFORT.header,
108
+ BETA_REGISTRY.TOOL_SEARCH.header,
109
+ BETA_REGISTRY.AFK_MODE.header,
110
+ BETA_REGISTRY.FALLBACK_CREDIT.header,
111
+ ]));
112
+ // Reserved for later work packages; upstream `S2r` provider filtering.
113
+ export const BEDROCK_UNSUPPORTED_BETAS = Object.freeze(new Set([
114
+ BETA_REGISTRY.INTERLEAVED_THINKING.header,
115
+ BETA_REGISTRY.LONG_CONTEXT.header,
116
+ BETA_REGISTRY.TOOL_SEARCH.header,
117
+ ]));
118
+ // Reserved for later work packages; upstream `E2r` count-tokens selection.
119
+ export const COUNT_TOKENS_BETAS = Object.freeze(new Set([
120
+ BETA_REGISTRY.CLAUDE_CODE.header,
121
+ BETA_REGISTRY.INTERLEAVED_THINKING.header,
122
+ BETA_REGISTRY.CONTEXT_MANAGEMENT.header,
123
+ BETA_REGISTRY.OAUTH_AUTH.header,
124
+ ]));
125
+ //# sourceMappingURL=beta-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beta-registry.js","sourceRoot":"","sources":["../src/beta-registry.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAO5C,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oDAAoD;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,WAAW,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,sBAAsB,EAAE,EAAE,MAAM;IAClF,UAAU,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM;IAC5E,oBAAoB,EAAE;QACpB,UAAU,EAAE,sBAAsB;QAClC,MAAM,EAAE,iCAAiC;KAC1C,EAAE,MAAM;IACT,Y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M;IACvC,aAAa,CAAC,kBAAkB,CAAC,MAAM;IACvC,aAAa,CAAC,UAAU,CAAC,MAAM;IAC/B,aAAa,CAAC,MAAM,CAAC,MAAM;IAC3B,aAAa,CAAC,WAAW,CAAC,MAAM;IAChC,aAAa,CAAC,QAAQ,CAAC,MAAM;IAC7B,aAAa,CAAC,eAAe,CAAC,MAAM;CACrC,CAAC,CACH,CAAC;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAwB,MAAM,CAAC,MAAM,CACzE,IAAI,GAAG,CAAC;IACN,aAAa,CAAC,oBAAoB,CAAC,MAAM;IACzC,aAAa,CAAC,YAAY,CAAC,MAAM;IACjC,aAAa,CAAC,WAAW,CAAC,MAAM;CACjC,CAAC,CACH,CAAC;AAEF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAwB,MAAM,CAAC,MAAM,CAClE,IAAI,GAAG,CAAC;IACN,aAAa,CAAC,WAAW,CAAC,MAAM;IAChC,aAAa,CAAC,oBAAoB,CAAC,MAAM;IACzC,aAAa,CAAC,kBAAkB,CAAC,MAAM;IACvC,aAAa,CAAC,UAAU,CAAC,MAAM;CAChC,CAAC,CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ClaudeCodeCapabilities, ClaudeCodeProtocolProfile } from "./contracts.js";
2
+ export interface ComposeBetasInput {
3
+ readonly rawModel: string;
4
+ readonly normalizedId: string;
5
+ readonly capabilities: ClaudeCodeCapabilities;
6
+ readonly thinkingDisplayActive: boolean;
7
+ readonly cacheTtl?: "5m" | "1h" | null;
8
+ readonly speed?: "standard" | "fast" | null;
9
+ }
10
+ export declare function composeBetas(input: ComposeBetasInput, profile?: ClaudeCodeProtocolProfile): readonly string[];
11
+ //# sourceMappingURL=betas.d.ts.map
@@ -0,0 +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;AAkBxB,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;CAC7C;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,yBAAuD,GAC/D,SAAS,MAAM,EAAE,CA0EnB"}
package/dist/betas.js ADDED
@@ -0,0 +1,68 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ import { BETA_REGISTRY } from "./beta-registry.js";
3
+ import { supportsMidConversationSystem, supportsStructuredOutputs, } from "./model-capabilities.js";
4
+ import { CLAUDE_CODE_2_1_195_PROFILE } from "./profiles/claude-code-2.1.195.js";
5
+ export function composeBetas(input, profile = CLAUDE_CODE_2_1_195_PROFILE) {
6
+ const out = [];
7
+ const policy = profile.betaPolicy;
8
+ const experimental = policy.experimentalBetasEnabled;
9
+ if (!input.normalizedId.includes("haiku"))
10
+ out.push(BETA_REGISTRY.CLAUDE_CODE.header);
11
+ if (policy.oauthAuthenticated)
12
+ out.push(BETA_REGISTRY.OAUTH_AUTH.header);
13
+ if (policy.oneMillionContextEnabled && /\[1m\]/iu.test(input.rawModel)) {
14
+ out.push(BETA_REGISTRY.LONG_CONTEXT.header);
15
+ }
16
+ if (policy.interleavedThinkingEnabled &&
17
+ input.capabilities.interleavedThinking) {
18
+ out.push(BETA_REGISTRY.INTERLEAVED_THINKING.header);
19
+ }
20
+ if (experimental &&
21
+ input.capabilities.interleavedThinking &&
22
+ policy.interactive &&
23
+ !policy.thinkingSummariesShown &&
24
+ !input.thinkingDisplayActive) {
25
+ out.push(BETA_REGISTRY.REDACT_THINKING.header);
26
+ }
27
+ if (policy.thinkingTokenCountEnabled &&
28
+ experimental &&
29
+ input.capabilities.interleavedThinking) {
30
+ out.push(BETA_REGISTRY.THINKING_TOKEN_COUNT.header);
31
+ }
32
+ if (experimental && policy.narrationSummariesEnabled)
33
+ out.push(BETA_REGISTRY.NARRATION_SUMMARIES.header);
34
+ if (experimental && input.capabilities.contextManagement)
35
+ out.push(BETA_REGISTRY.CONTEXT_MANAGEMENT.header);
36
+ if (experimental &&
37
+ supportsStructuredOutputs(input.normalizedId) &&
38
+ policy.structuredOutputsEnabled) {
39
+ out.push(BETA_REGISTRY.STRUCTURED_OUTPUTS.header);
40
+ }
41
+ // No web-search beta: upstream pushes it only for vertex and foundry.
42
+ if (experimental)
43
+ out.push(BETA_REGISTRY.PROMPT_CACHING_SCOPE.header);
44
+ if (supportsMidConversationSystem(input.normalizedId))
45
+ out.push(BETA_REGISTRY.MID_CONVERSATION_SYSTEM.header);
46
+ if (input.capabilities.effort)
47
+ out.push(BETA_REGISTRY.EFFORT.header);
48
+ if (input.speed === "fast" && !out.includes(BETA_REGISTRY.SPEED.header)) {
49
+ out.push(BETA_REGISTRY.SPEED.header);
50
+ }
51
+ if (policy.afkModeEnabled && !out.includes(BETA_REGISTRY.AFK_MODE.header)) {
52
+ out.push(BETA_REGISTRY.AFK_MODE.header);
53
+ }
54
+ if (input.cacheTtl === "1h" &&
55
+ experimental &&
56
+ !out.includes(BETA_REGISTRY.EXTENDED_CACHE_TTL.header)) {
57
+ out.push(BETA_REGISTRY.EXTENDED_CACHE_TTL.header);
58
+ }
59
+ if (profile.contextHintEnabled)
60
+ out.push(BETA_REGISTRY.CONTEXT_HINT.header);
61
+ if (policy.cacheDiagnosisEnabled &&
62
+ !out.includes(BETA_REGISTRY.CACHE_DIAGNOSIS.header)) {
63
+ out.push(BETA_REGISTRY.CACHE_DIAGNOSIS.header);
64
+ }
65
+ // No advisor-tool beta: upstream has no observed unconditional push site.
66
+ return Object.freeze(out);
67
+ }
68
+ //# sourceMappingURL=betas.js.map
@@ -0,0 +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,EACL,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAsBhF,MAAM,UAAU,YAAY,CAC1B,KAAwB,EACxB,UAAqC,2BAA2B;IAEhE,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAClC,MAAM,YAAY,GAAG,MAAM,CAAC,wBAAwB,CAAC;IAErD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;QACvC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,kBAAkB;QAAE,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACzE,IAAI,MAAM,CAAC,wBAAwB,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvE,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IACD,IACE,MAAM,CAAC,0BAA0B;QACjC,KAAK,CAAC,YAAY,CAAC,mBAAmB,EACtC,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IACD,IACE,YAAY;QACZ,KAAK,CAAC,YAAY,CAAC,mBAAmB;QACtC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