reactor-effect-client 0.0.0-reserved.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +29 -0
  3. package/README.md +124 -2
  4. package/dist/FetchHttp.d.ts +9 -0
  5. package/dist/FetchHttp.d.ts.map +1 -0
  6. package/dist/FetchHttp.js +63 -0
  7. package/dist/FetchHttp.js.map +1 -0
  8. package/dist/PeerFactory.d.ts +15 -0
  9. package/dist/PeerFactory.d.ts.map +1 -0
  10. package/dist/PeerFactory.js +4 -0
  11. package/dist/PeerFactory.js.map +1 -0
  12. package/dist/PeerTypes.d.ts +64 -0
  13. package/dist/PeerTypes.d.ts.map +1 -0
  14. package/dist/PeerTypes.js +2 -0
  15. package/dist/PeerTypes.js.map +1 -0
  16. package/dist/Sequence.d.ts +81 -0
  17. package/dist/Sequence.d.ts.map +1 -0
  18. package/dist/Sequence.js +215 -0
  19. package/dist/Sequence.js.map +1 -0
  20. package/dist/SessionTypes.d.ts +164 -0
  21. package/dist/SessionTypes.d.ts.map +1 -0
  22. package/dist/SessionTypes.js +2 -0
  23. package/dist/SessionTypes.js.map +1 -0
  24. package/dist/Submission.d.ts +42 -0
  25. package/dist/Submission.d.ts.map +1 -0
  26. package/dist/Submission.js +52 -0
  27. package/dist/Submission.js.map +1 -0
  28. package/dist/bytes.d.ts +6 -0
  29. package/dist/bytes.d.ts.map +1 -0
  30. package/dist/bytes.js +32 -0
  31. package/dist/bytes.js.map +1 -0
  32. package/dist/contract.d.ts +58 -0
  33. package/dist/contract.d.ts.map +1 -0
  34. package/dist/contract.js +87 -0
  35. package/dist/contract.js.map +1 -0
  36. package/dist/coordinator/_internal/client.d.ts +127 -0
  37. package/dist/coordinator/_internal/client.d.ts.map +1 -0
  38. package/dist/coordinator/_internal/client.js +450 -0
  39. package/dist/coordinator/_internal/client.js.map +1 -0
  40. package/dist/coordinator/_internal/response.d.ts +15 -0
  41. package/dist/coordinator/_internal/response.d.ts.map +1 -0
  42. package/dist/coordinator/_internal/response.js +57 -0
  43. package/dist/coordinator/_internal/response.js.map +1 -0
  44. package/dist/coordinator/_internal/schemas.d.ts +51 -0
  45. package/dist/coordinator/_internal/schemas.d.ts.map +1 -0
  46. package/dist/coordinator/_internal/schemas.js +170 -0
  47. package/dist/coordinator/_internal/schemas.js.map +1 -0
  48. package/dist/coordinator/index.d.ts +28 -0
  49. package/dist/coordinator/index.d.ts.map +1 -0
  50. package/dist/coordinator/index.js +25 -0
  51. package/dist/coordinator/index.js.map +1 -0
  52. package/dist/correlation.d.ts +32 -0
  53. package/dist/correlation.d.ts.map +1 -0
  54. package/dist/correlation.js +113 -0
  55. package/dist/correlation.js.map +1 -0
  56. package/dist/errors.d.ts +88 -0
  57. package/dist/errors.d.ts.map +1 -0
  58. package/dist/errors.js +93 -0
  59. package/dist/errors.js.map +1 -0
  60. package/dist/h3/_internal/client.d.ts +9 -0
  61. package/dist/h3/_internal/client.d.ts.map +1 -0
  62. package/dist/h3/_internal/client.js +510 -0
  63. package/dist/h3/_internal/client.js.map +1 -0
  64. package/dist/h3/_internal/contracts.d.ts +123 -0
  65. package/dist/h3/_internal/contracts.d.ts.map +1 -0
  66. package/dist/h3/_internal/contracts.js +113 -0
  67. package/dist/h3/_internal/contracts.js.map +1 -0
  68. package/dist/h3/_internal/deployment.d.ts +8 -0
  69. package/dist/h3/_internal/deployment.d.ts.map +1 -0
  70. package/dist/h3/_internal/deployment.js +132 -0
  71. package/dist/h3/_internal/deployment.js.map +1 -0
  72. package/dist/h3/_internal/evidence.d.ts +17 -0
  73. package/dist/h3/_internal/evidence.d.ts.map +1 -0
  74. package/dist/h3/_internal/evidence.js +48 -0
  75. package/dist/h3/_internal/evidence.js.map +1 -0
  76. package/dist/h3/_internal/references.d.ts +18 -0
  77. package/dist/h3/_internal/references.d.ts.map +1 -0
  78. package/dist/h3/_internal/references.js +186 -0
  79. package/dist/h3/_internal/references.js.map +1 -0
  80. package/dist/h3/_internal/request.d.ts +16 -0
  81. package/dist/h3/_internal/request.d.ts.map +1 -0
  82. package/dist/h3/_internal/request.js +79 -0
  83. package/dist/h3/_internal/request.js.map +1 -0
  84. package/dist/h3/_internal/state.d.ts +30 -0
  85. package/dist/h3/_internal/state.d.ts.map +1 -0
  86. package/dist/h3/_internal/state.js +243 -0
  87. package/dist/h3/_internal/state.js.map +1 -0
  88. package/dist/h3/index.d.ts +10 -0
  89. package/dist/h3/index.d.ts.map +1 -0
  90. package/dist/h3/index.js +7 -0
  91. package/dist/h3/index.js.map +1 -0
  92. package/dist/h3/messages.d.ts +310 -0
  93. package/dist/h3/messages.d.ts.map +1 -0
  94. package/dist/h3/messages.js +114 -0
  95. package/dist/h3/messages.js.map +1 -0
  96. package/dist/h3/profile.d.ts +109 -0
  97. package/dist/h3/profile.d.ts.map +1 -0
  98. package/dist/h3/profile.js +70 -0
  99. package/dist/h3/profile.js.map +1 -0
  100. package/dist/h3/types.d.ts +173 -0
  101. package/dist/h3/types.d.ts.map +1 -0
  102. package/dist/h3/types.js +2 -0
  103. package/dist/h3/types.js.map +1 -0
  104. package/dist/host.d.ts +25 -0
  105. package/dist/host.d.ts.map +1 -0
  106. package/dist/host.js +20 -0
  107. package/dist/host.js.map +1 -0
  108. package/dist/index.d.ts +17 -0
  109. package/dist/index.d.ts.map +1 -0
  110. package/dist/index.js +8 -0
  111. package/dist/index.js.map +1 -0
  112. package/dist/json.d.ts +18 -0
  113. package/dist/json.d.ts.map +1 -0
  114. package/dist/json.js +123 -0
  115. package/dist/json.js.map +1 -0
  116. package/dist/media-stream.d.ts +10 -0
  117. package/dist/media-stream.d.ts.map +1 -0
  118. package/dist/media-stream.js +20 -0
  119. package/dist/media-stream.js.map +1 -0
  120. package/dist/observation.d.ts +26 -0
  121. package/dist/observation.d.ts.map +1 -0
  122. package/dist/observation.js +106 -0
  123. package/dist/observation.js.map +1 -0
  124. package/dist/orchestration/h3-source.d.ts +30 -0
  125. package/dist/orchestration/h3-source.d.ts.map +1 -0
  126. package/dist/orchestration/h3-source.js +303 -0
  127. package/dist/orchestration/h3-source.js.map +1 -0
  128. package/dist/orchestration/index.d.ts +12 -0
  129. package/dist/orchestration/index.d.ts.map +1 -0
  130. package/dist/orchestration/index.js +9 -0
  131. package/dist/orchestration/index.js.map +1 -0
  132. package/dist/orchestration/media-buffer.d.ts +23 -0
  133. package/dist/orchestration/media-buffer.d.ts.map +1 -0
  134. package/dist/orchestration/media-buffer.js +73 -0
  135. package/dist/orchestration/media-buffer.js.map +1 -0
  136. package/dist/orchestration/queries.d.ts +10 -0
  137. package/dist/orchestration/queries.d.ts.map +1 -0
  138. package/dist/orchestration/queries.js +40 -0
  139. package/dist/orchestration/queries.js.map +1 -0
  140. package/dist/orchestration/references.d.ts +16 -0
  141. package/dist/orchestration/references.d.ts.map +1 -0
  142. package/dist/orchestration/references.js +76 -0
  143. package/dist/orchestration/references.js.map +1 -0
  144. package/dist/orchestration/renewal-state.d.ts +58 -0
  145. package/dist/orchestration/renewal-state.d.ts.map +1 -0
  146. package/dist/orchestration/renewal-state.js +60 -0
  147. package/dist/orchestration/renewal-state.js.map +1 -0
  148. package/dist/orchestration/renewal.d.ts +76 -0
  149. package/dist/orchestration/renewal.d.ts.map +1 -0
  150. package/dist/orchestration/renewal.js +633 -0
  151. package/dist/orchestration/renewal.js.map +1 -0
  152. package/dist/orchestration/request.d.ts +53 -0
  153. package/dist/orchestration/request.d.ts.map +1 -0
  154. package/dist/orchestration/request.js +122 -0
  155. package/dist/orchestration/request.js.map +1 -0
  156. package/dist/orchestration/routing.d.ts +21 -0
  157. package/dist/orchestration/routing.d.ts.map +1 -0
  158. package/dist/orchestration/routing.js +90 -0
  159. package/dist/orchestration/routing.js.map +1 -0
  160. package/dist/orchestration/source-slot.d.ts +99 -0
  161. package/dist/orchestration/source-slot.d.ts.map +1 -0
  162. package/dist/orchestration/source-slot.js +206 -0
  163. package/dist/orchestration/source-slot.js.map +1 -0
  164. package/dist/orchestration/types.d.ts +334 -0
  165. package/dist/orchestration/types.d.ts.map +1 -0
  166. package/dist/orchestration/types.js +11 -0
  167. package/dist/orchestration/types.js.map +1 -0
  168. package/dist/protobuf.d.ts +63 -0
  169. package/dist/protobuf.d.ts.map +1 -0
  170. package/dist/protobuf.js +252 -0
  171. package/dist/protobuf.js.map +1 -0
  172. package/dist/session/_internal/acquire.d.ts +23 -0
  173. package/dist/session/_internal/acquire.d.ts.map +1 -0
  174. package/dist/session/_internal/acquire.js +167 -0
  175. package/dist/session/_internal/acquire.js.map +1 -0
  176. package/dist/session/_internal/cleanup.d.ts +18 -0
  177. package/dist/session/_internal/cleanup.d.ts.map +1 -0
  178. package/dist/session/_internal/cleanup.js +94 -0
  179. package/dist/session/_internal/cleanup.js.map +1 -0
  180. package/dist/session/_internal/lifecycle.d.ts +62 -0
  181. package/dist/session/_internal/lifecycle.d.ts.map +1 -0
  182. package/dist/session/_internal/lifecycle.js +132 -0
  183. package/dist/session/_internal/lifecycle.js.map +1 -0
  184. package/dist/session/_internal/remote.d.ts +28 -0
  185. package/dist/session/_internal/remote.d.ts.map +1 -0
  186. package/dist/session/_internal/remote.js +61 -0
  187. package/dist/session/_internal/remote.js.map +1 -0
  188. package/dist/session/_internal/uploads.d.ts +4 -0
  189. package/dist/session/_internal/uploads.d.ts.map +1 -0
  190. package/dist/session/_internal/uploads.js +33 -0
  191. package/dist/session/_internal/uploads.js.map +1 -0
  192. package/dist/session/commands.d.ts +22 -0
  193. package/dist/session/commands.d.ts.map +1 -0
  194. package/dist/session/commands.js +13 -0
  195. package/dist/session/commands.js.map +1 -0
  196. package/dist/session/files.d.ts +15 -0
  197. package/dist/session/files.d.ts.map +1 -0
  198. package/dist/session/files.js +54 -0
  199. package/dist/session/files.js.map +1 -0
  200. package/dist/session/index.d.ts +76 -0
  201. package/dist/session/index.d.ts.map +1 -0
  202. package/dist/session/index.js +16 -0
  203. package/dist/session/index.js.map +1 -0
  204. package/dist/session/media.d.ts +67 -0
  205. package/dist/session/media.d.ts.map +1 -0
  206. package/dist/session/media.js +2 -0
  207. package/dist/session/media.js.map +1 -0
  208. package/dist/session.d.ts +104 -0
  209. package/dist/session.d.ts.map +1 -0
  210. package/dist/session.js +872 -0
  211. package/dist/session.js.map +1 -0
  212. package/dist/simulation/_internal/source.d.ts +12 -0
  213. package/dist/simulation/_internal/source.d.ts.map +1 -0
  214. package/dist/simulation/_internal/source.js +477 -0
  215. package/dist/simulation/_internal/source.js.map +1 -0
  216. package/dist/simulation/index.d.ts +14 -0
  217. package/dist/simulation/index.d.ts.map +1 -0
  218. package/dist/simulation/index.js +13 -0
  219. package/dist/simulation/index.js.map +1 -0
  220. package/dist/simulation/types.d.ts +29 -0
  221. package/dist/simulation/types.d.ts.map +1 -0
  222. package/dist/simulation/types.js +2 -0
  223. package/dist/simulation/types.js.map +1 -0
  224. package/dist/stats.d.ts +33 -0
  225. package/dist/stats.d.ts.map +1 -0
  226. package/dist/stats.js +134 -0
  227. package/dist/stats.js.map +1 -0
  228. package/dist/testing/Faults.d.ts +4 -0
  229. package/dist/testing/Faults.d.ts.map +1 -0
  230. package/dist/testing/Faults.js +7 -0
  231. package/dist/testing/Faults.js.map +1 -0
  232. package/dist/testing/Png.d.ts +3 -0
  233. package/dist/testing/Png.d.ts.map +1 -0
  234. package/dist/testing/Png.js +68 -0
  235. package/dist/testing/Png.js.map +1 -0
  236. package/dist/testing/index.d.ts +3 -0
  237. package/dist/testing/index.d.ts.map +1 -0
  238. package/dist/testing/index.js +3 -0
  239. package/dist/testing/index.js.map +1 -0
  240. package/dist/wire.d.ts +7 -0
  241. package/dist/wire.d.ts.map +1 -0
  242. package/dist/wire.generated.d.ts +305 -0
  243. package/dist/wire.generated.d.ts.map +1 -0
  244. package/dist/wire.generated.js +1257 -0
  245. package/dist/wire.generated.js.map +1 -0
  246. package/dist/wire.js +5 -0
  247. package/dist/wire.js.map +1 -0
  248. package/notices/effect-LICENSE +21 -0
  249. package/notices/google-protobuf-LICENSE +32 -0
  250. package/notices/owned-webrtc/Effect-MIT.txt +21 -0
  251. package/notices/owned-webrtc/IETF.txt +43 -0
  252. package/notices/owned-webrtc/LICENSE +21 -0
  253. package/notices/owned-webrtc/UPSTREAM.md +20 -0
  254. package/notices/owned-webrtc/VP8-ADAPTATION.md +32 -0
  255. package/notices/owned-webrtc/VP8-AUTHORS.txt +42 -0
  256. package/notices/owned-webrtc/VP8-LICENSE.txt +25 -0
  257. package/notices/owned-webrtc/VP8-PATENTS.txt +21 -0
  258. package/notices/owned-webrtc/Werift-MIT.txt +21 -0
  259. package/notices/owned-webrtc/libvpx-v1.12.0-LICENSE.txt +28 -0
  260. package/notices/owned-webrtc/libvpx-v1.12.0-PATENTS.txt +22 -0
  261. package/notices/owned-webrtc/rfc3711.txt +3139 -0
  262. package/notices/owned-webrtc/str0m-MIT.txt +7 -0
  263. package/notices/owned-webrtc-LICENSE +21 -0
  264. package/notices/reactor-runtime-LICENSE +201 -0
  265. package/notices/reactor-runtime-NOTICE +5 -0
  266. package/notices/reactor-sdk-LICENSE +201 -0
  267. package/package.json +62 -4
