effect-agent 0.1.0-beta.140 → 0.1.0-beta.143

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 (77) hide show
  1. package/dist/{Admin-DGZXE5BU.d.mts → Admin-CQMppCcy.d.mts} +986 -3
  2. package/dist/{AgentRuntime-RdmnK_aD.mjs → AgentRuntime-xeCUXutN.mjs} +10 -9
  3. package/dist/AgentRuntime-xeCUXutN.mjs.map +1 -0
  4. package/dist/{DurableAgentRuntime-BmG_UVZG.mjs → DurableAgentRuntime-D8GI66mP.mjs} +21 -3
  5. package/dist/DurableAgentRuntime-D8GI66mP.mjs.map +1 -0
  6. package/dist/{EventSource-Cg3IeJa6.d.mts → EventSource-w9PonN9X.d.mts} +2 -2
  7. package/dist/{PreparedInputAdmission-CLvaruRe.d.mts → PreparedInputAdmission-BfcLy_k4.d.mts} +3 -3
  8. package/dist/{Subagent-Bnc7I-kb.mjs → Subagent-8RzJkqJ9.mjs} +2 -2
  9. package/dist/{Subagent-Bnc7I-kb.mjs.map → Subagent-8RzJkqJ9.mjs.map} +1 -1
  10. package/dist/{Subscription-_VTIVN8o.d.mts → Subscription-ClkC4_T0.d.mts} +2 -2
  11. package/dist/{SubscriptionInput-BIH1f3Th.d.mts → SubscriptionInput-CMjEKL1z.d.mts} +2 -2
  12. package/dist/capabilities/Subagent.mjs +1 -1
  13. package/dist/durable/Admin.d.mts +1 -1
  14. package/dist/durable/AgentRegistration.d.mts +1 -1
  15. package/dist/durable/Certification.d.mts +1 -1
  16. package/dist/durable/CommittedActivity.d.mts +1 -1
  17. package/dist/durable/DurableAgentRuntime.d.mts +1 -1
  18. package/dist/durable/DurableAgentRuntime.mjs +1 -1
  19. package/dist/durable/EventSource.d.mts +1 -1
  20. package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
  21. package/dist/durable/LifecyclePublication.d.mts +2 -0
  22. package/dist/durable/LifecyclePublication.mjs +169 -0
  23. package/dist/durable/LifecyclePublication.mjs.map +1 -0
  24. package/dist/durable/MessageDelivery.d.mts +4 -3
  25. package/dist/durable/MessageDelivery.mjs.map +1 -1
  26. package/dist/durable/MessageDeliveryStoreConformance.d.mts +1 -1
  27. package/dist/durable/PersistentHistory.d.mts +1 -1
  28. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  29. package/dist/durable/Recovery.d.mts +1 -1
  30. package/dist/durable/RunJournal.d.mts +1 -1
  31. package/dist/durable/Scheduling.d.mts +1 -1
  32. package/dist/durable/SubmissionLedger.d.mts +1 -1
  33. package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
  34. package/dist/durable/SubmissionStatus.d.mts +1 -1
  35. package/dist/durable/Subscription.d.mts +1 -1
  36. package/dist/durable/SubscriptionInput.d.mts +1 -1
  37. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  38. package/dist/durable/SubscriptionTools.d.mts +2 -2
  39. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  40. package/dist/durable/Subscriptions.d.mts +5 -5
  41. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  42. package/dist/durable/ThreadInvariants.d.mts +1 -1
  43. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  44. package/dist/durable/ThreadStore.d.mts +1 -1
  45. package/dist/durable/ThreadStore.mjs.map +1 -1
  46. package/dist/durable/ThreadStoreConformance.d.mts +1 -1
  47. package/dist/durable/WorkerHost.d.mts +1 -1
  48. package/dist/engine/AgentRuntime.mjs +1 -1
  49. package/dist/index.d.mts +6 -7
  50. package/dist/index.mjs +5 -5
  51. package/package.json +1 -1
  52. package/src/durable/DurableAgentRuntime.ts +41 -1
  53. package/src/durable/LifecyclePublication.ts +244 -0
  54. package/src/durable/MessageDelivery.ts +2 -0
  55. package/src/durable/ThreadStore.ts +2 -0
  56. package/src/engine/internal/agent-runtime.ts +49 -19
  57. package/src/index.ts +1 -2
  58. package/dist/AgentRuntime-RdmnK_aD.mjs.map +0 -1
  59. package/dist/DurableAgentRuntime-BmG_UVZG.mjs.map +0 -1
  60. package/dist/durable/SqlMessageDeliveryStore.d.mts +0 -42
  61. package/dist/durable/SqlMessageDeliveryStore.mjs +0 -179
  62. package/dist/durable/SqlMessageDeliveryStore.mjs.map +0 -1
  63. package/dist/durable/SqlStorageV2Upgrade.d.mts +0 -21
  64. package/dist/durable/SqlStorageV2Upgrade.mjs +0 -459
  65. package/dist/durable/SqlStorageV2Upgrade.mjs.map +0 -1
  66. package/dist/durable/SqlSubscriptionStore.d.mts +0 -62
  67. package/dist/durable/SqlSubscriptionStore.mjs +0 -751
  68. package/dist/durable/SqlSubscriptionStore.mjs.map +0 -1
  69. package/dist/durable/SqlThreadNativeReads.d.mts +0 -55
  70. package/dist/durable/SqlThreadNativeReads.mjs +0 -196
  71. package/dist/durable/SqlThreadNativeReads.mjs.map +0 -1
  72. package/src/durable/SqlMessageDeliveryStore.ts +0 -335
  73. package/src/durable/SqlStorageV2Upgrade.ts +0 -500
  74. package/src/durable/SqlSubscriptionStore.ts +0 -1440
  75. package/src/durable/SqlThreadNativeReads.ts +0 -343
  76. package/src/durable/internal/storage-v2-layout.ts +0 -163
  77. package/src/durable/internal/storage-v2.ts +0 -73
