effect-agent 0.1.0-beta.115 → 0.1.0-beta.116

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.
Files changed (67) hide show
  1. package/dist/{AgentRuntime-DyZv8uu2.d.mts → AgentRuntime-BUxDdLpw.d.mts} +2 -2
  2. package/dist/{DurableAgentRuntime-tNrkJZNo.mjs → DurableAgentRuntime-DQqxmn2h.mjs} +39 -10
  3. package/dist/DurableAgentRuntime-DQqxmn2h.mjs.map +1 -0
  4. package/dist/{EventSource-DPRdlvhV.d.mts → EventSource-hk1sVGsO.d.mts} +3 -3
  5. package/dist/{PreparedInputAdmission-DqQUjA9k.d.mts → PreparedInputAdmission-DXvFh8zZ.d.mts} +4 -4
  6. package/dist/{Records-Byeb70tt.d.mts → Records-3uLornLz.d.mts} +3 -3
  7. package/dist/{Schedule-krSnBcbU.d.mts → Schedule-yVT2CmKT.d.mts} +2 -2
  8. package/dist/{Subagent-gw9KD6eb.d.mts → Subagent-CNik9RiA.d.mts} +3 -3
  9. package/dist/{Subagent-Di8EEjWZ.mjs → Subagent-DCrB7an7.mjs} +2 -3
  10. package/dist/Subagent-DCrB7an7.mjs.map +1 -0
  11. package/dist/{SubagentHost-P9zB_TfV.d.mts → SubagentHost-4WB8Hj0C.d.mts} +13 -4
  12. package/dist/{Subscription-Xnwd42Sm.d.mts → Subscription-CCvcJGlB.d.mts} +3 -3
  13. package/dist/{SubscriptionInput-CqtJ58vl.d.mts → SubscriptionInput-BlE85a8M.d.mts} +3 -3
  14. package/dist/capabilities/Subagent.d.mts +1 -1
  15. package/dist/capabilities/Subagent.mjs +1 -1
  16. package/dist/durable/ActivityStore.d.mts +1 -1
  17. package/dist/durable/Admin.d.mts +1 -1
  18. package/dist/durable/AgentRegistration.d.mts +1 -1
  19. package/dist/durable/Certification.d.mts +1 -1
  20. package/dist/durable/CommittedActivity.d.mts +1 -1
  21. package/dist/durable/Digest.d.mts +1 -1
  22. package/dist/durable/DurableAgentRuntime.d.mts +1 -1
  23. package/dist/durable/DurableAgentRuntime.mjs +1 -1
  24. package/dist/durable/EventSource.d.mts +1 -1
  25. package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
  26. package/dist/durable/MessageDelivery.d.mts +3 -3
  27. package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
  28. package/dist/durable/PersistentHistory.d.mts +1 -1
  29. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  30. package/dist/durable/Records.d.mts +1 -1
  31. package/dist/durable/Recovery.d.mts +1 -1
  32. package/dist/durable/RunJournal.d.mts +1 -1
  33. package/dist/durable/Schedule.d.mts +1 -1
  34. package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
  35. package/dist/durable/ScheduleTransition.d.mts +1 -1
  36. package/dist/durable/Scheduling.d.mts +2 -2
  37. package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
  38. package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
  39. package/dist/durable/SqlThreadNativeReads.d.mts +1 -1
  40. package/dist/durable/SubmissionLedger.d.mts +1 -1
  41. package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
  42. package/dist/durable/SubmissionStatus.d.mts +1 -1
  43. package/dist/durable/Subscription.d.mts +1 -1
  44. package/dist/durable/SubscriptionInput.d.mts +1 -1
  45. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  46. package/dist/durable/SubscriptionTools.d.mts +3 -3
  47. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  48. package/dist/durable/Subscriptions.d.mts +5 -5
  49. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  50. package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
  51. package/dist/durable/ThreadInvariants.d.mts +1 -1
  52. package/dist/durable/ThreadProjection.d.mts +1 -1
  53. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  54. package/dist/durable/ThreadStore.d.mts +1 -1
  55. package/dist/durable/ThreadStoreConformance.d.mts +1 -1
  56. package/dist/durable/WorkerHost.d.mts +1 -1
  57. package/dist/engine/AgentRuntime.d.mts +1 -1
  58. package/dist/engine/SubagentHost.d.mts +2 -2
  59. package/dist/engine/SubagentHost.mjs.map +1 -1
  60. package/dist/index.d.mts +9 -9
  61. package/dist/index.mjs +2 -2
  62. package/package.json +1 -1
  63. package/src/capabilities/internal/subagent-background.ts +1 -3
  64. package/src/durable/internal/worker-host.ts +76 -18
  65. package/src/engine/SubagentHost.ts +16 -3
  66. package/dist/DurableAgentRuntime-tNrkJZNo.mjs.map +0 -1
  67. package/dist/Subagent-Di8EEjWZ.mjs.map +0 -1
