@askalf/dario 4.8.146 → 4.8.148
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
CHANGED
|
@@ -501,15 +501,6 @@ export declare function applyCcPromptCaching(ccRequest: Record<string, unknown>,
|
|
|
501
501
|
export declare function dedupeToolsByName<T extends {
|
|
502
502
|
name?: unknown;
|
|
503
503
|
}>(tools: T[]): T[];
|
|
504
|
-
/**
|
|
505
|
-
* A genuine Claude Code client is identified by TWO markers together:
|
|
506
|
-
* the `x-anthropic-billing-header:` system block at [0] (the discriminator
|
|
507
|
-
* extractSystemText and extractTemplate key on) AND CC's own identity block
|
|
508
|
-
* at [1] ("You are Claude Code…" / the Claude Agent SDK variant). Requiring
|
|
509
|
-
* both keeps a non-CC framework that replays a billing-tagged body (e.g. a
|
|
510
|
-
* Kilo client behind a second proxy hop) on the detector path instead of
|
|
511
|
-
* passthrough. Exported for tests.
|
|
512
|
-
*/
|
|
513
504
|
export declare function isGenuineCCClient(clientBody: Record<string, unknown>): boolean;
|
|
514
505
|
export declare function buildCCRequest(clientBody: Record<string, unknown>, billingTag: string, cacheControl: CacheControl, identity: {
|
|
515
506
|
deviceId: string;
|
package/dist/cc-template.js
CHANGED
|
@@ -1332,12 +1332,37 @@ export function dedupeToolsByName(tools) {
|
|
|
1332
1332
|
/**
|
|
1333
1333
|
* A genuine Claude Code client is identified by TWO markers together:
|
|
1334
1334
|
* the `x-anthropic-billing-header:` system block at [0] (the discriminator
|
|
1335
|
-
* extractSystemText and extractTemplate key on) AND CC
|
|
1336
|
-
*
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1335
|
+
* extractSystemText and extractTemplate key on) AND a CC-origin block at [1].
|
|
1336
|
+
* Requiring both keeps a non-CC framework that replays a billing-tagged body
|
|
1337
|
+
* (e.g. a Kilo client behind a second proxy hop) on the detector path instead
|
|
1338
|
+
* of passthrough. Exported for tests.
|
|
1339
|
+
*
|
|
1340
|
+
* CC is not one request shape. Besides the main loop ("You are Claude Code…" /
|
|
1341
|
+
* the Claude Agent SDK variant), a single CC session also emits:
|
|
1342
|
+
* - sub-agent (Task/Agent tool) requests — system[1] is the agent prompt,
|
|
1343
|
+
* "You are an agent for Claude Code, Anthropic's official CLI for
|
|
1344
|
+
* Claude.…" (exact bytes in the CC v2.1.205 bundle; it neither starts
|
|
1345
|
+
* with "You are Claude Code" nor mentions the Agent SDK), and
|
|
1346
|
+
* - auto-mode permission-classifier requests — system[1] is the ~106KB
|
|
1347
|
+
* "You are a security monitor for autonomous AI coding agents" prompt,
|
|
1348
|
+
* fired once per gated tool call (live-captured via loopback MITM).
|
|
1349
|
+
* Both missed the v4.8.146 detector and fell onto the template path, where
|
|
1350
|
+
* the ~25KB template prepend re-billed per request shape per cache window —
|
|
1351
|
+
* the #678 remote re-test burned +19% vs +2% direct on exactly the run where
|
|
1352
|
+
* CC fanned out parallel sub-agents. Openers are matched with startsWith,
|
|
1353
|
+
* same anti-replay posture as the main-loop marker: none of them appear at
|
|
1354
|
+
* system[1] in any known non-CC framework's wire shape.
|
|
1355
|
+
*
|
|
1356
|
+
* Known gap: named/custom agents (~/.claude/agents, Explore/Plan) put their
|
|
1357
|
+
* operator-authored definition text at system[1] with no stable CC marker —
|
|
1358
|
+
* those still ride the template path until a live capture pins a reliable
|
|
1359
|
+
* discriminator.
|
|
1340
1360
|
*/
|
|
1361
|
+
const CC_ORIGIN_SYSTEM_OPENERS = [
|
|
1362
|
+
'You are Claude Code', // main loop, cli entrypoint
|
|
1363
|
+
'You are an agent for Claude Code', // sub-agents (Task/Agent tool)
|
|
1364
|
+
'You are a security monitor for autonomous AI coding agents', // auto-mode permission classifier
|
|
1365
|
+
];
|
|
1341
1366
|
export function isGenuineCCClient(clientBody) {
|
|
1342
1367
|
const sys = clientBody.system;
|
|
1343
1368
|
if (!Array.isArray(sys) || sys.length < 2)
|
|
@@ -1348,7 +1373,8 @@ export function isGenuineCCClient(clientBody) {
|
|
|
1348
1373
|
const second = sys[1];
|
|
1349
1374
|
if (typeof second?.text !== 'string')
|
|
1350
1375
|
return false;
|
|
1351
|
-
|
|
1376
|
+
const text = second.text;
|
|
1377
|
+
return CC_ORIGIN_SYSTEM_OPENERS.some((opener) => text.startsWith(opener)) || text.includes('Claude Agent SDK');
|
|
1352
1378
|
}
|
|
1353
1379
|
export function buildCCRequest(clientBody, billingTag, cacheControl, identity, opts = {}) {
|
|
1354
1380
|
const model = clientBody.model || 'claude-sonnet-5';
|
|
@@ -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.205";
|
|
286
286
|
};
|
|
287
287
|
/**
|
|
288
288
|
* Compare two dotted-numeric version strings. Returns negative if `a<b`,
|
package/dist/live-fingerprint.js
CHANGED
|
@@ -806,7 +806,7 @@ export function _resetInstalledVersionProbeForTest() {
|
|
|
806
806
|
*/
|
|
807
807
|
export const SUPPORTED_CC_RANGE = {
|
|
808
808
|
min: '1.0.0',
|
|
809
|
-
maxTested: '2.1.
|
|
809
|
+
maxTested: '2.1.205',
|
|
810
810
|
};
|
|
811
811
|
/**
|
|
812
812
|
* Compare two dotted-numeric version strings. Returns negative if `a<b`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askalf/dario",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.148",
|
|
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": {
|