@caeliq/llms 1.0.57 → 1.0.58
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/README.md +2 -1
- package/dist/cjs/server.cjs +220 -217
- package/dist/cjs/server.cjs.map +4 -4
- package/dist/cursor-sdk/hooks-template.d.ts +2 -1
- package/dist/cursor-sdk/host-env.d.ts +38 -0
- package/dist/cursor-sdk/lifecycle-planner.d.ts +69 -0
- package/dist/cursor-sdk/prompt.d.ts +33 -3
- package/dist/cursor-sdk/runner.d.ts +29 -0
- package/dist/cursor-sdk/session.d.ts +53 -0
- package/dist/cursor-sdk/shared.d.ts +14 -0
- package/dist/cursor-sdk/tool-paths.d.ts +26 -0
- package/dist/cursor-sdk/tools.d.ts +12 -1
- package/dist/cursor-sdk/turn-identity.d.ts +46 -0
- package/dist/cursor-sdk/turn-output.d.ts +77 -0
- package/dist/esm/server.mjs +220 -217
- package/dist/esm/server.mjs.map +4 -4
- package/dist/tests/anthropic.tool-call-id-sanitize.d.ts +1 -0
- package/dist/tests/anthropic.turn-intent.d.ts +1 -0
- package/dist/tests/cursor-sdk.host-env.d.ts +1 -0
- package/dist/tests/cursor-sdk.interrupt-reentry.d.ts +1 -0
- package/dist/tests/cursor-sdk.lifecycle-planner.d.ts +1 -0
- package/dist/tests/cursor-sdk.pending-next-rejection.d.ts +1 -0
- package/dist/tests/cursor-sdk.scratch-paths.d.ts +1 -0
- package/dist/tests/cursor-sdk.scratch-report.d.ts +1 -0
- package/dist/tests/cursor-sdk.tool-call-id.d.ts +1 -0
- package/dist/tests/cursor-sdk.trailing-turn-fallback.d.ts +1 -0
- package/dist/tests/cursor-sdk.turn-coordination.d.ts +1 -0
- package/dist/tests/cursor-sdk.turn-identity.d.ts +1 -0
- package/dist/tests/stream.upstream-terminated.d.ts +1 -0
- package/dist/transformer/anthropic.transformer.d.ts +1 -1
- package/dist/transformer/cursor-sdk.transformer.d.ts +4 -2
- package/dist/types/transformer.d.ts +6 -0
- package/dist/types/turn-intent.d.ts +26 -0
- package/dist/utils/toolCallId.d.ts +15 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,7 +8,7 @@ export declare class AnthropicTransformer implements Transformer {
|
|
|
8
8
|
logger?: any;
|
|
9
9
|
constructor(options?: TransformerOptions | undefined);
|
|
10
10
|
auth(request: any, provider: LLMProvider, _context?: any): Promise<any>;
|
|
11
|
-
transformRequestOut(request: Record<string, any>, context?:
|
|
11
|
+
transformRequestOut(request: Record<string, any>, context?: TransformerContext): Promise<UnifiedChatRequest>;
|
|
12
12
|
transformResponseIn(response: Response, context?: TransformerContext): Promise<Response>;
|
|
13
13
|
/**
|
|
14
14
|
* Rebuild an Anthropic-format request body from a UnifiedChatRequest.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { UnifiedChatRequest } from "../types/llm";
|
|
2
|
-
import type { Transformer, TransformerOptions } from "../types/transformer";
|
|
2
|
+
import type { Transformer, TransformerContext, TransformerOptions } from "../types/transformer";
|
|
3
|
+
import { type CursorSdkRunnerOptions } from "../cursor-sdk/runner";
|
|
3
4
|
import { type CursorSdkMode } from "../cursor-sdk/shared";
|
|
4
5
|
export interface CursorSdkTransformerOptions extends TransformerOptions {
|
|
5
6
|
cursorMode?: CursorSdkMode;
|
|
@@ -7,6 +8,7 @@ export interface CursorSdkTransformerOptions extends TransformerOptions {
|
|
|
7
8
|
/** Opt-in only; forced off in Docker. Default false. */
|
|
8
9
|
sandboxEnabled?: boolean;
|
|
9
10
|
}
|
|
11
|
+
export declare function buildCursorSdkRunnerOptions(options: CursorSdkTransformerOptions, context?: TransformerContext, logger?: any): CursorSdkRunnerOptions;
|
|
10
12
|
/**
|
|
11
13
|
* Thin CCR transformer that owns the full upstream call via @cursor/sdk.
|
|
12
14
|
* Returns OpenAI-compatible SSE/JSON through config.__providerResponse so
|
|
@@ -18,6 +20,6 @@ export declare class CursorSdkTransformer implements Transformer {
|
|
|
18
20
|
logger?: any;
|
|
19
21
|
private options;
|
|
20
22
|
constructor(options?: CursorSdkTransformerOptions);
|
|
21
|
-
transformRequestIn(request: UnifiedChatRequest, provider: any, context?:
|
|
23
|
+
transformRequestIn(request: UnifiedChatRequest, provider: any, context?: TransformerContext): Promise<Record<string, any>>;
|
|
22
24
|
transformResponseOut(response: Response): Promise<Response>;
|
|
23
25
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LLMProvider, UnifiedChatRequest } from "./llm";
|
|
2
|
+
import type { UnifiedRequestRuntime } from "./turn-intent";
|
|
2
3
|
export interface TransformerOptions {
|
|
3
4
|
[key: string]: any;
|
|
4
5
|
}
|
|
@@ -8,6 +9,11 @@ interface TransformerWithStaticName {
|
|
|
8
9
|
}
|
|
9
10
|
export type TransformerConstructor = TransformerWithStaticName;
|
|
10
11
|
export interface TransformerContext {
|
|
12
|
+
req?: any;
|
|
13
|
+
provider?: any;
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
/** Protocol semantics that must not be serialized into the provider body. */
|
|
16
|
+
unifiedRequest?: UnifiedRequestRuntime;
|
|
11
17
|
[key: string]: any;
|
|
12
18
|
}
|
|
13
19
|
export type Transformer = {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-local semantics recovered by a wire-protocol transformer.
|
|
3
|
+
*
|
|
4
|
+
* This state belongs on TransformerContext, not UnifiedChatRequest: the latter
|
|
5
|
+
* is also the OpenAI-compatible outbound body and is serialized for providers.
|
|
6
|
+
*/
|
|
7
|
+
export type UnifiedTrailingToolResult = {
|
|
8
|
+
toolCallId: string;
|
|
9
|
+
content: string;
|
|
10
|
+
isError: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type UnifiedTurnIntent = {
|
|
13
|
+
source: "anthropic" | "unified-fallback";
|
|
14
|
+
trailingToolResults: UnifiedTrailingToolResult[];
|
|
15
|
+
interruption: "none" | "synthetic_client_interrupt";
|
|
16
|
+
steering: "none" | "meaningful";
|
|
17
|
+
};
|
|
18
|
+
export type UnifiedRequestRuntime = {
|
|
19
|
+
source: "anthropic";
|
|
20
|
+
sourceSessionIdentity?: string;
|
|
21
|
+
turnIntent: UnifiedTurnIntent;
|
|
22
|
+
};
|
|
23
|
+
export declare const ANTHROPIC_SYNTHETIC_INTERRUPT_MARKERS: readonly ["[Request interrupted by user]", "[Request interrupted by user for tool use]"];
|
|
24
|
+
export declare function classifyAnthropicTurnIntent(requestMessages: unknown): UnifiedTurnIntent;
|
|
25
|
+
export declare function extractAnthropicSourceSessionIdentity(metadata: unknown): string | undefined;
|
|
26
|
+
export declare function buildAnthropicRequestRuntime(request: Record<string, any>): UnifiedRequestRuntime;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function isValidAnthropicToolCallId(id: unknown): id is string;
|
|
2
|
+
/**
|
|
3
|
+
* Coerce an id into Anthropic's allowed alphabet.
|
|
4
|
+
*
|
|
5
|
+
* Runs of invalid characters collapse to a single `_` rather than being
|
|
6
|
+
* deleted: deletion can merge two distinct ids into one (`a\nb` and `ab` both
|
|
7
|
+
* become `ab`), and a duplicate `tool_use.id` is a worse failure than a long
|
|
8
|
+
* one — it silently mispairs tool results.
|
|
9
|
+
*
|
|
10
|
+
* Must be deterministic and idempotent. The same id arrives from two
|
|
11
|
+
* independent directions — emitted on the response and echoed back by the
|
|
12
|
+
* client on the next request — and both must map to the same value or the
|
|
13
|
+
* `tool_use` / `tool_result` pair stops matching.
|
|
14
|
+
*/
|
|
15
|
+
export declare function sanitizeToolCallId(id: unknown): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caeliq/llms",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.58",
|
|
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.54.0",
|
|
33
|
-
"@caeliq/ccr-shared": "^2.0
|
|
33
|
+
"@caeliq/ccr-shared": "^2.1.0",
|
|
34
34
|
"@cursor/sdk": "^1.0.23",
|
|
35
35
|
"@fastify/cors": "^11.0.1",
|
|
36
36
|
"@google/genai": "^2.13.0",
|