@@ -15,7 +15,7 @@ import { n as CompactionError } from "./ContextCompactor-WwSIG_Z2.mjs";
15
15
  import { t as DurableStep } from "./DurableStep-Cry_iol4.mjs";
16
16
  import { B as RunSubagentChildIdentity, H as RunSubagentEstablishRequest, M as RunOptions, S as RunContextPreparationError, W as RunSubagentJoinRequest, i as ChildEstablishStatus, l as ModelUsageAccounting, t as AgentUpdateAcceptance, x as RunContextPreparation } from "./RunOptions-CSBsSj0X.mjs";
17
17
  import { t as MessagingHost } from "./MessagingHost-CqzpxbGz.mjs";
18
- import { a as SubagentHost } from "./SubagentHost-P9zB_TfV.mjs";
18
+ import { o as SubagentHost } from "./SubagentHost-4WB8Hj0C.mjs";
19
19
  import { t as RunEventSink } from "./RunEventSink-D5aVhISG.mjs";
20
20
  import { AiError, LanguageModel, Model, Prompt, Tool, Toolkit } from "effect/unstable/ai";
21
21
  import { Cause, Context, Effect, Layer, Option, Schema, Scope, Stream, Tracer } from "effect";
@@ -343,4 +343,4 @@ declare namespace AgentRuntime_d_exports {
343
343
  }
344
344
  //#endregion
345
345
  export { start as A, decodeFinalOutput as C, renderInputPrompt as D, projectCompletionOutput as E, withTerminalDefectEvent as F, stream as M, streamUnknown as N, run as O, streamWithUsageAccountingUnknown as P, ToolCallWaiting as S, projectCompletionFromToolOutput as T, SubagentDurability as _, AgentResultSchema as a, SubagentDurabilityError as b, AgentSpawner as c, DetachedRun as d, EngineProvidedToolServices as f, SpawnedChildRun as g, SpawnRunOptions as h, AgentResult as i, startUnknown as j, runUnknown as k, AgentSpawnerParent as l, SpawnDelegation as m, AgentChildPending as n, AgentRuntimeFailure as o, RuntimeBinding as p, AgentCompletionProjectionRequirements as r, AgentRuntimeRequirements as s, AgentRuntime_d_exports as t, AgentSpawnerService as u, SubagentDurabilityDurable as v, encodeRunDisposition as w, SubagentDurabilityService as x, SubagentDurabilityEphemeral as y };
346
- //# sourceMappingURL=AgentRuntime-DyZv8uu2.d.mts.map
346
+ //# sourceMappingURL=AgentRuntime-BUxDdLpw.d.mts.map
@@ -1619,24 +1619,53 @@ const makeWorkerRuntime = Effect.fn("WorkerHost.make")(function* (options) {
1619
1619
  return saved === null ? yield* Effect.fail(error) : yield* replay(saved);
1620
1620
  })));
1621
1621
  }),
