effect-durable-agent 0.1.0-alpha.1 → 0.1.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +140 -136
  2. package/dist/{command-queues-CQ9cwRP7.d.ts → command-queues-B45Xa1Dl.d.ts} +109 -21
  3. package/dist/{commands-Ce1ec6kH.d.ts → commands-p8venTWs.d.ts} +10 -2
  4. package/dist/compaction-0k8zCJgB.js +473 -0
  5. package/dist/compaction-0k8zCJgB.js.map +1 -0
  6. package/dist/{compaction-YayFKo_1.d.ts → compaction-DoTyQf6k.d.ts} +28 -7
  7. package/dist/context-projection-CCoN8m9W.d.ts +140 -0
  8. package/dist/{core-Hv3cFydL.d.ts → core-C-6xHzRx.d.ts} +6 -3
  9. package/dist/domain/command-queues.d.ts +1 -1
  10. package/dist/domain/command-queues.js +1 -1
  11. package/dist/domain/command-queues.js.map +1 -1
  12. package/dist/domain/context-projection.d.ts +2 -0
  13. package/dist/domain/context-projection.js +32 -0
  14. package/dist/domain/context-projection.js.map +1 -0
  15. package/dist/domain/message-transcript.d.ts +1 -1
  16. package/dist/domain/model-usage.d.ts +2 -0
  17. package/dist/domain/model-usage.js +59 -0
  18. package/dist/domain/model-usage.js.map +1 -0
  19. package/dist/domain/reduced-state-schema.d.ts +14 -18
  20. package/dist/domain/reduced-state-schema.js +7 -11
  21. package/dist/domain/reduced-state-schema.js.map +1 -1
  22. package/dist/domain/reduced-state.d.ts +3 -2
  23. package/dist/domain/reduced-state.js +3 -2
  24. package/dist/domain/run-scheduling.d.ts +2 -0
  25. package/dist/domain/run-scheduling.js +127 -0
  26. package/dist/domain/run-scheduling.js.map +1 -0
  27. package/dist/{durable-C3Rz7kg3.js → durable-BPHVFVvV.js} +74 -83
  28. package/dist/durable-BPHVFVvV.js.map +1 -0
  29. package/dist/{durable-DlScwmCy.d.ts → durable-DeLCAvbw.d.ts} +1256 -104
  30. package/dist/envelope-DkZyMIgp.d.ts +191 -0
  31. package/dist/envelope-DxQzo5rN.js +82 -0
  32. package/dist/envelope-DxQzo5rN.js.map +1 -0
  33. package/dist/{keep-alive-DYDsH6qN.d.ts → event-factory-EL4szNWm.d.ts} +10 -30
  34. package/dist/{keep-alive-p8dIcSVy.js → event-factory-QuC_UvyP.js} +8 -10
  35. package/dist/event-factory-QuC_UvyP.js.map +1 -0
  36. package/dist/{events-Bb9-Cu-7.d.ts → events-LZFNoESe.d.ts} +2 -188
  37. package/dist/{id-generator-C2Q15uZM.d.ts → id-generator--x6itQZ2.d.ts} +3 -2
  38. package/dist/index.d.ts +7 -6
  39. package/dist/index.js +5 -4
  40. package/dist/keep-alive-Chl5SJxy.d.ts +29 -0
  41. package/dist/{message-transcript-BCHdHAe2.d.ts → message-transcript-Dr6Rk-re.d.ts} +4 -4
  42. package/dist/model-resolver-BPPJAsuh.d.ts +18 -0
  43. package/dist/model-usage-CdBEkTwU.d.ts +55 -0
  44. package/dist/{prompt-projector-9_02lk5-.d.ts → prompt-projector-BpRH-Ec-.d.ts} +15 -16
  45. package/dist/{reduced-state-C4nVVzz9.js → reduced-state-Bz68V2H8.js} +65 -32
  46. package/dist/reduced-state-Bz68V2H8.js.map +1 -0
  47. package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-DjP1qqbs.d.ts} +16 -6
  48. package/dist/run-scheduler-DvHWwWBJ.d.ts +43 -0
  49. package/dist/run-scheduling-wakeup-CGgJ7RNe.d.ts +25 -0
  50. package/dist/{runtime-C56FQxiL.d.ts → runtime-BFsU92E7.d.ts} +15 -6
  51. package/dist/services/compaction.d.ts +1 -1
  52. package/dist/services/compaction.js +1 -425
  53. package/dist/services/id-generator.d.ts +1 -1
  54. package/dist/services/id-generator.js +2 -1
  55. package/dist/services/id-generator.js.map +1 -1
  56. package/dist/services/keep-alive.d.ts +2 -0
  57. package/dist/services/keep-alive.js +13 -0
  58. package/dist/services/keep-alive.js.map +1 -0
  59. package/dist/services/model-resolver.d.ts +2 -0
  60. package/dist/services/model-resolver.js +17 -0
  61. package/dist/services/model-resolver.js.map +1 -0
  62. package/dist/services/prompt-projector.d.ts +2 -2
  63. package/dist/services/prompt-projector.js +20 -10
  64. package/dist/services/prompt-projector.js.map +1 -1
  65. package/dist/services/reducer-registry.d.ts +2 -2
  66. package/dist/services/reducer-registry.js +7 -3
  67. package/dist/services/reducer-registry.js.map +1 -1
  68. package/dist/services/run-scheduler.d.ts +3 -0
  69. package/dist/services/run-scheduler.js +25 -0
  70. package/dist/services/run-scheduler.js.map +1 -0
  71. package/dist/services/run-scheduling-wakeup.d.ts +2 -0
  72. package/dist/services/run-scheduling-wakeup.js +13 -0
  73. package/dist/services/run-scheduling-wakeup.js.map +1 -0
  74. package/dist/services/runtime-layer.d.ts +67 -0
  75. package/dist/services/runtime-layer.js +47 -0
  76. package/dist/services/runtime-layer.js.map +1 -0
  77. package/dist/services/runtime.d.ts +1 -1
  78. package/dist/services/runtime.js +21 -14
  79. package/dist/services/runtime.js.map +1 -1
  80. package/dist/services/session-event-observer.d.ts +2 -0
  81. package/dist/services/session-event-observer.js +13 -0
  82. package/dist/services/session-event-observer.js.map +1 -0
  83. package/dist/services/session-query.d.ts +2 -2
  84. package/dist/services/session-query.js +140 -1
  85. package/dist/services/session-query.js.map +1 -0
  86. package/dist/services/session-state.d.ts +2 -0
  87. package/dist/services/session-state.js +2 -0
  88. package/dist/services/session-store.d.ts +2 -2
  89. package/dist/services/session-store.js +182 -2
  90. package/dist/services/session-store.js.map +1 -0
  91. package/dist/services/sink-checkpoint-store.d.ts +2 -0
  92. package/dist/services/sink-checkpoint-store.js +49 -0
  93. package/dist/services/sink-checkpoint-store.js.map +1 -0
  94. package/dist/services/sink-registry.d.ts +1 -1
  95. package/dist/services/sink-registry.js +1 -1
  96. package/dist/services/span-names.d.ts +1 -1
  97. package/dist/services/span-names.js +3 -0
  98. package/dist/services/span-names.js.map +1 -1
  99. package/dist/services/tool-registry.d.ts +1 -1
  100. package/dist/services/tracing.d.ts +1 -1
  101. package/dist/services/tracing.js +23 -2
  102. package/dist/services/tracing.js.map +1 -1
  103. package/dist/session-event-observer-DaFMKKNc.d.ts +24 -0
  104. package/dist/session-query-Bo_wroPS.d.ts +47 -0
  105. package/dist/{session-query-DlRo5Ufc.d.ts → session-state-5uD0FqQ8.d.ts} +143 -45
  106. package/dist/{session-query-DOc1KanA.js → session-state-CN7DcLal.js} +353 -186
  107. package/dist/session-state-CN7DcLal.js.map +1 -0
  108. package/dist/{session-store-D2Ore1QC.d.ts → session-store-BIr-xfJ7.d.ts} +7 -96
  109. package/dist/sink-checkpoint-store-Cr9_GmOw.d.ts +40 -0
  110. package/dist/{sink-registry-CFC6xjsN.js → sink-registry-6CNeeRTt.js} +41 -82
  111. package/dist/sink-registry-6CNeeRTt.js.map +1 -0
  112. package/dist/{sink-registry-CIU0LD3m.d.ts → sink-registry-Bz4bBJaC.d.ts} +24 -49
  113. package/dist/testkit/layers.d.ts +24 -14
  114. package/dist/testkit/layers.js +18 -11
  115. package/dist/testkit/layers.js.map +1 -1
  116. package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-Dhs2KmYK.d.ts} +4 -4
  117. package/dist/types/commands.d.ts +2 -2
  118. package/dist/types/commands.js +7 -2
  119. package/dist/types/commands.js.map +1 -1
  120. package/dist/types/core.d.ts +2 -2
  121. package/dist/types/core.js +4 -2
  122. package/dist/types/core.js.map +1 -1
  123. package/dist/types/events/durable.d.ts +2 -2
  124. package/dist/types/events/durable.js +2 -2
  125. package/dist/types/events.d.ts +4 -3
  126. package/dist/types/events.js +3 -2
  127. package/dist/types/events.js.map +1 -1
  128. package/dist/websocket.d.ts +2776 -0
  129. package/dist/websocket.js +498 -0
  130. package/dist/websocket.js.map +1 -0
  131. package/package.json +68 -43
  132. package/testing/offline-trace/README.md +2 -1
  133. package/CHANGELOG.md +0 -10
  134. package/CONTRIBUTING.md +0 -26
  135. package/SECURITY.md +0 -8
  136. package/dist/durable-C3Rz7kg3.js.map +0 -1
  137. package/dist/durable-object-runtime-B7jwBY2R.js +0 -1494
  138. package/dist/durable-object-runtime-B7jwBY2R.js.map +0 -1
  139. package/dist/durable-object-runtime-pWv0ohlz.d.ts +0 -257
  140. package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
  141. package/dist/host/durable-object-runtime.d.ts +0 -2
  142. package/dist/host/durable-object-runtime.js +0 -2
  143. package/dist/host/durable-object-storage.d.ts +0 -2
  144. package/dist/host/durable-object-storage.js +0 -0
  145. package/dist/host/durable-object.d.ts +0 -83
  146. package/dist/host/durable-object.js +0 -191
  147. package/dist/host/durable-object.js.map +0 -1
  148. package/dist/host/websocket-wire.d.ts +0 -2
  149. package/dist/host/websocket-wire.js +0 -88
  150. package/dist/host/websocket-wire.js.map +0 -1
  151. package/dist/keep-alive-p8dIcSVy.js.map +0 -1
  152. package/dist/reduced-state-C4nVVzz9.js.map +0 -1
  153. package/dist/services/compaction.js.map +0 -1
  154. package/dist/session-query-DOc1KanA.js.map +0 -1
  155. package/dist/session-store-pYxQW9qh.js +0 -214
  156. package/dist/session-store-pYxQW9qh.js.map +0 -1
  157. package/dist/sink-registry-CFC6xjsN.js.map +0 -1
  158. package/dist/websocket-wire-DvOu_6BJ.d.ts +0 -16773
  159. package/docs/assets/architecture.svg +0 -106
  160. package/docs/assets/event-sequence.svg +0 -143
  161. package/docs/assets/gcp-trace.png +0 -0
  162. package/docs/message-steering.md +0 -831
  163. package/docs/releasing.md +0 -57
  164. package/docs/spec.md +0 -774
  165. package/docs/subagents.md +0 -725
  166. package/docs/testing.md +0 -64
  167. package/docs/ui-projection.md +0 -742
  168. package/docs/websocket-protocol.md +0 -613
  169. package/examples/001-no-tools/README.md +0 -65
  170. package/examples/001-no-tools/worker.ts +0 -79
  171. package/examples/002-slack-bridge/README.md +0 -134
  172. package/examples/002-slack-bridge/events.ts +0 -115
  173. package/examples/002-slack-bridge/reducer.ts +0 -216
  174. package/examples/002-slack-bridge/scenario.test.ts +0 -223
  175. package/examples/002-slack-bridge/sinks.ts +0 -109
  176. package/examples/002-slack-bridge/worker.ts +0 -140
  177. package/examples/003-sandbox-lifecycle/README.md +0 -78
  178. package/examples/003-sandbox-lifecycle/events.ts +0 -203
  179. package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
  180. package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
  181. package/examples/_shared/event-id.ts +0 -12
  182. package/examples/_shared/http.ts +0 -27
  183. package/examples/_shared/openai.ts +0 -33
