@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.
@@ -1,4 +1,4 @@
1
- import { p as RunOperation } from './run-D22b53SU.cjs';
1
+ import { p as RunOperation } from './run-TMdc7gmo.cjs';
2
2
 
3
3
  /**
4
4
  * Public type contract for the Budget enforcement primitive
@@ -1,4 +1,4 @@
1
- import { p as RunOperation } from './run-D22b53SU.js';
1
+ import { p as RunOperation } from './run-TMdc7gmo.js';
2
2
 
3
3
  /**
4
4
  * Public type contract for the Budget enforcement primitive
package/dist/errors.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, g as BudgetExceededError, C as ConfigurationError, u as CredentialPoolExhaustedError, E as ErrorCode, m as ErrorMetadata, I as IntegrationNotConnectedError, n as InvalidTaskIdError, K as KnownAgentRunErrorCode, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, T as TheokitAgentError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-FKoM44Mj.cjs';
2
- import './run-D22b53SU.cjs';
1
+ export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, g as BudgetExceededError, C as ConfigurationError, u as CredentialPoolExhaustedError, E as ErrorCode, m as ErrorMetadata, I as IntegrationNotConnectedError, n as InvalidTaskIdError, K as KnownAgentRunErrorCode, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, T as TheokitAgentError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-9yw4UQwX.cjs';
2
+ import './run-TMdc7gmo.cjs';
package/dist/eval.cjs CHANGED
@@ -8547,6 +8547,9 @@ async function streamLlmTurn(inputs, ctx) {
8547
8547
  const effort = reasoningEffortFromParams(inputs.model.params);
8548
8548
  return effort !== void 0 ? { reasoning: { effort } } : {};
8549
8549
  })(),
8550
+ // Step-cap force-close: forward the per-run tool gate (`"none"` on a ceiling round forces a
8551
+ // text close even though tools are advertised). Absent ⇒ provider default (auto).
8552
+ ...inputs.toolChoice !== void 0 ? { toolChoice: inputs.toolChoice } : {},
8550
8553
  messages: ctx.messages,
8551
8554
  tools: ctx.tools.map(toLlmTool)
8552
8555
  },
@@ -11018,6 +11021,16 @@ var OpenAIClient = class {
11018
11021
  } catch {
11019
11022
  continue;
11020
11023
  }
11024
+ if (chunk.error !== void 0 && chunk.error !== null) {
11025
+ const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
11026
+ throw mapOpenAICompatibleError({
11027
+ providerId,
11028
+ status,
11029
+ body: chunk,
11030
+ headers: response.headers,
11031
+ endpoint: "/v1/chat/completions"
11032
+ });
11033
+ }
11021
11034
  const events = accumulator.consume(chunk);
11022
11035
  for (const event of events) yield event;
11023
11036
  }
@@ -11121,6 +11134,14 @@ function applyReasoningRequest(body, effort, providerName) {
11121
11134
  }
11122
11135
  body.reasoning = { effort };
11123
11136
  }
11137
+ function applyToolsRequest(body, request) {
11138
+ if (request.tools === void 0 || request.tools.length === 0) return;
11139
+ body.tools = request.tools.map((tool) => ({
11140
+ type: "function",
11141
+ function: { name: tool.name, description: tool.description, parameters: tool.inputSchema }
11142
+ }));
11143
+ if (request.toolChoice !== void 0) body.tool_choice = request.toolChoice;
11144
+ }
11124
11145
  function buildOpenAIBody(request, providerName) {
11125
11146
  const messages = [];
11126
11147
  const systemText = openAISystemText(request.system);
@@ -11142,12 +11163,7 @@ function buildOpenAIBody(request, providerName) {
11142
11163
  if (request.temperature !== void 0) body.temperature = request.temperature;
11143
11164
  if (request.reasoning?.effort !== void 0)
11144
11165
  applyReasoningRequest(body, request.reasoning.effort, providerName);
11145
- if (request.tools !== void 0 && request.tools.length > 0) {
11146
- body.tools = request.tools.map((tool) => ({
11147
- type: "function",
11148
- function: { name: tool.name, description: tool.description, parameters: tool.inputSchema }
11149
- }));
11150
- }
11166
+ applyToolsRequest(body, request);
11151
11167
  const responseFormat = encodeOpenAIResponseFormat(request.responseFormat);
11152
11168
  if (responseFormat !== void 0) body.response_format = responseFormat;
11153
11169
  return body;
@@ -11990,6 +12006,7 @@ function buildLoopInputs(options, runId, userText) {
11990
12006
  ...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
11991
12007
  ...options.onStep !== void 0 ? { onStep: options.onStep } : {},
11992
12008
  ...options.onDelta !== void 0 ? { onDelta: options.onDelta } : {},
12009
+ ...options.sendOptions.toolChoice !== void 0 ? { toolChoice: options.sendOptions.toolChoice } : {},
11993
12010
  ...options.priorMessages !== void 0 ? { priorMessages: options.priorMessages } : {},
11994
12011
  ...options.memoryTools !== void 0 && options.memoryTools.length > 0 ? { memoryTools: options.memoryTools } : {},
11995
12012
  ...buildCustomToolsInput(