@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/index.cjs
CHANGED
|
@@ -12817,11 +12817,28 @@ async function runToolWithLifecycle(inputs, resolved, call, callId) {
|
|
|
12817
12817
|
conversationId: inputs.agentId,
|
|
12818
12818
|
callId
|
|
12819
12819
|
});
|
|
12820
|
+
await emitToolLifecycleDelta(inputs, {
|
|
12821
|
+
type: "tool-call-started",
|
|
12822
|
+
callId,
|
|
12823
|
+
toolCall: { callId, name: call.name, args: call.input },
|
|
12824
|
+
modelCallId: callId
|
|
12825
|
+
});
|
|
12820
12826
|
const result = await raceToolExecution(executeTool(inputs, resolved, call), {
|
|
12821
12827
|
signal: inputs.signal,
|
|
12822
12828
|
timeoutMs: inputs.perToolTimeoutMs
|
|
12823
12829
|
});
|
|
12824
12830
|
const durationMs = Date.now() - startAt;
|
|
12831
|
+
await emitToolLifecycleDelta(inputs, {
|
|
12832
|
+
type: "tool-call-completed",
|
|
12833
|
+
callId,
|
|
12834
|
+
toolCall: {
|
|
12835
|
+
callId,
|
|
12836
|
+
name: call.name,
|
|
12837
|
+
args: call.input,
|
|
12838
|
+
result: result.content !== void 0 ? result.content : renderToolResult(result)
|
|
12839
|
+
},
|
|
12840
|
+
modelCallId: callId
|
|
12841
|
+
});
|
|
12825
12842
|
inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.TOOL_CALL_DURATION_MS, durationMs, {
|
|
12826
12843
|
"tool.name": call.name
|
|
12827
12844
|
});
|
|
@@ -12887,6 +12904,17 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
|
|
|
12887
12904
|
...result.exitCode !== 0 && result.exitCode !== void 0 ? { isError: true } : {}
|
|
12888
12905
|
};
|
|
12889
12906
|
}
|
|
12907
|
+
async function emitToolLifecycleDelta(inputs, update) {
|
|
12908
|
+
if (inputs.onDelta === void 0) return;
|
|
12909
|
+
try {
|
|
12910
|
+
await inputs.onDelta({ update });
|
|
12911
|
+
} catch (err) {
|
|
12912
|
+
process.stderr.write(
|
|
12913
|
+
`[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
12914
|
+
`
|
|
12915
|
+
);
|
|
12916
|
+
}
|
|
12917
|
+
}
|
|
12890
12918
|
async function safeEmitToolHook(callback, event) {
|
|
12891
12919
|
if (callback === void 0) return;
|
|
12892
12920
|
try {
|