@theokit/sdk 2.11.3 → 2.13.0
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/CHANGELOG.md +12 -0
- package/dist/a2a/index.cjs +85 -6
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +85 -6
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-BRfFPEKY.d.ts → cron-CL_9nfhQ.d.ts} +18 -0
- package/dist/{cron-DOw-Hqol.d.cts → cron-CpxLdAXc.d.cts} +18 -0
- package/dist/cron.cjs +79 -6
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +79 -6
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +79 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +79 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +79 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +79 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/hermes-tool-extract.d.ts +6 -0
- package/dist/internal/llm/openai.d.ts +7 -0
- package/dist/internal/llm/router.d.ts +8 -0
- package/dist/internal/providers/types.d.ts +7 -0
- package/dist/types/providers.d.ts +11 -0
- package/package.json +14 -14
|
@@ -64,6 +64,8 @@ export declare class OpenAIClient implements LlmClient {
|
|
|
64
64
|
stream(request: LlmRequest, signal: AbortSignal): AsyncGenerator<LlmEvent, LlmFinish, void>;
|
|
65
65
|
}
|
|
66
66
|
declare class OpenAIStreamAccumulator {
|
|
67
|
+
private readonly extractFromContent;
|
|
68
|
+
private readonly providerName;
|
|
67
69
|
private text;
|
|
68
70
|
private stopReason;
|
|
69
71
|
private inputTokens?;
|
|
@@ -72,6 +74,11 @@ declare class OpenAIStreamAccumulator {
|
|
|
72
74
|
private cacheWriteTokens?;
|
|
73
75
|
private reasoningTokens?;
|
|
74
76
|
private readonly toolCalls;
|
|
77
|
+
/**
|
|
78
|
+
* @param extractFromContent opt-in leaked-dialect safe-parse (theokit#58). Default false.
|
|
79
|
+
* @param providerName provider id, used only to label the recovery log line.
|
|
80
|
+
*/
|
|
81
|
+
constructor(extractFromContent?: boolean, providerName?: string);
|
|
75
82
|
consume(chunk: OpenAIDeltaChunk): LlmEvent[];
|
|
76
83
|
private applyReasoningDelta;
|
|
77
84
|
private applyUsage;
|
|
@@ -7,6 +7,14 @@ export interface ProviderRouterOptions {
|
|
|
7
7
|
apiKeys?: Record<string, string[]>;
|
|
8
8
|
/** Pool rotation strategy per provider. Optional; default `"fill_first"`. */
|
|
9
9
|
credentialPoolStrategy?: Record<string, CredentialPoolStrategy>;
|
|
10
|
+
/**
|
|
11
|
+
* Per-run opt-in leaked-dialect safe-parse derived from the chat route
|
|
12
|
+
* (theokit#58 follow-up). When `true`, the resolved profile is cloned with
|
|
13
|
+
* `extractToolCallsFromContent: true` so the OpenAI-compatible transport
|
|
14
|
+
* recovers Hermes `<function=…></tool_call>` dialect leaked as text. Applied
|
|
15
|
+
* to the resolved chain; fail-open, so a non-leaking provider is unaffected.
|
|
16
|
+
*/
|
|
17
|
+
extractToolCallsFromContent?: boolean;
|
|
10
18
|
}
|
|
11
19
|
export declare function resolveProviderChainAsync(options: ProviderRouterOptions): Promise<LlmClient[]>;
|
|
12
20
|
/**
|
|
@@ -24,4 +24,11 @@ export interface ProviderProfile {
|
|
|
24
24
|
fallbackModels: ReadonlyArray<string>;
|
|
25
25
|
extraHeaders?: Record<string, string>;
|
|
26
26
|
bodyOverrides?: Record<string, unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Opt-in leaked-dialect safe-parse (theokit#58 follow-up). When `true`, a chat_completions finish
|
|
29
|
+
* with ZERO native `tool_calls` has its assistant content scanned for the Hermes
|
|
30
|
+
* `<function=…></tool_call>` dialect and any recovered calls are surfaced as real `tool_calls`.
|
|
31
|
+
* Default off — only enable for routes/models known to leak (e.g. a qwen3-coder profile variant).
|
|
32
|
+
*/
|
|
33
|
+
extractToolCallsFromContent?: boolean;
|
|
27
34
|
}
|
|
@@ -14,6 +14,17 @@ export interface ProviderRoute {
|
|
|
14
14
|
capability: ProviderCapability;
|
|
15
15
|
provider: string;
|
|
16
16
|
model?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Opt-in leaked-dialect safe-parse for this route's provider (theokit#58
|
|
19
|
+
* follow-up). When `true`, a `chat_completions` finish that carries ZERO
|
|
20
|
+
* native `tool_calls` has its assistant text scanned for the Hermes
|
|
21
|
+
* `<function=…></tool_call>` dialect, and any recovered calls are surfaced as
|
|
22
|
+
* real `tool_calls` so the loop executes them — for models (qwen3-coder via
|
|
23
|
+
* OpenRouter) that intermittently leak tool calls as text. Default `false`;
|
|
24
|
+
* fail-open (a partial/unclosed block never fabricates a call). Scoped to the
|
|
25
|
+
* resolved chat chain, so a non-leaking route is unaffected.
|
|
26
|
+
*/
|
|
27
|
+
extractToolCallsFromContent?: boolean;
|
|
17
28
|
}
|
|
18
29
|
/**
|
|
19
30
|
* Provider routing configuration accepted by `Agent.create()` via
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theokit/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/usetheo/theokit-sdk#readme",
|
|
@@ -298,6 +298,15 @@
|
|
|
298
298
|
"**/agent.js",
|
|
299
299
|
"**/agent.cjs"
|
|
300
300
|
],
|
|
301
|
+
"scripts": {
|
|
302
|
+
"build": "tsup && cp src/internal/providers/provider-catalog.json dist/provider-catalog.json",
|
|
303
|
+
"test": "vitest run --no-file-parallelism",
|
|
304
|
+
"test:watch": "vitest",
|
|
305
|
+
"typecheck": "tsc --noEmit",
|
|
306
|
+
"clean": "rm -rf dist",
|
|
307
|
+
"docs:json": "typedoc --options typedoc.json",
|
|
308
|
+
"docs:drift": "tsx scripts/check-docs-drift.ts"
|
|
309
|
+
},
|
|
301
310
|
"peerDependencies": {
|
|
302
311
|
"@lancedb/lancedb": "^0.30.0",
|
|
303
312
|
"@types/ws": ">=8.0.0",
|
|
@@ -354,6 +363,8 @@
|
|
|
354
363
|
"devDependencies": {
|
|
355
364
|
"@opentelemetry/api": "^1.9.1",
|
|
356
365
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
366
|
+
"@theokit/sdk-handoff": "workspace:*",
|
|
367
|
+
"@theokit/sdk-memory": "workspace:*",
|
|
357
368
|
"@types/better-sqlite3": "^7.6.13",
|
|
358
369
|
"@types/proper-lockfile": "^4.1.4",
|
|
359
370
|
"@types/ws": "^8.18.0",
|
|
@@ -363,17 +374,6 @@
|
|
|
363
374
|
"sqlite-vec": "^0.1.9",
|
|
364
375
|
"typedoc": "^0.28.19",
|
|
365
376
|
"ws": "^8.18.0",
|
|
366
|
-
"zod": "^4.0.0"
|
|
367
|
-
"@theokit/sdk-memory": "0.2.0",
|
|
368
|
-
"@theokit/sdk-handoff": "0.1.0"
|
|
369
|
-
},
|
|
370
|
-
"scripts": {
|
|
371
|
-
"build": "tsup && cp src/internal/providers/provider-catalog.json dist/provider-catalog.json",
|
|
372
|
-
"test": "vitest run --no-file-parallelism",
|
|
373
|
-
"test:watch": "vitest",
|
|
374
|
-
"typecheck": "tsc --noEmit",
|
|
375
|
-
"clean": "rm -rf dist",
|
|
376
|
-
"docs:json": "typedoc --options typedoc.json",
|
|
377
|
-
"docs:drift": "tsx scripts/check-docs-drift.ts"
|
|
377
|
+
"zod": "^4.0.0"
|
|
378
378
|
}
|
|
379
|
-
}
|
|
379
|
+
}
|