@axlsdk/axl 0.13.4 → 0.13.6

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/index.d.cts CHANGED
@@ -340,6 +340,7 @@ type ExecutionInfo = {
340
340
  startedAt: number;
341
341
  completedAt?: number;
342
342
  duration: number;
343
+ result?: unknown;
343
344
  error?: string;
344
345
  };
345
346
  type StreamEvent = {
@@ -349,10 +350,12 @@ type StreamEvent = {
349
350
  type: 'tool_call';
350
351
  name: string;
351
352
  args: unknown;
353
+ callId?: string;
352
354
  } | {
353
355
  type: 'tool_result';
354
356
  name: string;
355
357
  result: unknown;
358
+ callId?: string;
356
359
  } | {
357
360
  type: 'tool_approval';
358
361
  name: string;
@@ -382,7 +385,7 @@ type StreamEvent = {
382
385
  data: unknown;
383
386
  } | {
384
387
  type: 'error';
385
- error: Error;
388
+ message: string;
386
389
  };
387
390
  /** Record of an agent handoff event (persisted in session metadata). */
388
391
  type HandoffRecord = {
@@ -958,6 +961,7 @@ type WorkflowContextInit = {
958
961
  onToolCall?: (call: {
959
962
  name: string;
960
963
  args: unknown;
964
+ callId?: string;
961
965
  }) => void;
962
966
  pendingDecisions?: Map<string, (d: HumanDecision) => void>;
963
967
  budgetContext?: {
package/dist/index.d.ts CHANGED
@@ -340,6 +340,7 @@ type ExecutionInfo = {
340
340
  startedAt: number;
341
341
  completedAt?: number;
342
342
  duration: number;
343
+ result?: unknown;
343
344
  error?: string;
344
345
  };
345
346
  type StreamEvent = {
@@ -349,10 +350,12 @@ type StreamEvent = {
349
350
  type: 'tool_call';
350
351
  name: string;
351
352
  args: unknown;
353
+ callId?: string;
352
354
  } | {
353
355
  type: 'tool_result';
354
356
  name: string;
355
357
  result: unknown;
358
+ callId?: string;
356
359
  } | {
357
360
  type: 'tool_approval';
358
361
  name: string;
@@ -382,7 +385,7 @@ type StreamEvent = {
382
385
  data: unknown;
383
386
  } | {
384
387
  type: 'error';
385
- error: Error;
388
+ message: string;
386
389
  };
387
390
  /** Record of an agent handoff event (persisted in session metadata). */
388
391
  type HandoffRecord = {
@@ -958,6 +961,7 @@ type WorkflowContextInit = {
958
961
  onToolCall?: (call: {
959
962
  name: string;
960
963
  args: unknown;
964
+ callId?: string;
961
965
  }) => void;
962
966
  pendingDecisions?: Map<string, (d: HumanDecision) => void>;
963
967
  budgetContext?: {
package/dist/index.js CHANGED
@@ -2691,7 +2691,7 @@ ${JSON.stringify(jsonSchema, null, 2)}`;
2691
2691
  });
2692
2692
  continue;
2693
2693
  }
2694
- this.onToolCall?.({ name: toolName, args: toolArgs2 });
2694
+ this.onToolCall?.({ name: toolName, args: toolArgs2, callId: toolCall.id });
2695
2695
  const toolStart2 = Date.now();
2696
2696
  const executeOverride = async () => {
2697
2697
  let toolResult3;
@@ -2724,7 +2724,7 @@ ${JSON.stringify(jsonSchema, null, 2)}`;
2724
2724
  agent: agent2._name,
2725
2725
  tool: toolName,
2726
2726
  duration: Date.now() - toolStart2,
2727
- data: { args: toolArgs2, result: toolResult2 }
2727
+ data: { args: toolArgs2, result: toolResult2, callId: toolCall.id }
2728
2728
  });
2729
2729
  currentMessages.push({
2730
2730
  role: "tool",
@@ -2755,7 +2755,7 @@ ${JSON.stringify(jsonSchema, null, 2)}`;
2755
2755
  });
2756
2756
  continue;
2757
2757
  }
2758
- this.onToolCall?.({ name: toolName, args: toolArgs });
2758
+ this.onToolCall?.({ name: toolName, args: toolArgs, callId: toolCall.id });
2759
2759
  const toolStart = Date.now();
2760
2760
  if (tool2 && tool2.requireApproval) {
2761
2761
  const approvalFn = async () => {
@@ -2884,7 +2884,7 @@ ${JSON.stringify(jsonSchema, null, 2)}`;
2884
2884
  agent: agent2._name,
2885
2885
  tool: traceName,
2886
2886
  duration: Date.now() - toolStart,
2887
- data: { args: toolArgs, result: toolResult }
2887
+ data: { args: toolArgs, result: toolResult, callId: toolCall.id }
2888
2888
  });
2889
2889
  currentMessages.push({
2890
2890
  role: "tool",
@@ -4595,6 +4595,8 @@ var AxlStream = class _AxlStream extends Readable {
4595
4595
  this.bus.on("__reject", (error) => rejectPromise(error));
4596
4596
  this.bus.on("error", () => {
4597
4597
  });
4598
+ this.promise.catch(() => {
4599
+ });
4598
4600
  }
4599
4601
  static STREAM_EVENTS = /* @__PURE__ */ new Set([
4600
4602
  "token",
@@ -4740,9 +4742,16 @@ var AxlStream = class _AxlStream extends Readable {
4740
4742
  _error(error) {
4741
4743
  if (this.finished) return;
4742
4744
  this.finished = true;
4743
- const errorEvent = { type: "error", error };
4745
+ const errorEvent = { type: "error", message: error.message };
4744
4746
  this.bus.emit("error", errorEvent);
4747
+ this.push(errorEvent);
4745
4748
  this.push(null);
4749
+ const waiter = this.waiters.shift();
4750
+ if (waiter) {
4751
+ waiter({ value: errorEvent, done: false });
4752
+ } else {
4753
+ this.eventQueue.push(errorEvent);
4754
+ }
4746
4755
  for (const w of this.waiters) {
4747
4756
  w({ value: void 0, done: true });
4748
4757
  }
@@ -5594,6 +5603,7 @@ var AxlRuntime = class extends EventEmitter2 {
5594
5603
  execInfo.status = "completed";
5595
5604
  execInfo.completedAt = Date.now();
5596
5605
  execInfo.duration = execInfo.completedAt - execInfo.startedAt;
5606
+ execInfo.result = output;
5597
5607
  ctx.log("workflow_end", {
5598
5608
  workflow: name,
5599
5609
  status: "completed",
@@ -5706,7 +5716,8 @@ var AxlRuntime = class extends EventEmitter2 {
5706
5716
  axlStream._push({
5707
5717
  type: "tool_result",
5708
5718
  name: event.tool ?? "",
5709
- result: event.data?.result
5719
+ result: event.data?.result,
5720
+ callId: event.data?.callId
5710
5721
  });
5711
5722
  }
5712
5723
  axlStream._push({ type: "step", step: event.step, data: event });
@@ -5715,7 +5726,12 @@ var AxlRuntime = class extends EventEmitter2 {
5715
5726
  axlStream._push({ type: "token", data: token });
5716
5727
  },
5717
5728
  onToolCall: (call) => {
5718
- axlStream._push({ type: "tool_call", name: call.name, args: call.args });
5729
+ axlStream._push({
5730
+ type: "tool_call",
5731
+ name: call.name,
5732
+ args: call.args,
5733
+ callId: call.callId
5734
+ });
5719
5735
  },
5720
5736
  onAgentStart: (info) => {
5721
5737
  axlStream._push({ type: "agent_start", agent: info.agent, model: info.model });
@@ -5749,6 +5765,7 @@ var AxlRuntime = class extends EventEmitter2 {
5749
5765
  execInfo.status = "completed";
5750
5766
  execInfo.completedAt = Date.now();
5751
5767
  execInfo.duration = execInfo.completedAt - execInfo.startedAt;
5768
+ execInfo.result = result;
5752
5769
  wfCtx.log("workflow_end", {
5753
5770
  workflow: name,
5754
5771
  status: "completed",