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