effect-durable-agent 0.1.0 → 0.2.0

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 (110) hide show
  1. package/dist/{compaction-63iEDHHl.js → compaction-D7WJa899.js} +3 -3
  2. package/dist/{compaction-63iEDHHl.js.map → compaction-D7WJa899.js.map} +1 -1
  3. package/dist/{delivery-D3MxW4wg.d.ts → delivery-B_LDTuIB.d.ts} +153 -10
  4. package/dist/{delivery-2ZILvoRD.js → delivery-BoF-NZbZ.js} +3 -3
  5. package/dist/{delivery-2ZILvoRD.js.map → delivery-BoF-NZbZ.js.map} +1 -1
  6. package/dist/domain/command-queues.d.ts +1 -1
  7. package/dist/domain/message-transcript.d.ts +1 -1
  8. package/dist/domain/model-usage.d.ts +1 -1
  9. package/dist/domain/model-usage.js +1 -1
  10. package/dist/domain/reduced-state-schema.d.ts +2 -2
  11. package/dist/domain/reduced-state-schema.js +2 -2
  12. package/dist/domain/reduced-state.d.ts +2 -2
  13. package/dist/domain/reduced-state.js +3 -2
  14. package/dist/domain/reduced-state.js.map +1 -1
  15. package/dist/domain/run-scheduling.d.ts +1 -1
  16. package/dist/{durable-168Womqp.d.ts → durable-BXqwM70o.d.ts} +510 -3
  17. package/dist/{durable-D13w1Qr3.js → durable-Da57Rcml.js} +17 -3
  18. package/dist/durable-Da57Rcml.js.map +1 -0
  19. package/dist/{envelope-BCzKUq_z.js → envelope-BSI_Xh-f.js} +21 -5
  20. package/dist/envelope-BSI_Xh-f.js.map +1 -0
  21. package/dist/{envelope-Che6KatU.d.ts → envelope-CJnPfbjC.d.ts} +53 -6
  22. package/dist/{event-factory-_vF1bIJ7.js → event-factory-BUoBwqAy.js} +3 -3
  23. package/dist/{event-factory-_vF1bIJ7.js.map → event-factory-BUoBwqAy.js.map} +1 -1
  24. package/dist/{events-DwTARLMv.d.ts → events-AIIwZ6dS.d.ts} +3 -3
  25. package/dist/{in-memory-CeODnZhE.js → in-memory-E497WhtS.js} +3 -3
  26. package/dist/{in-memory-CeODnZhE.js.map → in-memory-E497WhtS.js.map} +1 -1
  27. package/dist/index.d.ts +5 -5
  28. package/dist/index.js +3 -3
  29. package/dist/{interpreter-DKGJ1sSx.js → interpreter-BwYN2PCC.js} +5 -4
  30. package/dist/interpreter-BwYN2PCC.js.map +1 -0
  31. package/dist/{model-resolver-DeBDK8XO.d.ts → model-resolver-O8Kn27GH.d.ts} +3 -3
  32. package/dist/{model-usage-0GeHwaaU.d.ts → model-usage-mttrPN0j.d.ts} +2 -2
  33. package/dist/{records--54mZEBx.js → records-D0ZIAOzd.js} +3 -3
  34. package/dist/{records--54mZEBx.js.map → records-D0ZIAOzd.js.map} +1 -1
  35. package/dist/{reduced-state-B1cvy8N_.d.ts → reduced-state-YbjpihEf.d.ts} +50549 -48726
  36. package/dist/{reduced-state-schema-B98exWxQ.d.ts → reduced-state-schema-B9TYxkP9.d.ts} +2 -2
  37. package/dist/{reducer-registry-DhGVzHBV.d.ts → reducer-registry-Bqn5B4JO.d.ts} +5 -5
  38. package/dist/{run-scheduling-wakeup-Mjic4tb_.d.ts → run-scheduling-wakeup-DX2zRAxd.d.ts} +2 -2
  39. package/dist/services/compaction.d.ts +1 -1
  40. package/dist/services/compaction.js +1 -1
  41. package/dist/services/decider.d.ts +2 -0
  42. package/dist/services/decider.js +97 -0
  43. package/dist/services/decider.js.map +1 -0
  44. package/dist/services/model-call.d.ts +1 -1
  45. package/dist/services/model-resolver.d.ts +1 -1
  46. package/dist/services/prompt-projector.d.ts +1 -1
  47. package/dist/services/reducer-registry.d.ts +1 -1
  48. package/dist/services/run-scheduler.d.ts +1 -1
  49. package/dist/services/run-scheduling-wakeup.d.ts +1 -1
  50. package/dist/services/runtime-layer.d.ts +13 -9
  51. package/dist/services/runtime-layer.js +10 -7
  52. package/dist/services/runtime-layer.js.map +1 -1
  53. package/dist/services/runtime.d.ts +1 -1
  54. package/dist/services/runtime.js +4 -3
  55. package/dist/services/runtime.js.map +1 -1
  56. package/dist/services/session-event-observer.d.ts +1 -1
  57. package/dist/services/session-query.d.ts +1 -1
  58. package/dist/services/session-query.js +3 -3
  59. package/dist/services/session-state.d.ts +2 -2
  60. package/dist/services/session-state.js +2 -1
  61. package/dist/services/session-store.d.ts +2 -2
  62. package/dist/services/session-store.js +32 -17
  63. package/dist/services/session-store.js.map +1 -1
  64. package/dist/services/sink-checkpoint-store.d.ts +1 -1
  65. package/dist/services/sink-registry.d.ts +1 -1
  66. package/dist/services/sink-registry.js +1 -1
  67. package/dist/services/span-names.d.ts +1 -1
  68. package/dist/services/span-names.js +1 -0
  69. package/dist/services/span-names.js.map +1 -1
  70. package/dist/services/tool-registry.d.ts +1 -1
  71. package/dist/services/tool-registry.js.map +1 -1
  72. package/dist/services/tracing.d.ts +2 -2
  73. package/dist/session-admission-WE8J_0z9.js +138 -0
  74. package/dist/session-admission-WE8J_0z9.js.map +1 -0
  75. package/dist/{session-event-observer-DlP9ITB2.d.ts → session-event-observer-BWQUJTcN.d.ts} +3 -3
  76. package/dist/{session-state-BehvUVyq.js → session-state-D02LCVcC.js} +167 -17
  77. package/dist/session-state-D02LCVcC.js.map +1 -0
  78. package/dist/{session-store-BL6sfrnn.d.ts → session-store-DaSHeg8Q.d.ts} +25 -8
  79. package/dist/{sink-checkpoint-store-DvuHwvx_.d.ts → sink-checkpoint-store-CUvIVvlZ.d.ts} +2 -2
  80. package/dist/{sink-registry-DskRcyOS.js → sink-registry-AOjX5_A1.js} +34 -10
  81. package/dist/sink-registry-AOjX5_A1.js.map +1 -0
  82. package/dist/{subscription-DZNWFDTV.d.ts → subscription-BhwUmsl4.d.ts} +2 -2
  83. package/dist/{subscription-DmO3BcdT.js → subscription-D7U4Tziv.js} +3 -3
  84. package/dist/{subscription-DmO3BcdT.js.map → subscription-D7U4Tziv.js.map} +1 -1
  85. package/dist/testkit/layers.d.ts +13 -10
  86. package/dist/testkit/layers.js +16 -9
  87. package/dist/testkit/layers.js.map +1 -1
  88. package/dist/testkit/transcript.d.ts +10 -4
  89. package/dist/testkit/transcript.js +58 -7
  90. package/dist/testkit/transcript.js.map +1 -1
  91. package/dist/transcript.d.ts +5 -5
  92. package/dist/transcript.js +5 -5
  93. package/dist/types/events/durable.d.ts +2 -2
  94. package/dist/types/events/durable.js +2 -2
  95. package/dist/types/events.d.ts +4 -4
  96. package/dist/types/events.js +3 -3
  97. package/dist/websocket/events.d.ts +1 -1
  98. package/dist/websocket/events.js +1 -1
  99. package/dist/websocket.d.ts +3 -3
  100. package/dist/websocket.js +3 -3
  101. package/dist/{window-read-Brov9VdQ.d.ts → window-read-BELSkO-r.d.ts} +2 -2
  102. package/dist/{window-read-DPFAA1hM.js → window-read-FJTCDaSq.js} +3 -3
  103. package/dist/{window-read-DPFAA1hM.js.map → window-read-FJTCDaSq.js.map} +1 -1
  104. package/package.json +5 -1
  105. package/dist/durable-D13w1Qr3.js.map +0 -1
  106. package/dist/envelope-BCzKUq_z.js.map +0 -1
  107. package/dist/interpreter-DKGJ1sSx.js.map +0 -1
  108. package/dist/session-state-BehvUVyq.js.map +0 -1
  109. package/dist/sink-registry-DskRcyOS.js.map +0 -1
  110. package/dist/tool-registry-CHHUU9BN.d.ts +0 -87
@@ -1,5 +1,5 @@
1
1
  import { _ as parseEDATraceparent, a as EDATraceAttributes, c as EDATraceLink, d as makeEDAEventTrace, f as makeEDARunTrace, g as makeRootEDATraceMetadata, h as makeRootEDAEventTrace, i as EDATraceAttributeValue, l as EDATraceMetadata, m as makeEDATraceMetadataFromParent, n as EDARunTrace, o as EDATraceContext, p as makeEDATraceContext, r as EDASpanId, s as EDATraceId, t as EDAEventTrace, u as buildEDATraceparent } from "../tracing-BwjbF285.js";
2
- import { _ as UnixEpochMillis, a as EventNamespace, b as makeEventType, c as FailurePayload, d as NonNegativeInt, f as PositionedEvent, g as ToolName, h as SystemPromptText, i as EventEnvelope, l as ForeignDurableEvent, m as SchemaVersion, n as EphemeralEventEnvelope, o as EventType, p as ProviderPartId, r as EventDurability, s as EventTypeName, t as DurableEventEnvelope, u as ModelSelectionPayload, v as UsagePayload, x as schemaV1, y as effectDurableAgentNamespace } from "../envelope-Che6KatU.js";
3
- import { $ as LegacyAttemptEvent, $n as pendingMessagesPausedEventType, $t as ToolCallRejectedPayload, A as CompactionFailedEvent, An as baseStateCreatedEventType, At as SessionConfiguredEvent, B as ContextRebasedPayload, Bn as compactionRequestedEventType, Bt as SummaryCreatedEvent, C as CommandEvent, Cn as UserMessagePromotedEvent, Cr as turnStartedEventType, Ct as RunSchedulingGrantedPayload, D as CommandStartedPayload, Dn as assistantMessageCommittedEventType, Dr as userMessagePromotedEventType, Dt as RunSchedulingRequestedPayload, E as CommandStartedEvent, En as UserMessageSubmittedPayload, Er as userMessageCommittedEventType, Et as RunSchedulingRequestedEvent, F as CompactionStartedPayload, Fn as commandCompletedEventType, Ft as StopControlEvent, G as InferenceCompletedEvent, Gn as decodeUnknownEDADurableEvent, Gt as ToolCallCompletedPayload, H as DecodedDurableEvent, Hn as contextProjectedEventType, Ht as SystemMessageCommittedEvent, I as ContextAndCompactionEvent, In as commandFailedEventType, It as StopTurnAppliedEvent, J as InferenceFailedEvent, Jn as inferenceCompletedEventType, Jt as ToolCallEvent, K as InferenceCompletedPayload, Kn as decodeUnknownEDADurableEventSync, Kt as ToolCallCreatedEvent, L as ContextProjectedEvent, Ln as commandStartedEventType, Lt as StopTurnAppliedPayload, M as CompactionRequestedEvent, Mn as baseStateRequestedEventType, Mt as SteeringMessageCancelledPayload, N as CompactionRequestedPayload, Nn as commandAdmittedEventType, Nt as SteeringMessageQueuedEvent, O as CompactionCompletedEvent, On as assistantMessageImportedEventType, Or as userMessageSubmittedEventType, Ot as RunStartedEvent, P as CompactionStartedEvent, Pn as commandCancelledEventType, Pt as SteeringMessageQueuedPayload, Q as LegacyAssistantMessageCommittedEvent, Qn as messageQueuePausedEventType, Qt as ToolCallRejectedEvent, R as ContextProjectedPayload, Rn as compactionCompletedEventType, Rt as StopTurnRequestedEvent, S as CommandCompletedPayload, Sn as UserMessageDisposition, Sr as turnFailedEventType, St as RunSchedulingGrantedEvent, T as CommandFailedPayload, Tn as UserMessageSubmittedEvent, Tr as userMessageCancelledEventType, Tt as RunSchedulingInvalidatedPayload, U as EDADurableEvent, Un as contextRebasedEventType, Ut as SystemMessageCommittedPayload, V as CurrentEDADurableEvent, Vn as compactionStartedEventType, Vt as SummaryCreatedPayload, W as EDADurableEventV1, Wn as decodeDurableEventSync, Wt as ToolCallCompletedEvent, X as InferenceStartedEvent, Xn as inferenceStartedEventType, Xt as ToolCallFailedPayload, Y as InferenceFailedPayload, Yn as inferenceFailedEventType, Yt as ToolCallFailedEvent, Z as InferenceStartedPayload, Zn as interpretLegacyAttemptForReduction, Zt as ToolCallPromptPart, _ as CommandAdmittedEvent, _n as UserMessageCancellationReason, _r as toolCallCreatedEventType, _t as RunInterruptedEvent, a as AssistantMessageImportedPayload, an as ToolPromptPart, ar as runSchedulingGrantedEventType, at as MessageQueuePausedPayload, b as CommandCancelledPayload, bn as UserMessageCommittedEvent, br as toolCallStartedEventType, bt as RunSchedulingDeliveredPayload, c as AssistantPromptPart, cn as TurnCompletedEvent, cr as runStartedEventType, ct as RecoveryCompletedEvent, d as BaseStateCreatedPayload, dn as TurnFailedEvent, dr as steeringMessageQueuedEventType, dt as RecoveryEvent, en as ToolCallRejectionFeedback, er as recoveryCompletedEventType, et as LegacyToolCallCreatedEvent, f as BaseStateEvent, fn as TurnFailedPayload, fr as stopTurnAppliedEventType, ft as RunCompletedEvent, g as BaseStateRequestedPayload, gn as TurnStoppedPayload, gr as toolCallCompletedEventType, gt as RunFailedPayload, h as BaseStateRequestedEvent, hn as TurnStoppedEvent, hr as systemMessageCommittedEventType, ht as RunFailedEvent, i as AssistantMessageImportedEvent, in as ToolFailurePromptPart, ir as runSchedulingDeliveredEventType, it as MessageQueuePausedEvent, j as CompactionFailedPayload, jn as baseStateFailedEventType, jt as SteeringMessageCancelledEvent, k as CompactionCompletedPayload, kn as assistantPartialCommittedEventType, kt as RunStartedPayload, l as AssistantPromptParts, ln as TurnCompletedPayload, lr as sessionConfiguredEventType, lt as RecoveryCompletedPayload, m as BaseStateFailedPayload, mn as TurnStartedPayload, mr as summaryCreatedEventType, mt as RunEvent, n as AssistantMessageCommittedPayload, nn as ToolCallStartedEvent, nr as runFailedEventType, nt as LegacyTurnAttemptStartedEvent, o as AssistantPartialCommittedEvent, on as ToolRejectionPromptPart, or as runSchedulingInvalidatedEventType, ot as PendingMessagesPausedEvent, p as BaseStateFailedEvent, pn as TurnStartedEvent, pr as stopTurnRequestedEventType, pt as RunCompletedPayload, q as InferenceEvent, qn as durableEventEnvelope, qt as ToolCallCreatedPayload, r as AssistantMessageContent, rn as ToolCallStartedPayload, rr as runInterruptedEventType, rt as MessageEvent, s as AssistantPartialCommittedPayload, sn as ToolSuccessPromptPart, sr as runSchedulingRequestedEventType, st as PendingMessagesPausedPayload, t as AssistantMessageCommittedEvent, tn as ToolCallRejectionReason, tr as runCompletedEventType, tt as LegacyTurnAttemptCompletedEvent, u as BaseStateCreatedEvent, un as TurnEvent, ur as steeringMessageCancelledEventType, ut as RecoveryContinuation, v as CommandAdmittedPayload, vn as UserMessageCancelledEvent, vr as toolCallFailedEventType, vt as RunInterruptedPayload, w as CommandFailedEvent, wn as UserMessagePromotedPayload, wr as turnStoppedEventType, wt as RunSchedulingInvalidatedEvent, x as CommandCompletedEvent, xn as UserMessageCommittedPayload, xr as turnCompletedEventType, xt as RunSchedulingEvent, y as CommandCancelledEvent, yn as UserMessageCancelledPayload, yr as toolCallRejectedEventType, yt as RunSchedulingDeliveredEvent, z as ContextRebasedEvent, zn as compactionFailedEventType, zt as StopTurnRequestedPayload } from "../durable-168Womqp.js";
4
- import { C as toolParamsDeltaEventType, E as traceStatusEventType, S as textDeltaEventType, T as toolParamsStartEventType, _ as TraceStatusEvent, a as RuntimeStatusEvent, b as reasoningDeltaEventType, c as SubscriberStatusPayload, d as ToolParamsDeltaEvent, f as ToolParamsDeltaPayload, g as ToolParamsStartPayload, h as ToolParamsStartEvent, i as ReasoningDeltaPayload, l as TextDeltaEvent, m as ToolParamsEndPayload, n as ModelStreamEvent, o as SubscriberStatusEvent, p as ToolParamsEndEvent, r as ReasoningDeltaEvent, s as SubscriberStatusKind, t as EDAEphemeralEvent, u as TextDeltaPayload, v as TraceStatusKind, w as toolParamsEndEventType, x as subscriberStatusEventType, y as TraceStatusPayload } from "../events-DwTARLMv.js";
5
- export { AssistantMessageCommittedEvent, AssistantMessageCommittedPayload, AssistantMessageContent, AssistantMessageImportedEvent, AssistantMessageImportedPayload, AssistantPartialCommittedEvent, AssistantPartialCommittedPayload, AssistantPromptPart, AssistantPromptParts, BaseStateCreatedEvent, BaseStateCreatedPayload, BaseStateEvent, BaseStateFailedEvent, BaseStateFailedPayload, BaseStateRequestedEvent, BaseStateRequestedPayload, CommandAdmittedEvent, CommandAdmittedPayload, CommandCancelledEvent, CommandCancelledPayload, CommandCompletedEvent, CommandCompletedPayload, CommandEvent, CommandFailedEvent, CommandFailedPayload, CommandStartedEvent, CommandStartedPayload, CompactionCompletedEvent, CompactionCompletedPayload, CompactionFailedEvent, CompactionFailedPayload, CompactionRequestedEvent, CompactionRequestedPayload, CompactionStartedEvent, CompactionStartedPayload, ContextAndCompactionEvent, ContextProjectedEvent, ContextProjectedPayload, ContextRebasedEvent, ContextRebasedPayload, CurrentEDADurableEvent, DecodedDurableEvent, DurableEventEnvelope, EDADurableEvent, EDADurableEventV1, EDAEphemeralEvent, EDAEventTrace, EDARunTrace, EDASpanId, EDATraceAttributeValue, EDATraceAttributes, EDATraceContext, EDATraceId, EDATraceLink, EDATraceMetadata, EphemeralEventEnvelope, EventDurability, EventEnvelope, EventNamespace, EventType, EventTypeName, FailurePayload, ForeignDurableEvent, InferenceCompletedEvent, InferenceCompletedPayload, InferenceEvent, InferenceFailedEvent, InferenceFailedPayload, InferenceStartedEvent, InferenceStartedPayload, LegacyAssistantMessageCommittedEvent, LegacyAttemptEvent, LegacyToolCallCreatedEvent, LegacyTurnAttemptCompletedEvent, LegacyTurnAttemptStartedEvent, MessageEvent, MessageQueuePausedEvent, MessageQueuePausedPayload, ModelSelectionPayload, ModelStreamEvent, NonNegativeInt, PendingMessagesPausedEvent, PendingMessagesPausedPayload, PositionedEvent, ProviderPartId, ReasoningDeltaEvent, ReasoningDeltaPayload, RecoveryCompletedEvent, RecoveryCompletedPayload, RecoveryContinuation, RecoveryEvent, RunCompletedEvent, RunCompletedPayload, RunEvent, RunFailedEvent, RunFailedPayload, RunInterruptedEvent, RunInterruptedPayload, RunSchedulingDeliveredEvent, RunSchedulingDeliveredPayload, RunSchedulingEvent, RunSchedulingGrantedEvent, RunSchedulingGrantedPayload, RunSchedulingInvalidatedEvent, RunSchedulingInvalidatedPayload, RunSchedulingRequestedEvent, RunSchedulingRequestedPayload, RunStartedEvent, RunStartedPayload, RuntimeStatusEvent, SchemaVersion, SessionConfiguredEvent, SteeringMessageCancelledEvent, SteeringMessageCancelledPayload, SteeringMessageQueuedEvent, SteeringMessageQueuedPayload, StopControlEvent, StopTurnAppliedEvent, StopTurnAppliedPayload, StopTurnRequestedEvent, StopTurnRequestedPayload, SubscriberStatusEvent, SubscriberStatusKind, SubscriberStatusPayload, SummaryCreatedEvent, SummaryCreatedPayload, SystemMessageCommittedEvent, SystemMessageCommittedPayload, SystemPromptText, TextDeltaEvent, TextDeltaPayload, ToolCallCompletedEvent, ToolCallCompletedPayload, ToolCallCreatedEvent, ToolCallCreatedPayload, ToolCallEvent, ToolCallFailedEvent, ToolCallFailedPayload, ToolCallPromptPart, ToolCallRejectedEvent, ToolCallRejectedPayload, ToolCallRejectionFeedback, ToolCallRejectionReason, ToolCallStartedEvent, ToolCallStartedPayload, ToolFailurePromptPart, ToolName, ToolParamsDeltaEvent, ToolParamsDeltaPayload, ToolParamsEndEvent, ToolParamsEndPayload, ToolParamsStartEvent, ToolParamsStartPayload, ToolPromptPart, ToolRejectionPromptPart, ToolSuccessPromptPart, TraceStatusEvent, TraceStatusKind, TraceStatusPayload, TurnCompletedEvent, TurnCompletedPayload, TurnEvent, TurnFailedEvent, TurnFailedPayload, TurnStartedEvent, TurnStartedPayload, TurnStoppedEvent, TurnStoppedPayload, UnixEpochMillis, UsagePayload, UserMessageCancellationReason, UserMessageCancelledEvent, UserMessageCancelledPayload, UserMessageCommittedEvent, UserMessageCommittedPayload, UserMessageDisposition, UserMessagePromotedEvent, UserMessagePromotedPayload, UserMessageSubmittedEvent, UserMessageSubmittedPayload, assistantMessageCommittedEventType, assistantMessageImportedEventType, assistantPartialCommittedEventType, baseStateCreatedEventType, baseStateFailedEventType, baseStateRequestedEventType, buildEDATraceparent, commandAdmittedEventType, commandCancelledEventType, commandCompletedEventType, commandFailedEventType, commandStartedEventType, compactionCompletedEventType, compactionFailedEventType, compactionRequestedEventType, compactionStartedEventType, contextProjectedEventType, contextRebasedEventType, decodeDurableEventSync, decodeUnknownEDADurableEvent, decodeUnknownEDADurableEventSync, durableEventEnvelope, effectDurableAgentNamespace, inferenceCompletedEventType, inferenceFailedEventType, inferenceStartedEventType, interpretLegacyAttemptForReduction, makeEDAEventTrace, makeEDARunTrace, makeEDATraceContext, makeEDATraceMetadataFromParent, makeEventType, makeRootEDAEventTrace, makeRootEDATraceMetadata, messageQueuePausedEventType, parseEDATraceparent, pendingMessagesPausedEventType, reasoningDeltaEventType, recoveryCompletedEventType, runCompletedEventType, runFailedEventType, runInterruptedEventType, runSchedulingDeliveredEventType, runSchedulingGrantedEventType, runSchedulingInvalidatedEventType, runSchedulingRequestedEventType, runStartedEventType, schemaV1, sessionConfiguredEventType, steeringMessageCancelledEventType, steeringMessageQueuedEventType, stopTurnAppliedEventType, stopTurnRequestedEventType, subscriberStatusEventType, summaryCreatedEventType, systemMessageCommittedEventType, textDeltaEventType, toolCallCompletedEventType, toolCallCreatedEventType, toolCallFailedEventType, toolCallRejectedEventType, toolCallStartedEventType, toolParamsDeltaEventType, toolParamsEndEventType, toolParamsStartEventType, traceStatusEventType, turnCompletedEventType, turnFailedEventType, turnStartedEventType, turnStoppedEventType, userMessageCancelledEventType, userMessageCommittedEventType, userMessagePromotedEventType, userMessageSubmittedEventType };
2
+ import { C as schemaV1, S as maxAppEventBytes, _ as ToolName, a as EventEnvelope, b as effectDurableAgentNamespace, c as EventTypeName, d as ModelSelectionPayload, f as NonNegativeInt, g as SystemPromptText, h as SchemaVersion, i as EventDurability, l as FailurePayload, m as ProviderPartId, n as EphemeralEventEnvelope, o as EventNamespace, p as PositionedEvent, r as EventDedupeKey, s as EventType, t as DurableEventEnvelope, u as ForeignDurableEvent, v as UnixEpochMillis, x as makeEventType, y as UsagePayload } from "../envelope-CJnPfbjC.js";
3
+ import { $ as InferenceStartedPayload, $n as inferenceStartedEventType, $t as ToolCallPromptPart, A as CompactionFailedEvent, An as assistantMessageImportedEventType, Ar as userMessagePromotedEventType, At as RunStartedEvent, B as ContextRebasedPayload, Bn as compactionCompletedEventType, Bt as StopTurnRequestedEvent, C as CommandEvent, Cn as UserMessageCommittedPayload, Cr as toolCallStartedEventType, Ct as RunSchedulingEvent, D as CommandStartedPayload, Dn as UserMessageSubmittedEvent, Dr as turnStoppedEventType, Dt as RunSchedulingInvalidatedPayload, E as CommandStartedEvent, En as UserMessagePromotedPayload, Er as turnStartedEventType, Et as RunSchedulingInvalidatedEvent, F as CompactionStartedPayload, Fn as commandAdmittedEventType, Ft as SteeringMessageQueuedEvent, G as EDADurableEvent, Gn as contextRebasedEventType, Gt as SystemMessageCommittedPayload, H as DeciderAcceptedEvent, Hn as compactionRequestedEventType, Ht as SummaryCreatedEvent, I as ContextAndCompactionEvent, In as commandCancelledEventType, It as SteeringMessageQueuedPayload, J as InferenceCompletedPayload, Jn as decodeUnknownEDADurableEvent, Jt as ToolCallCreatedEvent, K as EDADurableEventV1, Kn as deciderAcceptedEventType, Kt as ToolCallCompletedEvent, L as ContextProjectedEvent, Ln as commandCompletedEventType, Lt as StopControlEvent, M as CompactionRequestedEvent, Mn as baseStateCreatedEventType, Mt as SessionConfiguredEvent, N as CompactionRequestedPayload, Nn as baseStateFailedEventType, Nt as SteeringMessageCancelledEvent, O as CompactionCompletedEvent, On as UserMessageSubmittedPayload, Or as userMessageCancelledEventType, Ot as RunSchedulingRequestedEvent, P as CompactionStartedEvent, Pn as baseStateRequestedEventType, Pt as SteeringMessageCancelledPayload, Q as InferenceStartedEvent, Qn as inferenceFailedEventType, Qt as ToolCallFailedPayload, R as ContextProjectedPayload, Rn as commandFailedEventType, Rt as StopTurnAppliedEvent, S as CommandCompletedPayload, Sn as UserMessageCommittedEvent, Sr as toolCallRejectedEventType, St as RunSchedulingDeliveredPayload, T as CommandFailedPayload, Tn as UserMessagePromotedEvent, Tr as turnFailedEventType, Tt as RunSchedulingGrantedPayload, U as DeciderAcceptedPayload, Un as compactionStartedEventType, Ut as SummaryCreatedPayload, V as CurrentEDADurableEvent, Vn as compactionFailedEventType, Vt as StopTurnRequestedPayload, W as DecodedDurableEvent, Wn as contextProjectedEventType, Wt as SystemMessageCommittedEvent, X as InferenceFailedEvent, Xn as durableEventEnvelope, Xt as ToolCallEvent, Y as InferenceEvent, Yn as decodeUnknownEDADurableEventSync, Yt as ToolCallCreatedPayload, Z as InferenceFailedPayload, Zn as inferenceCompletedEventType, Zt as ToolCallFailedEvent, _ as CommandAdmittedEvent, _n as TurnStoppedEvent, _r as summaryCreatedEventType, _t as RunFailedEvent, a as AssistantMessageImportedPayload, an as ToolCallStartedPayload, ar as runFailedEventType, at as MessageEvent, b as CommandCancelledPayload, bn as UserMessageCancelledEvent, br as toolCallCreatedEventType, bt as RunInterruptedPayload, c as AssistantPromptPart, cn as ToolRejectionPromptPart, cr as runSchedulingGrantedEventType, ct as PendingMessagesPausedEvent, d as BaseStateCreatedPayload, dn as TurnCompletedPayload, dr as runStartedEventType, dt as RecoveryCompletedPayload, en as ToolCallRejectedEvent, er as interpretLegacyAttemptForReduction, et as LegacyAssistantMessageCommittedEvent, f as BaseStateEvent, fn as TurnEvent, fr as sessionConfiguredEventType, ft as RecoveryContinuation, g as BaseStateRequestedPayload, gn as TurnStartedPayload, gr as stopTurnRequestedEventType, gt as RunEvent, h as BaseStateRequestedEvent, hn as TurnStartedEvent, hr as stopTurnAppliedEventType, ht as RunCompletedPayload, i as AssistantMessageImportedEvent, in as ToolCallStartedEvent, ir as runCompletedEventType, it as LegacyTurnAttemptStartedEvent, j as CompactionFailedPayload, jn as assistantPartialCommittedEventType, jr as userMessageSubmittedEventType, jt as RunStartedPayload, k as CompactionCompletedPayload, kn as assistantMessageCommittedEventType, kr as userMessageCommittedEventType, kt as RunSchedulingRequestedPayload, l as AssistantPromptParts, ln as ToolSuccessPromptPart, lr as runSchedulingInvalidatedEventType, lt as PendingMessagesPausedPayload, m as BaseStateFailedPayload, mn as TurnFailedPayload, mr as steeringMessageQueuedEventType, mt as RunCompletedEvent, n as AssistantMessageCommittedPayload, nn as ToolCallRejectionFeedback, nr as pendingMessagesPausedEventType, nt as LegacyToolCallCreatedEvent, o as AssistantPartialCommittedEvent, on as ToolFailurePromptPart, or as runInterruptedEventType, ot as MessageQueuePausedEvent, p as BaseStateFailedEvent, pn as TurnFailedEvent, pr as steeringMessageCancelledEventType, pt as RecoveryEvent, q as InferenceCompletedEvent, qn as decodeDurableEventSync, qt as ToolCallCompletedPayload, r as AssistantMessageContent, rn as ToolCallRejectionReason, rr as recoveryCompletedEventType, rt as LegacyTurnAttemptCompletedEvent, s as AssistantPartialCommittedPayload, sn as ToolPromptPart, sr as runSchedulingDeliveredEventType, st as MessageQueuePausedPayload, t as AssistantMessageCommittedEvent, tn as ToolCallRejectedPayload, tr as messageQueuePausedEventType, tt as LegacyAttemptEvent, u as BaseStateCreatedEvent, un as TurnCompletedEvent, ur as runSchedulingRequestedEventType, ut as RecoveryCompletedEvent, v as CommandAdmittedPayload, vn as TurnStoppedPayload, vr as systemMessageCommittedEventType, vt as RunFailedPayload, w as CommandFailedEvent, wn as UserMessageDisposition, wr as turnCompletedEventType, wt as RunSchedulingGrantedEvent, x as CommandCompletedEvent, xn as UserMessageCancelledPayload, xr as toolCallFailedEventType, xt as RunSchedulingDeliveredEvent, y as CommandCancelledEvent, yn as UserMessageCancellationReason, yr as toolCallCompletedEventType, yt as RunInterruptedEvent, z as ContextRebasedEvent, zn as commandStartedEventType, zt as StopTurnAppliedPayload } from "../durable-BXqwM70o.js";
4
+ import { C as toolParamsDeltaEventType, E as traceStatusEventType, S as textDeltaEventType, T as toolParamsStartEventType, _ as TraceStatusEvent, a as RuntimeStatusEvent, b as reasoningDeltaEventType, c as SubscriberStatusPayload, d as ToolParamsDeltaEvent, f as ToolParamsDeltaPayload, g as ToolParamsStartPayload, h as ToolParamsStartEvent, i as ReasoningDeltaPayload, l as TextDeltaEvent, m as ToolParamsEndPayload, n as ModelStreamEvent, o as SubscriberStatusEvent, p as ToolParamsEndEvent, r as ReasoningDeltaEvent, s as SubscriberStatusKind, t as EDAEphemeralEvent, u as TextDeltaPayload, v as TraceStatusKind, w as toolParamsEndEventType, x as subscriberStatusEventType, y as TraceStatusPayload } from "../events-AIIwZ6dS.js";
5
+ export { AssistantMessageCommittedEvent, AssistantMessageCommittedPayload, AssistantMessageContent, AssistantMessageImportedEvent, AssistantMessageImportedPayload, AssistantPartialCommittedEvent, AssistantPartialCommittedPayload, AssistantPromptPart, AssistantPromptParts, BaseStateCreatedEvent, BaseStateCreatedPayload, BaseStateEvent, BaseStateFailedEvent, BaseStateFailedPayload, BaseStateRequestedEvent, BaseStateRequestedPayload, CommandAdmittedEvent, CommandAdmittedPayload, CommandCancelledEvent, CommandCancelledPayload, CommandCompletedEvent, CommandCompletedPayload, CommandEvent, CommandFailedEvent, CommandFailedPayload, CommandStartedEvent, CommandStartedPayload, CompactionCompletedEvent, CompactionCompletedPayload, CompactionFailedEvent, CompactionFailedPayload, CompactionRequestedEvent, CompactionRequestedPayload, CompactionStartedEvent, CompactionStartedPayload, ContextAndCompactionEvent, ContextProjectedEvent, ContextProjectedPayload, ContextRebasedEvent, ContextRebasedPayload, CurrentEDADurableEvent, DeciderAcceptedEvent, DeciderAcceptedPayload, DecodedDurableEvent, DurableEventEnvelope, EDADurableEvent, EDADurableEventV1, EDAEphemeralEvent, EDAEventTrace, EDARunTrace, EDASpanId, EDATraceAttributeValue, EDATraceAttributes, EDATraceContext, EDATraceId, EDATraceLink, EDATraceMetadata, EphemeralEventEnvelope, EventDedupeKey, EventDurability, EventEnvelope, EventNamespace, EventType, EventTypeName, FailurePayload, ForeignDurableEvent, InferenceCompletedEvent, InferenceCompletedPayload, InferenceEvent, InferenceFailedEvent, InferenceFailedPayload, InferenceStartedEvent, InferenceStartedPayload, LegacyAssistantMessageCommittedEvent, LegacyAttemptEvent, LegacyToolCallCreatedEvent, LegacyTurnAttemptCompletedEvent, LegacyTurnAttemptStartedEvent, MessageEvent, MessageQueuePausedEvent, MessageQueuePausedPayload, ModelSelectionPayload, ModelStreamEvent, NonNegativeInt, PendingMessagesPausedEvent, PendingMessagesPausedPayload, PositionedEvent, ProviderPartId, ReasoningDeltaEvent, ReasoningDeltaPayload, RecoveryCompletedEvent, RecoveryCompletedPayload, RecoveryContinuation, RecoveryEvent, RunCompletedEvent, RunCompletedPayload, RunEvent, RunFailedEvent, RunFailedPayload, RunInterruptedEvent, RunInterruptedPayload, RunSchedulingDeliveredEvent, RunSchedulingDeliveredPayload, RunSchedulingEvent, RunSchedulingGrantedEvent, RunSchedulingGrantedPayload, RunSchedulingInvalidatedEvent, RunSchedulingInvalidatedPayload, RunSchedulingRequestedEvent, RunSchedulingRequestedPayload, RunStartedEvent, RunStartedPayload, RuntimeStatusEvent, SchemaVersion, SessionConfiguredEvent, SteeringMessageCancelledEvent, SteeringMessageCancelledPayload, SteeringMessageQueuedEvent, SteeringMessageQueuedPayload, StopControlEvent, StopTurnAppliedEvent, StopTurnAppliedPayload, StopTurnRequestedEvent, StopTurnRequestedPayload, SubscriberStatusEvent, SubscriberStatusKind, SubscriberStatusPayload, SummaryCreatedEvent, SummaryCreatedPayload, SystemMessageCommittedEvent, SystemMessageCommittedPayload, SystemPromptText, TextDeltaEvent, TextDeltaPayload, ToolCallCompletedEvent, ToolCallCompletedPayload, ToolCallCreatedEvent, ToolCallCreatedPayload, ToolCallEvent, ToolCallFailedEvent, ToolCallFailedPayload, ToolCallPromptPart, ToolCallRejectedEvent, ToolCallRejectedPayload, ToolCallRejectionFeedback, ToolCallRejectionReason, ToolCallStartedEvent, ToolCallStartedPayload, ToolFailurePromptPart, ToolName, ToolParamsDeltaEvent, ToolParamsDeltaPayload, ToolParamsEndEvent, ToolParamsEndPayload, ToolParamsStartEvent, ToolParamsStartPayload, ToolPromptPart, ToolRejectionPromptPart, ToolSuccessPromptPart, TraceStatusEvent, TraceStatusKind, TraceStatusPayload, TurnCompletedEvent, TurnCompletedPayload, TurnEvent, TurnFailedEvent, TurnFailedPayload, TurnStartedEvent, TurnStartedPayload, TurnStoppedEvent, TurnStoppedPayload, UnixEpochMillis, UsagePayload, UserMessageCancellationReason, UserMessageCancelledEvent, UserMessageCancelledPayload, UserMessageCommittedEvent, UserMessageCommittedPayload, UserMessageDisposition, UserMessagePromotedEvent, UserMessagePromotedPayload, UserMessageSubmittedEvent, UserMessageSubmittedPayload, assistantMessageCommittedEventType, assistantMessageImportedEventType, assistantPartialCommittedEventType, baseStateCreatedEventType, baseStateFailedEventType, baseStateRequestedEventType, buildEDATraceparent, commandAdmittedEventType, commandCancelledEventType, commandCompletedEventType, commandFailedEventType, commandStartedEventType, compactionCompletedEventType, compactionFailedEventType, compactionRequestedEventType, compactionStartedEventType, contextProjectedEventType, contextRebasedEventType, deciderAcceptedEventType, decodeDurableEventSync, decodeUnknownEDADurableEvent, decodeUnknownEDADurableEventSync, durableEventEnvelope, effectDurableAgentNamespace, inferenceCompletedEventType, inferenceFailedEventType, inferenceStartedEventType, interpretLegacyAttemptForReduction, makeEDAEventTrace, makeEDARunTrace, makeEDATraceContext, makeEDATraceMetadataFromParent, makeEventType, makeRootEDAEventTrace, makeRootEDATraceMetadata, maxAppEventBytes, messageQueuePausedEventType, parseEDATraceparent, pendingMessagesPausedEventType, reasoningDeltaEventType, recoveryCompletedEventType, runCompletedEventType, runFailedEventType, runInterruptedEventType, runSchedulingDeliveredEventType, runSchedulingGrantedEventType, runSchedulingInvalidatedEventType, runSchedulingRequestedEventType, runStartedEventType, schemaV1, sessionConfiguredEventType, steeringMessageCancelledEventType, steeringMessageQueuedEventType, stopTurnAppliedEventType, stopTurnRequestedEventType, subscriberStatusEventType, summaryCreatedEventType, systemMessageCommittedEventType, textDeltaEventType, toolCallCompletedEventType, toolCallCreatedEventType, toolCallFailedEventType, toolCallRejectedEventType, toolCallStartedEventType, toolParamsDeltaEventType, toolParamsEndEventType, toolParamsStartEventType, traceStatusEventType, turnCompletedEventType, turnFailedEventType, turnStartedEventType, turnStoppedEventType, userMessageCancelledEventType, userMessageCommittedEventType, userMessagePromotedEventType, userMessageSubmittedEventType };
@@ -1,7 +1,7 @@
1
1
  import { ToolCallId } from "./core.js";
