@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/eval.cjs CHANGED
@@ -10230,11 +10230,28 @@ async function runToolWithLifecycle(inputs, resolved, call, callId) {
10230
10230
  conversationId: inputs.agentId,
10231
10231
  callId
10232
10232
  });
10233
+ await emitToolLifecycleDelta(inputs, {
10234
+ type: "tool-call-started",
10235
+ callId,
10236
+ toolCall: { callId, name: call.name, args: call.input },
10237
+ modelCallId: callId
10238
+ });
10233
10239
  const result = await raceToolExecution(executeTool(inputs, resolved, call), {
10234
10240
  signal: inputs.signal,
10235
10241
  timeoutMs: inputs.perToolTimeoutMs
10236
10242
  });
10237
10243
  const durationMs = Date.now() - startAt;
10244
+ await emitToolLifecycleDelta(inputs, {
10245
+ type: "tool-call-completed",
10246
+ callId,
10247
+ toolCall: {
10248
+ callId,
10249
+ name: call.name,
10250
+ args: call.input,
10251
+ result: result.content !== void 0 ? result.content : renderToolResult(result)
10252
+ },
10253
+ modelCallId: callId
10254
+ });
10238
10255
  inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.TOOL_CALL_DURATION_MS, durationMs, {
10239
10256
  "tool.name": call.name
10240
10257
  });
@@ -10300,6 +10317,17 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
10300
10317
  ...result.exitCode !== 0 && result.exitCode !== void 0 ? { isError: true } : {}
10301
10318
  };
10302
10319
  }
10320
+ async function emitToolLifecycleDelta(inputs, update) {
10321
+ if (inputs.onDelta === void 0) return;
10322
+ try {
10323
+ await inputs.onDelta({ update });
10324
+ } catch (err) {
10325
+ process.stderr.write(
10326
+ `[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
10327
+ `
10328
+ );
10329
+ }
10330
+ }
10303
10331
  async function safeEmitToolHook(callback, event) {
10304
10332
  if (callback === void 0) return;
10305
10333
  try {