@theokit/sdk 2.21.0 → 2.22.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/dist/cron.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import './run-BMo8yRwK.cjs';
2
- export { Q as Cron } from './cron-YrmsszEN.cjs';
1
+ import './run-CrIulPF7.cjs';
2
+ export { Q as Cron } from './cron-Bpt_1khA.cjs';
3
3
  import 'zod';
package/dist/cron.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import './run-BMo8yRwK.js';
2
- export { Q as Cron } from './cron-dpvtRoro.js';
1
+ import './run-CrIulPF7.js';
2
+ export { Q as Cron } from './cron-7CruUd_0.js';
3
3
  import 'zod';
package/dist/cron.js CHANGED
@@ -9451,21 +9451,21 @@ async function executeTool(inputs, resolved, call) {
9451
9451
  if (resolved.origin === "shell") return runShellTool(inputs, call);
9452
9452
  if (resolved.origin === "memory") return runMemoryTool(resolved, call, inputs.context);
9453
9453
  if (resolved.origin === "custom")
9454
- return runCustomTool(resolved, call, inputs.signal, inputs.context);
9454
+ return runCustomTool(resolved, call, inputs.signal, inputs.context, inputs.messages);
9455
9455
  return runMcpTool(inputs, resolved, call);
9456
9456
  }
9457
9457
  async function runMemoryTool(resolved, call, context) {
9458
9458
  return runHandlerTool("memory", resolved.memoryHandler, call, void 0, context);
9459
9459
  }
9460
- async function runCustomTool(resolved, call, signal, context) {
9461
- return runHandlerTool("custom", resolved.customHandler, call, signal, context);
9460
+ async function runCustomTool(resolved, call, signal, context, messages) {
9461
+ return runHandlerTool("custom", resolved.customHandler, call, signal, context, messages);
9462
9462
  }
9463
- async function runHandlerTool(kind, handler, call, signal, context) {
9463
+ async function runHandlerTool(kind, handler, call, signal, context, messages) {
9464
9464
  if (handler === void 0) {
9465
9465
  return { stdout: "", stderr: `${kind} tool ${call.name} has no handler`, exitCode: 127 };
9466
9466
  }
9467
9467
  try {
9468
- const out = await handler(call.input, { signal, context });
9468
+ const out = await handler(call.input, { signal, context, messages });
9469
9469
  if (typeof out !== "string") return { stdout: "", stderr: "", exitCode: 0, content: out };
9470
9470
  return { stdout: out, stderr: "", exitCode: 0 };
9471
9471
  } catch (cause) {
@@ -10225,6 +10225,14 @@ function computeUsageCost(inputs, usage) {
10225
10225
  }
10226
10226
 
10227
10227
  // src/internal/agent-loop/loop.ts
10228
+ function projectToolContextMessages(messages) {
10229
+ const projected = [];
10230
+ for (const m of messages) {
10231
+ const content = m.content.flatMap((p) => p.type === "text" ? [p.text] : []).join("");
10232
+ if (content !== "") projected.push({ role: m.role, content });
10233
+ }
10234
+ return projected;
10235
+ }
10228
10236
  var MAX_NUDGE_ATTEMPTS = 2;
10229
10237
  var MAX_STOP_FEEDBACK_ATTEMPTS = 2;
10230
10238
  async function runAgentLoop(inputs) {
@@ -10467,7 +10475,9 @@ async function continueOrTerminate(inputs, ctx, llmOutput) {
10467
10475
  const outText = await transformLlmOutputText(inputs, llmOutput.text, tCtx);
10468
10476
  ctx.messages.push(buildAssistantTurn(outText, llmOutput.toolCalls));
10469
10477
  const rawResults = await dispatchTools(
10470
- inputs,
10478
+ // SE12 — forward a read-only text projection of the transcript-so-far to tool
10479
+ // handlers via `ctx.messages` (consumed by defineSubAgent's messageFilter).
10480
+ { ...inputs, messages: projectToolContextMessages(ctx.messages) },
10471
10481
  ctx.tools,
10472
10482
  llmOutput.toolCalls,
10473
10483
  ctx.events,