@askalf/dario 4.8.129 → 4.8.131

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.
@@ -362,11 +362,13 @@ export declare function parseEffortSuffix(model: string): {
362
362
  * defaulted to `high`; dario special-cased it. A fresh live replay on 2026-07-01
363
363
  * through the deployed proxy (CC 2.1.198's verbatim fable body, only
364
364
  * output_config.effort mutated) shows the redeployed fable now ANSWERS all three
365
- * — high/xhigh/max → end_turn, zero refusals and CC 2.1.198 itself sends
366
- * `effort: xhigh` on fable (same as opus). So the clamp + the fable-only default
367
- * are gone: fable now takes the general path (default 'max', no clamp), matching
368
- * how dario treats opus. `model` is retained in the signature for callers and in
369
- * case a future model needs per-family effort handling again.
365
+ * — high/xhigh/max → end_turn, zero refusals. So the clamp + the fable-only
366
+ * default are gone: fable now takes the general path (no clamp), matching how
367
+ * dario treats opus. The general default is `high` (see resolveEffort below)
368
+ * Claude Code's out-of-box default. Effort is a user-adjustable knob, so no
369
+ * single value is "the" value; `high` is the safe unconfigured baseline.
370
+ * `model` is retained in the signature in case a future model needs per-family
371
+ * effort handling again.
370
372
  *
371
373
  * Exported for tests.
372
374
  */
@@ -1111,17 +1111,26 @@ function normalizeEffortForWire(effort) {
1111
1111
  * defaulted to `high`; dario special-cased it. A fresh live replay on 2026-07-01
1112
1112
  * through the deployed proxy (CC 2.1.198's verbatim fable body, only
1113
1113
  * output_config.effort mutated) shows the redeployed fable now ANSWERS all three
1114
- * — high/xhigh/max → end_turn, zero refusals and CC 2.1.198 itself sends
1115
- * `effort: xhigh` on fable (same as opus). So the clamp + the fable-only default
1116
- * are gone: fable now takes the general path (default 'max', no clamp), matching
1117
- * how dario treats opus. `model` is retained in the signature for callers and in
1118
- * case a future model needs per-family effort handling again.
1114
+ * — high/xhigh/max → end_turn, zero refusals. So the clamp + the fable-only
1115
+ * default are gone: fable now takes the general path (no clamp), matching how
1116
+ * dario treats opus. The general default is `high` (see resolveEffort below)
1117
+ * Claude Code's out-of-box default. Effort is a user-adjustable knob, so no
1118
+ * single value is "the" value; `high` is the safe unconfigured baseline.
1119
+ * `model` is retained in the signature in case a future model needs per-family
1120
+ * effort handling again.
1119
1121
  *
1120
1122
  * Exported for tests.
1121
1123
  */
1122
1124
  export function resolveEffort(flag, clientBody, model) {
1123
1125
  void model; // no per-family effort handling at present (see FABLE CLAMP note above)
1124
- const familyDefault = 'max';
1126
+ // `high` is Claude Code's out-of-box default effort. The prior default `'max'`
1127
+ // was the reasoning ceiling: combined with unbounded adaptive thinking it makes
1128
+ // the model reason until it exhausts `max_tokens` — on prompts over ~5K input
1129
+ // tokens the thinking phase consumes the entire budget, so the stream ends
1130
+ // `stop_reason: max_tokens` with ZERO text blocks (dario#658). `high` thinks
1131
+ // proportionally and leaves room for the answer. Effort is a user-adjustable
1132
+ // knob; operators who want a higher tier pin it via `--effort` / DARIO_EFFORT.
1133
+ const familyDefault = 'high';
1125
1134
  if (flag === undefined)
1126
1135
  return familyDefault;
1127
1136
  if (flag === 'client') {
package/dist/cch.d.ts CHANGED
@@ -3,8 +3,8 @@ export declare const CCH_SEEDS: Record<string, bigint>;
3
3
  /**
4
4
  * Whether a calibrated cch seed exists for `version`. The proxy gates cch
5
5
  * EMISSION on this: with a seed it stamps the deterministic value, without
6
- * one it omits the token (matching CC 2.1.199+, which sends no cch). Keyed on
7
- * `major.minor.patch` — same key space as CCH_SEEDS.
6
+ * one it omits the token (matching current Claude Code, which sends no cch).
7
+ * Keyed on `major.minor.patch` — same key space as CCH_SEEDS.
8
8
  */
9
9
  export declare function hasCchSeed(version: string): boolean;
10
10
  /** Canonical xxHash64 of `data` with a 64-bit `seed`. */
package/dist/cch.js CHANGED
@@ -24,14 +24,13 @@
24
24
  // version returns null; the caller then OMITS the cch token entirely rather
25
25
  // than stamping a random one (see hasCchSeed below).
26
26
  //
27
- // ⚠ Claude Code DROPPED the cch token between 2.1.177 and 2.1.199 (live
28
- // capture 2026-07-03, sdk-cli entrypoint the entrypoint dario claims): the
29
- // billing block is now `cc_version=…; cc_entrypoint=sdk-cli;` with no `cch=`.
30
- // So "no seed" and "CC emits no cch" currently coincide, and gating cch
31
- // emission on seed availability keeps dario byte-aligned with real CC: we emit
32
- // cch only when we can emit the CORRECT deterministic value, and otherwise
33
- // send nothing which is exactly what current CC sends. A random cch never
34
- // validates AND is a field genuine CC no longer carries: a 100%-vs-0% tell.
27
+ // ⚠ Claude Code DROPPED the cch token in a recent release: newer versions send
28
+ // the billing block as `cc_version=…; cc_entrypoint=sdk-cli;` with no `cch=`.
29
+ // So "no seed" and "current Claude Code sends no cch" coincide, and gating cch
30
+ // emission on seed availability keeps dario in step with it: emit cch only when
31
+ // we hold the value to produce it correctly, and otherwise send nothing — which
32
+ // is what current Claude Code sends. A stamped-but-wrong or random cch is worse
33
+ // than none: it's a field current Claude Code no longer includes.
35
34
  /** Verified per-release seeds, keyed on `major.minor.patch`. */
36
35
  export const CCH_SEEDS = {
37
36
  '2.1.177': 0x4d659218e32a3268n,
@@ -39,8 +38,8 @@ export const CCH_SEEDS = {
39
38
  /**
40
39
  * Whether a calibrated cch seed exists for `version`. The proxy gates cch
41
40
  * EMISSION on this: with a seed it stamps the deterministic value, without
42
- * one it omits the token (matching CC 2.1.199+, which sends no cch). Keyed on
43
- * `major.minor.patch` — same key space as CCH_SEEDS.
41
+ * one it omits the token (matching current Claude Code, which sends no cch).
42
+ * Keyed on `major.minor.patch` — same key space as CCH_SEEDS.
44
43
  */
45
44
  export function hasCchSeed(version) {
46
45
  return CCH_SEEDS[version] !== undefined;
@@ -282,7 +282,7 @@ export declare function _resetInstalledVersionProbeForTest(): void;
282
282
  */
283
283
  export declare const SUPPORTED_CC_RANGE: {
284
284
  readonly min: "1.0.0";
285
- readonly maxTested: "2.1.199";
285
+ readonly maxTested: "2.1.200";
286
286
  };
287
287
  /**
288
288
  * Compare two dotted-numeric version strings. Returns negative if `a<b`,
@@ -786,7 +786,7 @@ export function _resetInstalledVersionProbeForTest() {
786
786
  */
787
787
  export const SUPPORTED_CC_RANGE = {
788
788
  min: '1.0.0',
789
- maxTested: '2.1.199',
789
+ maxTested: '2.1.200',
790
790
  };
791
791
  /**
792
792
  * Compare two dotted-numeric version strings. Returns negative if `a<b`,
package/dist/proxy.d.ts CHANGED
@@ -3,18 +3,18 @@ import { type WriteStream } from 'node:fs';
3
3
  import { getAccessToken, getStatus } from './oauth.js';
4
4
  import { type EffortValue } from './cc-template.js';
5
5
  /**
6
- * Assemble the `x-anthropic-billing-header` system-block text, tracking real
7
- * Claude Code's wire shape:
8
- * with cch: `…; cc_entrypoint=sdk-cli; cch=<5hex>;` (CC ≤ 2.1.177)
9
- * without cch: `…; cc_entrypoint=sdk-cli;` (CC 2.1.199+)
6
+ * Assemble the `x-anthropic-billing-header` system-block text, following
7
+ * Claude Code's format:
8
+ * with cch: `…; cc_entrypoint=sdk-cli; cch=<5hex>;` (older releases)
9
+ * without cch: `…; cc_entrypoint=sdk-cli;` (current releases)
10
10
  *
11
11
  * `cch` is passed in rather than generated here so this stays a pure, testable
12
12
  * string builder: the caller gates on hasCchSeed(cliVersion) and passes
13
13
  * computeCch() (a placeholder stampCch later overwrites with the deterministic
14
14
  * value) when a seed exists, or null when it doesn't. Passing null omits the
15
- * token — never emit a cch we can't stand behind, and never emit one current
16
- * CC doesn't send. The cc_version build suffix is stable per config
17
- * (computeVersionSuffix), independent of the request. Exported for tests.
15
+ * token — never emit a cch we can't produce correctly, and never emit one
16
+ * current Claude Code doesn't send. The cc_version build suffix is stable per
17
+ * config (computeVersionSuffix), independent of the request. Exported for tests.
18
18
  */
19
19
  export declare function buildBillingTag(cliVersion: string, cch: string | null): string;
20
20
  /**
@@ -59,9 +59,7 @@ export declare const AFK_MODE_BETA = "afk-mode-2026-01-31";
59
59
  export declare const ADVISOR_TOOL_BETA = "advisor-tool-2026-03-01";
60
60
  export declare const CLAUDE_CODE_BETA = "claude-code-20250219";
61
61
  /**
62
- * Model-conditional anthropic-beta set, mirroring real CC 2.1.199 (live
63
- * captures 2026-07-03, this box, `--print --model <m> -p hi` — same
64
- * binary/account, deterministic across repeat trials). `base` is the captured
62
+ * Model-conditional anthropic-beta set for current Claude Code. `base` is the
65
63
  * opus/sonnet order (TEMPLATE.anthropic_beta); each family is a transform of
66
64
  * it, ORDER included:
67
65
  *
@@ -78,16 +76,16 @@ export declare const CLAUDE_CODE_BETA = "claude-code-20250219";
78
76
  * NOT send it for plain models. `skipContext1m` (dario#36) suppresses it when
79
77
  * the account's long-context billing was rejected.
80
78
  *
81
- * afk-mode-2026-01-31 is REMOTE-CONFIG controlled and flips within a CC version
82
- * (memory: rolled off 7/2, back on 7/3), so its presence is a property of the
83
- * captured `base`, not of this function — the live capture heals it. haiku
84
- * drops it regardless. The per-family shape here is correct whether or not the
85
- * base carries afk-mode: the anchor-relative inserts/moves degrade gracefully
79
+ * afk-mode-2026-01-31 is remote-config controlled and can flip within a Claude
80
+ * Code version, so its presence is a property of `base` (the loaded template),
81
+ * not of this function — the template refresh keeps it current. haiku drops it
82
+ * regardless. The per-family shape here is correct whether or not the base
83
+ * carries afk-mode: the anchor-relative inserts/moves degrade gracefully
86
84
  * (append / no-op) when an anchor is absent.
87
85
  *
88
86
  * Removing a beta can never provoke an upstream 400 (the runtime rejection
89
87
  * cache only ever needs to ADD strips), so the haiku omissions are safe; the
90
- * position fixes are pure wire-shape fidelity.
88
+ * position adjustments keep the per-family order correct.
91
89
  */
92
90
  export declare function betaForModel(base: string, model: string | null | undefined, skipContext1m?: boolean): string;
93
91
  /**
package/dist/proxy.js CHANGED
@@ -52,26 +52,17 @@ function isLoopbackAddr(addr) {
52
52
  }
53
53
  // Concurrency control: see src/request-queue.ts for the bounded queue
54
54
  // (replaced the v3.30.x-and-earlier simple unbounded semaphore in dario#80).
55
- // Deterministic seed for the cc_version build suffix. Once reverse-engineered
56
- // as Claude Code's own value; it is now just dario's stable constant — CC's
57
- // real suffix algorithm has moved (see computeVersionSuffix).
55
+ // Deterministic constant used to seed the cc_version build suffix
56
+ // (computeVersionSuffix). Arbitrary its only job is to make the suffix stable.
58
57
  const BILLING_SEED = '59cf53e54c78';
59
- // The `.<suffix>` on cc_version (e.g. `2.1.199.ef3`). A clean-room capture
60
- // (2026-07-03, fresh HOME with no CLAUDE.md / memory / project context) proved
61
- // this is NOT a function of the user message: every prompt any content, any
62
- // length, bytes flipped at positions 0/4/7/20/29 returned the SAME suffix,
63
- // and it shifted only when the injected SYSTEM CONTEXT changed. So CC derives
64
- // it from the system payload and it is STABLE for a given config. dario's old
65
- // `chars[4,7,20]`-of-user-message hash was doubly wrong: wrong input, and
66
- // per-request-varying where real CC is stable across requests.
67
- //
68
- // We can't reproduce CC's exact algorithm (it lives in the compiled binary,
69
- // same as the cch seed) and the value isn't population-discriminating — every
70
- // CC machine's suffix differs by its own context — so a STABLE, plausible 3-hex
71
- // derived from the template we replay is the faithful choice: it matches CC's
72
- // observable property (one stable suffix per config, like a single real
73
- // install) and changes only when the system payload changes (a template
74
- // rebake). Memoized — the inputs don't change within a process.
58
+ // The `.<suffix>` on cc_version (e.g. `2.1.199.ef3`). This suffix is not a
59
+ // function of the user message it tracks the request's system context, so it
60
+ // is stable for a given configuration and changes only when that context does.
61
+ // dario's old `chars[4,7,20]`-of-user-message hash was wrong on both counts:
62
+ // wrong input, and per-request-varying. We emit instead a STABLE, plausible
63
+ // 3-hex derived from the loaded template one stable value per config, which
64
+ // changes only when the template does (a rebake). Memoized — the inputs don't
65
+ // change within a process.
75
66
  let _versionSuffixCache = null;
76
67
  function computeVersionSuffix(version) {
77
68
  if (_versionSuffixCache && _versionSuffixCache.key === version)
@@ -88,27 +79,27 @@ function computeVersionSuffix(version) {
88
79
  // deterministic value at serialize time (the `stampCch` call near the
89
80
  // JSON.stringify of the outbound body).
90
81
  //
91
- // This placeholder is only emitted for CC versions we hold a calibrated seed
92
- // for — see buildBillingTag / hasCchSeed. Versions without a seed omit the cch
93
- // token entirely: current CC (2.1.199+) sends no cch at all, so a random
94
- // value would be a fingerprint, not cover. Operators can force the random
95
- // path on every seeded request with DARIO_CCH=random.
82
+ // This placeholder is only emitted for versions we hold a calibrated seed for
83
+ // — see buildBillingTag / hasCchSeed. Versions without a seed omit the cch
84
+ // token entirely: current Claude Code sends no cch, so omitting is the correct
85
+ // match. Operators can force the random path on every seeded request with
86
+ // DARIO_CCH=random.
96
87
  function computeCch() {
97
88
  return randomBytes(3).toString('hex').slice(0, 5);
98
89
  }
99
90
  /**
100
- * Assemble the `x-anthropic-billing-header` system-block text, tracking real
101
- * Claude Code's wire shape:
102
- * with cch: `…; cc_entrypoint=sdk-cli; cch=<5hex>;` (CC ≤ 2.1.177)
103
- * without cch: `…; cc_entrypoint=sdk-cli;` (CC 2.1.199+)
91
+ * Assemble the `x-anthropic-billing-header` system-block text, following
92
+ * Claude Code's format:
93
+ * with cch: `…; cc_entrypoint=sdk-cli; cch=<5hex>;` (older releases)
94
+ * without cch: `…; cc_entrypoint=sdk-cli;` (current releases)
104
95
  *
105
96
  * `cch` is passed in rather than generated here so this stays a pure, testable
106
97
  * string builder: the caller gates on hasCchSeed(cliVersion) and passes
107
98
  * computeCch() (a placeholder stampCch later overwrites with the deterministic
108
99
  * value) when a seed exists, or null when it doesn't. Passing null omits the
109
- * token — never emit a cch we can't stand behind, and never emit one current
110
- * CC doesn't send. The cc_version build suffix is stable per config
111
- * (computeVersionSuffix), independent of the request. Exported for tests.
100
+ * token — never emit a cch we can't produce correctly, and never emit one
101
+ * current Claude Code doesn't send. The cc_version build suffix is stable per
102
+ * config (computeVersionSuffix), independent of the request. Exported for tests.
112
103
  */
113
104
  export function buildBillingTag(cliVersion, cch) {
114
105
  const fullVersion = `${cliVersion}.${computeVersionSuffix(cliVersion)}`;
@@ -327,9 +318,7 @@ function moveBetaBefore(flags, flag, anchor) {
327
318
  return i < 0 ? flags : [...without.slice(0, i), flag, ...without.slice(i)];
328
319
  }
329
320
  /**
330
- * Model-conditional anthropic-beta set, mirroring real CC 2.1.199 (live
331
- * captures 2026-07-03, this box, `--print --model <m> -p hi` — same
332
- * binary/account, deterministic across repeat trials). `base` is the captured
321
+ * Model-conditional anthropic-beta set for current Claude Code. `base` is the
333
322
  * opus/sonnet order (TEMPLATE.anthropic_beta); each family is a transform of
334
323
  * it, ORDER included:
335
324
  *
@@ -346,16 +335,16 @@ function moveBetaBefore(flags, flag, anchor) {
346
335
  * NOT send it for plain models. `skipContext1m` (dario#36) suppresses it when
347
336
  * the account's long-context billing was rejected.
348
337
  *
349
- * afk-mode-2026-01-31 is REMOTE-CONFIG controlled and flips within a CC version
350
- * (memory: rolled off 7/2, back on 7/3), so its presence is a property of the
351
- * captured `base`, not of this function — the live capture heals it. haiku
352
- * drops it regardless. The per-family shape here is correct whether or not the
353
- * base carries afk-mode: the anchor-relative inserts/moves degrade gracefully
338
+ * afk-mode-2026-01-31 is remote-config controlled and can flip within a Claude
339
+ * Code version, so its presence is a property of `base` (the loaded template),
340
+ * not of this function — the template refresh keeps it current. haiku drops it
341
+ * regardless. The per-family shape here is correct whether or not the base
342
+ * carries afk-mode: the anchor-relative inserts/moves degrade gracefully
354
343
  * (append / no-op) when an anchor is absent.
355
344
  *
356
345
  * Removing a beta can never provoke an upstream 400 (the runtime rejection
357
346
  * cache only ever needs to ADD strips), so the haiku omissions are safe; the
358
- * position fixes are pure wire-shape fidelity.
347
+ * position adjustments keep the per-family order correct.
359
348
  */
360
349
  export function betaForModel(base, model, skipContext1m = false) {
361
350
  const m = (model ?? '').toLowerCase();
@@ -2048,11 +2037,10 @@ export async function startProxy(opts = {}) {
2048
2037
  // from CC's exact template and inject only the conversation content.
2049
2038
  // The upstream sees a genuine CC request structure.
2050
2039
  const userMsg = extractFirstUserMessage(r);
2051
- // Emit a cch token only for CC versions we hold a calibrated seed
2052
- // for (stampCch overwrites this placeholder with the deterministic
2053
- // value at serialize time). Uncalibrated versions omit cch: current
2054
- // CC (2.1.199+) sends none, so a random placeholder would be a
2055
- // fingerprint rather than cover. dario#528 + 2026-07-03 drift.
2040
+ // Emit a cch token only for versions we hold a calibrated seed for
2041
+ // (stampCch overwrites this placeholder with the deterministic value
2042
+ // at serialize time). Uncalibrated versions omit cch, matching
2043
+ // current Claude Code, which sends none. dario#528.
2056
2044
  const cch = hasCchSeed(cliVersion) ? computeCch() : null;
2057
2045
  const billingTag = buildBillingTag(cliVersion, cch);
2058
2046
  const CACHE_EPHEMERAL = { type: 'ephemeral' };
@@ -2215,8 +2203,8 @@ export async function startProxy(opts = {}) {
2215
2203
  // anchored to the billing tag — never a cch quoted in conversation
2216
2204
  // content. No-op for uncalibrated versions — but those also carry no
2217
2205
  // cch token to begin with (buildBillingTag omits it without a seed,
2218
- // matching CC 2.1.199+), so there is nothing to stamp and nothing
2219
- // stale is shipped. Only the template-replay path is stamped —
2206
+ // matching current Claude Code), so there is nothing to stamp and
2207
+ // nothing stale is shipped. Only the template-replay path is stamped —
2220
2208
  // passthrough / count_tokens forward the client's body (and its own
2221
2209
  // cch) verbatim. Reversible kill-switch: DARIO_CCH=random.
2222
2210
  let outboundText = JSON.stringify(r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "4.8.129",
3
+ "version": "4.8.131",
4
4
  "description": "Use your Claude Pro/Max subscription in any tool — Cursor, Cline, Aider, the Agent SDK, your scripts — at subscription pricing, not per-token API bills. One local Anthropic + OpenAI-compatible endpoint.",
5
5
  "type": "module",
6
6
  "bin": {