@cortexkit/anthropic-auth-core
Advanced tools
+4
-5
@@ -27,8 +27,7 @@ type Message = { | ||
| * | ||
| * The previous implementation sampled the first user message, which could make | ||
| * the system billing header change with conversation content. Keep this suffix | ||
| * stable for a day so it resembles a rotating Claude Code fingerprint without | ||
| * busting prompt-cache prefixes on every turn. | ||
| * The captured Claude Code version uses its observed build hash. Custom/future | ||
| * versions get a deterministic version-only suffix so date changes never rotate | ||
| * the billing header and bust prompt-cache prefixes. | ||
| */ | ||
| export declare function computeVersionSuffix(version?: string, date?: Date): string; | ||
| export declare function computeVersionSuffix(version?: string, _date?: Date): string; | ||
| /** | ||
@@ -35,0 +34,0 @@ * Build the billing header with a cch placeholder. |
+5
-10
@@ -65,15 +65,10 @@ import { createHash } from 'node:crypto'; | ||
| * | ||
| * The previous implementation sampled the first user message, which could make | ||
| * the system billing header change with conversation content. Keep this suffix | ||
| * stable for a day so it resembles a rotating Claude Code fingerprint without | ||
| * busting prompt-cache prefixes on every turn. | ||
| * The captured Claude Code version uses its observed build hash. Custom/future | ||
| * versions get a deterministic version-only suffix so date changes never rotate | ||
| * the billing header and bust prompt-cache prefixes. | ||
| */ | ||
| export function computeVersionSuffix(version = CLAUDE_CODE_VERSION, date = new Date()) { | ||
| export function computeVersionSuffix(version = CLAUDE_CODE_VERSION, _date = new Date()) { | ||
| if (version === CLAUDE_CODE_VERSION) | ||
| return CLAUDE_CODE_BUILD_HASH; | ||
| const dayStamp = date.toISOString().slice(0, 10); | ||
| return createHash('sha256') | ||
| .update(`${dayStamp}${version}`) | ||
| .digest('hex') | ||
| .slice(0, 3); | ||
| return createHash('sha256').update(version).digest('hex').slice(0, 3); | ||
| } | ||
@@ -80,0 +75,0 @@ /** |
+10
-1
@@ -81,2 +81,11 @@ import { createHash } from 'node:crypto'; | ||
| } | ||
| function dumpFileSessionSegment(affinity) { | ||
| const normalized = affinity | ||
| .trim() | ||
| .replace(/[^a-zA-Z0-9._-]+/g, '-') | ||
| .replace(/^-+|-+$/g, ''); | ||
| if (!normalized) | ||
| return 'session-unknown'; | ||
| return normalized.length <= 80 ? normalized : normalized.slice(0, 80); | ||
| } | ||
| function hashText(value) { | ||
@@ -188,3 +197,3 @@ return createHash('sha256').update(value).digest('hex'); | ||
| nextDumpId += 1; | ||
| const id = `${new Date().toISOString().replace(/[:.]/g, '-')}-${String(nextDumpId).padStart(5, '0')}-${input.transport}-p${input.protocol}-${input.mode}`; | ||
| const id = `${new Date().toISOString().replace(/[:.]/g, '-')}-${String(nextDumpId).padStart(5, '0')}-${dumpFileSessionSegment(input.affinity)}-${input.transport}-p${input.protocol}-${input.mode}`; | ||
| const dumpDir = getDumpDirectory(); | ||
@@ -191,0 +200,0 @@ const prefix = join(dumpDir, id); |
+1
-1
| { | ||
| "name": "@cortexkit/anthropic-auth-core", | ||
| "version": "1.6.1", | ||
| "version": "1.7.0", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "repository": { |
210762
0.05%5124
0.06%