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,123 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import { terminal } from "../../contract.js";
|
|
3
|
-
import { duration } from "../../duration.js";
|
|
4
|
-
import { ReactorError, parsed, positiveLimit } from "../../errors.js";
|
|
5
|
-
import { retryAfterMs } from "./response.js";
|
|
6
|
-
const pure = (body) => parsed(body);
|
|
7
|
-
export const parsePlaylist = (text, baseUrl, maxSegments = 1024) => {
|
|
8
|
-
positiveLimit(maxSegments, "clip segments", 16_384);
|
|
9
|
-
if (text.trimStart().split(/\r?\n/, 1)[0]?.trim() !== "#EXTM3U")
|
|
10
|
-
throw ReactorError.fromCode("Protocol", "not an HLS playlist");
|
|
11
|
-
let init;
|
|
12
|
-
const media = [];
|
|
13
|
-
for (const line of text
|
|
14
|
-
.split(/\r?\n/)
|
|
15
|
-
.map((s) => s.trim())
|
|
16
|
-
.filter(Boolean)) {
|
|
17
|
-
if (/^#EXT-X-(STREAM-INF|I-FRAME-STREAM-INF|BYTERANGE|DISCONTINUITY|PART|PRELOAD-HINT|SKIP|GAP|SESSION-KEY|DEFINE)(:|$)/.test(line))
|
|
18
|
-
throw ReactorError.fromCode("UnsupportedCapability", "master, byte-range, discontinuous, encrypted, gap, variable, or low-latency playlists require an HLS player, not byte concatenation");
|
|
19
|
-
if (line.startsWith("#EXT-X-KEY:") && !/(?:^|,)METHOD=NONE(?:,|$)/.test(line.slice(11)))
|
|
20
|
-
throw ReactorError.fromCode("UnsupportedCapability", "encrypted clips are not assembled by this client");
|
|
21
|
-
if (line.startsWith("#EXT-X-MAP:")) {
|
|
22
|
-
if (line.includes("BYTERANGE="))
|
|
23
|
-
throw ReactorError.fromCode("UnsupportedCapability", "byte-range init segments unsupported");
|
|
24
|
-
const match = /(?:^|,)URI="([^"]+)"/.exec(line.slice(11)), uri = match?.[1];
|
|
25
|
-
if (uri === undefined || (init !== undefined && init !== uri))
|
|
26
|
-
throw ReactorError.fromCode("Protocol", "missing or changing HLS init URI");
|
|
27
|
-
init = uri;
|
|
28
|
-
}
|
|
29
|
-
else if (!line.startsWith("#")) {
|
|
30
|
-
if (media.length >= maxSegments)
|
|
31
|
-
throw ReactorError.fromCode("Overflow", "clip segment count bound exceeded");
|
|
32
|
-
media.push(line);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (media.length === 0)
|
|
36
|
-
throw ReactorError.fromCode("Protocol", "empty clip playlist");
|
|
37
|
-
// The URL constructor rejects a malformed playlist URI with a TypeError.
|
|
38
|
-
const parseUrl = (uri) => {
|
|
39
|
-
try {
|
|
40
|
-
return new URL(uri, baseUrl);
|
|
41
|
-
}
|
|
42
|
-
catch (cause) {
|
|
43
|
-
throw ReactorError.fromCode("Protocol", "invalid clip URL", { detail: cause });
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const resolve = (uri) => {
|
|
47
|
-
const url = parseUrl(uri);
|
|
48
|
-
if (!(url.protocol === "http:" || url.protocol === "https:") || url.username || url.password)
|
|
49
|
-
throw ReactorError.fromCode("Protocol", "clip URL must use http(s) with no embedded credentials");
|
|
50
|
-
return url.href;
|
|
51
|
-
};
|
|
52
|
-
if (init === undefined &&
|
|
53
|
-
media.some((uri) => /\.(?:m4s|mp4|m4a|m4v)$/i.test(parseUrl(uri).pathname)))
|
|
54
|
-
throw ReactorError.fromCode("Protocol", "fragmented MP4 playlist lacks EXT-X-MAP init segment");
|
|
55
|
-
const segments = init === undefined ? [] : [{ kind: "init", url: resolve(init) }];
|
|
56
|
-
for (const uri of media)
|
|
57
|
-
segments.push({ kind: "media", url: resolve(uri) });
|
|
58
|
-
return Object.freeze(segments.map((s) => Object.freeze(s)));
|
|
59
|
-
};
|
|
60
|
-
/** Bounded transport of a prepared recording. Does not decode, play, or assert further generation.
|
|
61
|
-
* This API intentionally uses a caller wall deadline, not an unbounded wait based on a prediction. */
|
|
62
|
-
export const downloadClip = (http, clip, options = {}) => Effect.suspend(() => {
|
|
63
|
-
const action = Effect.gen(function* () {
|
|
64
|
-
const bounds = yield* pure(() => ({
|
|
65
|
-
timeout: duration(options.downloadTimeout ?? "60 seconds", "clip download timeout", {
|
|
66
|
-
maximum: "10 minutes",
|
|
67
|
-
}),
|
|
68
|
-
manifest: positiveLimit(options.maxManifestBytes ?? 262_144, "manifest bytes", 2_097_152),
|
|
69
|
-
segment: positiveLimit(options.maxSegmentBytes ?? 16_777_216, "segment bytes", 64 * 1024 * 1024),
|
|
70
|
-
total: positiveLimit(options.maxTotalBytes ?? 64 * 1024 * 1024, "clip bytes", 64 * 1024 * 1024),
|
|
71
|
-
count: positiveLimit(options.maxSegments ?? 1024, "clip segments", 16_384),
|
|
72
|
-
}));
|
|
73
|
-
const fetchAndAssemble = Effect.gen(function* () {
|
|
74
|
-
let segments;
|
|
75
|
-
while (true) {
|
|
76
|
-
const response = yield* http.request({
|
|
77
|
-
operation: "clip playlist",
|
|
78
|
-
url: clip.playlist_url,
|
|
79
|
-
auth: "same-origin",
|
|
80
|
-
maxBytes: bounds.manifest,
|
|
81
|
-
});
|
|
82
|
-
if (response.status !== 202) {
|
|
83
|
-
segments = yield* pure(() => parsePlaylist(new TextDecoder("utf-8", { fatal: true }).decode(response.bytes), clip.playlist_url, bounds.count));
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
// A local peer disconnection does not prove stopped inference. Query the remote descriptor.
|
|
87
|
-
const descriptor = yield* http.read(clip.session_id);
|
|
88
|
-
if (terminal(descriptor.state))
|
|
89
|
-
return yield* ReactorError.fromCode("TerminalSession", "session terminated before playlist became available");
|
|
90
|
-
yield* Effect.sleep(Math.max(200, Math.min(retryAfterMs(response.headers) ?? 2000, 2000)));
|
|
91
|
-
}
|
|
92
|
-
let size = 0;
|
|
93
|
-
const chunks = [];
|
|
94
|
-
for (const segment of segments) {
|
|
95
|
-
const response = yield* http.request({
|
|
96
|
-
operation: "clip segment",
|
|
97
|
-
url: segment.url,
|
|
98
|
-
auth: "same-origin",
|
|
99
|
-
maxBytes: Math.min(bounds.segment, bounds.total - size || 1),
|
|
100
|
-
});
|
|
101
|
-
if (response.status === 202)
|
|
102
|
-
return yield* ReactorError.fromCode("Protocol", "playlist referenced a segment that is not ready");
|
|
103
|
-
size += response.bytes.length;
|
|
104
|
-
if (size > bounds.total)
|
|
105
|
-
return yield* ReactorError.fromCode("Overflow", "assembled clip byte bound exceeded");
|
|
106
|
-
chunks.push(response.bytes);
|
|
107
|
-
}
|
|
108
|
-
const bytes = new Uint8Array(size);
|
|
109
|
-
let at = 0;
|
|
110
|
-
for (const chunk of chunks) {
|
|
111
|
-
bytes.set(chunk, at);
|
|
112
|
-
at += chunk.length;
|
|
113
|
-
}
|
|
114
|
-
return { bytes, segments };
|
|
115
|
-
});
|
|
116
|
-
return yield* fetchAndAssemble.pipe(Effect.timeoutOrElse({
|
|
117
|
-
duration: bounds.timeout,
|
|
118
|
-
orElse: () => Effect.fail(ReactorError.fromCode("Timeout", "clip download deadline; remote generation outcome unchanged")),
|
|
119
|
-
}));
|
|
120
|
-
});
|
|
121
|
-
return action;
|
|
122
|
-
});
|
|
123
|
-
//# sourceMappingURL=recording.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recording.js","sourceRoot":"","sources":["../../../src/coordinator/_internal/recording.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAsB7C,MAAM,IAAI,GAAG,CAAI,IAAa,EAAkC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACh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X,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBACrB,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC;YACrB,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC,CAAC,gBAAgB,CAAC,IAAI,CACjC,MAAM,CAAC,aAAa,CAAC;YACnB,QAAQ,EAAE,MAAM,CAAC,OAAO;YACxB,MAAM,EAAE,GAAG,EAAE,CACX,MAAM,CAAC,IAAI,CACT,YAAY,CAAC,QAAQ,CACnB,SAAS,EACT,6DAA6D,CAC9D,CACF;SACJ,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
3
|
-
import type * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
|
|
4
|
-
import { ReactorError } from "../../errors.js";
|
|
5
|
-
export interface HttpReply {
|
|
6
|
-
readonly status: number;
|
|
7
|
-
readonly headers: Headers;
|
|
8
|
-
readonly bytes: Uint8Array<ArrayBuffer>;
|
|
9
|
-
}
|
|
10
|
-
/** Count every emitted chunk, including empty chunks, before retaining owned bytes. */
|
|
11
|
-
export declare const readBody: (response: HttpClientResponse.HttpClientResponse, operation: string, maxBytes: number, maxChunks: number) => Effect.Effect<Uint8Array<ArrayBuffer>, HttpClientError.HttpClientError | ReactorError, never>;
|
|
12
|
-
/** An absent body is not JSON null. Invalid UTF-8 is never repaired silently. */
|
|
13
|
-
export declare const decodeJsonReply: (reply: HttpReply, operation?: string) => unknown;
|
|
14
|
-
export declare const retryAfterMs: (headers: Headers) => number | undefined;
|
|
15
|
-
//# sourceMappingURL=response.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/coordinator/_internal/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,eAAe,MAAM,sCAAsC,CAAC;AACxE,OAAO,KAAK,KAAK,kBAAkB,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CACzC;AAED,uFAAuF;AACvF,eAAO,MAAM,QAAQ,aACT,kBAAkB,CAAC,kBAAkB,aACpC,MAAM,YACP,MAAM,aACL,MAAM,kGAoCf,CAAC;AAEL,iFAAiF;AACjF,eAAO,MAAM,eAAe,UAAW,SAAS,cAAc,MAAM,KAAG,OAoBtE,CAAC;AAEF,eAAO,MAAM,YAAY,YAAa,OAAO,KAAG,MAAM,GAAG,SAOxD,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Stream from "effect/Stream";
|
|
3
|
-
import * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
4
|
-
import { ReactorError } from "../../errors.js";
|
|
5
|
-
/** Count every emitted chunk, including empty chunks, before retaining owned bytes. */
|
|
6
|
-
export const readBody = (response, operation, maxBytes, maxChunks) => Effect.gen(function* () {
|
|
7
|
-
let size = 0;
|
|
8
|
-
let count = 0;
|
|
9
|
-
const chunks = [];
|
|
10
|
-
yield* response.stream.pipe(Stream.runForEach((chunk) => Effect.gen(function* () {
|
|
11
|
-
size += chunk.byteLength;
|
|
12
|
-
count++;
|
|
13
|
-
if (size > maxBytes || count > maxChunks)
|
|
14
|
-
return yield* ReactorError.fromCode("Overflow", `${operation} response exceeds its ${maxBytes} byte/${maxChunks} chunk bound`, { operation, outcome: "replied", detail: { status: response.status } });
|
|
15
|
-
// A supplied HTTP implementation may reuse its transport buffer.
|
|
16
|
-
if (chunk.byteLength !== 0)
|
|
17
|
-
chunks.push(new Uint8Array(chunk));
|
|
18
|
-
})), Effect.catchIf((error) => count === 0 &&
|
|
19
|
-
HttpClientError.isHttpClientError(error) &&
|
|
20
|
-
error.reason._tag === "EmptyBodyError", () => Effect.void));
|
|
21
|
-
const bytes = new Uint8Array(size);
|
|
22
|
-
let offset = 0;
|
|
23
|
-
for (const chunk of chunks) {
|
|
24
|
-
bytes.set(chunk, offset);
|
|
25
|
-
offset += chunk.byteLength;
|
|
26
|
-
}
|
|
27
|
-
return bytes;
|
|
28
|
-
});
|
|
29
|
-
/** An absent body is not JSON null. Invalid UTF-8 is never repaired silently. */
|
|
30
|
-
export const decodeJsonReply = (reply, operation) => {
|
|
31
|
-
try {
|
|
32
|
-
const result = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(reply.bytes));
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
catch (cause) {
|
|
36
|
-
// The SyntaxError quotes the body, so it stays in the inspection-only detail.
|
|
37
|
-
throw ReactorError.fromCode("Protocol", operation === undefined
|
|
38
|
-
? "invalid UTF-8/JSON HTTP response"
|
|
39
|
-
: `Reactor ${operation} request or response failed`, {
|
|
40
|
-
...(operation === undefined ? {} : { operation }),
|
|
41
|
-
outcome: "replied",
|
|
42
|
-
detail: cause,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export const retryAfterMs = (headers) => {
|
|
47
|
-
const raw = headers.get("retry-after");
|
|
48
|
-
if (raw === null || !/^\s*(?:\d+(?:\.\d*)?|\.\d+)\s*$/.test(raw))
|
|
49
|
-
return undefined;
|
|
50
|
-
const seconds = Number(raw);
|
|
51
|
-
return Number.isFinite(seconds) && seconds >= 0 && Number.isFinite(seconds * 1000)
|
|
52
|
-
? seconds * 1000
|
|
53
|
-
: undefined;
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=response.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/coordinator/_internal/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,eAAe,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C,uFAAuF;AACvF,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,QAA+C,EAC/C,SAAiB,EACjB,QAAgB,EAChB,SAAiB,EACjB,EAAE,CACF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,MAAM,MAAM,GAA8B,EAAE,CAAC;IAC7C,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CACzB,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE,CAC1B,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC;QACzB,KAAK,EAAE,CAAC;QACR,IAAI,IAAI,GAAG,QAAQ,IAAI,KAAK,GAAG,SAAS;YACtC,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,QAAQ,CACjC,UAAU,EACV,GAAG,SAAS,yBAAyB,QAAQ,SAAS,SAAS,cAAc,EAC7E,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CACvE,CAAC;QACJ,iEAAiE;QACjE,IAAI,KAAK,CAAC,UAAU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AC;YACjD,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,KAAK;SACd,CACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAsB,EAAE;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACvC,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,iCAAiC,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACnF,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;QAChF,CAAC,CAAC,OAAO,GAAG,IAAI;QAChB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Duration, Effect, Redacted, Schema } from "effect";
|
|
2
|
-
import { ReactorError } from "../../errors.js";
|
|
3
|
-
/**
|
|
4
|
-
* The rate of `model`, given by its connect slug (or its bare name), in
|
|
5
|
-
* credits per second: exactly as stated for a per-second rate, and a
|
|
6
|
-
* per-minute rate divided by 60. Callers decide whether the price fits their
|
|
7
|
-
* budget, and how the time they are billed rounds: Reactor's documentation
|
|
8
|
-
* bills by the session-minute.
|
|
9
|
-
*/
|
|
10
|
-
export declare const modelRate: (value: unknown, model: string) => Effect.Effect<{
|
|
11
|
-
creditsPerDollar: number;
|
|
12
|
-
creditsPerSecond: number;
|
|
13
|
-
}, ReactorError, never>;
|
|
14
|
-
export interface TokenOptions {
|
|
15
|
-
readonly apiKey: Redacted.Redacted<string>;
|
|
16
|
-
readonly modelName: string;
|
|
17
|
-
/**
|
|
18
|
-
* The longest session the token may start, a whole number of seconds up to
|
|
19
|
-
* one day. A bare number is milliseconds.
|
|
20
|
-
*/
|
|
21
|
-
readonly maxSessionDuration: Duration.Input;
|
|
22
|
-
/**
|
|
23
|
-
* How long the token stays valid, a whole number of seconds more than 30
|
|
24
|
-
* seconds past `maxSessionDuration`, so cleanup still holds a valid token. A
|
|
25
|
-
* bare number is milliseconds.
|
|
26
|
-
*/
|
|
27
|
-
readonly expiresAfter: Duration.Input;
|
|
28
|
-
}
|
|
29
|
-
/** Token options after validation, in the wire's whole seconds. */
|
|
30
|
-
export interface TokenRequest {
|
|
31
|
-
readonly apiKey: Redacted.Redacted<string>;
|
|
32
|
-
readonly modelName: string;
|
|
33
|
-
readonly maxSessionDurationSeconds: number;
|
|
34
|
-
readonly expiresAfterSeconds: number;
|
|
35
|
-
}
|
|
36
|
-
export interface TokenGrant {
|
|
37
|
-
readonly jwt: Redacted.Redacted<string>;
|
|
38
|
-
readonly expiresAt: number;
|
|
39
|
-
readonly granted: {
|
|
40
|
-
readonly maxSessions: 1;
|
|
41
|
-
readonly maxSessionSeconds: number;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export declare const validateTokenOptions: (input: TokenOptions) => Effect.Effect<TokenRequest, ReactorError>;
|
|
45
|
-
export declare const decodeToken: (raw: unknown) => Effect.Effect<{
|
|
46
|
-
readonly jwt: string;
|
|
47
|
-
readonly expires_at: number;
|
|
48
|
-
}, ReactorError, never>;
|
|
49
|
-
/** Validate the issuer's returned authority; token expiry alone never caps a remote session. */
|
|
50
|
-
export declare const grantedLimits: (jwt: string, options: TokenRequest) => Effect.Effect<{
|
|
51
|
-
maxSessions: 1;
|
|
52
|
-
maxSessionSeconds: number;
|
|
53
|
-
}, ReactorError, never>;
|
|
54
|
-
export declare const Inspection: Schema.Struct<{
|
|
55
|
-
readonly observedAt: Schema.Finite;
|
|
56
|
-
readonly state: Schema.String;
|
|
57
|
-
readonly hasCapabilities: Schema.Boolean;
|
|
58
|
-
readonly selectedTransport: Schema.NullOr<Schema.Struct<{
|
|
59
|
-
readonly protocol: Schema.NonEmptyString;
|
|
60
|
-
readonly version: Schema.NonEmptyString;
|
|
61
|
-
}>>;
|
|
62
|
-
readonly cluster: Schema.NullOr<Schema.String>;
|
|
63
|
-
readonly zone: Schema.NullOr<Schema.String>;
|
|
64
|
-
readonly serverVersion: Schema.NullOr<Schema.String>;
|
|
65
|
-
readonly additional: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>;
|
|
66
|
-
}>;
|
|
67
|
-
export type Inspection = typeof Inspection.Type;
|
|
68
|
-
export declare const decodeInspection: (raw: unknown, sessionId: string) => Effect.Effect<Inspection, ReactorError>;
|
|
69
|
-
export declare const decodeTermination: (raw: unknown, sessionId: string) => Effect.Effect<{
|
|
70
|
-
readonly session_id?: string;
|
|
71
|
-
readonly state: string;
|
|
72
|
-
}, ReactorError, never>;
|
|
73
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/coordinator/_internal/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,EAAsB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAoDnE;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,UAAW,OAAO,SAAS,MAAM;;;uBAiBpD,CAAC;AAEJ,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC;CACvC;AACD,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,yBAAyB,EAAE,MAAM,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC;AACD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,CAAC;CACnF;AAED,eAAO,MAAM,oBAAoB,UACxB,YAAY,KAClB,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,CAwC9B,CAAC;AAsBd,eAAO,MAAM,WAAW,QAAS,OAAO;;;uBAKrC,CAAC;AAEJ,gGAAgG;AAChG,eAAO,MAAM,aAAa,QAAS,MAAM,WAAW,YAAY;;;uBAqB7D,CAAC;AAMJ,eAAO,MAAM,UAAU;;;;;;;;;;;;EAYrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAqChD,eAAO,MAAM,gBAAgB,QACtB,OAAO,aACD,MAAM,KAChB,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAmBrC,CAAC;AAQL,eAAO,MAAM,iBAAiB,QAAS,OAAO,aAAa,MAAM;;;uBAS9D,CAAC"}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { Clock, Duration, Effect, Redacted, Result, Schema } from "effect";
|
|
2
|
-
import { duration } from "../../duration.js";
|
|
3
|
-
import { parse, parsedInput, ReactorError } from "../../errors.js";
|
|
4
|
-
const failure = (operation, message, cause) => ReactorError.fromCode("Protocol", message, {
|
|
5
|
-
operation,
|
|
6
|
-
outcome: "replied",
|
|
7
|
-
...(cause === undefined ? {} : { detail: cause }),
|
|
8
|
-
});
|
|
9
|
-
const PositiveInteger = Schema.Int.check(Schema.isGreaterThan(0));
|
|
10
|
-
/**
|
|
11
|
-
* Only the settings are read strictly. The catalog is shared by every model,
|
|
12
|
-
* so an entry in a shape this client does not price never stops it pricing
|
|
13
|
-
* the model it was asked for; an absent catalog is empty, as Reactor's
|
|
14
|
-
* pricing documentation says. Credits are sold per US dollar, so a stated
|
|
15
|
-
* currency must be that one.
|
|
16
|
-
*/
|
|
17
|
-
const Pricing = Schema.Struct({
|
|
18
|
-
settings: Schema.Struct({
|
|
19
|
-
currency_code: Schema.optional(Schema.Literal("USD")),
|
|
20
|
-
credits_per_dollar: PositiveInteger,
|
|
21
|
-
}),
|
|
22
|
-
models: Schema.optional(Schema.Array(Schema.Unknown)),
|
|
23
|
-
});
|
|
24
|
-
const isEntry = Schema.is(Schema.Struct({ name: Schema.String, rate: Schema.Unknown }));
|
|
25
|
-
const unknownRate = (cause) => failure("pricing", "Reactor pricing has an unknown model, currency or rate unit", cause);
|
|
26
|
-
/**
|
|
27
|
-
* The rates this client prices: whole credits per second, as the live pricing
|
|
28
|
-
* document states them, or per minute, as its documentation does.
|
|
29
|
-
*/
|
|
30
|
-
const CreditsRate = Schema.Union([
|
|
31
|
-
Schema.Struct({
|
|
32
|
-
amount_per_sec: PositiveInteger,
|
|
33
|
-
unit: Schema.Literal("credits"),
|
|
34
|
-
denomination: Schema.Literal("second"),
|
|
35
|
-
}),
|
|
36
|
-
Schema.Struct({
|
|
37
|
-
amount_per_min: PositiveInteger,
|
|
38
|
-
unit: Schema.Literal("credits"),
|
|
39
|
-
denomination: Schema.Literal("minute"),
|
|
40
|
-
}),
|
|
41
|
-
]);
|
|
42
|
-
/**
|
|
43
|
-
* Pricing lists a model by its bare name, `h3-reference-to-video-turbo-realtime`,
|
|
44
|
-
* where sessions and tokens take its connect slug,
|
|
45
|
-
* `reactor/h3-reference-to-video-turbo-realtime`: the name after the owner.
|
|
46
|
-
*/
|
|
47
|
-
const pricedAs = (model) => model.slice(model.lastIndexOf("/") + 1);
|
|
48
|
-
/**
|
|
49
|
-
* The rate of `model`, given by its connect slug (or its bare name), in
|
|
50
|
-
* credits per second: exactly as stated for a per-second rate, and a
|
|
51
|
-
* per-minute rate divided by 60. Callers decide whether the price fits their
|
|
52
|
-
* budget, and how the time they are billed rounds: Reactor's documentation
|
|
53
|
-
* bills by the session-minute.
|
|
54
|
-
*/
|
|
55
|
-
export const modelRate = (value, model) => Schema.decodeUnknownEffect(Pricing)(value).pipe(Effect.flatMap((decoded) => {
|
|
56
|
-
const matches = (decoded.models ?? [])
|
|
57
|
-
.filter(isEntry)
|
|
58
|
-
.filter((entry) => entry.name === model || entry.name === pricedAs(model));
|
|
59
|
-
return Schema.decodeUnknownEffect(CreditsRate)(matches.length === 1 ? matches[0].rate : undefined).pipe(Effect.map((rate) => ({
|
|
60
|
-
creditsPerDollar: decoded.settings.credits_per_dollar,
|
|
61
|
-
creditsPerSecond: "amount_per_sec" in rate ? rate.amount_per_sec : rate.amount_per_min / 60,
|
|
62
|
-
})));
|
|
63
|
-
}), Effect.mapError(unknownRate));
|
|
64
|
-
const wholeSeconds = (value) => Math.round(Duration.toSeconds(value));
|
|
65
|
-
export const validateTokenOptions = (input) => parsedInput(() => {
|
|
66
|
-
const reject = () => {
|
|
67
|
-
throw ReactorError.fromCode("InvalidInput", "A bounded session needs a model, redacted key, positive duration, and token expiry allowing cleanup", { operation: "token", outcome: "not-submitted" });
|
|
68
|
-
};
|
|
69
|
-
if (input === null || typeof input !== "object")
|
|
70
|
-
return reject();
|
|
71
|
-
const bounded = parse(() => ({
|
|
72
|
-
maxSessionDurationSeconds: wholeSeconds(duration(input.maxSessionDuration, "session duration", {
|
|
73
|
-
maximum: "1 day",
|
|
74
|
-
wholeSeconds: true,
|
|
75
|
-
})),
|
|
76
|
-
// Whole milliseconds stay exact up to this bound, so the seconds do too.
|
|
77
|
-
expiresAfterSeconds: wholeSeconds(duration(input.expiresAfter, "token expiry", {
|
|
78
|
-
maximum: Duration.millis(Number.MAX_SAFE_INTEGER),
|
|
79
|
-
wholeSeconds: true,
|
|
80
|
-
})),
|
|
81
|
-
}));
|
|
82
|
-
if (Result.isFailure(bounded))
|
|
83
|
-
return reject();
|
|
84
|
-
const options = {
|
|
85
|
-
apiKey: input.apiKey,
|
|
86
|
-
modelName: input.modelName,
|
|
87
|
-
...bounded.success,
|
|
88
|
-
};
|
|
89
|
-
if (!Redacted.isRedacted(options.apiKey) ||
|
|
90
|
-
Redacted.value(options.apiKey).length === 0 ||
|
|
91
|
-
typeof options.modelName !== "string" ||
|
|
92
|
-
options.modelName.length === 0 ||
|
|
93
|
-
options.expiresAfterSeconds <= options.maxSessionDurationSeconds + 30)
|
|
94
|
-
return reject();
|
|
95
|
-
return Object.freeze(options);
|
|
96
|
-
}, "token");
|
|
97
|
-
const Token = Schema.Struct({
|
|
98
|
-
jwt: Schema.NonEmptyString,
|
|
99
|
-
expires_at: Schema.Finite,
|
|
100
|
-
});
|
|
101
|
-
const TokenClaims = Schema.StringFromBase64Url.pipe(Schema.decodeTo(Schema.fromJsonString(Schema.Struct({ authorization_details: Schema.Unknown }))));
|
|
102
|
-
const SessionAuthorization = Schema.Tuple([
|
|
103
|
-
Schema.Struct({
|
|
104
|
-
type: Schema.Literal("session"),
|
|
105
|
-
resources: Schema.Struct({
|
|
106
|
-
models: Schema.Struct({ match: Schema.Tuple([Schema.NonEmptyString]) }),
|
|
107
|
-
}),
|
|
108
|
-
constraints: Schema.Struct({
|
|
109
|
-
max_sessions: Schema.Literal(1),
|
|
110
|
-
max_session_duration_seconds: PositiveInteger,
|
|
111
|
-
}),
|
|
112
|
-
}),
|
|
113
|
-
]);
|
|
114
|
-
export const decodeToken = (raw) => Schema.decodeUnknownEffect(Token)(raw).pipe(Effect.mapError((cause) => failure("token", "Reactor returned an invalid token response", cause)));
|
|
115
|
-
/** Validate the issuer's returned authority; token expiry alone never caps a remote session. */
|
|
116
|
-
export const grantedLimits = (jwt, options) => Effect.gen(function* () {
|
|
117
|
-
const payload = /^[A-Za-z0-9_-]+\.([A-Za-z0-9_-]+)\.[A-Za-z0-9_-]+$/.exec(jwt)?.[1];
|
|
118
|
-
const claims = yield* Schema.decodeUnknownEffect(TokenClaims)(payload);
|
|
119
|
-
const [authorization] = yield* Schema.decodeUnknownEffect(SessionAuthorization, {
|
|
120
|
-
onExcessProperty: "error",
|
|
121
|
-
})(claims.authorization_details);
|
|
122
|
-
const seconds = authorization.constraints.max_session_duration_seconds;
|
|
123
|
-
if (authorization.resources.models.match[0] !== options.modelName ||
|
|
124
|
-
seconds > options.maxSessionDurationSeconds)
|
|
125
|
-
return yield* failure("token", "Reactor returned a token outside the requested session grant");
|
|
126
|
-
return { maxSessions: authorization.constraints.max_sessions, maxSessionSeconds: seconds };
|
|
127
|
-
}).pipe(Effect.mapError((cause) => failure("token", "Reactor returned an invalid or unbounded session grant", cause)));
|
|
128
|
-
const Transport = Schema.Struct({
|
|
129
|
-
protocol: Schema.NonEmptyString,
|
|
130
|
-
version: Schema.NonEmptyString,
|
|
131
|
-
});
|
|
132
|
-
export const Inspection = Schema.Struct({
|
|
133
|
-
observedAt: Schema.Finite,
|
|
134
|
-
state: Schema.String,
|
|
135
|
-
hasCapabilities: Schema.Boolean,
|
|
136
|
-
selectedTransport: Schema.NullOr(Transport),
|
|
137
|
-
cluster: Schema.NullOr(Schema.String),
|
|
138
|
-
zone: Schema.NullOr(Schema.String),
|
|
139
|
-
serverVersion: Schema.NullOr(Schema.String),
|
|
140
|
-
additional: Schema.Record(Schema.String, Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null])),
|
|
141
|
-
});
|
|
142
|
-
const OptionalText = Schema.optionalKey(Schema.NullOr(Schema.String));
|
|
143
|
-
const modeledFields = new Set([
|
|
144
|
-
"session_id",
|
|
145
|
-
"state",
|
|
146
|
-
"capabilities",
|
|
147
|
-
"selected_transport",
|
|
148
|
-
"cluster",
|
|
149
|
-
"zone",
|
|
150
|
-
"server_info",
|
|
151
|
-
]);
|
|
152
|
-
const sensitiveField = /secret|token|credential|password|key|jwt|url|auth/i;
|
|
153
|
-
const additionalFacts = (raw) => {
|
|
154
|
-
const facts = [];
|
|
155
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
156
|
-
return {};
|
|
157
|
-
for (const [key, value] of Object.entries(raw).slice(0, 64)) {
|
|
158
|
-
if (modeledFields.has(key) || sensitiveField.test(key))
|
|
159
|
-
continue;
|
|
160
|
-
if (value === null || typeof value === "number" || typeof value === "boolean")
|
|
161
|
-
facts.push([key, value]);
|
|
162
|
-
else if (typeof value === "string")
|
|
163
|
-
facts.push([key, value.slice(0, 200)]);
|
|
164
|
-
}
|
|
165
|
-
return Object.fromEntries(facts);
|
|
166
|
-
};
|
|
167
|
-
// Inspection needs coordinator facts, even when connection capabilities are
|
|
168
|
-
// only partially published. Allocation/readiness uses the stricter Descriptor.
|
|
169
|
-
const SessionDescription = Schema.Struct({
|
|
170
|
-
session_id: Schema.NonEmptyString,
|
|
171
|
-
state: Schema.NonEmptyString,
|
|
172
|
-
capabilities: Schema.optionalKey(Schema.NullOr(Schema.JsonObject)),
|
|
173
|
-
selected_transport: Schema.optionalKey(Schema.NullOr(Transport)),
|
|
174
|
-
cluster: OptionalText,
|
|
175
|
-
zone: OptionalText,
|
|
176
|
-
server_info: Schema.optionalKey(Schema.NullOr(Schema.Struct({ server_version: Schema.String }))),
|
|
177
|
-
});
|
|
178
|
-
export const decodeInspection = (raw, sessionId) => Effect.gen(function* () {
|
|
179
|
-
const value = yield* Schema.decodeUnknownEffect(SessionDescription)(raw).pipe(Effect.mapError((cause) => failure("inspect", "Reactor returned an invalid session description", cause)));
|
|
180
|
-
if (value.session_id !== sessionId)
|
|
181
|
-
return yield* failure("inspect", "Reactor returned a different session identity");
|
|
182
|
-
return {
|
|
183
|
-
observedAt: yield* Clock.currentTimeMillis,
|
|
184
|
-
state: value.state,
|
|
185
|
-
hasCapabilities: value.capabilities != null,
|
|
186
|
-
selectedTransport: value.selected_transport ?? null,
|
|
187
|
-
cluster: value.cluster ?? null,
|
|
188
|
-
zone: value.zone ?? null,
|
|
189
|
-
serverVersion: value.server_info?.server_version ?? null,
|
|
190
|
-
additional: additionalFacts(raw),
|
|
191
|
-
};
|
|
192
|
-
});
|
|
193
|
-
// A termination probe promises state, not a complete connectable descriptor.
|
|
194
|
-
// When it includes identity, that identity must match the requested session.
|
|
195
|
-
const TerminalState = Schema.Struct({
|
|
196
|
-
session_id: Schema.optionalKey(Schema.NonEmptyString),
|
|
197
|
-
state: Schema.NonEmptyString,
|
|
198
|
-
});
|
|
199
|
-
export const decodeTermination = (raw, sessionId) => Schema.decodeUnknownEffect(TerminalState)(raw).pipe(Effect.mapError((cause) => failure("terminate", "Reactor returned an invalid termination description", cause)), Effect.filterOrFail((value) => value.session_id === undefined || value.session_id === sessionId, () => failure("terminate", "Reactor returned a different session identity")));
|
|
200
|
-
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/coordinator/_internal/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,OAAO,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAE,KAAe,EAAE,EAAE,CACtE,YAAY,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE;IACzC,SAAS;IACT,OAAO,EAAE,SAAS;IAClB,GAAG,CAAC,KAAK,KAA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CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CACjD,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,OAAO,CAAC,WAAW,EAAE,qDAAqD,EAAE,KAAK,CAAC,CACnF,EACD,MAAM,CAAC,YAAY,CACjB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAC3E,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,+CAA+C,CAAC,CAC5E,CACF,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Redacted from "effect/Redacted";
|
|
3
|
-
import * as Http from "effect/unstable/http/HttpClient";
|
|
4
|
-
import { ReactorError } from "../errors.js";
|
|
5
|
-
import type { Json } from "../json.js";
|
|
6
|
-
import type { HttpOptions, Termination } from "./_internal/client.js";
|
|
7
|
-
import type { Inspection, TokenGrant, TokenOptions } from "./_internal/schemas.js";
|
|
8
|
-
import type { DownloadedClip, DownloadOptions } from "./_internal/recording.js";
|
|
9
|
-
import type { ClipReady } from "../wire.generated.js";
|
|
10
|
-
export { Inspection, modelRate } from "./_internal/schemas.js";
|
|
11
|
-
export type { TokenGrant, TokenOptions } from "./_internal/schemas.js";
|
|
12
|
-
export { Termination } from "./_internal/client.js";
|
|
13
|
-
export type { Poll } from "./_internal/client.js";
|
|
14
|
-
export { parsePlaylist } from "./_internal/recording.js";
|
|
15
|
-
export type { DownloadedClip, DownloadOptions, Segment } from "./_internal/recording.js";
|
|
16
|
-
export type { Capabilities, Descriptor, Track, Mapping, IceCandidate, IceServer, } from "../contract.js";
|
|
17
|
-
export interface Configuration extends Omit<HttpOptions, "apiUrl" | "credential"> {
|
|
18
|
-
readonly apiUrl?: string;
|
|
19
|
-
/** Evaluated for each authenticated request, including a supervisor's confirmation GET. */
|
|
20
|
-
readonly credential?: Effect.Effect<Redacted.Redacted<string>, ReactorError>;
|
|
21
|
-
}
|
|
22
|
-
/** Coordinator operations share configuration and the supplied Effect HTTP client. */
|
|
23
|
-
export interface Client {
|
|
24
|
-
readonly apiUrl: string;
|
|
25
|
-
readonly pricing: Effect.Effect<Json, ReactorError>;
|
|
26
|
-
readonly mintToken: (options: TokenOptions) => Effect.Effect<TokenGrant, ReactorError>;
|
|
27
|
-
readonly inspect: (sessionId: string) => Effect.Effect<Inspection, ReactorError>;
|
|
28
|
-
/** Uncertainty is retained in the report; supervisors choose their own failure policy. */
|
|
29
|
-
readonly terminate: (sessionId: string) => Effect.Effect<Termination>;
|
|
30
|
-
/**
|
|
31
|
-
* Bounded transport of a prepared recording (`clip_ready`): polls its HLS
|
|
32
|
-
* playlist, then fetches and concatenates its segments within a caller wall
|
|
33
|
-
* deadline. It does not decode or play the clip, and a deadline does not
|
|
34
|
-
* change the remote generation outcome.
|
|
35
|
-
*/
|
|
36
|
-
readonly downloadClip: (clip: ClipReady, options?: DownloadOptions) => Effect.Effect<DownloadedClip, ReactorError>;
|
|
37
|
-
}
|
|
38
|
-
/** No network request or remote allocation occurs while constructing a coordinator client. */
|
|
39
|
-
export declare const make: (configuration?: Configuration) => Effect.Effect<Client, ReactorError, Http.HttpClient>;
|
|
40
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/coordinator/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAU,YAAY,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MA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AC,CAAC;IACvF,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACjF,0FAA0F;IAC1F,QAAQ,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACtE;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,CACrB,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE,eAAe,KACtB,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;CAClD;AAED,8FAA8F;AAC9F,eAAO,MAAM,IAAI,mBACA,aAAa,KAC3B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,CA4BnD,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Redacted from "effect/Redacted";
|
|
3
|
-
import * as Http from "effect/unstable/http/HttpClient";
|
|
4
|
-
import { parsed, ReactorError } from "../errors.js";
|
|
5
|
-
import { CoordinatorClient } from "./_internal/client.js";
|
|
6
|
-
export { Inspection, modelRate } from "./_internal/schemas.js";
|
|
7
|
-
export { Termination } from "./_internal/client.js";
|
|
8
|
-
export { parsePlaylist } from "./_internal/recording.js";
|
|
9
|
-
/** No network request or remote allocation occurs while constructing a coordinator client. */
|
|
10
|
-
export const make = (configuration = {}) => Effect.flatMap(Http.HttpClient, (http) => parsed(() => new CoordinatorClient({
|
|
11
|
-
...configuration,
|
|
12
|
-
apiUrl: configuration.apiUrl ?? "https://api.reactor.inc",
|
|
13
|
-
credential: configuration.credential === undefined
|
|
14
|
-
? Effect.undefined
|
|
15
|
-
: configuration.credential.pipe(Effect.flatMap((credential) => parsed(() => {
|
|
16
|
-
if (!Redacted.isRedacted(credential))
|
|
17
|
-
throw ReactorError.fromCode("InvalidInput", "Coordinator credential must be Redacted", { outcome: "not-submitted" });
|
|
18
|
-
return Redacted.value(credential);
|
|
19
|
-
}))),
|
|
20
|
-
}, http)));
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coordinator/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAM1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAqCzD,8FAA8F;AAC9F,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,aAAa,GAAkB,EAAE,EACqB,EAAE,CACxD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CACvC,MAAM,CACJ,GAAG,EAAE,CACH,IAAI,iBAAiB,CACnB;IACE,GAAG,aAAa;IAChB,MAAM,EAAE,aAAa,CAAC,MAAM,IAAI,yBAAyB;IACzD,UAAU,EACR,aAAa,CAAC,UAAU,KAAK,SAAS;QACpC,CAAC,CAAC,MAAM,CAAC,SAAS;QAClB,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAC5B,MAAM,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;gBAClC,MAAM,YAAY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