@caeliq/llms 1.0.67 → 1.0.68

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/server.d.ts CHANGED
@@ -59,7 +59,7 @@ export { pluginManager, tokenSpeedPlugin, getTokenSpeedStats, getGlobalTokenSpee
59
59
  export { SSEParserTransform, SSESerializerTransform, rewriteStream } from "./utils/sse";
60
60
  export { isClientAbortError } from "./utils/retry";
61
61
  export { sanitizeHeadersForLog, diffHeadersForLog, sanitizeBodyForLog, DEFAULT_LOG_BODY_MAX_BYTES, } from "./utils/redact";
62
- export { logMessageBody, bodyToLogString, shouldLogRequestBodies, shouldLogSSEEvents, resolveLogBodyMaxBytes, isTruthyConfigFlag, type MessageDebugDirection, } from "./utils/message-debug";
62
+ export { logMessageBody, bodyToLogString, shouldLogSSEEvents, resolveLogBodyMaxBytes, resolveLogBodySelection, isTruthyConfigFlag, type MessageDebugDirection, } from "./utils/message-debug";
63
63
  export { tapUpstreamSSEDebug, tapClientSSEDebug, } from "./utils/sse-debug-tap";
64
64
  export { exchangeAuthorizationCode, fetchUserEmail, resolveProjectId, saveTokens, loadTokens, getValidAccessToken, getValidAccessToken as getAntigravityAccessToken, ANTIGRAVITY_CLIENT_ID, ANTIGRAVITY_CLIENT_SECRET, ANTIGRAVITY_REDIRECT_URI, ANTIGRAVITY_SCOPES, type AntigravityTokens, } from "./utils/antigravity-auth";
65
65
  export { getValidAccessToken as getClaudeAccessToken } from "./utils/claude-auth";
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Persistent registry for every session identity CCR mints.
3
+ *
4
+ * Two families, one mechanism — the stable lookup key already exists in each
5
+ * case (Zen conversation id, cursor buildSessionKey hash); only the minted
6
+ * value used to live in process memory and died on restart:
7
+ *
8
+ * - "zen": conversationKey -> x-opencode-session (ses_…)
9
+ * - "cursor": sessionKey -> { agentId, workspaceDir, model }
10
+ *
11
+ * The file lives under CCR_HOME (the mounted ~/.claude-code-router volume),
12
+ * so bindings survive both restarts and image rebuilds. Plain JSON: values
13
+ * are short strings, not blobs (unlike cursor-opencode-provider's pb.gz,
14
+ * which persists raw Cursor protocol state we never see — the SDK owns that).
15
+ *
16
+ * Synchronous API, tiny file (capped entries), persistence on mint/delete
17
+ * only — never on the hot read path.
18
+ */
19
+ export type PersistedSession = {
20
+ /** The fixed CCR-minted id (ses_… for zen; SDK agentId for cursor). */
21
+ sessionId: string;
22
+ workspaceDir?: string;
23
+ model?: string;
24
+ updatedAt: number;
25
+ };
26
+ export declare const SESSION_REGISTRY_TTL_MS: number;
27
+ /** Fixed id previously minted for this family+key, or undefined. */
28
+ export declare function getPersistedSession(family: string, key: string, now?: number): PersistedSession | undefined;
29
+ /** Record a newly minted fixed id. Overwrites any prior binding. */
30
+ export declare function putPersistedSession(family: string, key: string, value: Omit<PersistedSession, "updatedAt">, now?: number): PersistedSession;
31
+ /** Forget a binding (session retire, Zen bucket re-roll). */
32
+ export declare function deletePersistedSession(family: string, key: string): void;
33
+ /** Drop expired bindings; returns the number pruned. */
34
+ export declare function pruneSessionRegistry(now?: number): number;
35
+ /** Test hook: drop in-memory state (the file itself is keyed by env dir). */
36
+ export declare function resetSessionRegistryForTests(): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -3,8 +3,6 @@ export declare class OpencodeHeadersTransformer implements Transformer {
3
3
  name: string;
4
4
  ownsTransport: boolean;
5
5
  requestPhase: "transport";
6
- private sessionCache;
7
- private readonly MAX_SESSIONS;
8
6
  private lastTimestamp;
9
7
  private counter;
10
8
  transformRequestIn(request: any, provider: any, context: any): Promise<Record<string, any>>;
@@ -33,6 +31,7 @@ export declare class OpencodeHeadersTransformer implements Transformer {
33
31
  private exponentialRetryDelayMs;
34
32
  private retryAfterHeaders;
35
33
  private ensurePromptCacheKey;
34
+ private ensurePromptCacheRetention;
36
35
  private fingerprintConversation;
37
36
  private getOrCreateSessionId;
38
37
  private invalidateSession;
@@ -4,9 +4,18 @@ export declare function isTruthyConfigFlag(value: unknown): boolean;
4
4
  export declare function resolveLogBodyMaxBytes(configService: {
5
5
  get?: (key: string) => unknown;
6
6
  } | null | undefined): number;
7
- export declare function shouldLogRequestBodies(configService: {
7
+ /**
8
+ * Body capture selector (`LOG_REQUEST_BODY_PARTS`): comma-separated top-level
9
+ * body fields (`system,tools`), or `full` for the whole body. Unset/empty
10
+ * disables capture. Unknown names are kept and reported as not-found at write
11
+ * time so typos stay visible.
12
+ */
13
+ export type LogBodySelection = "full" | string[];
14
+ export declare function resolveLogBodySelection(configService: {
8
15
  get?: (key: string) => unknown;
9
- } | null | undefined): boolean;
16
+ } | null | undefined): LogBodySelection | undefined;
17
+ /** Capture files live next to the rotated server logs. */
18
+ export declare function defaultLogBodyDir(): string;
10
19
  export declare function shouldLogSSEEvents(configService: {
11
20
  get?: (key: string) => unknown;
12
21
  } | null | undefined): boolean;
@@ -27,6 +36,15 @@ export type MessageBodyLogOptions = {
27
36
  maxBytes?: number;
28
37
  /** Override the historical `type` field when needed. */
29
38
  type?: string;
39
+ /**
40
+ * Resolved `LOG_REQUEST_BODY_PARTS` (see resolveLogBodySelection).
41
+ * `"full"` stores the whole body; a list stores one file per named
42
+ * top-level field. The log carries one manifest line per part (with sha256)
43
+ * instead of the body. Undefined keeps the legacy inline whole-body dump.
44
+ */
45
+ selection?: LogBodySelection | undefined;
46
+ /** Code-level directory override (tests); defaults to the logs folder. */
47
+ bodiesDir?: string;
30
48
  };
31
49
  /**
32
50
  * Compact keep-wire snapshot for debug logs. Full transcripts stay behind
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caeliq/llms",
3
- "version": "1.0.67",
3
+ "version": "1.0.68",
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.9",
33
+ "@caeliq/ccr-shared": "^2.1.10",
34
34
  "@cursor/sdk": "^1.0.30",
35
35
  "@fastify/cors": "^11.3.0",
36
36
  "@fastify/rate-limit": "^11.2.0",
@@ -46,13 +46,13 @@
46
46
  "lru-cache": "^11.5.2",
47
47
  "openai": "^7.5.0",
48
48
  "tiktoken": "^1.0.22",
49
- "undici": "^8.10.0",
49
+ "undici": "^8.10.1",
50
50
  "uuid": "^14.0.2"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/node": "^26.4.0",
53
+ "@types/node": "^26.4.1",
54
54
  "esbuild": "^0.28.2",
55
- "tsx": "^4.23.12",
55
+ "tsx": "^4.23.13",
56
56
  "typescript": "^6.0.3"
57
57
  },
58
58
  "engines": {