@theokit/sdk 2.11.1 → 2.11.3
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 +23 -6
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +23 -6
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-CZlMLA1K.d.ts → cron-BRfFPEKY.d.ts} +1 -1
- package/dist/{cron-BNI8pyn_.d.cts → cron-DOw-Hqol.d.cts} +1 -1
- package/dist/cron.cjs +23 -6
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +23 -6
- package/dist/cron.js.map +1 -1
- package/dist/{errors-FKoM44Mj.d.cts → errors-9yw4UQwX.d.cts} +1 -1
- package/dist/{errors-C8EVGqje.d.ts → errors-DFiY-NHK.d.ts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +23 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +23 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +23 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/openai.d.ts +12 -0
- package/dist/internal/llm/types.d.ts +8 -0
- package/dist/{run-D22b53SU.d.cts → run-TMdc7gmo.d.cts} +7 -0
- package/dist/{run-D22b53SU.d.ts → run-TMdc7gmo.d.ts} +7 -0
- package/dist/types/run.d.ts +7 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.11.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bb3a7d8: Fail-loud on in-stream provider errors. OpenRouter (and some OpenAI-compatible proxies) report auth / quota / rate-limit failures as an HTTP 200 SSE body carrying `data: {"error":{"message":"...","code":401}}` rather than a non-2xx status. The stream accumulator only reads `choices`, so such an error-only chunk produced zero events and the turn finished empty — the failure was silently swallowed (a dead API key looked like an empty model response). The OpenAI client now detects an in-stream `error` chunk and throws the same typed error a non-2xx HTTP status would (`AuthenticationError` / `RateLimitError` / `ConfigurationError` / …), so callers surface it instead of a blank turn. Fixes usetheodev/theocode#31.
|
|
8
|
+
|
|
9
|
+
## 2.11.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 8b411c5: Add `SendOptions.toolChoice` (`"auto" | "none" | "required"`), forwarded to the OpenAI/OpenRouter `tool_choice` request field. `"none"` forces a text answer even when the agent has tools registered — this lets an agent loop force a closing summary at its step ceiling (a cached agent's tools cannot be un-registered, so the gate must be applied per-send, not at agent creation). `tool_choice` is emitted only alongside a non-empty `tools` array. Additive and backward-compatible (absent ⇒ provider default).
|
|
14
|
+
|
|
3
15
|
## 2.11.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/a2a/index.cjs
CHANGED
|
@@ -7108,6 +7108,9 @@ async function streamLlmTurn(inputs, ctx) {
|
|
|
7108
7108
|
const effort = reasoningEffortFromParams(inputs.model.params);
|
|
7109
7109
|
return effort !== void 0 ? { reasoning: { effort } } : {};
|
|
7110
7110
|
})(),
|
|
7111
|
+
// Step-cap force-close: forward the per-run tool gate (`"none"` on a ceiling round forces a
|
|
7112
|
+
// text close even though tools are advertised). Absent ⇒ provider default (auto).
|
|
7113
|
+
...inputs.toolChoice !== void 0 ? { toolChoice: inputs.toolChoice } : {},
|
|
7111
7114
|
messages: ctx.messages,
|
|
7112
7115
|
tools: ctx.tools.map(toLlmTool)
|
|
7113
7116
|
},
|
|
@@ -10114,6 +10117,14 @@ function applyReasoningRequest(body, effort, providerName) {
|
|
|
10114
10117
|
}
|
|
10115
10118
|
body.reasoning = { effort };
|
|
10116
10119
|
}
|
|
10120
|
+
function applyToolsRequest(body, request) {
|
|
10121
|
+
if (request.tools === void 0 || request.tools.length === 0) return;
|
|
10122
|
+
body.tools = request.tools.map((tool) => ({
|
|
10123
|
+
type: "function",
|
|
10124
|
+
function: { name: tool.name, description: tool.description, parameters: tool.inputSchema }
|
|
10125
|
+
}));
|
|
10126
|
+
if (request.toolChoice !== void 0) body.tool_choice = request.toolChoice;
|
|
10127
|
+
}
|
|
10117
10128
|
function buildOpenAIBody(request, providerName) {
|
|
10118
10129
|
const messages = [];
|
|
10119
10130
|
const systemText = openAISystemText(request.system);
|
|
@@ -10135,12 +10146,7 @@ function buildOpenAIBody(request, providerName) {
|
|
|
10135
10146
|
if (request.temperature !== void 0) body.temperature = request.temperature;
|
|
10136
10147
|
if (request.reasoning?.effort !== void 0)
|
|
10137
10148
|
applyReasoningRequest(body, request.reasoning.effort, providerName);
|
|
10138
|
-
|
|
10139
|
-
body.tools = request.tools.map((tool) => ({
|
|
10140
|
-
type: "function",
|
|
10141
|
-
function: { name: tool.name, description: tool.description, parameters: tool.inputSchema }
|
|
10142
|
-
}));
|
|
10143
|
-
}
|
|
10149
|
+
applyToolsRequest(body, request);
|
|
10144
10150
|
const responseFormat = encodeOpenAIResponseFormat(request.responseFormat);
|
|
10145
10151
|
if (responseFormat !== void 0) body.response_format = responseFormat;
|
|
10146
10152
|
return body;
|
|
@@ -10273,6 +10279,16 @@ var init_openai2 = __esm({
|
|
|
10273
10279
|
} catch {
|
|
10274
10280
|
continue;
|
|
10275
10281
|
}
|
|
10282
|
+
if (chunk.error !== void 0 && chunk.error !== null) {
|
|
10283
|
+
const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
|
|
10284
|
+
throw mapOpenAICompatibleError({
|
|
10285
|
+
providerId,
|
|
10286
|
+
status,
|
|
10287
|
+
body: chunk,
|
|
10288
|
+
headers: response.headers,
|
|
10289
|
+
endpoint: "/v1/chat/completions"
|
|
10290
|
+
});
|
|
10291
|
+
}
|
|
10276
10292
|
const events = accumulator.consume(chunk);
|
|
10277
10293
|
for (const event of events) yield event;
|
|
10278
10294
|
}
|
|
@@ -11211,6 +11227,7 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
11211
11227
|
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
11212
11228
|
...options.onStep !== void 0 ? { onStep: options.onStep } : {},
|
|
11213
11229
|
...options.onDelta !== void 0 ? { onDelta: options.onDelta } : {},
|
|
11230
|
+
...options.sendOptions.toolChoice !== void 0 ? { toolChoice: options.sendOptions.toolChoice } : {},
|
|
11214
11231
|
...options.priorMessages !== void 0 ? { priorMessages: options.priorMessages } : {},
|
|
11215
11232
|
...options.memoryTools !== void 0 && options.memoryTools.length > 0 ? { memoryTools: options.memoryTools } : {},
|
|
11216
11233
|
...buildCustomToolsInput(
|