@theokit/sdk 4.2.10 → 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/dist/cron.cjs +28 -0
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +28 -0
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +28 -0
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +28 -0
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cron.cjs
CHANGED
|
@@ -10235,11 +10235,28 @@ async function runToolWithLifecycle(inputs, resolved, call, callId) {
|
|
|
10235
10235
|
conversationId: inputs.agentId,
|
|
10236
10236
|
callId
|
|
10237
10237
|
});
|
|
10238
|
+
await emitToolLifecycleDelta(inputs, {
|
|
10239
|
+
type: "tool-call-started",
|
|
10240
|
+
callId,
|
|
10241
|
+
toolCall: { callId, name: call.name, args: call.input },
|
|
10242
|
+
modelCallId: callId
|
|
10243
|
+
});
|
|
10238
10244
|
const result = await raceToolExecution(executeTool(inputs, resolved, call), {
|
|
10239
10245
|
signal: inputs.signal,
|
|
10240
10246
|
timeoutMs: inputs.perToolTimeoutMs
|
|
10241
10247
|
});
|
|
10242
10248
|
const durationMs = Date.now() - startAt;
|
|
10249
|
+
await emitToolLifecycleDelta(inputs, {
|
|
10250
|
+
type: "tool-call-completed",
|
|
10251
|
+
callId,
|
|
10252
|
+
toolCall: {
|
|
10253
|
+
callId,
|
|
10254
|
+
name: call.name,
|
|
10255
|
+
args: call.input,
|
|
10256
|
+
result: result.content !== void 0 ? result.content : renderToolResult(result)
|
|
10257
|
+
},
|
|
10258
|
+
modelCallId: callId
|
|
10259
|
+
});
|
|
10243
10260
|
inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.TOOL_CALL_DURATION_MS, durationMs, {
|
|
10244
10261
|
"tool.name": call.name
|
|
10245
10262
|
});
|
|
@@ -10305,6 +10322,17 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
|
|
|
10305
10322
|
...result.exitCode !== 0 && result.exitCode !== void 0 ? { isError: true } : {}
|
|
10306
10323
|
};
|
|
10307
10324
|
}
|
|
10325
|
+
async function emitToolLifecycleDelta(inputs, update) {
|
|
10326
|
+
if (inputs.onDelta === void 0) return;
|
|
10327
|
+
try {
|
|
10328
|
+
await inputs.onDelta({ update });
|
|
10329
|
+
} catch (err) {
|
|
10330
|
+
process.stderr.write(
|
|
10331
|
+
`[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
10332
|
+
`
|
|
10333
|
+
);
|
|
10334
|
+
}
|
|
10335
|
+
}
|
|
10308
10336
|
async function safeEmitToolHook(callback, event) {
|
|
10309
10337
|
if (callback === void 0) return;
|
|
10310
10338
|
try {
|