@theokit/sdk 4.2.10 → 4.4.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/dist/interactive/index.cjs +29 -0
- package/dist/interactive/index.cjs.map +1 -0
- package/dist/interactive/index.js +24 -0
- package/dist/interactive/index.js.map +1 -0
- package/package.json +11 -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 {
|