@@ -1,26 +1,25 @@
1
- import { m as SequenceNumber } from "./core-Hv3cFydL.js";
2
- import { r as EDACommand } from "./commands-Ce1ec6kH.js";
3
- import { D as DurableEventEnvelope, F as ModelSelectionPayload, I as NonNegativeInt, L as PositionedEvent, O as EphemeralEventEnvelope } from "./events-Bb9-Cu-7.js";
4
- import { Dt as ToolCallCreatedEvent } from "./durable-DlScwmCy.js";
5
- import { a as EDASessionStore, o as EDASessionStoreError, t as CommittedDurableEvent } from "./session-store-D2Ore1QC.js";
6
- import { S as ReducedState } from "./command-queues-CQ9cwRP7.js";
7
- import { t as DurableTranscriptMessage } from "./message-transcript-BCHdHAe2.js";
8
- import { i as EDAReducerStateSnapshot, n as EDAReducerRegistry } from "./reducer-registry-C0svUa63.js";
9
- import { d as LiveEventBus, s as EDASinkRegistry } from "./sink-registry-CIU0LD3m.js";
10
- import { t as IdGenerator } from "./id-generator-C2Q15uZM.js";
11
- import { i as SessionContext, n as EventFactory, t as EDAKeepAlive } from "./keep-alive-DYDsH6qN.js";
12
- import { d as CompactionRunner } from "./compaction-YayFKo_1.js";
13
- import { n as EDAPromptProjector } from "./prompt-projector-9_02lk5-.js";
14
- import { r as EDAToolRegistry } from "./tool-registry-CcnkAAQK.js";
1
+ import { Q as RunGrantResult, S as ReducedState } from "./command-queues-B45Xa1Dl.js";
2
+ import { d as PositionedEvent, l as ModelSelectionPayload, n as EphemeralEventEnvelope, t as DurableEventEnvelope, u as NonNegativeInt } from "./envelope-DkZyMIgp.js";
3
+ import { i as GrantRunCommand, r as EDACommand } from "./commands-p8venTWs.js";
4
+ import { zt as ToolCallCreatedEvent } from "./durable-DeLCAvbw.js";
5
+ import { a as EDASessionStore, o as EDASessionStoreError, t as CommittedDurableEvent } from "./session-store-BIr-xfJ7.js";
6
+ import { t as ModelResolver } from "./model-resolver-BPPJAsuh.js";
7
+ import { t as IdGenerator } from "./id-generator--x6itQZ2.js";
8
+ import { r as SessionContext, t as EventFactory } from "./event-factory-EL4szNWm.js";
9
+ import { t as EDAKeepAlive } from "./keep-alive-Chl5SJxy.js";
10
+ import { d as CompactionRunner } from "./compaction-DoTyQf6k.js";
11
+ import { s as EDASinkRegistry, u as LiveEventBus } from "./sink-registry-Bz4bBJaC.js";
12
+ import { a as EDAReducerStateSnapshot, r as EDAReducerRegistry } from "./reducer-registry-DjP1qqbs.js";
13
+ import { r as EDAPromptProjector } from "./prompt-projector-BpRH-Ec-.js";
14
+ import { t as RunScheduler } from "./run-scheduler-DvHWwWBJ.js";
15
+ import { t as RunSchedulingWakeup } from "./run-scheduling-wakeup-CGgJ7RNe.js";
16
+ import { r as EDAToolRegistry } from "./tool-registry-Dhs2KmYK.js";
15
17
  import * as Context from "effect/Context";