@@ -0,0 +1,173 @@
1
+ import type * as Effect from "effect/Effect";
2
+ import type * as Result from "effect/Result";
3
+ import type * as Scope from "effect/Scope";
4
+ import type * as Stream from "effect/Stream";
5
+ import type { ReactorError } from "../errors.js";
6
+ import type { CommandFailure, CommandReply, SessionEvent } from "../session/index.js";
7
+ import type { Submission } from "../Submission.js";
8
+ import type { UploadReference } from "../wire.generated.js";
9
+ import type { Clip, DecodedMessage, Message, MessageType, Payload, Queue, State } from "./messages.js";
10
+ import type { CanvasAspect, documentedVersion, imageMimeTypes, modelName } from "./profile.js";
11
+ export type Aspect = CanvasAspect;
12
+ export type Reference = {
13
+ readonly _tag: "Bytes";
14
+ readonly bytes: Uint8Array;
15
+ } | {
16
+ readonly _tag: "Uploaded";
17
+ readonly file: UploadReference;
18
+ };
19
+ declare const validatedReference: unique symbol;
20
+ /** Opaque validated input. Byte storage is private and detached from the caller. */
21
+ export interface ValidatedReference {
22
+ readonly [validatedReference]: true;
23
+ readonly _tag: "ValidatedReference";
24
+ readonly mimeType: (typeof imageMimeTypes)[number];
25
+ readonly size: number;
26
+ readonly width: number | null;
27
+ readonly height: number | null;
28
+ }
29
+ export interface Request {
30
+ readonly prompt: string;
31
+ readonly references?: readonly (Reference | ValidatedReference)[];
32
+ readonly seconds?: number;
33
+ readonly seed?: number;
34
+ readonly position?: number;
35
+ readonly continueFrom?: string;
36
+ /** User metadata is a provider string. Local acceptance wraps and preserves it. */
37
+ readonly metadata?: string;
38
+ }
39
+ export interface Contract {
40
+ readonly modelName: typeof modelName;
41
+ readonly documentedVersion: typeof documentedVersion;
42
+ readonly source: string;
43
+ readonly subset: "prompt-and-images";
44
+ readonly deployment: {
45
+ readonly title: string | null;
46
+ readonly version: string | null;
47
+ };
48
+ }
49
+ export interface Facts {
50
+ readonly state: State;
51
+ readonly queue: Queue;
52
+ }
53
+ export interface ClipObservation {
54
+ readonly clip: Clip;
55
+ /** Last explicit clip lifecycle event; null means only a queue snapshot listed it. */
56
+ readonly lifecycle: Exclude<MessageType, "queue_update" | "state_update"> | null;
57
+ readonly source: CommandReply;
58
+ }
59
+ interface SnapshotBase {
60
+ readonly sessionId: string;
61
+ readonly transportGeneration: bigint;
62
+ readonly revision: bigint;
63
+ readonly clips: readonly ClipObservation[];
64
+ }
65
+ export type ProviderSnapshot = SnapshotBase & ({
66
+ readonly _tag: "Synchronizing";
67
+ readonly lastFacts: Facts | null;
68
+ } | {
69
+ readonly _tag: "Ready";
70
+ readonly state: State;
71
+ readonly queue: Queue;
72
+ } | {
73
+ readonly _tag: "Unavailable";
74
+ readonly cause: ReactorError;
75
+ readonly lastFacts: Facts | null;
76
+ });
77
+ export interface Acceptance {
78
+ readonly submissionId: string;
79
+ readonly clip: Clip;
80
+ readonly evidence: {
81
+ readonly kind: "correlated" | "metadata";
82
+ readonly source: CommandReply;
83
+ };
84
+ }
85
+ export interface Reply<K extends MessageType> {
86
+ readonly value: Payload<K>;
87
+ readonly source: CommandReply;
88
+ }
89
+ /** An ACK establishes command receipt, never an invented model payload. */
90
+ export type ControlResult = {
91
+ readonly _tag: "Acknowledged";
92
+ readonly source: CommandReply;
93
+ } | {
94
+ readonly _tag: "Reply";
95
+ readonly message: Message;
96
+ readonly source: CommandReply;
97
+ };
98
+ export type ProviderEvent = {
99
+ readonly _tag: "Message";
100
+ readonly message: DecodedMessage;
101
+ readonly source: CommandReply;
102
+ readonly disposition: "applied" | "duplicate" | "stale";
103
+ } | {
104
+ readonly _tag: "Acknowledged";
105
+ readonly source: CommandReply;
106
+ } | {
107
+ readonly _tag: "Acceptance";
108
+ readonly acceptance: Acceptance;
109
+ } | {
110
+ readonly _tag: "Session";
111
+ readonly source: Exclude<SessionEvent, CommandReply>;
112
+ } | {
113
+ readonly _tag: "Diagnostic";
114
+ readonly error: ReactorError;
115
+ readonly source?: SessionEvent;
116
+ };
117
+ export interface ObservationOptions {
118
+ readonly capacity?: number;
119
+ readonly maxBytes?: number;
120
+ }
121
+ export interface ProviderObservation {
122
+ readonly initial: ProviderSnapshot;
123
+ readonly revision: bigint;
124
+ readonly events: Stream.Stream<ProviderEvent, ReactorError>;
125
+ }
126
+ export interface PrepareHooks {
127
+ readonly commit?: (submissionId: string) => Effect.Effect<void, CommandFailure>;
128
+ /** A post-commit observer. Failure is diagnostic and cannot rewrite remote evidence. */
129
+ readonly result?: (submissionId: string, result: Result.Result<Acceptance, CommandFailure>) => Effect.Effect<void>;
130
+ }
131
+ export interface Options {
132
+ readonly commandTimeoutMs?: number;
133
+ readonly setupTimeoutMs?: number;
134
+ readonly reconcileWindowMs?: number;
135
+ readonly resultHookTimeoutMs?: number;
136
+ readonly maxPending?: number;
137
+ readonly maxTrackedClips?: number;
138
+ readonly maxAcceptances?: number;
139
+ readonly maxCachedUploads?: number;
140
+ readonly maxRetainedBytes?: number;
141
+ readonly maxPromptBytes?: number;
142
+ readonly observation?: ObservationOptions;
143
+ }
144
+ export interface Provider {
145
+ readonly sessionId: string;
146
+ readonly contract: Contract;
147
+ readonly current: Effect.Effect<ProviderSnapshot>;
148
+ readonly observe: (options?: ObservationOptions) => Effect.Effect<ProviderObservation, ReactorError, Scope.Scope>;
149
+ readonly events: (options?: ObservationOptions) => Stream.Stream<ProviderEvent, ReactorError>;
150
+ readonly failure: Effect.Effect<ReactorError>;
151
+ /** Local annotations are separate from the provider's authoritative state. */
152
+ readonly acceptances: Effect.Effect<readonly Acceptance[]>;
153
+ readonly acceptance: (submissionId: string) => Effect.Effect<Acceptance | undefined>;
154
+ readonly prepare: (request: Request, hooks?: PrepareHooks) => Effect.Effect<Submission<Acceptance, CommandFailure>, ReactorError>;
155
+ /** Host IO belongs to the same provisional scope and commit owner as static preparation. */
156
+ readonly prepareFrom: (preparation: Effect.Effect<Request, ReactorError, Scope.Scope>, hooks?: PrepareHooks) => Effect.Effect<Submission<Acceptance, CommandFailure>, ReactorError>;
157
+ readonly enqueue: (request: Request) => Effect.Effect<Acceptance, CommandFailure>;
158
+ readonly getState: Effect.Effect<Reply<"state_update">, CommandFailure>;
159
+ readonly getQueue: Effect.Effect<Reply<"queue_update">, CommandFailure>;
160
+ readonly refresh: Effect.Effect<void, CommandFailure>;
161
+ readonly pop: (clipId: string) => Effect.Effect<Reply<"clip_popped">, CommandFailure>;
162
+ readonly move: (clipId: string, position: number) => Effect.Effect<Reply<"clip_moved">, CommandFailure>;
163
+ readonly play: (clipId?: string) => Effect.Effect<ControlResult, CommandFailure>;
164
+ readonly stop: Effect.Effect<ControlResult, CommandFailure>;
165
+ readonly setSeed: (seed: number) => Effect.Effect<Reply<"seed_accepted">, CommandFailure>;
166
+ readonly setClipSeconds: (seconds: number) => Effect.Effect<Reply<"clip_length_accepted">, CommandFailure>;
167
+ readonly setCanvas: (aspect: Aspect) => Effect.Effect<Reply<"canvas_accepted">, CommandFailure>;
168
+ readonly setAutoplay: (enabled: boolean) => Effect.Effect<Reply<"autoplay_accepted">, CommandFailure>;
169
+ readonly setFlushOnClipEnd: (enabled: boolean) => Effect.Effect<Reply<"flush_accepted">, CommandFailure>;
170
+ readonly reset: Effect.Effect<Reply<"session_reset">, CommandFailure>;
171
+ }
172
+ export {};
173
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/h3/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,OAAO,EACP,WAAW,EACX,OAAO,EACP,KAAK,EACL,KAAK,EACN,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/F,MAAM,MAAM,MAAM,GAAG,YAAY,CAAC;AAClC,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAElE,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CA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B,CAAC,EAAE,cAAc,CAAC,CAAC;IAChG,QAAQ,CAAC,WAAW,EAAE,CACpB,OAAO,EAAE,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC,CAAC;IAC/D,QAAQ,CAAC,iBAAiB,EAAE,CAC1B,OAAO,EAAE,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC,CAAC;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC,CAAC;CACvE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/h3/types.ts"],"names":[],"mappings":""}
package/dist/host.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Host transport extension surface.
3
+ *
4
+ * reactor-effect-browser and reactor-effect-native implement the peer contract
5
+ * and project a connected session's media generations through this module. It
6
+ * is published for those first-party host packages, which pin this exact
7
+ * version, and is not part of the application-facing contract: applications
8
+ * compose hosts through their packages and read media through their `media`
9
+ * functions. Nothing here allocates or owns a session.
10
+ */
11
+ export { errorOf, positiveLimit } from "./errors.js";
12
+ export { finite, isRecord, record } from "./json.js";
13
+ export { fromOwnedReadableStream } from "./media-stream.js";
14
+ export { terminal } from "./contract.js";
15
+ export type { IceCandidate, IceServer } from "./contract.js";
16
+ export { Observations } from "./observation.js";
17
+ export type { ObservationOptions } from "./observation.js";
18
+ export { CoordinatorClient } from "./coordinator/_internal/client.js";
19
+ export { retryAfterMs } from "./coordinator/_internal/response.js";
20
+ export { mediaGeneration, trackGeneration } from "./session/_internal/acquire.js";
21
+ export type { Channel, MediaTrack, Peer, PeerEvent, PeerState, Prepared } from "./PeerTypes.js";
22
+ export type { AudioFrame, MediaGeneration, MediaPressure, RawMedia, TrackGeneration, VideoFrame, } from "./session/media.js";
23
+ export { readFileBytes, uploadFile } from "./session/files.js";
24
+ export type { FileUploadOptions } from "./session/files.js";
25
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAClF,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAChG,YAAY,EACV,UAAU,EACV,eAAe,EACf,aAAa,EACb,QAAQ,EACR,eAAe,EACf,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/host.js ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Host transport extension surface.
3
+ *
4
+ * reactor-effect-browser and reactor-effect-native implement the peer contract
5
+ * and project a connected session's media generations through this module. It
6
+ * is published for those first-party host packages, which pin this exact
7
+ * version, and is not part of the application-facing contract: applications
8
+ * compose hosts through their packages and read media through their `media`
9
+ * functions. Nothing here allocates or owns a session.
10
+ */
11
+ export { errorOf, positiveLimit } from "./errors.js";
12
+ export { finite, isRecord, record } from "./json.js";
13
+ export { fromOwnedReadableStream } from "./media-stream.js";
14
+ export { terminal } from "./contract.js";
15
+ export { Observations } from "./observation.js";
16
+ export { CoordinatorClient } from "./coordinator/_internal/client.js";
17
+ export { retryAfterMs } from "./coordinator/_internal/response.js";
18
+ export { mediaGeneration, trackGeneration } from "./session/_internal/acquire.js";
19
+ export { readFileBytes, uploadFile } from "./session/files.js";
20
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAUlF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** Portable entry point: importing it does not select or load a native/browser peer. */
2
+ export { Client, make, layer, AcquisitionFailure, CommandFailure } from "./session/index.js";
3
+ export type { Factory, Configuration, CreateOptions, AttachOptions, Session, } from "./session/index.js";
4
+ export * as Coordinator from "./coordinator/index.js";
5
+ export * as Peers from "./PeerFactory.js";
6
+ export * as FetchHttp from "./FetchHttp.js";
7
+ export { ReactorError, ErrorCode, ErrorContext, ProviderFailure } from "./errors.js";
8
+ export type { RemoteOutcome } from "./errors.js";
9
+ export { PeerFactory } from "./PeerFactory.js";
10
+ export type { PeerFactoryShape } from "./PeerFactory.js";
11
+ export type { SessionEvent, Snapshot, ReadyState, Status, CommandReply, CloseReport, Uploaded, UploadProgress, } from "./SessionTypes.js";
12
+ export type { HttpOptions, Termination } from "./coordinator/_internal/client.js";
13
+ export type { CommandContext } from "./session/commands.js";
14
+ export type { Statistics } from "./stats.js";
15
+ export type { Json, JsonObject } from "./json.js";
16
+ export type { Capabilities, Descriptor, Track, Mapping } from "./contract.js";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC7F,YAAY,EACV,OAAO,EACP,aAAa,EACb,aAAa,EACb,aAAa,EACb,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrF,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,MAAM,EACN,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAClF,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /** Portable entry point: importing it does not select or load a native/browser peer. */
2
+ export { Client, make, layer, AcquisitionFailure, CommandFailure } from "./session/index.js";
3
+ export * as Coordinator from "./coordinator/index.js";
4
+ export * as Peers from "./PeerFactory.js";
5
+ export * as FetchHttp from "./FetchHttp.js";
6
+ export { ReactorError, ErrorCode, ErrorContext, ProviderFailure } from "./errors.js";
7
+ export { PeerFactory } from "./PeerFactory.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAQ7F,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/json.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import type { Google_Struct } from "./wire.generated.js";
2
+ export type Json = null | boolean | number | string | JsonObject | readonly Json[];
3
+ export interface JsonObject {
4
+ readonly [key: string]: Json;
5
+ }
6
+ export declare const isRecord: (u: unknown) => u is Record<string, unknown>;
7
+ export declare const record: (u: unknown, context?: string) => Record<string, unknown>;
8
+ export declare const string: (u: unknown, context: string, max?: number) => string;
9
+ export declare const nonempty: (u: unknown, context: string) => string;
10
+ export declare const finite: (u: unknown, context: string) => number;
11
+ export declare const uint32: (u: unknown, context: string) => number;
12
+ export declare const array: (u: unknown, context: string) => readonly unknown[];
13
+ /** Validates, copies, and freezes finite JSON; never coerces undefined, cycles, Dates or accessors. */
14
+ export declare const json: (input: unknown, maximumNodes?: number) => Json;
15
+ export declare const jsonObject: (input: unknown) => JsonObject;
16
+ export declare const structFromObject: (input: unknown) => Google_Struct;
17
+ export declare const objectFromStruct: (s: Google_Struct, depth?: number) => JsonObject;
18
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,qBAAqB,CAAC;AACvE,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,IAAI,EAAE,CAAC;AACnF,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AACD,eAAO,MAAM,QAAQ,MAAO,OAAO,KAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACP,CAAC;AAI3D,eAAO,MAAM,MAAM,MAAO,OAAO,uBAAuB,MAAM,CAAC,MAAM,EAAE,OAAO,CAChC,CAAC;AAC/C,eAAO,MAAM,MAAM,MAAO,OAAO,WAAW,MAAM,mBAAoB,MACc,CAAC;AACrF,eAAO,MAAM,QAAQ,MAAO,OAAO,WAAW,MAAM,KAAG,MAGtD,CAAC;AACF,eAAO,MAAM,MAAM,MAAO,OAAO,WAAW,MAAM,KAAG,MACwC,CAAC;AAC9F,eAAO,MAAM,MAAM,MAAO,OAAO,WAAW,MAAM,KAAG,MAGpD,CAAC;AACF,eAAO,MAAM,KAAK,MAAO,OAAO,WAAW,MAAM,KAAG,SAAS,OAAO,EACV,CAAC;AAE3D,uGAAuG;AACvG,eAAO,MAAM,IAAI,UAAW,OAAO,4BAA0B,IAqC5D,CAAC;AAGF,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,UAG3C,CAAC;AAUF,eAAO,MAAM,gBAAgB,UAAW,OAAO,KAAG,aAKjD,CAAC;AAsBF,eAAO,MAAM,gBAAgB,MAAO,aAAa,qBAAc,UAM9D,CAAC"}
package/dist/json.js ADDED
@@ -0,0 +1,123 @@
1
+ import { ReactorError } from "./errors.js";
2
+ import { checkedString } from "./protobuf.js";
3
+ export const isRecord = (u) => typeof u === "object" && u !== null && !Array.isArray(u);
4
+ const bad = (message) => {
5
+ throw new ReactorError("Protocol", message);
6
+ };
7
+ export const record = (u, context = "object") => isRecord(u) ? u : bad(`expected ${context}`);
8
+ export const string = (u, context, max = 1_048_576) => typeof u === "string" ? checkedString(u, max) : bad(`expected string: ${context}`);
9
+ export const nonempty = (u, context) => {
10
+ const s = string(u, context);
11
+ return s.length ? s : bad(`empty ${context}`);
12
+ };
13
+ export const finite = (u, context) => typeof u === "number" && Number.isFinite(u) ? u : bad(`expected finite number: ${context}`);
14
+ export const uint32 = (u, context) => {
15
+ const n = finite(u, context);
16
+ return Number.isInteger(n) && n >= 0 && n <= 0xffffffff ? n : bad(`expected uint32: ${context}`);
17
+ };
18
+ export const array = (u, context) => Array.isArray(u) ? u : bad(`expected array: ${context}`);
19
+ /** Validates, copies, and freezes finite JSON; never coerces undefined, cycles, Dates or accessors. */
20
+ export const json = (input, maximumNodes = 65_536) => {
21
+ const ancestors = new Set();
22
+ let nodes = 0, chars = 0;
23
+ const visit = (u, depth) => {
24
+ if (++nodes > maximumNodes || depth > 64)
25
+ return bad("JSON node/depth limit");
26
+ if (u === null || typeof u === "boolean")
27
+ return u;
28
+ if (typeof u === "number")
29
+ return finite(u, "JSON number");
30
+ if (typeof u === "string") {
31
+ chars += u.length;
32
+ if (chars > 4_194_304)
33
+ return bad("JSON text limit");
34
+ return checkedString(u, 4_194_304);
35
+ }
36
+ if (typeof u !== "object")
37
+ return bad("not a JSON value");
38
+ if (ancestors.has(u))
39
+ return bad("cyclic JSON");
40
+ ancestors.add(u);
41
+ try {
42
+ if (Array.isArray(u))
43
+ return Object.freeze(u.map((v) => visit(v, depth + 1)));
44
+ const proto = Object.getPrototypeOf(u);
45
+ if (proto !== Object.prototype && proto !== null)
46
+ return bad("JSON object must have a plain prototype");
47
+ if (Object.getOwnPropertySymbols(u).length)
48
+ return bad("symbol keys are not JSON");
49
+ const result = {};
50
+ for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(u))) {
51
+ if (!descriptor.enumerable)
52
+ continue;
53
+ if (!("value" in descriptor))
54
+ return bad("JSON accessors are not supported");
55
+ chars += key.length;
56
+ checkedString(key, 4_194_304);
57
+ const value = descriptor.value;
58
+ Object.defineProperty(result, key, { value: visit(value, depth + 1), enumerable: true });
59
+ }
60
+ return Object.freeze(result);
61
+ }
62
+ finally {
63
+ ancestors.delete(u);
64
+ }
65
+ };
66
+ return visit(input, 0);
67
+ };
68
+ const isJsonObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
69
+ export const jsonObject = (input) => {
70
+ const value = json(input);
71
+ return isJsonObject(value) ? value : bad("command data must be a top-level JSON object");
72
+ };
73
+ const valueFromJson = (value) => {
74
+ if (value === null)
75
+ return { kind: { case: "null_value", value: 0 } };
76
+ if (typeof value === "boolean")
77
+ return { kind: { case: "bool_value", value } };
78
+ if (typeof value === "number")
79
+ return { kind: { case: "number_value", value } };
80
+ if (typeof value === "string")
81
+ return { kind: { case: "string_value", value } };
82
+ if (Array.isArray(value))
83
+ return { kind: { case: "list_value", value: { values: value.map(valueFromJson) } } };
84
+ return { kind: { case: "struct_value", value: structFromObject(value) } };
85
+ };
86
+ export const structFromObject = (input) => {
87
+ const data = jsonObject(input), fields = new Map();
88
+ for (const [key, value] of Object.entries(data))
89
+ fields.set(key, valueFromJson(value));
90
+ return { fields };
91
+ };
92
+ /** Upstream Struct conversion maps unset/unknown Value kinds and nonfinite doubles to null.
93
+ * The raw generated codecs preserve those distinctions; use them when JSON is insufficient.
94
+ */
95
+ const valueToJson = (value, depth) => {
96
+ if (depth > 64)
97
+ return bad("Struct depth limit");
98
+ const kind = value.kind;
99
+ if (kind === undefined)
100
+ return null;
101
+ switch (kind.case) {
102
+ case "null_value":
103
+ return null;
104
+ case "number_value":
105
+ return Number.isFinite(kind.value) ? kind.value : null;
106
+ case "string_value":
107
+ case "bool_value":
108
+ return kind.value;
109
+ case "struct_value":
110
+ return objectFromStruct(kind.value, depth + 1);
111
+ case "list_value":
112
+ return Object.freeze(kind.value.values.map((v) => valueToJson(v, depth + 1)));
113
+ }
114
+ };
115
+ export const objectFromStruct = (s, depth = 0) => {
116
+ if (depth > 64)
117
+ return bad("Struct depth limit");
118
+ const result = {};
119
+ for (const [key, value] of s.fields)
120
+ Object.defineProperty(result, key, { value: valueToJson(value, depth + 1), enumerable: true });
121
+ return Object.freeze(result);
122
+ };
123
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAM9C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CACnE,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC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AAK,cAAc,CAAC;QACpB,KAAK,YAAY;YACf,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,KAAK,cAAc;YACjB,OAAO,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACjD,KAAK,YAAY;YACf,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAgB,EAAE,KAAK,GAAG,CAAC,EAAc,EAAE;IAC1E,IAAI,KAAK,GAAG,EAAE;QAAE,OAAO,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACjD,MAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM;QACjC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IACjG,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import * as Stream from "effect/Stream";
2
+ import type { ReactorError } from "./errors.js";
3
+ /** Catch acquisition failures in the typed channel and own both cancel AND releaseLock.
4
+ * In pinned Effect, fromReadableStream's default finalizer cancels without releasing;
5
+ * releaseLockOnEnd instead releases without cancellation. Media needs both operations. */
6
+ export declare const fromOwnedReadableStream: <A>(options: {
7
+ readonly evaluate: () => ReadableStream<A>;
8
+ readonly onError: (error: unknown) => ReactorError;
9
+ }) => Stream.Stream<A, ReactorError>;
10
+ //# sourceMappingURL=media-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-stream.d.ts","sourceRoot":"","sources":["../src/media-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD;;0FAE0F;AAC1F,eAAO,MAAM,uBAAuB,GAAI,CAAC,WAAW;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,YAAY,CAAC;CACpD,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAsB9B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Stream from "effect/Stream";
3
+ /** Catch acquisition failures in the typed channel and own both cancel AND releaseLock.
4
+ * In pinned Effect, fromReadableStream's default finalizer cancels without releasing;
5
+ * releaseLockOnEnd instead releases without cancellation. Media needs both operations. */
6
+ export const fromOwnedReadableStream = (options) => Stream.unwrap(Effect.gen(function* () {
7
+ const reader = yield* Effect.acquireRelease(Effect.try({ try: () => options.evaluate().getReader(), catch: options.onError }), (reader) => Effect.promise(async () => {
8
+ try {
9
+ await reader.cancel();
10
+ }
11
+ catch {
12
+ /* Underlying media finalizer still runs on stream error. */
13
+ }
14
+ finally {
15
+ reader.releaseLock();
16
+ }
17
+ }));
18
+ return Stream.unfold(undefined, () => Effect.tryPromise({ try: () => reader.read(), catch: options.onError }).pipe(Effect.map((next) => (next.done ? undefined : [next.value, undefined]))));
19
+ }));
20
+ //# sourceMappingURL=media-stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-stream.js","sourceRoot":"","sources":["../src/media-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;0FAE0F;AAC1F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAI,OAG1C,EAAkC,EAAE,CACnC,MAAM,CAAC,MAAM,CACX,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CACzC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,EACjF,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;QACxB,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,4DAA4D;QAC9D,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CACL,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CACnC,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAC1E,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAW,CAAC,CAAC,CACnF,CACF,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
@@ -0,0 +1,26 @@
1
+ import * as Effect from "effect/Effect";
2
+ import type * as Scope from "effect/Scope";
3
+ import * as Stream from "effect/Stream";
4
+ import { ReactorError } from "./errors.js";
5
+ export interface ObservationOptions {
6
+ readonly capacity?: number;
7
+ readonly maxBytes?: number;
8
+ }
9
+ /** Slow observation never blocks protocol correlation or silently drops lifecycle events. */
10
+ export declare class Observations<A> {
11
+ private readonly maxSubscribers;
12
+ private readonly subscribers;
13
+ private closed;
14
+ private failure;
15
+ overflowCount: bigint;
16
+ constructor(maxSubscribers?: number);
17
+ get size(): number;
18
+ /** Acquire before reading a snapshot, then ignore queued revisions covered by that snapshot. */
19
+ subscribe(options?: ObservationOptions): Effect.Effect<Stream.Stream<A, ReactorError>, ReactorError, Scope.Scope>;
20
+ stream(options?: ObservationOptions): Stream.Stream<A, ReactorError>;
21
+ emit(value: A, bytes?: number): void;
22
+ end(): void;
23
+ /** Source failure belongs to each reader, including a later subscription. */
24
+ fail(error: ReactorError): void;
25
+ }
26
+ //# sourceMappingURL=observation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAA0B,YAAY,EAAE,MAAM,aAAa,CAAC;AAYnE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,6FAA6F;AAC7F,qBAAa,YAAY,CAAC,CAAC;IAMb,OAAO,CAAC,QAAQ,CAAC,cAAc;IAL3C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAA2B;IAC1C,aAAa,SAAM;IAEnB,YAA6B,cAAc,SAAK,EAE/C;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,gGAAgG;IAChG,SAAS,CACP,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAwE1E;IAED,MAAM,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,CAEnE;IAED,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,SAAM,GAAG,IAAI,CAoBhC;IAED,GAAG,IAAI,IAAI,CAKV;IAED,6EAA6E;IAC7E,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAO9B;CACF"}
@@ -0,0 +1,106 @@
1
+ import * as Cause from "effect/Cause";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Queue from "effect/Queue";
4
+ import * as Stream from "effect/Stream";
5
+ import { errorOf, positiveLimit, ReactorError } from "./errors.js";
6
+ /** Slow observation never blocks protocol correlation or silently drops lifecycle events. */
7
+ export class Observations {
8
+ maxSubscribers;
9
+ subscribers = new Set();
10
+ closed = false;
11
+ failure;
12
+ overflowCount = 0n;
13
+ constructor(maxSubscribers = 64) {
14
+ this.maxSubscribers = maxSubscribers;
15
+ positiveLimit(maxSubscribers, "observer count", 4096);
16
+ }
17
+ get size() {
18
+ return this.subscribers.size;
19
+ }
20
+ /** Acquire before reading a snapshot, then ignore queued revisions covered by that snapshot. */
21
+ subscribe(options = {}) {
22
+ const observations = this;
23
+ return Effect.gen(function* () {
24
+ const bounds = yield* Effect.try({
25
+ try: () => ({
26
+ capacity: positiveLimit(options.capacity ?? 64, "observation capacity", 4096),
27
+ maxBytes: positiveLimit(options.maxBytes ?? 1_048_576, "observation bytes", 64 * 1024 * 1024),
28
+ }),
29
+ catch: errorOf,
30
+ });
31
+ const subscriber = yield* Effect.acquireRelease(Effect.gen(function* () {
32
+ if (observations.subscribers.size >= observations.maxSubscribers) {
33
+ return yield* Effect.fail(new ReactorError("Overflow", "observer count bound reached", {
34
+ outcome: "not-submitted",
35
+ }));
36
+ }
37
+ const queue = yield* Queue.dropping(bounds.capacity);
38
+ const subscriber = { queue, maxBytes: bounds.maxBytes, bufferedBytes: 0 };
39
+ if (observations.failure !== undefined)
40
+ Queue.failCauseUnsafe(queue, Cause.fail(observations.failure));
41
+ else if (observations.closed)
42
+ Queue.endUnsafe(queue);
43
+ else
44
+ observations.subscribers.add(subscriber);
45
+ return subscriber;
46
+ }), (subscriber) => Effect.gen(function* () {
47
+ observations.subscribers.delete(subscriber);
48
+ subscriber.bufferedBytes = 0;
49
+ yield* Queue.shutdown(subscriber.queue);
50
+ }));
51
+ let reading = false;
52
+ return Stream.unwrap(Effect.gen(function* () {
53
+ yield* Effect.acquireRelease(Effect.try({
54
+ try: () => {
55
+ if (reading)
56
+ throw new ReactorError("AlreadyReading", "this observation already has an active reader");
57
+ reading = true;
58
+ },
59
+ catch: errorOf,
60
+ }), () => Effect.sync(() => {
61
+ reading = false;
62
+ }));
63
+ return Stream.fromEffectRepeat(Effect.uninterruptibleMask((restore) => restore(Queue.take(subscriber.queue)).pipe(Effect.map((entry) => {
64
+ subscriber.bufferedBytes -= entry.bytes;
65
+ return entry.value;
66
+ }))));
67
+ }));
68
+ });
69
+ }
70
+ stream(options) {
71
+ return Stream.unwrap(this.subscribe(options));
72
+ }
73
+ emit(value, bytes = 256) {
74
+ if (this.closed)
75
+ return;
76
+ for (const subscriber of this.subscribers) {
77
+ if (bytes > subscriber.maxBytes - subscriber.bufferedBytes ||
78
+ !Queue.offerUnsafe(subscriber.queue, { value, bytes })) {
79
+ this.overflowCount++;
80
+ Queue.failCauseUnsafe(subscriber.queue, Cause.fail(new ReactorError("Overflow", "observation bound exceeded; acquire a new observation and snapshot")));
81
+ this.subscribers.delete(subscriber);
82
+ }
83
+ else
84
+ subscriber.bufferedBytes += bytes;
85
+ }
86
+ }
87
+ end() {
88
+ if (this.closed)
89
+ return;
90
+ this.closed = true;
91
+ for (const subscriber of this.subscribers)
92
+ Queue.endUnsafe(subscriber.queue);
93
+ this.subscribers.clear();
94
+ }
95
+ /** Source failure belongs to each reader, including a later subscription. */
96
+ fail(error) {
97
+ if (this.closed)
98
+ return;
99
+ this.failure = error;
100
+ this.closed = true;
101
+ for (const subscriber of this.subscribers)
102
+ Queue.failCauseUnsafe(subscriber.queue, Cause.fail(error));
103
+ this.subscribers.clear();
104
+ }
105
+ }
106
+ //# sourceMappingURL=observation.js.map