@tangle-network/agent-app 4.0.28 → 4.0.30

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.
@@ -848,17 +848,19 @@ function createHybridTurnProducer(options) {
848
848
  });
849
849
  };
850
850
  let settled;
851
+ const step = (name, work) => router.trace ? router.trace.measure(`hybrid.settle.${name}`, "sandbox", work) : work();
851
852
  const settle = () => settled ??= (async () => {
852
853
  abort.abort(new Error("The hybrid turn settled"));
853
- await (box.started ?? start)?.catch(() => void 0);
854
- const results = await Promise.allSettled([Promise.resolve().then(() => box.dispose?.()), Promise.resolve().then(() => onSettled?.())]);
854
+ const starting = box.started ?? start;
855
+ if (starting) await step("box_start", () => starting.catch(() => void 0));
856
+ const results = await step("release", () => Promise.allSettled([Promise.resolve().then(() => box.dispose?.()), Promise.resolve().then(() => onSettled?.())]));
855
857
  for (const result of results) if (result.status === "rejected") {
856
858
  console.error(JSON.stringify({ event: "hybrid_turn_settle_failed", error: redactErrorMessage(result.reason) }));
857
859
  }
858
860
  })();
859
861
  try {
860
- const step = box.computer ? createComputerStep({ ...box.computer, parentExecutionId: box.computer.parentExecutionId ?? router.traceId }) : void 0;
861
- const runBoxTask = box.runTask ?? step?.runTask;
862
+ const step2 = box.computer ? createComputerStep({ ...box.computer, parentExecutionId: box.computer.parentExecutionId ?? router.traceId }) : void 0;
863
+ const runBoxTask = box.runTask ?? step2?.runTask;
862
864
  if (!runBoxTask) throw new Error("A hybrid box needs runTask or computer");
863
865
  const warnings = /* @__PURE__ */ new Map();
864
866
  const details = /* @__PURE__ */ new Map();
@@ -906,7 +908,7 @@ function createHybridTurnProducer(options) {
906
908
  ...onSpeculate ? { onSpeculate } : {}
907
909
  });
908
910
  speculator.onInput({ text: speculateOn ?? router.userMessage, ...attachments ? { attachments } : {} });
909
- const extra = guidance === false ? "" : [guidance ?? HYBRID_TURN_GUIDANCE, step?.guidance].filter(Boolean).join("\n\n");
911
+ const extra = guidance === false ? "" : [guidance ?? HYBRID_TURN_GUIDANCE, step2?.guidance].filter(Boolean).join("\n\n");
910
912
  const producer = createRouterTurnProducer({
911
913
  ...router,
912
914
  systemPrompt: Promise.resolve(router.systemPrompt).then((prompt) => !extra ? prompt : typeof prompt === "string" ? `${prompt}
@@ -3745,4 +3747,4 @@ export {
3745
3747
  createChatTurnRoutes,
3746
3748
  streamChatRouteAsSandboxEvents
3747
3749
  };
3748
- //# sourceMappingURL=chunk-WXK2AKRZ.js.map
3750
+ //# sourceMappingURL=chunk-GHBQUZYG.js.map