@caeliq/llms 1.0.70 → 1.0.71

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.
@@ -37,6 +37,18 @@ export declare function inspectAnthropicClientFingerprint(headers: Record<string
37
37
  */
38
38
  export declare function getAnthropicProviderMode(provider: any, endpointTransformerName?: string): AnthropicProviderMode;
39
39
  export declare function isNativeAnthropicClient(kind: AnthropicClientKind): boolean;
40
+ /** `CLAUDE_AUTH_NATIVE_CACHE_TTL` values: `1h` (default) or `client`. */
41
+ export type NativeClaudeOAuthCacheTtlMode = "1h" | "client";
42
+ export declare function resolveNativeClaudeOAuthCacheTtlMode(value: unknown): NativeClaudeOAuthCacheTtlMode;
43
+ /**
44
+ * Native Desktop/CLI on claude-auth OAuth: extend the client's default-TTL
45
+ * (5m) ephemeral breakpoints to 1h, the TTL the third-party profile already
46
+ * uses on this route. Breakpoint placement is untouched. A body that already
47
+ * sets a TTL on any breakpoint is left exactly as sent (an explicit client
48
+ * choice), as is every body when the mode is `client`. Returns whether the
49
+ * body changed.
50
+ */
51
+ export declare function applyNativeClaudeOAuthCacheTtl(body: any, context: AnthropicClientPolicyContext | undefined, mode?: NativeClaudeOAuthCacheTtlMode): boolean;
40
52
  /**
41
53
  * Apply the one and only system transformation allowed by the gateway policy.
42
54
  * This runs after routing has identified an in-scope Anthropic destination and
@@ -5,10 +5,14 @@
5
5
  * transformer chain without a bisect.
6
6
  */
7
7
  export type CachePrefixStage = "client" | "wire";
8
+ /**
9
+ * Routing headers that pin prompt-cache affinity. `x-client-request-id` is
10
+ * deliberately absent: claude-auth mints a fresh one per request (as Claude
11
+ * Code does), and Codex sets it equal to `thread-id`, which is tracked here.
12
+ */
8
13
  export type CacheAffinityHeaders = {
9
14
  sessionId?: string;
10
15
  threadId?: string;
11
- clientRequestId?: string;
12
16
  };
13
17
  export type CachePrefixSegment = {
14
18
  path: string;
@@ -25,6 +25,15 @@ export declare function buildClaudeBillingHeaderValue(messages: UnifiedMessage[]
25
25
  export declare function normalizeSystemToArray(request: UnifiedChatRequest): TextContent[];
26
26
  /** Drop any existing billing entry (dedupe) and prepend a fresh one at system[0]. */
27
27
  export declare function applyClaudeBillingSystemBlock(system: TextContent[], messages: UnifiedMessage[] | undefined): void;
28
+ /**
29
+ * Drop any existing billing entry (dedupe) and reserve system[0] for a fresh
30
+ * one, so applyClaudeSystemIdentity places identity right after it. The value
31
+ * samples the first user text as sent, which relocation may still change, so
32
+ * fill it afterwards with fillClaudeBillingSystemBlock.
33
+ */
34
+ export declare function reserveClaudeBillingSystemBlock(system: TextContent[]): TextContent;
35
+ /** Fill a reserved billing block; remove it when attribution is disabled. */
36
+ export declare function fillClaudeBillingSystemBlock(system: TextContent[], block: TextContent, messages: UnifiedMessage[] | undefined): void;
28
37
  /**
29
38
  * Insert SYSTEM_IDENTITY after the billing block (normally system[1], or
30
39
  * system[0] when attribution is disabled). Any remaining caller system
@@ -45,8 +54,13 @@ export declare function applyClaudeSystemIdentity(system: TextContent[]): void;
45
54
  * A no-op when there is no user message to attach the content to, so nothing
46
55
  * is silently dropped — the caller's system content stays in `system[]`
47
56
  * instead.
57
+ *
58
+ * Returns the inserted block unless the first user message has non-empty
59
+ * string content (the relocated text is then a standalone block a cache
60
+ * breakpoint can end on); non-empty string content is prefixed in place and
61
+ * returns undefined.
48
62
  */
49
- export declare function relocateForeignSystemContent(system: TextContent[], messages: UnifiedMessage[] | undefined): void;
63
+ export declare function relocateForeignSystemContent(system: TextContent[], messages: UnifiedMessage[] | undefined): TextContent | undefined;
50
64
  /**
51
65
  * Claude Code's OAuth validator expects tool names in the mcp_PascalCase
52
66
  * spelling used by the official CLI. Non-Claude-Code clients commonly send
@@ -39,6 +39,12 @@ export declare function unifiedToolTextOnly(content: unknown): string;
39
39
  export declare function unifiedToolHasMedia(content: unknown): boolean;
40
40
  /** Anthropic tool_result.content: string or (text|image|document)[]. */
41
41
  export declare function unifiedToolContentToAnthropic(content: unknown): string | any[];
42
+ /**
43
+ * Anthropic blocks for one Unified user content part. Empty when the part is
44
+ * not sent (empty text, image without URL, file without data or URL, unknown
45
+ * type), so callers placing cache breakpoints can skip it.
46
+ */
47
+ export declare function unifiedUserPartToAnthropic(part: any): any[];
42
48
  /**
43
49
  * Anthropic inbound tool_result.content → Unified tool content
44
50
  * (string or text/image_url/file parts).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caeliq/llms",
3
- "version": "1.0.70",
3
+ "version": "1.0.71",
4
4
  "description": "A universal LLM API transformation server",
5
5
  "main": "dist/cjs/server.cjs",
6
6
  "module": "dist/esm/server.mjs",
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "@anthropic-ai/sdk": "^0.120.0",
33
- "@caeliq/ccr-shared": "^2.1.12",
33
+ "@caeliq/ccr-shared": "^2.1.13",
34
34
  "@cursor/sdk": "^1.0.32",
35
35
  "@fastify/cors": "^11.3.0",
36
36
  "@fastify/rate-limit": "^11.2.0",