@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/cron.js
CHANGED
|
@@ -10232,11 +10232,28 @@ async function runToolWithLifecycle(inputs, resolved, call, callId) {
|
|
|
10232
10232
|
conversationId: inputs.agentId,
|
|
10233
10233
|
callId
|
|
10234
10234
|
});
|
|
10235
|
+
await emitToolLifecycleDelta(inputs, {
|
|
10236
|
+
type: "tool-call-started",
|
|
10237
|
+
callId,
|
|
10238
|
+
toolCall: { callId, name: call.name, args: call.input },
|
|
10239
|
+
modelCallId: callId
|
|
10240
|
+
});
|
|
10235
10241
|
const result = await raceToolExecution(executeTool(inputs, resolved, call), {
|
|
10236
10242
|
signal: inputs.signal,
|
|
10237
10243
|
timeoutMs: inputs.perToolTimeoutMs
|
|
10238
10244
|
});
|
|
10239
10245
|
const durationMs = Date.now() - startAt;
|
|
10246
|
+
await emitToolLifecycleDelta(inputs, {
|
|
10247
|
+
type: "tool-call-completed",
|
|
10248
|
+
callId,
|
|
10249
|
+
toolCall: {
|
|
10250
|
+
callId,
|
|
10251
|
+
name: call.name,
|
|
10252
|
+
args: call.input,
|
|
10253
|
+
result: result.content !== void 0 ? result.content : renderToolResult(result)
|
|
10254
|
+
},
|
|
10255
|
+
modelCallId: callId
|
|
10256
|
+
});
|
|
10240
10257
|
inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.TOOL_CALL_DURATION_MS, durationMs, {
|
|
10241
10258
|
"tool.name": call.name
|
|
10242
10259
|
});
|
|
@@ -10302,6 +10319,17 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
|
|
|
10302
10319
|
...result.exitCode !== 0 && result.exitCode !== void 0 ? { isError: true } : {}
|
|
10303
10320
|
};
|
|
10304
10321
|
}
|
|
10322
|
+
async function emitToolLifecycleDelta(inputs, update) {
|
|
10323
|
+
if (inputs.onDelta === void 0) return;
|
|
10324
|
+
try {
|
|
10325
|
+
await inputs.onDelta({ update });
|
|
10326
|
+
} catch (err) {
|
|
10327
|
+
process.stderr.write(
|
|
10328
|
+
`[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
10329
|
+
`
|
|
10330
|
+
);
|
|
10331
|
+
}
|
|
10332
|
+
}
|
|
10305
10333
|
async function safeEmitToolHook(callback, event) {
|
|
10306
10334
|
if (callback === void 0) return;
|
|
10307
10335
|
try {
|
|
@@ -13734,7 +13762,7 @@ function detectPrimaryProvider() {
|
|
|
13734
13762
|
|
|
13735
13763
|
// src/a2a/subagent.ts
|
|
13736
13764
|
init_agent_factory_registry();
|
|
13737
|
-
var INHERIT_CREDENTIALS = /* @__PURE__ */ Symbol("theokit.subagent.inheritCredentials");
|
|
13765
|
+
var INHERIT_CREDENTIALS = /* @__PURE__ */ Symbol.for("theokit.subagent.inheritCredentials");
|
|
13738
13766
|
function inheritSubAgentCredentials(tool, creds) {
|
|
13739
13767
|
const sink = tool[INHERIT_CREDENTIALS];
|
|
13740
13768
|
if (typeof sink === "function") sink(creds);
|
|
@@ -13797,6 +13825,13 @@ async function runChildAgent(spec, input, signal, maxSteps, inherited) {
|
|
|
13797
13825
|
};
|
|
13798
13826
|
const run = await agent.send(input, sendOptions);
|
|
13799
13827
|
const result = await run.wait();
|
|
13828
|
+
if (result.status === "error") {
|
|
13829
|
+
const cause = result.error;
|
|
13830
|
+
throw new Error(
|
|
13831
|
+
`subagent "${spec.name}" run failed: ${cause?.message ?? "unknown error"}`,
|
|
13832
|
+
cause !== void 0 ? { cause } : void 0
|
|
13833
|
+
);
|
|
13834
|
+
}
|
|
13800
13835
|
const text = result.result ?? "(no response)";
|
|
13801
13836
|
return spec.includeToolResults === true ? text + await collectChildToolResults(run) : text;
|
|
13802
13837
|
} finally {
|