@webless/agent 0.6.7 → 0.6.8

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/embed.cjs CHANGED
@@ -650,8 +650,7 @@ function applyMessageEvent(event, rendered, handlers, workItems) {
650
650
  if (event.type === "message.completed") {
651
651
  handlers.onComplete?.();
652
652
  }
653
- if (event.type === "action.result") emitActionResult(event, handlers);
654
- if (event.type === "input.requested") emitInputRequests(event, handlers);
653
+ emitVisitorInteractionEvent(event, handlers);
655
654
  if (event.type !== "message.appended") return rendered;
656
655
  const { messageDelta, messageSoFar } = event.data;
657
656
  let delta = messageDelta;
@@ -701,6 +700,13 @@ function emitInputRequests(event, handlers) {
701
700
  })
702
701
  );
703
702
  }
703
+ function emitVisitorInteractionEvent(event, handlers) {
704
+ if (event.type === "action.result") emitActionResult(event, handlers);
705
+ if (event.type === "input.requested") emitInputRequests(event, handlers);
706
+ if (event.type === "subagent.event") {
707
+ emitVisitorInteractionEvent(event.data.event, handlers);
708
+ }
709
+ }
704
710
  function isResumeTurnMessage(received, candidate) {
705
711
  if (received === candidate) return true;
706
712
  return Boolean(candidate) && received.endsWith(`
@@ -1031,8 +1037,7 @@ var AgentSession = class {
1031
1037
  const workItems = /* @__PURE__ */ new Map();
1032
1038
  for (const event of turnEvents) {
1033
1039
  applyWorkEvent(event, handlers, workItems);
1034
- if (event.type === "input.requested") emitInputRequests(event, handlers);
1035
- if (event.type === "action.result") emitActionResult(event, handlers);
1040
+ emitVisitorInteractionEvent(event, handlers);
1036
1041
  }
1037
1042
  if (rendered.startsWith(initialText)) {
1038
1043
  const missedText = rendered.slice(initialText.length);