Open History to see the last commit
1import { EnvironmentId } from "@t3tools/contracts";
2import * as Context from "effect/Context";
3import * as Effect from "effect/Effect";
4import * as Equal from "effect/Equal";
5import * as Exit from "effect/Exit";
6import * as Layer from "effect/Layer";
7import * as Option from "effect/Option";
8import * as Ref from "effect/Ref";
9import * as Schema from "effect/Schema";
10import * as Scope from "effect/Scope";
11import * as Semaphore from "effect/Semaphore";
12import * as Stream from "effect/Stream";
13import * as SubscriptionRef from "effect/SubscriptionRef";
14
15import * as ClientCapabilities from "../platform/capabilities.ts";
16import {
17 type ConnectionCatalogEntry,
18 type ConnectionRegistration,
19 type PlatformConnectionRegistration,
20 type PrimaryConnectionRegistration,
21 SshConnectionProfile,
22 connectionRegistrationCatalogEntry,
23} from "./catalog.ts";
24import * as ConnectionCredentialStore from "./credentialStore.ts";
25import * as ConnectionProfileStore from "./profileStore.ts";
26import * as Connectivity from "./connectivity.ts";
27import type {
28 ConnectionAttemptError,
29 ConnectionTarget,
30 NetworkStatus,
31 SupervisorConnectionState,
32} from "./model.ts";
33import * as Persistence from "../platform/persistence.ts";
34import * as EnvironmentSupervisor from "./supervisor.ts";
35import * as ConnectionDriver from "./driver.ts";
36import * as ConnectionWakeups from "./wakeups.ts";
37
38const isSshConnectionProfile = Schema.is(SshConnectionProfile);
39
40export class EnvironmentNotRegisteredError extends Schema.TaggedError<EnvironmentNotRegisteredError>()(
41 "EnvironmentNotRegisteredError",
42 {
43 environmentId: EnvironmentId,
44 },
45) {
46 override get message(): string {
47 return `Environment ${this.environmentId} is not registered.`;
48 }
49}
50
51export class PlatformEnvironmentRemovalError extends Schema.TaggedError<PlatformEnvironmentRemovalError>()(
52 "PlatformEnvironmentRemovalError",
53 {
54 environmentId: EnvironmentId,
55 },
56) {
57 override get message(): string {
58 return `Platform-managed environment ${this.environmentId} cannot be removed.`;
59 }
60}
61
62export class EnvironmentRegistry extends Context.Service<
63 EnvironmentRegistry,
64 {
65 readonly entries: SubscriptionRef.SubscriptionRef<
66 ReadonlyMap<EnvironmentId, ConnectionCatalogEntry>
67 >;
68 readonly networkStatus: SubscriptionRef.SubscriptionRef<NetworkStatus>;
69 readonly start: Effect.Effect<void>;
70 readonly register: (
71 registration: ConnectionRegistration,
72 ) => Effect.Effect<void, Persistence.ConnectionPersistenceError>;
73 readonly registerPlatform: (registration: PrimaryConnectionRegistration) => Effect.Effect<void>;
74 readonly reconcilePlatform: (
75 registrations: ReadonlyArray<PlatformConnectionRegistration>,
76 ) => Effect.Effect<void>;
77 readonly remove: (
78 environmentId: EnvironmentId,
79 ) => Effect.Effect<
80 void,
81 | Persistence.ConnectionPersistenceError
82 | ConnectionAttemptError
83 | EnvironmentNotRegisteredError
84 | PlatformEnvironmentRemovalError
85 >;
86 readonly removeRelayEnvironments: () => Effect.Effect<
87 void,
88 | Persistence.ConnectionPersistenceError
89 | ConnectionAttemptError
90 | PlatformEnvironmentRemovalError
91 >;
92 readonly retryNow: (environmentId: EnvironmentId) => Effect.Effect<void>;
93 readonly state: (
94 environmentId: EnvironmentId,
95 ) => Effect.Effect<SupervisorConnectionState, EnvironmentNotRegisteredError>;
96 readonly stateChanges: (
97 environmentId: EnvironmentId,
98 ) => Stream.Stream<SupervisorConnectionState, EnvironmentNotRegisteredError>;
99 readonly run: <A, E, R>(
100 environmentId: EnvironmentId,
101 effect: Effect.Effect<A, E, R>,
102 ) => Effect.Effect<
103 A,
104 E | EnvironmentNotRegisteredError,
105 Exclude<R, EnvironmentSupervisor.EnvironmentSupervisor>
106 >;
107 readonly runStream: <A, E, R>(
108 environmentId: EnvironmentId,
109 stream: Stream.Stream<A, E, R>,
110 ) => Stream.Stream<
111 A,
112 E | EnvironmentNotRegisteredError,
113 Exclude<R, EnvironmentSupervisor.EnvironmentSupervisor>
114 >;
115 readonly followStream: <A, E, R>(
116 environmentId: EnvironmentId,
117 stream: Stream.Stream<A, E, R>,
118 ) => Stream.Stream<A, E, Exclude<R, EnvironmentSupervisor.EnvironmentSupervisor>>;
119 }
120>()("@t3tools/client-runtime/connection/registry/EnvironmentRegistry") {}
121
122interface EnvironmentServiceScope {
123 readonly entry: ConnectionCatalogEntry;
124 readonly supervisor: EnvironmentSupervisor.EnvironmentSupervisor["Service"];
125 readonly scope: Scope.Closeable;
126}
127
128/** @public Service construction is part of the canonical Effect module API. */
129export const make = Effect.gen(function* () {
130 const registryScope = yield* Scope.Scope;
131 const storage = yield* Persistence.ConnectionTargetStore;
132 const registrations = yield* Persistence.ConnectionRegistrationStore;
133 const cache = yield* Persistence.EnvironmentCacheStore;
134 const ownedDataCleanup = yield* Persistence.EnvironmentOwnedDataCleanup;
135 const profiles = yield* ConnectionProfileStore.ConnectionProfileStore;
136 const credentials = yield* ConnectionCredentialStore.ConnectionCredentialStore;
137 const connectivity = yield* Connectivity.Connectivity;
138 const driver = yield* ConnectionDriver.ConnectionDriver;
139 const wakeups = yield* ConnectionWakeups.ConnectionWakeups;
140 const ssh = yield* ClientCapabilities.SshEnvironmentGateway;
141 const persistedTargets = yield* storage.list;
142 const initialEntries = new Map(
143 yield* Effect.forEach(
144 persistedTargets,
145 Effect.fn("EnvironmentRegistry.loadCatalogEntry")(function* (target) {
146 const profile =
147 target._tag === "BearerConnectionTarget" || target._tag === "SshConnectionTarget"
148 ? yield* profiles.get(target.connectionId)
149 : Option.none();
150 return [
151 target.environmentId,
152 { target, profile } satisfies ConnectionCatalogEntry,
153 ] as const;
154 }),
155 { concurrency: "unbounded" },
156 ),
157 );
158 const entries =
159 yield* SubscriptionRef.make<ReadonlyMap<EnvironmentId, ConnectionCatalogEntry>>(initialEntries);
160 const networkStatus = yield* SubscriptionRef.make(yield* connectivity.status);
161 const serviceScopes = yield* SubscriptionRef.make<
162 ReadonlyMap<EnvironmentId, EnvironmentServiceScope>
163 >(new Map());
164 const platformEnvironmentIds = yield* Ref.make<ReadonlySet<EnvironmentId>>(new Set());
165 const persistedTargetsByEnvironment = yield* Ref.make<
166 ReadonlyMap<EnvironmentId, ConnectionTarget>
167 >(new Map(persistedTargets.map((target) => [target.environmentId, target])));
168 interface LeaseLock {
169 readonly semaphore: Semaphore.Semaphore;
170 readonly users: number;
171 }
172
173 const leaseLocks = yield* Ref.make<ReadonlyMap<EnvironmentId, LeaseLock>>(new Map());
174 const leaseLocksGuard = yield* Semaphore.make(1);
175 const started = yield* Ref.make(false);
176
177 const withLeaseLock = <A, E, R>(
178 environmentId: EnvironmentId,
179 effect: Effect.Effect<A, E, R>,
180 ): Effect.Effect<A, E, R> =>
181 Effect.acquireUseRelease(
182 leaseLocksGuard.withPermits(1)(
183 Effect.gen(function* () {
184 const current = yield* Ref.get(leaseLocks);
185 const existing = current.get(environmentId);
186 if (existing !== undefined) {
187 yield* Ref.set(
188 leaseLocks,
189 new Map(current).set(environmentId, {
190 semaphore: existing.semaphore,
191 users: existing.users + 1,
192 }),
193 );
194 return existing.semaphore;
195 }
196 const semaphore = yield* Semaphore.make(1);
197 yield* Ref.set(leaseLocks, new Map(current).set(environmentId, { semaphore, users: 1 }));
198 return semaphore;
199 }),
200 ),
201 (semaphore) => semaphore.withPermits(1)(effect),
202 (semaphore) =>
203 leaseLocksGuard.withPermits(1)(
204 Ref.update(leaseLocks, (current) => {
205 const existing = current.get(environmentId);
206 if (existing === undefined || existing.semaphore !== semaphore) {
207 return current;
208 }
209 const next = new Map(current);
210 if (existing.users === 1) {
211 next.delete(environmentId);
212 } else {
213 next.set(environmentId, {
214 semaphore,
215 users: existing.users - 1,
216 });
217 }
218 return next;
219 }),
220 ),
221 ).pipe(Effect.withSpan("EnvironmentRegistry.withLeaseLock"));
222
223 const getEntry = Effect.fn("EnvironmentRegistry.getEntry")(function* (
224 environmentId: EnvironmentId,
225 ) {
226 const entry = (yield* SubscriptionRef.get(entries)).get(environmentId);
227 if (entry === undefined) {
228 return yield* new EnvironmentNotRegisteredError({
229 environmentId,
230 });
231 }
232 return entry;
233 });
234
235 const closeServiceScope = Effect.fn("EnvironmentRegistry.closeServiceScope")(function* (
236 environmentId: EnvironmentId,
237 ) {
238 const current = yield* SubscriptionRef.get(serviceScopes);
239 const lease = current.get(environmentId);
240 if (lease === undefined) {
241 return;
242 }
243 const next = new Map(current);
244 next.delete(environmentId);
245 yield* SubscriptionRef.set(serviceScopes, next);
246 yield* Scope.close(lease.scope, Exit.void);
247 });
248
249 const createServiceScope = Effect.fn("EnvironmentRegistry.createServiceScope")(
250 (entry: ConnectionCatalogEntry) =>
251 Effect.uninterruptible(
252 Effect.gen(function* () {
253 const environmentId = entry.target.environmentId;
254 const scope = yield* Scope.fork(registryScope);
255 const supervisor = yield* EnvironmentSupervisor.make(entry, {
256 initiallyDesired: false,
257 }).pipe(
258 Effect.provideService(Connectivity.Connectivity, connectivity),
259 Effect.provideService(ConnectionDriver.ConnectionDriver, driver),
260 Effect.provideService(ConnectionWakeups.ConnectionWakeups, wakeups),
261 Scope.provide(scope),
262 Effect.onError(() => Scope.close(scope, Exit.void)),
263 );
264 yield* supervisor.connect;
265 yield* SubscriptionRef.update(serviceScopes, (current) => {
266 const next = new Map(current);
267 next.set(environmentId, { entry, supervisor, scope });
268 return next;
269 });
270 return supervisor;
271 }),
272 ),
273 );
274
275 const acquireSupervisor = Effect.fn("EnvironmentRegistry.acquireSupervisor")(function* (
276 environmentId: EnvironmentId,
277 ) {
278 return yield* withLeaseLock(
279 environmentId,
280 Effect.gen(function* () {
281 const entry = yield* getEntry(environmentId);
282 const existing = (yield* SubscriptionRef.get(serviceScopes)).get(environmentId);
283 if (existing !== undefined) {
284 if (Equal.equals(existing.entry, entry)) {
285 return existing.supervisor;
286 }
287 yield* closeServiceScope(environmentId);
288 }
289 return yield* createServiceScope(entry);
290 }),
291 );
292 });
293
294 const run: EnvironmentRegistry["Service"]["run"] = Effect.fn("EnvironmentRegistry.run")(
295 function* <A, E, R>(environmentId: EnvironmentId, effect: Effect.Effect<A, E, R>) {
296 const supervisor = yield* acquireSupervisor(environmentId);
297 return yield* Effect.provideService(
298 effect,
299 EnvironmentSupervisor.EnvironmentSupervisor,
300 supervisor,
301 );
302 },
303 );
304
305 const runStream: EnvironmentRegistry["Service"]["runStream"] = <A, E, R>(
306 environmentId: EnvironmentId,
307 stream: Stream.Stream<A, E, R>,
308 ) =>
309 Stream.unwrap(
310 acquireSupervisor(environmentId).pipe(
311 Effect.map((supervisor) =>
312 Stream.provideService(stream, EnvironmentSupervisor.EnvironmentSupervisor, supervisor),
313 ),
314 ),
315 );
316
317 const followStream: EnvironmentRegistry["Service"]["followStream"] = <A, E, R>(
318 environmentId: EnvironmentId,
319 stream: Stream.Stream<A, E, R>,
320 ) =>
321 Stream.concat(
322 Stream.fromEffect(SubscriptionRef.get(entries)),
323 SubscriptionRef.changes(entries),
324 ).pipe(
325 Stream.map((current) => Option.fromUndefinedOr(current.get(environmentId))),
326 Stream.changes,
327 Stream.switchMap(
328 Option.match({
329 onNone: () => Stream.empty,
330 onSome: () =>
331 Stream.unwrap(
332 acquireSupervisor(environmentId).pipe(
333 Effect.match({
334 onFailure: () => Stream.empty,
335 onSuccess: (supervisor) =>
336 Stream.provideService(
337 stream,
338 EnvironmentSupervisor.EnvironmentSupervisor,
339 supervisor,
340 ),
341 }),
342 ),
343 ),
344 }),
345 ),
346 );
347
348 const start = Effect.gen(function* () {
349 if (yield* Ref.getAndSet(started, true)) {
350 return;
351 }
352 yield* Effect.forEach(
353 persistedTargets,
354 (target) =>
355 acquireSupervisor(target.environmentId).pipe(
356 Effect.catchTag("EnvironmentNotRegisteredError", () => Effect.void),
357 ),
358 {
359 concurrency: "unbounded",
360 discard: true,
361 },
362 );
363 }).pipe(Effect.withSpan("EnvironmentRegistry.start"));
364
365 const installEntryLocked = Effect.fn("EnvironmentRegistry.installEntryLocked")(function* (
366 entry: ConnectionCatalogEntry,
367 options?: { readonly retainEquivalentRuntime?: boolean },
368 ) {
369 const target = entry.target;
370 const previous = (yield* SubscriptionRef.get(entries)).get(target.environmentId);
371 const existingScope = (yield* SubscriptionRef.get(serviceScopes)).get(target.environmentId);
372 if (
373 options?.retainEquivalentRuntime === true &&
374 previous !== undefined &&
375 Equal.equals(previous, entry) &&
376 existingScope !== undefined &&
377 Equal.equals(existingScope.entry, entry)
378 ) {
379 return;
380 }
381
382 yield* closeServiceScope(target.environmentId);
383 yield* SubscriptionRef.update(entries, (current) => {
384 const next = new Map(current);
385 next.set(target.environmentId, entry);
386 return next;
387 });
388 yield* createServiceScope(entry);
389 });
390
391 const register = Effect.fn("EnvironmentRegistry.register")(function* (
392 registration: ConnectionRegistration,
393 ) {
394 const entry = connectionRegistrationCatalogEntry(registration);
395 const environmentId = entry.target.environmentId;
396 yield* withLeaseLock(
397 environmentId,
398 Effect.gen(function* () {
399 if ((yield* Ref.get(platformEnvironmentIds)).has(environmentId)) {
400 return;
401 }
402 yield* registrations.register(registration);
403 yield* Ref.update(persistedTargetsByEnvironment, (current) => {
404 const next = new Map(current);
405 next.set(environmentId, registration.target);
406 return next;
407 });
408 yield* installEntryLocked(entry);
409 }),
410 );
411 });
412
413 const installPlatformRegistration = Effect.fn("EnvironmentRegistry.installPlatformRegistration")(
414 function* (registration: PlatformConnectionRegistration) {
415 const entry = connectionRegistrationCatalogEntry(registration);
416 const target = entry.target;
417 yield* withLeaseLock(
418 target.environmentId,
419 Effect.gen(function* () {
420 yield* Ref.update(platformEnvironmentIds, (current) => {
421 const next = new Set(current);
422 next.add(target.environmentId);
423 return next;
424 });
425
426 // Secondary desktop-local backends (e.g. a parallel WSL backend) live
427 // on their own loopback origin, so they authenticate with a bearer
428 // token instead of the primary's same-origin cookie. Stash it where
429 // the resolver's bearer broker looks it up.
430 if (registration._tag === "BearerConnectionRegistration") {
431 yield* credentials.put(registration.target.connectionId, registration.credential).pipe(
432 Effect.catch((error) =>
433 Effect.logWarning("Could not store the platform bearer credential.", {
434 environmentId: target.environmentId,
435 error,
436 }),
437 ),
438 );
439 }
440
441 const persistedTarget = (yield* Ref.get(persistedTargetsByEnvironment)).get(
442 target.environmentId,
443 );
444 if (persistedTarget !== undefined) {
445 yield* registrations.remove(persistedTarget).pipe(
446 Effect.tap(() =>
447 Ref.update(persistedTargetsByEnvironment, (current) => {
448 const next = new Map(current);
449 next.delete(target.environmentId);
450 return next;
451 }),
452 ),
453 Effect.catch((error) =>
454 Effect.logWarning(
455 "Could not remove a persisted registration shadowed by a platform environment.",
456 {
457 environmentId: target.environmentId,
458 error,
459 },
460 ),
461 ),
462 );
463 }
464
465 yield* installEntryLocked(entry, { retainEquivalentRuntime: true });
466 }),
467 );
468 },
469 );
470
471 // Tear down a platform-managed environment that the host no longer reports
472 // (e.g. the user turned the parallel WSL backend off). Platform environments
473 // bypass the user-facing `remove` guard since they are reconciled from the
474 // bootstrap rather than removed by hand.
475 const removePlatformEnvironment = Effect.fn("EnvironmentRegistry.removePlatformEnvironment")(
476 function* (environmentId: EnvironmentId) {
477 yield* withLeaseLock(
478 environmentId,
479 Effect.gen(function* () {
480 const entry = (yield* SubscriptionRef.get(entries)).get(environmentId);
481 yield* Ref.update(platformEnvironmentIds, (current) => {
482 const next = new Set(current);
483 next.delete(environmentId);
484 return next;
485 });
486 yield* closeServiceScope(environmentId);
487 yield* SubscriptionRef.update(entries, (current) => {
488 const next = new Map(current);
489 next.delete(environmentId);
490 return next;
491 });
492 if (entry !== undefined && entry.target._tag === "BearerConnectionTarget") {
493 yield* credentials.remove(entry.target.connectionId).pipe(
494 Effect.catch((error) =>
495 Effect.logWarning("Could not clear the platform bearer credential.", {
496 environmentId,
497 error,
498 }),
499 ),
500 );
501 }
502 yield* Effect.all(
503 [
504 cache.clear(environmentId).pipe(
505 Effect.catch((error) =>
506 Effect.logWarning("Could not clear cached environment data after removal.", {
507 environmentId,
508 error,
509 }),
510 ),
511 ),
512 ownedDataCleanup.clear(environmentId),
513 ],
514 { concurrency: "unbounded", discard: true },
515 );
516 }),
517 );
518 },
519 );
520
521 const registerPlatform = Effect.fn("EnvironmentRegistry.registerPlatform")(function* (
522 registration: PrimaryConnectionRegistration,
523 ) {
524 yield* installPlatformRegistration(registration);
525 });
526
527 // Reconcile the full set of platform-managed environments against what the
528 // host currently reports: add/refresh the desired ones and tear down any
529 // platform environment that disappeared (WSL toggled off, distro switched).
530 const reconcilePlatform = Effect.fn("EnvironmentRegistry.reconcilePlatform")(function* (
531 platformRegistrations: ReadonlyArray<PlatformConnectionRegistration>,
532 ) {
533 const desiredIds = new Set(
534 platformRegistrations.map((registration) => registration.target.environmentId),
535 );
536 const currentPlatformIds = yield* Ref.get(platformEnvironmentIds);
537 yield* Effect.forEach(
538 currentPlatformIds,
539 (environmentId) =>
540 desiredIds.has(environmentId) ? Effect.void : removePlatformEnvironment(environmentId),
541 { discard: true },
542 );
543 yield* Effect.forEach(platformRegistrations, installPlatformRegistration, { discard: true });
544 });
545
546 const remove = Effect.fn("EnvironmentRegistry.remove")(function* (environmentId: EnvironmentId) {
547 return yield* withLeaseLock(
548 environmentId,
549 Effect.gen(function* () {
550 if ((yield* Ref.get(platformEnvironmentIds)).has(environmentId)) {
551 return yield* new PlatformEnvironmentRemovalError({
552 environmentId,
553 });
554 }
555 const target = (yield* getEntry(environmentId)).target;
556 const profile =
557 target._tag === "BearerConnectionTarget" || target._tag === "SshConnectionTarget"
558 ? yield* profiles.get(target.connectionId)
559 : Option.none();
560
561 yield* registrations.remove(target);
562 yield* Ref.update(persistedTargetsByEnvironment, (current) => {
563 const next = new Map(current);
564 next.delete(environmentId);
565 return next;
566 });
567 yield* closeServiceScope(environmentId);
568 yield* SubscriptionRef.update(entries, (current) => {
569 const next = new Map(current);
570 next.delete(environmentId);
571 return next;
572 });
573 yield* Effect.all(
574 [
575 cache.clear(environmentId).pipe(
576 Effect.catch((error) =>
577 Effect.logWarning("Could not clear cached environment data after removal.", {
578 environmentId,
579 error,
580 }),
581 ),
582 ),
583 ownedDataCleanup.clear(environmentId),
584 ],
585 { concurrency: "unbounded", discard: true },
586 );
587
588 if (
589 target._tag === "SshConnectionTarget" &&
590 Option.isSome(profile) &&
591 isSshConnectionProfile(profile.value)
592 ) {
593 yield* ssh.disconnect(profile.value.target).pipe(
594 Effect.tapError((error) =>
595 Effect.logWarning("Could not disconnect the managed SSH environment.", {
596 environmentId,
597 error,
598 }),
599 ),
600 Effect.ignore,
601 );
602 }
603 }),
604 );
605 });
606
607 const removeRelayEnvironments = Effect.fn("EnvironmentRegistry.removeRelayEnvironments")(
608 function* () {
609 const relayEnvironmentIds = [...(yield* SubscriptionRef.get(entries)).values()]
610 .filter((entry) => entry.target._tag === "RelayConnectionTarget")
611 .map((entry) => entry.target.environmentId);
612
613 yield* Effect.forEach(
614 relayEnvironmentIds,
615 (environmentId) =>
616 remove(environmentId).pipe(
617 Effect.catchTag("EnvironmentNotRegisteredError", () => Effect.void),
618 ),
619 {
620 concurrency: "unbounded",
621 discard: true,
622 },
623 );
624 },
625 );
626
627 const retryNow = (environmentId: EnvironmentId) =>
628 acquireSupervisor(environmentId).pipe(
629 Effect.flatMap((supervisor) => supervisor.retryNow),
630 Effect.catchTag("EnvironmentNotRegisteredError", () => Effect.void),
631 Effect.withSpan("EnvironmentRegistry.retryNow"),
632 );
633 const state = Effect.fn("EnvironmentRegistry.state")(function* (environmentId: EnvironmentId) {
634 const supervisor = yield* acquireSupervisor(environmentId);
635 return yield* SubscriptionRef.get(supervisor.state);
636 });
637 const stateChanges = (environmentId: EnvironmentId) =>
638 followStream(
639 environmentId,
640 Stream.unwrap(
641 EnvironmentSupervisor.EnvironmentSupervisor.pipe(
642 Effect.map((supervisor) => SubscriptionRef.changes(supervisor.state)),
643 ),
644 ),
645 );
646
647 yield* Effect.addFinalizer(() =>
648 SubscriptionRef.get(serviceScopes).pipe(
649 Effect.flatMap((current) =>
650 Effect.forEach(current.values(), (lease) => Scope.close(lease.scope, Exit.void), {
651 concurrency: "unbounded",
652 discard: true,
653 }),
654 ),
655 ),
656 );
657 yield* connectivity.changes.pipe(
658 Stream.runForEach((status) => SubscriptionRef.set(networkStatus, status)),
659 Effect.forkScoped,
660 );
661
662 return EnvironmentRegistry.of({
663 entries,
664 networkStatus,
665 start,
666 register,
667 registerPlatform,
668 reconcilePlatform,
669 remove,
670 removeRelayEnvironments,
671 retryNow,
672 state,
673 stateChanges,
674 run,
675 runStream,
676 followStream,
677 });
678});
679
680export const layer = Layer.effect(EnvironmentRegistry, make);