@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/CHANGELOG.md +33 -0
- package/dist/a2a/index.cjs +73 -19
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.d.cts +2 -1
- package/dist/a2a/index.d.ts +2 -1
- package/dist/a2a/index.js +73 -19
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/subagent.d.cts +70 -1
- package/dist/a2a/subagent.d.ts +70 -1
- package/dist/{cron-dpvtRoro.d.ts → cron-7CruUd_0.d.ts} +1 -1
- package/dist/{cron-YrmsszEN.d.cts → cron-Bpt_1khA.d.cts} +1 -1
- package/dist/cron.cjs +16 -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 +16 -6
- package/dist/cron.js.map +1 -1
- package/dist/{errors-C4vZPqXf.d.ts → errors-BuwwkrAk.d.ts} +1 -1
- package/dist/{errors-DrcpYVfZ.d.cts → errors-CkCaIqVP.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +16 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +16 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +16 -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 +16 -6
- package/dist/index.js.map +1 -1
- package/dist/{run-BMo8yRwK.d.cts → run-CrIulPF7.d.cts} +22 -2
- package/dist/{run-BMo8yRwK.d.ts → run-CrIulPF7.d.ts} +22 -2
- package/dist/types/agent-prims.d.ts +21 -1
- package/dist/types/agent.d.ts +1 -1
- package/package.json +3 -3
package/dist/eval.js
CHANGED
|
@@ -9446,21 +9446,21 @@ async function executeTool(inputs, resolved, call) {
|
|
|
9446
9446
|
if (resolved.origin === "shell") return runShellTool(inputs, call);
|
|
9447
9447
|
if (resolved.origin === "memory") return runMemoryTool(resolved, call, inputs.context);
|
|
9448
9448
|
if (resolved.origin === "custom")
|
|
9449
|
-
return runCustomTool(resolved, call, inputs.signal, inputs.context);
|
|
9449
|
+
return runCustomTool(resolved, call, inputs.signal, inputs.context, inputs.messages);
|
|
9450
9450
|
return runMcpTool(inputs, resolved, call);
|
|
9451
9451
|
}
|
|
9452
9452
|
async function runMemoryTool(resolved, call, context) {
|
|
9453
9453
|
return runHandlerTool("memory", resolved.memoryHandler, call, void 0, context);
|
|
9454
9454
|
}
|
|
9455
|
-
async function runCustomTool(resolved, call, signal, context) {
|
|
9456
|
-
return runHandlerTool("custom", resolved.customHandler, call, signal, context);
|
|
9455
|
+
async function runCustomTool(resolved, call, signal, context, messages) {
|
|
9456
|
+
return runHandlerTool("custom", resolved.customHandler, call, signal, context, messages);
|
|
9457
9457
|
}
|
|
9458
|
-
async function runHandlerTool(kind, handler, call, signal, context) {
|
|
9458
|
+
async function runHandlerTool(kind, handler, call, signal, context, messages) {
|
|
9459
9459
|
if (handler === void 0) {
|
|
9460
9460
|
return { stdout: "", stderr: `${kind} tool ${call.name} has no handler`, exitCode: 127 };
|
|
9461
9461
|
}
|
|
9462
9462
|
try {
|
|
9463
|
-
const out = await handler(call.input, { signal, context });
|
|
9463
|
+
const out = await handler(call.input, { signal, context, messages });
|
|
9464
9464
|
if (typeof out !== "string") return { stdout: "", stderr: "", exitCode: 0, content: out };
|
|
9465
9465
|
return { stdout: out, stderr: "", exitCode: 0 };
|
|
9466
9466
|
} catch (cause) {
|
|
@@ -10220,6 +10220,14 @@ function computeUsageCost(inputs, usage) {
|
|
|
10220
10220
|
}
|
|
10221
10221
|
|
|
10222
10222
|
// src/internal/agent-loop/loop.ts
|
|
10223
|
+
function projectToolContextMessages(messages) {
|
|
10224
|
+
const projected = [];
|
|
10225
|
+
for (const m of messages) {
|
|
10226
|
+
const content = m.content.flatMap((p) => p.type === "text" ? [p.text] : []).join("");
|
|
10227
|
+
if (content !== "") projected.push({ role: m.role, content });
|
|
10228
|
+
}
|
|
10229
|
+
return projected;
|
|
10230
|
+
}
|
|
10223
10231
|
var MAX_NUDGE_ATTEMPTS = 2;
|
|
10224
10232
|
var MAX_STOP_FEEDBACK_ATTEMPTS = 2;
|
|
10225
10233
|
async function runAgentLoop(inputs) {
|
|
@@ -10462,7 +10470,9 @@ async function continueOrTerminate(inputs, ctx, llmOutput) {
|
|
|
10462
10470
|
const outText = await transformLlmOutputText(inputs, llmOutput.text, tCtx);
|
|
10463
10471
|
ctx.messages.push(buildAssistantTurn(outText, llmOutput.toolCalls));
|
|
10464
10472
|
const rawResults = await dispatchTools(
|
|
10465
|
-
|
|
10473
|
+
// SE12 — forward a read-only text projection of the transcript-so-far to tool
|
|
10474
|
+
// handlers via `ctx.messages` (consumed by defineSubAgent's messageFilter).
|
|
10475
|
+
{ ...inputs, messages: projectToolContextMessages(ctx.messages) },
|
|
10466
10476
|
ctx.tools,
|
|
10467
10477
|
llmOutput.toolCalls,
|
|
10468
10478
|
ctx.events,
|