@askalf/dario 4.8.130 → 4.8.132
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/dist/cc-template.d.ts +4 -3
- package/dist/cc-template.js +11 -13
- package/dist/cch.d.ts +2 -2
- package/dist/cch.js +9 -10
- package/dist/live-fingerprint.d.ts +1 -1
- package/dist/live-fingerprint.js +1 -1
- package/dist/proxy.d.ts +14 -16
- package/dist/proxy.js +35 -47
- package/package.json +1 -1
package/dist/cc-template.d.ts
CHANGED
|
@@ -365,9 +365,10 @@ export declare function parseEffortSuffix(model: string): {
|
|
|
365
365
|
* — high/xhigh/max → end_turn, zero refusals. So the clamp + the fable-only
|
|
366
366
|
* default are gone: fable now takes the general path (no clamp), matching how
|
|
367
367
|
* dario treats opus. The general default is `high` (see resolveEffort below) —
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
* signature in case a future model needs per-family
|
|
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.
|
|
371
372
|
*
|
|
372
373
|
* Exported for tests.
|
|
373
374
|
*/
|
package/dist/cc-template.js
CHANGED
|
@@ -1114,24 +1114,22 @@ function normalizeEffortForWire(effort) {
|
|
|
1114
1114
|
* — high/xhigh/max → end_turn, zero refusals. So the clamp + the fable-only
|
|
1115
1115
|
* default are gone: fable now takes the general path (no clamp), matching how
|
|
1116
1116
|
* dario treats opus. The general default is `high` (see resolveEffort below) —
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
* signature in case a future model needs per-family
|
|
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.
|
|
1120
1121
|
*
|
|
1121
1122
|
* Exported for tests.
|
|
1122
1123
|
*/
|
|
1123
1124
|
export function resolveEffort(flag, clientBody, model) {
|
|
1124
1125
|
void model; // no per-family effort handling at present (see FABLE CLAMP note above)
|
|
1125
|
-
//
|
|
1126
|
-
//
|
|
1127
|
-
//
|
|
1128
|
-
//
|
|
1129
|
-
//
|
|
1130
|
-
//
|
|
1131
|
-
//
|
|
1132
|
-
// stream ends `stop_reason: max_tokens` with ZERO text blocks (dario#658). CC
|
|
1133
|
-
// at `high` thinks proportionally and leaves room for text. Operators who
|
|
1134
|
-
// want a higher tier still pin it via `--effort` / DARIO_EFFORT.
|
|
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.
|
|
1135
1133
|
const familyDefault = 'high';
|
|
1136
1134
|
if (flag === undefined)
|
|
1137
1135
|
return familyDefault;
|
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
|
|
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
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
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
|
|
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.
|
|
285
|
+
readonly maxTested: "2.1.201";
|
|
286
286
|
};
|
|
287
287
|
/**
|
|
288
288
|
* Compare two dotted-numeric version strings. Returns negative if `a<b`,
|
package/dist/live-fingerprint.js
CHANGED
|
@@ -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.
|
|
789
|
+
maxTested: '2.1.201',
|
|
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,
|
|
7
|
-
* Claude Code's
|
|
8
|
-
* with cch: `…; cc_entrypoint=sdk-cli; cch=<5hex>;` (
|
|
9
|
-
* without cch: `…; cc_entrypoint=sdk-cli;` (
|
|
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
|
|
16
|
-
*
|
|
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
|
|
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
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
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
|
|
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
|
|
56
|
-
//
|
|
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`).
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
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
|
|
92
|
-
//
|
|
93
|
-
// token entirely: current
|
|
94
|
-
//
|
|
95
|
-
//
|
|
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,
|
|
101
|
-
* Claude Code's
|
|
102
|
-
* with cch: `…; cc_entrypoint=sdk-cli; cch=<5hex>;` (
|
|
103
|
-
* without cch: `…; cc_entrypoint=sdk-cli;` (
|
|
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
|
|
110
|
-
*
|
|
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
|
|
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
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
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
|
|
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
|
|
2052
|
-
//
|
|
2053
|
-
//
|
|
2054
|
-
//
|
|
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
|
|
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.
|
|
3
|
+
"version": "4.8.132",
|
|
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": {
|