@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/index.cjs
CHANGED
|
@@ -11919,21 +11919,21 @@ async function executeTool(inputs, resolved, call) {
|
|
|
11919
11919
|
if (resolved.origin === "shell") return runShellTool(inputs, call);
|
|
11920
11920
|
if (resolved.origin === "memory") return runMemoryTool(resolved, call, inputs.context);
|
|
11921
11921
|
if (resolved.origin === "custom")
|
|
11922
|
-
return runCustomTool(resolved, call, inputs.signal, inputs.context);
|
|
11922
|
+
return runCustomTool(resolved, call, inputs.signal, inputs.context, inputs.messages);
|
|
11923
11923
|
return runMcpTool(inputs, resolved, call);
|
|
11924
11924
|
}
|
|
11925
11925
|
async function runMemoryTool(resolved, call, context) {
|
|
11926
11926
|
return runHandlerTool("memory", resolved.memoryHandler, call, void 0, context);
|
|
11927
11927
|
}
|
|
11928
|
-
async function runCustomTool(resolved, call, signal, context) {
|
|
11929
|
-
return runHandlerTool("custom", resolved.customHandler, call, signal, context);
|
|
11928
|
+
async function runCustomTool(resolved, call, signal, context, messages) {
|
|
11929
|
+
return runHandlerTool("custom", resolved.customHandler, call, signal, context, messages);
|
|
11930
11930
|
}
|
|
11931
|
-
async function runHandlerTool(kind, handler, call, signal, context) {
|
|
11931
|
+
async function runHandlerTool(kind, handler, call, signal, context, messages) {
|
|
11932
11932
|
if (handler === void 0) {
|
|
11933
11933
|
return { stdout: "", stderr: `${kind} tool ${call.name} has no handler`, exitCode: 127 };
|
|
11934
11934
|
}
|
|
11935
11935
|
try {
|
|
11936
|
-
const out = await handler(call.input, { signal, context });
|
|
11936
|
+
const out = await handler(call.input, { signal, context, messages });
|
|
11937
11937
|
if (typeof out !== "string") return { stdout: "", stderr: "", exitCode: 0, content: out };
|
|
11938
11938
|
return { stdout: out, stderr: "", exitCode: 0 };
|
|
11939
11939
|
} catch (cause) {
|
|
@@ -12693,6 +12693,14 @@ function computeUsageCost(inputs, usage) {
|
|
|
12693
12693
|
}
|
|
12694
12694
|
|
|
12695
12695
|
// src/internal/agent-loop/loop.ts
|
|
12696
|
+
function projectToolContextMessages(messages) {
|
|
12697
|
+
const projected = [];
|
|
12698
|
+
for (const m of messages) {
|
|
12699
|
+
const content = m.content.flatMap((p) => p.type === "text" ? [p.text] : []).join("");
|
|
12700
|
+
if (content !== "") projected.push({ role: m.role, content });
|
|
12701
|
+
}
|
|
12702
|
+
return projected;
|
|
12703
|
+
}
|
|
12696
12704
|
var MAX_NUDGE_ATTEMPTS = 2;
|
|
12697
12705
|
var MAX_STOP_FEEDBACK_ATTEMPTS = 2;
|
|
12698
12706
|
async function runAgentLoop(inputs) {
|
|
@@ -12935,7 +12943,9 @@ async function continueOrTerminate(inputs, ctx, llmOutput) {
|
|
|
12935
12943
|
const outText = await transformLlmOutputText(inputs, llmOutput.text, tCtx);
|
|
12936
12944
|
ctx.messages.push(buildAssistantTurn(outText, llmOutput.toolCalls));
|
|
12937
12945
|
const rawResults = await dispatchTools(
|
|
12938
|
-
|
|
12946
|
+
// SE12 — forward a read-only text projection of the transcript-so-far to tool
|
|
12947
|
+
// handlers via `ctx.messages` (consumed by defineSubAgent's messageFilter).
|
|
12948
|
+
{ ...inputs, messages: projectToolContextMessages(ctx.messages) },
|
|
12939
12949
|
ctx.tools,
|
|
12940
12950
|
llmOutput.toolCalls,
|
|
12941
12951
|
ctx.events,
|