1622
- followUp: Effect.fn("WorkerHost.followUp")(function* (request) {
1623
- const principal = yield* authorize("followUp", "send", request.worker);
1624
- const origin = yield* findOrigin(request.worker, request.target, "followUp");
1625
- yield* resolveTargetPolicy({
1622
+ followUp: Effect.fn("WorkerHost.followUp")(function* (command) {
1623
+ const principal = yield* authorize("followUp", "send", command.worker);
1624
+ const origin = yield* findOrigin(command.worker, command.target, "followUp");
1625
+ const currentPolicy = resolveTargetPolicy({
1626
1626
  _tag: "RetainedWorker",
1627
- definition: request.target,
1627
+ definition: command.target,
1628
1628
  definitions: origin.targetDigests,
1629
1629
  source: origin.source,
1630
1630
  origin
1631
1631
  });
1632
- yield* Schema.decodeUnknownEffect(Schema.toEncoded(request.target.input))(request.encodedInput).pipe(Effect.mapError((cause) => failure("followUp", "corrupt", cause)));
1632
+ yield* currentPolicy;
1633
1633
  const messageId = yield* messageIdFor([
1634
1634
  context.source.threadId,
1635
- request.worker.threadId,
1635
+ command.worker.threadId,
1636
1636
  "followUp",
1637
- request.idempotencyKey
1637
+ command.idempotencyKey
1638
1638
  ]);
1639
- return yield* send(origin, messageId, request.encodedInput, request.encodedParameters, principal, "followUp");
1639
+ if (Option.isNone(deps.deliveries)) return yield* failure("followUp", "unavailable");
1640
+ const deliveries = deps.deliveries.value;
1641
+ const retained = () => deliveries.get({
1642
+ ownerThreadId: context.source.threadId,
1643
+ messageId
1644
+ }).pipe(Effect.mapError(storageFailure("followUp")));
1645
+ const replay = (saved) => Effect.gen(function* () {
1646
+ const replayPrincipal = yield* authorize("followUp", "send", command.worker);
1647
+ yield* currentPolicy;
1648
+ return yield* send(origin, messageId, saved.envelope.input, command.encodedParameters, replayPrincipal, "followUp");
1649
+ });
1650
+ const existing = "prepare" in command ? yield* retained() : null;
1651
+ if (existing !== null) return yield* replay(existing);
1652
+ return yield* Effect.gen(function* () {
1653
+ const request = "prepare" in command ? {
1654
+ ...yield* command.prepare,
1655
+ ...command
1656
+ } : command;
1657
+ yield* Schema.decodeUnknownEffect(Schema.toEncoded(request.target.input))(request.encodedInput).pipe(Effect.mapError((cause) => failure("followUp", "corrupt", cause)));
1658
+ let sendPrincipal = principal;
1659
+ if ("prepare" in command) {
1660
+ sendPrincipal = yield* authorize("followUp", "send", command.worker);
1661
+ yield* currentPolicy;
1662
+ }
1663
+ return yield* send(origin, messageId, request.encodedInput, request.encodedParameters, sendPrincipal, "followUp");
1664
+ }).pipe(Effect.catch((error) => Effect.gen(function* () {
1665
+ if (!("prepare" in command)) return yield* Effect.fail(error);
1666
+ const saved = yield* retained();
1667
+ return saved === null ? yield* Effect.fail(error) : yield* replay(saved);
1668
+ })));
1640
1669
  }),
1641
1670
  inspect: Effect.fn("WorkerHost.inspect")(function* (request) {
1642
1671
  yield* authorize("inspect", "read", request.worker);
@@ -6994,4 +7023,4 @@ var DurableAgentRuntime = class DurableAgentRuntime extends Context.Service()("@
6994
7023
  //#endregion
6995
7024
  export { RecoveryBlocked as a, RecoverySweepResult as c, recoveryRepairBatchId as d, recoveryRepairRecordId as f, DurableRuntimeConfig as i, childReservationIdFor as l, threadCreatedRecordId as m, DurableAgentRuntime_exports as n, RecoveryFailure as o, threadCreatedBatchId as p, DurableApprovalResolver as r, RecoveryReport as s, DurableAgentRuntime as t, isolateRecovery as u };
6996
7025
 
6997
- //# sourceMappingURL=DurableAgentRuntime-tNrkJZNo.mjs.map
7026
+ //# sourceMappingURL=DurableAgentRuntime-DQqxmn2h.mjs.map