2
2
  import { EDAEventTrace, EDARunTrace, EDASpanId, EDATraceAttributeValue, EDATraceAttributes, EDATraceContext, EDATraceId, EDATraceLink, EDATraceMetadata, buildEDATraceparent, makeEDAEventTrace, makeEDARunTrace, makeEDATraceContext, makeEDATraceMetadataFromParent, makeRootEDAEventTrace, makeRootEDATraceMetadata, parseEDATraceparent } from "./tracing.js";
3
- import { _ as UsagePayload, a as EventNamespace, b as schemaV1, c as ForeignDurableEvent, d as PositionedEvent, f as ProviderPartId, g as UnixEpochMillis, h as ToolName, i as EventEnvelope, l as ModelSelectionPayload, m as SystemPromptText, n as EphemeralEventEnvelope, o as EventType, p as SchemaVersion, r as EventDurability, s as FailurePayload, t as DurableEventEnvelope, u as NonNegativeInt, v as effectDurableAgentNamespace, y as makeEventType } from "../envelope-BCzKUq_z.js";
4
- import { $ as LegacyAttemptEvent, $n as pendingMessagesPausedEventType, $t as ToolCallRejectedPayload, A as CompactionFailedEvent, An as baseStateCreatedEventType, Ar as ephemeralEventSchema, At as SessionConfiguredEvent, B as ContextRebasedPayload, Bn as compactionRequestedEventType, Bt as SummaryCreatedEvent, C as CommandEvent, Cn as UserMessagePromotedEvent, Cr as turnStartedEventType, Ct as RunSchedulingGrantedPayload, D as CommandStartedPayload, Dn as assistantMessageCommittedEventType, Dr as userMessagePromotedEventType, Dt as RunSchedulingRequestedPayload, E as CommandStartedEvent, En as UserMessageSubmittedPayload, Er as userMessageCommittedEventType, Et as RunSchedulingRequestedEvent, F as CompactionStartedPayload, Fn as commandCompletedEventType, Ft as StopControlEvent, G as InferenceCompletedEvent, Gn as decodeUnknownEDADurableEvent, Gt as ToolCallCompletedPayload, H as DecodedDurableEvent, Hn as contextProjectedEventType, Ht as SystemMessageCommittedEvent, I as ContextAndCompactionEvent, In as commandFailedEventType, It as StopTurnAppliedEvent, J as InferenceFailedEvent, Jn as inferenceCompletedEventType, Jt as ToolCallEvent, K as InferenceCompletedPayload, Kn as decodeUnknownEDADurableEventSync, Kt as ToolCallCreatedEvent, L as ContextProjectedEvent, Ln as commandStartedEventType, Lt as StopTurnAppliedPayload, M as CompactionRequestedEvent, Mn as baseStateRequestedEventType, Mt as SteeringMessageCancelledPayload, N as CompactionRequestedPayload, Nn as commandAdmittedEventType, Nt as SteeringMessageQueuedEvent, O as CompactionCompletedEvent, On as assistantMessageImportedEventType, Or as userMessageSubmittedEventType, Ot as RunStartedEvent, P as CompactionStartedEvent, Pn as commandCancelledEventType, Pt as SteeringMessageQueuedPayload, Q as LegacyAssistantMessageCommittedEvent, Qn as messageQueuePausedEventType, Qt as ToolCallRejectedEvent, R as ContextProjectedPayload, Rn as compactionCompletedEventType, Rt as StopTurnRequestedEvent, S as CommandCompletedPayload, Sn as UserMessageDisposition, Sr as turnFailedEventType, St as RunSchedulingGrantedEvent, T as CommandFailedPayload, Tn as UserMessageSubmittedEvent, Tr as userMessageCancelledEventType, Tt as RunSchedulingInvalidatedPayload, U as EDADurableEvent, Un as contextRebasedEventType, Ut as SystemMessageCommittedPayload, V as CurrentEDADurableEvent, Vn as compactionStartedEventType, Vt as SummaryCreatedPayload, W as EDADurableEventV1, Wn as decodeDurableEventSync, Wt as ToolCallCompletedEvent, X as InferenceStartedEvent, Xn as inferenceStartedEventType, Xt as ToolCallFailedPayload, Y as InferenceFailedPayload, Yn as inferenceFailedEventType, Yt as ToolCallFailedEvent, Z as InferenceStartedPayload, Zn as interpretLegacyAttemptForReduction, Zt as ToolCallPromptPart, _ as CommandAdmittedEvent, _n as UserMessageCancellationReason, _r as toolCallCreatedEventType, _t as RunInterruptedEvent, a as AssistantMessageImportedPayload, an as ToolPromptPart, ar as runSchedulingGrantedEventType, at as MessageQueuePausedPayload, b as CommandCancelledPayload, bn as UserMessageCommittedEvent, br as toolCallStartedEventType, bt as RunSchedulingDeliveredPayload, c as AssistantPromptPart, cn as TurnCompletedEvent, cr as runStartedEventType, ct as RecoveryCompletedEvent, d as BaseStateCreatedPayload, dn as TurnFailedEvent, dr as steeringMessageQueuedEventType, dt as RecoveryEvent, en as ToolCallRejectionFeedback, er as recoveryCompletedEventType, et as LegacyToolCallCreatedEvent, f as BaseStateEvent, fn as TurnFailedPayload, fr as stopTurnAppliedEventType, ft as RunCompletedEvent, g as BaseStateRequestedPayload, gn as TurnStoppedPayload, gr as toolCallCompletedEventType, gt as RunFailedPayload, h as BaseStateRequestedEvent, hn as TurnStoppedEvent, hr as systemMessageCommittedEventType, ht as RunFailedEvent, i as AssistantMessageImportedEvent, in as ToolFailurePromptPart, ir as runSchedulingDeliveredEventType, it as MessageQueuePausedEvent, j as CompactionFailedPayload, jn as baseStateFailedEventType, jt as SteeringMessageCancelledEvent, k as CompactionCompletedPayload, kn as assistantPartialCommittedEventType, kt as RunStartedPayload, l as AssistantPromptParts, ln as TurnCompletedPayload, lr as sessionConfiguredEventType, lt as RecoveryCompletedPayload, m as BaseStateFailedPayload, mn as TurnStartedPayload, mr as summaryCreatedEventType, mt as RunEvent, n as AssistantMessageCommittedPayload, nn as ToolCallStartedEvent, nr as runFailedEventType, nt as LegacyTurnAttemptStartedEvent, o as AssistantPartialCommittedEvent, on as ToolRejectionPromptPart, or as runSchedulingInvalidatedEventType, ot as PendingMessagesPausedEvent, p as BaseStateFailedEvent, pn as TurnStartedEvent, pr as stopTurnRequestedEventType, pt as RunCompletedPayload, q as InferenceEvent, qn as durableEventEnvelope, qt as ToolCallCreatedPayload, r as AssistantMessageContent, rn as ToolCallStartedPayload, rr as runInterruptedEventType, rt as MessageEvent, s as AssistantPartialCommittedPayload, sn as ToolSuccessPromptPart, sr as runSchedulingRequestedEventType, st as PendingMessagesPausedPayload, t as AssistantMessageCommittedEvent, tn as ToolCallRejectionReason, tr as runCompletedEventType, tt as LegacyTurnAttemptCompletedEvent, u as BaseStateCreatedEvent, un as TurnEvent, ur as steeringMessageCancelledEventType, ut as RecoveryContinuation, v as CommandAdmittedPayload, vn as UserMessageCancelledEvent, vr as toolCallFailedEventType, vt as RunInterruptedPayload, w as CommandFailedEvent, wn as UserMessagePromotedPayload, wr as turnStoppedEventType, wt as RunSchedulingInvalidatedEvent, x as CommandCompletedEvent, xn as UserMessageCommittedPayload, xr as turnCompletedEventType, xt as RunSchedulingEvent, y as CommandCancelledEvent, yn as UserMessageCancelledPayload, yr as toolCallRejectedEventType, yt as RunSchedulingDeliveredEvent, z as ContextRebasedEvent, zn as compactionFailedEventType, zt as StopTurnRequestedPayload } from "../durable-D13w1Qr3.js";
3
+ import { S as schemaV1, _ as UnixEpochMillis, a as EventEnvelope, b as makeEventType, c as FailurePayload, d as NonNegativeInt, f as PositionedEvent, g as ToolName, h as SystemPromptText, i as EventDurability, l as ForeignDurableEvent, m as SchemaVersion, n as EphemeralEventEnvelope, o as EventNamespace, p as ProviderPartId, r as EventDedupeKey, s as EventType, t as DurableEventEnvelope, u as ModelSelectionPayload, v as UsagePayload, x as maxAppEventBytes, y as effectDurableAgentNamespace } from "../envelope-BSI_Xh-f.js";
4
+ import { $ as InferenceStartedPayload, $n as inferenceStartedEventType, $t as ToolCallPromptPart, A as CompactionFailedEvent, An as assistantMessageImportedEventType, Ar as userMessagePromotedEventType, At as RunStartedEvent, B as ContextRebasedPayload, Bn as compactionCompletedEventType, Bt as StopTurnRequestedEvent, C as CommandEvent, Cn as UserMessageCommittedPayload, Cr as toolCallStartedEventType, Ct as RunSchedulingEvent, D as CommandStartedPayload, Dn as UserMessageSubmittedEvent, Dr as turnStoppedEventType, Dt as RunSchedulingInvalidatedPayload, E as CommandStartedEvent, En as UserMessagePromotedPayload, Er as turnStartedEventType, Et as RunSchedulingInvalidatedEvent, F as CompactionStartedPayload, Fn as commandAdmittedEventType, Ft as SteeringMessageQueuedEvent, G as EDADurableEvent, Gn as contextRebasedEventType, Gt as SystemMessageCommittedPayload, H as DeciderAcceptedEvent, Hn as compactionRequestedEventType, Ht as SummaryCreatedEvent, I as ContextAndCompactionEvent, In as commandCancelledEventType, It as SteeringMessageQueuedPayload, J as InferenceCompletedPayload, Jn as decodeUnknownEDADurableEvent, Jt as ToolCallCreatedEvent, K as EDADurableEventV1, Kn as deciderAcceptedEventType, Kt as ToolCallCompletedEvent, L as ContextProjectedEvent, Ln as commandCompletedEventType, Lt as StopControlEvent, M as CompactionRequestedEvent, Mn as baseStateCreatedEventType, Mt as SessionConfiguredEvent, N as CompactionRequestedPayload, Nn as baseStateFailedEventType, Nr as ephemeralEventSchema, Nt as SteeringMessageCancelledEvent, O as CompactionCompletedEvent, On as UserMessageSubmittedPayload, Or as userMessageCancelledEventType, Ot as RunSchedulingRequestedEvent, P as CompactionStartedEvent, Pn as baseStateRequestedEventType, Pt as SteeringMessageCancelledPayload, Q as InferenceStartedEvent, Qn as inferenceFailedEventType, Qt as ToolCallFailedPayload, R as ContextProjectedPayload, Rn as commandFailedEventType, Rt as StopTurnAppliedEvent, S as CommandCompletedPayload, Sn as UserMessageCommittedEvent, Sr as toolCallRejectedEventType, St as RunSchedulingDeliveredPayload, T as CommandFailedPayload, Tn as UserMessagePromotedEvent, Tr as turnFailedEventType, Tt as RunSchedulingGrantedPayload, U as DeciderAcceptedPayload, Un as compactionStartedEventType, Ut as SummaryCreatedPayload, V as CurrentEDADurableEvent, Vn as compactionFailedEventType, Vt as StopTurnRequestedPayload, W as DecodedDurableEvent, Wn as contextProjectedEventType, Wt as SystemMessageCommittedEvent, X as InferenceFailedEvent, Xn as durableEventEnvelope, Xt as ToolCallEvent, Y as InferenceEvent, Yn as decodeUnknownEDADurableEventSync, Yt as ToolCallCreatedPayload, Z as InferenceFailedPayload, Zn as inferenceCompletedEventType, Zt as ToolCallFailedEvent, _ as CommandAdmittedEvent, _n as TurnStoppedEvent, _r as summaryCreatedEventType, _t as RunFailedEvent, a as AssistantMessageImportedPayload, an as ToolCallStartedPayload, ar as runFailedEventType, at as MessageEvent, b as CommandCancelledPayload, bn as UserMessageCancelledEvent, br as toolCallCreatedEventType, bt as RunInterruptedPayload, c as AssistantPromptPart, cn as ToolRejectionPromptPart, cr as runSchedulingGrantedEventType, ct as PendingMessagesPausedEvent, d as BaseStateCreatedPayload, dn as TurnCompletedPayload, dr as runStartedEventType, dt as RecoveryCompletedPayload, en as ToolCallRejectedEvent, er as interpretLegacyAttemptForReduction, et as LegacyAssistantMessageCommittedEvent, f as BaseStateEvent, fn as TurnEvent, fr as sessionConfiguredEventType, ft as RecoveryContinuation, g as BaseStateRequestedPayload, gn as TurnStartedPayload, gr as stopTurnRequestedEventType, gt as RunEvent, h as BaseStateRequestedEvent, hn as TurnStartedEvent, hr as stopTurnAppliedEventType, ht as RunCompletedPayload, i as AssistantMessageImportedEvent, in as ToolCallStartedEvent, ir as runCompletedEventType, it as LegacyTurnAttemptStartedEvent, j as CompactionFailedPayload, jn as assistantPartialCommittedEventType, jr as userMessageSubmittedEventType, jt as RunStartedPayload, k as CompactionCompletedPayload, kn as assistantMessageCommittedEventType, kr as userMessageCommittedEventType, kt as RunSchedulingRequestedPayload, l as AssistantPromptParts, ln as ToolSuccessPromptPart, lr as runSchedulingInvalidatedEventType, lt as PendingMessagesPausedPayload, m as BaseStateFailedPayload, mn as TurnFailedPayload, mr as steeringMessageQueuedEventType, mt as RunCompletedEvent, n as AssistantMessageCommittedPayload, nn as ToolCallRejectionFeedback, nr as pendingMessagesPausedEventType, nt as LegacyToolCallCreatedEvent, o as AssistantPartialCommittedEvent, on as ToolFailurePromptPart, or as runInterruptedEventType, ot as MessageQueuePausedEvent, p as BaseStateFailedEvent, pn as TurnFailedEvent, pr as steeringMessageCancelledEventType, pt as RecoveryEvent, q as InferenceCompletedEvent, qn as decodeDurableEventSync, qt as ToolCallCompletedPayload, r as AssistantMessageContent, rn as ToolCallRejectionReason, rr as recoveryCompletedEventType, rt as LegacyTurnAttemptCompletedEvent, s as AssistantPartialCommittedPayload, sn as ToolPromptPart, sr as runSchedulingDeliveredEventType, st as MessageQueuePausedPayload, t as AssistantMessageCommittedEvent, tn as ToolCallRejectedPayload, tr as messageQueuePausedEventType, tt as LegacyAttemptEvent, u as BaseStateCreatedEvent, un as TurnCompletedEvent, ur as runSchedulingRequestedEventType, ut as RecoveryCompletedEvent, v as CommandAdmittedPayload, vn as TurnStoppedPayload, vr as systemMessageCommittedEventType, vt as RunFailedPayload, w as CommandFailedEvent, wn as UserMessageDisposition, wr as turnCompletedEventType, wt as RunSchedulingGrantedEvent, x as CommandCompletedEvent, xn as UserMessageCancelledPayload, xr as toolCallFailedEventType, xt as RunSchedulingDeliveredEvent, y as CommandCancelledEvent, yn as UserMessageCancellationReason, yr as toolCallCompletedEventType, yt as RunInterruptedEvent, z as ContextRebasedEvent, zn as commandStartedEventType, zt as StopTurnAppliedPayload } from "../durable-Da57Rcml.js";
5
5
  import * as Schema from "effect/Schema";