@@ -15,7 +15,7 @@ import { a as PeerMessageCapacity, d as MessageAdmission, f as MessagingError, i
15
15
  import { SubagentHost } from "./engine/SubagentHost.mjs";
16
16
  import { ThreadHistory } from "./engine/ThreadHistory.mjs";
17
17
  import { n as RunToolVisibility } from "./ToolExposure-9uF_Yo0T.mjs";
18
- import { f as renderInputPrompt, n as AgentChildPending, y as streamWithUsageAccountingUnknown } from "./AgentRuntime-RdmnK_aD.mjs";
18
+ import { f as renderInputPrompt, n as AgentChildPending, y as streamWithUsageAccountingUnknown } from "./AgentRuntime-xeCUXutN.mjs";
19
19
  import { ContextRolloverTool } from "./engine/ContextWindow.mjs";
20
20
  import { getToolExecutionClass } from "./engine/DurableStep.mjs";
21
21
  import { CompactionError, ContextCompactor } from "./engine/ContextCompactor.mjs";
@@ -2338,6 +2338,11 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
2338
2338
  const ledger = yield* SubmissionLedger;
2339
2339
  const submissionScheduling = yield* SubmissionScheduling;
2340
2340
  const store = yield* ThreadStore;
2341
+ const publicationPending = (threadId) => store.lifecyclePublications === void 0 ? Effect.succeed(false) : store.lifecyclePublications.pendingDeadlineFor(threadId).pipe(Effect.map(Option.isSome), Effect.mapError((cause) => ThreadStoreError.make({
2342
+ operation: "read lifecycle publication gate",
2343
+ message: "Native lifecycle publication state is unavailable",
2344
+ cause
2345
+ })));
2341
2346
  const wake = yield* WakeScheduler;
2342
2347
  const failpoint = yield* DurableRuntimeFailpoint;
2343
2348
  const config = yield* DurableRuntimeConfig;
@@ -4098,6 +4103,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
4098
4103
  */
4099
4104
  const runModel = (agent, ctx, submission, tokenRef, records, canonical, canonicalThrough, journalSeed, journalMetadata, lineage, approvalDecisions, runTiming, yieldAfter) => Effect.gen(function* () {
4100
4105
  const submissionId = submission.submissionId;
4106
+ if (yield* publicationPending(submission.threadId)) return { _tag: "yielded" };
4101
4107
  const runId = runIdForSubmission(submissionId);
4102
4108
  const boundaries = [];
4103
4109
  const journal = yield* projectRunJournalStream(canonical, runId, (boundary) => boundaries.push(boundary), journalSeed, journalMetadata);
@@ -4828,9 +4834,18 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
4828
4834
  const decodedInput = yield* Schema.decodeEffect(agent.definition.input)(encodedInput).pipe(Effect.mapError((cause) => AgentInputError.make({ message: cause.message })));
4829
4835
  return yield* renderInputPrompt(inputPrompt, decodedInput, encodedInput);
4830
4836
  });
4837
+ const yieldForPublication = Effect.gen(function* () {
4838
+ const pending = yield* Effect.exit(publicationPending(submission.threadId));
4839
+ if (Exit.isSuccess(pending) && !pending.value) return;
4840
+ yield* recordHalt(commitPendingTurn);
4841
+ if (Exit.isFailure(pending)) return yield* recordHalt(Effect.failCause(pending.cause));
4842
+ yield* Deferred.succeed(yieldSignal, void 0);
4843
+ return yield* Effect.never;
4844
+ });
4831
4845
  const input = { drain: (policy) => Effect.gen(function* () {
4832
4846
  const state = yield* Ref.get(stateRef);
4833
4847
  if (state.pendingTurn !== void 0 && knownIds.has(modelResponseRecordId(runId, state.pendingTurn.turn))) yield* recordHalt(commitPendingTurn);
4848
+ yield* yieldForPublication;
4834
4849
  const joinedInputs = yield* recordHalt(Effect.gen(function* () {
4835
4850
  const limit = policy === "one" ? 1 : MAX_JOIN_DRAIN;
4836
4851
  const joinedInputs = [];
@@ -4908,6 +4923,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
4908
4923
  }
4909
4924
  return joinedInputs;
4910
4925
  }));
4926
+ yield* yieldForPublication;
4911
4927
  return yield* Effect.forEach(joinedInputs, (joinedInput) => renderJoinedInput(joinedInput).pipe(Effect.map((input) => ({
4912
4928
  kind: "steering",
4913
4929
  input
@@ -5230,6 +5246,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
5230
5246
  ...preparedContext === void 0 ? {} : { context: preparedContext },
5231
5247
  beforeTurn: () => Effect.gen(function* () {
5232
5248
  yield* recordHalt(commitPendingTurn);
5249
+ yield* yieldForPublication;
5233
5250
  if (yieldAfter !== void 0 && (yield* Clock.currentTimeMillis) >= DateTime.toEpochMillis(yieldAfter)) {
5234
5251
  yield* Deferred.succeed(yieldSignal, void 0);
5235
5252
  return yield* Effect.never;
@@ -5505,7 +5522,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
5505
5522
  yield* Ref.set(tokenRef, renewal.ownershipToken);
5506
5523
  }).pipe(Effect.uninterruptible), { schedule: Schedule.spaced(config.leaseRenewalInterval) }).pipe(Effect.andThen(Effect.never)));
5507
5524
  const execution = Effect.raceFirst(consume, Effect.raceFirst(abortWatcher, renewal));
5508
- const result = yield* (yieldAfter === void 0 && submissionScheduling.yieldTo === void 0 ? execution : Effect.raceFirst(execution, Deferred.await(yieldSignal).pipe(Effect.map((nextSubmissionId) => ({
5525
+ const result = yield* (yieldAfter === void 0 && submissionScheduling.yieldTo === void 0 && store.lifecyclePublications === void 0 ? execution : Effect.raceFirst(execution, Deferred.await(yieldSignal).pipe(Effect.map((nextSubmissionId) => ({
5509
5526
  _tag: "yielded",
5510
5527
  ...nextSubmissionId === void 0 ? {} : { nextSubmissionId }
5511
5528
  }))))).pipe(Effect.provideService(IdGenerator$1, idGenerator)).pipe(Effect.catchCauseFilter(Cause.findError, (error, cause) => {
@@ -5881,6 +5898,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
5881
5898
  let handoff;
5882
5899
  let nextHandoff;
5883
5900
  const attempt = Effect.scoped(Effect.gen(function* () {
5901
+ if (yield* publicationPending(threadId)) return Option.none();
5884
5902
  const claimed = yield* acquireClaim(threadId, handoff);
5885
5903
  if (Option.isNone(claimed)) return Option.none();
5886
5904
  const { claim, tokenRef } = claimed.value;
@@ -7162,4 +7180,4 @@ var DurableAgentRuntime = class DurableAgentRuntime extends Context.Service()("@
7162
7180
  //#endregion
7163
7181
  export { DurableApprovalSuspension as a, RecoveryFailure as c, childReservationIdFor as d, isolateRecovery as f, threadCreatedRecordId as g, threadCreatedBatchId as h, DurableApprovalResolver as i, RecoveryReport as l, recoveryRepairRecordId as m, DurableAgentRuntime as n, DurableRuntimeConfig as o, recoveryRepairBatchId as p, DurableAgentRuntime_exports as r, RecoveryBlocked as s, ApprovalSuspensionError as t, RecoverySweepResult as u };
7164
7182
 
7165
- //# sourceMappingURL=DurableAgentRuntime-BmG_UVZG.mjs.map
7183
+ //# sourceMappingURL=DurableAgentRuntime-D8GI66mP.mjs.map