effect-agent 0.1.0-beta.157 → 0.1.0-beta.158

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.
@@ -3663,11 +3663,17 @@ const durationLimitError = (policy) => AgentPolicyError.make({
3663
3663
  limit: "duration",
3664
3664
  message: `Agent exceeded its ${Duration.format(policy.maxDuration)} duration limit`
3665
3665
  });
3666
- const enforceDurationDeadline = (execution, durationDeadlineMillis, durationLimit) => Stream.unwrap(Effect.gen(function* () {
3667
- const remaining = durationDeadlineMillis - (yield* Clock.currentTimeMillis);
3668
- if (remaining <= 0) return Stream.fail(durationLimit);
3669
- return execution.pipe(Stream.interruptWhen(Effect.sleep(remaining).pipe(Effect.andThen(Effect.fail(durationLimit)))));
3670
- }));
3666
+ const enforceDurationDeadline = (execution, durationDeadlineMillis, durationLimit) => {
3667
+ const beforeDeadline = Effect.fnUntraced(function* (effect) {
3668
+ const remaining = durationDeadlineMillis - (yield* Clock.currentTimeMillis);
3669
+ if (remaining <= 0) return yield* Effect.fail(durationLimit);
3670
+ return yield* effect.pipe(Effect.timeoutOrElse({
3671
+ duration: remaining,
3672
+ orElse: () => Effect.fail(durationLimit)
3673
+ }));
3674
+ });
3675
+ return Stream.fromPull(beforeDeadline(Stream.toPull(execution)).pipe(Effect.map(beforeDeadline))).pipe(Stream.scoped);
3676
+ };
3671
3677
  const guardBudgetStream = (stream, budget) => budget === void 0 ? stream : Stream.transformPull(stream, (pull) => Effect.succeed(budget.guard(pull)));
3672
3678
  function streamWithCompletion(agentValue, input, runOptions = {}, onCompleted, onUsage) {
3673
3679
  const agent = { definition: "definition" in agentValue ? agentValue.definition : agentValue };
@@ -4801,4 +4807,4 @@ var AgentRuntime_exports = /* @__PURE__ */ __exportAll({
4801
4807
  //#endregion
4802
4808
  export { stream as _, SubagentDurability as a, withTerminalDefectEvent as b, decodeFinalOutput as c, projectCompletionOutput as d, renderInputPrompt as f, startUnknown as g, start as h, AgentSpawner as i, encodeRunDisposition as l, runUnknown as m, AgentChildPending as n, SubagentDurabilityError as o, run as p, AgentResultSchema as r, ToolCallWaiting as s, AgentRuntime_exports as t, projectCompletionFromToolOutput as u, streamUnknown as v, streamWithUsageAccountingUnknown as y };
4803
4809
 
4804
- //# sourceMappingURL=AgentRuntime-GQACxY_m.mjs.map
4810
+ //# sourceMappingURL=AgentRuntime-D4eoBpIW.mjs.map