@theokit/sdk 2.18.0 → 2.19.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 +31 -0
- package/dist/a2a/index.cjs +41 -8
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +41 -8
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-Bbg0mBOv.d.ts → cron-Cep07kTz.d.ts} +1 -1
- package/dist/{cron-ZLSKbDbB.d.cts → cron-D_wK1S-0.d.cts} +1 -1
- package/dist/cron.cjs +41 -8
- 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 +41 -8
- package/dist/cron.js.map +1 -1
- package/dist/define-tool.d.ts +1 -0
- package/dist/{errors-qyVYfk9H.d.ts → errors-5lj1EWgs.d.ts} +1 -1
- package/dist/{errors-1tVcX3Fq.d.cts → errors-CE-lMBi2.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +41 -8
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +41 -8
- package/dist/eval.js.map +1 -1
- package/dist/generate-object.d.ts +11 -0
- package/dist/index.cjs +41 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +41 -8
- package/dist/index.js.map +1 -1
- package/dist/{run-pE-34AAo.d.cts → run-BgfBWX-z.d.cts} +13 -1
- package/dist/{run-pE-34AAo.d.ts → run-BgfBWX-z.d.ts} +13 -1
- package/dist/types/agent-prims.d.ts +4 -1
- package/dist/types/run.d.ts +9 -0
- package/package.json +14 -14
package/dist/a2a/index.js
CHANGED
|
@@ -7860,22 +7860,23 @@ async function executeTool(inputs, resolved, call) {
|
|
|
7860
7860
|
return { stdout: "", stderr: `Unknown tool ${call.name}`, exitCode: 127 };
|
|
7861
7861
|
}
|
|
7862
7862
|
if (resolved.origin === "shell") return runShellTool(inputs, call);
|
|
7863
|
-
if (resolved.origin === "memory") return runMemoryTool(resolved, call);
|
|
7864
|
-
if (resolved.origin === "custom")
|
|
7863
|
+
if (resolved.origin === "memory") return runMemoryTool(resolved, call, inputs.context);
|
|
7864
|
+
if (resolved.origin === "custom")
|
|
7865
|
+
return runCustomTool(resolved, call, inputs.signal, inputs.context);
|
|
7865
7866
|
return runMcpTool(inputs, resolved, call);
|
|
7866
7867
|
}
|
|
7867
|
-
async function runMemoryTool(resolved, call) {
|
|
7868
|
-
return runHandlerTool("memory", resolved.memoryHandler, call);
|
|
7868
|
+
async function runMemoryTool(resolved, call, context) {
|
|
7869
|
+
return runHandlerTool("memory", resolved.memoryHandler, call, void 0, context);
|
|
7869
7870
|
}
|
|
7870
|
-
async function runCustomTool(resolved, call, signal) {
|
|
7871
|
-
return runHandlerTool("custom", resolved.customHandler, call, signal);
|
|
7871
|
+
async function runCustomTool(resolved, call, signal, context) {
|
|
7872
|
+
return runHandlerTool("custom", resolved.customHandler, call, signal, context);
|
|
7872
7873
|
}
|
|
7873
|
-
async function runHandlerTool(kind, handler, call, signal) {
|
|
7874
|
+
async function runHandlerTool(kind, handler, call, signal, context) {
|
|
7874
7875
|
if (handler === void 0) {
|
|
7875
7876
|
return { stdout: "", stderr: `${kind} tool ${call.name} has no handler`, exitCode: 127 };
|
|
7876
7877
|
}
|
|
7877
7878
|
try {
|
|
7878
|
-
const stdout = await handler(call.input, { signal });
|
|
7879
|
+
const stdout = await handler(call.input, { signal, context });
|
|
7879
7880
|
return { stdout, stderr: "", exitCode: 0 };
|
|
7880
7881
|
} catch (cause) {
|
|
7881
7882
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -12380,6 +12381,9 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
12380
12381
|
// D318 — forward SendOptions.signal to the agent loop so streamLlmTurn
|
|
12381
12382
|
// can attach it to the LLM `fetch({ signal })` call.
|
|
12382
12383
|
...options.sendOptions.signal !== void 0 ? { signal: options.sendOptions.signal } : {},
|
|
12384
|
+
// M7 — forward SendOptions.context to the loop so every tool handler receives
|
|
12385
|
+
// it on `ctx.context` (shared run config set once, e.g. projectRoot).
|
|
12386
|
+
...options.sendOptions.context !== void 0 ? { context: options.sendOptions.context } : {},
|
|
12383
12387
|
// #58 / #57 — forward the per-tool timeout + tool-result guard so a consumer
|
|
12384
12388
|
// can enable them via SendOptions (not only internal AgentLoopInputs).
|
|
12385
12389
|
...options.sendOptions.perToolTimeoutMs !== void 0 ? { perToolTimeoutMs: options.sendOptions.perToolTimeoutMs } : {},
|
|
@@ -17150,6 +17154,19 @@ __export(generate_object_exports, {
|
|
|
17150
17154
|
GenerateObjectError: () => GenerateObjectError,
|
|
17151
17155
|
generateObjectImpl: () => generateObjectImpl
|
|
17152
17156
|
});
|
|
17157
|
+
function salvagePartial(schema, raw) {
|
|
17158
|
+
if (typeof raw !== "object" || raw === null) return raw;
|
|
17159
|
+
const shape = schema.shape;
|
|
17160
|
+
if (shape === void 0 || typeof shape !== "object") return raw;
|
|
17161
|
+
const rawObj = raw;
|
|
17162
|
+
const out = {};
|
|
17163
|
+
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
17164
|
+
if (typeof fieldSchema?.safeParse !== "function") continue;
|
|
17165
|
+
const parsed = fieldSchema.safeParse(rawObj[key]);
|
|
17166
|
+
if (parsed.success) out[key] = parsed.data;
|
|
17167
|
+
}
|
|
17168
|
+
return out;
|
|
17169
|
+
}
|
|
17153
17170
|
async function generateObjectImpl(options, deps) {
|
|
17154
17171
|
const { jsonSchema, maxRetries, initialUsage } = setupStructuredOutput(
|
|
17155
17172
|
options.schema,
|
|
@@ -17216,6 +17233,22 @@ async function generateObjectImpl(options, deps) {
|
|
|
17216
17233
|
}
|
|
17217
17234
|
lastParseError = parsed.error;
|
|
17218
17235
|
}
|
|
17236
|
+
if (options.errorStrategy === "return-raw") {
|
|
17237
|
+
return {
|
|
17238
|
+
object: capturedRaw,
|
|
17239
|
+
raw: capturedRaw,
|
|
17240
|
+
usage: lastUsage,
|
|
17241
|
+
finishReason: "tool_use"
|
|
17242
|
+
};
|
|
17243
|
+
}
|
|
17244
|
+
if (options.errorStrategy === "return-partial") {
|
|
17245
|
+
return {
|
|
17246
|
+
object: salvagePartial(options.schema, capturedRaw),
|
|
17247
|
+
raw: capturedRaw,
|
|
17248
|
+
usage: lastUsage,
|
|
17249
|
+
finishReason: "tool_use"
|
|
17250
|
+
};
|
|
17251
|
+
}
|
|
17219
17252
|
throw new GenerateObjectError(
|
|
17220
17253
|
"parse_failed",
|
|
17221
17254
|
"Schema parse failed after all retries.",
|