reactor-effect-client 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +7 -2
- package/README.md +103 -141
- package/dist/Coordinator.d.ts +382 -0
- package/dist/Coordinator.d.ts.map +1 -0
- package/dist/Coordinator.js +732 -0
- package/dist/Coordinator.js.map +1 -0
- package/dist/H3.d.ts +159 -0
- package/dist/H3.d.ts.map +1 -0
- package/dist/H3.js +21 -0
- package/dist/H3.js.map +1 -0
- package/dist/H3Source.d.ts +93 -0
- package/dist/H3Source.d.ts.map +1 -0
- package/dist/H3Source.js +401 -0
- package/dist/H3Source.js.map +1 -0
- package/dist/LocalSource.d.ts +68 -0
- package/dist/LocalSource.d.ts.map +1 -0
- package/dist/LocalSource.js +354 -0
- package/dist/LocalSource.js.map +1 -0
- package/dist/Media.d.ts +106 -0
- package/dist/Media.d.ts.map +1 -0
- package/dist/Media.js +16 -0
- package/dist/Media.js.map +1 -0
- package/dist/Peer.d.ts +134 -0
- package/dist/Peer.d.ts.map +1 -0
- package/dist/Peer.js +57 -0
- package/dist/Peer.js.map +1 -0
- package/dist/Playout.d.ts +724 -0
- package/dist/Playout.d.ts.map +1 -0
- package/dist/Playout.js +28 -0
- package/dist/Playout.js.map +1 -0
- package/dist/Reactor.d.ts +135 -0
- package/dist/Reactor.d.ts.map +1 -0
- package/dist/Reactor.js +158 -0
- package/dist/Reactor.js.map +1 -0
- package/dist/ReactorError.d.ts +331 -0
- package/dist/ReactorError.d.ts.map +1 -0
- package/dist/ReactorError.js +316 -0
- package/dist/ReactorError.js.map +1 -0
- package/dist/ReactorTest.d.ts +383 -0
- package/dist/ReactorTest.d.ts.map +1 -0
- package/dist/ReactorTest.js +317 -0
- package/dist/ReactorTest.js.map +1 -0
- package/dist/Session.d.ts +314 -0
- package/dist/Session.d.ts.map +1 -0
- package/dist/Session.js +51 -0
- package/dist/Session.js.map +1 -0
- package/dist/index.d.ts +12 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/internal/correlator.d.ts +46 -0
- package/dist/internal/correlator.d.ts.map +1 -0
- package/dist/internal/correlator.js +150 -0
- package/dist/internal/correlator.js.map +1 -0
- package/dist/internal/deadline.d.ts +24 -0
- package/dist/internal/deadline.d.ts.map +1 -0
- package/dist/internal/deadline.js +44 -0
- package/dist/internal/deadline.js.map +1 -0
- package/dist/{h3/_internal/contracts.d.ts → internal/h3/commands.d.ts} +39 -33
- package/dist/internal/h3/commands.d.ts.map +1 -0
- package/dist/internal/h3/commands.js +128 -0
- package/dist/internal/h3/commands.js.map +1 -0
- package/dist/{h3 → internal/h3}/messages.d.ts +16 -11
- package/dist/internal/h3/messages.d.ts.map +1 -0
- package/dist/{h3 → internal/h3}/messages.js +19 -31
- package/dist/internal/h3/messages.js.map +1 -0
- package/dist/internal/h3/operations.d.ts +145 -0
- package/dist/internal/h3/operations.d.ts.map +1 -0
- package/dist/internal/h3/operations.js +284 -0
- package/dist/internal/h3/operations.js.map +1 -0
- package/dist/{h3 → internal/h3}/profile.d.ts +63 -65
- package/dist/internal/h3/profile.d.ts.map +1 -0
- package/dist/{h3 → internal/h3}/profile.js +39 -39
- package/dist/internal/h3/profile.js.map +1 -0
- package/dist/internal/h3/provider.d.ts +14 -0
- package/dist/internal/h3/provider.d.ts.map +1 -0
- package/dist/internal/h3/provider.js +672 -0
- package/dist/internal/h3/provider.js.map +1 -0
- package/dist/internal/h3/references.d.ts +68 -0
- package/dist/internal/h3/references.d.ts.map +1 -0
- package/dist/internal/h3/references.js +339 -0
- package/dist/internal/h3/references.js.map +1 -0
- package/dist/internal/h3/request.d.ts +56 -0
- package/dist/internal/h3/request.d.ts.map +1 -0
- package/dist/internal/h3/request.js +70 -0
- package/dist/internal/h3/request.js.map +1 -0
- package/dist/internal/h3/state.d.ts +120 -0
- package/dist/internal/h3/state.d.ts.map +1 -0
- package/dist/internal/h3/state.js +270 -0
- package/dist/internal/h3/state.js.map +1 -0
- package/dist/{Submission.d.ts → internal/h3/submission.d.ts} +1 -3
- package/dist/internal/h3/submission.d.ts.map +1 -0
- package/dist/{Submission.js → internal/h3/submission.js} +1 -9
- package/dist/internal/h3/submission.js.map +1 -0
- package/dist/internal/hub.d.ts +32 -0
- package/dist/internal/hub.d.ts.map +1 -0
- package/dist/internal/hub.js +92 -0
- package/dist/internal/hub.js.map +1 -0
- package/dist/internal/playout/errors.d.ts +51 -0
- package/dist/internal/playout/errors.d.ts.map +1 -0
- package/dist/internal/playout/errors.js +40 -0
- package/dist/internal/playout/errors.js.map +1 -0
- package/dist/internal/playout/policy.d.ts +559 -0
- package/dist/internal/playout/policy.d.ts.map +1 -0
- package/dist/internal/playout/policy.js +2338 -0
- package/dist/internal/playout/policy.js.map +1 -0
- package/dist/internal/playout/runtime.d.ts +28 -0
- package/dist/internal/playout/runtime.d.ts.map +1 -0
- package/dist/internal/playout/runtime.js +766 -0
- package/dist/internal/playout/runtime.js.map +1 -0
- package/dist/internal/playout/tag.d.ts +14 -0
- package/dist/internal/playout/tag.d.ts.map +1 -0
- package/dist/internal/playout/tag.js +43 -0
- package/dist/internal/playout/tag.js.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/common_pb.d.ts +55 -0
- package/dist/internal/proto/reactor_wire/v1/common_pb.d.ts.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/common_pb.js +42 -0
- package/dist/internal/proto/reactor_wire/v1/common_pb.js.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/control_pb.d.ts +160 -0
- package/dist/internal/proto/reactor_wire/v1/control_pb.d.ts.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/control_pb.js +21 -0
- package/dist/internal/proto/reactor_wire/v1/control_pb.js.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/data_pb.d.ts +89 -0
- package/dist/internal/proto/reactor_wire/v1/data_pb.d.ts.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/data_pb.js +20 -0
- package/dist/internal/proto/reactor_wire/v1/data_pb.js.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/model_pb.d.ts +85 -0
- package/dist/internal/proto/reactor_wire/v1/model_pb.d.ts.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/model_pb.js +24 -0
- package/dist/internal/proto/reactor_wire/v1/model_pb.js.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/platform_pb.d.ts +190 -0
- package/dist/internal/proto/reactor_wire/v1/platform_pb.d.ts.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/platform_pb.js +54 -0
- package/dist/internal/proto/reactor_wire/v1/platform_pb.js.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/track_pb.d.ts +88 -0
- package/dist/internal/proto/reactor_wire/v1/track_pb.d.ts.map +1 -0
- package/dist/internal/proto/reactor_wire/v1/track_pb.js +33 -0
- package/dist/internal/proto/reactor_wire/v1/track_pb.js.map +1 -0
- package/dist/internal/queue.d.ts +4 -0
- package/dist/internal/queue.d.ts.map +1 -0
- package/dist/{_internal → internal}/queue.js +0 -9
- package/dist/internal/queue.js.map +1 -0
- package/dist/internal/reactorTest/coordinator.d.ts +5 -0
- package/dist/internal/reactorTest/coordinator.d.ts.map +1 -0
- package/dist/internal/reactorTest/coordinator.js +178 -0
- package/dist/internal/reactorTest/coordinator.js.map +1 -0
- package/dist/internal/reactorTest/faults.d.ts +172 -0
- package/dist/internal/reactorTest/faults.d.ts.map +1 -0
- package/dist/internal/reactorTest/faults.js +23 -0
- package/dist/internal/reactorTest/faults.js.map +1 -0
- package/dist/internal/reactorTest/h3.d.ts +431 -0
- package/dist/internal/reactorTest/h3.d.ts.map +1 -0
- package/dist/internal/reactorTest/h3.js +625 -0
- package/dist/internal/reactorTest/h3.js.map +1 -0
- package/dist/internal/reactorTest/media.d.ts +22 -0
- package/dist/internal/reactorTest/media.d.ts.map +1 -0
- package/dist/internal/reactorTest/media.js +34 -0
- package/dist/internal/reactorTest/media.js.map +1 -0
- package/dist/internal/reactorTest/peer.d.ts +318 -0
- package/dist/internal/reactorTest/peer.d.ts.map +1 -0
- package/dist/internal/reactorTest/peer.js +206 -0
- package/dist/internal/reactorTest/peer.js.map +1 -0
- package/dist/internal/reactorTest/playout.d.ts +34 -0
- package/dist/internal/reactorTest/playout.d.ts.map +1 -0
- package/dist/internal/reactorTest/playout.js +340 -0
- package/dist/internal/reactorTest/playout.js.map +1 -0
- package/dist/internal/reactorTest/references.d.ts +25 -0
- package/dist/internal/reactorTest/references.d.ts.map +1 -0
- package/dist/{testing/Png.js → internal/reactorTest/references.js} +50 -12
- package/dist/internal/reactorTest/references.js.map +1 -0
- package/dist/internal/reactorTest/sessions.d.ts +364 -0
- package/dist/internal/reactorTest/sessions.d.ts.map +1 -0
- package/dist/internal/reactorTest/sessions.js +592 -0
- package/dist/internal/reactorTest/sessions.js.map +1 -0
- package/dist/internal/reactorTest/timing.d.ts +13 -0
- package/dist/internal/reactorTest/timing.d.ts.map +1 -0
- package/dist/internal/reactorTest/timing.js +20 -0
- package/dist/internal/reactorTest/timing.js.map +1 -0
- package/dist/internal/recording.d.ts +52 -0
- package/dist/internal/recording.d.ts.map +1 -0
- package/dist/internal/recording.js +141 -0
- package/dist/internal/recording.js.map +1 -0
- package/dist/internal/session/connect.d.ts +34 -0
- package/dist/internal/session/connect.d.ts.map +1 -0
- package/dist/internal/session/connect.js +502 -0
- package/dist/internal/session/connect.js.map +1 -0
- package/dist/internal/session/generation.d.ts +35 -0
- package/dist/internal/session/generation.d.ts.map +1 -0
- package/dist/internal/session/generation.js +185 -0
- package/dist/internal/session/generation.js.map +1 -0
- package/dist/internal/session/ice.d.ts +23 -0
- package/dist/internal/session/ice.d.ts.map +1 -0
- package/dist/internal/session/ice.js +57 -0
- package/dist/internal/session/ice.js.map +1 -0
- package/dist/internal/session/inbound.d.ts +50 -0
- package/dist/internal/session/inbound.d.ts.map +1 -0
- package/dist/internal/session/inbound.js +202 -0
- package/dist/internal/session/inbound.js.map +1 -0
- package/dist/internal/session/model.d.ts +163 -0
- package/dist/internal/session/model.d.ts.map +1 -0
- package/dist/internal/session/model.js +78 -0
- package/dist/internal/session/model.js.map +1 -0
- package/dist/internal/session/requests.d.ts +71 -0
- package/dist/internal/session/requests.d.ts.map +1 -0
- package/dist/internal/session/requests.js +240 -0
- package/dist/internal/session/requests.js.map +1 -0
- package/dist/internal/session/tracks.d.ts +21 -0
- package/dist/internal/session/tracks.d.ts.map +1 -0
- package/dist/internal/session/tracks.js +166 -0
- package/dist/internal/session/tracks.js.map +1 -0
- package/dist/internal/session/upload.d.ts +21 -0
- package/dist/internal/session/upload.d.ts.map +1 -0
- package/dist/internal/session/upload.js +68 -0
- package/dist/internal/session/upload.js.map +1 -0
- package/dist/internal/session.d.ts +66 -0
- package/dist/internal/session.d.ts.map +1 -0
- package/dist/internal/session.js +280 -0
- package/dist/internal/session.js.map +1 -0
- package/dist/{stats.d.ts → internal/stats.d.ts} +30 -16
- package/dist/internal/stats.d.ts.map +1 -0
- package/dist/internal/stats.js +201 -0
- package/dist/internal/stats.js.map +1 -0
- package/dist/internal/token.d.ts +22 -0
- package/dist/internal/token.d.ts.map +1 -0
- package/dist/internal/token.js +65 -0
- package/dist/internal/token.js.map +1 -0
- package/dist/internal/wire.d.ts +37 -0
- package/dist/internal/wire.d.ts.map +1 -0
- package/dist/internal/wire.js +49 -0
- package/dist/internal/wire.js.map +1 -0
- package/notices/bufbuild-protobuf-LICENSE +201 -0
- package/package.json +17 -38
- package/dist/FetchHttp.d.ts +0 -9
- package/dist/FetchHttp.d.ts.map +0 -1
- package/dist/FetchHttp.js +0 -63
- package/dist/FetchHttp.js.map +0 -1
- package/dist/PeerFactory.d.ts +0 -26
- package/dist/PeerFactory.d.ts.map +0 -1
- package/dist/PeerFactory.js +0 -4
- package/dist/PeerFactory.js.map +0 -1
- package/dist/PeerTypes.d.ts +0 -64
- package/dist/PeerTypes.d.ts.map +0 -1
- package/dist/PeerTypes.js +0 -2
- package/dist/PeerTypes.js.map +0 -1
- package/dist/Sequence.d.ts +0 -85
- package/dist/Sequence.d.ts.map +0 -1
- package/dist/Sequence.js +0 -210
- package/dist/Sequence.js.map +0 -1
- package/dist/SessionTypes.d.ts +0 -312
- package/dist/SessionTypes.d.ts.map +0 -1
- package/dist/SessionTypes.js +0 -19
- package/dist/SessionTypes.js.map +0 -1
- package/dist/Submission.d.ts.map +0 -1
- package/dist/Submission.js.map +0 -1
- package/dist/_internal/queue.d.ts +0 -6
- package/dist/_internal/queue.d.ts.map +0 -1
- package/dist/_internal/queue.js.map +0 -1
- package/dist/bytes.d.ts +0 -6
- package/dist/bytes.d.ts.map +0 -1
- package/dist/bytes.js +0 -32
- package/dist/bytes.js.map +0 -1
- package/dist/contract.d.ts +0 -149
- package/dist/contract.d.ts.map +0 -1
- package/dist/contract.js +0 -119
- package/dist/contract.js.map +0 -1
- package/dist/coordinator/_internal/client.d.ts +0 -215
- package/dist/coordinator/_internal/client.d.ts.map +0 -1
- package/dist/coordinator/_internal/client.js +0 -563
- package/dist/coordinator/_internal/client.js.map +0 -1
- package/dist/coordinator/_internal/recording.d.ts +0 -31
- package/dist/coordinator/_internal/recording.d.ts.map +0 -1
- package/dist/coordinator/_internal/recording.js +0 -123
- package/dist/coordinator/_internal/recording.js.map +0 -1
- package/dist/coordinator/_internal/response.d.ts +0 -15
- package/dist/coordinator/_internal/response.d.ts.map +0 -1
- package/dist/coordinator/_internal/response.js +0 -55
- package/dist/coordinator/_internal/response.js.map +0 -1
- package/dist/coordinator/_internal/schemas.d.ts +0 -73
- package/dist/coordinator/_internal/schemas.d.ts.map +0 -1
- package/dist/coordinator/_internal/schemas.js +0 -200
- package/dist/coordinator/_internal/schemas.js.map +0 -1
- package/dist/coordinator/index.d.ts +0 -40
- package/dist/coordinator/index.d.ts.map +0 -1
- package/dist/coordinator/index.js +0 -21
- package/dist/coordinator/index.js.map +0 -1
- package/dist/correlation.d.ts +0 -47
- package/dist/correlation.d.ts.map +0 -1
- package/dist/correlation.js +0 -131
- package/dist/correlation.js.map +0 -1
- package/dist/duration.d.ts +0 -27
- package/dist/duration.d.ts.map +0 -1
- package/dist/duration.js +0 -47
- package/dist/duration.js.map +0 -1
- package/dist/errors.d.ts +0 -1303
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -745
- package/dist/errors.js.map +0 -1
- package/dist/h3/_internal/client.d.ts +0 -9
- package/dist/h3/_internal/client.d.ts.map +0 -1
- package/dist/h3/_internal/client.js +0 -652
- package/dist/h3/_internal/client.js.map +0 -1
- package/dist/h3/_internal/contracts.d.ts.map +0 -1
- package/dist/h3/_internal/contracts.js +0 -123
- package/dist/h3/_internal/contracts.js.map +0 -1
- package/dist/h3/_internal/deployment.d.ts +0 -8
- package/dist/h3/_internal/deployment.d.ts.map +0 -1
- package/dist/h3/_internal/deployment.js +0 -149
- package/dist/h3/_internal/deployment.js.map +0 -1
- package/dist/h3/_internal/evidence.d.ts +0 -17
- package/dist/h3/_internal/evidence.d.ts.map +0 -1
- package/dist/h3/_internal/evidence.js +0 -48
- package/dist/h3/_internal/evidence.js.map +0 -1
- package/dist/h3/_internal/operations.d.ts +0 -58
- package/dist/h3/_internal/operations.d.ts.map +0 -1
- package/dist/h3/_internal/operations.js +0 -268
- package/dist/h3/_internal/operations.js.map +0 -1
- package/dist/h3/_internal/references.d.ts +0 -24
- package/dist/h3/_internal/references.d.ts.map +0 -1
- package/dist/h3/_internal/references.js +0 -309
- package/dist/h3/_internal/references.js.map +0 -1
- package/dist/h3/_internal/request.d.ts +0 -21
- package/dist/h3/_internal/request.d.ts.map +0 -1
- package/dist/h3/_internal/request.js +0 -97
- package/dist/h3/_internal/request.js.map +0 -1
- package/dist/h3/_internal/retained.d.ts +0 -22
- package/dist/h3/_internal/retained.d.ts.map +0 -1
- package/dist/h3/_internal/retained.js +0 -89
- package/dist/h3/_internal/retained.js.map +0 -1
- package/dist/h3/_internal/state.d.ts +0 -44
- package/dist/h3/_internal/state.d.ts.map +0 -1
- package/dist/h3/_internal/state.js +0 -283
- package/dist/h3/_internal/state.js.map +0 -1
- package/dist/h3/index.d.ts +0 -10
- package/dist/h3/index.d.ts.map +0 -1
- package/dist/h3/index.js +0 -7
- package/dist/h3/index.js.map +0 -1
- package/dist/h3/messages.d.ts.map +0 -1
- package/dist/h3/messages.js.map +0 -1
- package/dist/h3/profile.d.ts.map +0 -1
- package/dist/h3/profile.js.map +0 -1
- package/dist/h3/types.d.ts +0 -291
- package/dist/h3/types.d.ts.map +0 -1
- package/dist/h3/types.js +0 -2
- package/dist/h3/types.js.map +0 -1
- package/dist/host.d.ts +0 -26
- package/dist/host.d.ts.map +0 -1
- package/dist/host.js +0 -20
- package/dist/host.js.map +0 -1
- package/dist/json.d.ts +0 -25
- package/dist/json.d.ts.map +0 -1
- package/dist/json.js +0 -143
- package/dist/json.js.map +0 -1
- package/dist/media-stream.d.ts +0 -10
- package/dist/media-stream.d.ts.map +0 -1
- package/dist/media-stream.js +0 -18
- package/dist/media-stream.js.map +0 -1
- package/dist/observation.d.ts +0 -38
- package/dist/observation.d.ts.map +0 -1
- package/dist/observation.js +0 -113
- package/dist/observation.js.map +0 -1
- package/dist/orchestration/elapsed.d.ts +0 -9
- package/dist/orchestration/elapsed.d.ts.map +0 -1
- package/dist/orchestration/elapsed.js +0 -8
- package/dist/orchestration/elapsed.js.map +0 -1
- package/dist/orchestration/h3-source.d.ts +0 -58
- package/dist/orchestration/h3-source.d.ts.map +0 -1
- package/dist/orchestration/h3-source.js +0 -362
- package/dist/orchestration/h3-source.js.map +0 -1
- package/dist/orchestration/index.d.ts +0 -17
- package/dist/orchestration/index.d.ts.map +0 -1
- package/dist/orchestration/index.js +0 -12
- package/dist/orchestration/index.js.map +0 -1
- package/dist/orchestration/media-buffer.d.ts +0 -32
- package/dist/orchestration/media-buffer.d.ts.map +0 -1
- package/dist/orchestration/media-buffer.js +0 -94
- package/dist/orchestration/media-buffer.js.map +0 -1
- package/dist/orchestration/open-h3.d.ts +0 -101
- package/dist/orchestration/open-h3.d.ts.map +0 -1
- package/dist/orchestration/open-h3.js +0 -127
- package/dist/orchestration/open-h3.js.map +0 -1
- package/dist/orchestration/queries.d.ts +0 -10
- package/dist/orchestration/queries.d.ts.map +0 -1
- package/dist/orchestration/queries.js +0 -43
- package/dist/orchestration/queries.js.map +0 -1
- package/dist/orchestration/references.d.ts +0 -18
- package/dist/orchestration/references.d.ts.map +0 -1
- package/dist/orchestration/references.js +0 -79
- package/dist/orchestration/references.js.map +0 -1
- package/dist/orchestration/renewal-state.d.ts +0 -84
- package/dist/orchestration/renewal-state.d.ts.map +0 -1
- package/dist/orchestration/renewal-state.js +0 -95
- package/dist/orchestration/renewal-state.js.map +0 -1
- package/dist/orchestration/renewal.d.ts +0 -103
- package/dist/orchestration/renewal.d.ts.map +0 -1
- package/dist/orchestration/renewal.js +0 -1088
- package/dist/orchestration/renewal.js.map +0 -1
- package/dist/orchestration/request.d.ts +0 -65
- package/dist/orchestration/request.d.ts.map +0 -1
- package/dist/orchestration/request.js +0 -134
- package/dist/orchestration/request.js.map +0 -1
- package/dist/orchestration/retention.d.ts +0 -100
- package/dist/orchestration/retention.d.ts.map +0 -1
- package/dist/orchestration/retention.js +0 -134
- package/dist/orchestration/retention.js.map +0 -1
- package/dist/orchestration/routing.d.ts +0 -21
- package/dist/orchestration/routing.d.ts.map +0 -1
- package/dist/orchestration/routing.js +0 -93
- package/dist/orchestration/routing.js.map +0 -1
- package/dist/orchestration/scheduler-key.d.ts +0 -14
- package/dist/orchestration/scheduler-key.d.ts.map +0 -1
- package/dist/orchestration/scheduler-key.js +0 -62
- package/dist/orchestration/scheduler-key.js.map +0 -1
- package/dist/orchestration/scheduler-policy.d.ts +0 -222
- package/dist/orchestration/scheduler-policy.d.ts.map +0 -1
- package/dist/orchestration/scheduler-policy.js +0 -582
- package/dist/orchestration/scheduler-policy.js.map +0 -1
- package/dist/orchestration/scheduler.d.ts +0 -383
- package/dist/orchestration/scheduler.d.ts.map +0 -1
- package/dist/orchestration/scheduler.js +0 -2597
- package/dist/orchestration/scheduler.js.map +0 -1
- package/dist/orchestration/source-slot.d.ts +0 -124
- package/dist/orchestration/source-slot.d.ts.map +0 -1
- package/dist/orchestration/source-slot.js +0 -348
- package/dist/orchestration/source-slot.js.map +0 -1
- package/dist/orchestration/types.d.ts +0 -1462
- package/dist/orchestration/types.d.ts.map +0 -1
- package/dist/orchestration/types.js +0 -135
- package/dist/orchestration/types.js.map +0 -1
- package/dist/protobuf.d.ts +0 -63
- package/dist/protobuf.d.ts.map +0 -1
- package/dist/protobuf.js +0 -252
- package/dist/protobuf.js.map +0 -1
- package/dist/session/_internal/acquire.d.ts +0 -21
- package/dist/session/_internal/acquire.d.ts.map +0 -1
- package/dist/session/_internal/acquire.js +0 -168
- package/dist/session/_internal/acquire.js.map +0 -1
- package/dist/session/_internal/cleanup.d.ts +0 -19
- package/dist/session/_internal/cleanup.d.ts.map +0 -1
- package/dist/session/_internal/cleanup.js +0 -102
- package/dist/session/_internal/cleanup.js.map +0 -1
- package/dist/session/_internal/lifecycle.d.ts +0 -67
- package/dist/session/_internal/lifecycle.d.ts.map +0 -1
- package/dist/session/_internal/lifecycle.js +0 -142
- package/dist/session/_internal/lifecycle.js.map +0 -1
- package/dist/session/_internal/remote.d.ts +0 -28
- package/dist/session/_internal/remote.d.ts.map +0 -1
- package/dist/session/_internal/remote.js +0 -71
- package/dist/session/_internal/remote.js.map +0 -1
- package/dist/session/_internal/uploads.d.ts +0 -7
- package/dist/session/_internal/uploads.d.ts.map +0 -1
- package/dist/session/_internal/uploads.js +0 -31
- package/dist/session/_internal/uploads.js.map +0 -1
- package/dist/session/commands.d.ts +0 -2
- package/dist/session/commands.d.ts.map +0 -1
- package/dist/session/commands.js +0 -2
- package/dist/session/commands.js.map +0 -1
- package/dist/session/files.d.ts +0 -21
- package/dist/session/files.d.ts.map +0 -1
- package/dist/session/files.js +0 -49
- package/dist/session/files.js.map +0 -1
- package/dist/session/index.d.ts +0 -84
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js +0 -16
- package/dist/session/index.js.map +0 -1
- package/dist/session/media.d.ts +0 -114
- package/dist/session/media.d.ts.map +0 -1
- package/dist/session/media.js +0 -2
- package/dist/session/media.js.map +0 -1
- package/dist/session/recorder.d.ts +0 -24
- package/dist/session/recorder.d.ts.map +0 -1
- package/dist/session/recorder.js +0 -19
- package/dist/session/recorder.js.map +0 -1
- package/dist/session.d.ts +0 -105
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -976
- package/dist/session.js.map +0 -1
- package/dist/simulation/_internal/source.d.ts +0 -12
- package/dist/simulation/_internal/source.d.ts.map +0 -1
- package/dist/simulation/_internal/source.js +0 -513
- package/dist/simulation/_internal/source.js.map +0 -1
- package/dist/simulation/index.d.ts +0 -13
- package/dist/simulation/index.d.ts.map +0 -1
- package/dist/simulation/index.js +0 -12
- package/dist/simulation/index.js.map +0 -1
- package/dist/simulation/types.d.ts +0 -39
- package/dist/simulation/types.d.ts.map +0 -1
- package/dist/simulation/types.js +0 -2
- package/dist/simulation/types.js.map +0 -1
- package/dist/stats.d.ts.map +0 -1
- package/dist/stats.js +0 -205
- package/dist/stats.js.map +0 -1
- package/dist/testing/Faults.d.ts +0 -4
- package/dist/testing/Faults.d.ts.map +0 -1
- package/dist/testing/Faults.js +0 -7
- package/dist/testing/Faults.js.map +0 -1
- package/dist/testing/Png.d.ts +0 -3
- package/dist/testing/Png.d.ts.map +0 -1
- package/dist/testing/Png.js.map +0 -1
- package/dist/testing/Wav.d.ts +0 -14
- package/dist/testing/Wav.d.ts.map +0 -1
- package/dist/testing/Wav.js +0 -37
- package/dist/testing/Wav.js.map +0 -1
- package/dist/testing/index.d.ts +0 -5
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js +0 -4
- package/dist/testing/index.js.map +0 -1
- package/dist/wire.d.ts +0 -7
- package/dist/wire.d.ts.map +0 -1
- package/dist/wire.generated.d.ts +0 -305
- package/dist/wire.generated.d.ts.map +0 -1
- package/dist/wire.generated.js +0 -1257
- package/dist/wire.generated.js.map +0 -1
- package/dist/wire.js +0 -5
- package/dist/wire.js.map +0 -1
|
@@ -1,652 +0,0 @@
|
|
|
1
|
-
import * as Crypto from "effect/Crypto";
|
|
2
|
-
import * as Deferred from "effect/Deferred";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Exit from "effect/Exit";
|
|
5
|
-
import * as Result from "effect/Result";
|
|
6
|
-
import * as Scope from "effect/Scope";
|
|
7
|
-
import * as Semaphore from "effect/Semaphore";
|
|
8
|
-
import * as Stream from "effect/Stream";
|
|
9
|
-
import { CommandFailure, parsed, PolicyFailure, positiveLimit, ReactorError, Remote, } from "../../errors.js";
|
|
10
|
-
import { duration } from "../../duration.js";
|
|
11
|
-
import { Observations } from "../../observation.js";
|
|
12
|
-
import * as Submission from "../../Submission.js";
|
|
13
|
-
import { decodeMessage } from "../messages.js";
|
|
14
|
-
import { Operations } from "./operations.js";
|
|
15
|
-
import { canvases } from "../profile.js";
|
|
16
|
-
import { Commands } from "./contracts.js";
|
|
17
|
-
import { validateDeployment } from "./deployment.js";
|
|
18
|
-
import { acceptanceFor, encodeMetadata, submissionFromMetadata } from "./evidence.js";
|
|
19
|
-
import { checkedUpload, referenceMaterial } from "./references.js";
|
|
20
|
-
import { captureRequest, clipId, enqueueArguments, nonnegative, seconds } from "./request.js";
|
|
21
|
-
import { sizeOf } from "./retained.js";
|
|
22
|
-
import { ProviderState } from "./state.js";
|
|
23
|
-
const pure = (evaluate) => parsed(evaluate);
|
|
24
|
-
const localFailure = (operation, cause) => CommandFailure.from(cause, { ...cause.context, operation, outcome: "not-submitted" });
|
|
25
|
-
/** A caller's local refusal already proves no dispatch; anything else becomes one. */
|
|
26
|
-
const preparationFailure = (operation, cause) => ReactorError.is(cause) || CommandFailure.is(cause) ? localFailure(operation, cause) : cause;
|
|
27
|
-
const uncertain = (operation, source, message, cause) => CommandFailure.from(cause ?? ReactorError.fromCode("UnexpectedReply", message), {
|
|
28
|
-
...(cause?.context ?? {}),
|
|
29
|
-
operation,
|
|
30
|
-
outcome: "unknown",
|
|
31
|
-
requestId: source.requestId,
|
|
32
|
-
generation: source.generation,
|
|
33
|
-
});
|
|
34
|
-
/** The refusal reason is provider free text with no stable codes: kept for diagnosis only. */
|
|
35
|
-
const rejected = (operation, source, reason) => new CommandFailure({
|
|
36
|
-
reason: new Remote({ _tag: "Remote", message: `H3 ${operation} was refused`, body: reason }),
|
|
37
|
-
context: {
|
|
38
|
-
operation,
|
|
39
|
-
outcome: "replied",
|
|
40
|
-
requestId: source.requestId,
|
|
41
|
-
generation: source.generation,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
const hex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
45
|
-
/**
|
|
46
|
-
* Whether a snapshot at `revision` already reflects `event`: the reducer
|
|
47
|
-
* handles session events in sequence order. An acceptance is local evidence
|
|
48
|
-
* that no snapshot holds, and a diagnostic without a source has no sequence,
|
|
49
|
-
* so neither is ever covered.
|
|
50
|
-
*/
|
|
51
|
-
const covered = (event, revision) => {
|
|
52
|
-
switch (event._tag) {
|
|
53
|
-
case "Acceptance":
|
|
54
|
-
return false;
|
|
55
|
-
case "Diagnostic":
|
|
56
|
-
return event.source !== undefined && event.source.sequence <= revision;
|
|
57
|
-
default:
|
|
58
|
-
return event.source.sequence <= revision;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const build = (session, options) => Effect.gen(function* () {
|
|
62
|
-
const scope = yield* Effect.scope;
|
|
63
|
-
const crypto = yield* Crypto.Crypto;
|
|
64
|
-
const limits = yield* pure(() => ({
|
|
65
|
-
command: duration(options.replyTimeout ?? "15 seconds", "H3 reply timeout", {
|
|
66
|
-
maximum: "10 minutes",
|
|
67
|
-
}),
|
|
68
|
-
upload: duration(options.uploadTimeout ?? "60 seconds", "H3 upload timeout", {
|
|
69
|
-
maximum: "10 minutes",
|
|
70
|
-
}),
|
|
71
|
-
setup: duration(options.setupTimeout ?? "60 seconds", "H3 setup timeout", {
|
|
72
|
-
maximum: "10 minutes",
|
|
73
|
-
}),
|
|
74
|
-
reconcile: duration(options.reconcileWindow ?? "5 seconds", "H3 reconciliation window", {
|
|
75
|
-
maximum: "1 minute",
|
|
76
|
-
}),
|
|
77
|
-
hook: duration(options.resultHookTimeout ?? "1 second", "H3 result hook timeout", {
|
|
78
|
-
maximum: "1 minute",
|
|
79
|
-
}),
|
|
80
|
-
pending: positiveLimit(options.maxPending ?? 128, "H3 pending acceptance bound", 4096),
|
|
81
|
-
clips: positiveLimit(options.maxTrackedClips ?? 4096, "H3 clip observation bound", 16384),
|
|
82
|
-
acceptances: positiveLimit(options.maxAcceptances ?? 1024, "H3 local acceptance bound", 16384),
|
|
83
|
-
cache: positiveLimit(options.maxCachedUploads ?? 256, "H3 upload cache bound", 4096),
|
|
84
|
-
operations: positiveLimit(options.maxOperations ?? 1024, "H3 clip operation bound", 16384),
|
|
85
|
-
prompt: positiveLimit(options.maxPromptBytes ?? 1048576, "H3 prompt byte bound", 4194304),
|
|
86
|
-
retained: positiveLimit(options.maxRetainedBytes ?? 16777216, "H3 retained byte bound", 67108864),
|
|
87
|
-
}));
|
|
88
|
-
// A provider attaches to an already connected session. It neither allocates
|
|
89
|
-
// nor connects it, and it never takes ownership of its remote lifetime.
|
|
90
|
-
yield* session.ready;
|
|
91
|
-
const observation = yield* session.observe(options.observation);
|
|
92
|
-
const state = new ProviderState(session.id, observation.initial.generation, observation.revision, limits.clips);
|
|
93
|
-
const namespace = hex(yield* crypto.randomBytes(16).pipe(Effect.mapError(() => ReactorError.fromCode("InvalidState", "Could not allocate H3 acceptance namespace", {
|
|
94
|
-
outcome: "not-submitted",
|
|
95
|
-
}))));
|
|
96
|
-
let counter = 0n, closed = false, fatalError;
|
|
97
|
-
const fatal = yield* Deferred.make();
|
|
98
|
-
const events = new Observations();
|
|
99
|
-
const pending = new Map();
|
|
100
|
-
const acceptances = new Map();
|
|
101
|
-
/** Acceptances count toward the reducer's retained bytes while the map holds them. */
|
|
102
|
-
const retain = (acceptance, direction) => {
|
|
103
|
-
state.retained.add(direction * (64 + acceptance.submissionId.length * 3));
|
|
104
|
-
if (direction === 1) {
|
|
105
|
-
state.retained.hold(acceptance.clip);
|
|
106
|
-
state.retained.hold(acceptance.evidence.source);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
state.retained.drop(acceptance.clip);
|
|
110
|
-
state.retained.drop(acceptance.evidence.source);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
const operations = new Operations(limits.operations);
|
|
114
|
-
const decoded = new WeakMap();
|
|
115
|
-
const observedWaiters = new Map();
|
|
116
|
-
const uploads = new Map();
|
|
117
|
-
const uploadGate = yield* Semaphore.make(1);
|
|
118
|
-
// Callers waiting for the provider to synchronize; every applied event and
|
|
119
|
-
// any failure wakes them to look again. A woken caller may wait again at
|
|
120
|
-
// once, so the set is emptied before any waiter is released.
|
|
121
|
-
const synchronizing = new Set();
|
|
122
|
-
const wake = () => {
|
|
123
|
-
const waiters = [...synchronizing];
|
|
124
|
-
synchronizing.clear();
|
|
125
|
-
for (const waiter of waiters)
|
|
126
|
-
Deferred.doneUnsafe(waiter, Effect.void);
|
|
127
|
-
};
|
|
128
|
-
const emit = (event) => events.emit(event, sizeOf(event));
|
|
129
|
-
/** Decide a submission's acceptance: record it, resolve its waiters and announce it. */
|
|
130
|
-
const record = (entry, acceptance) => {
|
|
131
|
-
entry.held = undefined;
|
|
132
|
-
if (acceptances.size >= limits.acceptances) {
|
|
133
|
-
const first = acceptances.entries().next();
|
|
134
|
-
if (!first.done) {
|
|
135
|
-
acceptances.delete(first.value[0]);
|
|
136
|
-
retain(first.value[1], -1);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
acceptances.set(entry.id, acceptance);
|
|
140
|
-
retain(acceptance, 1);
|
|
141
|
-
operations.accept(acceptance);
|
|
142
|
-
Deferred.doneUnsafe(entry.deferred, Effect.succeed(acceptance));
|
|
143
|
-
emit({ _tag: "Acceptance", acceptance });
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Held evidence decides the acceptance once the reply cannot: it came
|
|
147
|
-
* without correlating the clip, or the wait for it ended short of a
|
|
148
|
-
* definite failure, which discards the evidence instead.
|
|
149
|
-
*/
|
|
150
|
-
const decideHeld = (entry) => {
|
|
151
|
-
if (entry.held !== undefined)
|
|
152
|
-
record(entry, entry.held);
|
|
153
|
-
};
|
|
154
|
-
const fail = (error) => {
|
|
155
|
-
if (fatalError !== undefined)
|
|
156
|
-
return;
|
|
157
|
-
fatalError = error;
|
|
158
|
-
state.unavailable(error);
|
|
159
|
-
// Recording held evidence resumes its waiters at once: by now the provider
|
|
160
|
-
// refuses their new work, and they can read the acceptance before anyone
|
|
161
|
-
// learns of the failure.
|
|
162
|
-
for (const entry of pending.values())
|
|
163
|
-
decideHeld(entry);
|
|
164
|
-
Deferred.doneUnsafe(fatal, Effect.succeed(error));
|
|
165
|
-
for (const entry of pending.values())
|
|
166
|
-
Deferred.doneUnsafe(entry.deferred, Effect.fail(error));
|
|
167
|
-
for (const waiter of observedWaiters.values())
|
|
168
|
-
Deferred.doneUnsafe(waiter, Effect.fail(error));
|
|
169
|
-
emit({ _tag: "Diagnostic", error });
|
|
170
|
-
wake();
|
|
171
|
-
};
|
|
172
|
-
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
173
|
-
closed = true;
|
|
174
|
-
fail(ReactorError.fromCode("Closed", "H3 provider scope closed", {
|
|
175
|
-
operation: "H3 observation",
|
|
176
|
-
}));
|
|
177
|
-
operations.retire();
|
|
178
|
-
events.end();
|
|
179
|
-
pending.clear();
|
|
180
|
-
observedWaiters.clear();
|
|
181
|
-
uploads.clear();
|
|
182
|
-
}));
|
|
183
|
-
const accept = (clip, source) => {
|
|
184
|
-
const id = submissionFromMetadata(namespace, clip.metadata);
|
|
185
|
-
if (id === undefined)
|
|
186
|
-
return;
|
|
187
|
-
const entry = pending.get(id);
|
|
188
|
-
const acceptance = entry === undefined ? undefined : acceptanceFor(entry, clip, source);
|
|
189
|
-
if (entry === undefined || acceptance === undefined) {
|
|
190
|
-
// After the reconcile window, or in a later transport generation, the
|
|
191
|
-
// evidence can still resolve the operation, never the acceptances.
|
|
192
|
-
operations.lateEvidence(id, clip, source);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
const previous = acceptances.get(entry.id) ?? entry.held;
|
|
196
|
-
if (previous !== undefined && previous.clip.clip_id !== clip.clip_id) {
|
|
197
|
-
fail(ReactorError.fromCode("Protocol", "H3 acceptance identity named two clips", {
|
|
198
|
-
operation: "enqueue",
|
|
199
|
-
}));
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (acceptances.has(entry.id))
|
|
203
|
-
return;
|
|
204
|
-
// Until the reply is observed, it may still correlate the acceptance; the
|
|
205
|
-
// clip's facts are recorded meanwhile.
|
|
206
|
-
if (acceptance.evidence.kind === "metadata" && entry.awaiting) {
|
|
207
|
-
if (entry.held === undefined) {
|
|
208
|
-
entry.held = acceptance;
|
|
209
|
-
operations.identify(acceptance);
|
|
210
|
-
}
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
record(entry, acceptance);
|
|
214
|
-
};
|
|
215
|
-
const reduce = (source) => {
|
|
216
|
-
if (closed || fatalError !== undefined)
|
|
217
|
-
return;
|
|
218
|
-
try {
|
|
219
|
-
const before = state.transportGeneration;
|
|
220
|
-
let disposition = state.admit(source);
|
|
221
|
-
if (state.transportGeneration !== before) {
|
|
222
|
-
uploads.clear();
|
|
223
|
-
for (const entry of pending.values())
|
|
224
|
-
if (entry.generation !== source.generation) {
|
|
225
|
-
// No reply to an earlier generation's enqueue can correlate now.
|
|
226
|
-
decideHeld(entry);
|
|
227
|
-
Deferred.doneUnsafe(entry.deferred, Effect.fail(ReactorError.fromCode("Disconnected", "H3 acceptance crossed a transport generation", { operation: "enqueue" })));
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
if (source._tag !== "Model") {
|
|
231
|
-
emit({ _tag: "Session", source });
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
let result;
|
|
235
|
-
if (source.kind === "ack") {
|
|
236
|
-
result =
|
|
237
|
-
disposition === "stale"
|
|
238
|
-
? Result.fail(ReactorError.fromCode("Disconnected", "H3 received a stale command acknowledgement"))
|
|
239
|
-
: Result.succeed(undefined);
|
|
240
|
-
emit({ _tag: "Acknowledged", source });
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
const message = decodeMessage(source.type, source.data);
|
|
244
|
-
if (disposition === "applied")
|
|
245
|
-
disposition = state.apply(message, source);
|
|
246
|
-
result =
|
|
247
|
-
disposition === "stale"
|
|
248
|
-
? Result.fail(ReactorError.fromCode("Disconnected", "H3 received a stale command message"))
|
|
249
|
-
: Result.succeed(message);
|
|
250
|
-
if (disposition !== "stale" && message.type !== "unknown") {
|
|
251
|
-
if (message.type === "queue_update") {
|
|
252
|
-
for (const clip of [
|
|
253
|
-
...message.data.generation,
|
|
254
|
-
...message.data.playout,
|
|
255
|
-
...message.data.history,
|
|
256
|
-
])
|
|
257
|
-
accept(clip, source);
|
|
258
|
-
}
|
|
259
|
-
else if ("clip" in message.data)
|
|
260
|
-
accept(message.data.clip, source);
|
|
261
|
-
operations.observe(message, source);
|
|
262
|
-
}
|
|
263
|
-
emit({ _tag: "Message", message, source, disposition });
|
|
264
|
-
}
|
|
265
|
-
decoded.set(source, result);
|
|
266
|
-
const waiter = observedWaiters.get(source);
|
|
267
|
-
if (waiter !== undefined)
|
|
268
|
-
Deferred.doneUnsafe(waiter, Result.isSuccess(result) ? Effect.succeed(result.success) : Effect.fail(result.failure));
|
|
269
|
-
if (state.retained.bytes > limits.retained)
|
|
270
|
-
fail(ReactorError.fromCode("Overflow", "H3 retained observation byte bound exceeded", {
|
|
271
|
-
operation: "H3 observation",
|
|
272
|
-
}));
|
|
273
|
-
}
|
|
274
|
-
catch (cause) {
|
|
275
|
-
// The reducer rejects provider data with a ReactorError; anything else
|
|
276
|
-
// it throws is a bug, which stays a defect of the observation fiber.
|
|
277
|
-
if (!ReactorError.is(cause))
|
|
278
|
-
throw cause;
|
|
279
|
-
const error = cause;
|
|
280
|
-
if (source._tag === "Model") {
|
|
281
|
-
decoded.set(source, Result.fail(error));
|
|
282
|
-
const waiter = observedWaiters.get(source);
|
|
283
|
-
if (waiter !== undefined)
|
|
284
|
-
Deferred.doneUnsafe(waiter, Effect.fail(error));
|
|
285
|
-
}
|
|
286
|
-
fail(error);
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
yield* observation.events.pipe(Stream.runForEach((source) => Effect.sync(() => {
|
|
290
|
-
reduce(source);
|
|
291
|
-
wake();
|
|
292
|
-
})), Effect.catch((error) => Effect.sync(() => fail(error))), Effect.andThen(Effect.sync(() => {
|
|
293
|
-
if (!closed)
|
|
294
|
-
fail(ReactorError.fromCode("Closed", "H3 session observation ended"));
|
|
295
|
-
})), Effect.forkScoped);
|
|
296
|
-
// Enqueues execute in a scope of their own. Finalizers run last-added first,
|
|
297
|
-
// so a closing provider refuses new work before that scope interrupts them.
|
|
298
|
-
const executions = yield* Scope.fork(scope);
|
|
299
|
-
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
300
|
-
closed = true;
|
|
301
|
-
}));
|
|
302
|
-
const refusal = (needsFacts) => closed
|
|
303
|
-
? ReactorError.fromCode("Closed", "H3 provider scope is closed")
|
|
304
|
-
: (fatalError ??
|
|
305
|
-
(needsFacts && state.availability !== "Ready"
|
|
306
|
-
? ReactorError.fromCode("InvalidState", "H3 provider needs current state and queue observations")
|
|
307
|
-
: undefined));
|
|
308
|
-
/**
|
|
309
|
-
* H3 documents that a command replies before it broadcasts the state and
|
|
310
|
-
* queue it changed (hosted H3 broadcasts an enqueue's queue first), so the
|
|
311
|
-
* provider may be briefly synchronizing after a reply. A command that needs
|
|
312
|
-
* current facts waits, within its own reply deadline, for those
|
|
313
|
-
* broadcasts; it is refused, not submitted, only if they do not come or
|
|
314
|
-
* the provider fails.
|
|
315
|
-
*/
|
|
316
|
-
const synchronized = Effect.gen(function* () {
|
|
317
|
-
while (!closed && fatalError === undefined && state.availability === "Synchronizing") {
|
|
318
|
-
const waiter = Deferred.makeUnsafe();
|
|
319
|
-
synchronizing.add(waiter);
|
|
320
|
-
yield* Deferred.await(waiter).pipe(Effect.ensuring(Effect.sync(() => synchronizing.delete(waiter))));
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
/** Wait, within one reply deadline, while the provider is only synchronizing. */
|
|
324
|
-
const settled = Effect.suspend(() => refusal(false) === undefined && state.availability === "Synchronizing"
|
|
325
|
-
? synchronized.pipe(Effect.timeout(limits.command), Effect.ignore)
|
|
326
|
-
: Effect.void);
|
|
327
|
-
const active = (operation, needsFacts) => Effect.gen(function* () {
|
|
328
|
-
if (needsFacts)
|
|
329
|
-
yield* settled;
|
|
330
|
-
const error = refusal(needsFacts);
|
|
331
|
-
if (error !== undefined)
|
|
332
|
-
return yield* localFailure(operation, error);
|
|
333
|
-
});
|
|
334
|
-
const awaitObservation = (source) => Effect.suspend(() => {
|
|
335
|
-
const previous = decoded.get(source);
|
|
336
|
-
if (previous !== undefined)
|
|
337
|
-
return Result.isSuccess(previous)
|
|
338
|
-
? Effect.succeed(previous.success)
|
|
339
|
-
: Effect.fail(previous.failure);
|
|
340
|
-
if (fatalError !== undefined)
|
|
341
|
-
return Effect.fail(fatalError);
|
|
342
|
-
if (observedWaiters.size >= limits.pending)
|
|
343
|
-
return Effect.fail(ReactorError.fromCode("Overflow", "H3 reply observer bound exceeded"));
|
|
344
|
-
const waiter = Deferred.makeUnsafe();
|
|
345
|
-
observedWaiters.set(source, waiter);
|
|
346
|
-
return Deferred.await(waiter).pipe(Effect.timeoutOrElse({
|
|
347
|
-
duration: limits.command,
|
|
348
|
-
orElse: () => Effect.fail(ReactorError.fromCode("Timeout", "H3 did not observe the command's exact returned envelope")),
|
|
349
|
-
}), Effect.ensuring(Effect.sync(() => {
|
|
350
|
-
observedWaiters.delete(source);
|
|
351
|
-
})));
|
|
352
|
-
});
|
|
353
|
-
const call = (operation, args, needsFacts = true) => Effect.gen(function* () {
|
|
354
|
-
yield* active(operation, needsFacts);
|
|
355
|
-
const source = yield* session.command(operation, args, { replyTimeout: limits.command });
|
|
356
|
-
const message = yield* awaitObservation(source).pipe(Effect.mapError((error) => uncertain(operation, source, "H3 reply observation failed", error)));
|
|
357
|
-
if (message?.type === "command_error" && message.data.command === operation)
|
|
358
|
-
return yield* rejected(operation, source, message.data.reason);
|
|
359
|
-
return { source, message };
|
|
360
|
-
});
|
|
361
|
-
const named = (operation, args, needsFacts = true) => {
|
|
362
|
-
const expected = Commands[operation].reply;
|
|
363
|
-
return call(operation, args, needsFacts).pipe(Effect.flatMap(({ source, message }) => message?.type === expected
|
|
364
|
-
? // The broadcasts a reply implies follow it: the command settles once
|
|
365
|
-
// they are observed, so its caller reads its own effects. The state
|
|
366
|
-
// and queue reads are themselves that barrier and do not wait.
|
|
367
|
-
(needsFacts ? settled : Effect.void).pipe(Effect.as(Object.freeze({ value: message.data, source })))
|
|
368
|
-
: Effect.fail(uncertain(operation, source, `H3 ${operation} did not return ${expected}`))));
|
|
369
|
-
};
|
|
370
|
-
const checked = (operation, value) => pure(value).pipe(Effect.mapError((error) => localFailure(operation, error)));
|
|
371
|
-
const getState = named("get_state", {}, false);
|
|
372
|
-
const getQueue = named("get_queue", {}, false);
|
|
373
|
-
const refresh = getState.pipe(Effect.andThen(getQueue), Effect.flatMap((reply) => state.snapshot()._tag === "Ready"
|
|
374
|
-
? Effect.void
|
|
375
|
-
: Effect.fail(CommandFailure.from(ReactorError.fromCode("InvalidState", "H3 full snapshots changed during refresh"), {
|
|
376
|
-
operation: "H3 refresh",
|
|
377
|
-
outcome: "replied",
|
|
378
|
-
requestId: reply.source.requestId,
|
|
379
|
-
generation: reply.source.generation,
|
|
380
|
-
}))));
|
|
381
|
-
const control = (operation, args) => call(operation, args).pipe(Effect.flatMap(({ source, message }) => source.kind === "ack"
|
|
382
|
-
? Effect.succeed(Object.freeze({ _tag: "Acknowledged", source }))
|
|
383
|
-
: message !== undefined && message.type !== "unknown"
|
|
384
|
-
? settled.pipe(Effect.as(Object.freeze({ _tag: "Reply", message, source })))
|
|
385
|
-
: Effect.fail(uncertain(operation, source, "Unexpected H3 control response"))));
|
|
386
|
-
const stage = (request, metadata) => Effect.gen(function* () {
|
|
387
|
-
yield* active("enqueue", true);
|
|
388
|
-
const before = state.snapshot();
|
|
389
|
-
if (before._tag !== "Ready")
|
|
390
|
-
return yield* localFailure("enqueue", ReactorError.fromCode("InvalidState", "H3 is not ready"));
|
|
391
|
-
if (request.seconds !== undefined)
|
|
392
|
-
yield* checked("enqueue", () => seconds(request.seconds, {
|
|
393
|
-
min: before.state.clip_seconds_min,
|
|
394
|
-
max: before.state.clip_seconds_max,
|
|
395
|
-
}));
|
|
396
|
-
if (request.audio.length > 0 && !contract.referenceAudio)
|
|
397
|
-
return yield* localFailure("enqueue", ReactorError.fromCode("UnsupportedCapability", "The H3 deployment does not declare reference audio"));
|
|
398
|
-
const files = [];
|
|
399
|
-
for (const reference of request.references)
|
|
400
|
-
files.push(yield* upload(reference, "image", before.transportGeneration));
|
|
401
|
-
const audio = [];
|
|
402
|
-
for (const reference of request.audio)
|
|
403
|
-
audio.push(yield* upload(reference, "audio", before.transportGeneration));
|
|
404
|
-
const args = enqueueArguments(request, files, audio, metadata);
|
|
405
|
-
return { args, generation: before.transportGeneration };
|
|
406
|
-
});
|
|
407
|
-
/**
|
|
408
|
-
* One reference's upload, content-addressed within a transport generation,
|
|
409
|
-
* so identical bytes upload once however many requests carry them.
|
|
410
|
-
*/
|
|
411
|
-
const upload = (reference, kind, generation) => Effect.gen(function* () {
|
|
412
|
-
const material = referenceMaterial(reference);
|
|
413
|
-
if (material._tag === "Uploaded")
|
|
414
|
-
return material.file;
|
|
415
|
-
const digest = yield* crypto
|
|
416
|
-
.digest("SHA-256", material.bytes)
|
|
417
|
-
.pipe(Effect.mapError(() => localFailure("enqueue", ReactorError.fromCode("InvalidState", "Could not hash H3 reference"))));
|
|
418
|
-
const key = `${generation}:${hex(digest)}`;
|
|
419
|
-
return yield* uploadGate.withPermit(Effect.gen(function* () {
|
|
420
|
-
const cached = uploads.get(key);
|
|
421
|
-
if (cached !== undefined)
|
|
422
|
-
return cached;
|
|
423
|
-
const uploaded = yield* session
|
|
424
|
-
.upload(`h3-${hex(digest)}`, reference.mimeType, material.bytes, {
|
|
425
|
-
uploadTimeout: limits.upload,
|
|
426
|
-
})
|
|
427
|
-
.pipe(Effect.mapError((error) => localFailure("enqueue", error)));
|
|
428
|
-
const file = yield* checked("enqueue", () => checkedUpload(uploaded.file, kind));
|
|
429
|
-
if (file.size !== BigInt(reference.size) || file.mime_type !== reference.mimeType)
|
|
430
|
-
return yield* localFailure("enqueue", ReactorError.fromCode("Protocol", "H3 upload returned different file facts"));
|
|
431
|
-
if (state.snapshot().transportGeneration !== generation)
|
|
432
|
-
return yield* localFailure("enqueue", ReactorError.fromCode("Disconnected", "H3 reference upload crossed a generation"));
|
|
433
|
-
if (uploads.size >= limits.cache) {
|
|
434
|
-
const first = uploads.keys().next();
|
|
435
|
-
if (!first.done)
|
|
436
|
-
uploads.delete(first.value);
|
|
437
|
-
}
|
|
438
|
-
uploads.set(key, file);
|
|
439
|
-
return file;
|
|
440
|
-
}));
|
|
441
|
-
});
|
|
442
|
-
const nextId = () => pure(() => {
|
|
443
|
-
if (counter === 0xffffffffffffffffn)
|
|
444
|
-
throw ReactorError.fromCode("Overflow", "H3 submission identity space exhausted", {
|
|
445
|
-
outcome: "not-submitted",
|
|
446
|
-
});
|
|
447
|
-
return `${namespace}:${++counter}`;
|
|
448
|
-
});
|
|
449
|
-
const prepared = (id, input, hooks) => Submission.make({
|
|
450
|
-
id,
|
|
451
|
-
prepare: Effect.gen(function* () {
|
|
452
|
-
const { request, metadata } = yield* input.pipe(Effect.mapError((error) => preparationFailure("enqueue", error)));
|
|
453
|
-
const staged = yield* stage(request, metadata);
|
|
454
|
-
const entry = {
|
|
455
|
-
id,
|
|
456
|
-
metadata,
|
|
457
|
-
prompt: request.prompt,
|
|
458
|
-
generation: staged.generation,
|
|
459
|
-
deferred: Deferred.makeUnsafe(),
|
|
460
|
-
awaiting: true,
|
|
461
|
-
held: undefined,
|
|
462
|
-
};
|
|
463
|
-
return { ...staged, entry };
|
|
464
|
-
}),
|
|
465
|
-
commit: ({ entry }) => Effect.gen(function* () {
|
|
466
|
-
yield* active("enqueue", true);
|
|
467
|
-
const live = yield* session.ready.pipe(Effect.mapError((error) => localFailure("enqueue", error)));
|
|
468
|
-
if (entry.generation !== state.snapshot().transportGeneration ||
|
|
469
|
-
live.generation !== entry.generation)
|
|
470
|
-
return yield* localFailure("enqueue", ReactorError.fromCode("Disconnected", "H3 prepared input crossed a transport generation"));
|
|
471
|
-
if (pending.size >= limits.pending)
|
|
472
|
-
return yield* localFailure("enqueue", ReactorError.fromCode("Overflow", "H3 pending acceptance bound reached"));
|
|
473
|
-
// The operation's slot is taken before anything is sent.
|
|
474
|
-
yield* pure(() => operations.reserve(entry)).pipe(Effect.mapError((error) => localFailure("enqueue", error)));
|
|
475
|
-
// Acceptance registration is inside the same commit boundary as the
|
|
476
|
-
// orchestration hook and precedes Session.command's wire correlation.
|
|
477
|
-
pending.set(id, entry);
|
|
478
|
-
if (hooks.commit !== undefined)
|
|
479
|
-
yield* hooks.commit(id).pipe(Effect.onExit((exit) => Exit.isFailure(exit)
|
|
480
|
-
? Effect.sync(() => {
|
|
481
|
-
pending.delete(id);
|
|
482
|
-
operations.abandon(id);
|
|
483
|
-
})
|
|
484
|
-
: Effect.void));
|
|
485
|
-
}),
|
|
486
|
-
execute: ({ args, entry }) => {
|
|
487
|
-
const execution = Effect.gen(function* () {
|
|
488
|
-
const sent = yield* Effect.result(session.command("enqueue", args, { replyTimeout: limits.command }));
|
|
489
|
-
let original;
|
|
490
|
-
if (Result.isFailure(sent)) {
|
|
491
|
-
if (sent.failure.context.outcome !== "unknown")
|
|
492
|
-
return yield* sent.failure;
|
|
493
|
-
original = sent.failure;
|
|
494
|
-
}
|
|
495
|
-
else {
|
|
496
|
-
const source = sent.success;
|
|
497
|
-
const observed = yield* Effect.result(awaitObservation(source));
|
|
498
|
-
if (Result.isSuccess(observed) &&
|
|
499
|
-
observed.success?.type === "command_error" &&
|
|
500
|
-
observed.success.data.command === "enqueue")
|
|
501
|
-
return yield* rejected("enqueue", source, observed.success.data.reason);
|
|
502
|
-
original = uncertain("enqueue", source, "H3 enqueue has no proven clip acceptance", Result.isFailure(observed) ? observed.failure : undefined);
|
|
503
|
-
}
|
|
504
|
-
// The reply was observed or is lost: evidence by metadata that came
|
|
505
|
-
// while it was awaited now decides, and later evidence at once.
|
|
506
|
-
entry.awaiting = false;
|
|
507
|
-
decideHeld(entry);
|
|
508
|
-
const acceptance = yield* Deferred.await(entry.deferred).pipe(Effect.timeoutOrElse({
|
|
509
|
-
duration: limits.reconcile,
|
|
510
|
-
orElse: () => Effect.fail(original),
|
|
511
|
-
}), Effect.mapError(() => original), Effect.withSpan("reactor.h3.reconcile", {}, { captureStackTrace: false }));
|
|
512
|
-
// Like every command, an enqueue settles once the snapshots its reply
|
|
513
|
-
// implies are observed, so its caller finds the clip in the queue.
|
|
514
|
-
yield* settled;
|
|
515
|
-
return acceptance;
|
|
516
|
-
}).pipe(Effect.onExit((exit) => Effect.sync(() => {
|
|
517
|
-
// However the enqueue ends, interrupted as the provider closes or
|
|
518
|
-
// otherwise, the evidence it saw still decides; only a definite
|
|
519
|
-
// failure discards it.
|
|
520
|
-
const error = Exit.findError(exit);
|
|
521
|
-
if (!(error._tag === "Success" && error.success.context.outcome !== "unknown"))
|
|
522
|
-
decideHeld(entry);
|
|
523
|
-
pending.delete(id);
|
|
524
|
-
})), Effect.onExit((exit) => Effect.sync(() => {
|
|
525
|
-
operations.settle(id, exit);
|
|
526
|
-
})),
|
|
527
|
-
// The submission's own execution fiber carries the span, so it ends with
|
|
528
|
-
// the enqueue's outcome even when the caller stopped waiting.
|
|
529
|
-
Effect.onExit((exit) => {
|
|
530
|
-
const error = Exit.findError(exit);
|
|
531
|
-
return Effect.annotateCurrentSpan(Exit.isSuccess(exit)
|
|
532
|
-
? { "reactor.command.outcome": "replied" }
|
|
533
|
-
: error._tag === "Success"
|
|
534
|
-
? {
|
|
535
|
-
"reactor.command.outcome": error.success.context.outcome,
|
|
536
|
-
"error.type": error.success.reason._tag,
|
|
537
|
-
}
|
|
538
|
-
: {});
|
|
539
|
-
}), Effect.withSpan("reactor.h3.enqueue", { kind: "client", attributes: { "reactor.h3.submission.id": id } }, { captureStackTrace: false }));
|
|
540
|
-
return hooks.result === undefined
|
|
541
|
-
? execution
|
|
542
|
-
: Effect.result(execution).pipe(Effect.flatMap((result) => Effect.gen(function* () {
|
|
543
|
-
const hook = yield* Effect.exit(Effect.suspend(() => hooks.result(id, result)).pipe(Effect.interruptible, Effect.timeoutOrElse({
|
|
544
|
-
duration: limits.hook,
|
|
545
|
-
orElse: () => Effect.fail(ReactorError.fromCode("Timeout", "H3 result hook exceeded its deadline")),
|
|
546
|
-
})));
|
|
547
|
-
// Preserve the entire secondary Cause for deliberate inspection,
|
|
548
|
-
// including defects; never substitute it for primary remote evidence.
|
|
549
|
-
if (Exit.isFailure(hook))
|
|
550
|
-
emit({
|
|
551
|
-
_tag: "Diagnostic",
|
|
552
|
-
error: ReactorError.fromCode("InvalidState", "H3 result hook failed", {
|
|
553
|
-
operation: "H3 result hook",
|
|
554
|
-
detail: hook.cause,
|
|
555
|
-
}),
|
|
556
|
-
});
|
|
557
|
-
return yield* Result.isSuccess(result)
|
|
558
|
-
? Effect.succeed(result.success)
|
|
559
|
-
: Effect.fail(result.failure);
|
|
560
|
-
})));
|
|
561
|
-
},
|
|
562
|
-
}).pipe(Scope.provide(executions));
|
|
563
|
-
const prepare = (input, hooks = {}) => Effect.gen(function* () {
|
|
564
|
-
yield* active("enqueue", true);
|
|
565
|
-
const request = yield* pure(() => captureRequest(input, limits.prompt));
|
|
566
|
-
const id = yield* nextId();
|
|
567
|
-
const metadata = yield* pure(() => encodeMetadata(namespace, id, request.metadata));
|
|
568
|
-
return yield* prepared(id, Effect.succeed({ request, metadata }), hooks);
|
|
569
|
-
});
|
|
570
|
-
const prepareFrom = (preparation, hooks = {}) => Effect.gen(function* () {
|
|
571
|
-
yield* active("enqueue", true);
|
|
572
|
-
if (!Effect.isEffect(preparation))
|
|
573
|
-
return yield* ReactorError.fromCode("InvalidInput", "H3 preparation must be an Effect", {
|
|
574
|
-
outcome: "not-submitted",
|
|
575
|
-
});
|
|
576
|
-
const id = yield* nextId();
|
|
577
|
-
return yield* prepared(id, preparation.pipe(Effect.flatMap((input) => pure(() => {
|
|
578
|
-
const request = captureRequest(input, limits.prompt);
|
|
579
|
-
return { request, metadata: encodeMetadata(namespace, id, request.metadata) };
|
|
580
|
-
}))), hooks);
|
|
581
|
-
});
|
|
582
|
-
const contract = yield* session.schema.pipe(Effect.flatMap(({ openapi }) => pure(() => validateDeployment(openapi))), Effect.timeoutOrElse({
|
|
583
|
-
duration: limits.setup,
|
|
584
|
-
orElse: () => Effect.fail(ReactorError.fromCode("Timeout", "H3 schema read timed out")),
|
|
585
|
-
}));
|
|
586
|
-
yield* refresh.pipe(Effect.timeoutOrElse({
|
|
587
|
-
duration: limits.setup,
|
|
588
|
-
orElse: () => Effect.fail(ReactorError.fromCode("Timeout", "H3 initial state and queue reads timed out")),
|
|
589
|
-
}));
|
|
590
|
-
if (state.snapshot()._tag !== "Ready")
|
|
591
|
-
return yield* (fatalError ??
|
|
592
|
-
ReactorError.fromCode("InvalidState", "H3 initial observations are unavailable"));
|
|
593
|
-
const provider = {
|
|
594
|
-
sessionId: session.id,
|
|
595
|
-
contract,
|
|
596
|
-
current: Effect.sync(() => state.snapshot()),
|
|
597
|
-
observe: (bounds) => Effect.gen(function* () {
|
|
598
|
-
const stream = yield* events.subscribe(bounds);
|
|
599
|
-
const initial = state.snapshot();
|
|
600
|
-
// The reducer may apply a queued event between the subscription and
|
|
601
|
-
// this read; the snapshot then covers it, so it is not repeated.
|
|
602
|
-
return {
|
|
603
|
-
initial,
|
|
604
|
-
revision: initial.revision,
|
|
605
|
-
events: Stream.filter(stream, (event) => !covered(event, initial.revision)),
|
|
606
|
-
};
|
|
607
|
-
}),
|
|
608
|
-
events: (bounds) => events.stream(bounds),
|
|
609
|
-
failure: Deferred.await(fatal),
|
|
610
|
-
acceptances: Effect.sync(() => Object.freeze([...acceptances.values()])),
|
|
611
|
-
acceptance: (id) => Effect.sync(() => acceptances.get(id)),
|
|
612
|
-
operation: (submission) => operations.attach(submission.id),
|
|
613
|
-
prepare,
|
|
614
|
-
prepareFrom,
|
|
615
|
-
enqueue: (request) => prepare(request).pipe(Effect.mapError((error) => ReactorError.is(error) ? localFailure("enqueue", error) : error), Effect.flatMap((submission) => submission.submit)),
|
|
616
|
-
getState,
|
|
617
|
-
getQueue,
|
|
618
|
-
refresh,
|
|
619
|
-
pop: (id) => checked("pop", () => clipId(id)).pipe(Effect.flatMap((id) => named("pop", { clip_id: id })), Effect.filterOrFail((reply) => reply.value.clip.clip_id === id, (reply) => uncertain("pop", reply.source, "H3 pop returned a different clip"))),
|
|
620
|
-
move: (id, position) => checked("move", () => ({
|
|
621
|
-
clip_id: clipId(id),
|
|
622
|
-
position: nonnegative(position, "position"),
|
|
623
|
-
})).pipe(Effect.flatMap((args) => named("move", args)), Effect.filterOrFail((reply) => reply.value.clip.clip_id === id, (reply) => uncertain("move", reply.source, "H3 move returned a different clip"))),
|
|
624
|
-
play: (id) => checked("play", () => ({ clip_id: id === undefined ? "" : clipId(id) })).pipe(Effect.flatMap((args) => control("play", args))),
|
|
625
|
-
stop: control("stop", {}),
|
|
626
|
-
setSeed: (value) => checked("set_seed", () => nonnegative(value, "seed")).pipe(Effect.flatMap((seed) => named("set_seed", { seed }))),
|
|
627
|
-
setClipSeconds: (value) => checked("set_clip_seconds", () => seconds(value)).pipe(Effect.flatMap((seconds) => named("set_clip_seconds", { seconds }))),
|
|
628
|
-
setCanvas: (aspect) => checked("set_canvas", () => {
|
|
629
|
-
if (!Object.hasOwn(canvases, aspect))
|
|
630
|
-
throw ReactorError.fromCode("InvalidInput", "Unsupported H3 canvas aspect");
|
|
631
|
-
return { aspect };
|
|
632
|
-
}).pipe(Effect.flatMap((args) => named("set_canvas", args))),
|
|
633
|
-
setAutoplay: (enabled) => checked("set_autoplay", () => {
|
|
634
|
-
if (typeof enabled !== "boolean")
|
|
635
|
-
throw ReactorError.fromCode("InvalidInput", "Autoplay must be boolean");
|
|
636
|
-
return { enabled };
|
|
637
|
-
}).pipe(Effect.flatMap((args) => named("set_autoplay", args))),
|
|
638
|
-
setFlushOnClipEnd: (enabled) => checked("set_flush_on_clip_end", () => {
|
|
639
|
-
if (typeof enabled !== "boolean")
|
|
640
|
-
throw ReactorError.fromCode("InvalidInput", "Flush setting must be boolean");
|
|
641
|
-
return { enabled };
|
|
642
|
-
}).pipe(Effect.flatMap((args) => named("set_flush_on_clip_end", args))),
|
|
643
|
-
reset: named("reset", {}),
|
|
644
|
-
};
|
|
645
|
-
return Object.freeze(provider);
|
|
646
|
-
});
|
|
647
|
-
/** Failed acquisition closes its local observation scope immediately. */
|
|
648
|
-
export const make = (session, options = {}) => Effect.gen(function* () {
|
|
649
|
-
const child = yield* Scope.fork(yield* Effect.scope);
|
|
650
|
-
return yield* build(session, options).pipe(Scope.provide(child), Effect.onExit((exit) => (Exit.isFailure(exit) ? Scope.close(child, exit) : Effect.void)));
|
|
651
|
-
});
|
|
652
|
-
//# sourceMappingURL=client.js.map
|