@theokit/sdk 2.15.0 → 2.15.2
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 +136 -17
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +136 -17
- package/dist/a2a/index.js.map +1 -1
- package/dist/cron.cjs +135 -16
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +135 -16
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +135 -16
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +135 -16
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +135 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +135 -16
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/hermes-tool-extract.d.ts +5 -1
- package/dist/internal/llm/openai.d.ts +14 -1
- package/package.json +1 -1
|
@@ -2,6 +2,10 @@ import type { LlmToolCallPart } from "./types.js";
|
|
|
2
2
|
export interface HermesExtractResult {
|
|
3
3
|
/** Recovered tool calls (empty when none matched). */
|
|
4
4
|
toolCalls: LlmToolCallPart[];
|
|
5
|
-
/** Content with every
|
|
5
|
+
/** Content with every PROMOTED block removed + trimmed; gated-out and unmatched blocks stay visible. */
|
|
6
6
|
residualText: string;
|
|
7
|
+
/** Names of well-formed leaked blocks that WERE dropped by the request-scoped allowlist (R5) — a
|
|
8
|
+
* block whose name is not a tool in the current request. Empty when no allowlist was applied or
|
|
9
|
+
* nothing was gated out. The caller logs these so a guard firing is observable in production. */
|
|
10
|
+
droppedNames: string[];
|
|
7
11
|
}
|
|
@@ -66,6 +66,7 @@ export declare class OpenAIClient implements LlmClient {
|
|
|
66
66
|
declare class OpenAIStreamAccumulator {
|
|
67
67
|
private readonly extractFromContent;
|
|
68
68
|
private readonly providerName;
|
|
69
|
+
private readonly allowedToolNames?;
|
|
69
70
|
private text;
|
|
70
71
|
private stopReason;
|
|
71
72
|
private inputTokens?;
|
|
@@ -74,15 +75,27 @@ declare class OpenAIStreamAccumulator {
|
|
|
74
75
|
private cacheWriteTokens?;
|
|
75
76
|
private reasoningTokens?;
|
|
76
77
|
private readonly toolCalls;
|
|
78
|
+
/** R7: present only when recovery is enabled AND the request declares tools — holds suspected
|
|
79
|
+
* leaked-dialect content back from the `text_delta` stream. `undefined` ⇒ stream immediately. */
|
|
80
|
+
private readonly suppress?;
|
|
77
81
|
/**
|
|
78
82
|
* @param extractFromContent opt-in leaked-dialect safe-parse (theokit#58). Default false.
|
|
79
83
|
* @param providerName provider id, used only to label the recovery log line.
|
|
84
|
+
* @param allowedToolNames R5 request-scoped allowlist — built from `request.tools` at `stream()`;
|
|
85
|
+
* leaked recovery in `finish()` only promotes a block whose name is in this set. `undefined`
|
|
86
|
+
* (direct construction) recovers all (back-compat); an empty set recovers nothing.
|
|
80
87
|
*/
|
|
81
|
-
constructor(extractFromContent?: boolean, providerName?: string);
|
|
88
|
+
constructor(extractFromContent?: boolean, providerName?: string, allowedToolNames?: ReadonlySet<string> | undefined);
|
|
82
89
|
consume(chunk: OpenAIDeltaChunk): LlmEvent[];
|
|
90
|
+
private applyChoice;
|
|
83
91
|
private applyReasoningDelta;
|
|
84
92
|
private applyUsage;
|
|
85
93
|
private applyContentDelta;
|
|
94
|
+
/** R7 held-buffer finalizer, called at the `finish_reason` chunk (in `applyChoice`) AND after the
|
|
95
|
+
* SSE loop in `stream()` — so a stream that omits a `finish_reason` terminal never silently drops
|
|
96
|
+
* held text. `toolCalls.size > 0` (native calls present) makes `finish()` skip recovery, so the
|
|
97
|
+
* buffer streams the held text whole. Idempotent once drained. */
|
|
98
|
+
finalizeHeldText(): LlmEvent | undefined;
|
|
86
99
|
private mergeToolCallDeltas;
|
|
87
100
|
private applyFinishReason;
|
|
88
101
|
finish(): LlmFinish;
|
package/package.json
CHANGED