effect-durable-agent 0.1.0-alpha.29 → 0.1.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{compaction-ajHZ5l7f.js → compaction-63iEDHHl.js} +2 -2
- package/dist/{compaction-ajHZ5l7f.js.map → compaction-63iEDHHl.js.map} +1 -1
- package/dist/{delivery-Bb7pkQ9o.js → delivery-2ZILvoRD.js} +2 -2
- package/dist/{delivery-Bb7pkQ9o.js.map → delivery-2ZILvoRD.js.map} +1 -1
- package/dist/{delivery-C0aN3Oza.d.ts → delivery-RjM1_NAE.d.ts} +4 -3
- package/dist/domain/command-queues.d.ts +1 -1
- package/dist/domain/message-transcript.d.ts +1 -1
- package/dist/domain/reduced-state-schema.d.ts +1 -1
- package/dist/domain/reduced-state-schema.js +2 -1
- package/dist/domain/reduced-state-schema.js.map +1 -1
- package/dist/domain/reduced-state.d.ts +1 -1
- package/dist/domain/reduced-state.js +13 -4
- package/dist/domain/reduced-state.js.map +1 -1
- package/dist/domain/run-scheduling.d.ts +1 -1
- package/dist/{durable-CKdCCqhw.d.ts → durable-Cqv5ZRFA.d.ts} +14 -2
- package/dist/{durable-CD__3ztN.js → durable-D13w1Qr3.js} +11 -3
- package/dist/{durable-CD__3ztN.js.map → durable-D13w1Qr3.js.map} +1 -1
- package/dist/{event-factory-VAci3NJb.js → event-factory-_vF1bIJ7.js} +2 -2
- package/dist/{event-factory-VAci3NJb.js.map → event-factory-_vF1bIJ7.js.map} +1 -1
- package/dist/{events-BWuvzVml.d.ts → events-Dg0o5wWs.d.ts} +2 -2
- package/dist/{in-memory-IgxnTbGb.js → in-memory-CeODnZhE.js} +3 -3
- package/dist/{in-memory-IgxnTbGb.js.map → in-memory-CeODnZhE.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{interpreter-BdRoYrfL.js → interpreter-DKGJ1sSx.js} +4 -4
- package/dist/{interpreter-BdRoYrfL.js.map → interpreter-DKGJ1sSx.js.map} +1 -1
- package/dist/{model-resolver-DUms5p6X.d.ts → model-resolver-D0vcDZsU.d.ts} +2 -2
- package/dist/{records-DWKEjuqb.js → records--54mZEBx.js} +2 -2
- package/dist/{records-DWKEjuqb.js.map → records--54mZEBx.js.map} +1 -1
- package/dist/{reduced-state-D50SR0qM.d.ts → reduced-state-DU2ECOUp.d.ts} +1600 -1561
- package/dist/{reduced-state-schema-jyZWJ0QS.d.ts → reduced-state-schema-B2t3cobf.d.ts} +3 -1
- package/dist/{reducer-registry-CPObI3cs.d.ts → reducer-registry-JLU1yptN.d.ts} +4 -4
- package/dist/{run-scheduling-wakeup-B19JTeyq.d.ts → run-scheduling-wakeup-D_bGdicf.d.ts} +2 -2
- package/dist/services/compaction.d.ts +1 -1
- package/dist/services/compaction.js +1 -1
- package/dist/services/model-call.d.ts +1 -1
- package/dist/services/model-resolver.d.ts +1 -1
- package/dist/services/prompt-projector.d.ts +1 -1
- package/dist/services/reducer-registry.d.ts +1 -1
- package/dist/services/run-scheduler.d.ts +1 -1
- package/dist/services/run-scheduling-wakeup.d.ts +1 -1
- package/dist/services/runtime-layer.d.ts +8 -8
- package/dist/services/runtime-layer.js +4 -4
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +2 -2
- package/dist/services/session-event-observer.d.ts +1 -1
- package/dist/services/session-query.d.ts +1 -1
- package/dist/services/session-query.js +2 -2
- package/dist/services/session-state.d.ts +1 -1
- package/dist/services/session-state.js +1 -1
- package/dist/services/session-store.d.ts +1 -1
- package/dist/services/session-store.js +5 -5
- package/dist/services/sink-checkpoint-store.d.ts +1 -1
- package/dist/services/sink-registry.d.ts +1 -1
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/span-names.d.ts +1 -1
- package/dist/services/span-names.js +1 -0
- package/dist/services/span-names.js.map +1 -1
- package/dist/services/tool-registry.d.ts +2 -2
- package/dist/services/tool-registry.js +10 -1
- package/dist/services/tool-registry.js.map +1 -1
- package/dist/services/tracing.d.ts +1 -1
- package/dist/{session-event-observer-BdZltdrK.d.ts → session-event-observer-HvrRckbC.d.ts} +2 -2
- package/dist/{session-state-BW0l2aNk.js → session-state-BQYsuBqi.js} +154 -59
- package/dist/session-state-BQYsuBqi.js.map +1 -0
- package/dist/{session-store-CWYZ29CV.d.ts → session-store-CQxg9U82.d.ts} +3 -3
- package/dist/{sink-checkpoint-store-B8Ky5nfW.d.ts → sink-checkpoint-store-DWGifxp0.d.ts} +2 -2
- package/dist/{sink-registry-D0MetcNq.js → sink-registry-DskRcyOS.js} +2 -2
- package/dist/{sink-registry-D0MetcNq.js.map → sink-registry-DskRcyOS.js.map} +1 -1
- package/dist/{subscription-hkD4M3xp.js → subscription-DmO3BcdT.js} +2 -2
- package/dist/{subscription-hkD4M3xp.js.map → subscription-DmO3BcdT.js.map} +1 -1
- package/dist/{subscription-DelB8L87.d.ts → subscription-rC35dAWn.d.ts} +2 -2
- package/dist/testkit/layers.d.ts +11 -9
- package/dist/testkit/layers.js +5 -5
- package/dist/testkit/layers.js.map +1 -1
- package/dist/testkit/transcript.d.ts +2 -2
- package/dist/testkit/transcript.js +4 -4
- package/dist/{tool-registry-B_WE2ZwK.d.ts → tool-registry-BzlMhwzj.d.ts} +35 -6
- package/dist/transcript.d.ts +4 -4
- package/dist/transcript.js +5 -5
- package/dist/types/events/durable.d.ts +1 -1
- package/dist/types/events/durable.js +1 -1
- package/dist/types/events.d.ts +2 -2
- package/dist/types/events.js +1 -1
- package/dist/websocket/events.d.ts +1 -1
- package/dist/websocket/events.js +1 -1
- package/dist/websocket.d.ts +3 -3
- package/dist/websocket.js +3 -3
- package/dist/{window-read-BG8lxMVB.d.ts → window-read-CBZEJ84M.d.ts} +2 -2
- package/dist/{window-read-C8anZVdl.js → window-read-DPFAA1hM.js} +2 -2
- package/dist/{window-read-C8anZVdl.js.map → window-read-DPFAA1hM.js.map} +1 -1
- package/package.json +1 -1
- package/dist/session-state-BW0l2aNk.js.map +0 -1
|
@@ -3472,9 +3472,15 @@ declare const ToolCallRejectedEvent: Schema.Struct<{
|
|
|
3472
3472
|
}>;
|
|
3473
3473
|
}>;
|
|
3474
3474
|
type ToolCallRejectedEvent = typeof ToolCallRejectedEvent.Type;
|
|
3475
|
-
/**
|
|
3475
|
+
/**
|
|
3476
|
+
* One execution attempt of a framework-owned tool call. The first start carries no `attempt`
|
|
3477
|
+
* (attempt 1). Startup recovery re-invokes a started call whose tool declares
|
|
3478
|
+
* `ToolRecovery: "reinvoke"` by committing another start with the next `attempt` before
|
|
3479
|
+
* running it, so the attempt count survives a runtime that dies again mid-reinvocation.
|
|
3480
|
+
*/
|
|
3476
3481
|
declare const ToolCallStartedPayload: Schema.Struct<{
|
|
3477
3482
|
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
3483
|
+
readonly attempt: Schema.optionalKey<Schema.Int>;
|
|
3478
3484
|
}>;
|
|
3479
3485
|
type ToolCallStartedPayload = typeof ToolCallStartedPayload.Type;
|
|
3480
3486
|
declare const ToolCallStartedEvent: Schema.Struct<{
|
|
@@ -3505,6 +3511,7 @@ declare const ToolCallStartedEvent: Schema.Struct<{
|
|
|
3505
3511
|
readonly schemaVersion: Schema.Literal<number>;
|
|
3506
3512
|
readonly payload: Schema.Struct<{
|
|
3507
3513
|
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
3514
|
+
readonly attempt: Schema.optionalKey<Schema.Int>;
|
|
3508
3515
|
}>;
|
|
3509
3516
|
}>;
|
|
3510
3517
|
type ToolCallStartedEvent = typeof ToolCallStartedEvent.Type;
|
|
@@ -3754,6 +3761,7 @@ declare const ToolCallEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
3754
3761
|
readonly schemaVersion: Schema.Literal<number>;
|
|
3755
3762
|
readonly payload: Schema.Struct<{
|
|
3756
3763
|
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
3764
|
+
readonly attempt: Schema.optionalKey<Schema.Int>;
|
|
3757
3765
|
}>;
|
|
3758
3766
|
}>, Schema.Struct<{
|
|
3759
3767
|
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
@@ -6604,6 +6612,7 @@ declare const CurrentEDADurableEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
6604
6612
|
readonly schemaVersion: Schema.Literal<number>;
|
|
6605
6613
|
readonly payload: Schema.Struct<{
|
|
6606
6614
|
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
6615
|
+
readonly attempt: Schema.optionalKey<Schema.Int>;
|
|
6607
6616
|
}>;
|
|
6608
6617
|
}>, Schema.Struct<{
|
|
6609
6618
|
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
@@ -8689,6 +8698,7 @@ declare const EDADurableEvent: Schema.Union<readonly [Schema.Union<readonly [Sch
|
|
|
8689
8698
|
readonly schemaVersion: Schema.Literal<number>;
|
|
8690
8699
|
readonly payload: Schema.Struct<{
|
|
8691
8700
|
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
8701
|
+
readonly attempt: Schema.optionalKey<Schema.Int>;
|
|
8692
8702
|
}>;
|
|
8693
8703
|
}>, Schema.Struct<{
|
|
8694
8704
|
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
@@ -10774,6 +10784,7 @@ declare const EDADurableEventV1: Schema.Union<readonly [Schema.Union<readonly [S
|
|
|
10774
10784
|
readonly schemaVersion: Schema.Literal<number>;
|
|
10775
10785
|
readonly payload: Schema.Struct<{
|
|
10776
10786
|
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
10787
|
+
readonly attempt: Schema.optionalKey<Schema.Int>;
|
|
10777
10788
|
}>;
|
|
10778
10789
|
}>, Schema.Struct<{
|
|
10779
10790
|
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
@@ -12863,6 +12874,7 @@ declare const DecodedDurableEvent: Schema.Union<readonly [Schema.Union<readonly
|
|
|
12863
12874
|
readonly schemaVersion: Schema.Literal<number>;
|
|
12864
12875
|
readonly payload: Schema.Struct<{
|
|
12865
12876
|
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
12877
|
+
readonly attempt: Schema.optionalKey<Schema.Int>;
|
|
12866
12878
|
}>;
|
|
12867
12879
|
}>, Schema.Struct<{
|
|
12868
12880
|
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
@@ -13417,4 +13429,4 @@ declare const durableEventEnvelope: (event: DecodedDurableEvent | DurableEventEn
|
|
|
13417
13429
|
declare const decodeDurableEventSync: (input: unknown) => DecodedDurableEvent;
|
|
13418
13430
|
//#endregion
|
|
13419
13431
|
export { LegacyAttemptEvent as $, pendingMessagesPausedEventType as $n, ToolCallRejectedPayload as $t, CompactionFailedEvent as A, baseStateCreatedEventType as An, SessionConfiguredEvent as At, ContextRebasedPayload as B, compactionRequestedEventType as Bn, SummaryCreatedEvent as Bt, CommandEvent as C, UserMessagePromotedEvent as Cn, turnStartedEventType as Cr, RunSchedulingGrantedPayload as Ct, CommandStartedPayload as D, assistantMessageCommittedEventType as Dn, userMessagePromotedEventType as Dr, RunSchedulingRequestedPayload as Dt, CommandStartedEvent as E, UserMessageSubmittedPayload as En, userMessageCommittedEventType as Er, RunSchedulingRequestedEvent as Et, CompactionStartedPayload as F, commandCompletedEventType as Fn, StopControlEvent as Ft, InferenceCompletedEvent as G, decodeUnknownEDADurableEvent as Gn, ToolCallCompletedPayload as Gt, DecodedDurableEvent as H, contextProjectedEventType as Hn, SystemMessageCommittedEvent as Ht, ContextAndCompactionEvent as I, commandFailedEventType as In, StopTurnAppliedEvent as It, InferenceFailedEvent as J, inferenceCompletedEventType as Jn, ToolCallEvent as Jt, InferenceCompletedPayload as K, decodeUnknownEDADurableEventSync as Kn, ToolCallCreatedEvent as Kt, ContextProjectedEvent as L, commandStartedEventType as Ln, StopTurnAppliedPayload as Lt, CompactionRequestedEvent as M, baseStateRequestedEventType as Mn, SteeringMessageCancelledPayload as Mt, CompactionRequestedPayload as N, commandAdmittedEventType as Nn, SteeringMessageQueuedEvent as Nt, CompactionCompletedEvent as O, assistantMessageImportedEventType as On, userMessageSubmittedEventType as Or, RunStartedEvent as Ot, CompactionStartedEvent as P, commandCancelledEventType as Pn, SteeringMessageQueuedPayload as Pt, LegacyAssistantMessageCommittedEvent as Q, messageQueuePausedEventType as Qn, ToolCallRejectedEvent as Qt, ContextProjectedPayload as R, compactionCompletedEventType as Rn, StopTurnRequestedEvent as Rt, CommandCompletedPayload as S, UserMessageDisposition as Sn, turnFailedEventType as Sr, RunSchedulingGrantedEvent as St, CommandFailedPayload as T, UserMessageSubmittedEvent as Tn, userMessageCancelledEventType as Tr, RunSchedulingInvalidatedPayload as Tt, EDADurableEvent as U, contextRebasedEventType as Un, SystemMessageCommittedPayload as Ut, CurrentEDADurableEvent as V, compactionStartedEventType as Vn, SummaryCreatedPayload as Vt, EDADurableEventV1 as W, decodeDurableEventSync as Wn, ToolCallCompletedEvent as Wt, InferenceStartedEvent as X, inferenceStartedEventType as Xn, ToolCallFailedPayload as Xt, InferenceFailedPayload as Y, inferenceFailedEventType as Yn, ToolCallFailedEvent as Yt, InferenceStartedPayload as Z, interpretLegacyAttemptForReduction as Zn, ToolCallPromptPart as Zt, CommandAdmittedEvent as _, UserMessageCancellationReason as _n, toolCallCreatedEventType as _r, RunInterruptedEvent as _t, AssistantMessageImportedPayload as a, ToolPromptPart as an, runSchedulingGrantedEventType as ar, MessageQueuePausedPayload as at, CommandCancelledPayload as b, UserMessageCommittedEvent as bn, toolCallStartedEventType as br, RunSchedulingDeliveredPayload as bt, AssistantPromptPart as c, TurnCompletedEvent as cn, runStartedEventType as cr, RecoveryCompletedEvent as ct, BaseStateCreatedPayload as d, TurnFailedEvent as dn, steeringMessageQueuedEventType as dr, RecoveryEvent as dt, ToolCallRejectionFeedback as en, recoveryCompletedEventType as er, LegacyToolCallCreatedEvent as et, BaseStateEvent as f, TurnFailedPayload as fn, stopTurnAppliedEventType as fr, RunCompletedEvent as ft, BaseStateRequestedPayload as g, TurnStoppedPayload as gn, toolCallCompletedEventType as gr, RunFailedPayload as gt, BaseStateRequestedEvent as h, TurnStoppedEvent as hn, systemMessageCommittedEventType as hr, RunFailedEvent as ht, AssistantMessageImportedEvent as i, ToolFailurePromptPart as in, runSchedulingDeliveredEventType as ir, MessageQueuePausedEvent as it, CompactionFailedPayload as j, baseStateFailedEventType as jn, SteeringMessageCancelledEvent as jt, CompactionCompletedPayload as k, assistantPartialCommittedEventType as kn, RunStartedPayload as kt, AssistantPromptParts as l, TurnCompletedPayload as ln, sessionConfiguredEventType as lr, RecoveryCompletedPayload as lt, BaseStateFailedPayload as m, TurnStartedPayload as mn, summaryCreatedEventType as mr, RunEvent as mt, AssistantMessageCommittedPayload as n, ToolCallStartedEvent as nn, runFailedEventType as nr, LegacyTurnAttemptStartedEvent as nt, AssistantPartialCommittedEvent as o, ToolRejectionPromptPart as on, runSchedulingInvalidatedEventType as or, PendingMessagesPausedEvent as ot, BaseStateFailedEvent as p, TurnStartedEvent as pn, stopTurnRequestedEventType as pr, RunCompletedPayload as pt, InferenceEvent as q, durableEventEnvelope as qn, ToolCallCreatedPayload as qt, AssistantMessageContent as r, ToolCallStartedPayload as rn, runInterruptedEventType as rr, MessageEvent as rt, AssistantPartialCommittedPayload as s, ToolSuccessPromptPart as sn, runSchedulingRequestedEventType as sr, PendingMessagesPausedPayload as st, AssistantMessageCommittedEvent as t, ToolCallRejectionReason as tn, runCompletedEventType as tr, LegacyTurnAttemptCompletedEvent as tt, BaseStateCreatedEvent as u, TurnEvent as un, steeringMessageCancelledEventType as ur, RecoveryContinuation as ut, CommandAdmittedPayload as v, UserMessageCancelledEvent as vn, toolCallFailedEventType as vr, RunInterruptedPayload as vt, CommandFailedEvent as w, UserMessagePromotedPayload as wn, turnStoppedEventType as wr, RunSchedulingInvalidatedEvent as wt, CommandCompletedEvent as x, UserMessageCommittedPayload as xn, turnCompletedEventType as xr, RunSchedulingEvent as xt, CommandCancelledEvent as y, UserMessageCancelledPayload as yn, toolCallRejectedEventType as yr, RunSchedulingDeliveredEvent as yt, ContextRebasedEvent as z, compactionFailedEventType as zn, StopTurnRequestedPayload as zt };
|
|
13420
|
-
//# sourceMappingURL=durable-
|
|
13432
|
+
//# sourceMappingURL=durable-Cqv5ZRFA.d.ts.map
|
|
@@ -502,8 +502,16 @@ const ToolCallRejectedPayload = Schema.Struct({
|
|
|
502
502
|
promptPart: ToolRejectionPromptPart
|
|
503
503
|
});
|
|
504
504
|
const ToolCallRejectedEvent = durableEventSchema(toolCallRejectedEventType, ToolCallRejectedPayload);
|
|
505
|
-
/**
|
|
506
|
-
|
|
505
|
+
/**
|
|
506
|
+
* One execution attempt of a framework-owned tool call. The first start carries no `attempt`
|
|
507
|
+
* (attempt 1). Startup recovery re-invokes a started call whose tool declares
|
|
508
|
+
* `ToolRecovery: "reinvoke"` by committing another start with the next `attempt` before
|
|
509
|
+
* running it, so the attempt count survives a runtime that dies again mid-reinvocation.
|
|
510
|
+
*/
|
|
511
|
+
const ToolCallStartedPayload = Schema.Struct({
|
|
512
|
+
toolCallId: ToolCallId,
|
|
513
|
+
attempt: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(2)))
|
|
514
|
+
});
|
|
507
515
|
const ToolCallStartedEvent = durableEventSchema(toolCallStartedEventType, ToolCallStartedPayload);
|
|
508
516
|
/** Payload recorded when a tool call completes with a result. */
|
|
509
517
|
const ToolCallCompletedPayload = Schema.Struct({
|
|
@@ -776,4 +784,4 @@ const decodeDurableEventSync = (input) => {
|
|
|
776
784
|
//#endregion
|
|
777
785
|
export { LegacyAttemptEvent as $, pendingMessagesPausedEventType as $n, ToolCallRejectedPayload as $t, CompactionFailedEvent as A, baseStateCreatedEventType as An, ephemeralEventSchema as Ar, SessionConfiguredEvent as At, ContextRebasedPayload as B, compactionRequestedEventType as Bn, SummaryCreatedEvent as Bt, CommandEvent as C, UserMessagePromotedEvent as Cn, turnStartedEventType as Cr, RunSchedulingGrantedPayload as Ct, CommandStartedPayload as D, assistantMessageCommittedEventType as Dn, userMessagePromotedEventType as Dr, RunSchedulingRequestedPayload as Dt, CommandStartedEvent as E, UserMessageSubmittedPayload as En, userMessageCommittedEventType as Er, RunSchedulingRequestedEvent as Et, CompactionStartedPayload as F, commandCompletedEventType as Fn, StopControlEvent as Ft, InferenceCompletedEvent as G, decodeUnknownEDADurableEvent as Gn, ToolCallCompletedPayload as Gt, DecodedDurableEvent as H, contextProjectedEventType as Hn, SystemMessageCommittedEvent as Ht, ContextAndCompactionEvent as I, commandFailedEventType as In, StopTurnAppliedEvent as It, InferenceFailedEvent as J, inferenceCompletedEventType as Jn, ToolCallEvent as Jt, InferenceCompletedPayload as K, decodeUnknownEDADurableEventSync as Kn, ToolCallCreatedEvent as Kt, ContextProjectedEvent as L, commandStartedEventType as Ln, StopTurnAppliedPayload as Lt, CompactionRequestedEvent as M, baseStateRequestedEventType as Mn, SteeringMessageCancelledPayload as Mt, CompactionRequestedPayload as N, commandAdmittedEventType as Nn, SteeringMessageQueuedEvent as Nt, CompactionCompletedEvent as O, assistantMessageImportedEventType as On, userMessageSubmittedEventType as Or, RunStartedEvent as Ot, CompactionStartedEvent as P, commandCancelledEventType as Pn, SteeringMessageQueuedPayload as Pt, LegacyAssistantMessageCommittedEvent as Q, messageQueuePausedEventType as Qn, ToolCallRejectedEvent as Qt, ContextProjectedPayload as R, compactionCompletedEventType as Rn, StopTurnRequestedEvent as Rt, CommandCompletedPayload as S, UserMessageDisposition as Sn, turnFailedEventType as Sr, RunSchedulingGrantedEvent as St, CommandFailedPayload as T, UserMessageSubmittedEvent as Tn, userMessageCancelledEventType as Tr, RunSchedulingInvalidatedPayload as Tt, EDADurableEvent as U, contextRebasedEventType as Un, SystemMessageCommittedPayload as Ut, CurrentEDADurableEvent as V, compactionStartedEventType as Vn, SummaryCreatedPayload as Vt, EDADurableEventV1 as W, decodeDurableEventSync as Wn, ToolCallCompletedEvent as Wt, InferenceStartedEvent as X, inferenceStartedEventType as Xn, ToolCallFailedPayload as Xt, InferenceFailedPayload as Y, inferenceFailedEventType as Yn, ToolCallFailedEvent as Yt, InferenceStartedPayload as Z, interpretLegacyAttemptForReduction as Zn, ToolCallPromptPart as Zt, CommandAdmittedEvent as _, UserMessageCancellationReason as _n, toolCallCreatedEventType as _r, RunInterruptedEvent as _t, AssistantMessageImportedPayload as a, ToolPromptPart as an, runSchedulingGrantedEventType as ar, MessageQueuePausedPayload as at, CommandCancelledPayload as b, UserMessageCommittedEvent as bn, toolCallStartedEventType as br, RunSchedulingDeliveredPayload as bt, AssistantPromptPart as c, TurnCompletedEvent as cn, runStartedEventType as cr, RecoveryCompletedEvent as ct, BaseStateCreatedPayload as d, TurnFailedEvent as dn, steeringMessageQueuedEventType as dr, RecoveryEvent as dt, ToolCallRejectionFeedback as en, recoveryCompletedEventType as er, LegacyToolCallCreatedEvent as et, BaseStateEvent as f, TurnFailedPayload as fn, stopTurnAppliedEventType as fr, RunCompletedEvent as ft, BaseStateRequestedPayload as g, TurnStoppedPayload as gn, toolCallCompletedEventType as gr, RunFailedPayload as gt, BaseStateRequestedEvent as h, TurnStoppedEvent as hn, systemMessageCommittedEventType as hr, RunFailedEvent as ht, AssistantMessageImportedEvent as i, ToolFailurePromptPart as in, runSchedulingDeliveredEventType as ir, MessageQueuePausedEvent as it, CompactionFailedPayload as j, baseStateFailedEventType as jn, SteeringMessageCancelledEvent as jt, CompactionCompletedPayload as k, assistantPartialCommittedEventType as kn, decodeRetainingExcess as kr, RunStartedPayload as kt, AssistantPromptParts as l, TurnCompletedPayload as ln, sessionConfiguredEventType as lr, RecoveryCompletedPayload as lt, BaseStateFailedPayload as m, TurnStartedPayload as mn, summaryCreatedEventType as mr, RunEvent as mt, AssistantMessageCommittedPayload as n, ToolCallStartedEvent as nn, runFailedEventType as nr, LegacyTurnAttemptStartedEvent as nt, AssistantPartialCommittedEvent as o, ToolRejectionPromptPart as on, runSchedulingInvalidatedEventType as or, PendingMessagesPausedEvent as ot, BaseStateFailedEvent as p, TurnStartedEvent as pn, stopTurnRequestedEventType as pr, RunCompletedPayload as pt, InferenceEvent as q, durableEventEnvelope as qn, ToolCallCreatedPayload as qt, AssistantMessageContent as r, ToolCallStartedPayload as rn, runInterruptedEventType as rr, MessageEvent as rt, AssistantPartialCommittedPayload as s, ToolSuccessPromptPart as sn, runSchedulingRequestedEventType as sr, PendingMessagesPausedPayload as st, AssistantMessageCommittedEvent as t, ToolCallRejectionReason as tn, runCompletedEventType as tr, LegacyTurnAttemptCompletedEvent as tt, BaseStateCreatedEvent as u, TurnEvent as un, steeringMessageCancelledEventType as ur, RecoveryContinuation as ut, CommandAdmittedPayload as v, UserMessageCancelledEvent as vn, toolCallFailedEventType as vr, RunInterruptedPayload as vt, CommandFailedEvent as w, UserMessagePromotedPayload as wn, turnStoppedEventType as wr, RunSchedulingInvalidatedEvent as wt, CommandCompletedEvent as x, UserMessageCommittedPayload as xn, turnCompletedEventType as xr, RunSchedulingEvent as xt, CommandCancelledEvent as y, UserMessageCancelledPayload as yn, toolCallRejectedEventType as yr, RunSchedulingDeliveredEvent as yt, ContextRebasedEvent as z, compactionFailedEventType as zn, StopTurnRequestedPayload as zt };
|
|
778
786
|
|
|
779
|
-
//# sourceMappingURL=durable-
|
|
787
|
+
//# sourceMappingURL=durable-D13w1Qr3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-CD__3ztN.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/** Payload recorded when framework-owned tool execution starts. */\nexport const ToolCallStartedPayload = Schema.Struct({ toolCallId: ToolCallId });\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;CACtC;AACF,CAAC;;AAGH,MAAa,wBACX,MACA,YAEA,OAAO,OAAO;CACZ,GAAG,uBAAuB;CAC1B,WAAW,OAAO,QAAQ,2BAA2B;CACrD,MAAM,OAAO,QAAQ,IAAI;CACzB,eAAe,OAAO,QAAQ,QAAQ;CACtC;AACF,CAAC;AAEH,MAAM,iBAAiB,UAA+D;CACpF,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO;CAChF,MAAM,YAAqB,OAAO,eAAe,KAAK;CACtD,OAAO,cAAc,OAAO,aAAa,cAAc;AACzD;;AAGA,MAAM,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AAM;EAAW,MAAM;EAAW;CAAS;AAC3F"}
|
|
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 decodeFrameworkE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B,CAAC,CAAC,KAAK,CAAC;AACtF;AAEA,MAAM,2BAA2B,aAAoD;CACnF,IAAI,SAAS,cAAA,wBACX,MAAM,IAAI,MACR,kDAAkD,4BAA4B,aAAa,SAAS,WACtG;CAGF,QAAQ,SAAS,eAAjB;EACE,KAAK,UACH,OAAO,wBAAwB,QAAQ;EACzC,SACE,MAAM,IAAI,MACR,+CAA+C,SAAS,cAAc,OAAO,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,5 +1,5 @@
|
|
|
1
1
|
import { b as schemaV1, g as UnixEpochMillis, v as effectDurableAgentNamespace } from "./envelope-BCzKUq_z.js";
|
|
2
|
-
import { $n as pendingMessagesPausedEventType, A as CompactionFailedEvent, Bn as compactionRequestedEventType, Bt as SummaryCreatedEvent, Cn as UserMessagePromotedEvent, Cr as turnStartedEventType, Dn as assistantMessageCommittedEventType, Dr as userMessagePromotedEventType, E as CommandStartedEvent, Er as userMessageCommittedEventType, Et as RunSchedulingRequestedEvent, Fn as commandCompletedEventType, G as InferenceCompletedEvent, Ht as SystemMessageCommittedEvent, In as commandFailedEventType, It as StopTurnAppliedEvent, J as InferenceFailedEvent, Jn as inferenceCompletedEventType, Kt as ToolCallCreatedEvent, Ln as commandStartedEventType, M as CompactionRequestedEvent, Nn as commandAdmittedEventType, Nt as SteeringMessageQueuedEvent, O as CompactionCompletedEvent, Or as userMessageSubmittedEventType, Ot as RunStartedEvent, P as CompactionStartedEvent, Pn as commandCancelledEventType, Qt as ToolCallRejectedEvent, Rn as compactionCompletedEventType, Rt as StopTurnRequestedEvent, Sr as turnFailedEventType, St as RunSchedulingGrantedEvent, Tn as UserMessageSubmittedEvent, Tr as userMessageCancelledEventType, Un as contextRebasedEventType, Vn as compactionStartedEventType, Wt as ToolCallCompletedEvent, X as InferenceStartedEvent, Xn as inferenceStartedEventType, Yn as inferenceFailedEventType, Yt as ToolCallFailedEvent, _ as CommandAdmittedEvent, _r as toolCallCreatedEventType, _t as RunInterruptedEvent, ar as runSchedulingGrantedEventType, bn as UserMessageCommittedEvent, br as toolCallStartedEventType, cn as TurnCompletedEvent, cr as runStartedEventType, ct as RecoveryCompletedEvent, dn as TurnFailedEvent, dr as steeringMessageQueuedEventType, er as recoveryCompletedEventType, fr as stopTurnAppliedEventType, ft as RunCompletedEvent, gr as toolCallCompletedEventType, hn as TurnStoppedEvent, hr as systemMessageCommittedEventType, ht as RunFailedEvent, ir as runSchedulingDeliveredEventType, jt as SteeringMessageCancelledEvent, kn as assistantPartialCommittedEventType, mr as summaryCreatedEventType, nn as ToolCallStartedEvent, nr as runFailedEventType, o as AssistantPartialCommittedEvent, or as runSchedulingInvalidatedEventType, ot as PendingMessagesPausedEvent, pn as TurnStartedEvent, pr as stopTurnRequestedEventType, rr as runInterruptedEventType, sr as runSchedulingRequestedEventType, t as AssistantMessageCommittedEvent, tr as runCompletedEventType, ur as steeringMessageCancelledEventType, vn as UserMessageCancelledEvent, vr as toolCallFailedEventType, w as CommandFailedEvent, wr as turnStoppedEventType, wt as RunSchedulingInvalidatedEvent, x as CommandCompletedEvent, xr as turnCompletedEventType, y as CommandCancelledEvent, yr as toolCallRejectedEventType, yt as RunSchedulingDeliveredEvent, z as ContextRebasedEvent, zn as compactionFailedEventType } from "./durable-
|
|
2
|
+
import { $n as pendingMessagesPausedEventType, A as CompactionFailedEvent, Bn as compactionRequestedEventType, Bt as SummaryCreatedEvent, Cn as UserMessagePromotedEvent, Cr as turnStartedEventType, Dn as assistantMessageCommittedEventType, Dr as userMessagePromotedEventType, E as CommandStartedEvent, Er as userMessageCommittedEventType, Et as RunSchedulingRequestedEvent, Fn as commandCompletedEventType, G as InferenceCompletedEvent, Ht as SystemMessageCommittedEvent, In as commandFailedEventType, It as StopTurnAppliedEvent, J as InferenceFailedEvent, Jn as inferenceCompletedEventType, Kt as ToolCallCreatedEvent, Ln as commandStartedEventType, M as CompactionRequestedEvent, Nn as commandAdmittedEventType, Nt as SteeringMessageQueuedEvent, O as CompactionCompletedEvent, Or as userMessageSubmittedEventType, Ot as RunStartedEvent, P as CompactionStartedEvent, Pn as commandCancelledEventType, Qt as ToolCallRejectedEvent, Rn as compactionCompletedEventType, Rt as StopTurnRequestedEvent, Sr as turnFailedEventType, St as RunSchedulingGrantedEvent, Tn as UserMessageSubmittedEvent, Tr as userMessageCancelledEventType, Un as contextRebasedEventType, Vn as compactionStartedEventType, Wt as ToolCallCompletedEvent, X as InferenceStartedEvent, Xn as inferenceStartedEventType, Yn as inferenceFailedEventType, Yt as ToolCallFailedEvent, _ as CommandAdmittedEvent, _r as toolCallCreatedEventType, _t as RunInterruptedEvent, ar as runSchedulingGrantedEventType, bn as UserMessageCommittedEvent, br as toolCallStartedEventType, cn as TurnCompletedEvent, cr as runStartedEventType, ct as RecoveryCompletedEvent, dn as TurnFailedEvent, dr as steeringMessageQueuedEventType, er as recoveryCompletedEventType, fr as stopTurnAppliedEventType, ft as RunCompletedEvent, gr as toolCallCompletedEventType, hn as TurnStoppedEvent, hr as systemMessageCommittedEventType, ht as RunFailedEvent, ir as runSchedulingDeliveredEventType, jt as SteeringMessageCancelledEvent, kn as assistantPartialCommittedEventType, mr as summaryCreatedEventType, nn as ToolCallStartedEvent, nr as runFailedEventType, o as AssistantPartialCommittedEvent, or as runSchedulingInvalidatedEventType, ot as PendingMessagesPausedEvent, pn as TurnStartedEvent, pr as stopTurnRequestedEventType, rr as runInterruptedEventType, sr as runSchedulingRequestedEventType, t as AssistantMessageCommittedEvent, tr as runCompletedEventType, ur as steeringMessageCancelledEventType, vn as UserMessageCancelledEvent, vr as toolCallFailedEventType, w as CommandFailedEvent, wr as turnStoppedEventType, wt as RunSchedulingInvalidatedEvent, x as CommandCompletedEvent, xr as turnCompletedEventType, y as CommandCancelledEvent, yr as toolCallRejectedEventType, yt as RunSchedulingDeliveredEvent, z as ContextRebasedEvent, zn as compactionFailedEventType } from "./durable-D13w1Qr3.js";
|
|
3
3
|
import { ReasoningDeltaEvent, TextDeltaEvent, ToolParamsDeltaEvent, ToolParamsEndEvent, ToolParamsStartEvent, reasoningDeltaEventType, textDeltaEventType, toolParamsDeltaEventType, toolParamsEndEventType, toolParamsStartEventType } from "./types/events.js";
|
|
4
4
|
import { IdGenerator } from "./services/id-generator.js";
|
|
5
5
|
import { currentOrRootEDAEventTrace } from "./services/tracing.js";
|
|
@@ -104,4 +104,4 @@ var EventFactory = class EventFactory extends Context.Service()("@effect-durable
|
|
|
104
104
|
//#endregion
|
|
105
105
|
export { SessionContext as n, EventFactory as t };
|
|
106
106
|
|
|
107
|
-
//# sourceMappingURL=event-factory-
|
|
107
|
+
//# sourceMappingURL=event-factory-_vF1bIJ7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-factory-VAci3NJb.js","names":[],"sources":["../src/services/session-context.ts","../src/services/event-factory.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\n\nimport { SessionId } from \"../types/core\";\n\n/** Runtime-scoped session identity dependency. */\nexport interface SessionContextShape {\n /** The one session this runtime instance owns; fixed for the runtime lifetime. */\n readonly sessionId: SessionId;\n}\n\n/**\n * Identity of the session a runtime instance is bound to. One runtime = one\n * session, so services read the session here instead of threading `sessionId`\n * through every input struct.\n */\nexport class SessionContext extends Context.Service<SessionContext, SessionContextShape>()(\n \"@effect-durable-agent/SessionContext\",\n) {\n static readonly Live = (sessionId: SessionId) => Layer.succeed(SessionContext, { sessionId });\n}\n","import * as Clock from \"effect/Clock\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n\nimport {\n CommandAdmittedEvent,\n CommandAdmittedPayload,\n CommandCancelledEvent,\n CommandCancelledPayload,\n CommandCompletedEvent,\n CommandCompletedPayload,\n CommandFailedEvent,\n CommandFailedPayload,\n CommandStartedEvent,\n CommandStartedPayload,\n CompactionCompletedEvent,\n CompactionCompletedPayload,\n CompactionFailedEvent,\n CompactionFailedPayload,\n CompactionRequestedEvent,\n CompactionRequestedPayload,\n CompactionStartedEvent,\n CompactionStartedPayload,\n ContextRebasedEvent,\n ContextRebasedPayload,\n AssistantMessageCommittedEvent,\n AssistantMessageCommittedPayload,\n AssistantPartialCommittedEvent,\n AssistantPartialCommittedPayload,\n EventType,\n InferenceCompletedEvent,\n InferenceCompletedPayload,\n InferenceFailedEvent,\n InferenceFailedPayload,\n InferenceStartedEvent,\n InferenceStartedPayload,\n SummaryCreatedEvent,\n SummaryCreatedPayload,\n SystemMessageCommittedEvent,\n SystemMessageCommittedPayload,\n ReasoningDeltaEvent,\n ReasoningDeltaPayload,\n RecoveryCompletedEvent,\n RecoveryCompletedPayload,\n RunCompletedEvent,\n RunCompletedPayload,\n RunFailedEvent,\n RunFailedPayload,\n RunInterruptedEvent,\n RunInterruptedPayload,\n RunSchedulingRequestedEvent,\n RunSchedulingRequestedPayload,\n runSchedulingRequestedEventType,\n RunSchedulingDeliveredEvent,\n RunSchedulingDeliveredPayload,\n runSchedulingDeliveredEventType,\n RunSchedulingInvalidatedEvent,\n RunSchedulingInvalidatedPayload,\n runSchedulingInvalidatedEventType,\n RunSchedulingGrantedEvent,\n RunSchedulingGrantedPayload,\n runSchedulingGrantedEventType,\n RunStartedEvent,\n RunStartedPayload,\n StopTurnAppliedEvent,\n StopTurnAppliedPayload,\n StopTurnRequestedEvent,\n StopTurnRequestedPayload,\n SteeringMessageCancelledEvent,\n SteeringMessageCancelledPayload,\n SteeringMessageQueuedEvent,\n SteeringMessageQueuedPayload,\n TextDeltaEvent,\n TextDeltaPayload,\n ToolCallCompletedEvent,\n ToolCallCompletedPayload,\n ToolCallCreatedEvent,\n ToolCallCreatedPayload,\n ToolCallFailedEvent,\n ToolCallFailedPayload,\n ToolCallRejectedEvent,\n ToolCallRejectedPayload,\n ToolCallStartedEvent,\n ToolCallStartedPayload,\n ToolParamsDeltaEvent,\n ToolParamsDeltaPayload,\n ToolParamsEndEvent,\n ToolParamsEndPayload,\n ToolParamsStartEvent,\n ToolParamsStartPayload,\n TurnCompletedEvent,\n TurnCompletedPayload,\n TurnFailedEvent,\n TurnFailedPayload,\n TurnStartedEvent,\n TurnStartedPayload,\n TurnStoppedEvent,\n TurnStoppedPayload,\n UnixEpochMillis,\n UserMessageCommittedEvent,\n UserMessageCommittedPayload,\n UserMessageSubmittedEvent,\n UserMessageSubmittedPayload,\n UserMessagePromotedEvent,\n UserMessagePromotedPayload,\n UserMessageCancelledEvent,\n UserMessageCancelledPayload,\n PendingMessagesPausedEvent,\n PendingMessagesPausedPayload,\n commandAdmittedEventType,\n commandCancelledEventType,\n commandCompletedEventType,\n commandFailedEventType,\n commandStartedEventType,\n compactionCompletedEventType,\n compactionFailedEventType,\n compactionRequestedEventType,\n compactionStartedEventType,\n contextRebasedEventType,\n assistantMessageCommittedEventType,\n assistantPartialCommittedEventType,\n effectDurableAgentNamespace,\n inferenceCompletedEventType,\n inferenceFailedEventType,\n inferenceStartedEventType,\n reasoningDeltaEventType,\n recoveryCompletedEventType,\n runCompletedEventType,\n runFailedEventType,\n runInterruptedEventType,\n runStartedEventType,\n schemaV1,\n steeringMessageCancelledEventType,\n summaryCreatedEventType,\n systemMessageCommittedEventType,\n steeringMessageQueuedEventType,\n stopTurnAppliedEventType,\n stopTurnRequestedEventType,\n textDeltaEventType,\n toolCallCompletedEventType,\n toolCallCreatedEventType,\n toolCallFailedEventType,\n toolCallRejectedEventType,\n toolCallStartedEventType,\n toolParamsDeltaEventType,\n toolParamsEndEventType,\n toolParamsStartEventType,\n turnCompletedEventType,\n turnFailedEventType,\n turnStartedEventType,\n turnStoppedEventType,\n userMessageCommittedEventType,\n userMessageSubmittedEventType,\n userMessagePromotedEventType,\n userMessageCancelledEventType,\n pendingMessagesPausedEventType,\n} from \"../types/events\";\nimport { IdGenerator } from \"./id-generator\";\nimport { SessionContext } from \"./session-context\";\nimport { currentOrRootEDAEventTrace } from \"./tracing\";\n\n/** Central envelope factory that stamps session id, event id, and current clock time. */\nexport interface EventFactoryShape {\n // Durable lifecycle events.\n readonly commandAdmitted: (\n payload: CommandAdmittedPayload,\n ) => Effect.Effect<CommandAdmittedEvent>;\n readonly commandStarted: (payload: CommandStartedPayload) => Effect.Effect<CommandStartedEvent>;\n readonly commandCompleted: (\n payload: CommandCompletedPayload,\n ) => Effect.Effect<CommandCompletedEvent>;\n readonly commandFailed: (payload: CommandFailedPayload) => Effect.Effect<CommandFailedEvent>;\n readonly commandCancelled: (\n payload: CommandCancelledPayload,\n ) => Effect.Effect<CommandCancelledEvent>;\n readonly systemMessageCommitted: (\n payload: SystemMessageCommittedPayload,\n ) => Effect.Effect<SystemMessageCommittedEvent>;\n readonly userMessageCommitted: (\n payload: UserMessageCommittedPayload,\n ) => Effect.Effect<UserMessageCommittedEvent>;\n readonly userMessageSubmitted: (\n payload: UserMessageSubmittedPayload,\n ) => Effect.Effect<UserMessageSubmittedEvent>;\n readonly userMessagePromoted: (\n payload: UserMessagePromotedPayload,\n ) => Effect.Effect<UserMessagePromotedEvent>;\n readonly userMessageCancelled: (\n payload: UserMessageCancelledPayload,\n ) => Effect.Effect<UserMessageCancelledEvent>;\n readonly pendingMessagesPaused: (\n payload: PendingMessagesPausedPayload,\n ) => Effect.Effect<PendingMessagesPausedEvent>;\n readonly steeringMessageQueued: (\n payload: SteeringMessageQueuedPayload,\n ) => Effect.Effect<SteeringMessageQueuedEvent>;\n readonly steeringMessageCancelled: (\n payload: SteeringMessageCancelledPayload,\n ) => Effect.Effect<SteeringMessageCancelledEvent>;\n readonly assistantMessageCommitted: (\n payload: AssistantMessageCommittedPayload,\n ) => Effect.Effect<AssistantMessageCommittedEvent>;\n readonly assistantPartialCommitted: (\n payload: AssistantPartialCommittedPayload,\n ) => Effect.Effect<AssistantPartialCommittedEvent>;\n readonly runSchedulingRequested: (\n payload: RunSchedulingRequestedPayload,\n ) => Effect.Effect<RunSchedulingRequestedEvent>;\n readonly runSchedulingDelivered: (\n payload: RunSchedulingDeliveredPayload,\n ) => Effect.Effect<RunSchedulingDeliveredEvent>;\n readonly runSchedulingInvalidated: (\n payload: RunSchedulingInvalidatedPayload,\n ) => Effect.Effect<RunSchedulingInvalidatedEvent>;\n readonly runSchedulingGranted: (\n payload: RunSchedulingGrantedPayload,\n ) => Effect.Effect<RunSchedulingGrantedEvent>;\n readonly runStarted: (payload: RunStartedPayload) => Effect.Effect<RunStartedEvent>;\n readonly runCompleted: (payload: RunCompletedPayload) => Effect.Effect<RunCompletedEvent>;\n readonly runFailed: (payload: RunFailedPayload) => Effect.Effect<RunFailedEvent>;\n readonly recoveryCompleted: (\n payload: RecoveryCompletedPayload,\n ) => Effect.Effect<RecoveryCompletedEvent>;\n /** @deprecated Emit `runFailed` with `error.code = \"run.interrupted\"`. Retained for legacy event construction only. */\n readonly runInterrupted: (payload: RunInterruptedPayload) => Effect.Effect<RunInterruptedEvent>;\n readonly turnStarted: (payload: TurnStartedPayload) => Effect.Effect<TurnStartedEvent>;\n readonly turnCompleted: (payload: TurnCompletedPayload) => Effect.Effect<TurnCompletedEvent>;\n readonly turnFailed: (payload: TurnFailedPayload) => Effect.Effect<TurnFailedEvent>;\n /** @deprecated Emit `turnFailed` with `error.code = \"turn.interrupted\"`. Retained for legacy event construction only. */\n readonly turnStopped: (payload: TurnStoppedPayload) => Effect.Effect<TurnStoppedEvent>;\n readonly inferenceStarted: (\n payload: InferenceStartedPayload,\n ) => Effect.Effect<InferenceStartedEvent>;\n readonly inferenceCompleted: (\n payload: InferenceCompletedPayload,\n ) => Effect.Effect<InferenceCompletedEvent>;\n readonly inferenceFailed: (\n payload: InferenceFailedPayload,\n ) => Effect.Effect<InferenceFailedEvent>;\n readonly toolCallCreated: (\n payload: ToolCallCreatedPayload,\n ) => Effect.Effect<ToolCallCreatedEvent>;\n readonly toolCallRejected: (\n payload: ToolCallRejectedPayload,\n ) => Effect.Effect<ToolCallRejectedEvent>;\n readonly toolCallStarted: (\n payload: ToolCallStartedPayload,\n ) => Effect.Effect<ToolCallStartedEvent>;\n readonly toolCallCompleted: (\n payload: ToolCallCompletedPayload,\n ) => Effect.Effect<ToolCallCompletedEvent>;\n readonly toolCallFailed: (payload: ToolCallFailedPayload) => Effect.Effect<ToolCallFailedEvent>;\n readonly stopTurnRequested: (\n payload: StopTurnRequestedPayload,\n ) => Effect.Effect<StopTurnRequestedEvent>;\n readonly stopTurnApplied: (\n payload: StopTurnAppliedPayload,\n ) => Effect.Effect<StopTurnAppliedEvent>;\n readonly compactionRequested: (\n payload: CompactionRequestedPayload,\n ) => Effect.Effect<CompactionRequestedEvent>;\n readonly compactionStarted: (\n payload: CompactionStartedPayload,\n ) => Effect.Effect<CompactionStartedEvent>;\n readonly summaryCreated: (payload: SummaryCreatedPayload) => Effect.Effect<SummaryCreatedEvent>;\n readonly contextRebased: (payload: ContextRebasedPayload) => Effect.Effect<ContextRebasedEvent>;\n readonly compactionCompleted: (\n payload: CompactionCompletedPayload,\n ) => Effect.Effect<CompactionCompletedEvent>;\n readonly compactionFailed: (\n payload: CompactionFailedPayload,\n ) => Effect.Effect<CompactionFailedEvent>;\n // Ephemeral live-only events.\n readonly textDelta: (payload: TextDeltaPayload) => Effect.Effect<TextDeltaEvent>;\n readonly reasoningDelta: (payload: ReasoningDeltaPayload) => Effect.Effect<ReasoningDeltaEvent>;\n readonly toolParamsStart: (\n payload: ToolParamsStartPayload,\n ) => Effect.Effect<ToolParamsStartEvent>;\n readonly toolParamsDelta: (\n payload: ToolParamsDeltaPayload,\n ) => Effect.Effect<ToolParamsDeltaEvent>;\n readonly toolParamsEnd: (payload: ToolParamsEndPayload) => Effect.Effect<ToolParamsEndEvent>;\n}\n\n/**\n * The one construction path for built-in event envelopes. It closes over the\n * session identity, mints `eventId`s, and stamps `createdAtMs` from the\n * ambient `Clock`, so lifecycle code provides only the payload.\n */\nexport class EventFactory extends Context.Service<EventFactory, EventFactoryShape>()(\n \"@effect-durable-agent/EventFactory\",\n) {\n static readonly Live = Layer.effect(\n EventFactory,\n Effect.gen(function* () {\n const { sessionId } = yield* SessionContext;\n const ids = yield* IdGenerator;\n\n const envelope = (durability: \"durable\" | \"ephemeral\") =>\n Effect.gen(function* () {\n const eventId = yield* ids.makeEventId();\n const nowMs = yield* Clock.currentTimeMillis;\n const trace = yield* currentOrRootEDAEventTrace;\n return {\n namespace: effectDurableAgentNamespace,\n schemaVersion: schemaV1,\n durability,\n eventId,\n sessionId,\n createdAtMs: UnixEpochMillis.make(nowMs),\n trace,\n };\n });\n\n const event =\n (durability: \"durable\" | \"ephemeral\") =>\n <Payload, Event>(schema: { readonly make: (input: never) => Event }, type: EventType) =>\n (payload: Payload): Effect.Effect<Event> =>\n Effect.map(envelope(durability), (fields) =>\n schema.make({ ...fields, type, payload } as never),\n );\n const durable = event(\"durable\");\n const ephemeral = event(\"ephemeral\");\n\n return {\n commandAdmitted: durable<CommandAdmittedPayload, CommandAdmittedEvent>(\n CommandAdmittedEvent,\n commandAdmittedEventType,\n ),\n commandStarted: durable<CommandStartedPayload, CommandStartedEvent>(\n CommandStartedEvent,\n commandStartedEventType,\n ),\n commandCompleted: durable<CommandCompletedPayload, CommandCompletedEvent>(\n CommandCompletedEvent,\n commandCompletedEventType,\n ),\n commandFailed: durable<CommandFailedPayload, CommandFailedEvent>(\n CommandFailedEvent,\n commandFailedEventType,\n ),\n commandCancelled: durable<CommandCancelledPayload, CommandCancelledEvent>(\n CommandCancelledEvent,\n commandCancelledEventType,\n ),\n systemMessageCommitted: durable<SystemMessageCommittedPayload, SystemMessageCommittedEvent>(\n SystemMessageCommittedEvent,\n systemMessageCommittedEventType,\n ),\n userMessageCommitted: durable<UserMessageCommittedPayload, UserMessageCommittedEvent>(\n UserMessageCommittedEvent,\n userMessageCommittedEventType,\n ),\n userMessageSubmitted: durable<UserMessageSubmittedPayload, UserMessageSubmittedEvent>(\n UserMessageSubmittedEvent,\n userMessageSubmittedEventType,\n ),\n userMessagePromoted: durable<UserMessagePromotedPayload, UserMessagePromotedEvent>(\n UserMessagePromotedEvent,\n userMessagePromotedEventType,\n ),\n userMessageCancelled: durable<UserMessageCancelledPayload, UserMessageCancelledEvent>(\n UserMessageCancelledEvent,\n userMessageCancelledEventType,\n ),\n pendingMessagesPaused: durable<PendingMessagesPausedPayload, PendingMessagesPausedEvent>(\n PendingMessagesPausedEvent,\n pendingMessagesPausedEventType,\n ),\n steeringMessageQueued: durable<SteeringMessageQueuedPayload, SteeringMessageQueuedEvent>(\n SteeringMessageQueuedEvent,\n steeringMessageQueuedEventType,\n ),\n steeringMessageCancelled: durable<\n SteeringMessageCancelledPayload,\n SteeringMessageCancelledEvent\n >(SteeringMessageCancelledEvent, steeringMessageCancelledEventType),\n assistantMessageCommitted: durable<\n AssistantMessageCommittedPayload,\n AssistantMessageCommittedEvent\n >(AssistantMessageCommittedEvent, assistantMessageCommittedEventType),\n assistantPartialCommitted: durable<\n AssistantPartialCommittedPayload,\n AssistantPartialCommittedEvent\n >(AssistantPartialCommittedEvent, assistantPartialCommittedEventType),\n runSchedulingRequested: durable<RunSchedulingRequestedPayload, RunSchedulingRequestedEvent>(\n RunSchedulingRequestedEvent,\n runSchedulingRequestedEventType,\n ),\n runSchedulingDelivered: durable<RunSchedulingDeliveredPayload, RunSchedulingDeliveredEvent>(\n RunSchedulingDeliveredEvent,\n runSchedulingDeliveredEventType,\n ),\n runSchedulingInvalidated: durable<\n RunSchedulingInvalidatedPayload,\n RunSchedulingInvalidatedEvent\n >(RunSchedulingInvalidatedEvent, runSchedulingInvalidatedEventType),\n runSchedulingGranted: durable<RunSchedulingGrantedPayload, RunSchedulingGrantedEvent>(\n RunSchedulingGrantedEvent,\n runSchedulingGrantedEventType,\n ),\n runStarted: durable<RunStartedPayload, RunStartedEvent>(\n RunStartedEvent,\n runStartedEventType,\n ),\n runCompleted: durable<RunCompletedPayload, RunCompletedEvent>(\n RunCompletedEvent,\n runCompletedEventType,\n ),\n runFailed: durable<RunFailedPayload, RunFailedEvent>(RunFailedEvent, runFailedEventType),\n recoveryCompleted: durable<RecoveryCompletedPayload, RecoveryCompletedEvent>(\n RecoveryCompletedEvent,\n recoveryCompletedEventType,\n ),\n runInterrupted: durable<RunInterruptedPayload, RunInterruptedEvent>(\n RunInterruptedEvent,\n runInterruptedEventType,\n ),\n turnStarted: durable<TurnStartedPayload, TurnStartedEvent>(\n TurnStartedEvent,\n turnStartedEventType,\n ),\n turnCompleted: durable<TurnCompletedPayload, TurnCompletedEvent>(\n TurnCompletedEvent,\n turnCompletedEventType,\n ),\n turnFailed: durable<TurnFailedPayload, TurnFailedEvent>(\n TurnFailedEvent,\n turnFailedEventType,\n ),\n turnStopped: durable<TurnStoppedPayload, TurnStoppedEvent>(\n TurnStoppedEvent,\n turnStoppedEventType,\n ),\n inferenceStarted: durable<InferenceStartedPayload, InferenceStartedEvent>(\n InferenceStartedEvent,\n inferenceStartedEventType,\n ),\n inferenceCompleted: durable<InferenceCompletedPayload, InferenceCompletedEvent>(\n InferenceCompletedEvent,\n inferenceCompletedEventType,\n ),\n inferenceFailed: durable<InferenceFailedPayload, InferenceFailedEvent>(\n InferenceFailedEvent,\n inferenceFailedEventType,\n ),\n toolCallCreated: durable<ToolCallCreatedPayload, ToolCallCreatedEvent>(\n ToolCallCreatedEvent,\n toolCallCreatedEventType,\n ),\n toolCallRejected: durable<ToolCallRejectedPayload, ToolCallRejectedEvent>(\n ToolCallRejectedEvent,\n toolCallRejectedEventType,\n ),\n toolCallStarted: durable<ToolCallStartedPayload, ToolCallStartedEvent>(\n ToolCallStartedEvent,\n toolCallStartedEventType,\n ),\n toolCallCompleted: durable<ToolCallCompletedPayload, ToolCallCompletedEvent>(\n ToolCallCompletedEvent,\n toolCallCompletedEventType,\n ),\n toolCallFailed: durable<ToolCallFailedPayload, ToolCallFailedEvent>(\n ToolCallFailedEvent,\n toolCallFailedEventType,\n ),\n stopTurnRequested: durable<StopTurnRequestedPayload, StopTurnRequestedEvent>(\n StopTurnRequestedEvent,\n stopTurnRequestedEventType,\n ),\n stopTurnApplied: durable<StopTurnAppliedPayload, StopTurnAppliedEvent>(\n StopTurnAppliedEvent,\n stopTurnAppliedEventType,\n ),\n compactionRequested: durable<CompactionRequestedPayload, CompactionRequestedEvent>(\n CompactionRequestedEvent,\n compactionRequestedEventType,\n ),\n compactionStarted: durable<CompactionStartedPayload, CompactionStartedEvent>(\n CompactionStartedEvent,\n compactionStartedEventType,\n ),\n summaryCreated: durable<SummaryCreatedPayload, SummaryCreatedEvent>(\n SummaryCreatedEvent,\n summaryCreatedEventType,\n ),\n contextRebased: durable<ContextRebasedPayload, ContextRebasedEvent>(\n ContextRebasedEvent,\n contextRebasedEventType,\n ),\n compactionCompleted: durable<CompactionCompletedPayload, CompactionCompletedEvent>(\n CompactionCompletedEvent,\n compactionCompletedEventType,\n ),\n compactionFailed: durable<CompactionFailedPayload, CompactionFailedEvent>(\n CompactionFailedEvent,\n compactionFailedEventType,\n ),\n textDelta: ephemeral<TextDeltaPayload, TextDeltaEvent>(TextDeltaEvent, textDeltaEventType),\n reasoningDelta: ephemeral<ReasoningDeltaPayload, ReasoningDeltaEvent>(\n ReasoningDeltaEvent,\n reasoningDeltaEventType,\n ),\n toolParamsStart: ephemeral<ToolParamsStartPayload, ToolParamsStartEvent>(\n ToolParamsStartEvent,\n toolParamsStartEventType,\n ),\n toolParamsDelta: ephemeral<ToolParamsDeltaPayload, ToolParamsDeltaEvent>(\n ToolParamsDeltaEvent,\n toolParamsDeltaEventType,\n ),\n toolParamsEnd: ephemeral<ToolParamsEndPayload, ToolParamsEndEvent>(\n ToolParamsEndEvent,\n toolParamsEndEventType,\n ),\n };\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBAAb,MAAa,uBAAuB,QAAQ,QAA6C,CAAC,CACxF,sCACF,CAAC,CAAC;CACA,OAAgB,QAAQ,cAAyB,MAAM,QAAQ,gBAAgB,EAAE,UAAU,CAAC;AAC9F;;;;;;;;AC8QA,IAAa,eAAb,MAAa,qBAAqB,QAAQ,QAAyC,CAAC,CAClF,oCACF,CAAC,CAAC;CACA,OAAgB,OAAO,MAAM,OAC3B,cACA,OAAO,IAAI,aAAa;EACtB,MAAM,EAAE,cAAc,OAAO;EAC7B,MAAM,MAAM,OAAO;EAEnB,MAAM,YAAY,eAChB,OAAO,IAAI,aAAa;GACtB,MAAM,UAAU,OAAO,IAAI,YAAY;GACvC,MAAM,QAAQ,OAAO,MAAM;GAC3B,MAAM,QAAQ,OAAO;GACrB,OAAO;IACL,WAAW;IACX,eAAe;IACf;IACA;IACA;IACA,aAAa,gBAAgB,KAAK,KAAK;IACvC;GACF;EACF,CAAC;EAEH,MAAM,SACH,gBACgB,QAAoD,UACpE,YACC,OAAO,IAAI,SAAS,UAAU,IAAI,WAChC,OAAO,KAAK;GAAE,GAAG;GAAQ;GAAM;EAAQ,CAAU,CACnD;EACJ,MAAM,UAAU,MAAM,SAAS;EAC/B,MAAM,YAAY,MAAM,WAAW;EAEnC,OAAO;GACL,iBAAiB,QACf,sBACA,wBACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,eAAe,QACb,oBACA,sBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,wBAAwB,QACtB,6BACA,+BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,uBAAuB,QACrB,4BACA,8BACF;GACA,uBAAuB,QACrB,4BACA,8BACF;GACA,0BAA0B,QAGxB,+BAA+B,iCAAiC;GAClE,2BAA2B,QAGzB,gCAAgC,kCAAkC;GACpE,2BAA2B,QAGzB,gCAAgC,kCAAkC;GACpE,wBAAwB,QACtB,6BACA,+BACF;GACA,wBAAwB,QACtB,6BACA,+BACF;GACA,0BAA0B,QAGxB,+BAA+B,iCAAiC;GAClE,sBAAsB,QACpB,2BACA,6BACF;GACA,YAAY,QACV,iBACA,mBACF;GACA,cAAc,QACZ,mBACA,qBACF;GACA,WAAW,QAA0C,gBAAgB,kBAAkB;GACvF,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,aAAa,QACX,kBACA,oBACF;GACA,eAAe,QACb,oBACA,sBACF;GACA,YAAY,QACV,iBACA,mBACF;GACA,aAAa,QACX,kBACA,oBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,oBAAoB,QAClB,yBACA,2BACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,WAAW,UAA4C,gBAAgB,kBAAkB;GACzF,gBAAgB,UACd,qBACA,uBACF;GACA,iBAAiB,UACf,sBACA,wBACF;GACA,iBAAiB,UACf,sBACA,wBACF;GACA,eAAe,UACb,oBACA,sBACF;EACF;CACF,CAAC,CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"event-factory-_vF1bIJ7.js","names":[],"sources":["../src/services/session-context.ts","../src/services/event-factory.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\n\nimport { SessionId } from \"../types/core\";\n\n/** Runtime-scoped session identity dependency. */\nexport interface SessionContextShape {\n /** The one session this runtime instance owns; fixed for the runtime lifetime. */\n readonly sessionId: SessionId;\n}\n\n/**\n * Identity of the session a runtime instance is bound to. One runtime = one\n * session, so services read the session here instead of threading `sessionId`\n * through every input struct.\n */\nexport class SessionContext extends Context.Service<SessionContext, SessionContextShape>()(\n \"@effect-durable-agent/SessionContext\",\n) {\n static readonly Live = (sessionId: SessionId) => Layer.succeed(SessionContext, { sessionId });\n}\n","import * as Clock from \"effect/Clock\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n\nimport {\n CommandAdmittedEvent,\n CommandAdmittedPayload,\n CommandCancelledEvent,\n CommandCancelledPayload,\n CommandCompletedEvent,\n CommandCompletedPayload,\n CommandFailedEvent,\n CommandFailedPayload,\n CommandStartedEvent,\n CommandStartedPayload,\n CompactionCompletedEvent,\n CompactionCompletedPayload,\n CompactionFailedEvent,\n CompactionFailedPayload,\n CompactionRequestedEvent,\n CompactionRequestedPayload,\n CompactionStartedEvent,\n CompactionStartedPayload,\n ContextRebasedEvent,\n ContextRebasedPayload,\n AssistantMessageCommittedEvent,\n AssistantMessageCommittedPayload,\n AssistantPartialCommittedEvent,\n AssistantPartialCommittedPayload,\n EventType,\n InferenceCompletedEvent,\n InferenceCompletedPayload,\n InferenceFailedEvent,\n InferenceFailedPayload,\n InferenceStartedEvent,\n InferenceStartedPayload,\n SummaryCreatedEvent,\n SummaryCreatedPayload,\n SystemMessageCommittedEvent,\n SystemMessageCommittedPayload,\n ReasoningDeltaEvent,\n ReasoningDeltaPayload,\n RecoveryCompletedEvent,\n RecoveryCompletedPayload,\n RunCompletedEvent,\n RunCompletedPayload,\n RunFailedEvent,\n RunFailedPayload,\n RunInterruptedEvent,\n RunInterruptedPayload,\n RunSchedulingRequestedEvent,\n RunSchedulingRequestedPayload,\n runSchedulingRequestedEventType,\n RunSchedulingDeliveredEvent,\n RunSchedulingDeliveredPayload,\n runSchedulingDeliveredEventType,\n RunSchedulingInvalidatedEvent,\n RunSchedulingInvalidatedPayload,\n runSchedulingInvalidatedEventType,\n RunSchedulingGrantedEvent,\n RunSchedulingGrantedPayload,\n runSchedulingGrantedEventType,\n RunStartedEvent,\n RunStartedPayload,\n StopTurnAppliedEvent,\n StopTurnAppliedPayload,\n StopTurnRequestedEvent,\n StopTurnRequestedPayload,\n SteeringMessageCancelledEvent,\n SteeringMessageCancelledPayload,\n SteeringMessageQueuedEvent,\n SteeringMessageQueuedPayload,\n TextDeltaEvent,\n TextDeltaPayload,\n ToolCallCompletedEvent,\n ToolCallCompletedPayload,\n ToolCallCreatedEvent,\n ToolCallCreatedPayload,\n ToolCallFailedEvent,\n ToolCallFailedPayload,\n ToolCallRejectedEvent,\n ToolCallRejectedPayload,\n ToolCallStartedEvent,\n ToolCallStartedPayload,\n ToolParamsDeltaEvent,\n ToolParamsDeltaPayload,\n ToolParamsEndEvent,\n ToolParamsEndPayload,\n ToolParamsStartEvent,\n ToolParamsStartPayload,\n TurnCompletedEvent,\n TurnCompletedPayload,\n TurnFailedEvent,\n TurnFailedPayload,\n TurnStartedEvent,\n TurnStartedPayload,\n TurnStoppedEvent,\n TurnStoppedPayload,\n UnixEpochMillis,\n UserMessageCommittedEvent,\n UserMessageCommittedPayload,\n UserMessageSubmittedEvent,\n UserMessageSubmittedPayload,\n UserMessagePromotedEvent,\n UserMessagePromotedPayload,\n UserMessageCancelledEvent,\n UserMessageCancelledPayload,\n PendingMessagesPausedEvent,\n PendingMessagesPausedPayload,\n commandAdmittedEventType,\n commandCancelledEventType,\n commandCompletedEventType,\n commandFailedEventType,\n commandStartedEventType,\n compactionCompletedEventType,\n compactionFailedEventType,\n compactionRequestedEventType,\n compactionStartedEventType,\n contextRebasedEventType,\n assistantMessageCommittedEventType,\n assistantPartialCommittedEventType,\n effectDurableAgentNamespace,\n inferenceCompletedEventType,\n inferenceFailedEventType,\n inferenceStartedEventType,\n reasoningDeltaEventType,\n recoveryCompletedEventType,\n runCompletedEventType,\n runFailedEventType,\n runInterruptedEventType,\n runStartedEventType,\n schemaV1,\n steeringMessageCancelledEventType,\n summaryCreatedEventType,\n systemMessageCommittedEventType,\n steeringMessageQueuedEventType,\n stopTurnAppliedEventType,\n stopTurnRequestedEventType,\n textDeltaEventType,\n toolCallCompletedEventType,\n toolCallCreatedEventType,\n toolCallFailedEventType,\n toolCallRejectedEventType,\n toolCallStartedEventType,\n toolParamsDeltaEventType,\n toolParamsEndEventType,\n toolParamsStartEventType,\n turnCompletedEventType,\n turnFailedEventType,\n turnStartedEventType,\n turnStoppedEventType,\n userMessageCommittedEventType,\n userMessageSubmittedEventType,\n userMessagePromotedEventType,\n userMessageCancelledEventType,\n pendingMessagesPausedEventType,\n} from \"../types/events\";\nimport { IdGenerator } from \"./id-generator\";\nimport { SessionContext } from \"./session-context\";\nimport { currentOrRootEDAEventTrace } from \"./tracing\";\n\n/** Central envelope factory that stamps session id, event id, and current clock time. */\nexport interface EventFactoryShape {\n // Durable lifecycle events.\n readonly commandAdmitted: (\n payload: CommandAdmittedPayload,\n ) => Effect.Effect<CommandAdmittedEvent>;\n readonly commandStarted: (payload: CommandStartedPayload) => Effect.Effect<CommandStartedEvent>;\n readonly commandCompleted: (\n payload: CommandCompletedPayload,\n ) => Effect.Effect<CommandCompletedEvent>;\n readonly commandFailed: (payload: CommandFailedPayload) => Effect.Effect<CommandFailedEvent>;\n readonly commandCancelled: (\n payload: CommandCancelledPayload,\n ) => Effect.Effect<CommandCancelledEvent>;\n readonly systemMessageCommitted: (\n payload: SystemMessageCommittedPayload,\n ) => Effect.Effect<SystemMessageCommittedEvent>;\n readonly userMessageCommitted: (\n payload: UserMessageCommittedPayload,\n ) => Effect.Effect<UserMessageCommittedEvent>;\n readonly userMessageSubmitted: (\n payload: UserMessageSubmittedPayload,\n ) => Effect.Effect<UserMessageSubmittedEvent>;\n readonly userMessagePromoted: (\n payload: UserMessagePromotedPayload,\n ) => Effect.Effect<UserMessagePromotedEvent>;\n readonly userMessageCancelled: (\n payload: UserMessageCancelledPayload,\n ) => Effect.Effect<UserMessageCancelledEvent>;\n readonly pendingMessagesPaused: (\n payload: PendingMessagesPausedPayload,\n ) => Effect.Effect<PendingMessagesPausedEvent>;\n readonly steeringMessageQueued: (\n payload: SteeringMessageQueuedPayload,\n ) => Effect.Effect<SteeringMessageQueuedEvent>;\n readonly steeringMessageCancelled: (\n payload: SteeringMessageCancelledPayload,\n ) => Effect.Effect<SteeringMessageCancelledEvent>;\n readonly assistantMessageCommitted: (\n payload: AssistantMessageCommittedPayload,\n ) => Effect.Effect<AssistantMessageCommittedEvent>;\n readonly assistantPartialCommitted: (\n payload: AssistantPartialCommittedPayload,\n ) => Effect.Effect<AssistantPartialCommittedEvent>;\n readonly runSchedulingRequested: (\n payload: RunSchedulingRequestedPayload,\n ) => Effect.Effect<RunSchedulingRequestedEvent>;\n readonly runSchedulingDelivered: (\n payload: RunSchedulingDeliveredPayload,\n ) => Effect.Effect<RunSchedulingDeliveredEvent>;\n readonly runSchedulingInvalidated: (\n payload: RunSchedulingInvalidatedPayload,\n ) => Effect.Effect<RunSchedulingInvalidatedEvent>;\n readonly runSchedulingGranted: (\n payload: RunSchedulingGrantedPayload,\n ) => Effect.Effect<RunSchedulingGrantedEvent>;\n readonly runStarted: (payload: RunStartedPayload) => Effect.Effect<RunStartedEvent>;\n readonly runCompleted: (payload: RunCompletedPayload) => Effect.Effect<RunCompletedEvent>;\n readonly runFailed: (payload: RunFailedPayload) => Effect.Effect<RunFailedEvent>;\n readonly recoveryCompleted: (\n payload: RecoveryCompletedPayload,\n ) => Effect.Effect<RecoveryCompletedEvent>;\n /** @deprecated Emit `runFailed` with `error.code = \"run.interrupted\"`. Retained for legacy event construction only. */\n readonly runInterrupted: (payload: RunInterruptedPayload) => Effect.Effect<RunInterruptedEvent>;\n readonly turnStarted: (payload: TurnStartedPayload) => Effect.Effect<TurnStartedEvent>;\n readonly turnCompleted: (payload: TurnCompletedPayload) => Effect.Effect<TurnCompletedEvent>;\n readonly turnFailed: (payload: TurnFailedPayload) => Effect.Effect<TurnFailedEvent>;\n /** @deprecated Emit `turnFailed` with `error.code = \"turn.interrupted\"`. Retained for legacy event construction only. */\n readonly turnStopped: (payload: TurnStoppedPayload) => Effect.Effect<TurnStoppedEvent>;\n readonly inferenceStarted: (\n payload: InferenceStartedPayload,\n ) => Effect.Effect<InferenceStartedEvent>;\n readonly inferenceCompleted: (\n payload: InferenceCompletedPayload,\n ) => Effect.Effect<InferenceCompletedEvent>;\n readonly inferenceFailed: (\n payload: InferenceFailedPayload,\n ) => Effect.Effect<InferenceFailedEvent>;\n readonly toolCallCreated: (\n payload: ToolCallCreatedPayload,\n ) => Effect.Effect<ToolCallCreatedEvent>;\n readonly toolCallRejected: (\n payload: ToolCallRejectedPayload,\n ) => Effect.Effect<ToolCallRejectedEvent>;\n readonly toolCallStarted: (\n payload: ToolCallStartedPayload,\n ) => Effect.Effect<ToolCallStartedEvent>;\n readonly toolCallCompleted: (\n payload: ToolCallCompletedPayload,\n ) => Effect.Effect<ToolCallCompletedEvent>;\n readonly toolCallFailed: (payload: ToolCallFailedPayload) => Effect.Effect<ToolCallFailedEvent>;\n readonly stopTurnRequested: (\n payload: StopTurnRequestedPayload,\n ) => Effect.Effect<StopTurnRequestedEvent>;\n readonly stopTurnApplied: (\n payload: StopTurnAppliedPayload,\n ) => Effect.Effect<StopTurnAppliedEvent>;\n readonly compactionRequested: (\n payload: CompactionRequestedPayload,\n ) => Effect.Effect<CompactionRequestedEvent>;\n readonly compactionStarted: (\n payload: CompactionStartedPayload,\n ) => Effect.Effect<CompactionStartedEvent>;\n readonly summaryCreated: (payload: SummaryCreatedPayload) => Effect.Effect<SummaryCreatedEvent>;\n readonly contextRebased: (payload: ContextRebasedPayload) => Effect.Effect<ContextRebasedEvent>;\n readonly compactionCompleted: (\n payload: CompactionCompletedPayload,\n ) => Effect.Effect<CompactionCompletedEvent>;\n readonly compactionFailed: (\n payload: CompactionFailedPayload,\n ) => Effect.Effect<CompactionFailedEvent>;\n // Ephemeral live-only events.\n readonly textDelta: (payload: TextDeltaPayload) => Effect.Effect<TextDeltaEvent>;\n readonly reasoningDelta: (payload: ReasoningDeltaPayload) => Effect.Effect<ReasoningDeltaEvent>;\n readonly toolParamsStart: (\n payload: ToolParamsStartPayload,\n ) => Effect.Effect<ToolParamsStartEvent>;\n readonly toolParamsDelta: (\n payload: ToolParamsDeltaPayload,\n ) => Effect.Effect<ToolParamsDeltaEvent>;\n readonly toolParamsEnd: (payload: ToolParamsEndPayload) => Effect.Effect<ToolParamsEndEvent>;\n}\n\n/**\n * The one construction path for built-in event envelopes. It closes over the\n * session identity, mints `eventId`s, and stamps `createdAtMs` from the\n * ambient `Clock`, so lifecycle code provides only the payload.\n */\nexport class EventFactory extends Context.Service<EventFactory, EventFactoryShape>()(\n \"@effect-durable-agent/EventFactory\",\n) {\n static readonly Live = Layer.effect(\n EventFactory,\n Effect.gen(function* () {\n const { sessionId } = yield* SessionContext;\n const ids = yield* IdGenerator;\n\n const envelope = (durability: \"durable\" | \"ephemeral\") =>\n Effect.gen(function* () {\n const eventId = yield* ids.makeEventId();\n const nowMs = yield* Clock.currentTimeMillis;\n const trace = yield* currentOrRootEDAEventTrace;\n return {\n namespace: effectDurableAgentNamespace,\n schemaVersion: schemaV1,\n durability,\n eventId,\n sessionId,\n createdAtMs: UnixEpochMillis.make(nowMs),\n trace,\n };\n });\n\n const event =\n (durability: \"durable\" | \"ephemeral\") =>\n <Payload, Event>(schema: { readonly make: (input: never) => Event }, type: EventType) =>\n (payload: Payload): Effect.Effect<Event> =>\n Effect.map(envelope(durability), (fields) =>\n schema.make({ ...fields, type, payload } as never),\n );\n const durable = event(\"durable\");\n const ephemeral = event(\"ephemeral\");\n\n return {\n commandAdmitted: durable<CommandAdmittedPayload, CommandAdmittedEvent>(\n CommandAdmittedEvent,\n commandAdmittedEventType,\n ),\n commandStarted: durable<CommandStartedPayload, CommandStartedEvent>(\n CommandStartedEvent,\n commandStartedEventType,\n ),\n commandCompleted: durable<CommandCompletedPayload, CommandCompletedEvent>(\n CommandCompletedEvent,\n commandCompletedEventType,\n ),\n commandFailed: durable<CommandFailedPayload, CommandFailedEvent>(\n CommandFailedEvent,\n commandFailedEventType,\n ),\n commandCancelled: durable<CommandCancelledPayload, CommandCancelledEvent>(\n CommandCancelledEvent,\n commandCancelledEventType,\n ),\n systemMessageCommitted: durable<SystemMessageCommittedPayload, SystemMessageCommittedEvent>(\n SystemMessageCommittedEvent,\n systemMessageCommittedEventType,\n ),\n userMessageCommitted: durable<UserMessageCommittedPayload, UserMessageCommittedEvent>(\n UserMessageCommittedEvent,\n userMessageCommittedEventType,\n ),\n userMessageSubmitted: durable<UserMessageSubmittedPayload, UserMessageSubmittedEvent>(\n UserMessageSubmittedEvent,\n userMessageSubmittedEventType,\n ),\n userMessagePromoted: durable<UserMessagePromotedPayload, UserMessagePromotedEvent>(\n UserMessagePromotedEvent,\n userMessagePromotedEventType,\n ),\n userMessageCancelled: durable<UserMessageCancelledPayload, UserMessageCancelledEvent>(\n UserMessageCancelledEvent,\n userMessageCancelledEventType,\n ),\n pendingMessagesPaused: durable<PendingMessagesPausedPayload, PendingMessagesPausedEvent>(\n PendingMessagesPausedEvent,\n pendingMessagesPausedEventType,\n ),\n steeringMessageQueued: durable<SteeringMessageQueuedPayload, SteeringMessageQueuedEvent>(\n SteeringMessageQueuedEvent,\n steeringMessageQueuedEventType,\n ),\n steeringMessageCancelled: durable<\n SteeringMessageCancelledPayload,\n SteeringMessageCancelledEvent\n >(SteeringMessageCancelledEvent, steeringMessageCancelledEventType),\n assistantMessageCommitted: durable<\n AssistantMessageCommittedPayload,\n AssistantMessageCommittedEvent\n >(AssistantMessageCommittedEvent, assistantMessageCommittedEventType),\n assistantPartialCommitted: durable<\n AssistantPartialCommittedPayload,\n AssistantPartialCommittedEvent\n >(AssistantPartialCommittedEvent, assistantPartialCommittedEventType),\n runSchedulingRequested: durable<RunSchedulingRequestedPayload, RunSchedulingRequestedEvent>(\n RunSchedulingRequestedEvent,\n runSchedulingRequestedEventType,\n ),\n runSchedulingDelivered: durable<RunSchedulingDeliveredPayload, RunSchedulingDeliveredEvent>(\n RunSchedulingDeliveredEvent,\n runSchedulingDeliveredEventType,\n ),\n runSchedulingInvalidated: durable<\n RunSchedulingInvalidatedPayload,\n RunSchedulingInvalidatedEvent\n >(RunSchedulingInvalidatedEvent, runSchedulingInvalidatedEventType),\n runSchedulingGranted: durable<RunSchedulingGrantedPayload, RunSchedulingGrantedEvent>(\n RunSchedulingGrantedEvent,\n runSchedulingGrantedEventType,\n ),\n runStarted: durable<RunStartedPayload, RunStartedEvent>(\n RunStartedEvent,\n runStartedEventType,\n ),\n runCompleted: durable<RunCompletedPayload, RunCompletedEvent>(\n RunCompletedEvent,\n runCompletedEventType,\n ),\n runFailed: durable<RunFailedPayload, RunFailedEvent>(RunFailedEvent, runFailedEventType),\n recoveryCompleted: durable<RecoveryCompletedPayload, RecoveryCompletedEvent>(\n RecoveryCompletedEvent,\n recoveryCompletedEventType,\n ),\n runInterrupted: durable<RunInterruptedPayload, RunInterruptedEvent>(\n RunInterruptedEvent,\n runInterruptedEventType,\n ),\n turnStarted: durable<TurnStartedPayload, TurnStartedEvent>(\n TurnStartedEvent,\n turnStartedEventType,\n ),\n turnCompleted: durable<TurnCompletedPayload, TurnCompletedEvent>(\n TurnCompletedEvent,\n turnCompletedEventType,\n ),\n turnFailed: durable<TurnFailedPayload, TurnFailedEvent>(\n TurnFailedEvent,\n turnFailedEventType,\n ),\n turnStopped: durable<TurnStoppedPayload, TurnStoppedEvent>(\n TurnStoppedEvent,\n turnStoppedEventType,\n ),\n inferenceStarted: durable<InferenceStartedPayload, InferenceStartedEvent>(\n InferenceStartedEvent,\n inferenceStartedEventType,\n ),\n inferenceCompleted: durable<InferenceCompletedPayload, InferenceCompletedEvent>(\n InferenceCompletedEvent,\n inferenceCompletedEventType,\n ),\n inferenceFailed: durable<InferenceFailedPayload, InferenceFailedEvent>(\n InferenceFailedEvent,\n inferenceFailedEventType,\n ),\n toolCallCreated: durable<ToolCallCreatedPayload, ToolCallCreatedEvent>(\n ToolCallCreatedEvent,\n toolCallCreatedEventType,\n ),\n toolCallRejected: durable<ToolCallRejectedPayload, ToolCallRejectedEvent>(\n ToolCallRejectedEvent,\n toolCallRejectedEventType,\n ),\n toolCallStarted: durable<ToolCallStartedPayload, ToolCallStartedEvent>(\n ToolCallStartedEvent,\n toolCallStartedEventType,\n ),\n toolCallCompleted: durable<ToolCallCompletedPayload, ToolCallCompletedEvent>(\n ToolCallCompletedEvent,\n toolCallCompletedEventType,\n ),\n toolCallFailed: durable<ToolCallFailedPayload, ToolCallFailedEvent>(\n ToolCallFailedEvent,\n toolCallFailedEventType,\n ),\n stopTurnRequested: durable<StopTurnRequestedPayload, StopTurnRequestedEvent>(\n StopTurnRequestedEvent,\n stopTurnRequestedEventType,\n ),\n stopTurnApplied: durable<StopTurnAppliedPayload, StopTurnAppliedEvent>(\n StopTurnAppliedEvent,\n stopTurnAppliedEventType,\n ),\n compactionRequested: durable<CompactionRequestedPayload, CompactionRequestedEvent>(\n CompactionRequestedEvent,\n compactionRequestedEventType,\n ),\n compactionStarted: durable<CompactionStartedPayload, CompactionStartedEvent>(\n CompactionStartedEvent,\n compactionStartedEventType,\n ),\n summaryCreated: durable<SummaryCreatedPayload, SummaryCreatedEvent>(\n SummaryCreatedEvent,\n summaryCreatedEventType,\n ),\n contextRebased: durable<ContextRebasedPayload, ContextRebasedEvent>(\n ContextRebasedEvent,\n contextRebasedEventType,\n ),\n compactionCompleted: durable<CompactionCompletedPayload, CompactionCompletedEvent>(\n CompactionCompletedEvent,\n compactionCompletedEventType,\n ),\n compactionFailed: durable<CompactionFailedPayload, CompactionFailedEvent>(\n CompactionFailedEvent,\n compactionFailedEventType,\n ),\n textDelta: ephemeral<TextDeltaPayload, TextDeltaEvent>(TextDeltaEvent, textDeltaEventType),\n reasoningDelta: ephemeral<ReasoningDeltaPayload, ReasoningDeltaEvent>(\n ReasoningDeltaEvent,\n reasoningDeltaEventType,\n ),\n toolParamsStart: ephemeral<ToolParamsStartPayload, ToolParamsStartEvent>(\n ToolParamsStartEvent,\n toolParamsStartEventType,\n ),\n toolParamsDelta: ephemeral<ToolParamsDeltaPayload, ToolParamsDeltaEvent>(\n ToolParamsDeltaEvent,\n toolParamsDeltaEventType,\n ),\n toolParamsEnd: ephemeral<ToolParamsEndPayload, ToolParamsEndEvent>(\n ToolParamsEndEvent,\n toolParamsEndEventType,\n ),\n };\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBAAb,MAAa,uBAAuB,QAAQ,QAA6C,CAAC,CACxF,sCACF,CAAC,CAAC;CACA,OAAgB,QAAQ,cAAyB,MAAM,QAAQ,gBAAgB,EAAE,UAAU,CAAC;AAC9F;;;;;;;;AC8QA,IAAa,eAAb,MAAa,qBAAqB,QAAQ,QAAyC,CAAC,CAClF,oCACF,CAAC,CAAC;CACA,OAAgB,OAAO,MAAM,OAC3B,cACA,OAAO,IAAI,aAAa;EACtB,MAAM,EAAE,cAAc,OAAO;EAC7B,MAAM,MAAM,OAAO;EAEnB,MAAM,YAAY,eAChB,OAAO,IAAI,aAAa;GACtB,MAAM,UAAU,OAAO,IAAI,YAAY;GACvC,MAAM,QAAQ,OAAO,MAAM;GAC3B,MAAM,QAAQ,OAAO;GACrB,OAAO;IACL,WAAW;IACX,eAAe;IACf;IACA;IACA;IACA,aAAa,gBAAgB,KAAK,KAAK;IACvC;GACF;EACF,CAAC;EAEH,MAAM,SACH,gBACgB,QAAoD,UACpE,YACC,OAAO,IAAI,SAAS,UAAU,IAAI,WAChC,OAAO,KAAK;GAAE,GAAG;GAAQ;GAAM;EAAQ,CAAU,CACnD;EACJ,MAAM,UAAU,MAAM,SAAS;EAC/B,MAAM,YAAY,MAAM,WAAW;EAEnC,OAAO;GACL,iBAAiB,QACf,sBACA,wBACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,eAAe,QACb,oBACA,sBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,wBAAwB,QACtB,6BACA,+BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,uBAAuB,QACrB,4BACA,8BACF;GACA,uBAAuB,QACrB,4BACA,8BACF;GACA,0BAA0B,QAGxB,+BAA+B,iCAAiC;GAClE,2BAA2B,QAGzB,gCAAgC,kCAAkC;GACpE,2BAA2B,QAGzB,gCAAgC,kCAAkC;GACpE,wBAAwB,QACtB,6BACA,+BACF;GACA,wBAAwB,QACtB,6BACA,+BACF;GACA,0BAA0B,QAGxB,+BAA+B,iCAAiC;GAClE,sBAAsB,QACpB,2BACA,6BACF;GACA,YAAY,QACV,iBACA,mBACF;GACA,cAAc,QACZ,mBACA,qBACF;GACA,WAAW,QAA0C,gBAAgB,kBAAkB;GACvF,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,aAAa,QACX,kBACA,oBACF;GACA,eAAe,QACb,oBACA,sBACF;GACA,YAAY,QACV,iBACA,mBACF;GACA,aAAa,QACX,kBACA,oBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,oBAAoB,QAClB,yBACA,2BACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,WAAW,UAA4C,gBAAgB,kBAAkB;GACzF,gBAAgB,UACd,qBACA,uBACF;GACA,iBAAiB,UACf,sBACA,wBACF;GACA,iBAAiB,UACf,sBACA,wBACF;GACA,eAAe,UACb,oBACA,sBACF;EACF;CACF,CAAC,CACH;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./tracing-BwjbF285.js";
|
|
2
2
|
import "./envelope-Che6KatU.js";
|
|
3
|
-
import "./durable-
|
|
3
|
+
import "./durable-Cqv5ZRFA.js";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
//#region src/types/events/ephemeral.d.ts
|
|
6
6
|
/** Event type values for ephemeral model stream events. */
|
|
@@ -731,4 +731,4 @@ declare const EDAEphemeralEvent: Schema.Union<readonly [Schema.Union<readonly [S
|
|
|
731
731
|
type EDAEphemeralEvent = typeof EDAEphemeralEvent.Type;
|
|
732
732
|
//#endregion
|
|
733
733
|
export { toolParamsDeltaEventType as C, traceStatusEventType as E, textDeltaEventType as S, toolParamsStartEventType as T, TraceStatusEvent as _, RuntimeStatusEvent as a, reasoningDeltaEventType as b, SubscriberStatusPayload as c, ToolParamsDeltaEvent as d, ToolParamsDeltaPayload as f, ToolParamsStartPayload as g, ToolParamsStartEvent as h, ReasoningDeltaPayload as i, TextDeltaEvent as l, ToolParamsEndPayload as m, ModelStreamEvent as n, SubscriberStatusEvent as o, ToolParamsEndEvent as p, ReasoningDeltaEvent as r, SubscriberStatusKind as s, EDAEphemeralEvent as t, TextDeltaPayload as u, TraceStatusKind as v, toolParamsEndEventType as w, subscriberStatusEventType as x, TraceStatusPayload as y };
|
|
734
|
-
//# sourceMappingURL=events-
|
|
734
|
+
//# sourceMappingURL=events-Dg0o5wWs.d.ts.map
|