@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.
- package/CHANGELOG.md +57 -0
- package/dist/a2a/index.cjs +99 -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 +99 -19
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/subagent.d.cts +95 -1
- package/dist/a2a/subagent.d.ts +95 -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 +1 -1
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-
|
|
2
|
-
import './run-
|
|
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
|
-
|
|
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,
|