@theoremjs/agents 0.3.5-next.900.g35bbf80 → 0.3.5-next.901.g4c6ea22

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.
@@ -58,6 +58,7 @@ export interface ToolBackgroundSettled {
58
58
  /** The host's service for detached calls. Without it every tool runs inline. */
59
59
  export interface ToolBackgroundService {
60
60
  detached(call: ToolBackgroundHandle): void;
61
+ /** Each later event of the call, with `hook_failed` for a store crash after the reply. */
61
62
  event(event: TurnEvent, call: ToolBackgroundCall): void | Promise<void>;
62
63
  }
63
64
  /** A detached call's own trace record, joined to its turn through `traceparent`. */
@@ -272,17 +272,21 @@ class CoordinatedExecution {
272
272
  detach.trace.hookFailed('background', error);
273
273
  }
274
274
  };
275
+ const reportCrash = async (error) => {
276
+ detach.trace.hookFailed('execution', error);
277
+ await emit(hookFailed('execution', error, { callId: this.operation.callId }));
278
+ };
275
279
  try {
276
280
  await this.drain(iterator, pending, emit);
277
281
  }
278
282
  catch (error) {
279
- detach.trace.hookFailed('execution', error);
283
+ await reportCrash(error);
280
284
  }
281
285
  finally {
282
286
  clearTimeout(this.graceTimer);
283
287
  const crashed = await this.close();
284
288
  if (crashed)
285
- detach.trace.hookFailed('execution', crashed.error);
289
+ await reportCrash(crashed.error);
286
290
  await Promise.resolve()
287
291
  .then(() => detach.trace.end())
288
292
  .catch(() => { });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/agents",
3
- "version": "0.3.5-next.900.g35bbf80",
3
+ "version": "0.3.5-next.901.g4c6ea22",
4
4
  "description": "A flat TypeScript agent kernel for typed profiles, deterministic turn execution, registered tools, provider adapters, guardrails, and host-injected traces.",
5
5
  "keywords": [
6
6
  "agent",