@askalf/dario 4.8.139 → 4.8.141
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 +21 -6
- package/dist/cc-template.js +10 -0
- package/dist/doctor.js +2 -2
- package/dist/live-fingerprint.d.ts +1 -1
- package/dist/live-fingerprint.js +1 -1
- package/dist/proxy.js +3 -2
- package/package.json +1 -1
package/dist/cc-template.d.ts
CHANGED
|
@@ -432,6 +432,25 @@ export declare function resolveEffort(flag: EffortValue | undefined, clientBody:
|
|
|
432
432
|
* — never a broken request.
|
|
433
433
|
*/
|
|
434
434
|
export declare function supportsAdaptiveThinking(modelId: string): boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Anthropic prompt-cache control. `ttl` is the cache lifetime: `5m` (the
|
|
437
|
+
* upstream default when omitted) or `1h`. Real CC sends `1h` on its system
|
|
438
|
+
* blocks (see live-fingerprint.ts extractTemplate), so dario mirrors it.
|
|
439
|
+
*/
|
|
440
|
+
export type CacheControl = {
|
|
441
|
+
type: 'ephemeral';
|
|
442
|
+
ttl?: '5m' | '1h';
|
|
443
|
+
};
|
|
444
|
+
/**
|
|
445
|
+
* The cache-control dario stamps on every breakpoint (2 system + tools +
|
|
446
|
+
* conversation). `ttl: '1h'` mirrors real CC — dario shipped the 5-min
|
|
447
|
+
* ephemeral default, so its prefix expired 12x sooner than CC's and any
|
|
448
|
+
* interactive turn past the 5-min window re-created the whole prefix
|
|
449
|
+
* (system + all tools) at cache-creation cost, draining the Max window far
|
|
450
|
+
* faster than direct CC (root cause of dario#678). Single source of truth so
|
|
451
|
+
* the emitted TTL can't silently drift back to 5m.
|
|
452
|
+
*/
|
|
453
|
+
export declare const CC_CACHE_CONTROL: CacheControl;
|
|
435
454
|
/**
|
|
436
455
|
* Place CC-style prompt-cache breakpoints on the tools array and the
|
|
437
456
|
* conversation. The system prompt is already cached at build time (2 system
|
|
@@ -446,12 +465,8 @@ export declare function supportsAdaptiveThinking(modelId: string): boolean;
|
|
|
446
465
|
* sails through. CC genuinely caches tools + conversation, so NOT caching them
|
|
447
466
|
* was itself a wire divergence from CC. Exported for unit testing.
|
|
448
467
|
*/
|
|
449
|
-
export declare function applyCcPromptCaching(ccRequest: Record<string, unknown>, cacheControl:
|
|
450
|
-
|
|
451
|
-
}): void;
|
|
452
|
-
export declare function buildCCRequest(clientBody: Record<string, unknown>, billingTag: string, cacheControl: {
|
|
453
|
-
type: 'ephemeral';
|
|
454
|
-
}, identity: {
|
|
468
|
+
export declare function applyCcPromptCaching(ccRequest: Record<string, unknown>, cacheControl: CacheControl): void;
|
|
469
|
+
export declare function buildCCRequest(clientBody: Record<string, unknown>, billingTag: string, cacheControl: CacheControl, identity: {
|
|
455
470
|
deviceId: string;
|
|
456
471
|
accountUuid: string;
|
|
457
472
|
sessionId: string;
|
package/dist/cc-template.js
CHANGED
|
@@ -1235,6 +1235,16 @@ export function supportsAdaptiveThinking(modelId) {
|
|
|
1235
1235
|
return true;
|
|
1236
1236
|
return false;
|
|
1237
1237
|
}
|
|
1238
|
+
/**
|
|
1239
|
+
* The cache-control dario stamps on every breakpoint (2 system + tools +
|
|
1240
|
+
* conversation). `ttl: '1h'` mirrors real CC — dario shipped the 5-min
|
|
1241
|
+
* ephemeral default, so its prefix expired 12x sooner than CC's and any
|
|
1242
|
+
* interactive turn past the 5-min window re-created the whole prefix
|
|
1243
|
+
* (system + all tools) at cache-creation cost, draining the Max window far
|
|
1244
|
+
* faster than direct CC (root cause of dario#678). Single source of truth so
|
|
1245
|
+
* the emitted TTL can't silently drift back to 5m.
|
|
1246
|
+
*/
|
|
1247
|
+
export const CC_CACHE_CONTROL = { type: 'ephemeral', ttl: '1h' };
|
|
1238
1248
|
/**
|
|
1239
1249
|
* Place CC-style prompt-cache breakpoints on the tools array and the
|
|
1240
1250
|
* conversation. The system prompt is already cached at build time (2 system
|
package/dist/doctor.js
CHANGED
|
@@ -334,7 +334,7 @@ export async function runChecks(opts = {}) {
|
|
|
334
334
|
// non-passthrough request and dominate the input-token cost on small
|
|
335
335
|
// turns. Anthropic caches them after the first hit (cache_creation
|
|
336
336
|
// tokens on call 1, then cache_read on subsequent calls within the
|
|
337
|
-
//
|
|
337
|
+
// 1-hour TTL), but non-CC users routing heavy tooling get
|
|
338
338
|
// surprised by the first-request charge. Surface the size up front
|
|
339
339
|
// so they can plan.
|
|
340
340
|
//
|
|
@@ -355,7 +355,7 @@ export async function runChecks(opts = {}) {
|
|
|
355
355
|
detail: `${promptChars.toLocaleString()} chars system prompt + ${toolCount} tool defs ` +
|
|
356
356
|
`(${toolChars.toLocaleString()} chars JSON-serialized) injected per non-passthrough ` +
|
|
357
357
|
`request. Cached after first hit; read-cost only on subsequent calls within ` +
|
|
358
|
-
`the
|
|
358
|
+
`the 1-hour TTL. Exact token count surfaces as cache_creation_input_tokens ` +
|
|
359
359
|
`on the first response (or run \`dario doctor --usage\`).`,
|
|
360
360
|
});
|
|
361
361
|
}
|
|
@@ -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.203";
|
|
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.203',
|
|
790
790
|
};
|
|
791
791
|
/**
|
|
792
792
|
* Compare two dotted-numeric version strings. Returns negative if `a<b`,
|
package/dist/proxy.js
CHANGED
|
@@ -9,7 +9,7 @@ import { arch, platform } from 'node:process';
|
|
|
9
9
|
import { getAccessToken, getStatus } from './oauth.js';
|
|
10
10
|
import { buildHealthResponse, derivePoolStatus, shouldDiscloseHealthInternals } from './health-response.js';
|
|
11
11
|
import { darioVersion } from './version.js';
|
|
12
|
-
import { buildCCRequest, applyCcPromptCaching, parseEffortSuffix, reverseMapResponse, createStreamingReverseMapper, orderHeadersForOutbound, isMcpToolName, CC_TEMPLATE } from './cc-template.js';
|
|
12
|
+
import { buildCCRequest, applyCcPromptCaching, parseEffortSuffix, reverseMapResponse, createStreamingReverseMapper, orderHeadersForOutbound, isMcpToolName, CC_TEMPLATE, CC_CACHE_CONTROL } from './cc-template.js';
|
|
13
13
|
import { stampCch, hasCchSeed } from './cch.js';
|
|
14
14
|
import { describeTemplate, detectDrift, checkCCCompat } from './live-fingerprint.js';
|
|
15
15
|
import { AccountPool, computeStickyKey, parseRateLimits, modelFamily, isInAuthCooldown, authCooldownMs, reconcilePoolAccounts } from './pool.js';
|
|
@@ -2049,7 +2049,8 @@ export async function startProxy(opts = {}) {
|
|
|
2049
2049
|
// current Claude Code, which sends none. dario#528.
|
|
2050
2050
|
const cch = hasCchSeed(cliVersion) ? computeCch() : null;
|
|
2051
2051
|
const billingTag = buildBillingTag(cliVersion, cch);
|
|
2052
|
-
|
|
2052
|
+
// 1h cache TTL, matching real CC (see CC_CACHE_CONTROL / dario#678).
|
|
2053
|
+
const CACHE_EPHEMERAL = CC_CACHE_CONTROL;
|
|
2053
2054
|
// Session stickiness: rebind the pre-selected pool account to
|
|
2054
2055
|
// whatever the sticky-key resolver picks. If this is a new
|
|
2055
2056
|
// conversation the key binds to the current best account
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askalf/dario",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.141",
|
|
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": {
|