6
6
  //#region src/types/events/ephemeral.ts
7
7
  /** Event type values for ephemeral model stream events. */
@@ -86,6 +86,6 @@ const RuntimeStatusEvent = Schema.Union([SubscriberStatusEvent, TraceStatusEvent
86
86
  /** Built-in ephemeral event union for framework-owned live-only updates. */
87
87
  const EDAEphemeralEvent = Schema.Union([ModelStreamEvent, RuntimeStatusEvent]);
88
88
  //#endregion
89
- export { AssistantMessageCommittedEvent, AssistantMessageCommittedPayload, AssistantMessageContent, AssistantMessageImportedEvent, AssistantMessageImportedPayload, AssistantPartialCommittedEvent, AssistantPartialCommittedPayload, AssistantPromptPart, AssistantPromptParts, BaseStateCreatedEvent, BaseStateCreatedPayload, BaseStateEvent, BaseStateFailedEvent, BaseStateFailedPayload, BaseStateRequestedEvent, BaseStateRequestedPayload, CommandAdmittedEvent, CommandAdmittedPayload, CommandCancelledEvent, CommandCancelledPayload, CommandCompletedEvent, CommandCompletedPayload, CommandEvent, CommandFailedEvent, CommandFailedPayload, CommandStartedEvent, CommandStartedPayload, CompactionCompletedEvent, CompactionCompletedPayload, CompactionFailedEvent, CompactionFailedPayload, CompactionRequestedEvent, CompactionRequestedPayload, CompactionStartedEvent, CompactionStartedPayload, ContextAndCompactionEvent, ContextProjectedEvent, ContextProjectedPayload, ContextRebasedEvent, ContextRebasedPayload, CurrentEDADurableEvent, DecodedDurableEvent, DurableEventEnvelope, EDADurableEvent, EDADurableEventV1, EDAEphemeralEvent, EDAEventTrace, EDARunTrace, EDASpanId, EDATraceAttributeValue, EDATraceAttributes, EDATraceContext, EDATraceId, EDATraceLink, EDATraceMetadata, EphemeralEventEnvelope, EventDurability, EventEnvelope, EventNamespace, EventType, FailurePayload, ForeignDurableEvent, InferenceCompletedEvent, InferenceCompletedPayload, InferenceEvent, InferenceFailedEvent, InferenceFailedPayload, InferenceStartedEvent, InferenceStartedPayload, LegacyAssistantMessageCommittedEvent, LegacyAttemptEvent, LegacyToolCallCreatedEvent, LegacyTurnAttemptCompletedEvent, LegacyTurnAttemptStartedEvent, MessageEvent, MessageQueuePausedEvent, MessageQueuePausedPayload, ModelSelectionPayload, ModelStreamEvent, NonNegativeInt, PendingMessagesPausedEvent, PendingMessagesPausedPayload, PositionedEvent, ProviderPartId, ReasoningDeltaEvent, ReasoningDeltaPayload, RecoveryCompletedEvent, RecoveryCompletedPayload, RecoveryContinuation, RecoveryEvent, RunCompletedEvent, RunCompletedPayload, RunEvent, RunFailedEvent, RunFailedPayload, RunInterruptedEvent, RunInterruptedPayload, RunSchedulingDeliveredEvent, RunSchedulingDeliveredPayload, RunSchedulingEvent, RunSchedulingGrantedEvent, RunSchedulingGrantedPayload, RunSchedulingInvalidatedEvent, RunSchedulingInvalidatedPayload, RunSchedulingRequestedEvent, RunSchedulingRequestedPayload, RunStartedEvent, RunStartedPayload, RuntimeStatusEvent, SchemaVersion, SessionConfiguredEvent, SteeringMessageCancelledEvent, SteeringMessageCancelledPayload, SteeringMessageQueuedEvent, SteeringMessageQueuedPayload, StopControlEvent, StopTurnAppliedEvent, StopTurnAppliedPayload, StopTurnRequestedEvent, StopTurnRequestedPayload, SubscriberStatusEvent, SubscriberStatusKind, SubscriberStatusPayload, SummaryCreatedEvent, SummaryCreatedPayload, SystemMessageCommittedEvent, SystemMessageCommittedPayload, SystemPromptText, TextDeltaEvent, TextDeltaPayload, ToolCallCompletedEvent, ToolCallCompletedPayload, ToolCallCreatedEvent, ToolCallCreatedPayload, ToolCallEvent, ToolCallFailedEvent, ToolCallFailedPayload, ToolCallPromptPart, ToolCallRejectedEvent, ToolCallRejectedPayload, ToolCallRejectionFeedback, ToolCallRejectionReason, ToolCallStartedEvent, ToolCallStartedPayload, ToolFailurePromptPart, ToolName, ToolParamsDeltaEvent, ToolParamsDeltaPayload, ToolParamsEndEvent, ToolParamsEndPayload, ToolParamsStartEvent, ToolParamsStartPayload, ToolPromptPart, ToolRejectionPromptPart, ToolSuccessPromptPart, TraceStatusEvent, TraceStatusKind, TraceStatusPayload, TurnCompletedEvent, TurnCompletedPayload, TurnEvent, TurnFailedEvent, TurnFailedPayload, TurnStartedEvent, TurnStartedPayload, TurnStoppedEvent, TurnStoppedPayload, UnixEpochMillis, UsagePayload, UserMessageCancellationReason, UserMessageCancelledEvent, UserMessageCancelledPayload, UserMessageCommittedEvent, UserMessageCommittedPayload, UserMessageDisposition, UserMessagePromotedEvent, UserMessagePromotedPayload, UserMessageSubmittedEvent, UserMessageSubmittedPayload, assistantMessageCommittedEventType, assistantMessageImportedEventType, assistantPartialCommittedEventType, baseStateCreatedEventType, baseStateFailedEventType, baseStateRequestedEventType, buildEDATraceparent, commandAdmittedEventType, commandCancelledEventType, commandCompletedEventType, commandFailedEventType, commandStartedEventType, compactionCompletedEventType, compactionFailedEventType, compactionRequestedEventType, compactionStartedEventType, contextProjectedEventType, contextRebasedEventType, decodeDurableEventSync, decodeUnknownEDADurableEvent, decodeUnknownEDADurableEventSync, durableEventEnvelope, effectDurableAgentNamespace, inferenceCompletedEventType, inferenceFailedEventType, inferenceStartedEventType, interpretLegacyAttemptForReduction, makeEDAEventTrace, makeEDARunTrace, makeEDATraceContext, makeEDATraceMetadataFromParent, makeEventType, makeRootEDAEventTrace, makeRootEDATraceMetadata, messageQueuePausedEventType, parseEDATraceparent, pendingMessagesPausedEventType, reasoningDeltaEventType, recoveryCompletedEventType, runCompletedEventType, runFailedEventType, runInterruptedEventType, runSchedulingDeliveredEventType, runSchedulingGrantedEventType, runSchedulingInvalidatedEventType, runSchedulingRequestedEventType, runStartedEventType, schemaV1, sessionConfiguredEventType, steeringMessageCancelledEventType, steeringMessageQueuedEventType, stopTurnAppliedEventType, stopTurnRequestedEventType, subscriberStatusEventType, summaryCreatedEventType, systemMessageCommittedEventType, textDeltaEventType, toolCallCompletedEventType, toolCallCreatedEventType, toolCallFailedEventType, toolCallRejectedEventType, toolCallStartedEventType, toolParamsDeltaEventType, toolParamsEndEventType, toolParamsStartEventType, traceStatusEventType, turnCompletedEventType, turnFailedEventType, turnStartedEventType, turnStoppedEventType, userMessageCancelledEventType, userMessageCommittedEventType, userMessagePromotedEventType, userMessageSubmittedEventType };
89
+ export { AssistantMessageCommittedEvent, AssistantMessageCommittedPayload, AssistantMessageContent, AssistantMessageImportedEvent, AssistantMessageImportedPayload, AssistantPartialCommittedEvent, AssistantPartialCommittedPayload, AssistantPromptPart, AssistantPromptParts, BaseStateCreatedEvent, BaseStateCreatedPayload, BaseStateEvent, BaseStateFailedEvent, BaseStateFailedPayload, BaseStateRequestedEvent, BaseStateRequestedPayload, CommandAdmittedEvent, CommandAdmittedPayload, CommandCancelledEvent, CommandCancelledPayload, CommandCompletedEvent, CommandCompletedPayload, CommandEvent, CommandFailedEvent, CommandFailedPayload, CommandStartedEvent, CommandStartedPayload, CompactionCompletedEvent, CompactionCompletedPayload, CompactionFailedEvent, CompactionFailedPayload, CompactionRequestedEvent, CompactionRequestedPayload, CompactionStartedEvent, CompactionStartedPayload, ContextAndCompactionEvent, ContextProjectedEvent, ContextProjectedPayload, ContextRebasedEvent, ContextRebasedPayload, CurrentEDADurableEvent, DeciderAcceptedEvent, DeciderAcceptedPayload, DecodedDurableEvent, DurableEventEnvelope, EDADurableEvent, EDADurableEventV1, EDAEphemeralEvent, EDAEventTrace, EDARunTrace, EDASpanId, EDATraceAttributeValue, EDATraceAttributes, EDATraceContext, EDATraceId, EDATraceLink, EDATraceMetadata, EphemeralEventEnvelope, EventDedupeKey, EventDurability, EventEnvelope, EventNamespace, EventType, FailurePayload, ForeignDurableEvent, InferenceCompletedEvent, InferenceCompletedPayload, InferenceEvent, InferenceFailedEvent, InferenceFailedPayload, InferenceStartedEvent, InferenceStartedPayload, LegacyAssistantMessageCommittedEvent, LegacyAttemptEvent, LegacyToolCallCreatedEvent, LegacyTurnAttemptCompletedEvent, LegacyTurnAttemptStartedEvent, MessageEvent, MessageQueuePausedEvent, MessageQueuePausedPayload, ModelSelectionPayload, ModelStreamEvent, NonNegativeInt, PendingMessagesPausedEvent, PendingMessagesPausedPayload, PositionedEvent, ProviderPartId, ReasoningDeltaEvent, ReasoningDeltaPayload, RecoveryCompletedEvent, RecoveryCompletedPayload, RecoveryContinuation, RecoveryEvent, RunCompletedEvent, RunCompletedPayload, RunEvent, RunFailedEvent, RunFailedPayload, RunInterruptedEvent, RunInterruptedPayload, RunSchedulingDeliveredEvent, RunSchedulingDeliveredPayload, RunSchedulingEvent, RunSchedulingGrantedEvent, RunSchedulingGrantedPayload, RunSchedulingInvalidatedEvent, RunSchedulingInvalidatedPayload, RunSchedulingRequestedEvent, RunSchedulingRequestedPayload, RunStartedEvent, RunStartedPayload, RuntimeStatusEvent, SchemaVersion, SessionConfiguredEvent, SteeringMessageCancelledEvent, SteeringMessageCancelledPayload, SteeringMessageQueuedEvent, SteeringMessageQueuedPayload, StopControlEvent, StopTurnAppliedEvent, StopTurnAppliedPayload, StopTurnRequestedEvent, StopTurnRequestedPayload, SubscriberStatusEvent, SubscriberStatusKind, SubscriberStatusPayload, SummaryCreatedEvent, SummaryCreatedPayload, SystemMessageCommittedEvent, SystemMessageCommittedPayload, SystemPromptText, TextDeltaEvent, TextDeltaPayload, ToolCallCompletedEvent, ToolCallCompletedPayload, ToolCallCreatedEvent, ToolCallCreatedPayload, ToolCallEvent, ToolCallFailedEvent, ToolCallFailedPayload, ToolCallPromptPart, ToolCallRejectedEvent, ToolCallRejectedPayload, ToolCallRejectionFeedback, ToolCallRejectionReason, ToolCallStartedEvent, ToolCallStartedPayload, ToolFailurePromptPart, ToolName, ToolParamsDeltaEvent, ToolParamsDeltaPayload, ToolParamsEndEvent, ToolParamsEndPayload, ToolParamsStartEvent, ToolParamsStartPayload, ToolPromptPart, ToolRejectionPromptPart, ToolSuccessPromptPart, TraceStatusEvent, TraceStatusKind, TraceStatusPayload, TurnCompletedEvent, TurnCompletedPayload, TurnEvent, TurnFailedEvent, TurnFailedPayload, TurnStartedEvent, TurnStartedPayload, TurnStoppedEvent, TurnStoppedPayload, UnixEpochMillis, UsagePayload, UserMessageCancellationReason, UserMessageCancelledEvent, UserMessageCancelledPayload, UserMessageCommittedEvent, UserMessageCommittedPayload, UserMessageDisposition, UserMessagePromotedEvent, UserMessagePromotedPayload, UserMessageSubmittedEvent, UserMessageSubmittedPayload, assistantMessageCommittedEventType, assistantMessageImportedEventType, assistantPartialCommittedEventType, baseStateCreatedEventType, baseStateFailedEventType, baseStateRequestedEventType, buildEDATraceparent, commandAdmittedEventType, commandCancelledEventType, commandCompletedEventType, commandFailedEventType, commandStartedEventType, compactionCompletedEventType, compactionFailedEventType, compactionRequestedEventType, compactionStartedEventType, contextProjectedEventType, contextRebasedEventType, deciderAcceptedEventType, decodeDurableEventSync, decodeUnknownEDADurableEvent, decodeUnknownEDADurableEventSync, durableEventEnvelope, effectDurableAgentNamespace, inferenceCompletedEventType, inferenceFailedEventType, inferenceStartedEventType, interpretLegacyAttemptForReduction, makeEDAEventTrace, makeEDARunTrace, makeEDATraceContext, makeEDATraceMetadataFromParent, makeEventType, makeRootEDAEventTrace, makeRootEDATraceMetadata, maxAppEventBytes, messageQueuePausedEventType, parseEDATraceparent, pendingMessagesPausedEventType, reasoningDeltaEventType, recoveryCompletedEventType, runCompletedEventType, runFailedEventType, runInterruptedEventType, runSchedulingDeliveredEventType, runSchedulingGrantedEventType, runSchedulingInvalidatedEventType, runSchedulingRequestedEventType, runStartedEventType, schemaV1, sessionConfiguredEventType, steeringMessageCancelledEventType, steeringMessageQueuedEventType, stopTurnAppliedEventType, stopTurnRequestedEventType, subscriberStatusEventType, summaryCreatedEventType, systemMessageCommittedEventType, textDeltaEventType, toolCallCompletedEventType, toolCallCreatedEventType, toolCallFailedEventType, toolCallRejectedEventType, toolCallStartedEventType, toolParamsDeltaEventType, toolParamsEndEventType, toolParamsStartEventType, traceStatusEventType, turnCompletedEventType, turnFailedEventType, turnStartedEventType, turnStoppedEventType, userMessageCancelledEventType, userMessageCommittedEventType, userMessagePromotedEventType, userMessageSubmittedEventType };
90
90
 
91
91
  //# sourceMappingURL=events.js.map
@@ -1,2 +1,2 @@
1
- import { $ as EDAWebSocketWireProtocol, A as EDA_WS_CLOSE_LAGGED, B as EDAFrameworkWebSocketEvent, C as EDAWebSocketHelloFrame, D as EDAWebSocketServerFrame, E as EDAWebSocketPongFrame, F as SubscriberId, G as EDAWebSocketWireClientFrame, H as EDAWebSocketServerFrameEncoder, I as decodeEDAWebSocketClientMessage, J as EDAWebSocketWireHeartbeatFrame, K as EDAWebSocketWireErrorFrame, L as defaultEDAWebSocketFlowControl, M as EDA_WS_CLOSE_SEND_FAILED, N as EDA_WS_CLOSE_UNSUPPORTED_DATA, O as EDA_WEB_SOCKET_PROTOCOL_VERSION, P as FrameId, Q as EDAWebSocketWirePongFrame, R as encodeEDAWebSocketServerFrame, S as EDAWebSocketHeartbeatFrame, T as EDAWebSocketPingFrame, U as EDAWebSocketServerFrameInput, V as EDAWebSocketEventConsumerPolicy, W as EDAWebSocketWireAckFrame, X as EDAWebSocketWireLaggedFrame, Y as EDAWebSocketWireHelloFrame, Z as EDAWebSocketWirePingFrame, _ as EDAWebSocketAckFrame, a as EDAWebSocketInFlightFrame, b as EDAWebSocketEventsFrame, c as SubscriberLagReason, d as makeWebSocketDeliveryState, et as EDA_WEB_SOCKET_PING_MESSAGE, f as onClientAck, g as restoreWebSocketDeliveryState, h as onHostSuppressedFrame, i as EDAWebSocketDeliveryState, it as makeEDAWebSocketWireProtocol, j as EDA_WS_CLOSE_PROTOCOL_ERROR, k as EDA_WS_CLOSE_GOING_AWAY, l as checkpointWebSocketDeliveryState, m as onEphemeralEvent, n as EDAWebSocketDeliveryCheckpoint, nt as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, o as EDAWebSocketSuppressedRange, p as onDurableEvents, q as EDAWebSocketWireFlowControl, r as EDAWebSocketDeliveryResult, rt as edaFrameworkWebSocketWireProtocol, s as MakeDeliveryStateInput, t as EDAWebSocketDeliveryAction, tt as EDA_WEB_SOCKET_PONG_MESSAGE, u as deliveryHelloFrame, v as EDAWebSocketClientFrame, w as EDAWebSocketLaggedFrame, x as EDAWebSocketFlowControl, y as EDAWebSocketErrorFrame, z as laggedCloseReason } from "../delivery-D3MxW4wg.js";
1
+ import { $ as EDAWebSocketWireProtocol, A as EDA_WS_CLOSE_LAGGED, B as EDAFrameworkWebSocketEvent, C as EDAWebSocketHelloFrame, D as EDAWebSocketServerFrame, E as EDAWebSocketPongFrame, F as SubscriberId, G as EDAWebSocketWireClientFrame, H as EDAWebSocketServerFrameEncoder, I as decodeEDAWebSocketClientMessage, J as EDAWebSocketWireHeartbeatFrame, K as EDAWebSocketWireErrorFrame, L as defaultEDAWebSocketFlowControl, M as EDA_WS_CLOSE_SEND_FAILED, N as EDA_WS_CLOSE_UNSUPPORTED_DATA, O as EDA_WEB_SOCKET_PROTOCOL_VERSION, P as FrameId, Q as EDAWebSocketWirePongFrame, R as encodeEDAWebSocketServerFrame, S as EDAWebSocketHeartbeatFrame, T as EDAWebSocketPingFrame, U as EDAWebSocketServerFrameInput, V as EDAWebSocketEventConsumerPolicy, W as EDAWebSocketWireAckFrame, X as EDAWebSocketWireLaggedFrame, Y as EDAWebSocketWireHelloFrame, Z as EDAWebSocketWirePingFrame, _ as EDAWebSocketAckFrame, a as EDAWebSocketInFlightFrame, b as EDAWebSocketEventsFrame, c as SubscriberLagReason, d as makeWebSocketDeliveryState, et as EDA_WEB_SOCKET_PING_MESSAGE, f as onClientAck, g as restoreWebSocketDeliveryState, h as onHostSuppressedFrame, i as EDAWebSocketDeliveryState, it as makeEDAWebSocketWireProtocol, j as EDA_WS_CLOSE_PROTOCOL_ERROR, k as EDA_WS_CLOSE_GOING_AWAY, l as checkpointWebSocketDeliveryState, m as onEphemeralEvent, n as EDAWebSocketDeliveryCheckpoint, nt as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, o as EDAWebSocketSuppressedRange, p as onDurableEvents, q as EDAWebSocketWireFlowControl, r as EDAWebSocketDeliveryResult, rt as edaFrameworkWebSocketWireProtocol, s as MakeDeliveryStateInput, t as EDAWebSocketDeliveryAction, tt as EDA_WEB_SOCKET_PONG_MESSAGE, u as deliveryHelloFrame, v as EDAWebSocketClientFrame, w as EDAWebSocketLaggedFrame, x as EDAWebSocketFlowControl, y as EDAWebSocketErrorFrame, z as laggedCloseReason } from "../delivery-B_LDTuIB.js";
2
2
  export { EDAFrameworkWebSocketEvent, EDAWebSocketAckFrame, EDAWebSocketClientFrame, EDAWebSocketDeliveryAction, EDAWebSocketDeliveryCheckpoint, EDAWebSocketDeliveryResult, EDAWebSocketDeliveryState, EDAWebSocketErrorFrame, EDAWebSocketEventConsumerPolicy, EDAWebSocketEventsFrame, EDAWebSocketFlowControl, EDAWebSocketHeartbeatFrame, EDAWebSocketHelloFrame, EDAWebSocketInFlightFrame, EDAWebSocketLaggedFrame, EDAWebSocketPingFrame, EDAWebSocketPongFrame, EDAWebSocketServerFrame, EDAWebSocketServerFrameEncoder, EDAWebSocketServerFrameInput, EDAWebSocketSuppressedRange, EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, EDAWebSocketWirePingFrame, EDAWebSocketWirePongFrame, EDAWebSocketWireProtocol, EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE, EDA_WEB_SOCKET_PROTOCOL_VERSION, EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, EDA_WS_CLOSE_GOING_AWAY, EDA_WS_CLOSE_LAGGED, EDA_WS_CLOSE_PROTOCOL_ERROR, EDA_WS_CLOSE_SEND_FAILED, EDA_WS_CLOSE_UNSUPPORTED_DATA, FrameId, MakeDeliveryStateInput, SubscriberId, SubscriberLagReason, checkpointWebSocketDeliveryState, decodeEDAWebSocketClientMessage, defaultEDAWebSocketFlowControl, deliveryHelloFrame, edaFrameworkWebSocketWireProtocol, encodeEDAWebSocketServerFrame, laggedCloseReason, makeEDAWebSocketWireProtocol, makeWebSocketDeliveryState, onClientAck, onDurableEvents, onEphemeralEvent, onHostSuppressedFrame, restoreWebSocketDeliveryState };
@@ -1,2 +1,2 @@
1
- import { A as FrameId, B as EDAWebSocketWireFlowControl, C as EDAWebSocketServerFrame, D as EDA_WS_CLOSE_PROTOCOL_ERROR, E as EDA_WS_CLOSE_LAGGED, F as laggedCloseReason, G as EDAWebSocketWirePongFrame, H as EDAWebSocketWireHelloFrame, I as EDAFrameworkWebSocketEvent, J as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, K as EDA_WEB_SOCKET_PING_MESSAGE, L as EDAWebSocketWireAckFrame, M as decodeEDAWebSocketClientMessage, N as defaultEDAWebSocketFlowControl, O as EDA_WS_CLOSE_SEND_FAILED, P as encodeEDAWebSocketServerFrame, R as EDAWebSocketWireClientFrame, S as EDAWebSocketPongFrame, T as EDA_WS_CLOSE_GOING_AWAY, U as EDAWebSocketWireLaggedFrame, V as EDAWebSocketWireHeartbeatFrame, W as EDAWebSocketWirePingFrame, X as makeEDAWebSocketWireProtocol, Y as edaFrameworkWebSocketWireProtocol, _ as EDAWebSocketFlowControl, a as checkpointWebSocketDeliveryState, b as EDAWebSocketLaggedFrame, c as onClientAck, d as onHostSuppressedFrame, f as restoreWebSocketDeliveryState, g as EDAWebSocketEventsFrame, h as EDAWebSocketErrorFrame, i as SubscriberLagReason, j as SubscriberId, k as EDA_WS_CLOSE_UNSUPPORTED_DATA, l as onDurableEvents, m as EDAWebSocketClientFrame, n as EDAWebSocketInFlightFrame, o as deliveryHelloFrame, p as EDAWebSocketAckFrame, q as EDA_WEB_SOCKET_PONG_MESSAGE, r as EDAWebSocketSuppressedRange, s as makeWebSocketDeliveryState, t as EDAWebSocketDeliveryCheckpoint, u as onEphemeralEvent, v as EDAWebSocketHeartbeatFrame, w as EDA_WEB_SOCKET_PROTOCOL_VERSION, x as EDAWebSocketPingFrame, y as EDAWebSocketHelloFrame, z as EDAWebSocketWireErrorFrame } from "../delivery-2ZILvoRD.js";
1
+ import { A as FrameId, B as EDAWebSocketWireFlowControl, C as EDAWebSocketServerFrame, D as EDA_WS_CLOSE_PROTOCOL_ERROR, E as EDA_WS_CLOSE_LAGGED, F as laggedCloseReason, G as EDAWebSocketWirePongFrame, H as EDAWebSocketWireHelloFrame, I as EDAFrameworkWebSocketEvent, J as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, K as EDA_WEB_SOCKET_PING_MESSAGE, L as EDAWebSocketWireAckFrame, M as decodeEDAWebSocketClientMessage, N as defaultEDAWebSocketFlowControl, O as EDA_WS_CLOSE_SEND_FAILED, P as encodeEDAWebSocketServerFrame, R as EDAWebSocketWireClientFrame, S as EDAWebSocketPongFrame, T as EDA_WS_CLOSE_GOING_AWAY, U as EDAWebSocketWireLaggedFrame, V as EDAWebSocketWireHeartbeatFrame, W as EDAWebSocketWirePingFrame, X as makeEDAWebSocketWireProtocol, Y as edaFrameworkWebSocketWireProtocol, _ as EDAWebSocketFlowControl, a as checkpointWebSocketDeliveryState, b as EDAWebSocketLaggedFrame, c as onClientAck, d as onHostSuppressedFrame, f as restoreWebSocketDeliveryState, g as EDAWebSocketEventsFrame, h as EDAWebSocketErrorFrame, i as SubscriberLagReason, j as SubscriberId, k as EDA_WS_CLOSE_UNSUPPORTED_DATA, l as onDurableEvents, m as EDAWebSocketClientFrame, n as EDAWebSocketInFlightFrame, o as deliveryHelloFrame, p as EDAWebSocketAckFrame, q as EDA_WEB_SOCKET_PONG_MESSAGE, r as EDAWebSocketSuppressedRange, s as makeWebSocketDeliveryState, t as EDAWebSocketDeliveryCheckpoint, u as onEphemeralEvent, v as EDAWebSocketHeartbeatFrame, w as EDA_WEB_SOCKET_PROTOCOL_VERSION, x as EDAWebSocketPingFrame, y as EDAWebSocketHelloFrame, z as EDAWebSocketWireErrorFrame } from "../delivery-BoF-NZbZ.js";
2
2
  export { EDAFrameworkWebSocketEvent, EDAWebSocketAckFrame, EDAWebSocketClientFrame, EDAWebSocketDeliveryCheckpoint, EDAWebSocketErrorFrame, EDAWebSocketEventsFrame, EDAWebSocketFlowControl, EDAWebSocketHeartbeatFrame, EDAWebSocketHelloFrame, EDAWebSocketInFlightFrame, EDAWebSocketLaggedFrame, EDAWebSocketPingFrame, EDAWebSocketPongFrame, EDAWebSocketServerFrame, EDAWebSocketSuppressedRange, EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, EDAWebSocketWirePingFrame, EDAWebSocketWirePongFrame, EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE, EDA_WEB_SOCKET_PROTOCOL_VERSION, EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, EDA_WS_CLOSE_GOING_AWAY, EDA_WS_CLOSE_LAGGED, EDA_WS_CLOSE_PROTOCOL_ERROR, EDA_WS_CLOSE_SEND_FAILED, EDA_WS_CLOSE_UNSUPPORTED_DATA, FrameId, SubscriberId, SubscriberLagReason, checkpointWebSocketDeliveryState, decodeEDAWebSocketClientMessage, defaultEDAWebSocketFlowControl, deliveryHelloFrame, edaFrameworkWebSocketWireProtocol, encodeEDAWebSocketServerFrame, laggedCloseReason, makeEDAWebSocketWireProtocol, makeWebSocketDeliveryState, onClientAck, onDurableEvents, onEphemeralEvent, onHostSuppressedFrame, restoreWebSocketDeliveryState };
@@ -1,7 +1,7 @@
1
1
  import { h as SequenceNumber } from "./core-BcimKMIv.js";
2
- import { Ct as TranscriptRecordView, Ft as TranscriptVersion, S as TranscriptReadiness, T as TranscriptWindow, b as TranscriptActiveContent, mt as TranscriptLogIncarnation } from "./session-store-BL6sfrnn.js";
3
- import { r as TranscriptSubscriptionBase, s as TranscriptUpdate, t as TranscriptCoverage } from "./subscription-DZNWFDTV.js";
4
- import { $ as EDAWebSocketWireProtocol, A as EDA_WS_CLOSE_LAGGED, B as EDAFrameworkWebSocketEvent, C as EDAWebSocketHelloFrame, D as EDAWebSocketServerFrame, E as EDAWebSocketPongFrame, F as SubscriberId, G as EDAWebSocketWireClientFrame, H as EDAWebSocketServerFrameEncoder, I as decodeEDAWebSocketClientMessage, J as EDAWebSocketWireHeartbeatFrame, K as EDAWebSocketWireErrorFrame, L as defaultEDAWebSocketFlowControl, M as EDA_WS_CLOSE_SEND_FAILED, N as EDA_WS_CLOSE_UNSUPPORTED_DATA, O as EDA_WEB_SOCKET_PROTOCOL_VERSION, P as FrameId, Q as EDAWebSocketWirePongFrame, R as encodeEDAWebSocketServerFrame, S as EDAWebSocketHeartbeatFrame, T as EDAWebSocketPingFrame, U as EDAWebSocketServerFrameInput, V as EDAWebSocketEventConsumerPolicy, W as EDAWebSocketWireAckFrame, X as EDAWebSocketWireLaggedFrame, Y as EDAWebSocketWireHelloFrame, Z as EDAWebSocketWirePingFrame, _ as EDAWebSocketAckFrame, a as EDAWebSocketInFlightFrame, b as EDAWebSocketEventsFrame, c as SubscriberLagReason, d as makeWebSocketDeliveryState, et as EDA_WEB_SOCKET_PING_MESSAGE, f as onClientAck, g as restoreWebSocketDeliveryState, h as onHostSuppressedFrame, i as EDAWebSocketDeliveryState, it as makeEDAWebSocketWireProtocol, j as EDA_WS_CLOSE_PROTOCOL_ERROR, k as EDA_WS_CLOSE_GOING_AWAY, l as checkpointWebSocketDeliveryState, m as onEphemeralEvent, n as EDAWebSocketDeliveryCheckpoint, nt as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, o as EDAWebSocketSuppressedRange, p as onDurableEvents, q as EDAWebSocketWireFlowControl, r as EDAWebSocketDeliveryResult, rt as edaFrameworkWebSocketWireProtocol, s as MakeDeliveryStateInput, t as EDAWebSocketDeliveryAction, tt as EDA_WEB_SOCKET_PONG_MESSAGE, u as deliveryHelloFrame, v as EDAWebSocketClientFrame, w as EDAWebSocketLaggedFrame, x as EDAWebSocketFlowControl, y as EDAWebSocketErrorFrame, z as laggedCloseReason } from "./delivery-D3MxW4wg.js";
2
+ import { C as TranscriptReadiness, E as TranscriptWindow, It as TranscriptVersion, ht as TranscriptLogIncarnation, wt as TranscriptRecordView, x as TranscriptActiveContent } from "./session-store-DaSHeg8Q.js";
3
+ import { r as TranscriptSubscriptionBase, s as TranscriptUpdate, t as TranscriptCoverage } from "./subscription-BhwUmsl4.js";
4
+ import { $ as EDAWebSocketWireProtocol, A as EDA_WS_CLOSE_LAGGED, B as EDAFrameworkWebSocketEvent, C as EDAWebSocketHelloFrame, D as EDAWebSocketServerFrame, E as EDAWebSocketPongFrame, F as SubscriberId, G as EDAWebSocketWireClientFrame, H as EDAWebSocketServerFrameEncoder, I as decodeEDAWebSocketClientMessage, J as EDAWebSocketWireHeartbeatFrame, K as EDAWebSocketWireErrorFrame, L as defaultEDAWebSocketFlowControl, M as EDA_WS_CLOSE_SEND_FAILED, N as EDA_WS_CLOSE_UNSUPPORTED_DATA, O as EDA_WEB_SOCKET_PROTOCOL_VERSION, P as FrameId, Q as EDAWebSocketWirePongFrame, R as encodeEDAWebSocketServerFrame, S as EDAWebSocketHeartbeatFrame, T as EDAWebSocketPingFrame, U as EDAWebSocketServerFrameInput, V as EDAWebSocketEventConsumerPolicy, W as EDAWebSocketWireAckFrame, X as EDAWebSocketWireLaggedFrame, Y as EDAWebSocketWireHelloFrame, Z as EDAWebSocketWirePingFrame, _ as EDAWebSocketAckFrame, a as EDAWebSocketInFlightFrame, b as EDAWebSocketEventsFrame, c as SubscriberLagReason, d as makeWebSocketDeliveryState, et as EDA_WEB_SOCKET_PING_MESSAGE, f as onClientAck, g as restoreWebSocketDeliveryState, h as onHostSuppressedFrame, i as EDAWebSocketDeliveryState, it as makeEDAWebSocketWireProtocol, j as EDA_WS_CLOSE_PROTOCOL_ERROR, k as EDA_WS_CLOSE_GOING_AWAY, l as checkpointWebSocketDeliveryState, m as onEphemeralEvent, n as EDAWebSocketDeliveryCheckpoint, nt as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, o as EDAWebSocketSuppressedRange, p as onDurableEvents, q as EDAWebSocketWireFlowControl, r as EDAWebSocketDeliveryResult, rt as edaFrameworkWebSocketWireProtocol, s as MakeDeliveryStateInput, t as EDAWebSocketDeliveryAction, tt as EDA_WEB_SOCKET_PONG_MESSAGE, u as deliveryHelloFrame, v as EDAWebSocketClientFrame, w as EDAWebSocketLaggedFrame, x as EDAWebSocketFlowControl, y as EDAWebSocketErrorFrame, z as laggedCloseReason } from "./delivery-B_LDTuIB.js";
5
5
  import * as Schema from "effect/Schema";
6
6
  //#region src/websocket/transcript.d.ts
7
7
  /**
package/dist/websocket.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { SequenceNumber } from "./types/core.js";
2
- import { E as TranscriptOrder, _ as TranscriptCursor } from "./records--54mZEBx.js";
3
- import { c as transcriptCoverageOf, i as TranscriptUpdate, n as TranscriptRequestId, r as TranscriptSubscriptionBase, t as TranscriptCoverage } from "./subscription-DmO3BcdT.js";
4
- import { A as FrameId, B as EDAWebSocketWireFlowControl, C as EDAWebSocketServerFrame, D as EDA_WS_CLOSE_PROTOCOL_ERROR, E as EDA_WS_CLOSE_LAGGED, F as laggedCloseReason, G as EDAWebSocketWirePongFrame, H as EDAWebSocketWireHelloFrame, I as EDAFrameworkWebSocketEvent, J as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, K as EDA_WEB_SOCKET_PING_MESSAGE, L as EDAWebSocketWireAckFrame, M as decodeEDAWebSocketClientMessage, N as defaultEDAWebSocketFlowControl, O as EDA_WS_CLOSE_SEND_FAILED, P as encodeEDAWebSocketServerFrame, R as EDAWebSocketWireClientFrame, S as EDAWebSocketPongFrame, T as EDA_WS_CLOSE_GOING_AWAY, U as EDAWebSocketWireLaggedFrame, V as EDAWebSocketWireHeartbeatFrame, W as EDAWebSocketWirePingFrame, X as makeEDAWebSocketWireProtocol, Y as edaFrameworkWebSocketWireProtocol, _ as EDAWebSocketFlowControl, a as checkpointWebSocketDeliveryState, b as EDAWebSocketLaggedFrame, c as onClientAck, d as onHostSuppressedFrame, f as restoreWebSocketDeliveryState, g as EDAWebSocketEventsFrame, h as EDAWebSocketErrorFrame, i as SubscriberLagReason, j as SubscriberId, k as EDA_WS_CLOSE_UNSUPPORTED_DATA, l as onDurableEvents, m as EDAWebSocketClientFrame, n as EDAWebSocketInFlightFrame, o as deliveryHelloFrame, p as EDAWebSocketAckFrame, q as EDA_WEB_SOCKET_PONG_MESSAGE, r as EDAWebSocketSuppressedRange, s as makeWebSocketDeliveryState, t as EDAWebSocketDeliveryCheckpoint, u as onEphemeralEvent, v as EDAWebSocketHeartbeatFrame, w as EDA_WEB_SOCKET_PROTOCOL_VERSION, x as EDAWebSocketPingFrame, y as EDAWebSocketHelloFrame, z as EDAWebSocketWireErrorFrame } from "./delivery-2ZILvoRD.js";
2
+ import { E as TranscriptOrder, _ as TranscriptCursor } from "./records-D0ZIAOzd.js";
3
+ import { c as transcriptCoverageOf, i as TranscriptUpdate, n as TranscriptRequestId, r as TranscriptSubscriptionBase, t as TranscriptCoverage } from "./subscription-D7U4Tziv.js";
4
+ import { A as FrameId, B as EDAWebSocketWireFlowControl, C as EDAWebSocketServerFrame, D as EDA_WS_CLOSE_PROTOCOL_ERROR, E as EDA_WS_CLOSE_LAGGED, F as laggedCloseReason, G as EDAWebSocketWirePongFrame, H as EDAWebSocketWireHelloFrame, I as EDAFrameworkWebSocketEvent, J as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, K as EDA_WEB_SOCKET_PING_MESSAGE, L as EDAWebSocketWireAckFrame, M as decodeEDAWebSocketClientMessage, N as defaultEDAWebSocketFlowControl, O as EDA_WS_CLOSE_SEND_FAILED, P as encodeEDAWebSocketServerFrame, R as EDAWebSocketWireClientFrame, S as EDAWebSocketPongFrame, T as EDA_WS_CLOSE_GOING_AWAY, U as EDAWebSocketWireLaggedFrame, V as EDAWebSocketWireHeartbeatFrame, W as EDAWebSocketWirePingFrame, X as makeEDAWebSocketWireProtocol, Y as edaFrameworkWebSocketWireProtocol, _ as EDAWebSocketFlowControl, a as checkpointWebSocketDeliveryState, b as EDAWebSocketLaggedFrame, c as onClientAck, d as onHostSuppressedFrame, f as restoreWebSocketDeliveryState, g as EDAWebSocketEventsFrame, h as EDAWebSocketErrorFrame, i as SubscriberLagReason, j as SubscriberId, k as EDA_WS_CLOSE_UNSUPPORTED_DATA, l as onDurableEvents, m as EDAWebSocketClientFrame, n as EDAWebSocketInFlightFrame, o as deliveryHelloFrame, p as EDAWebSocketAckFrame, q as EDA_WEB_SOCKET_PONG_MESSAGE, r as EDAWebSocketSuppressedRange, s as makeWebSocketDeliveryState, t as EDAWebSocketDeliveryCheckpoint, u as onEphemeralEvent, v as EDAWebSocketHeartbeatFrame, w as EDA_WEB_SOCKET_PROTOCOL_VERSION, x as EDAWebSocketPingFrame, y as EDAWebSocketHelloFrame, z as EDAWebSocketWireErrorFrame } from "./delivery-BoF-NZbZ.js";
5
5
  import * as Schema from "effect/Schema";
6
6
  import * as Exit from "effect/Exit";
7
7
  //#region src/websocket/transcript.ts
@@ -1,5 +1,5 @@
1
1
  import { h as SequenceNumber } from "./core-BcimKMIv.js";
2
- import { A as TranscriptDefinition, At as TranscriptToolRecord, C as TranscriptVersionMeta, D as TranscriptWindowSelector, E as TranscriptWindowLimits, Ft as TranscriptVersion, H as AssistantRecordId, Nt as TranscriptUserRecord, S as TranscriptReadiness, T as TranscriptWindow, gt as TranscriptOrderKey, jt as TranscriptTopLevelRecord, mt as TranscriptLogIncarnation, t as CommittedDurableEvent, v as TranscriptCursorMismatch, vt as TranscriptRecord, xt as TranscriptRecordId } from "./session-store-BL6sfrnn.js";
2
+ import { C as TranscriptReadiness, D as TranscriptWindowLimits, E as TranscriptWindow, It as TranscriptVersion, Mt as TranscriptTopLevelRecord, O as TranscriptWindowSelector, Pt as TranscriptUserRecord, St as TranscriptRecordId, U as AssistantRecordId, _t as TranscriptOrderKey, ht as TranscriptLogIncarnation, j as TranscriptDefinition, jt as TranscriptToolRecord, t as CommittedDurableEvent, w as TranscriptVersionMeta, y as TranscriptCursorMismatch, yt as TranscriptRecord } from "./session-store-DaSHeg8Q.js";
3
3
  import * as Schema from "effect/Schema";
4
4
  import * as Result from "effect/Result";
5
5
  //#region src/transcript/plan.d.ts
@@ -110,4 +110,4 @@ declare const inactiveTranscriptWindow: (incarnation: TranscriptLogIncarnation,
110
110
  declare const readTranscriptWindowFrom: (source: TranscriptWindowSource, selector: TranscriptWindowSelector, limits: TranscriptWindowLimits) => Result.Result<TranscriptWindow, TranscriptCursorMismatch>;
111
111
  //#endregion
112
112
  export { transcriptReadiness as a, TranscriptAliasNamespace as c, TranscriptProjectionError as d, readTranscriptWindowFrom as i, TranscriptChangePlan as l, buildingTranscriptWindow as n, PlanTranscriptBatch as o, inactiveTranscriptWindow as r, TranscriptAlias as s, TranscriptWindowSource as t, TranscriptLookup as u };
113
- //# sourceMappingURL=window-read-Brov9VdQ.d.ts.map
113
+ //# sourceMappingURL=window-read-BELSkO-r.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { SequenceNumber } from "./types/core.js";
2
- import { u as NonNegativeInt } from "./envelope-BCzKUq_z.js";
3
- import { A as TranscriptRecordFromEnvelope, E as TranscriptOrder, W as isPendingTranscriptUserRecord, Y as transcriptRecordId } from "./records--54mZEBx.js";
2
+ import { d as NonNegativeInt } from "./envelope-BSI_Xh-f.js";
3
+ import { A as TranscriptRecordFromEnvelope, E as TranscriptOrder, W as isPendingTranscriptUserRecord, Y as transcriptRecordId } from "./records-D0ZIAOzd.js";
4
4
  import * as Context from "effect/Context";
5
5
  import * as Schema from "effect/Schema";
6
6
  import * as Result from "effect/Result";
@@ -261,4 +261,4 @@ const withBodyRefs = (record, maxInlineBodyBytes) => {
261
261
  //#endregion
262
262
  export { EDATranscriptStore as a, transcriptReadiness as i, inactiveTranscriptWindow as n, TranscriptCursorMismatch as o, readTranscriptWindowFrom as r, buildingTranscriptWindow as t };
263
263
 
264
- //# sourceMappingURL=window-read-DPFAA1hM.js.map
264
+ //# sourceMappingURL=window-read-FJTCDaSq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"window-read-DPFAA1hM.js","names":[],"sources":["../src/transcript/store.ts","../src/transcript/window-read.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport type * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport type { EDASessionStoreError } from \"../services/session-store\";\nimport type { TranscriptDefinition } from \"./mapping\";\nimport type {\n TranscriptVersionMeta,\n TranscriptWindow,\n TranscriptWindowLimits,\n TranscriptWindowSelector,\n} from \"./window\";\n\n/**\n * The transcript definitions a store maintains, fixed when the store is constructed.\n *\n * `current` is what new sessions start with and every session converges to. `previous` is\n * carried for one release only, so a session not yet rebuilt keeps its active rows maintained.\n * A stored version that matches neither is frozen.\n */\nexport interface TranscriptMaintenanceConfig {\n readonly current: TranscriptDefinition;\n readonly previous?: TranscriptDefinition;\n}\n\n/** A cursor minted for another log incarnation or transcript version. The client takes `Latest`. */\nexport class TranscriptCursorMismatch extends Schema.TaggedError<TranscriptCursorMismatch>()(\n \"TranscriptCursorMismatch\",\n { message: Schema.String },\n) {}\n\n/**\n * Storage-level transcript reads for one session.\n *\n * Maintenance has no method here: the store runs it inside its own append transaction for every\n * carried, healthy version, so `EDASessionStore.append` semantics are unchanged. These reads never\n * construct the model runtime and never include live active content, which only the delivery\n * layer can capture.\n */\nexport interface EDATranscriptStoreShape {\n /** Read one complete window of the served version at a single cut. */\n readonly readTranscriptWindow: (\n selector: TranscriptWindowSelector,\n limits: TranscriptWindowLimits,\n ) => Effect.Effect<TranscriptWindow, EDASessionStoreError | TranscriptCursorMismatch>;\n /** Maintenance state of every version present, for builders, backfill proofs and alerts. */\n readonly readTranscriptMeta: Effect.Effect<\n ReadonlyArray<TranscriptVersionMeta>,\n EDASessionStoreError\n >;\n}\n\n/** Transcript read port, provided alongside `EDASessionStore` by stores that maintain transcripts. */\nexport class EDATranscriptStore extends Context.Service<\n EDATranscriptStore,\n EDATranscriptStoreShape\n>()(\"@effect-durable-agent/EDATranscriptStore\") {}\n","import * as Result from \"effect/Result\";\nimport * as Schema from \"effect/Schema\";\n\nimport { SequenceNumber } from \"../types/core\";\nimport { NonNegativeInt } from \"../types/events/envelope\";\nimport type { TranscriptAliasNamespace } from \"./plan\";\nimport {\n TranscriptOrder,\n TranscriptRecordFromEnvelope,\n isPendingTranscriptUserRecord,\n transcriptRecordId,\n type AssistantRecordId,\n type TranscriptAssistantPart,\n type TranscriptBody,\n type TranscriptCursor,\n type TranscriptLogIncarnation,\n type TranscriptOrderKey,\n type TranscriptRecord,\n type TranscriptRecordId,\n type TranscriptToolRecord,\n type TranscriptTopLevelRecord,\n type TranscriptUserRecord,\n type TranscriptVersion,\n} from \"./records\";\nimport { TranscriptCursorMismatch } from \"./store\";\nimport type {\n TranscriptReadiness,\n TranscriptVersionMeta,\n TranscriptWindow,\n TranscriptWindowLimits,\n TranscriptWindowSelector,\n} from \"./window\";\n\n/**\n * Synchronous indexed reads of the served version at one cut, as a store provides them.\n *\n * Window assembly (paging, dependency collection, byte budgeting and body references) is shared\n * by every store through `readTranscriptWindowFrom`; a store only supplies these reads.\n */\nexport interface TranscriptWindowSource {\n readonly incarnation: TranscriptLogIncarnation;\n /** Maintenance state of the served (active) version; its cursor is the window's `throughSeq`. */\n readonly meta: TranscriptVersionMeta;\n /** False when this release no longer carries the served version (a missed session). */\n readonly carried: boolean;\n /** Top-level records before `key` (or before the end), newest first. */\n readonly topLevelBefore: (\n key: TranscriptOrderKey | undefined,\n limit: number,\n inclusive: boolean,\n ) => ReadonlyArray<TranscriptTopLevelRecord>;\n /** Top-level records after `key` (or after the start), oldest first. */\n readonly topLevelAfter: (\n key: TranscriptOrderKey | undefined,\n limit: number,\n inclusive: boolean,\n ) => ReadonlyArray<TranscriptTopLevelRecord>;\n readonly record: (id: TranscriptRecordId) => TranscriptRecord | undefined;\n readonly alias: (\n namespace: TranscriptAliasNamespace,\n key: string,\n ) => TranscriptRecordId | undefined;\n /** Tool records of one assistant (the typed dependency lookup). */\n readonly toolsOf: (assistantId: AssistantRecordId) => ReadonlyArray<TranscriptToolRecord>;\n /** Every user record still waiting for the agent (the pending-membership index). */\n readonly pendingUsers: () => ReadonlyArray<TranscriptUserRecord>;\n}\n\n/** Readiness of a served version: why its cut may be behind the log. */\nexport const transcriptReadiness = (\n meta: TranscriptVersionMeta,\n carried: boolean,\n): TranscriptReadiness => {\n if (!carried) return { _tag: \"UpdatingHistory\" };\n switch (meta.status._tag) {\n case \"Ok\":\n return { _tag: \"Ready\" };\n case \"Failed\":\n return {\n _tag: \"Degraded\",\n failedAtSeq: meta.status.failedAtSeq,\n error: meta.status.error,\n };\n }\n};\n\n/** The empty window served while no version is servable yet. */\nexport const buildingTranscriptWindow = (\n incarnation: TranscriptLogIncarnation,\n version: TranscriptVersion,\n): TranscriptWindow => ({\n incarnation,\n version,\n throughSeq: SequenceNumber.make(0),\n records: [],\n dependencies: [],\n hasOlder: false,\n hasNewer: false,\n readiness: { _tag: \"Building\" },\n});\n\n/**\n * The empty window served while no version is active.\n *\n * It reads as `Building` while the build of `currentVersion` can still finish. A build that has\n * frozen as failed is never retried (only a new definition repairs it), so once the build of\n * `currentVersion` has failed the window is `Unreadable` and names that failure, rather than\n * reading as building forever.\n */\nexport const inactiveTranscriptWindow = (\n incarnation: TranscriptLogIncarnation,\n currentVersion: TranscriptVersion,\n build: Pick<TranscriptVersionMeta, \"version\" | \"status\"> | undefined,\n): TranscriptWindow => {\n const building = buildingTranscriptWindow(incarnation, currentVersion);\n if (build?.version !== currentVersion || build.status._tag !== \"Failed\") return building;\n return {\n ...building,\n readiness: {\n _tag: \"Unreadable\",\n error: `transcript version ${build.version} failed to build at seq ${build.status.failedAtSeq}: ${build.status.error}`,\n },\n };\n};\n\nconst orderKey = (record: TranscriptTopLevelRecord): TranscriptOrderKey => ({\n anchorSeq: record.position?.anchorSeq ?? 0,\n ordinal: record.position?.ordinal ?? 0,\n recordId: record.id,\n});\n\nconst cursorKey = (cursor: TranscriptCursor): TranscriptOrderKey => ({\n anchorSeq: cursor.anchorSeq,\n ordinal: cursor.ordinal,\n recordId: cursor.recordId,\n});\n\n/**\n * Assemble one window from a source at a single cut.\n *\n * The response never contains anything newer than the served version's cursor: a frozen (failed\n * or no longer carried) version's rows, pending users and session context all stop at its last\n * good cut, which is the degraded-read rule. Bodies above the inline limit become references;\n * if the response still exceeds the byte budget, records are dropped from the far end of the\n * selection, keeping at least one so paging always progresses.\n */\nexport const readTranscriptWindowFrom = (\n source: TranscriptWindowSource,\n selector: TranscriptWindowSelector,\n limits: TranscriptWindowLimits,\n): Result.Result<TranscriptWindow, TranscriptCursorMismatch> => {\n const version = source.meta.version;\n for (const cursor of selectorCursors(selector)) {\n if (cursor.incarnation !== source.incarnation || cursor.version !== version) {\n return Result.fail(\n new TranscriptCursorMismatch({\n message: `cursor for ${cursor.incarnation}/${cursor.version} read against ${source.incarnation}/${version}`,\n }),\n );\n }\n }\n\n const selected = selectTopLevel(source, selector, limits.maxRecords);\n // Latest and Page(before) keep the newest records when trimming; the others keep the oldest.\n const keepNewest =\n selector._tag === \"Latest\" || (selector._tag === \"Page\" && selector.direction === \"before\");\n const kept = trimToBudget(\n dependencyGroups(\n source,\n selected.map((record) => withBodyRefs(record, limits.maxInlineBodyBytes)),\n limits.maxInlineBodyBytes,\n ),\n limits.maxBytes,\n keepNewest,\n );\n const top = kept.top;\n const dependencies = flattenDependencies(kept);\n\n const first = top[0];\n const last = top[top.length - 1];\n const [hasOlder, hasNewer] =\n first === undefined || last === undefined\n ? emptySelectionNeighbours(source, selector)\n : [\n source.topLevelBefore(orderKey(first), 1, false).length > 0,\n source.topLevelAfter(orderKey(last), 1, false).length > 0,\n ];\n\n return Result.succeed({\n incarnation: source.incarnation,\n version,\n throughSeq: source.meta.cursor,\n records: top,\n dependencies,\n hasOlder,\n hasNewer,\n readiness: transcriptReadiness(source.meta, source.carried),\n });\n};\n\nconst selectorCursors = (selector: TranscriptWindowSelector): ReadonlyArray<TranscriptCursor> => {\n switch (selector._tag) {\n case \"Latest\":\n return [];\n case \"Page\":\n return [selector.cursor];\n case \"Range\":\n return [selector.from, selector.to];\n }\n};\n\nconst selectTopLevel = (\n source: TranscriptWindowSource,\n selector: TranscriptWindowSelector,\n maxRecords: number,\n): ReadonlyArray<TranscriptTopLevelRecord> => {\n switch (selector._tag) {\n case \"Latest\":\n return [\n ...source.topLevelBefore(undefined, Math.min(selector.count, maxRecords), false),\n ].reverse();\n case \"Page\": {\n const count = Math.min(selector.count, maxRecords);\n return selector.direction === \"before\"\n ? [...source.topLevelBefore(cursorKey(selector.cursor), count, false)].reverse()\n : source.topLevelAfter(cursorKey(selector.cursor), count, false);\n }\n case \"Range\": {\n const to = cursorKey(selector.to);\n return source\n .topLevelAfter(cursorKey(selector.from), maxRecords, true)\n .filter((record) => TranscriptOrder(orderKey(record), to) <= 0);\n }\n }\n};\n\nconst emptySelectionNeighbours = (\n source: TranscriptWindowSource,\n selector: TranscriptWindowSelector,\n): readonly [boolean, boolean] => {\n switch (selector._tag) {\n case \"Latest\":\n return [false, false];\n case \"Page\": {\n const key = cursorKey(selector.cursor);\n return selector.direction === \"before\"\n ? [false, source.topLevelAfter(key, 1, true).length > 0]\n : [source.topLevelBefore(key, 1, true).length > 0, false];\n }\n case \"Range\":\n return [\n source.topLevelBefore(cursorKey(selector.from), 1, false).length > 0,\n source.topLevelAfter(cursorKey(selector.to), 1, false).length > 0,\n ];\n }\n};\n\n/**\n * A selection with its dependencies grouped by owner: the session context first, each top-level\n * record's run group and tools in part order, then pending users. A record may appear in several\n * groups; the window carries it once, where it first appears.\n */\ninterface DependencyGroups {\n readonly top: ReadonlyArray<TranscriptTopLevelRecord>;\n readonly leading: ReadonlyArray<TranscriptRecord>;\n /** Dependencies of `top[i]`, in order. */\n readonly perTop: ReadonlyArray<ReadonlyArray<TranscriptRecord>>;\n readonly trailing: ReadonlyArray<TranscriptRecord>;\n}\n\nconst dependencyGroups = (\n source: TranscriptWindowSource,\n top: ReadonlyArray<TranscriptTopLevelRecord>,\n maxInlineBodyBytes: number,\n): DependencyGroups => {\n const referenced = (records: ReadonlyArray<TranscriptRecord | undefined>) =>\n records.flatMap((record) =>\n record === undefined ? [] : [withBodyRefs(record, maxInlineBodyBytes)],\n );\n return {\n top,\n leading: referenced([source.record(transcriptRecordId.session)]),\n perTop: top.map((record) => referenced(recordDependencies(source, record))),\n trailing: referenced(\n [...source.pendingUsers()]\n .filter(isPendingTranscriptUserRecord)\n .sort(\n (left, right) =>\n left.submittedSeq - right.submittedSeq ||\n (left.id < right.id ? -1 : left.id > right.id ? 1 : 0),\n ),\n ),\n };\n};\n\n/** One top-level record's run group and tools, in part order. */\nconst recordDependencies = (\n source: TranscriptWindowSource,\n record: TranscriptTopLevelRecord,\n): ReadonlyArray<TranscriptRecord | undefined> => {\n switch (record.kind) {\n case \"assistant\": {\n const partOrder = new Map(\n record.parts.flatMap((part, index) =>\n part._tag === \"ToolCall\" && part.toolId !== undefined ? [[part.toolId, index]] : [],\n ),\n );\n const tools = [...source.toolsOf(record.id)].sort(\n (left, right) =>\n (partOrder.get(left.id) ?? Number.MAX_SAFE_INTEGER) -\n (partOrder.get(right.id) ?? Number.MAX_SAFE_INTEGER) ||\n (left.id < right.id ? -1 : left.id > right.id ? 1 : 0),\n );\n return [\n ...(record.runGroupId === undefined ? [] : [source.record(record.runGroupId)]),\n ...tools,\n ];\n }\n case \"user\": {\n // The consuming run's group, or, for a submission committed at its own run's start (the\n // interrupt path, which records no run on the user), the group that owns its command.\n const runId = record.state._tag === \"Consumed\" ? record.state.runId : undefined;\n const groupId =\n (runId === undefined ? undefined : source.alias(\"runId\", runId)) ??\n source.alias(\"runCommand\", record.commandId);\n return groupId === undefined ? [] : [source.record(groupId)];\n }\n case \"compaction\":\n return [];\n }\n};\n\n/** Each dependency once, where it first appears. */\nconst flattenDependencies = (groups: DependencyGroups): ReadonlyArray<TranscriptRecord> => {\n const dependencies = new Map<string, TranscriptRecord>();\n for (const record of [...groups.leading, ...groups.perTop.flat(), ...groups.trailing]) {\n if (!dependencies.has(record.id)) dependencies.set(record.id, record);\n }\n return Array.from(dependencies.values());\n};\n\n/**\n * Drop records from the far end of the selection until the window (records and their\n * dependencies) fits `maxBytes`, keeping at least one.\n *\n * Each record is measured once. A dependency's bytes count while any kept record (or the\n * window itself, for the session context and pending users) needs it, so dropping a record\n * subtracts its own bytes and those of the dependencies only it needed. The result equals\n * re-measuring the whole window after every drop, in time linear in the selection.\n */\nconst trimToBudget = (\n groups: DependencyGroups,\n maxBytes: number,\n keepNewest: boolean,\n): DependencyGroups => {\n const { top } = groups;\n if (top.length <= 1) return groups;\n const users = new Map<string, number>();\n const sizes = new Map<string, number>();\n const sizeOf = (record: TranscriptRecord) => {\n const known = sizes.get(record.id);\n if (known !== undefined) return known;\n const bytes = recordBytes(record);\n sizes.set(record.id, bytes);\n return bytes;\n };\n let total = 0;\n const need = (record: TranscriptRecord) => {\n const count = users.get(record.id) ?? 0;\n if (count === 0) total += sizeOf(record);\n users.set(record.id, count + 1);\n };\n const release = (record: TranscriptRecord) => {\n const count = (users.get(record.id) ?? 0) - 1;\n if (count === 0) total -= sizeOf(record);\n users.set(record.id, count);\n };\n // Within one record a dependency counts once, as the window carries it once.\n const ownDependencies = groups.perTop.map((records) => [\n ...new Map(records.map((record) => [record.id, record])).values(),\n ]);\n const topBytes = top.map(recordBytes);\n for (const record of [...groups.leading, ...groups.trailing]) need(record);\n top.forEach((_, index) => {\n total += topBytes[index] ?? 0;\n ownDependencies[index]?.forEach(need);\n });\n let from = 0;\n let to = top.length;\n while (to - from > 1 && total > maxBytes) {\n const dropped = keepNewest ? from++ : --to;\n total -= topBytes[dropped] ?? 0;\n ownDependencies[dropped]?.forEach(release);\n }\n return { ...groups, top: top.slice(from, to), perTop: groups.perTop.slice(from, to) };\n};\n\nconst encoder = new TextEncoder();\nconst encodeRecord = Schema.encodeSync(TranscriptRecordFromEnvelope);\n\nconst jsonBytes = (value: unknown): number => {\n const json = JSON.stringify(value);\n return json === undefined ? 0 : encoder.encode(json).length;\n};\n\n/** A record's size in the window, as it is encoded on the wire. */\nconst recordBytes = (record: TranscriptRecord): number => jsonBytes(encodeRecord(record));\n\nconst bodyRef = (body: TranscriptBody, maxInlineBodyBytes: number): TranscriptBody => {\n if (body._tag === \"Ref\") return body;\n const byteLength = jsonBytes(body.value);\n return byteLength <= maxInlineBodyBytes\n ? body\n : { _tag: \"Ref\", source: body.source, byteLength: NonNegativeInt.make(byteLength) };\n};\n\n/** Replace inline bodies above the limit with references to their immutable log source. */\nconst withBodyRefs = <R extends TranscriptRecord>(record: R, maxInlineBodyBytes: number): R => {\n switch (record.kind) {\n case \"tool\": {\n const tool: TranscriptToolRecord = {\n ...record,\n ...(record.params === undefined\n ? {}\n : { params: bodyRef(record.params, maxInlineBodyBytes) }),\n lifecycle:\n record.lifecycle._tag === \"Completed\"\n ? { _tag: \"Completed\", result: bodyRef(record.lifecycle.result, maxInlineBodyBytes) }\n : record.lifecycle,\n };\n return { ...record, ...tool };\n }\n case \"assistant\": {\n const parts = record.parts.map((part): TranscriptAssistantPart =>\n part._tag === \"ToolResult\"\n ? { ...part, result: bodyRef(part.result, maxInlineBodyBytes) }\n : part,\n );\n return { ...record, parts };\n }\n default:\n return record;\n }\n};\n"],"mappings":";;;;;;;;AA0BA,IAAa,2BAAb,cAA8C,OAAO,YAAsC,CAAC,CAC1F,4BACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;;AAwBH,IAAa,qBAAb,cAAwC,QAAQ,QAG9C,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC;;;;ACajD,MAAa,uBACX,MACA,YACwB;CACxB,IAAI,CAAC,SAAS,OAAO,EAAE,MAAM,kBAAkB;CAC/C,QAAQ,KAAK,OAAO,MAApB;EACE,KAAK,MACH,OAAO,EAAE,MAAM,QAAQ;EACzB,KAAK,UACH,OAAO;GACL,MAAM;GACN,aAAa,KAAK,OAAO;GACzB,OAAO,KAAK,OAAO;EACrB;CACJ;AACF;;AAGA,MAAa,4BACX,aACA,aACsB;CACtB;CACA;CACA,YAAY,eAAe,KAAK,CAAC;CACjC,SAAS,CAAC;CACV,cAAc,CAAC;CACf,UAAU;CACV,UAAU;CACV,WAAW,EAAE,MAAM,WAAW;AAChC;;;;;;;;;AAUA,MAAa,4BACX,aACA,gBACA,UACqB;CACrB,MAAM,WAAW,y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AM,CAAC;AAExF,MAAM,WAAW,MAAsB,uBAA+C;CACpF,IAAI,KAAK,SAAS,OAAO,OAAO;CAChC,MAAM,aAAa,UAAU,KAAK,KAAK;CACvC,OAAO,cAAc,qBACjB,OACA;EAAE,MAAM;EAAO,QAAQ,KAAK;EAAQ,YAAY,eAAe,KAAK,UAAU;CAAE;AACtF;;AAGA,MAAM,gBAA4C,QAAW,uBAAkC;CAC7F,QAAQ,OAAO,MAAf;EACE,KAAK,QAAQ;GACX,MAAM,OAA6B;IACjC,GAAG;IACH,GAAI,OAAO,WAAW,KAAA,IAClB,CAAC,IACD,EAAE,QAAQ,QAAQ,OAAO,QAAQ,kBAAkB,EAAE;IACzD,WACE,OAAO,UAAU,SAAS,cACtB;KAAE,MAAM;KAAa,QAAQ,QAAQ,OAAO,UAAU,QAAQ,kBAAkB;IAAE,IAClF,OAAO;GACf;GACA,OAAO;IAAE,GAAG;IAAQ,GAAG;GAAK;EAC9B;EACA,KAAK,aAAa;GAChB,MAAM,QAAQ,OAAO,MAAM,KAAK,SAC9B,KAAK,SAAS,eACV;IAAE,GAAG;IAAM,QAAQ,QAAQ,KAAK,QAAQ,kBAAkB;GAAE,IAC5D,IACN;GACA,OAAO;IAAE,GAAG;IAAQ;GAAM;EAC5B;EACA,SACE,OAAO;CACX;AACF"}
1
+ {"version":3,"file":"window-read-FJTCDaSq.js","names":[],"sources":["../src/transcript/store.ts","../src/transcript/window-read.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport type * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport type { EDASessionStoreError } from \"../services/session-store\";\nimport type { TranscriptDefinition } from \"./mapping\";\nimport type {\n TranscriptVersionMeta,\n TranscriptWindow,\n TranscriptWindowLimits,\n TranscriptWindowSelector,\n} from \"./window\";\n\n/**\n * The transcript definitions a store maintains, fixed when the store is constructed.\n *\n * `current` is what new sessions start with and every session converges to. `previous` is\n * carried for one release only, so a session not yet rebuilt keeps its active rows maintained.\n * A stored version that matches neither is frozen.\n */\nexport interface TranscriptMaintenanceConfig {\n readonly current: TranscriptDefinition;\n readonly previous?: TranscriptDefinition;\n}\n\n/** A cursor minted for another log incarnation or transcript version. The client takes `Latest`. */\nexport class TranscriptCursorMismatch extends Schema.TaggedError<TranscriptCursorMismatch>()(\n \"TranscriptCursorMismatch\",\n { message: Schema.String },\n) {}\n\n/**\n * Storage-level transcript reads for one session.\n *\n * Maintenance has no method here: the store runs it inside its own append transaction for every\n * carried, healthy version, so `EDASessionStore.append` semantics are unchanged. These reads never\n * construct the model runtime and never include live active content, which only the delivery\n * layer can capture.\n */\nexport interface EDATranscriptStoreShape {\n /** Read one complete window of the served version at a single cut. */\n readonly readTranscriptWindow: (\n selector: TranscriptWindowSelector,\n limits: TranscriptWindowLimits,\n ) => Effect.Effect<TranscriptWindow, EDASessionStoreError | TranscriptCursorMismatch>;\n /** Maintenance state of every version present, for builders, backfill proofs and alerts. */\n readonly readTranscriptMeta: Effect.Effect<\n ReadonlyArray<TranscriptVersionMeta>,\n EDASessionStoreError\n >;\n}\n\n/** Transcript read port, provided alongside `EDASessionStore` by stores that maintain transcripts. */\nexport class EDATranscriptStore extends Context.Service<\n EDATranscriptStore,\n EDATranscriptStoreShape\n>()(\"@effect-durable-agent/EDATranscriptStore\") {}\n","import * as Result from \"effect/Result\";\nimport * as Schema from \"effect/Schema\";\n\nimport { SequenceNumber } from \"../types/core\";\nimport { NonNegativeInt } from \"../types/events/envelope\";\nimport type { TranscriptAliasNamespace } from \"./plan\";\nimport {\n TranscriptOrder,\n TranscriptRecordFromEnvelope,\n isPendingTranscriptUserRecord,\n transcriptRecordId,\n type AssistantRecordId,\n type TranscriptAssistantPart,\n type TranscriptBody,\n type TranscriptCursor,\n type TranscriptLogIncarnation,\n type TranscriptOrderKey,\n type TranscriptRecord,\n type TranscriptRecordId,\n type TranscriptToolRecord,\n type TranscriptTopLevelRecord,\n type TranscriptUserRecord,\n type TranscriptVersion,\n} from \"./records\";\nimport { TranscriptCursorMismatch } from \"./store\";\nimport type {\n TranscriptReadiness,\n TranscriptVersionMeta,\n TranscriptWindow,\n TranscriptWindowLimits,\n TranscriptWindowSelector,\n} from \"./window\";\n\n/**\n * Synchronous indexed reads of the served version at one cut, as a store provides them.\n *\n * Window assembly (paging, dependency collection, byte budgeting and body references) is shared\n * by every store through `readTranscriptWindowFrom`; a store only supplies these reads.\n */\nexport interface TranscriptWindowSource {\n readonly incarnation: TranscriptLogIncarnation;\n /** Maintenance state of the served (active) version; its cursor is the window's `throughSeq`. */\n readonly meta: TranscriptVersionMeta;\n /** False when this release no longer carries the served version (a missed session). */\n readonly carried: boolean;\n /** Top-level records before `key` (or before the end), newest first. */\n readonly topLevelBefore: (\n key: TranscriptOrderKey | undefined,\n limit: number,\n inclusive: boolean,\n ) => ReadonlyArray<TranscriptTopLevelRecord>;\n /** Top-level records after `key` (or after the start), oldest first. */\n readonly topLevelAfter: (\n key: TranscriptOrderKey | undefined,\n limit: number,\n inclusive: boolean,\n ) => ReadonlyArray<TranscriptTopLevelRecord>;\n readonly record: (id: TranscriptRecordId) => TranscriptRecord | undefined;\n readonly alias: (\n namespace: TranscriptAliasNamespace,\n key: string,\n ) => TranscriptRecordId | undefined;\n /** Tool records of one assistant (the typed dependency lookup). */\n readonly toolsOf: (assistantId: AssistantRecordId) => ReadonlyArray<TranscriptToolRecord>;\n /** Every user record still waiting for the agent (the pending-membership index). */\n readonly pendingUsers: () => ReadonlyArray<TranscriptUserRecord>;\n}\n\n/** Readiness of a served version: why its cut may be behind the log. */\nexport const transcriptReadiness = (\n meta: TranscriptVersionMeta,\n carried: boolean,\n): TranscriptReadiness => {\n if (!carried) return { _tag: \"UpdatingHistory\" };\n switch (meta.status._tag) {\n case \"Ok\":\n return { _tag: \"Ready\" };\n case \"Failed\":\n return {\n _tag: \"Degraded\",\n failedAtSeq: meta.status.failedAtSeq,\n error: meta.status.error,\n };\n }\n};\n\n/** The empty window served while no version is servable yet. */\nexport const buildingTranscriptWindow = (\n incarnation: TranscriptLogIncarnation,\n version: TranscriptVersion,\n): TranscriptWindow => ({\n incarnation,\n version,\n throughSeq: SequenceNumber.make(0),\n records: [],\n dependencies: [],\n hasOlder: false,\n hasNewer: false,\n readiness: { _tag: \"Building\" },\n});\n\n/**\n * The empty window served while no version is active.\n *\n * It reads as `Building` while the build of `currentVersion` can still finish. A build that has\n * frozen as failed is never retried (only a new definition repairs it), so once the build of\n * `currentVersion` has failed the window is `Unreadable` and names that failure, rather than\n * reading as building forever.\n */\nexport const inactiveTranscriptWindow = (\n incarnation: TranscriptLogIncarnation,\n currentVersion: TranscriptVersion,\n build: Pick<TranscriptVersionMeta, \"version\" | \"status\"> | undefined,\n): TranscriptWindow => {\n const building = buildingTranscriptWindow(incarnation, currentVersion);\n if (build?.version !== currentVersion || build.status._tag !== \"Failed\") return building;\n return {\n ...building,\n readiness: {\n _tag: \"Unreadable\",\n error: `transcript version ${build.version} failed to build at seq ${build.status.failedAtSeq}: ${build.status.error}`,\n },\n };\n};\n\nconst orderKey = (record: TranscriptTopLevelRecord): TranscriptOrderKey => ({\n anchorSeq: record.position?.anchorSeq ?? 0,\n ordinal: record.position?.ordinal ?? 0,\n recordId: record.id,\n});\n\nconst cursorKey = (cursor: TranscriptCursor): TranscriptOrderKey => ({\n anchorSeq: cursor.anchorSeq,\n ordinal: cursor.ordinal,\n recordId: cursor.recordId,\n});\n\n/**\n * Assemble one window from a source at a single cut.\n *\n * The response never contains anything newer than the served version's cursor: a frozen (failed\n * or no longer carried) version's rows, pending users and session context all stop at its last\n * good cut, which is the degraded-read rule. Bodies above the inline limit become references;\n * if the response still exceeds the byte budget, records are dropped from the far end of the\n * selection, keeping at least one so paging always progresses.\n */\nexport const readTranscriptWindowFrom = (\n source: TranscriptWindowSource,\n selector: TranscriptWindowSelector,\n limits: TranscriptWindowLimits,\n): Result.Result<TranscriptWindow, TranscriptCursorMismatch> => {\n const version = source.meta.version;\n for (const cursor of selectorCursors(selector)) {\n if (cursor.incarnation !== source.incarnation || cursor.version !== version) {\n return Result.fail(\n new TranscriptCursorMismatch({\n message: `cursor for ${cursor.incarnation}/${cursor.version} read against ${source.incarnation}/${version}`,\n }),\n );\n }\n }\n\n const selected = selectTopLevel(source, selector, limits.maxRecords);\n // Latest and Page(before) keep the newest records when trimming; the others keep the oldest.\n const keepNewest =\n selector._tag === \"Latest\" || (selector._tag === \"Page\" && selector.direction === \"before\");\n const kept = trimToBudget(\n dependencyGroups(\n source,\n selected.map((record) => withBodyRefs(record, limits.maxInlineBodyBytes)),\n limits.maxInlineBodyBytes,\n ),\n limits.maxBytes,\n keepNewest,\n );\n const top = kept.top;\n const dependencies = flattenDependencies(kept);\n\n const first = top[0];\n const last = top[top.length - 1];\n const [hasOlder, hasNewer] =\n first === undefined || last === undefined\n ? emptySelectionNeighbours(source, selector)\n : [\n source.topLevelBefore(orderKey(first), 1, false).length > 0,\n source.topLevelAfter(orderKey(last), 1, false).length > 0,\n ];\n\n return Result.succeed({\n incarnation: source.incarnation,\n version,\n throughSeq: source.meta.cursor,\n records: top,\n dependencies,\n hasOlder,\n hasNewer,\n readiness: transcriptReadiness(source.meta, source.carried),\n });\n};\n\nconst selectorCursors = (selector: TranscriptWindowSelector): ReadonlyArray<TranscriptCursor> => {\n switch (selector._tag) {\n case \"Latest\":\n return [];\n case \"Page\":\n return [selector.cursor];\n case \"Range\":\n return [selector.from, selector.to];\n }\n};\n\nconst selectTopLevel = (\n source: TranscriptWindowSource,\n selector: TranscriptWindowSelector,\n maxRecords: number,\n): ReadonlyArray<TranscriptTopLevelRecord> => {\n switch (selector._tag) {\n case \"Latest\":\n return [\n ...source.topLevelBefore(undefined, Math.min(selector.count, maxRecords), false),\n ].reverse();\n case \"Page\": {\n const count = Math.min(selector.count, maxRecords);\n return selector.direction === \"before\"\n ? [...source.topLevelBefore(cursorKey(selector.cursor), count, false)].reverse()\n : source.topLevelAfter(cursorKey(selector.cursor), count, false);\n }\n case \"Range\": {\n const to = cursorKey(selector.to);\n return source\n .topLevelAfter(cursorKey(selector.from), maxRecords, true)\n .filter((record) => TranscriptOrder(orderKey(record), to) <= 0);\n }\n }\n};\n\nconst emptySelectionNeighbours = (\n source: TranscriptWindowSource,\n selector: TranscriptWindowSelector,\n): readonly [boolean, boolean] => {\n switch (selector._tag) {\n case \"Latest\":\n return [false, false];\n case \"Page\": {\n const key = cursorKey(selector.cursor);\n return selector.direction === \"before\"\n ? [false, source.topLevelAfter(key, 1, true).length > 0]\n : [source.topLevelBefore(key, 1, true).length > 0, false];\n }\n case \"Range\":\n return [\n source.topLevelBefore(cursorKey(selector.from), 1, false).length > 0,\n source.topLevelAfter(cursorKey(selector.to), 1, false).length > 0,\n ];\n }\n};\n\n/**\n * A selection with its dependencies grouped by owner: the session context first, each top-level\n * record's run group and tools in part order, then pending users. A record may appear in several\n * groups; the window carries it once, where it first appears.\n */\ninterface DependencyGroups {\n readonly top: ReadonlyArray<TranscriptTopLevelRecord>;\n readonly leading: ReadonlyArray<TranscriptRecord>;\n /** Dependencies of `top[i]`, in order. */\n readonly perTop: ReadonlyArray<ReadonlyArray<TranscriptRecord>>;\n readonly trailing: ReadonlyArray<TranscriptRecord>;\n}\n\nconst dependencyGroups = (\n source: TranscriptWindowSource,\n top: ReadonlyArray<TranscriptTopLevelRecord>,\n maxInlineBodyBytes: number,\n): DependencyGroups => {\n const referenced = (records: ReadonlyArray<TranscriptRecord | undefined>) =>\n records.flatMap((record) =>\n record === undefined ? [] : [withBodyRefs(record, maxInlineBodyBytes)],\n );\n return {\n top,\n leading: referenced([source.record(transcriptRecordId.session)]),\n perTop: top.map((record) => referenced(recordDependencies(source, record))),\n trailing: referenced(\n [...source.pendingUsers()]\n .filter(isPendingTranscriptUserRecord)\n .sort(\n (left, right) =>\n left.submittedSeq - right.submittedSeq ||\n (left.id < right.id ? -1 : left.id > right.id ? 1 : 0),\n ),\n ),\n };\n};\n\n/** One top-level record's run group and tools, in part order. */\nconst recordDependencies = (\n source: TranscriptWindowSource,\n record: TranscriptTopLevelRecord,\n): ReadonlyArray<TranscriptRecord | undefined> => {\n switch (record.kind) {\n case \"assistant\": {\n const partOrder = new Map(\n record.parts.flatMap((part, index) =>\n part._tag === \"ToolCall\" && part.toolId !== undefined ? [[part.toolId, index]] : [],\n ),\n );\n const tools = [...source.toolsOf(record.id)].sort(\n (left, right) =>\n (partOrder.get(left.id) ?? Number.MAX_SAFE_INTEGER) -\n (partOrder.get(right.id) ?? Number.MAX_SAFE_INTEGER) ||\n (left.id < right.id ? -1 : left.id > right.id ? 1 : 0),\n );\n return [\n ...(record.runGroupId === undefined ? [] : [source.record(record.runGroupId)]),\n ...tools,\n ];\n }\n case \"user\": {\n // The consuming run's group, or, for a submission committed at its own run's start (the\n // interrupt path, which records no run on the user), the group that owns its command.\n const runId = record.state._tag === \"Consumed\" ? record.state.runId : undefined;\n const groupId =\n (runId === undefined ? undefined : source.alias(\"runId\", runId)) ??\n source.alias(\"runCommand\", record.commandId);\n return groupId === undefined ? [] : [source.record(groupId)];\n }\n case \"compaction\":\n return [];\n }\n};\n\n/** Each dependency once, where it first appears. */\nconst flattenDependencies = (groups: DependencyGroups): ReadonlyArray<TranscriptRecord> => {\n const dependencies = new Map<string, TranscriptRecord>();\n for (const record of [...groups.leading, ...groups.perTop.flat(), ...groups.trailing]) {\n if (!dependencies.has(record.id)) dependencies.set(record.id, record);\n }\n return Array.from(dependencies.values());\n};\n\n/**\n * Drop records from the far end of the selection until the window (records and their\n * dependencies) fits `maxBytes`, keeping at least one.\n *\n * Each record is measured once. A dependency's bytes count while any kept record (or the\n * window itself, for the session context and pending users) needs it, so dropping a record\n * subtracts its own bytes and those of the dependencies only it needed. The result equals\n * re-measuring the whole window after every drop, in time linear in the selection.\n */\nconst trimToBudget = (\n groups: DependencyGroups,\n maxBytes: number,\n keepNewest: boolean,\n): DependencyGroups => {\n const { top } = groups;\n if (top.length <= 1) return groups;\n const users = new Map<string, number>();\n const sizes = new Map<string, number>();\n const sizeOf = (record: TranscriptRecord) => {\n const known = sizes.get(record.id);\n if (known !== undefined) return known;\n const bytes = recordBytes(record);\n sizes.set(record.id, bytes);\n return bytes;\n };\n let total = 0;\n const need = (record: TranscriptRecord) => {\n const count = users.get(record.id) ?? 0;\n if (count === 0) total += sizeOf(record);\n users.set(record.id, count + 1);\n };\n const release = (record: TranscriptRecord) => {\n const count = (users.get(record.id) ?? 0) - 1;\n if (count === 0) total -= sizeOf(record);\n users.set(record.id, count);\n };\n // Within one record a dependency counts once, as the window carries it once.\n const ownDependencies = groups.perTop.map((records) => [\n ...new Map(records.map((record) => [record.id, record])).values(),\n ]);\n const topBytes = top.map(recordBytes);\n for (const record of [...groups.leading, ...groups.trailing]) need(record);\n top.forEach((_, index) => {\n total += topBytes[index] ?? 0;\n ownDependencies[index]?.forEach(need);\n });\n let from = 0;\n let to = top.length;\n while (to - from > 1 && total > maxBytes) {\n const dropped = keepNewest ? from++ : --to;\n total -= topBytes[dropped] ?? 0;\n ownDependencies[dropped]?.forEach(release);\n }\n return { ...groups, top: top.slice(from, to), perTop: groups.perTop.slice(from, to) };\n};\n\nconst encoder = new TextEncoder();\nconst encodeRecord = Schema.encodeSync(TranscriptRecordFromEnvelope);\n\nconst jsonBytes = (value: unknown): number => {\n const json = JSON.stringify(value);\n return json === undefined ? 0 : encoder.encode(json).length;\n};\n\n/** A record's size in the window, as it is encoded on the wire. */\nconst recordBytes = (record: TranscriptRecord): number => jsonBytes(encodeRecord(record));\n\nconst bodyRef = (body: TranscriptBody, maxInlineBodyBytes: number): TranscriptBody => {\n if (body._tag === \"Ref\") return body;\n const byteLength = jsonBytes(body.value);\n return byteLength <= maxInlineBodyBytes\n ? body\n : { _tag: \"Ref\", source: body.source, byteLength: NonNegativeInt.make(byteLength) };\n};\n\n/** Replace inline bodies above the limit with references to their immutable log source. */\nconst withBodyRefs = <R extends TranscriptRecord>(record: R, maxInlineBodyBytes: number): R => {\n switch (record.kind) {\n case \"tool\": {\n const tool: TranscriptToolRecord = {\n ...record,\n ...(record.params === undefined\n ? {}\n : { params: bodyRef(record.params, maxInlineBodyBytes) }),\n lifecycle:\n record.lifecycle._tag === \"Completed\"\n ? { _tag: \"Completed\", result: bodyRef(record.lifecycle.result, maxInlineBodyBytes) }\n : record.lifecycle,\n };\n return { ...record, ...tool };\n }\n case \"assistant\": {\n const parts = record.parts.map((part): TranscriptAssistantPart =>\n part._tag === \"ToolResult\"\n ? { ...part, result: bodyRef(part.result, maxInlineBodyBytes) }\n : part,\n );\n return { ...record, parts };\n }\n default:\n return record;\n }\n};\n"],"mappings":";;;;;;;;AA0BA,IAAa,2BAAb,cAA8C,OAAO,YAAsC,CAAC,CAC1F,4BACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;;AAwBH,IAAa,qBAAb,cAAwC,QAAQ,QAG9C,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC;;;;ACajD,MAAa,uBACX,MACA,YACwB;CACxB,IAAI,CAAC,SAAS,OAAO,EAAE,MAAM,kBAAkB;CAC/C,QAAQ,KAAK,OAAO,MAApB;EACE,KAAK,MACH,OAAO,EAAE,MAAM,QAAQ;EACzB,KAAK,UACH,OAAO;GACL,MAAM;GACN,aAAa,KAAK,OAAO;GACzB,OAAO,KAAK,OAAO;EACrB;CACJ;AACF;;AAGA,MAAa,4BACX,aACA,aACsB;CACtB;CACA;CACA,YAAY,eAAe,KAAK,CAAC;CACjC,SAAS,CAAC;CACV,cAAc,CAAC;CACf,UAAU;CACV,UAAU;CACV,WAAW,EAAE,MAAM,WAAW;AAChC;;;;;;;;;AAUA,MAAa,4BACX,aACA,gBACA,UACqB;CACrB,MAAM,WAAW,yBAAyB,aAAa,cAAc;CACrE,IAAI,OAAO,YAAY,kBAAkB,MAAM,OAAO,SAAS,UAAU,OAAO;CAChF,OAAO;EACL,GAAG;EACH,WAAW;GACT,MAAM;GACN,OAAO,sBAAsB,MAAM,QAAQ,0BAA0B,MAAM,OAAO,YAAY,IAAI,MAAM,OAAO;EACjH;CACF;AACF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F;;AAGA,MAAM,gBAA4C,QAAW,uBAAkC;CAC7F,QAAQ,OAAO,MAAf;EACE,KAAK,QAAQ;GACX,MAAM,OAA6B;IACjC,GAAG;IACH,GAAI,OAAO,WAAW,KAAA,IAClB,CAAC,IACD,EAAE,QAAQ,QAAQ,OAAO,QAAQ,kBAAkB,EAAE;IACzD,WACE,OAAO,UAAU,SAAS,cACtB;KAAE,MAAM;KAAa,QAAQ,QAAQ,OAAO,UAAU,QAAQ,kBAAkB;IAAE,IAClF,OAAO;GACf;GACA,OAAO;IAAE,GAAG;IAAQ,GAAG;GAAK;EAC9B;EACA,KAAK,aAAa;GAChB,MAAM,QAAQ,OAAO,MAAM,KAAK,SAC9B,KAAK,SAAS,eACV;IAAE,GAAG;IAAM,QAAQ,QAAQ,KAAK,QAAQ,kBAAkB;GAAE,IAC5D,IACN;GACA,OAAO;IAAE,GAAG;IAAQ;GAAM;EAC5B;EACA,SACE,OAAO;CACX;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect-durable-agent",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A host-independent, event-sourced durable state-management and execution layer for agentic applications.",
5
5
  "keywords": [
6
6
  "agents",
@@ -74,6 +74,10 @@
74
74
  "types": "./dist/services/keep-alive.d.ts",
75
75
  "import": "./dist/services/keep-alive.js"
76
76
  },
77
+ "./services/decider": {
78
+ "types": "./dist/services/decider.d.ts",
79
+ "import": "./dist/services/decider.js"
80
+ },
77
81
  "./services/compaction": {
78
82
  "types": "./dist/services/compaction.d.ts",
79
83
  "import": "./dist/services/compaction.js"
@@ -1 +0,0 @@
1
- {"version":3,"file":"durable-D13w1Qr3.js","names":[],"sources":["../src/types/events/internal.ts","../src/types/events/durable.ts"],"sourcesContent":["import * as Exit from \"effect/Exit\";\nimport * as Schema from \"effect/Schema\";\n\nimport {\n DurableEventEnvelope,\n EphemeralEventEnvelope,\n EventType,\n effectDurableAgentNamespace,\n schemaV1,\n} from \"./envelope\";\n\n/** Build a built-in durable event schema from its fixed event type and payload schema. */\nexport const durableEventSchema = <const Type extends EventType, Payload extends Schema.Top>(\n type: Type,\n payload: Payload,\n) =>\n Schema.Struct({\n ...DurableEventEnvelope.fields,\n namespace: Schema.Literal(effectDurableAgentNamespace),\n type: Schema.Literal(type),\n schemaVersion: Schema.Literal(schemaV1),\n payload,\n });\n\n/** Build a built-in ephemeral event schema from its fixed event type and payload schema. */\nexport const ephemeralEventSchema = <const Type extends EventType, Payload extends Schema.Top>(\n type: Type,\n payload: Payload,\n) =>\n Schema.Struct({\n ...EphemeralEventEnvelope.fields,\n namespace: Schema.Literal(effectDurableAgentNamespace),\n type: Schema.Literal(type),\n schemaVersion: Schema.Literal(schemaV1),\n payload,\n });\n\nconst isPlainRecord = (value: unknown): value is Readonly<Record<string, unknown>> => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n};\n\n/** Own data property, including a literal `__proto__` key from JSON, without touching prototypes. */\nconst setOwn = (target: Record<string, unknown>, key: string, value: unknown): void => {\n Object.defineProperty(target, key, {\n configurable: true,\n enumerable: true,\n value,\n writable: true,\n });\n};\n\n/** Whether a decode dropped any input key. Values returned by reference were not reshaped. */\nconst droppedKeys = (input: unknown, decoded: unknown): boolean => {\n if (input === decoded) return false;\n if (Array.isArray(input) && Array.isArray(decoded)) {\n return input.some((item, index) => droppedKeys(item, decoded[index]));\n }\n if (!isPlainRecord(input) || !isPlainRecord(decoded)) return false;\n return Object.keys(input).some(\n (key) => !Object.hasOwn(decoded, key) || droppedKeys(input[key], decoded[key]),\n );\n};\n\n/** The schema's encoding of this subtree when it has the input's container shape. */\nconst sameShape = (input: unknown, encoded: unknown): unknown =>\n (Array.isArray(input) && Array.isArray(encoded)) ||\n (isPlainRecord(input) && isPlainRecord(encoded))\n ? encoded\n : undefined;\n\n/**\n * Re-attach input properties the schema does not model. A key is unknown when the schema's own\n * encoding lacks it, so keys consumed by renaming transformations stay consumed. Where no encoding\n * of the same shape is available, such as a union member that encodes to a string, a key is\n * unknown when the decoded value lacks it. Only subtrees that dropped a key are copied.\n */\nconst retainUnknown = <A>(input: unknown, encoded: unknown, decoded: A): A => {\n if (!droppedKeys(input, decoded)) return decoded;\n const known = sameShape(input, encoded);\n if (Array.isArray(input) && Array.isArray(decoded) && input.length === decoded.length) {\n const items: ReadonlyArray<unknown> = Array.isArray(known) ? known : [];\n return Object.assign(\n [],\n decoded,\n decoded.map((item, index) => retainUnknown(input[index], items[index], item)),\n );\n }\n if (!isPlainRecord(input) || !isPlainRecord(decoded)) return decoded;\n const modelled: Readonly<Record<string, unknown>> = isPlainRecord(known) ? known : decoded;\n const unknown: Record<string, unknown> = {};\n const retained: Record<string, unknown> = {};\n for (const key of Object.keys(input)) {\n if (!Object.hasOwn(modelled, key)) setOwn(unknown, key, input[key]);\n else if (Object.hasOwn(decoded, key))\n setOwn(retained, key, retainUnknown(input[key], modelled[key], decoded[key]));\n }\n return Object.assign(unknown, decoded, retained);\n};\n\n/**\n * Effect 4 removed `onExcessProperty: \"preserve\"`. Durable facts written by other framework or\n * application versions must still re-encode at persistence and protocol boundaries without losing\n * fields, so decode with the default policy and re-attach what the schema does not model. The\n * extra encode runs only when the decode dropped a key; decode-only schemas use decoded keys.\n */\nexport const decodeRetainingExcess = <S extends Schema.Codec<unknown, unknown>>(schema: S) => {\n const decode = Schema.decodeUnknownSync(schema);\n const encode = Schema.encodeUnknownExit(schema);\n return (input: unknown): S[\"Type\"] => {\n const decoded = decode(input);\n if (!droppedKeys(input, decoded)) return decoded;\n const encoded = encode(decoded);\n return retainUnknown(input, Exit.isSuccess(encoded) ? encoded.value : undefined, decoded);\n };\n};\n","import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\nimport * as Prompt from \"effect/ai/Prompt\";\n\nimport { EDACommand, UserMessageContent } from \"../commands\";\nimport {\n BaseStateId,\n CommandId,\n CompactionId,\n ContextVersion,\n InferenceId,\n MessageId,\n RunId,\n RunRequestId,\n SequenceNumber,\n SummaryId,\n ToolCallId,\n TurnId,\n} from \"../core\";\nimport {\n DurableEventEnvelope,\n ForeignDurableEvent,\n FailurePayload,\n ModelSelectionPayload,\n ProviderPartId,\n SystemPromptText,\n ToolName,\n UsagePayload,\n effectDurableAgentNamespace,\n makeEventType,\n schemaV1,\n} from \"./envelope\";\nimport { RunSchedulingRequest } from \"../../domain/run-scheduling\";\nimport { decodeRetainingExcess, durableEventSchema } from \"./internal\";\nimport { EDARunTrace, makeEDARunTrace } from \"../tracing\";\n\n/** Establishes a session's execution policy before its first run; not a model-switch operation. */\nexport const sessionConfiguredEventType = makeEventType(\"SessionConfigured\");\nexport const SessionConfiguredEvent = durableEventSchema(\n sessionConfiguredEventType,\n Schema.Struct({ modelSelection: ModelSelectionPayload }),\n);\nexport type SessionConfiguredEvent = typeof SessionConfiguredEvent.Type;\n\n/** Event type values for durable command lifecycle events. */\nexport const commandAdmittedEventType = makeEventType(\"CommandAdmitted\");\nexport const commandStartedEventType = makeEventType(\"CommandStarted\");\nexport const commandCompletedEventType = makeEventType(\"CommandCompleted\");\nexport const commandFailedEventType = makeEventType(\"CommandFailed\");\nexport const commandCancelledEventType = makeEventType(\"CommandCancelled\");\n\n/** Payload recorded when a command enters the durable session log. */\nexport const CommandAdmittedPayload = Schema.Struct({ command: EDACommand });\nexport type CommandAdmittedPayload = typeof CommandAdmittedPayload.Type;\nexport const CommandAdmittedEvent = durableEventSchema(\n commandAdmittedEventType,\n CommandAdmittedPayload,\n);\nexport type CommandAdmittedEvent = typeof CommandAdmittedEvent.Type;\n\n/** Payload recorded when command execution starts. */\nexport const CommandStartedPayload = Schema.Struct({ commandId: CommandId });\nexport type CommandStartedPayload = typeof CommandStartedPayload.Type;\nexport const CommandStartedEvent = durableEventSchema(\n commandStartedEventType,\n CommandStartedPayload,\n);\nexport type CommandStartedEvent = typeof CommandStartedEvent.Type;\n\n/** Payload recorded when command execution completes normally. */\nexport const CommandCompletedPayload = Schema.Struct({ commandId: CommandId });\nexport type CommandCompletedPayload = typeof CommandCompletedPayload.Type;\nexport const CommandCompletedEvent = durableEventSchema(\n commandCompletedEventType,\n CommandCompletedPayload,\n);\nexport type CommandCompletedEvent = typeof CommandCompletedEvent.Type;\n\n/** Payload recorded when command execution fails. */\nexport const CommandFailedPayload = Schema.Struct({ commandId: CommandId, error: FailurePayload });\nexport type CommandFailedPayload = typeof CommandFailedPayload.Type;\nexport const CommandFailedEvent = durableEventSchema(commandFailedEventType, CommandFailedPayload);\nexport type CommandFailedEvent = typeof CommandFailedEvent.Type;\n\n/** Payload recorded when a command is cancelled before completion. */\nexport const CommandCancelledPayload = Schema.Struct({\n commandId: CommandId,\n reason: Schema.String,\n});\nexport type CommandCancelledPayload = typeof CommandCancelledPayload.Type;\nexport const CommandCancelledEvent = durableEventSchema(\n commandCancelledEventType,\n CommandCancelledPayload,\n);\nexport type CommandCancelledEvent = typeof CommandCancelledEvent.Type;\n\n/** Durable event union for the command lifecycle. */\nexport const CommandEvent = Schema.Union([\n CommandAdmittedEvent,\n CommandStartedEvent,\n CommandCompletedEvent,\n CommandFailedEvent,\n CommandCancelledEvent,\n]);\nexport type CommandEvent = typeof CommandEvent.Type;\n\n/** Durable reservation for the next run slot, committed before outbound delivery. */\nexport const runSchedulingRequestedEventType = makeEventType(\"RunSchedulingRequested\");\nexport const RunSchedulingRequestedPayload = RunSchedulingRequest;\nexport type RunSchedulingRequestedPayload = typeof RunSchedulingRequestedPayload.Type;\nexport const RunSchedulingRequestedEvent = durableEventSchema(\n runSchedulingRequestedEventType,\n RunSchedulingRequestedPayload,\n);\nexport type RunSchedulingRequestedEvent = typeof RunSchedulingRequestedEvent.Type;\n\n/** Acknowledgment that the external authorizer durably accepted this request. */\nexport const runSchedulingDeliveredEventType = makeEventType(\"RunSchedulingDelivered\");\nexport const RunSchedulingDeliveredPayload = Schema.Struct({ requestId: RunRequestId });\nexport type RunSchedulingDeliveredPayload = typeof RunSchedulingDeliveredPayload.Type;\nexport const RunSchedulingDeliveredEvent = durableEventSchema(\n runSchedulingDeliveredEventType,\n RunSchedulingDeliveredPayload,\n);\nexport type RunSchedulingDeliveredEvent = typeof RunSchedulingDeliveredEvent.Type;\n\n/** Revocation of a reservation whose work was cancelled, stopped, or superseded. */\nexport const runSchedulingInvalidatedEventType = makeEventType(\"RunSchedulingInvalidated\");\nexport const RunSchedulingInvalidatedPayload = Schema.Struct({\n requestId: RunRequestId,\n reason: Schema.Literals([\"stopped\", \"interrupted\", \"message-cancelled\", \"ineligible\"]),\n});\nexport type RunSchedulingInvalidatedPayload = typeof RunSchedulingInvalidatedPayload.Type;\nexport const RunSchedulingInvalidatedEvent = durableEventSchema(\n runSchedulingInvalidatedEventType,\n RunSchedulingInvalidatedPayload,\n);\nexport type RunSchedulingInvalidatedEvent = typeof RunSchedulingInvalidatedEvent.Type;\n\n/** Permission consumed atomically with RunStarted; never a standalone authorization. */\nexport const runSchedulingGrantedEventType = makeEventType(\"RunSchedulingGranted\");\nexport const RunSchedulingGrantedPayload = Schema.Struct({ requestId: RunRequestId, runId: RunId });\nexport type RunSchedulingGrantedPayload = typeof RunSchedulingGrantedPayload.Type;\nexport const RunSchedulingGrantedEvent = durableEventSchema(\n runSchedulingGrantedEventType,\n RunSchedulingGrantedPayload,\n);\nexport type RunSchedulingGrantedEvent = typeof RunSchedulingGrantedEvent.Type;\n\n/** Framework facts for durable run authorization and its strict delivery acknowledgment. */\nexport const RunSchedulingEvent = Schema.Union([\n RunSchedulingRequestedEvent,\n RunSchedulingDeliveredEvent,\n RunSchedulingInvalidatedEvent,\n RunSchedulingGrantedEvent,\n]);\nexport type RunSchedulingEvent = typeof RunSchedulingEvent.Type;\n\n/** Event type values for durable message lifecycle events. */\nexport const systemMessageCommittedEventType = makeEventType(\"SystemMessageCommitted\");\nexport const userMessageCommittedEventType = makeEventType(\"UserMessageCommitted\");\nexport const steeringMessageQueuedEventType = makeEventType(\"SteeringMessageQueued\");\nexport const steeringMessageCancelledEventType = makeEventType(\"SteeringMessageCancelled\");\nexport const userMessageSubmittedEventType = makeEventType(\"UserMessageSubmitted\");\nexport const userMessagePromotedEventType = makeEventType(\"UserMessagePromoted\");\nexport const userMessageCancelledEventType = makeEventType(\"UserMessageCancelled\");\nexport const messageQueuePausedEventType = makeEventType(\"MessageQueuePaused\");\nexport const pendingMessagesPausedEventType = makeEventType(\"PendingMessagesPaused\");\nexport const assistantMessageCommittedEventType = makeEventType(\"AssistantMessageCommitted\");\nexport const assistantMessageImportedEventType = makeEventType(\"AssistantMessageImported\");\nexport const assistantPartialCommittedEventType = makeEventType(\"AssistantPartialCommitted\");\n\n/** Semantic assistant content derived from canonical prompt parts for query convenience. */\nexport const AssistantMessageContent = Schema.Struct({\n text: Schema.String,\n reasoning: Schema.optionalKey(Schema.String),\n});\nexport type AssistantMessageContent = typeof AssistantMessageContent.Type;\n\n/** Exact assistant-role prompt parts sent to the model for cache-faithful replay. */\nexport const AssistantPromptPart = Schema.Union([\n Prompt.TextPart,\n Prompt.FilePart,\n Prompt.ReasoningPart,\n Prompt.ToolCallPart,\n Prompt.ToolResultPart,\n Prompt.ToolApprovalRequestPart,\n]);\nexport type AssistantPromptPart = typeof AssistantPromptPart.Type;\n\n/** Exact non-empty assistant-role prompt content sent to the model. */\nexport const AssistantPromptParts = Schema.NonEmptyArray(AssistantPromptPart);\nexport type AssistantPromptParts = typeof AssistantPromptParts.Type;\n\n/** Exact assistant tool-call prompt part with EDA-branded provider identity. */\nexport const ToolCallPromptPart = Schema.Struct({\n ...Prompt.ToolCallPart.fields,\n id: ProviderPartId,\n name: ToolName,\n});\nexport type ToolCallPromptPart = typeof ToolCallPromptPart.Type;\n\n/** Exact tool-role prompt part sent to the model with EDA-branded provider identity. */\nexport const ToolPromptPart = Schema.Struct({\n ...Prompt.ToolResultPart.fields,\n id: ProviderPartId,\n name: ToolName,\n});\nexport type ToolPromptPart = typeof ToolPromptPart.Type;\n\n/** Payload recorded when app instructions become durable system-message context. */\nexport const SystemMessageCommittedPayload = Schema.Struct({\n messageId: MessageId,\n content: SystemPromptText,\n});\nexport type SystemMessageCommittedPayload = typeof SystemMessageCommittedPayload.Type;\nexport const SystemMessageCommittedEvent = durableEventSchema(\n systemMessageCommittedEventType,\n SystemMessageCommittedPayload,\n);\nexport type SystemMessageCommittedEvent = typeof SystemMessageCommittedEvent.Type;\n\n/** Payload recorded when a user message becomes durable session context. */\nexport const UserMessageCommittedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n content: UserMessageContent,\n});\nexport type UserMessageCommittedPayload = typeof UserMessageCommittedPayload.Type;\nexport const UserMessageCommittedEvent = durableEventSchema(\n userMessageCommittedEventType,\n UserMessageCommittedPayload,\n);\nexport type UserMessageCommittedEvent = typeof UserMessageCommittedEvent.Type;\n\n/** Payload recorded when steering context is queued for a future turn. */\nexport const SteeringMessageQueuedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n runId: RunId,\n content: UserMessageContent,\n});\nexport type SteeringMessageQueuedPayload = typeof SteeringMessageQueuedPayload.Type;\nexport const SteeringMessageQueuedEvent = durableEventSchema(\n steeringMessageQueuedEventType,\n SteeringMessageQueuedPayload,\n);\nexport type SteeringMessageQueuedEvent = typeof SteeringMessageQueuedEvent.Type;\n\n/** Payload recorded when queued steering will never be consumed by its target run. */\nexport const SteeringMessageCancelledPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n reason: Schema.String,\n});\nexport type SteeringMessageCancelledPayload = typeof SteeringMessageCancelledPayload.Type;\nexport const SteeringMessageCancelledEvent = durableEventSchema(\n steeringMessageCancelledEventType,\n SteeringMessageCancelledPayload,\n);\nexport type SteeringMessageCancelledEvent = typeof SteeringMessageCancelledEvent.Type;\n\nexport const UserMessageDisposition = Schema.Literals([\"queue\", \"steer\"]);\nexport type UserMessageDisposition = typeof UserMessageDisposition.Type;\n\nexport const UserMessageSubmittedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n disposition: UserMessageDisposition,\n content: UserMessageContent,\n});\nexport type UserMessageSubmittedPayload = typeof UserMessageSubmittedPayload.Type;\nexport const UserMessageSubmittedEvent = durableEventSchema(\n userMessageSubmittedEventType,\n UserMessageSubmittedPayload,\n);\nexport type UserMessageSubmittedEvent = typeof UserMessageSubmittedEvent.Type;\n\nexport const UserMessagePromotedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n from: Schema.Literal(\"queue\"),\n to: Schema.Literal(\"steer\"),\n});\nexport type UserMessagePromotedPayload = typeof UserMessagePromotedPayload.Type;\nexport const UserMessagePromotedEvent = durableEventSchema(\n userMessagePromotedEventType,\n UserMessagePromotedPayload,\n);\nexport type UserMessagePromotedEvent = typeof UserMessagePromotedEvent.Type;\n\nexport const UserMessageCancellationReason = Schema.Literals([\n \"edit\",\n \"user-cancel\",\n \"clear-paused-queue\",\n]);\nexport type UserMessageCancellationReason = typeof UserMessageCancellationReason.Type;\nexport const UserMessageCancelledPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n reason: UserMessageCancellationReason,\n});\nexport type UserMessageCancelledPayload = typeof UserMessageCancelledPayload.Type;\nexport const UserMessageCancelledEvent = durableEventSchema(\n userMessageCancelledEventType,\n UserMessageCancelledPayload,\n);\nexport type UserMessageCancelledEvent = typeof UserMessageCancelledEvent.Type;\n\n/** Legacy V1 pause fact retained for replay compatibility. */\nexport const MessageQueuePausedPayload = Schema.Struct({\n stopCommandId: CommandId,\n runId: RunId,\n messageIds: Schema.Array(MessageId),\n reason: Schema.Literal(\"user-interrupted\"),\n});\nexport type MessageQueuePausedPayload = typeof MessageQueuePausedPayload.Type;\nexport const MessageQueuePausedEvent = durableEventSchema(\n messageQueuePausedEventType,\n MessageQueuePausedPayload,\n);\nexport type MessageQueuePausedEvent = typeof MessageQueuePausedEvent.Type;\n\nconst PendingMessagesPausedFields = {\n interruptionCommandId: CommandId,\n messageIds: Schema.NonEmptyArray(MessageId),\n reason: Schema.Literal(\"user-interrupted\"),\n};\n/** A pause refers to the running lifecycle or to permission still waiting before a run. */\nexport const PendingMessagesPausedPayload = Schema.Union([\n Schema.Struct({ ...PendingMessagesPausedFields, runId: RunId }),\n Schema.Struct({ ...PendingMessagesPausedFields, runRequestId: RunRequestId }),\n]);\nexport type PendingMessagesPausedPayload = typeof PendingMessagesPausedPayload.Type;\nexport const PendingMessagesPausedEvent = durableEventSchema(\n pendingMessagesPausedEventType,\n PendingMessagesPausedPayload,\n);\nexport type PendingMessagesPausedEvent = typeof PendingMessagesPausedEvent.Type;\n\n/** Payload recorded when an assistant message is durably finalized. */\nexport const AssistantMessageCommittedPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n promptParts: AssistantPromptParts,\n});\nexport type AssistantMessageCommittedPayload = typeof AssistantMessageCommittedPayload.Type;\nexport const AssistantMessageCommittedEvent = durableEventSchema(\n assistantMessageCommittedEventType,\n AssistantMessageCommittedPayload,\n);\nexport type AssistantMessageCommittedEvent = typeof AssistantMessageCommittedEvent.Type;\n\n/** Payload recorded when pre-existing assistant context is imported from an external transport. */\nexport const AssistantMessageImportedPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n promptParts: AssistantPromptParts,\n});\nexport type AssistantMessageImportedPayload = typeof AssistantMessageImportedPayload.Type;\nexport const AssistantMessageImportedEvent = durableEventSchema(\n assistantMessageImportedEventType,\n AssistantMessageImportedPayload,\n);\nexport type AssistantMessageImportedEvent = typeof AssistantMessageImportedEvent.Type;\n\n/** Payload recorded when a partial assistant message is preserved durably. */\nexport const AssistantPartialCommittedPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n promptParts: AssistantPromptParts,\n reason: Schema.String,\n});\nexport type AssistantPartialCommittedPayload = typeof AssistantPartialCommittedPayload.Type;\nexport const AssistantPartialCommittedEvent = durableEventSchema(\n assistantPartialCommittedEventType,\n AssistantPartialCommittedPayload,\n);\nexport type AssistantPartialCommittedEvent = typeof AssistantPartialCommittedEvent.Type;\n\n/** Durable event union for message commit/queue boundaries. */\nexport const MessageEvent = Schema.Union([\n SystemMessageCommittedEvent,\n UserMessageCommittedEvent,\n SteeringMessageQueuedEvent,\n SteeringMessageCancelledEvent,\n UserMessageSubmittedEvent,\n UserMessagePromotedEvent,\n UserMessageCancelledEvent,\n MessageQueuePausedEvent,\n PendingMessagesPausedEvent,\n AssistantMessageCommittedEvent,\n AssistantMessageImportedEvent,\n AssistantPartialCommittedEvent,\n]);\nexport type MessageEvent = typeof MessageEvent.Type;\n\n/** Event type values for durable run lifecycle events. */\nexport const runStartedEventType = makeEventType(\"RunStarted\");\nexport const runCompletedEventType = makeEventType(\"RunCompleted\");\nexport const runFailedEventType = makeEventType(\"RunFailed\");\n/** @deprecated Legacy terminal retained for durable replay. Emit `RunFailed` with an interruption-coded `FailurePayload` instead. */\nexport const runInterruptedEventType = makeEventType(\"RunInterrupted\");\n\n/** Payload recorded when a run starts with its intended model selection. */\nexport const RunStartedPayload = Schema.Struct({\n runId: RunId,\n commandIds: Schema.Array(CommandId),\n modelSelection: ModelSelectionPayload,\n trace: EDARunTrace.pipe(Schema.withConstructorDefault(Effect.sync(() => makeEDARunTrace()))),\n});\nexport type RunStartedPayload = typeof RunStartedPayload.Type;\nexport const RunStartedEvent = durableEventSchema(runStartedEventType, RunStartedPayload);\nexport type RunStartedEvent = typeof RunStartedEvent.Type;\n\n/** Payload recorded when a run completes. */\nexport const RunCompletedPayload = Schema.Struct({ runId: RunId });\nexport type RunCompletedPayload = typeof RunCompletedPayload.Type;\nexport const RunCompletedEvent = durableEventSchema(runCompletedEventType, RunCompletedPayload);\nexport type RunCompletedEvent = typeof RunCompletedEvent.Type;\n\n/** Payload recorded when a run fails. */\nexport const RunFailedPayload = Schema.Struct({ runId: RunId, error: FailurePayload });\nexport type RunFailedPayload = typeof RunFailedPayload.Type;\nexport const RunFailedEvent = durableEventSchema(runFailedEventType, RunFailedPayload);\nexport type RunFailedEvent = typeof RunFailedEvent.Type;\n\n/** @deprecated Legacy payload retained for durable replay. New interruptions use `RunFailedPayload` with `error.code = \"run.interrupted\"`. */\nexport const RunInterruptedPayload = Schema.Struct({ runId: RunId, reason: Schema.String });\n/** @deprecated Use `RunFailedPayload` with interruption metadata. */\nexport type RunInterruptedPayload = typeof RunInterruptedPayload.Type;\n/** @deprecated Legacy event schema retained for durable replay; new producers emit `RunFailedEvent`. */\nexport const RunInterruptedEvent = durableEventSchema(\n runInterruptedEventType,\n RunInterruptedPayload,\n);\n/** @deprecated Use `RunFailedEvent` with interruption metadata. */\nexport type RunInterruptedEvent = typeof RunInterruptedEvent.Type;\n\n/** Durable event union for run lifecycle boundaries. */\nexport const RunEvent = Schema.Union([\n RunStartedEvent,\n RunCompletedEvent,\n RunFailedEvent,\n RunInterruptedEvent,\n]);\nexport type RunEvent = typeof RunEvent.Type;\n\n/** Event type value for the durable barrier written after real startup recovery work. */\nexport const recoveryCompletedEventType = makeEventType(\"RecoveryCompleted\");\n\n/** Explicit relationship between an interrupted run and its startup-recovery replacement. */\nexport const RecoveryContinuation = Schema.Struct({\n commandId: CommandId,\n interruptedRunId: RunId,\n replacementRunId: RunId,\n});\nexport type RecoveryContinuation = typeof RecoveryContinuation.Type;\n\n/**\n * Durable completion barrier for a startup recovery transaction that repaired\n * unfinished state. Idle runtime construction does not emit this event.\n */\nexport const RecoveryCompletedPayload = Schema.Struct({\n trigger: Schema.Literal(\"runtime-restart\"),\n continuation: Schema.optionalKey(RecoveryContinuation),\n});\nexport type RecoveryCompletedPayload = typeof RecoveryCompletedPayload.Type;\nexport const RecoveryCompletedEvent = durableEventSchema(\n recoveryCompletedEventType,\n RecoveryCompletedPayload,\n);\nexport type RecoveryCompletedEvent = typeof RecoveryCompletedEvent.Type;\n\n/** Durable facts written only by the framework startup-recovery transaction. */\nexport const RecoveryEvent = RecoveryCompletedEvent;\nexport type RecoveryEvent = typeof RecoveryEvent.Type;\n\n/** Event type values for durable turn lifecycle events. */\nexport const turnStartedEventType = makeEventType(\"TurnStarted\");\nexport const turnCompletedEventType = makeEventType(\"TurnCompleted\");\nexport const turnFailedEventType = makeEventType(\"TurnFailed\");\n/** @deprecated Legacy terminal retained for durable replay. Emit `TurnFailed` with an interruption-coded `FailurePayload` instead. */\nexport const turnStoppedEventType = makeEventType(\"TurnStopped\");\n\n/** Payload recorded when one turn starts inside a run. */\nexport const TurnStartedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inputMessageIds: Schema.optionalKey(Schema.Array(MessageId)),\n});\nexport type TurnStartedPayload = typeof TurnStartedPayload.Type;\nexport const TurnStartedEvent = durableEventSchema(turnStartedEventType, TurnStartedPayload);\nexport type TurnStartedEvent = typeof TurnStartedEvent.Type;\n\n/** Payload recorded when one turn completes. */\nexport const TurnCompletedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n usage: Schema.optionalKey(UsagePayload),\n});\nexport type TurnCompletedPayload = typeof TurnCompletedPayload.Type;\nexport const TurnCompletedEvent = durableEventSchema(turnCompletedEventType, TurnCompletedPayload);\nexport type TurnCompletedEvent = typeof TurnCompletedEvent.Type;\n\n/** Payload recorded when one turn fails. */\nexport const TurnFailedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n error: FailurePayload,\n});\nexport type TurnFailedPayload = typeof TurnFailedPayload.Type;\nexport const TurnFailedEvent = durableEventSchema(turnFailedEventType, TurnFailedPayload);\nexport type TurnFailedEvent = typeof TurnFailedEvent.Type;\n\n/** @deprecated Legacy payload retained for durable replay. New stops use `TurnFailedPayload` with `error.code = \"turn.interrupted\"`. */\nexport const TurnStoppedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n reason: Schema.String,\n});\n/** @deprecated Use `TurnFailedPayload` with interruption metadata. */\nexport type TurnStoppedPayload = typeof TurnStoppedPayload.Type;\n/** @deprecated Legacy event schema retained for durable replay; new producers emit `TurnFailedEvent`. */\nexport const TurnStoppedEvent = durableEventSchema(turnStoppedEventType, TurnStoppedPayload);\n/** @deprecated Use `TurnFailedEvent` with interruption metadata. */\nexport type TurnStoppedEvent = typeof TurnStoppedEvent.Type;\n\n/** Durable event union for turn lifecycle boundaries. */\nexport const TurnEvent = Schema.Union([\n TurnStartedEvent,\n TurnCompletedEvent,\n TurnFailedEvent,\n TurnStoppedEvent,\n]);\nexport type TurnEvent = typeof TurnEvent.Type;\n\n/** Event type values for durable model-inference lifecycle events. */\nexport const inferenceStartedEventType = makeEventType(\"InferenceStarted\");\nexport const inferenceCompletedEventType = makeEventType(\"InferenceCompleted\");\nexport const inferenceFailedEventType = makeEventType(\"InferenceFailed\");\n\n/** Payload recorded when one model inference starts for a turn. */\nexport const InferenceStartedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n});\nexport type InferenceStartedPayload = typeof InferenceStartedPayload.Type;\nexport const InferenceStartedEvent = durableEventSchema(\n inferenceStartedEventType,\n InferenceStartedPayload,\n);\nexport type InferenceStartedEvent = typeof InferenceStartedEvent.Type;\n\n/** Payload recorded when one model inference completes. */\nexport const InferenceCompletedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n finishReason: Schema.optionalKey(Schema.String),\n usage: Schema.optionalKey(UsagePayload),\n responseMetadata: Schema.optionalKey(Schema.Unknown),\n finishMetadata: Schema.optionalKey(Schema.Unknown),\n});\nexport type InferenceCompletedPayload = typeof InferenceCompletedPayload.Type;\nexport const InferenceCompletedEvent = durableEventSchema(\n inferenceCompletedEventType,\n InferenceCompletedPayload,\n);\nexport type InferenceCompletedEvent = typeof InferenceCompletedEvent.Type;\n\n/** Payload recorded when one model inference fails or is interrupted. */\nexport const InferenceFailedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n error: FailurePayload,\n});\nexport type InferenceFailedPayload = typeof InferenceFailedPayload.Type;\nexport const InferenceFailedEvent = durableEventSchema(\n inferenceFailedEventType,\n InferenceFailedPayload,\n);\nexport type InferenceFailedEvent = typeof InferenceFailedEvent.Type;\n\n/** Durable event union for canonical model-inference lifecycle boundaries. */\nexport const InferenceEvent = Schema.Union([\n InferenceStartedEvent,\n InferenceCompletedEvent,\n InferenceFailedEvent,\n]);\nexport type InferenceEvent = typeof InferenceEvent.Type;\n\n/** Event type values for durable tool lifecycle events. */\nexport const toolCallCreatedEventType = makeEventType(\"ToolCallCreated\");\nexport const toolCallRejectedEventType = makeEventType(\"ToolCallRejected\");\nexport const toolCallStartedEventType = makeEventType(\"ToolCallStarted\");\nexport const toolCallCompletedEventType = makeEventType(\"ToolCallCompleted\");\nexport const toolCallFailedEventType = makeEventType(\"ToolCallFailed\");\n\n/** Reason a model-requested tool call was rejected before execution. */\nexport const ToolCallRejectionReason = Schema.Literals([\"unknown-tool\", \"invalid-params\"]);\nexport type ToolCallRejectionReason = typeof ToolCallRejectionReason.Type;\n\n/** Exact synthetic tool-result feedback for a rejected model-requested tool call. */\nexport const ToolCallRejectionFeedback = Schema.Struct({\n message: Schema.String,\n reason: ToolCallRejectionReason,\n modelFeedback: Schema.NonEmptyString,\n});\nexport type ToolCallRejectionFeedback = typeof ToolCallRejectionFeedback.Type;\n\n/** Exact prompt part for a rejected model-requested tool call. */\nexport const ToolRejectionPromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(true),\n result: ToolCallRejectionFeedback,\n});\nexport type ToolRejectionPromptPart = typeof ToolRejectionPromptPart.Type;\n\n/** Exact prompt part for a successful framework-owned tool result. */\nexport const ToolSuccessPromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(false),\n result: Schema.Unknown,\n});\nexport type ToolSuccessPromptPart = typeof ToolSuccessPromptPart.Type;\n\n/** Exact prompt part for a failed framework-owned tool result. */\nexport const ToolFailurePromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(true),\n result: FailurePayload,\n});\nexport type ToolFailurePromptPart = typeof ToolFailurePromptPart.Type;\n\n/** Payload recorded once streamed tool parameters validate and become executable. */\nexport const ToolCallCreatedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n toolCallId: ToolCallId,\n promptPart: ToolCallPromptPart,\n});\nexport type ToolCallCreatedPayload = typeof ToolCallCreatedPayload.Type;\nexport const ToolCallCreatedEvent = durableEventSchema(\n toolCallCreatedEventType,\n ToolCallCreatedPayload,\n);\nexport type ToolCallCreatedEvent = typeof ToolCallCreatedEvent.Type;\n\n/** Payload recorded when a model-requested tool call is not executable. */\nexport const ToolCallRejectedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n toolCallId: ToolCallId,\n promptPart: ToolRejectionPromptPart,\n});\nexport type ToolCallRejectedPayload = typeof ToolCallRejectedPayload.Type;\nexport const ToolCallRejectedEvent = durableEventSchema(\n toolCallRejectedEventType,\n ToolCallRejectedPayload,\n);\nexport type ToolCallRejectedEvent = typeof ToolCallRejectedEvent.Type;\n\n/**\n * One execution attempt of a framework-owned tool call. The first start carries no `attempt`\n * (attempt 1). Startup recovery re-invokes a started call whose tool declares\n * `ToolRecovery: \"reinvoke\"` by committing another start with the next `attempt` before\n * running it, so the attempt count survives a runtime that dies again mid-reinvocation.\n */\nexport const ToolCallStartedPayload = Schema.Struct({\n toolCallId: ToolCallId,\n attempt: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(2))),\n});\nexport type ToolCallStartedPayload = typeof ToolCallStartedPayload.Type;\nexport const ToolCallStartedEvent = durableEventSchema(\n toolCallStartedEventType,\n ToolCallStartedPayload,\n);\nexport type ToolCallStartedEvent = typeof ToolCallStartedEvent.Type;\n\n/** Payload recorded when a tool call completes with a result. */\nexport const ToolCallCompletedPayload = Schema.Struct({\n toolCallId: ToolCallId,\n promptPart: ToolSuccessPromptPart,\n});\nexport type ToolCallCompletedPayload = typeof ToolCallCompletedPayload.Type;\nexport const ToolCallCompletedEvent = durableEventSchema(\n toolCallCompletedEventType,\n ToolCallCompletedPayload,\n);\nexport type ToolCallCompletedEvent = typeof ToolCallCompletedEvent.Type;\n\n/** Payload recorded when a tool call fails. */\nexport const ToolCallFailedPayload = Schema.Struct({\n toolCallId: ToolCallId,\n error: Schema.optionalKey(FailurePayload),\n promptPart: ToolFailurePromptPart,\n});\nexport type ToolCallFailedPayload = typeof ToolCallFailedPayload.Type;\nexport const ToolCallFailedEvent = durableEventSchema(\n toolCallFailedEventType,\n ToolCallFailedPayload,\n);\nexport type ToolCallFailedEvent = typeof ToolCallFailedEvent.Type;\n\n/** Durable event union for tool lifecycle boundaries. */\nexport const ToolCallEvent = Schema.Union([\n ToolCallCreatedEvent,\n ToolCallRejectedEvent,\n ToolCallStartedEvent,\n ToolCallCompletedEvent,\n ToolCallFailedEvent,\n]);\nexport type ToolCallEvent = typeof ToolCallEvent.Type;\n\n/** Event type values for durable stop-control events. */\nexport const stopTurnRequestedEventType = makeEventType(\"StopTurnRequested\");\nexport const stopTurnAppliedEventType = makeEventType(\"StopTurnApplied\");\n\n/** Payload recorded when a stop command targets active or future turn work. */\nexport const StopTurnRequestedPayload = Schema.Struct({\n commandId: CommandId,\n runId: Schema.optionalKey(RunId),\n turnId: Schema.optionalKey(TurnId),\n});\nexport type StopTurnRequestedPayload = typeof StopTurnRequestedPayload.Type;\nexport const StopTurnRequestedEvent = durableEventSchema(\n stopTurnRequestedEventType,\n StopTurnRequestedPayload,\n);\nexport type StopTurnRequestedEvent = typeof StopTurnRequestedEvent.Type;\n\n/** Payload recorded when a stop request has affected runtime work. */\nexport const StopTurnAppliedPayload = Schema.Struct({\n commandId: CommandId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: Schema.optionalKey(InferenceId),\n});\nexport type StopTurnAppliedPayload = typeof StopTurnAppliedPayload.Type;\nexport const StopTurnAppliedEvent = durableEventSchema(\n stopTurnAppliedEventType,\n StopTurnAppliedPayload,\n);\nexport type StopTurnAppliedEvent = typeof StopTurnAppliedEvent.Type;\n\n/** Durable event union for stop-request lifecycle boundaries. */\nexport const StopControlEvent = Schema.Union([StopTurnRequestedEvent, StopTurnAppliedEvent]);\nexport type StopControlEvent = typeof StopControlEvent.Type;\n\n/** Event type values for durable context and compaction events. */\nexport const contextProjectedEventType = makeEventType(\"ContextProjected\");\nexport const compactionRequestedEventType = makeEventType(\"CompactionRequested\");\nexport const compactionStartedEventType = makeEventType(\"CompactionStarted\");\nexport const summaryCreatedEventType = makeEventType(\"SummaryCreated\");\nexport const compactionCompletedEventType = makeEventType(\"CompactionCompleted\");\nexport const contextRebasedEventType = makeEventType(\"ContextRebased\");\nexport const compactionFailedEventType = makeEventType(\"CompactionFailed\");\n\n/** Payload recorded when the prompt context projection advances. */\nexport const ContextProjectedPayload = Schema.Struct({\n contextVersion: ContextVersion,\n throughSeq: SequenceNumber,\n});\nexport type ContextProjectedPayload = typeof ContextProjectedPayload.Type;\nexport const ContextProjectedEvent = durableEventSchema(\n contextProjectedEventType,\n ContextProjectedPayload,\n);\nexport type ContextProjectedEvent = typeof ContextProjectedEvent.Type;\n\n/** Payload recorded when compaction is requested for a durable range. */\nexport const CompactionRequestedPayload = Schema.Struct({\n compactionId: CompactionId,\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n});\nexport type CompactionRequestedPayload = typeof CompactionRequestedPayload.Type;\nexport const CompactionRequestedEvent = durableEventSchema(\n compactionRequestedEventType,\n CompactionRequestedPayload,\n);\nexport type CompactionRequestedEvent = typeof CompactionRequestedEvent.Type;\n\n/** Payload recorded when compaction starts. */\nexport const CompactionStartedPayload = Schema.Struct({ compactionId: CompactionId });\nexport type CompactionStartedPayload = typeof CompactionStartedPayload.Type;\nexport const CompactionStartedEvent = durableEventSchema(\n compactionStartedEventType,\n CompactionStartedPayload,\n);\nexport type CompactionStartedEvent = typeof CompactionStartedEvent.Type;\n\n/** Payload recorded when a summary artifact is created. */\nexport const SummaryCreatedPayload = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n summary: Schema.Unknown,\n});\nexport type SummaryCreatedPayload = typeof SummaryCreatedPayload.Type;\nexport const SummaryCreatedEvent = durableEventSchema(\n summaryCreatedEventType,\n SummaryCreatedPayload,\n);\nexport type SummaryCreatedEvent = typeof SummaryCreatedEvent.Type;\n\n/** Payload recorded when compaction completes. */\nexport const CompactionCompletedPayload = Schema.Struct({\n compactionId: CompactionId,\n modelSelection: Schema.optionalKey(ModelSelectionPayload),\n usage: Schema.optionalKey(UsagePayload),\n});\nexport type CompactionCompletedPayload = typeof CompactionCompletedPayload.Type;\nexport const CompactionCompletedEvent = durableEventSchema(\n compactionCompletedEventType,\n CompactionCompletedPayload,\n);\nexport type CompactionCompletedEvent = typeof CompactionCompletedEvent.Type;\n\n/** Payload recorded when durable context is rebased onto a summary. */\nexport const ContextRebasedPayload = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n contextVersion: ContextVersion,\n retainedFromContextSeq: SequenceNumber,\n});\nexport type ContextRebasedPayload = typeof ContextRebasedPayload.Type;\nexport const ContextRebasedEvent = durableEventSchema(\n contextRebasedEventType,\n ContextRebasedPayload,\n);\nexport type ContextRebasedEvent = typeof ContextRebasedEvent.Type;\n\n/** Payload recorded when compaction fails. */\nexport const CompactionFailedPayload = Schema.Struct({\n compactionId: CompactionId,\n error: FailurePayload,\n modelSelection: Schema.optionalKey(ModelSelectionPayload),\n usage: Schema.optionalKey(UsagePayload),\n});\nexport type CompactionFailedPayload = typeof CompactionFailedPayload.Type;\nexport const CompactionFailedEvent = durableEventSchema(\n compactionFailedEventType,\n CompactionFailedPayload,\n);\nexport type CompactionFailedEvent = typeof CompactionFailedEvent.Type;\n\n/** Durable event union for context projection and compaction boundaries. */\nexport const ContextAndCompactionEvent = Schema.Union([\n ContextProjectedEvent,\n CompactionRequestedEvent,\n CompactionStartedEvent,\n SummaryCreatedEvent,\n CompactionCompletedEvent,\n ContextRebasedEvent,\n CompactionFailedEvent,\n]);\nexport type ContextAndCompactionEvent = typeof ContextAndCompactionEvent.Type;\n\n/** Event type values for durable BaseState lifecycle events. */\nexport const baseStateRequestedEventType = makeEventType(\"BaseStateRequested\");\nexport const baseStateCreatedEventType = makeEventType(\"BaseStateCreated\");\nexport const baseStateFailedEventType = makeEventType(\"BaseStateFailed\");\n\n/** Payload recorded when durable BaseState generation is requested. */\nexport const BaseStateRequestedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n requestedThroughSeq: SequenceNumber,\n});\nexport type BaseStateRequestedPayload = typeof BaseStateRequestedPayload.Type;\nexport const BaseStateRequestedEvent = durableEventSchema(\n baseStateRequestedEventType,\n BaseStateRequestedPayload,\n);\nexport type BaseStateRequestedEvent = typeof BaseStateRequestedEvent.Type;\n\n/** Payload recorded when a BaseState snapshot is created. */\nexport const BaseStateCreatedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n coversThroughSeq: SequenceNumber,\n});\nexport type BaseStateCreatedPayload = typeof BaseStateCreatedPayload.Type;\nexport const BaseStateCreatedEvent = durableEventSchema(\n baseStateCreatedEventType,\n BaseStateCreatedPayload,\n);\nexport type BaseStateCreatedEvent = typeof BaseStateCreatedEvent.Type;\n\n/** Payload recorded when BaseState generation fails. */\nexport const BaseStateFailedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n error: FailurePayload,\n});\nexport type BaseStateFailedPayload = typeof BaseStateFailedPayload.Type;\nexport const BaseStateFailedEvent = durableEventSchema(\n baseStateFailedEventType,\n BaseStateFailedPayload,\n);\nexport type BaseStateFailedEvent = typeof BaseStateFailedEvent.Type;\n\n/** Durable event union for BaseState lifecycle boundaries. */\nexport const BaseStateEvent = Schema.Union([\n BaseStateRequestedEvent,\n BaseStateCreatedEvent,\n BaseStateFailedEvent,\n]);\nexport type BaseStateEvent = typeof BaseStateEvent.Type;\n\n/** Retained pre-inference lifecycle facts. Attempt identities remain unchanged in storage and on wire. */\nexport const LegacyTurnAttemptStartedEvent = durableEventSchema(\n makeEventType(\"TurnAttemptStarted\"),\n Schema.Struct({ runId: RunId, turnId: TurnId, attemptId: InferenceId }),\n);\n\n/** A successful historical provider request; multiple attempts can belong to one historical turn. */\nexport const LegacyTurnAttemptCompletedEvent = durableEventSchema(\n makeEventType(\"TurnAttemptCompleted\"),\n Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n attemptId: InferenceId,\n finishReason: Schema.optionalKey(Schema.String),\n usage: Schema.optionalKey(UsagePayload),\n responseMetadata: Schema.optionalKey(Schema.Unknown),\n finishMetadata: Schema.optionalKey(Schema.Unknown),\n }),\n);\n\n/** Historical assistant content links to the original attempt rather than a renamed event. */\nexport const LegacyAssistantMessageCommittedEvent = durableEventSchema(\n assistantMessageCommittedEventType,\n Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n attemptId: InferenceId,\n promptParts: AssistantPromptParts,\n }),\n);\n\n/** Historical tool decisions retain their attempt and turn references during replay. */\nexport const LegacyToolCallCreatedEvent = durableEventSchema(\n toolCallCreatedEventType,\n Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n attemptId: InferenceId,\n toolCallId: ToolCallId,\n promptPart: ToolCallPromptPart,\n }),\n);\n\n/** Explicitly supported historical shapes; unknown event types and versions remain errors. */\nexport const LegacyAttemptEvent = Schema.Union([\n LegacyTurnAttemptStartedEvent,\n LegacyTurnAttemptCompletedEvent,\n LegacyAssistantMessageCommittedEvent,\n LegacyToolCallCreatedEvent,\n]);\n\n/**\n * Interprets retained attempt references solely for domain folding. It never changes the stored\n * envelope, stream position, or wire event. Historical turns retain all of their attempts;\n * this deliberately does not split turns or manufacture lifecycle events.\n */\nexport const interpretLegacyAttemptForReduction = (\n event: EDADurableEvent,\n): CurrentEDADurableEvent => {\n if (event.type === \"TurnAttemptStarted\") {\n return {\n ...event,\n type: inferenceStartedEventType,\n payload: { ...event.payload, inferenceId: event.payload.attemptId },\n };\n }\n if (event.type === \"TurnAttemptCompleted\") {\n return {\n ...event,\n type: inferenceCompletedEventType,\n payload: { ...event.payload, inferenceId: event.payload.attemptId },\n };\n }\n if (Schema.is(AssistantMessageCommittedEvent)(event) || Schema.is(ToolCallCreatedEvent)(event)) {\n return event;\n }\n if (isLegacyAssistant(event)) {\n return { ...event, payload: { ...event.payload, inferenceId: event.payload.attemptId } };\n }\n if (isLegacyToolCall(event)) {\n return { ...event, payload: { ...event.payload, inferenceId: event.payload.attemptId } };\n }\n return event;\n};\n\nconst isLegacyAssistant = (\n event: EDADurableEvent,\n): event is typeof LegacyAssistantMessageCommittedEvent.Type =>\n event.type === assistantMessageCommittedEventType && \"attemptId\" in event.payload;\nconst isLegacyToolCall = (\n event: EDADurableEvent,\n): event is typeof LegacyToolCallCreatedEvent.Type =>\n event.type === toolCallCreatedEventType && \"attemptId\" in event.payload;\n\n/** Built-in durable event union for framework-owned session facts, including retained historical schemas. */\nexport const CurrentEDADurableEvent = Schema.Union([\n SessionConfiguredEvent,\n RunSchedulingEvent,\n CommandEvent,\n MessageEvent,\n RunEvent,\n RecoveryEvent,\n TurnEvent,\n InferenceEvent,\n ToolCallEvent,\n StopControlEvent,\n ContextAndCompactionEvent,\n BaseStateEvent,\n]);\nexport type CurrentEDADurableEvent = typeof CurrentEDADurableEvent.Type;\n/** Retained historical facts remain readable without rewriting the event journal. */\nexport const EDADurableEvent = Schema.Union([LegacyAttemptEvent, CurrentEDADurableEvent]);\nexport type EDADurableEvent = typeof EDADurableEvent.Type;\n\n/** Current V1 framework durable event schema. Future versions route beside this alias. */\nexport const EDADurableEventV1 = EDADurableEvent;\nexport type EDADurableEventV1 = typeof EDADurableEventV1.Type;\n\n/** Framework facts from other EDA versions keep payload fields this version does not model. */\nconst decodeEDADurableEventV1 = decodeRetainingExcess(EDADurableEventV1);\n\n/** Decode one framework-owned durable event through the namespace/type/version router. */\nexport const decodeUnknownEDADurableEventSync = (input: unknown): EDADurableEvent => {\n return decodeFrameworkEnvelope(Schema.decodeUnknownSync(DurableEventEnvelope)(input));\n};\n\nconst decodeFrameworkEnvelope = (envelope: DurableEventEnvelope): EDADurableEvent => {\n if (envelope.namespace !== effectDurableAgentNamespace) {\n throw new Error(\n `EDADurableEvent decoder only accepts namespace ${effectDurableAgentNamespace}; received ${envelope.namespace}`,\n );\n }\n\n switch (envelope.schemaVersion) {\n case schemaV1:\n return decodeEDADurableEventV1(envelope);\n default:\n throw new Error(\n `Unsupported EDA durable event schemaVersion ${envelope.schemaVersion} for ${envelope.type}`,\n );\n }\n};\n\n/** Effectful V1+ router for untrusted framework-owned durable event boundaries. */\nexport const decodeUnknownEDADurableEvent = (\n input: unknown,\n): Effect.Effect<EDADurableEvent, unknown> =>\n Effect.try({\n try: () => decodeUnknownEDADurableEventSync(input),\n catch: (error) => error,\n });\n\n/** Decoded internal facts distinguish framework events from explicitly opaque foreign envelopes. */\nexport const DecodedDurableEvent = Schema.Union([EDADurableEvent, ForeignDurableEvent]);\nexport type DecodedDurableEvent = typeof DecodedDurableEvent.Type;\n\n/** Restore the original envelope at persistence and protocol boundaries. */\nexport const durableEventEnvelope = (\n event: DecodedDurableEvent | DurableEventEnvelope,\n): DurableEventEnvelope =>\n \"envelope\" in event && Schema.is(ForeignDurableEvent)(event) ? event.envelope : event;\n\n/** Decode a durable envelope once at the store boundary, preserving foreign namespaces opaquely. */\nexport const decodeDurableEventSync = (input: unknown): DecodedDurableEvent => {\n const envelope = Schema.decodeUnknownSync(DurableEventEnvelope)(input);\n if (envelope.namespace === effectDurableAgentNamespace) return decodeFrameworkEnvelope(envelope);\n return { ...envelope, namespace: \"__foreign\", type: \"Foreign\", _tag: \"Foreign\", envelope };\n};\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,sBACX,MACA,YAEA,OAAO,OAAO;CACZ,GAAG,qBAAqB;CACxB,WAAW,OAAO,QAAQ,2BAA2B;CACrD,MAAM,OAAO,QAAQ,IAAI;CACzB,eAAe,OAAO,QAAQ,QAAQ;C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AO,SAAS,MACxF;CACJ;AACF;;AAGA,MAAa,gCACX,UAEA,OAAO,IAAI;CACT,WAAW,iCAAiC,KAAK;CACjD,QAAQ,UAAU;AACpB,CAAC;;AAGH,MAAa,sBAAsB,OAAO,MAAM,CAAC,iBAAiB,mBAAmB,CAAC;;AAItF,MAAa,wBACX,UAEA,cAAc,SAAS,OAAO,GAAG,mBAAmB,CAAC,CAAC,KAAK,IAAI,MAAM,WAAW;;AAGlF,MAAa,0BAA0B,UAAwC;CAC7E,MAAM,WAAW,OAAO,kBAAkB,oBAAoB,CAAC,CAAC,KAAK;CACrE,IAAI,SAAS,cAAA,wBAA2C,OAAO,wBAAwB,QAAQ;CAC/F,OAAO;EAAE,GAAG;EAAU,WAAW;EAAa,MAAM;EAAW,MAAM;EAAW;CAAS;AAC3F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"envelope-BCzKUq_z.js","names":[],"sources":["../src/types/events/envelope.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport { CorrelationId, EventId, Position, SessionId } from \"../core\";\nimport { EDAEventTrace, makeRootEDAEventTrace } from \"../tracing\";\n\n/** Event namespace, such as `effect-durable-agent`, `sandbox`, or `gia`. */\nexport const EventNamespace = Schema.NonEmptyString;\nexport type EventNamespace = typeof EventNamespace.Type;\n\n/** Event type within a namespace, such as `CommandAdmitted` or `TextDelta`. */\nexport const EventType = Schema.NonEmptyString;\nexport type EventType = typeof EventType.Type;\n\n/** Build a non-empty event type while preserving its string literal for exhaustive unions. */\nexport const makeEventType = <const Value extends string>(\n value: Value extends \"\" ? never : Value,\n) => value;\n\n/** Extract the literal name retained by `makeEventType`. */\nexport type EventTypeName<Type extends EventType> = Type;\n\n/** Provider-supplied stream part identity, preserved for correlation/debugging. */\nexport const ProviderPartId = Schema.NonEmptyString.pipe(Schema.brand(\"ProviderPartId\"));\nexport type ProviderPartId = typeof ProviderPartId.Type;\n\n/** Positive schema version for one namespace/type payload contract. */\nexport const SchemaVersion = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));\nexport type SchemaVersion = typeof SchemaVersion.Type;\n\n/** Milliseconds since unix epoch, represented as a non-negative integer. */\nexport const UnixEpochMillis = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(\n Schema.brand(\"UnixEpochMillis\"),\n);\nexport type UnixEpochMillis = typeof UnixEpochMillis.Type;\n\n/** Whether an event is persisted or live-only. */\nexport const EventDurability = Schema.Literals([\"durable\", \"ephemeral\"]);\nexport type EventDurability = typeof EventDurability.Type;\n\n/** Common event envelope decoded before payload-specific schemas. */\nexport const EventEnvelope = Schema.Struct({\n namespace: EventNamespace,\n type: EventType,\n schemaVersion: SchemaVersion,\n durability: EventDurability,\n eventId: EventId,\n sessionId: SessionId,\n correlationId: Schema.optionalKey(CorrelationId),\n createdAtMs: UnixEpochMillis,\n trace: EDAEventTrace.pipe(Schema.withConstructorDefault(Effect.sync(makeRootEDAEventTrace))),\n payload: Schema.Unknown,\n});\nexport type EventEnvelope = typeof EventEnvelope.Type;\n\n/** Common envelope narrowed to committed durable events. */\nexport const DurableEventEnvelope = Schema.Struct({\n ...EventEnvelope.fields,\n durability: Schema.Literal(\"durable\"),\n});\nexport type DurableEventEnvelope = typeof DurableEventEnvelope.Type;\n\n/** Opaque facts from namespaces outside the framework; the original envelope owns all bytes. */\nexport const ForeignDurableEvent = Schema.Struct({\n ...DurableEventEnvelope.fields,\n namespace: Schema.Literal(\"__foreign\"),\n type: Schema.Literal(\"Foreign\"),\n _tag: Schema.Literal(\"Foreign\"),\n envelope: DurableEventEnvelope,\n decoded: Schema.optionalKey(Schema.Unknown),\n});\nexport type ForeignDurableEvent = typeof ForeignDurableEvent.Type;\n\n/** Common envelope narrowed to live-only ephemeral events. */\nexport const EphemeralEventEnvelope = Schema.Struct({\n ...EventEnvelope.fields,\n durability: Schema.Literal(\"ephemeral\"),\n});\nexport type EphemeralEventEnvelope = typeof EphemeralEventEnvelope.Type;\n\n/** Event delivered to live subscribers with its durable/ephemeral position. */\nexport const PositionedEvent = Schema.Struct({\n position: Position,\n event: EventEnvelope,\n});\nexport type PositionedEvent<E = EventEnvelope> = {\n readonly position: typeof Position.Type;\n readonly event: E;\n};\n\n/** Built-in framework event namespace. */\nexport const effectDurableAgentNamespace = \"effect-durable-agent\";\n\n/** Initial schema version for built-in event payloads. */\nexport const schemaV1 = SchemaVersion.make(1);\n\n/** Non-negative integer used by token counts and similar counters. */\nexport const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\nexport type NonNegativeInt = typeof NonNegativeInt.Type;\n\n/** Registered tool name; plain non-empty text, not a lifecycle identity. */\nexport const ToolName = Schema.NonEmptyString;\nexport type ToolName = typeof ToolName.Type;\n\n/** Error details stored on failed lifecycle events. */\nexport const FailurePayload = Schema.Struct({\n message: Schema.String,\n code: Schema.optionalKey(Schema.String),\n details: Schema.optionalKey(Schema.Unknown),\n});\nexport type FailurePayload = typeof FailurePayload.Type;\n\n/** Token usage reported by a model provider when available. */\nexport const UsagePayload = Schema.Struct({\n inputTokens: Schema.optionalKey(NonNegativeInt),\n cachedInputTokens: Schema.optionalKey(NonNegativeInt),\n cacheWriteInputTokens: Schema.optionalKey(NonNegativeInt),\n outputTokens: Schema.optionalKey(NonNegativeInt),\n textTokens: Schema.optionalKey(NonNegativeInt),\n reasoningTokens: Schema.optionalKey(NonNegativeInt),\n});\nexport type UsagePayload = typeof UsagePayload.Type;\n\n/** Intended provider/model selection known before a model request starts. */\nexport const ModelSelectionPayload = Schema.Struct({\n provider: Schema.NonEmptyString,\n modelId: Schema.NonEmptyString,\n settings: Schema.optionalKey(Schema.Unknown),\n});\nexport type ModelSelectionPayload = typeof ModelSelectionPayload.Type;\n\n/** App-owned instructions inserted into model context as a system message. */\nexport const SystemPromptText = Schema.NonEmptyString;\nexport type SystemPromptText = typeof SystemPromptText.Type;\n"],"mappings":";;;;;;AAOA,MAAa,iBAAiB,OAAO;;AAIrC,MAAa,YAAY,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