@theokit/sdk 4.2.9 → 4.3.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 +6 -0
- package/dist/a2a/index.cjs +8 -1
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +8 -1
- package/dist/a2a/index.js.map +1 -1
- package/dist/cron.cjs +36 -1
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +36 -1
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +36 -1
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +36 -1
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +36 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/eval.js
CHANGED
|
@@ -10227,11 +10227,28 @@ async function runToolWithLifecycle(inputs, resolved, call, callId) {
|
|
|
10227
10227
|
conversationId: inputs.agentId,
|
|
10228
10228
|
callId
|
|
10229
10229
|
});
|
|
10230
|
+
await emitToolLifecycleDelta(inputs, {
|
|
10231
|
+
type: "tool-call-started",
|
|
10232
|
+
callId,
|
|
10233
|
+
toolCall: { callId, name: call.name, args: call.input },
|
|
10234
|
+
modelCallId: callId
|
|
10235
|
+
});
|
|
10230
10236
|
const result = await raceToolExecution(executeTool(inputs, resolved, call), {
|
|
10231
10237
|
signal: inputs.signal,
|
|
10232
10238
|
timeoutMs: inputs.perToolTimeoutMs
|
|
10233
10239
|
});
|
|
10234
10240
|
const durationMs = Date.now() - startAt;
|
|
10241
|
+
await emitToolLifecycleDelta(inputs, {
|
|
10242
|
+
type: "tool-call-completed",
|
|
10243
|
+
callId,
|
|
10244
|
+
toolCall: {
|
|
10245
|
+
callId,
|
|
10246
|
+
name: call.name,
|
|
10247
|
+
args: call.input,
|
|
10248
|
+
result: result.content !== void 0 ? result.content : renderToolResult(result)
|
|
10249
|
+
},
|
|
10250
|
+
modelCallId: callId
|
|
10251
|
+
});
|
|
10235
10252
|
inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.TOOL_CALL_DURATION_MS, durationMs, {
|
|
10236
10253
|
"tool.name": call.name
|
|
10237
10254
|
});
|
|
@@ -10297,6 +10314,17 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
|
|
|
10297
10314
|
...result.exitCode !== 0 && result.exitCode !== void 0 ? { isError: true } : {}
|
|
10298
10315
|
};
|
|
10299
10316
|
}
|
|
10317
|
+
async function emitToolLifecycleDelta(inputs, update) {
|
|
10318
|
+
if (inputs.onDelta === void 0) return;
|
|
10319
|
+
try {
|
|
10320
|
+
await inputs.onDelta({ update });
|
|
10321
|
+
} catch (err) {
|
|
10322
|
+
process.stderr.write(
|
|
10323
|
+
`[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
10324
|
+
`
|
|
10325
|
+
);
|
|
10326
|
+
}
|
|
10327
|
+
}
|
|
10300
10328
|
async function safeEmitToolHook(callback, event) {
|
|
10301
10329
|
if (callback === void 0) return;
|
|
10302
10330
|
try {
|
|
@@ -13729,7 +13757,7 @@ function detectPrimaryProvider() {
|
|
|
13729
13757
|
|
|
13730
13758
|
// src/a2a/subagent.ts
|
|
13731
13759
|
init_agent_factory_registry();
|
|
13732
|
-
var INHERIT_CREDENTIALS = /* @__PURE__ */ Symbol("theokit.subagent.inheritCredentials");
|
|
13760
|
+
var INHERIT_CREDENTIALS = /* @__PURE__ */ Symbol.for("theokit.subagent.inheritCredentials");
|
|
13733
13761
|
function inheritSubAgentCredentials(tool, creds) {
|
|
13734
13762
|
const sink = tool[INHERIT_CREDENTIALS];
|
|
13735
13763
|
if (typeof sink === "function") sink(creds);
|
|
@@ -13792,6 +13820,13 @@ async function runChildAgent(spec, input, signal, maxSteps, inherited) {
|
|
|
13792
13820
|
};
|
|
13793
13821
|
const run = await agent.send(input, sendOptions);
|
|
13794
13822
|
const result = await run.wait();
|
|
13823
|
+
if (result.status === "error") {
|
|
13824
|
+
const cause = result.error;
|
|
13825
|
+
throw new Error(
|
|
13826
|
+
`subagent "${spec.name}" run failed: ${cause?.message ?? "unknown error"}`,
|
|
13827
|
+
cause !== void 0 ? { cause } : void 0
|
|
13828
|
+
);
|
|
13829
|
+
}
|
|
13795
13830
|
const text = result.result ?? "(no response)";
|
|
13796
13831
|
return spec.includeToolResults === true ? text + await collectChildToolResults(run) : text;
|
|
13797
13832
|
} finally {
|