@theokit/sdk 2.21.0 → 2.23.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.
@@ -1,4 +1,4 @@
1
- import { v as RunOperation } from './run-BMo8yRwK.js';
1
+ import { v as RunOperation } from './run-CrIulPF7.js';
2
2
 
3
3
  /**
4
4
  * Public type contract for the Budget enforcement primitive
@@ -1,4 +1,4 @@
1
- import { v as RunOperation } from './run-BMo8yRwK.cjs';
1
+ import { v as RunOperation } from './run-CrIulPF7.cjs';
2
2
 
3
3
  /**
4
4
  * Public type contract for the Budget enforcement primitive
package/dist/errors.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, g as BudgetExceededError, C as ConfigurationError, u as CredentialPoolExhaustedError, m as ErrorCode, E 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-DrcpYVfZ.cjs';
2
- import './run-BMo8yRwK.cjs';
1
+ export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, g as BudgetExceededError, C as ConfigurationError, u as CredentialPoolExhaustedError, m as ErrorCode, E 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-CkCaIqVP.cjs';
2
+ import './run-CrIulPF7.cjs';
3
3
  import 'zod';
package/dist/eval.cjs CHANGED
@@ -9449,21 +9449,21 @@ async function executeTool(inputs, resolved, call) {
9449
9449
  if (resolved.origin === "shell") return runShellTool(inputs, call);
9450
9450
  if (resolved.origin === "memory") return runMemoryTool(resolved, call, inputs.context);
9451
9451
  if (resolved.origin === "custom")
9452
- return runCustomTool(resolved, call, inputs.signal, inputs.context);
9452
+ return runCustomTool(resolved, call, inputs.signal, inputs.context, inputs.messages);
9453
9453
  return runMcpTool(inputs, resolved, call);
9454
9454
  }
9455
9455
  async function runMemoryTool(resolved, call, context) {
9456
9456
  return runHandlerTool("memory", resolved.memoryHandler, call, void 0, context);
9457
9457
  }
9458
- async function runCustomTool(resolved, call, signal, context) {
9459
- return runHandlerTool("custom", resolved.customHandler, call, signal, context);
9458
+ async function runCustomTool(resolved, call, signal, context, messages) {
9459
+ return runHandlerTool("custom", resolved.customHandler, call, signal, context, messages);
9460
9460
  }
9461
- async function runHandlerTool(kind, handler, call, signal, context) {
9461
+ async function runHandlerTool(kind, handler, call, signal, context, messages) {
9462
9462
  if (handler === void 0) {
9463
9463
  return { stdout: "", stderr: `${kind} tool ${call.name} has no handler`, exitCode: 127 };
9464
9464
  }
9465
9465
  try {
9466
- const out = await handler(call.input, { signal, context });
9466
+ const out = await handler(call.input, { signal, context, messages });
9467
9467
  if (typeof out !== "string") return { stdout: "", stderr: "", exitCode: 0, content: out };
9468
9468
  return { stdout: out, stderr: "", exitCode: 0 };
9469
9469
  } catch (cause) {
@@ -10223,6 +10223,14 @@ function computeUsageCost(inputs, usage) {
10223
10223
  }
10224
10224
 
10225
10225
  // src/internal/agent-loop/loop.ts
10226
+ function projectToolContextMessages(messages) {
10227
+ const projected = [];
10228
+ for (const m of messages) {
10229
+ const content = m.content.flatMap((p) => p.type === "text" ? [p.text] : []).join("");
10230
+ if (content !== "") projected.push({ role: m.role, content });
10231
+ }
10232
+ return projected;
10233
+ }
10226
10234
  var MAX_NUDGE_ATTEMPTS = 2;
10227
10235
  var MAX_STOP_FEEDBACK_ATTEMPTS = 2;
10228
10236
  async function runAgentLoop(inputs) {
@@ -10465,7 +10473,9 @@ async function continueOrTerminate(inputs, ctx, llmOutput) {
10465
10473
  const outText = await transformLlmOutputText(inputs, llmOutput.text, tCtx);
10466
10474
  ctx.messages.push(buildAssistantTurn(outText, llmOutput.toolCalls));
10467
10475
  const rawResults = await dispatchTools(
10468
- inputs,
10476
+ // SE12 — forward a read-only text projection of the transcript-so-far to tool
10477
+ // handlers via `ctx.messages` (consumed by defineSubAgent's messageFilter).
10478
+ { ...inputs, messages: projectToolContextMessages(ctx.messages) },
10469
10479
  ctx.tools,
10470
10480
  llmOutput.toolCalls,
10471
10481
  ctx.events,