16
18
  import * as Effect from "effect/Effect";
17
19
  import * as Layer from "effect/Layer";
18
20
  import * as Schema from "effect/Schema";
19
- import * as Stream from "effect/Stream";
20
21
  import * as Prompt from "effect/unstable/ai/Prompt";
21
22
  import * as Cause from "effect/Cause";
22
- import * as Scope from "effect/Scope";
23
- import * as LanguageModel from "effect/unstable/ai/LanguageModel";
24
23
  import * as Response from "effect/unstable/ai/Response";
25
24
 
26
25
  //#region src/services/session-event-sink.d.ts
@@ -146,7 +145,7 @@ interface ToolExecutorShape {
146
145
  declare const ToolExecutor_base: Context.ServiceClass<ToolExecutor, "@effect-durable-agent/ToolExecutor", ToolExecutorShape>;
147
146
  /** Executes sealed framework-owned tool calls and commits tool lifecycle boundaries. */
148
147
  declare class ToolExecutor extends ToolExecutor_base {
149
- static readonly Live: Layer.Layer<ToolExecutor, never, IdGenerator | EventFactory | SessionContext | EDAToolRegistry>;
148
+ static readonly Live: Layer.Layer<ToolExecutor, never, EDAToolRegistry | IdGenerator | EventFactory | SessionContext>;
150
149
  }
151
150
  //#endregion
152
151
  //#region src/services/inference-runner.d.ts
@@ -294,7 +293,7 @@ interface InferenceRunnerShape {
294
293
  declare const InferenceRunner_base: Context.ServiceClass<InferenceRunner, "@effect-durable-agent/InferenceRunner", InferenceRunnerShape>;
295
294
  /** Owns provider inference streams and routes them into durable/live inference emissions. */
296
295
  declare class InferenceRunner extends InferenceRunner_base {
297
- static readonly Live: Layer.Layer<InferenceRunner, never, IdGenerator | LanguageModel.LanguageModel | EventFactory | EDAToolRegistry>;
296
+ static readonly Live: Layer.Layer<InferenceRunner, never, ModelResolver | EDAToolRegistry | IdGenerator | EventFactory>;
298
297
  }
299
298
  //#endregion
300
299
  //#region src/services/turn-runner.d.ts
@@ -567,6 +566,120 @@ declare const SessionRunInput: Schema.Struct<{
567
566
  readonly systemPrompt: Schema.optionalKey<Schema.NonEmptyString>;
568
567
  }>;
569
568
  type SessionRunInput = typeof SessionRunInput.Type;
569
+ /** Command outcome when the command's run completed and the command was completed. */
570
+ declare const SessionCommandCompleted: Schema.TaggedStruct<"SessionCommandCompleted", {
571
+ readonly committed: Schema.Struct<{
572
+ readonly position: Schema.Struct<{
573
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
574
+ readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
575
+ }>;
576
+ readonly event: Schema.Struct<{
577
+ readonly durability: Schema.Literal<"durable">;
578
+ readonly namespace: Schema.NonEmptyString;
579
+ readonly type: Schema.NonEmptyString;
580
+ readonly schemaVersion: Schema.Int;
581
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
582
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
583
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
584
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
585
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
586
+ readonly span: Schema.Struct<{
587
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
588
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
589
+ readonly sampled: Schema.Boolean;
590
+ readonly tracestate: Schema.NullOr<Schema.String>;
591
+ }>;
592
+ readonly links: Schema.$Array<Schema.Struct<{
593
+ readonly context: Schema.Struct<{
594
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
595
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
596
+ readonly sampled: Schema.Boolean;
597
+ readonly tracestate: Schema.NullOr<Schema.String>;
598
+ }>;
599
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
600
+ }>>;
601
+ }>>;
602
+ readonly payload: Schema.Unknown;
603
+ }>;
604
+ }>;
605
+ }>;
606
+ type SessionCommandCompleted = typeof SessionCommandCompleted.Type;
607
+ /** Command outcome when the command's run failed and the command was failed. */
608
+ declare const SessionCommandFailed: Schema.TaggedStruct<"SessionCommandFailed", {
609
+ readonly committed: Schema.Struct<{
610
+ readonly position: Schema.Struct<{
611
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
612
+ readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
613
+ }>;
614
+ readonly event: Schema.Struct<{
615
+ readonly durability: Schema.Literal<"durable">;
616
+ readonly namespace: Schema.NonEmptyString;
617
+ readonly type: Schema.NonEmptyString;
618
+ readonly schemaVersion: Schema.Int;
619
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
620
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
621
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
622
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
623
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
624
+ readonly span: Schema.Struct<{
625
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
626
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
627
+ readonly sampled: Schema.Boolean;
628
+ readonly tracestate: Schema.NullOr<Schema.String>;
629
+ }>;
630
+ readonly links: Schema.$Array<Schema.Struct<{
631
+ readonly context: Schema.Struct<{
632
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
633
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
634
+ readonly sampled: Schema.Boolean;
635
+ readonly tracestate: Schema.NullOr<Schema.String>;
636
+ }>;
637
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
638
+ }>>;
639
+ }>>;
640
+ readonly payload: Schema.Unknown;
641
+ }>;
642
+ }>;
643
+ }>;
644
+ type SessionCommandFailed = typeof SessionCommandFailed.Type;
645
+ /** Command outcome when command work was cancelled by stop, interrupt, or recovery. */
646
+ declare const SessionCommandCancelled: Schema.TaggedStruct<"SessionCommandCancelled", {
647
+ readonly committed: Schema.Struct<{
648
+ readonly position: Schema.Struct<{
649
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
650
+ readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
651
+ }>;
652
+ readonly event: Schema.Struct<{
653
+ readonly durability: Schema.Literal<"durable">;
654
+ readonly namespace: Schema.NonEmptyString;
655
+ readonly type: Schema.NonEmptyString;
656
+ readonly schemaVersion: Schema.Int;
657
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
658
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
659
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
660
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
661
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
662
+ readonly span: Schema.Struct<{
663
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
664
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
665
+ readonly sampled: Schema.Boolean;
666
+ readonly tracestate: Schema.NullOr<Schema.String>;
667
+ }>;
668
+ readonly links: Schema.$Array<Schema.Struct<{
669
+ readonly context: Schema.Struct<{
670
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
671
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
672
+ readonly sampled: Schema.Boolean;
673
+ readonly tracestate: Schema.NullOr<Schema.String>;
674
+ }>;
675
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
676
+ }>>;
677
+ }>>;
678
+ readonly payload: Schema.Unknown;
679
+ }>;
680
+ }>;
681
+ }>;
682
+ type SessionCommandCancelled = typeof SessionCommandCancelled.Type;
570
683
  /** Terminal command-processing variants returned from one control action. */
571
684
  declare const SessionCommandOutcome: Schema.Union<readonly [Schema.TaggedStruct<"SessionCommandCompleted", {
572
685
  readonly committed: Schema.Struct<{
@@ -680,9 +793,12 @@ interface SessionCommandResult {
680
793
  readonly started: CommittedDurableEvent;
681
794
  readonly outcome: SessionCommandOutcome;
682
795
  }
796
+ /** Why a control drain stopped without starting more command work. */
797
+ declare const SessionNoRunnableReason: Schema.Literals<readonly ["active-command", "no-pending-command", "awaiting-run-authorization"]>;
798
+ type SessionNoRunnableReason = typeof SessionNoRunnableReason.Type;
683
799
  /** Session control result when no admitted command is runnable. */
684
800
  declare const SessionNoRunnableCommand: Schema.TaggedStruct<"SessionNoRunnableCommand", {
685
- readonly reason: Schema.Literals<readonly ["active-command", "no-pending-command"]>;
801
+ readonly reason: Schema.Literals<readonly ["active-command", "no-pending-command", "awaiting-run-authorization"]>;
686
802
  readonly active: Schema.optionalKey<Schema.TaggedStruct<"DispatchActiveCommand", {
687
803
  readonly commandId: Schema.brand<Schema.String, "CommandId">;
688
804
  readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
@@ -716,6 +832,10 @@ type SessionCommandAdmissionError = EDASessionStoreError | SessionCommandAdmissi
716
832
  type EDASubmittable = EDACommand | DurableEventEnvelope;
717
833
  /** Internal live-process authority for commands, durable writes, and scheduling. */
718
834
  interface SessionStateShape extends SessionEventSink {
835
+ /** Trusted permission entrypoint, serialized with control actions and revalidated before commit. */
836
+ readonly grantRun: (command: GrantRunCommand, input: SessionRunInput) => Effect.Effect<RunGrantResult, SessionStateError>;
837
+ /** Host alarm callback for strict, at-least-once delivery of the current persisted request. */
838
+ readonly retryRunSchedulingDelivery: () => Effect.Effect<void, EDASessionStoreError>;
719
839
  /** Commit session-initial context, such as app-owned system prompt, before command work starts. */
720
840
  readonly initialize: (input: SessionRunInput) => Effect.Effect<void, SessionCommandAdmissionError>;
721
841
  /** Submit commands and/or app durable events as one ordered durable batch. */
@@ -740,30 +860,8 @@ interface SessionStateShape extends SessionEventSink {
740
860
  declare const SessionState_base: Context.ServiceClass<SessionState, "@effect-durable-agent/SessionState", SessionStateShape>;
741
861
  /** Internal authoritative live state and root control loop for one session. */
742
862
  declare class SessionState extends SessionState_base {
743
- static readonly Live: Layer.Layer<SessionState, EDASessionStoreError, IdGenerator | EDAPromptProjector | LiveEventBus | EDASessionStore | CompactionRunner | EventFactory | EDAKeepAlive | EDAReducerRegistry | TurnRunner | SessionContext | EDASinkRegistry>;
744
- }
745
- //#endregion
746
- //#region src/services/session-query.d.ts
747
- /** Authoritative live snapshot for one EDA session plus its derived durable transcript. */
748
- interface EDASessionSnapshot {
749
- readonly state: ReducedState;
750
- readonly reducerStates: EDAReducerStateSnapshot;
751
- readonly messages: ReadonlyArray<DurableTranscriptMessage>;
752
- }
753
- /** Read-only query facade over authoritative live state and reconnect-safe event streams. */
754
- interface EDASessionQueryShape {
755
- /** Read the authoritative live state and derive its durable transcript. */
756
- readonly snapshot: () => Effect.Effect<EDASessionSnapshot, EDASessionStoreError>;
757
- /** Read durable user/assistant messages in committed sequence order from the live snapshot. */
758
- readonly messages: () => Effect.Effect<ReadonlyArray<DurableTranscriptMessage>, EDASessionStoreError>;
759
- /** Backfill durable events after `afterSeq`, then follow live durable/ephemeral events. */
760
- readonly eventsAfter: (afterSeq: SequenceNumber) => Effect.Effect<Stream.Stream<PositionedEvent, EDASessionStoreError>, EDASessionStoreError, Scope.Scope>;
761
- }
762
- declare const EDASessionQuery_base: Context.ServiceClass<EDASessionQuery, "@effect-durable-agent/EDASessionQuery", EDASessionQueryShape>;
763
- /** Read-only session query facade backed by authoritative SessionState plus durable backfill. */
764
- declare class EDASessionQuery extends EDASessionQuery_base {
765
- static readonly Live: Layer.Layer<EDASessionQuery, never, SessionState | LiveEventBus | EDASessionStore>;
863
+ static readonly Live: Layer.Layer<SessionState, EDASessionStoreError, RunSchedulingWakeup | RunScheduler | EDAKeepAlive | EDAPromptProjector | EDAReducerRegistry | EDASessionStore | LiveEventBus | IdGenerator | EventFactory | TurnRunner | CompactionRunner | SessionContext | EDASinkRegistry>;
766
864
  }
767
865
  //#endregion
768
- export { SessionCommandAdmissionError as a, InferenceRunner as c, EDASubmittable as i, InferenceRunnerStreamPart as l, EDASessionQueryShape as n, SessionState as o, EDASessionSnapshot as r, TurnRunner as s, EDASessionQuery as t, ToolExecutor as u };
769
- //# sourceMappingURL=session-query-DlRo5Ufc.d.ts.map
866
+ export { ToolExecutor as S, SessionStateShape as _, SessionCommandCompleted as a, InferenceRunner as b, SessionCommandResult as c, SessionForkedCommand as d, SessionNoRunnableCommand as f, SessionStateError as g, SessionState as h, SessionCommandCancelled as i, SessionDrainProcessed as l, SessionRunInput as m, SessionCommandAdmissionConflict as n, SessionCommandFailed as o, SessionNoRunnableReason as p, SessionCommandAdmissionError as r, SessionCommandOutcome as s, EDASubmittable as t, SessionDrainResult as u, SessionStateSnapshotData as v, InferenceRunnerStreamPart as x, TurnRunner as y };
867
+ //# sourceMappingURL=session-state-5uD0FqQ8.d.ts.map