effect-browser 0.3.0-beta.14 → 0.3.0-beta.15
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/README.md +18 -9
- package/dist/{Supervisor-W60pZWHh.d.mts → Supervisor-5tZ47hR5.d.mts} +24 -10
- package/dist/{Supervisor-BE2sGHBK.mjs → Supervisor-DaGlQVjv.mjs} +84 -58
- package/dist/Supervisor-DaGlQVjv.mjs.map +1 -0
- package/dist/Supervisor.d.mts +2 -2
- package/dist/Supervisor.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/Supervisor.ts +167 -166
- package/src/internal/supervisor/lifecycle.ts +22 -12
- package/dist/Supervisor-BE2sGHBK.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -883,15 +883,24 @@ It reopens on `reopen`, which also retries an open failure until the schedule en
|
|
|
883
883
|
`definite` failure goes `Down` at once, with the cause also available through `Unavailable`.
|
|
884
884
|
|
|
885
885
|
`admit({ number, after })` runs before every open attempt, including the first and each retry,
|
|
886
|
-
inside the opening scope.
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
886
|
+
inside the opening scope. `after` covers every earlier session that stopped serving: all older
|
|
887
|
+
generations still draining or releasing, and sessions whose acquisition or application build
|
|
888
|
+
failed. It waits for all of their pending releases. If any end is `Unconfirmed`, that outcome
|
|
889
|
+
remains visible on every later admission, even after newer releases settle. The supervisor keeps
|
|
890
|
+
the first unconfirmed outcome as its witness, without retaining completed generations' resources.
|
|
891
|
+
|
|
892
|
+
Before any release there is no `after`; completed confirmed releases resolve immediately. A
|
|
893
|
+
nonexclusive rotation excludes its still-serving predecessor, so awaiting `after` preserves
|
|
894
|
+
make-before-break rotation unless an older release remains pending or unconfirmed. The facts are
|
|
895
|
+
checked again before every retry. Exclusive acquisition also waits for all pending releases.
|
|
896
|
+
Admission failures follow `reopen` and `definite`, and retirement interrupts admission while
|
|
897
|
+
releases run to their outcomes. Ignoring `after` adds no release wait for nonexclusive acquisition.
|
|
898
|
+
|
|
899
|
+
Provider adapters can read the optional `Supervisor.Releasing` service during `open`. When an
|
|
900
|
+
attempt fails, its cleanup reports the actual outcome with `released(outcome)` before finishing;
|
|
901
|
+
the original acquisition failure stays a failure. Successful generations return `Opened.release`
|
|
902
|
+
as usual. `Browserbase.supervise` supplies failed-connect and failed-build outcomes this way, so
|
|
903
|
+
consumers do not need to wrap or repeat a provider release.
|
|
895
904
|
|
|
896
905
|
`retire` revokes immediately, stops acquisition and waits for every generation to release.
|
|
897
906
|
Closing the supervisor's scope does the same unless `keep` is set: then only the serving
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service, t as Browser_d_exports } from "./Browser.mjs";
|
|
2
|
-
import { Cause, Duration, Effect, Schedule, Schema, Scope, Stream } from "effect";
|
|
2
|
+
import { Cause, Context, Duration, Effect, Schedule, Schema, Scope, Stream } from "effect";
|
|
3
3
|
declare namespace lifecycle_d_exports {
|
|
4
|
-
export { Closed, Command, Down, Drain, Draining, GenerationState, Held, Input, Kept, Live, Lost, Open, Opening, Released, Reopening, Resolution, Settled, State, Step, Unconfirmed, lookup, resolve, start, transition };
|
|
4
|
+
export { Closed, Command, Down, Drain, Draining, GenerationState, Held, Input, Kept, Live, Lost, Open, Opening, Released, Reopening, Resolution, Settled, State, Step, Unconfirmed, combine, lookup, resolve, start, transition };
|
|
5
5
|
}
|
|
6
6
|
declare const Settled_base: Schema.Class<Settled, Schema.TaggedStruct<"Settled", {}>, {}>;
|
|
7
7
|
/** The provider confirmed that the generation's browser ended. */
|
|
@@ -88,12 +88,15 @@ type State<A, H = unknown> = ({
|
|
|
88
88
|
readonly _tag: "Retired";
|
|
89
89
|
}) & {
|
|
90
90
|
readonly draining: ReadonlyMap<number, Drain<A, H>>;
|
|
91
|
-
/**
|
|
92
|
-
readonly
|
|
91
|
+
/** Retain the first unconfirmed end, otherwise the latest settled end, without its resources. */
|
|
92
|
+
readonly released?: Released | undefined;
|
|
93
93
|
};
|
|
94
94
|
type Input<A, H = unknown> = {
|
|
95
95
|
readonly _tag: "Opened";
|
|
96
96
|
readonly live: Live<A>;
|
|
97
|
+
} | {
|
|
98
|
+
readonly _tag: "AttemptReleased";
|
|
99
|
+
readonly released: Released;
|
|
97
100
|
} | {
|
|
98
101
|
readonly _tag: "Failed";
|
|
99
102
|
readonly number: number;
|
|
@@ -133,7 +136,6 @@ type Input<A, H = unknown> = {
|
|
|
133
136
|
type Command<A> = {
|
|
134
137
|
readonly _tag: "Open";
|
|
135
138
|
readonly number: number;
|
|
136
|
-
readonly after: Live<A> | undefined;
|
|
137
139
|
} | {
|
|
138
140
|
readonly _tag: "Watch";
|
|
139
141
|
readonly live: Live<A>;
|
|
@@ -166,6 +168,8 @@ declare const start: <A, H = unknown>() => Step<A, H>;
|
|
|
166
168
|
declare const lookup: <A, H>(state: State<A, H>, number: number) => Held<A, H> | undefined;
|
|
167
169
|
/** Pure admission and lifecycle changes. A rejected hold preserves state identity. */
|
|
168
170
|
declare const transition: <A, H = unknown>(state: State<A, H>, input: Input<A, H>, exclusive: boolean, now?: number, handover?: number) => Step<A, H>;
|
|
171
|
+
/** Later confirmations cannot establish that an earlier unconfirmed session ended. */
|
|
172
|
+
declare const combine: (before: Released | undefined, next: Released | undefined) => Settled | Unconfirmed | undefined;
|
|
169
173
|
type Resolution<A> = {
|
|
170
174
|
readonly _tag: "Serve";
|
|
171
175
|
readonly live: Live<A>;
|
|
@@ -178,7 +182,7 @@ type Resolution<A> = {
|
|
|
178
182
|
/** An unheld browser resolution; use obtains its hold atomically through Hold instead. */
|
|
179
183
|
declare const resolve: <A, H>(state: State<A, H>, target: number | undefined) => Resolution<A> | undefined;
|
|
180
184
|
declare namespace Supervisor_d_exports {
|
|
181
|
-
export { Admission, Closed, Down, Draining, Generation, GenerationState, Kept, Lease, Lost, Open, Opened, Opening, Options, Released, Reopening, Settled, Superseded, Supervisor, Unavailable, Unconfirmed, UseOptions, make };
|
|
185
|
+
export { Admission, Closed, Down, Draining, Generation, GenerationState, Kept, Lease, Lost, Open, Opened, Opening, Options, Released, Releasing, Reopening, Settled, Superseded, Supervisor, Unavailable, Unconfirmed, UseOptions, make };
|
|
182
186
|
}
|
|
183
187
|
declare const Generation_base: Schema.Class<Generation, Schema.Struct<{
|
|
184
188
|
readonly number: Schema.Int;
|
|
@@ -215,11 +219,21 @@ interface Opened<A = void> {
|
|
|
215
219
|
interface Admission {
|
|
216
220
|
readonly number: number;
|
|
217
221
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
222
|
+
* Every earlier session that stopped serving, including failed attempts and older drains.
|
|
223
|
+
* Waits for all pending releases; an Unconfirmed end remains visible to later attempts.
|
|
224
|
+
* Undefined before any release. A still-serving nonexclusive predecessor is excluded.
|
|
220
225
|
*/
|
|
221
226
|
readonly after: Effect.Effect<Released> | undefined;
|
|
222
227
|
}
|
|
228
|
+
declare const Releasing_base: Context.ServiceClass<Releasing, "effect-browser/Supervisor/Releasing", {
|
|
229
|
+
readonly released: (outcome: Released) => Effect.Effect<void>;
|
|
230
|
+
}>;
|
|
231
|
+
/**
|
|
232
|
+
* Optional service supplied during `open`. Providers report failed-attempt cleanup here before
|
|
233
|
+
* their scope closes; successful generations instead return `Opened.release`. Reporting does
|
|
234
|
+
* not release resources or replace the original acquisition failure.
|
|
235
|
+
*/
|
|
236
|
+
declare class Releasing extends Releasing_base {}
|
|
223
237
|
interface Options<E, R, A = void> {
|
|
224
238
|
/** Opens one generation in the scope it is given. */
|
|
225
239
|
readonly open: Effect.Effect<Opened<A>, E, R>;
|
|
@@ -292,5 +306,5 @@ type MakeOptions<E, R, A> = Omit<Options<E, R, A>, "open"> & {
|
|
|
292
306
|
declare function make<E, R, A = void>(options: Options<E, R, A>): Effect.Effect<Supervisor<A>, never, Scope.Scope | Exclude<R, Scope.Scope>>;
|
|
293
307
|
declare function make<E, R>(options: MakeOptions<E, R, never>): Effect.Effect<Supervisor<void>, never, Scope.Scope | Exclude<R, Scope.Scope>>;
|
|
294
308
|
//#endregion
|
|
295
|
-
export {
|
|
296
|
-
//# sourceMappingURL=Supervisor-
|
|
309
|
+
export { Settled as C, Reopening as S, Kept as _, Options as a, Opening as b, Supervisor as c, UseOptions as d, make as f, GenerationState as g, Draining as h, Opened as i, Supervisor_d_exports as l, Down as m, Generation as n, Releasing as o, Closed as p, Lease as r, Superseded as s, Admission as t, Unavailable as u, Lost as v, Unconfirmed as w, Released as x, Open as y };
|
|
310
|
+
//# sourceMappingURL=Supervisor-5tZ47hR5.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { DisconnectCause } from "./BrowserEvent.mjs";
|
|
3
|
-
import { Cause, Clock, DateTime, Deferred, Duration, Effect, Exit, FiberHandle, FiberMap, Option, Predicate, PubSub, Schedule, Schema, Scope, Semaphore, Stream, SubscriptionRef } from "effect";
|
|
3
|
+
import { Cause, Clock, Context, DateTime, Deferred, Duration, Effect, Exit, FiberHandle, FiberMap, Option, Predicate, PubSub, Schedule, Schema, Scope, Semaphore, Stream, SubscriptionRef } from "effect";
|
|
4
4
|
//#region src/internal/supervisor/lifecycle.ts
|
|
5
5
|
/**
|
|
6
6
|
* A supervisor's life as one state and one transition function, and the generation states it
|
|
@@ -62,14 +62,12 @@ const start = () => ({
|
|
|
62
62
|
_tag: "Opening",
|
|
63
63
|
number: 1,
|
|
64
64
|
serving: void 0,
|
|
65
|
-
draining: /* @__PURE__ */ new Map()
|
|
66
|
-
latest: void 0
|
|
65
|
+
draining: /* @__PURE__ */ new Map()
|
|
67
66
|
},
|
|
68
67
|
events: [[1, new Opening()]],
|
|
69
68
|
commands: [{
|
|
70
69
|
_tag: "Open",
|
|
71
|
-
number: 1
|
|
72
|
-
after: void 0
|
|
70
|
+
number: 1
|
|
73
71
|
}]
|
|
74
72
|
});
|
|
75
73
|
const servingOf = (state) => state._tag === "Retired" ? void 0 : state.serving;
|
|
@@ -149,20 +147,18 @@ const holds = (change, input) => {
|
|
|
149
147
|
const next = (change, number, reopen) => {
|
|
150
148
|
const { exclusive } = change;
|
|
151
149
|
const current = servingOf(change.state);
|
|
152
|
-
const after = change.state.latest;
|
|
153
150
|
if (current !== void 0 && (reopen || exclusive)) end(change, current, reopen ? "lost" : "rotated");
|
|
154
151
|
change.state = {
|
|
155
152
|
_tag: "Opening",
|
|
156
153
|
number,
|
|
157
154
|
serving: reopen || exclusive ? void 0 : current,
|
|
158
155
|
draining: change.state.draining,
|
|
159
|
-
|
|
156
|
+
released: change.state.released
|
|
160
157
|
};
|
|
161
158
|
change.events.push([number, reopen ? new Reopening() : new Opening()]);
|
|
162
159
|
change.commands.push({
|
|
163
160
|
_tag: "Open",
|
|
164
|
-
number
|
|
165
|
-
after
|
|
161
|
+
number
|
|
166
162
|
});
|
|
167
163
|
};
|
|
168
164
|
const lost = (change, input) => {
|
|
@@ -224,7 +220,7 @@ const transition = (state, input, exclusive, now = 0, handover = 3e4) => {
|
|
|
224
220
|
_tag: "Open",
|
|
225
221
|
serving: live,
|
|
226
222
|
draining: change.state.draining,
|
|
227
|
-
|
|
223
|
+
released: change.state.released
|
|
228
224
|
};
|
|
229
225
|
}
|
|
230
226
|
break;
|
|
@@ -246,6 +242,12 @@ const transition = (state, input, exclusive, now = 0, handover = 3e4) => {
|
|
|
246
242
|
case "Abandoned":
|
|
247
243
|
change.events.push([input.number, new Closed({})]);
|
|
248
244
|
break;
|
|
245
|
+
case "AttemptReleased":
|
|
246
|
+
change.state = {
|
|
247
|
+
...state,
|
|
248
|
+
released: combine(state.released, input.released)
|
|
249
|
+
};
|
|
250
|
+
break;
|
|
249
251
|
case "Released": {
|
|
250
252
|
const drain = state.draining.get(input.number);
|
|
251
253
|
if (drain === void 0 || drain._tag === "Draining" || drain.live.holds.size > 0) break;
|
|
@@ -253,7 +255,8 @@ const transition = (state, input, exclusive, now = 0, handover = 3e4) => {
|
|
|
253
255
|
draining.delete(input.number);
|
|
254
256
|
change.state = {
|
|
255
257
|
...state,
|
|
256
|
-
draining
|
|
258
|
+
draining,
|
|
259
|
+
released: combine(state.released, input.released)
|
|
257
260
|
};
|
|
258
261
|
change.events.push([input.number, input.released === void 0 ? new Kept() : new Closed({ released: input.released })]);
|
|
259
262
|
break;
|
|
@@ -274,11 +277,13 @@ const transition = (state, input, exclusive, now = 0, handover = 3e4) => {
|
|
|
274
277
|
change.state = {
|
|
275
278
|
_tag: "Retired",
|
|
276
279
|
draining: change.state.draining,
|
|
277
|
-
|
|
280
|
+
released: change.state.released
|
|
278
281
|
};
|
|
279
282
|
}
|
|
280
283
|
return change;
|
|
281
284
|
};
|
|
285
|
+
/** Later confirmations cannot establish that an earlier unconfirmed session ended. */
|
|
286
|
+
const combine = (before, next) => before?._tag === "Unconfirmed" ? before : next ?? before;
|
|
282
287
|
/** An unheld browser resolution; use obtains its hold atomically through Hold instead. */
|
|
283
288
|
const resolve = (state, target) => {
|
|
284
289
|
if (state._tag === "Retired") return {
|
|
@@ -330,6 +335,7 @@ var Supervisor_exports = /* @__PURE__ */ __exportAll({
|
|
|
330
335
|
Open: () => Open,
|
|
331
336
|
Opening: () => Opening,
|
|
332
337
|
Released: () => Released,
|
|
338
|
+
Releasing: () => Releasing,
|
|
333
339
|
Reopening: () => Reopening,
|
|
334
340
|
Settled: () => Settled,
|
|
335
341
|
Superseded: () => Superseded,
|
|
@@ -361,6 +367,12 @@ var Unavailable = class extends Schema.TaggedError()("Unavailable", {
|
|
|
361
367
|
return `no browser: ${this.detail}`;
|
|
362
368
|
}
|
|
363
369
|
};
|
|
370
|
+
/**
|
|
371
|
+
* Optional service supplied during `open`. Providers report failed-attempt cleanup here before
|
|
372
|
+
* their scope closes; successful generations instead return `Opened.release`. Reporting does
|
|
373
|
+
* not release resources or replace the original acquisition failure.
|
|
374
|
+
*/
|
|
375
|
+
var Releasing = class extends Context.Service()("effect-browser/Supervisor/Releasing") {};
|
|
364
376
|
/** Work whose generation was revoked; input receipts still determine whether input reached a site. */
|
|
365
377
|
var Superseded = class extends Schema.TaggedError()("Superseded", {
|
|
366
378
|
generation: Schema.Int,
|
|
@@ -384,11 +396,6 @@ const describe = (cause) => {
|
|
|
384
396
|
const error = Cause.squash(cause);
|
|
385
397
|
return Predicate.isError(error) ? error.message : String(error);
|
|
386
398
|
};
|
|
387
|
-
const unavailable = (resolution) => new Unavailable({
|
|
388
|
-
reason: resolution.reason,
|
|
389
|
-
detail: resolution.detail,
|
|
390
|
-
cause: resolution.cause
|
|
391
|
-
});
|
|
392
399
|
const timedOut = () => new Unavailable({
|
|
393
400
|
reason: "opening",
|
|
394
401
|
detail: "no generation opened within the wait"
|
|
@@ -399,7 +406,7 @@ const bounded = (input, name) => Effect.suspend(() => {
|
|
|
399
406
|
});
|
|
400
407
|
/** Resolve immediately before starting a bounded wait, including when its duration is zero. */
|
|
401
408
|
const waitFor = (state, wait, clock, target) => {
|
|
402
|
-
const result = (resolution) => resolution._tag === "Serve" ? Effect.succeed(resolution.live) : Effect.fail(
|
|
409
|
+
const result = (resolution) => resolution._tag === "Serve" ? Effect.succeed(resolution.live) : Effect.fail(new Unavailable(resolution));
|
|
403
410
|
return Effect.suspend(() => {
|
|
404
411
|
const current = resolve(state.value, target);
|
|
405
412
|
return current === void 0 ? SubscriptionRef.changes(state).pipe(Stream.map((state) => resolve(state, target)), Stream.filter(Predicate.isNotUndefined), Stream.runHead, Effect.flatMap(Option.match({
|
|
@@ -420,7 +427,7 @@ const untilRotation = (expiresAt, before) => Clock.currentTimeMillis.pipe(Effect
|
|
|
420
427
|
const until = (at, now) => Effect.suspend(() => now() >= at ? Effect.void : Effect.sleep(Duration.millis(Math.ceil(at - now()))).pipe(Effect.andThen(until(at, now))));
|
|
421
428
|
/** Borrowed work and transferred scopes hold a generation until cleanup lets it go. */
|
|
422
429
|
const leasing = (state, apply, waitTimeout, now, clock) => {
|
|
423
|
-
const borrow =
|
|
430
|
+
const borrow = Effect.fnUntraced(function* (hold, wait) {
|
|
424
431
|
const until = now() + Duration.toMillis(wait);
|
|
425
432
|
for (;;) {
|
|
426
433
|
const step = yield* apply({
|
|
@@ -488,7 +495,6 @@ const acquireGeneration = (open, own) => Effect.uninterruptibleMask((restore) =>
|
|
|
488
495
|
revoked: Deferred.makeUnsafe(),
|
|
489
496
|
released: Deferred.makeUnsafe()
|
|
490
497
|
})))));
|
|
491
|
-
const changedUntil = (state, predicate) => SubscriptionRef.changes(state).pipe(Stream.filter(predicate), Stream.runHead, Effect.asVoid);
|
|
492
498
|
const watchGeneration = (live, rotateBefore, apply) => {
|
|
493
499
|
const { browser } = live.value.opened;
|
|
494
500
|
const loss = browser.disconnected.pipe(Effect.flatMap((cause) => apply({
|
|
@@ -505,11 +511,10 @@ const watchGeneration = (live, rotateBefore, apply) => {
|
|
|
505
511
|
discard: true
|
|
506
512
|
});
|
|
507
513
|
};
|
|
508
|
-
const releaseGeneration = (command, state, apply)
|
|
514
|
+
const releaseGeneration = Effect.fnUntraced(function* (command, state, apply) {
|
|
509
515
|
const { live } = command;
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
yield* changedUntil(state, (current) => (lookup(current, live.number)?.holds.size ?? 0) === 0);
|
|
516
|
+
const cleaned = yield* Effect.forEach(lookup(state.value, live.number)?.holds ?? [], (hold) => Effect.exit(hold._tag === "Retained" ? Scope.close(hold.scope, Exit.void) : Effect.void), { concurrency: 8 });
|
|
517
|
+
yield* SubscriptionRef.changes(state).pipe(Stream.filter((current) => (lookup(current, live.number)?.holds.size ?? 0) === 0), Stream.runHead);
|
|
513
518
|
const released = command._tag === "Leave" ? void 0 : yield* (live.value.opened.release ?? Effect.succeed(new Settled())).pipe(Effect.catchCause((cause) => Effect.succeed(new Unconfirmed({ detail: `the release failed: ${describe(cause)}` }))));
|
|
514
519
|
const closed = yield* Effect.exit(Scope.close(live.value.scope, Exit.void));
|
|
515
520
|
yield* apply({
|
|
@@ -520,29 +525,21 @@ const releaseGeneration = (command, state, apply) => Effect.gen(function* () {
|
|
|
520
525
|
if (released !== void 0) yield* Deferred.succeed(live.value.released, released);
|
|
521
526
|
yield* Exit.asVoidAll([...cleaned, closed]);
|
|
522
527
|
});
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
live
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
number
|
|
532
|
-
} : {
|
|
533
|
-
_tag: "Failed",
|
|
534
|
-
number,
|
|
535
|
-
detail: describe(exit.cause),
|
|
536
|
-
cause: Cause.squash(exit.cause)
|
|
528
|
+
const admissionAfter = (state) => {
|
|
529
|
+
const released = state.released;
|
|
530
|
+
const pending = [...state.draining.values()].filter((drain) => drain._tag !== "Leaving").map(({ live }) => live.value.released);
|
|
531
|
+
return pending.length === 0 && released === void 0 ? void 0 : Effect.gen(function* () {
|
|
532
|
+
let outcome = released;
|
|
533
|
+
for (const release of pending) outcome = combine(outcome, yield* Deferred.await(release));
|
|
534
|
+
return outcome ?? new Settled();
|
|
535
|
+
});
|
|
537
536
|
};
|
|
538
|
-
const admissionAfter = (previous, state) => previous === void 0 || state._tag !== "Retired" && state.serving?.number === previous.number ? void 0 : Deferred.await(previous.value.released);
|
|
539
537
|
const makeScoped = Effect.fn("Supervisor.make")(function* (options) {
|
|
540
538
|
const clock = yield* Clock.Clock;
|
|
541
539
|
const now = () => Number(clock.monotonicTimeNanosUnsafe()) / 1e6;
|
|
542
540
|
const context = yield* Effect.context();
|
|
543
541
|
const own = yield* Scope.fork(yield* Effect.scope);
|
|
544
542
|
const exclusive = options.exclusive ?? false;
|
|
545
|
-
const definite = options.definite ?? (() => false);
|
|
546
543
|
const reopen = options.reopen ?? Schedule.exponential("1 second").pipe(Schedule.upTo({ duration: Duration.minutes(5) }));
|
|
547
544
|
const rotateBefore = options.rotateBefore === void 0 ? void 0 : Duration.fromInputUnsafe(options.rotateBefore);
|
|
548
545
|
const waitTimeout = yield* bounded(options.waitTimeout ?? Duration.minutes(2), "waitTimeout");
|
|
@@ -555,14 +552,14 @@ const makeScoped = Effect.fn("Supervisor.make")(function* (options) {
|
|
|
555
552
|
const releases = yield* FiberMap.make();
|
|
556
553
|
const runOpen = yield* FiberHandle.runtime(opening)();
|
|
557
554
|
const runRelease = yield* FiberMap.runtime(releases)();
|
|
558
|
-
const apply =
|
|
555
|
+
const apply = Effect.fnUntraced(function* (input) {
|
|
559
556
|
const current = state.value;
|
|
560
557
|
const step = transition(current, input, exclusive, now(), handover);
|
|
561
558
|
if (step.state !== current) yield* SubscriptionRef.set(state, step.state);
|
|
562
559
|
yield* perform(step);
|
|
563
560
|
return step;
|
|
564
|
-
})
|
|
565
|
-
const perform =
|
|
561
|
+
}, (effect) => applying.withPermit(effect), Effect.uninterruptible, Effect.provideService(Clock.Clock, clock));
|
|
562
|
+
const perform = Effect.fnUntraced(function* (step) {
|
|
566
563
|
for (const [number, generation] of step.events) PubSub.publishUnsafe(events, [new Generation({
|
|
567
564
|
number,
|
|
568
565
|
at: clock.currentTimeMillisUnsafe(),
|
|
@@ -571,7 +568,7 @@ const makeScoped = Effect.fn("Supervisor.make")(function* (options) {
|
|
|
571
568
|
})]);
|
|
572
569
|
for (const command of step.commands) switch (command._tag) {
|
|
573
570
|
case "Open":
|
|
574
|
-
runOpen(openGeneration(command.number
|
|
571
|
+
runOpen(openGeneration(command.number));
|
|
575
572
|
break;
|
|
576
573
|
case "Watch":
|
|
577
574
|
yield* Effect.forkIn(Effect.provideContext(watchGeneration(command.live, rotateBefore, apply), context), command.live.value.scope);
|
|
@@ -591,26 +588,55 @@ const makeScoped = Effect.fn("Supervisor.make")(function* (options) {
|
|
|
591
588
|
runRelease(command.live.number, releaseGeneration(command, state, apply));
|
|
592
589
|
}
|
|
593
590
|
});
|
|
594
|
-
const openGeneration = (number
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
591
|
+
const openGeneration = (number) => {
|
|
592
|
+
const openOnce = acquireGeneration(Effect.gen(function* () {
|
|
593
|
+
const after = admissionAfter(state.value);
|
|
594
|
+
if (exclusive && after !== void 0) yield* after;
|
|
595
|
+
yield* options.admit?.({
|
|
596
|
+
number,
|
|
597
|
+
after
|
|
598
|
+
}) ?? Effect.void;
|
|
599
|
+
return yield* options.open.pipe(Effect.provideService(Releasing, { released: (released) => apply({
|
|
600
|
+
_tag: "AttemptReleased",
|
|
601
|
+
released
|
|
602
|
+
}).pipe(Effect.asVoid) }));
|
|
603
|
+
}), own).pipe(Effect.provideContext(context));
|
|
604
|
+
return Effect.uninterruptibleMask((restore) => restore(Effect.retry(openOnce, {
|
|
601
605
|
schedule: reopen,
|
|
602
|
-
while: (error) => !definite(error)
|
|
603
|
-
}))
|
|
606
|
+
while: (error) => !options.definite?.(error)
|
|
607
|
+
})).pipe(Effect.exit, Effect.flatMap((exit) => {
|
|
608
|
+
if (Exit.isSuccess(exit)) return apply({
|
|
609
|
+
_tag: "Opened",
|
|
610
|
+
live: {
|
|
611
|
+
number,
|
|
612
|
+
value: exit.value
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
const cause = exit.cause;
|
|
616
|
+
return apply(Cause.hasInterruptsOnly(cause) ? {
|
|
617
|
+
_tag: "Abandoned",
|
|
618
|
+
number
|
|
619
|
+
} : {
|
|
620
|
+
_tag: "Failed",
|
|
621
|
+
number,
|
|
622
|
+
detail: describe(cause),
|
|
623
|
+
cause: Cause.squash(cause)
|
|
624
|
+
});
|
|
625
|
+
})));
|
|
604
626
|
};
|
|
605
|
-
const use = leasing(state, apply, waitTimeout, now, clock);
|
|
606
627
|
const end = yield* Effect.cached(PubSub.publish(events, Exit.void));
|
|
607
|
-
const stop =
|
|
628
|
+
const stop = Effect.fnUntraced(function* (input) {
|
|
629
|
+
yield* apply(input);
|
|
630
|
+
yield* FiberHandle.clear(opening);
|
|
631
|
+
yield* FiberMap.awaitEmpty(releases);
|
|
632
|
+
if (yield* Deferred.isDone(releases.deferred)) yield* FiberMap.join(releases);
|
|
633
|
+
}, Effect.ensuring(end));
|
|
608
634
|
const retire = yield* Effect.cached(stop({ _tag: "Retire" }));
|
|
609
635
|
yield* Effect.addFinalizer(() => options.keep === true ? stop({ _tag: "Keep" }) : retire);
|
|
610
636
|
yield* perform(started);
|
|
611
637
|
return {
|
|
612
638
|
browser: Effect.map(waitFor(state, waitTimeout, clock), (live) => live.value.opened.browser),
|
|
613
|
-
use,
|
|
639
|
+
use: leasing(state, apply, waitTimeout, now, clock),
|
|
614
640
|
states: Stream.fromPubSubTake(events),
|
|
615
641
|
rotate: apply({ _tag: "Rotate" }).pipe(Effect.flatMap(({ reply }) => reply === void 0 ? Effect.fail(retired()) : Effect.map(waitFor(state, waitTimeout, clock, reply), (live) => live.value.opened.browser))),
|
|
616
642
|
retire
|
|
@@ -620,6 +646,6 @@ function make(options) {
|
|
|
620
646
|
return makeScoped(options);
|
|
621
647
|
}
|
|
622
648
|
//#endregion
|
|
623
|
-
export {
|
|
649
|
+
export { Settled as _, Unavailable as a, Down as c, Kept as d, Lost as f, Reopening as g, Released as h, Supervisor_exports as i, Draining as l, Opening as m, Releasing as n, make as o, Open as p, Superseded as r, Closed as s, Generation as t, GenerationState as u, Unconfirmed as v };
|
|
624
650
|
|
|
625
|
-
//# sourceMappingURL=Supervisor-
|
|
651
|
+
//# sourceMappingURL=Supervisor-DaGlQVjv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Supervisor-DaGlQVjv.mjs","names":["Lifecycle.GenerationState","Lifecycle.resolve","Lifecycle.lookup","Lifecycle.Settled","Lifecycle.Unconfirmed","Lifecycle.combine","Lifecycle.start","Lifecycle.transition"],"sources":["../src/internal/supervisor/lifecycle.ts","../src/Supervisor.ts"],"sourcesContent":["/**\n * A supervisor's life as one state and one transition function, and the generation states it\n * publishes. The transition has no effects: `Supervisor.make` applies each input under one lock,\n * publishes the events in order and runs the commands, so the rules here are tested alone.\n */\nimport { Schema } from \"effect\";\n\nimport { DisconnectCause } from \"../../BrowserEvent.ts\";\n\n/** The provider confirmed that the generation's browser ended. */\nexport class Settled extends Schema.TaggedClass<Settled>()(\"Settled\", {}) {}\n\n/** The provider could not confirm the end by its deadline, so the browser may still run, and bill. */\nexport class Unconfirmed extends Schema.TaggedClass<Unconfirmed>()(\"Unconfirmed\", {\n detail: Schema.String,\n}) {}\n\nexport const Released = Schema.Union([Settled, Unconfirmed]);\n\nexport type Released = typeof Released.Type;\n\n/** Opening, but not after a loss: the first generation, a rotation, or the one after `Down`. */\nexport class Opening extends Schema.TaggedClass<Opening>()(\"Opening\", {}) {}\n\n/** Opening after the generation before it was lost. */\nexport class Reopening extends Schema.TaggedClass<Reopening>()(\"Reopening\", {}) {}\n\n/** Open: `browser` gives this generation until the next one opens. */\nexport class Open extends Schema.TaggedClass<Open>()(\"Open\", {}) {}\n\n/** No longer serving; holds end at this host-monotonic deadline or when their owners let go. */\nexport class Draining extends Schema.TaggedClass<Draining>()(\"Draining\", {\n reason: Schema.Literals([\"rotated\", \"lost\", \"retired\"]),\n revokeAt: Schema.Finite,\n}) {}\n\n/** Lost through disconnection or a consumer's declaration that it is unusable. */\nexport class Lost extends Schema.TaggedClass<Lost>()(\"Lost\", {\n cause: Schema.Union([DisconnectCause, Schema.Literal(\"declared\")]),\n detail: Schema.optional(Schema.String),\n}) {}\n\n/**\n * It never opened: its last try failed with `cause`, which the provider deems definite, or after\n * which the reopen schedule gave up.\n */\nexport class Down extends Schema.TaggedClass<Down>()(\"Down\", {\n detail: Schema.String,\n cause: Schema.Defect(),\n}) {}\n\n/** It ended. `released` says how its release went; one retired while opening has none. */\nexport class Closed extends Schema.TaggedClass<Closed>()(\"Closed\", {\n released: Schema.optional(Released),\n}) {}\n\n/**\n * It was serving as the supervisor's scope closed, and was left running, not released: its scope\n * closed, and its provider runs it on, and bills, until something adopts and releases it.\n */\nexport class Kept extends Schema.TaggedClass<Kept>()(\"Kept\", {}) {}\n\nexport const GenerationState = Schema.Union([\n Opening,\n Reopening,\n Open,\n Draining,\n Lost,\n Down,\n Closed,\n Kept,\n]);\n\nexport type GenerationState = typeof GenerationState.Type;\n\n/** A generation that opened: its number, and what the runtime keeps to serve and end it. */\nexport interface Live<A> {\n readonly number: number;\n readonly value: A;\n}\n\nexport interface Held<A, H> extends Live<A> {\n readonly holds: ReadonlySet<H>;\n}\n\n/** Release ownership remains here until the provider and generation scope have finished. */\nexport interface Drain<A, H> {\n readonly _tag: \"Draining\" | \"Releasing\" | \"Leaving\";\n readonly live: Held<A, H>;\n readonly ending: Draining;\n}\n\n/** One serving generation, one shared acquisition, and prior generations still owned. */\nexport type State<A, H = unknown> = (\n | { readonly _tag: \"Opening\"; readonly number: number; readonly serving: Held<A, H> | undefined }\n | { readonly _tag: \"Open\"; readonly serving: Held<A, H> }\n | {\n readonly _tag: \"Down\";\n readonly number: number;\n readonly detail: string;\n readonly cause: unknown;\n readonly serving: Held<A, H> | undefined;\n }\n | { readonly _tag: \"Retired\" }\n) & {\n readonly draining: ReadonlyMap<number, Drain<A, H>>;\n /** Retain the first unconfirmed end, otherwise the latest settled end, without its resources. */\n readonly released?: Released | undefined;\n};\n\nexport type Input<A, H = unknown> =\n | { readonly _tag: \"Opened\"; readonly live: Live<A> }\n | { readonly _tag: \"AttemptReleased\"; readonly released: Released }\n | {\n readonly _tag: \"Failed\";\n readonly number: number;\n readonly detail: string;\n readonly cause: unknown;\n }\n | { readonly _tag: \"Abandoned\"; readonly number: number }\n | {\n readonly _tag: \"Lost\";\n readonly number: number;\n readonly cause: Lost[\"cause\"];\n readonly detail?: string | undefined;\n }\n | { readonly _tag: \"Rotate\"; readonly due?: number | undefined }\n | { readonly _tag: \"Retire\" }\n | { readonly _tag: \"Keep\" }\n | {\n readonly _tag: \"Hold\";\n readonly number?: number | undefined;\n readonly hold: H;\n }\n | { readonly _tag: \"Let\"; readonly number: number; readonly hold: H }\n | { readonly _tag: \"Revoke\"; readonly number: number }\n | {\n readonly _tag: \"Released\";\n readonly number: number;\n readonly released?: Released | undefined;\n };\n\nexport type Command<A> =\n | { readonly _tag: \"Open\"; readonly number: number }\n | { readonly _tag: \"Watch\"; readonly live: Live<A> }\n /** Signal ending and arrange revocation. Repeated only when loss/retirement accelerates it. */\n | { readonly _tag: \"Drain\"; readonly live: Live<A>; readonly ending: Draining }\n /** Revoke/close holds, await their Let inputs, release the provider, then close its scope. */\n | { readonly _tag: \"Release\"; readonly live: Live<A>; readonly ending: Draining }\n | { readonly _tag: \"Leave\"; readonly live: Live<A>; readonly ending: Draining };\n\nexport interface Step<A, H = unknown> {\n readonly state: State<A, H>;\n readonly events: ReadonlyArray<readonly [number, GenerationState]>;\n readonly commands: ReadonlyArray<Command<A>>;\n readonly reply?: number | undefined;\n readonly borrowed?: Live<A> | undefined;\n}\n\nexport const start = <A, H = unknown>(): Step<A, H> => ({\n state: { _tag: \"Opening\", number: 1, serving: undefined, draining: new Map() },\n events: [[1, new Opening()]],\n commands: [{ _tag: \"Open\", number: 1 }],\n});\n\nconst servingOf = <A, H>(state: State<A, H>) =>\n state._tag === \"Retired\" ? undefined : state.serving;\n\n/** The holds still owned for a generation, including one whose release has begun. */\nexport const lookup = <A, H>(state: State<A, H>, number: number): Held<A, H> | undefined =>\n servingOf(state)?.number === number ? servingOf(state) : state.draining.get(number)?.live;\n\n/** A transition's local result builder; input state and its collections remain immutable. */\ninterface Change<A, H> {\n readonly now: number;\n readonly handover: number;\n readonly exclusive: boolean;\n state: State<A, H>;\n events: Array<readonly [number, GenerationState]>;\n commands: Array<Command<A>>;\n reply?: number;\n borrowed?: Live<A>;\n}\n\n/** The sole writer of a drain's ending and phase; each release command is emitted once. */\nconst draining = <A, H>(change: Change<A, H>, drain: Drain<A, H>) => {\n const before = change.state.draining.get(drain.live.number);\n const { live, ending, _tag } = drain;\n\n change.state = {\n ...change.state,\n draining: new Map(change.state.draining).set(live.number, drain),\n };\n if (before?.ending !== ending) {\n change.events.push([live.number, ending]);\n change.commands.push({ _tag: \"Drain\", live, ending });\n }\n if (_tag !== \"Draining\" && before?._tag !== _tag)\n change.commands.push({ _tag: _tag === \"Leaving\" ? \"Leave\" : \"Release\", live, ending });\n};\n\nconst end = <A, H>(\n change: Change<A, H>,\n live: Held<A, H>,\n reason: Draining[\"reason\"],\n keep = false,\n) => {\n const ending = new Draining({\n reason,\n revokeAt: change.now + (reason === \"rotated\" ? change.handover : 0),\n });\n\n draining(change, {\n live,\n ending,\n _tag: keep\n ? \"Leaving\"\n : live.holds.size === 0 || ending.revokeAt <= change.now\n ? \"Releasing\"\n : \"Draining\",\n });\n};\n\nconst revoke = <A, H>(change: Change<A, H>, number: number, reason?: \"lost\" | \"retired\") => {\n const drain = change.state.draining.get(number);\n\n if (drain?._tag !== \"Draining\" || (reason === undefined && change.now < drain.ending.revokeAt))\n return;\n draining(change, {\n ...drain,\n _tag: \"Releasing\",\n ending: reason === undefined ? drain.ending : new Draining({ reason, revokeAt: change.now }),\n });\n};\n\nconst holds = <A, H>(\n change: Change<A, H>,\n input: Extract<Input<A, H>, { readonly _tag: \"Hold\" | \"Let\" }>,\n) => {\n const number = input.number ?? servingOf(change.state)?.number;\n const live = number === undefined ? undefined : lookup(change.state, number);\n\n if (live === undefined) return;\n const drain = change.state.draining.get(live.number);\n\n if (\n input._tag === \"Hold\" &&\n drain !== undefined &&\n (drain._tag !== \"Draining\" || change.now >= drain.ending.revokeAt)\n )\n return;\n if (live.holds.has(input.hold) === (input._tag === \"Hold\")) return;\n const holds = new Set(live.holds);\n\n if (input._tag === \"Hold\") {\n holds.add(input.hold);\n change.borrowed = live;\n } else holds.delete(input.hold);\n const held = { ...live, holds };\n\n if (drain !== undefined)\n draining(change, {\n ...drain,\n live: held,\n _tag: drain._tag === \"Draining\" && holds.size === 0 ? \"Releasing\" : drain._tag,\n });\n else if (change.state._tag !== \"Retired\") change.state = { ...change.state, serving: held };\n};\n\nconst next = <A, H>(change: Change<A, H>, number: number, reopen: boolean) => {\n const { exclusive } = change;\n const current = servingOf(change.state);\n\n if (current !== undefined && (reopen || exclusive))\n end(change, current, reopen ? \"lost\" : \"rotated\");\n change.state = {\n _tag: \"Opening\",\n number,\n serving: reopen || exclusive ? undefined : current,\n draining: change.state.draining,\n released: change.state.released,\n };\n change.events.push([number, reopen ? new Reopening() : new Opening()]);\n change.commands.push({ _tag: \"Open\", number });\n};\n\nconst lost = <A, H>(\n change: Change<A, H>,\n input: Extract<Input<A, H>, { readonly _tag: \"Lost\" }>,\n) => {\n const { state } = change;\n const drain = state.draining.get(input.number);\n const current = servingOf(state);\n\n if (input.cause === \"declared\" && current?.number !== input.number) return;\n if (drain?._tag === \"Draining\") {\n change.events.push([input.number, new Lost({ cause: input.cause })]);\n revoke(change, input.number, \"lost\");\n } else if (state._tag !== \"Retired\" && current?.number === input.number) {\n change.events.push([input.number, new Lost({ cause: input.cause, detail: input.detail })]);\n if (state._tag !== \"Opening\")\n next(change, (state._tag === \"Open\" ? current.number : state.number) + 1, true);\n else {\n change.state = { ...state, serving: undefined };\n end(change, current, \"lost\");\n }\n }\n};\n\n/** Pure admission and lifecycle changes. A rejected hold preserves state identity. */\nexport const transition = <A, H = unknown>(\n state: State<A, H>,\n input: Input<A, H>,\n exclusive: boolean,\n now = 0,\n handover = 30_000,\n): Step<A, H> => {\n const change: Change<A, H> = {\n state,\n events: [],\n commands: [],\n exclusive,\n handover,\n now,\n };\n\n switch (input._tag) {\n case \"Hold\":\n case \"Let\":\n holds(change, input);\n break;\n case \"Revoke\":\n revoke(change, input.number);\n break;\n case \"Opened\": {\n const live = { ...input.live, holds: new Set<H>() };\n\n if (lookup(state, live.number) !== undefined) break;\n if (state._tag !== \"Opening\" || state.number !== live.number) end(change, live, \"retired\");\n else {\n change.events.push([live.number, new Open()]);\n change.commands.push({ _tag: \"Watch\", live });\n if (state.serving !== undefined) end(change, state.serving, \"rotated\");\n change.state = {\n _tag: \"Open\",\n serving: live,\n draining: change.state.draining,\n released: change.state.released,\n };\n }\n break;\n }\n case \"Failed\": {\n const { number, detail, cause } = input;\n\n if (state._tag === \"Opening\" && state.number === number)\n change.state = { ...state, _tag: \"Down\", detail, cause };\n change.events.push([number, new Down({ detail, cause })]);\n break;\n }\n case \"Abandoned\":\n change.events.push([input.number, new Closed({})]);\n break;\n case \"AttemptReleased\":\n change.state = { ...state, released: combine(state.released, input.released) };\n break;\n case \"Released\": {\n const drain = state.draining.get(input.number);\n\n if (drain === undefined || drain._tag === \"Draining\" || drain.live.holds.size > 0) break;\n const draining = new Map(state.draining);\n\n draining.delete(input.number);\n change.state = { ...state, draining, released: combine(state.released, input.released) };\n change.events.push([\n input.number,\n input.released === undefined ? new Kept() : new Closed({ released: input.released }),\n ]);\n break;\n }\n case \"Lost\":\n lost(change, input);\n break;\n case \"Rotate\": {\n if (\n state._tag === \"Retired\" ||\n (input.due !== undefined && (state._tag !== \"Open\" || state.serving.number !== input.due))\n )\n break;\n change.reply =\n state._tag === \"Opening\"\n ? state.number\n : (state._tag === \"Open\" ? state.serving.number : state.number) + 1;\n if (state._tag !== \"Opening\") next(change, change.reply, false);\n break;\n }\n case \"Keep\":\n case \"Retire\":\n if (state._tag === \"Retired\") break;\n for (const number of state.draining.keys()) revoke(change, number, \"retired\");\n if (state.serving !== undefined) end(change, state.serving, \"retired\", input._tag === \"Keep\");\n change.state = {\n _tag: \"Retired\",\n draining: change.state.draining,\n released: change.state.released,\n };\n }\n\n return change;\n};\n\n/** Later confirmations cannot establish that an earlier unconfirmed session ended. */\nexport const combine = (before: Released | undefined, next: Released | undefined) =>\n before?._tag === \"Unconfirmed\" ? before : (next ?? before);\n\nexport type Resolution<A> =\n | { readonly _tag: \"Serve\"; readonly live: Live<A> }\n | {\n readonly _tag: \"Unavailable\";\n readonly reason: \"down\" | \"retired\";\n readonly detail: string;\n readonly cause?: unknown;\n };\n\n/** An unheld browser resolution; use obtains its hold atomically through Hold instead. */\nexport const resolve = <A, H>(\n state: State<A, H>,\n target: number | undefined,\n): Resolution<A> | undefined => {\n if (state._tag === \"Retired\")\n return { _tag: \"Unavailable\", reason: \"retired\", detail: \"the supervisor was retired\" };\n if (\n state.serving !== undefined &&\n (target === undefined || (state._tag === \"Open\" && state.serving.number >= target))\n )\n return { _tag: \"Serve\", live: state.serving };\n if (state._tag === \"Down\" && (target === undefined || state.number >= target))\n return { _tag: \"Unavailable\", reason: \"down\", detail: state.detail, cause: state.cause };\n\n return undefined;\n};\n","/**\n * A browser kept open across losses and session ends, as a series of generations, each a new\n * browser from the same provider. Pages don't carry over from one generation to the next.\n *\n * `make` opens the first generation at once with the provider's `open`, in a scope of its own, so\n * a caller that stops waiting never interrupts a half-open browser. `browser` gives the current\n * generation; callers wait, bounded, and share one open. A loss is published at once and the next\n * generation opens on the `reopen` schedule, which also retries a failed open, unless the provider\n * deems its failure `definite`: that goes `Down` at once, with its cause. `rotate` opens the\n * next generation now, and so does the time `rotateBefore` ahead of a generation's `expiresAt`. A\n * rotation makes the next generation before it breaks the current one, unless generations are\n * `exclusive`, as sessions saving to one stored context must be: then the current one is released\n * first. `retire` stops reopening at once and releases what is open; the scope's close retires\n * too, unless the supervisor `keep`s: then it leaves the serving generation running, `Kept`. `states`\n * publishes each generation's changes, with the provider's release outcome last.\n *\n * Providers supply the specifics: `Browserbase.supervise` opens hosted sessions this way.\n *\n * @since 0.3.0\n */\nimport {\n Cause,\n Clock,\n Context,\n DateTime,\n Deferred,\n Duration,\n Effect,\n Exit,\n FiberHandle,\n FiberMap,\n Option,\n Predicate,\n PubSub,\n Schedule,\n Schema,\n Scope,\n Semaphore,\n Stream,\n SubscriptionRef,\n type Take,\n} from \"effect\";\n\nimport type * as Browser from \"./Browser.ts\";\nimport * as Lifecycle from \"./internal/supervisor/lifecycle.ts\";\n\nexport {\n Closed,\n Down,\n Draining,\n GenerationState,\n Kept,\n Lost,\n Open,\n Opening,\n Released,\n Reopening,\n Settled,\n Unconfirmed,\n} from \"./internal/supervisor/lifecycle.ts\";\n\n/** One change in a generation's life. `at` is wall-clock epoch milliseconds from the Effect `Clock`. */\nexport class Generation extends Schema.Class<Generation>(\"effect-browser/Generation\")({\n number: Schema.Int.check(Schema.isGreaterThan(0)),\n at: Schema.Finite,\n hostTime: Schema.Finite,\n state: Lifecycle.GenerationState,\n}) {}\n\n/**\n * No browser to give: none opened within `waitTimeout` (`opening`), the latest generation failed\n * to open (`down`, with what it failed with as `cause`), or the supervisor was retired.\n */\nexport class Unavailable extends Schema.TaggedError<Unavailable>()(\"Unavailable\", {\n reason: Schema.Literals([\"opening\", \"down\", \"retired\"]),\n detail: Schema.String,\n cause: Schema.optional(Schema.Defect()),\n}) {\n override get message() {\n return `no browser: ${this.detail}`;\n }\n}\n\n/** One generation, as a provider opened it in the scope the supervisor gave it. */\nexport interface Opened<A = void> {\n readonly value: A;\n readonly browser: Browser.Service;\n /**\n * End the generation, and say whether the provider confirmed its end. The supervisor asks it\n * before it closes the generation's scope; without it, closing the scope ends the generation,\n * which counts as `Settled`.\n */\n readonly release?: Effect.Effect<Lifecycle.Released> | undefined;\n}\n\n/** Facts available before an acquisition attempt; awaiting `after` never changes release order. */\nexport interface Admission {\n readonly number: number;\n /**\n * Every earlier session that stopped serving, including failed attempts and older drains.\n * Waits for all pending releases; an Unconfirmed end remains visible to later attempts.\n * Undefined before any release. A still-serving nonexclusive predecessor is excluded.\n */\n readonly after: Effect.Effect<Lifecycle.Released> | undefined;\n}\n\n/**\n * Optional service supplied during `open`. Providers report failed-attempt cleanup here before\n * their scope closes; successful generations instead return `Opened.release`. Reporting does\n * not release resources or replace the original acquisition failure.\n */\nexport class Releasing extends Context.Service<\n Releasing,\n { readonly released: (outcome: Lifecycle.Released) => Effect.Effect<void> }\n>()(\"effect-browser/Supervisor/Releasing\") {}\n\nexport interface Options<E, R, A = void> {\n /** Opens one generation in the scope it is given. */\n readonly open: Effect.Effect<Opened<A>, E, R>;\n /** Runs before every open attempt, including the first; failures follow `reopen` and `definite`. */\n readonly admit?: ((opening: Admission) => Effect.Effect<void, E, R>) | undefined;\n /** When to try a failed open again. Defaults to exponential from 1 second, for 5 minutes. */\n readonly reopen?: Schedule.Schedule<unknown, E> | undefined;\n /**\n * Failures no new try mends, such as a refused key: an open that fails so is `Down` at once.\n * Defaults to none.\n */\n readonly definite?: ((error: E) => boolean) | undefined;\n /**\n * Rotate this long ahead of a generation's `expiresAt`, but no sooner than halfway through its\n * life. Without it, a generation's end is a loss.\n */\n readonly rotateBefore?: Duration.Input | undefined;\n /** Generations must not overlap: a rotation releases the current one before it opens the next. */\n readonly exclusive?: boolean | undefined;\n /** Finite, nonnegative time outgoing holds may finish; defaults to 30 seconds. */\n readonly handover?: Duration.Input | undefined;\n /**\n * Closing the scope leaves the serving generation running, `Kept`: it closes the generation's\n * scope but never asks `release`. For providers whose scope only disconnects, such as\n * `Browserbase.supervise` with `keep`. `retire` still releases it.\n */\n readonly keep?: boolean | undefined;\n /** How long `browser` and `rotate` wait for a generation to open. Defaults to 2 minutes. */\n readonly waitTimeout?: Duration.Input | undefined;\n}\n\n/** Work whose generation was revoked; input receipts still determine whether input reached a site. */\nexport class Superseded extends Schema.TaggedError<Superseded>()(\"Superseded\", {\n generation: Schema.Int,\n reason: Schema.Literals([\"rotated\", \"lost\", \"retired\"]),\n revokeAt: Schema.Finite,\n}) {}\n\nexport interface Lease<A> {\n readonly generation: number;\n readonly browser: Browser.Service;\n readonly value: A;\n /** Declare this serving generation unusable and revoke it now; stale declarations do nothing. */\n readonly lose: (detail: string) => Effect.Effect<void>;\n /** First notice that serving ended; loss or retirement may revoke before its deadline. */\n readonly ending: Effect.Effect<Superseded>;\n /** An independent scope; its resources close before provider release. Fails once revoked. */\n readonly retain: Effect.Effect<Scope.Closeable, Superseded>;\n}\n\nexport interface UseOptions {\n /** Finite, nonnegative wait for a serving generation. Zero makes an immediate attempt. */\n readonly wait?: Duration.Input | undefined;\n}\n\nexport interface Supervisor<A = void> {\n /** Scoped work on the current generation. Revocation interrupts it and waits for its cleanup. */\n readonly use: <B, E, R>(\n work: (lease: Lease<A>) => Effect.Effect<B, E, R>,\n options?: UseOptions,\n ) => Effect.Effect<B, E | Unavailable | Superseded, Exclude<R, Scope.Scope>>;\n /** The current generation's browser, waiting up to `waitTimeout` while none is open. */\n readonly browser: Effect.Effect<Browser.Service, Unavailable>;\n /** Each generation's changes, in order. A new reader first gets the latest 64; ends on retiring. */\n readonly states: Stream.Stream<Generation>;\n /** Open the next generation now, or join the one opening, and wait for it. */\n readonly rotate: Effect.Effect<Browser.Service, Unavailable>;\n /** Stop opening at once, release every generation, and wait until each release has finished. */\n readonly retire: Effect.Effect<void>;\n}\n\ntype Hold =\n | { readonly _tag: \"Use\" }\n | { readonly _tag: \"Retained\"; readonly scope: Scope.Closeable };\n\ninterface Held<A> {\n readonly opened: Opened<A>;\n readonly ending: Deferred.Deferred<Superseded>;\n readonly revoked: Deferred.Deferred<Superseded>;\n readonly released: Deferred.Deferred<Lifecycle.Released>;\n readonly scope: Scope.Closeable;\n}\n\ntype State<A> = Lifecycle.State<Held<A>, Hold>;\ntype Input<A> = Lifecycle.Input<Held<A>, Hold>;\ntype Step<A> = Lifecycle.Step<Held<A>, Hold>;\ntype Apply<A> = (input: Input<A>) => Effect.Effect<Step<A>>;\n\nconst superseded = (generation: number, { reason, revokeAt }: Lifecycle.Draining) =>\n new Superseded({ generation, reason, revokeAt });\n\nconst retired = () => new Unavailable({ reason: \"retired\", detail: \"the supervisor was retired\" });\n\nconst describe = (cause: Cause.Cause<unknown>) => {\n const error = Cause.squash(cause);\n\n return Predicate.isError(error) ? error.message : String(error);\n};\n\nconst timedOut = () =>\n new Unavailable({ reason: \"opening\", detail: \"no generation opened within the wait\" });\n\nconst bounded = (input: Duration.Input, name: string) =>\n Effect.suspend(() => {\n const duration = Duration.fromInput(input);\n\n return Option.isSome(duration) &&\n Duration.isFinite(duration.value) &&\n !Duration.isNegative(duration.value)\n ? Effect.succeed(duration.value)\n : Effect.die(new RangeError(`${name} must be a finite nonnegative duration`));\n });\n\n/** Resolve immediately before starting a bounded wait, including when its duration is zero. */\nconst waitFor = <A, H>(\n state: SubscriptionRef.SubscriptionRef<Lifecycle.State<A, H>>,\n wait: Duration.Duration,\n clock: Clock.Clock,\n target?: number,\n) => {\n const result = (resolution: Lifecycle.Resolution<A>) =>\n resolution._tag === \"Serve\"\n ? Effect.succeed(resolution.live)\n : Effect.fail(new Unavailable(resolution));\n\n return Effect.suspend(() => {\n const current = Lifecycle.resolve(state.value, target);\n\n return current === undefined\n ? SubscriptionRef.changes(state).pipe(\n Stream.map((state) => Lifecycle.resolve(state, target)),\n Stream.filter(Predicate.isNotUndefined),\n Stream.runHead,\n Effect.flatMap(Option.match({ onNone: () => Effect.fail(retired()), onSome: result })),\n Effect.timeoutOrElse({ duration: wait, orElse: () => Effect.fail(timedOut()) }),\n )\n : result(current);\n }).pipe(Effect.provideService(Clock.Clock, clock));\n};\n\n/** Sleep until `before` ahead of `expiresAt`, but no sooner than halfway there from now. */\nconst untilRotation = (expiresAt: DateTime.Utc, before: Duration.Duration) =>\n Clock.currentTimeMillis.pipe(\n Effect.flatMap((now) => {\n const left = DateTime.toEpochMillis(expiresAt) - now;\n\n return Effect.sleep(Duration.millis(Math.max(left - Duration.toMillis(before), left / 2, 0)));\n }),\n );\n\n/** Native timers may wake a fraction early; a revocation must reach its monotonic deadline. */\nconst until = (at: number, now: () => number): Effect.Effect<void> =>\n Effect.suspend(() =>\n now() >= at\n ? Effect.void\n : Effect.sleep(Duration.millis(Math.ceil(at - now()))).pipe(Effect.andThen(until(at, now))),\n );\n\n/** Borrowed work and transferred scopes hold a generation until cleanup lets it go. */\nconst leasing = <A>(\n state: SubscriptionRef.SubscriptionRef<State<A>>,\n apply: Apply<A>,\n waitTimeout: Duration.Duration,\n now: () => number,\n clock: Clock.Clock,\n) => {\n const borrow = Effect.fnUntraced(function* (hold: Hold, wait: Duration.Duration) {\n const until = now() + Duration.toMillis(wait);\n\n for (;;) {\n const step = yield* apply({ _tag: \"Hold\", hold });\n\n if (step.borrowed !== undefined) return step.borrowed;\n yield* waitFor(state, Duration.millis(Math.max(0, until - now())), clock).pipe(\n Effect.interruptible,\n );\n if (now() >= until) return yield* timedOut();\n }\n });\n\n const leaseOf = (live: Lifecycle.Live<Held<A>>): Lease<A> => ({\n generation: live.number,\n browser: live.value.opened.browser,\n value: live.value.opened.value,\n lose: (detail) =>\n apply({ _tag: \"Lost\", number: live.number, cause: \"declared\", detail }).pipe(Effect.asVoid),\n ending: Deferred.await(live.value.ending),\n retain: Effect.uninterruptible(\n Effect.gen(function* () {\n const scope = yield* Scope.make();\n const hold: Hold = { _tag: \"Retained\", scope };\n const step = yield* apply({ _tag: \"Hold\", number: live.number, hold });\n\n if (step.borrowed === undefined) {\n yield* Scope.close(scope, Exit.void);\n\n return yield* yield* Deferred.await(live.value.ending);\n }\n yield* Scope.addFinalizer(\n scope,\n apply({ _tag: \"Let\", number: live.number, hold }).pipe(Effect.asVoid),\n );\n\n return scope;\n }),\n ),\n });\n\n const use: Supervisor<A>[\"use\"] = (work, options = {}) =>\n Effect.scoped(\n Effect.gen(function* () {\n const hold: Hold = { _tag: \"Use\" };\n const wait = yield* bounded(options.wait ?? waitTimeout, \"wait\");\n\n const live = yield* Effect.acquireRelease(borrow(hold, wait), (live) =>\n apply({ _tag: \"Let\", number: live.number, hold }).pipe(Effect.asVoid),\n );\n\n const revoked = Deferred.await(live.value.revoked).pipe(Effect.flatMap(Effect.fail));\n\n return yield* Effect.raceFirst(\n work(leaseOf(live)).pipe(\n // Declaring loss and returning can finish before the race's other fiber runs.\n Effect.tap(() =>\n Deferred.isDone(live.value.revoked).pipe(\n Effect.flatMap((done) => (done ? revoked : Effect.void)),\n ),\n ),\n ),\n revoked,\n );\n }),\n );\n\n return use;\n};\n\ntype Provider = Omit<Opened, \"value\">;\ntype MakeOptions<E, R, A> = Omit<Options<E, R, A>, \"open\"> & {\n readonly open: Effect.Effect<Opened<A> | Provider, E, R>;\n};\n\nconst acquireGeneration = <A, E, R>(\n open: Effect.Effect<Opened<A> | Provider, E, R>,\n own: Scope.Scope,\n) =>\n Effect.uninterruptibleMask((restore) =>\n Effect.flatMap(Scope.fork(own), (scope) =>\n restore(open.pipe(Scope.provide(scope))).pipe(\n Effect.onError((cause) => Scope.close(scope, Exit.failCause(cause))),\n Effect.map((opened): Held<A | void> => ({\n opened: { ...opened, value: \"value\" in opened ? opened.value : undefined },\n scope,\n ending: Deferred.makeUnsafe<Superseded>(),\n revoked: Deferred.makeUnsafe<Superseded>(),\n released: Deferred.makeUnsafe<Lifecycle.Released>(),\n })),\n ),\n ),\n );\n\nconst watchGeneration = <A>(\n live: Lifecycle.Live<Held<A>>,\n rotateBefore: Duration.Duration | undefined,\n apply: Apply<A>,\n) => {\n const { browser } = live.value.opened;\n\n const loss = browser.disconnected.pipe(\n Effect.flatMap((cause) => apply({ _tag: \"Lost\", number: live.number, cause })),\n );\n\n const rotation =\n browser.expiresAt === undefined || rotateBefore === undefined\n ? Effect.void\n : untilRotation(browser.expiresAt, rotateBefore).pipe(\n Effect.andThen(apply({ _tag: \"Rotate\", due: live.number })),\n );\n\n return Effect.all([loss, rotation], { concurrency: 2, discard: true });\n};\n\n// After revocation, retained resources and use finalizers let go before the provider.\nconst releaseGeneration = Effect.fnUntraced(function* <A>(\n command: Extract<Lifecycle.Command<Held<A>>, { readonly _tag: \"Release\" | \"Leave\" }>,\n state: SubscriptionRef.SubscriptionRef<State<A>>,\n apply: Apply<A>,\n) {\n const { live } = command;\n\n const cleaned = yield* Effect.forEach(\n Lifecycle.lookup(state.value, live.number)?.holds ?? [],\n (hold) =>\n Effect.exit(hold._tag === \"Retained\" ? Scope.close(hold.scope, Exit.void) : Effect.void),\n { concurrency: 8 },\n );\n\n yield* SubscriptionRef.changes(state).pipe(\n Stream.filter((current) => (Lifecycle.lookup(current, live.number)?.holds.size ?? 0) === 0),\n Stream.runHead,\n );\n\n const released =\n command._tag === \"Leave\"\n ? undefined\n : yield* (live.value.opened.release ?? Effect.succeed(new Lifecycle.Settled())).pipe(\n Effect.catchCause((cause) =>\n Effect.succeed(\n new Lifecycle.Unconfirmed({ detail: `the release failed: ${describe(cause)}` }),\n ),\n ),\n );\n\n const closed = yield* Effect.exit(Scope.close(live.value.scope, Exit.void));\n\n yield* apply({ _tag: \"Released\", number: live.number, released });\n if (released !== undefined) yield* Deferred.succeed(live.value.released, released);\n yield* Exit.asVoidAll([...cleaned, closed]);\n});\n\nconst admissionAfter = <A>(state: State<A>) => {\n const released = state.released;\n\n const pending = [...state.draining.values()]\n .filter((drain) => drain._tag !== \"Leaving\")\n .map(({ live }) => live.value.released);\n\n return pending.length === 0 && released === undefined\n ? undefined\n : Effect.gen(function* () {\n let outcome = released;\n\n for (const release of pending)\n outcome = Lifecycle.combine(outcome, yield* Deferred.await(release));\n\n return outcome ?? new Lifecycle.Settled();\n });\n};\n\nconst makeScoped = Effect.fn(\"Supervisor.make\")(function* <E, R, A>(\n options: MakeOptions<E, R, A>,\n): Effect.fn.Return<Supervisor<A | void>, never, Scope.Scope | Exclude<R, Scope.Scope>> {\n const clock = yield* Clock.Clock;\n const now = () => Number(clock.monotonicTimeNanosUnsafe()) / 1e6;\n const context = yield* Effect.context<Exclude<R, Scope.Scope>>();\n const own = yield* Scope.fork(yield* Effect.scope);\n const exclusive = options.exclusive ?? false;\n\n const reopen: Schedule.Schedule<unknown, E> =\n options.reopen ??\n Schedule.exponential(\"1 second\").pipe(Schedule.upTo({ duration: Duration.minutes(5) }));\n\n const rotateBefore =\n options.rotateBefore === undefined ? undefined : Duration.fromInputUnsafe(options.rotateBefore);\n\n const waitTimeout = yield* bounded(options.waitTimeout ?? Duration.minutes(2), \"waitTimeout\");\n\n const handover = Duration.toMillis(\n yield* bounded(options.handover ?? Duration.seconds(30), \"handover\"),\n );\n\n const started = Lifecycle.start<Held<A | void>, Hold>();\n const state = yield* SubscriptionRef.make(started.state);\n const applying = yield* Semaphore.make(1);\n const events = yield* PubSub.unbounded<Take.Take<Generation>>({ replay: 64 });\n const opening = yield* FiberHandle.make<unknown, never>();\n const releases = yield* FiberMap.make<number, unknown, never>();\n const runOpen = yield* FiberHandle.runtime(opening)();\n const runRelease = yield* FiberMap.runtime(releases)();\n\n const apply: Apply<A | void> = Effect.fnUntraced(\n function* (input: Input<A | void>) {\n const current = state.value;\n const step = Lifecycle.transition(current, input, exclusive, now(), handover);\n\n if (step.state !== current) yield* SubscriptionRef.set(state, step.state);\n yield* perform(step);\n\n return step;\n },\n (effect) => applying.withPermit(effect),\n Effect.uninterruptible,\n Effect.provideService(Clock.Clock, clock),\n );\n\n const perform = Effect.fnUntraced(function* (step: Step<A | void>): Effect.fn.Return<void> {\n for (const [number, generation] of step.events)\n PubSub.publishUnsafe(events, [\n new Generation({\n number,\n at: clock.currentTimeMillisUnsafe(),\n hostTime: now(),\n state: generation,\n }),\n ]);\n for (const command of step.commands)\n switch (command._tag) {\n case \"Open\":\n runOpen(openGeneration(command.number));\n break;\n case \"Watch\":\n yield* Effect.forkIn(\n Effect.provideContext(watchGeneration(command.live, rotateBefore, apply), context),\n command.live.value.scope,\n );\n break;\n case \"Drain\": {\n const ending = superseded(command.live.number, command.ending);\n\n yield* Deferred.succeed(command.live.value.ending, ending);\n yield* Effect.forkIn(\n until(ending.revokeAt, now).pipe(\n Effect.andThen(\n Effect.suspend(() => apply({ _tag: \"Revoke\", number: command.live.number })),\n ),\n ),\n command.live.value.scope,\n );\n break;\n }\n case \"Release\":\n case \"Leave\":\n yield* Deferred.succeed(\n command.live.value.revoked,\n superseded(command.live.number, command.ending),\n );\n runRelease(command.live.number, releaseGeneration(command, state, apply));\n break;\n }\n });\n\n const openGeneration = (number: number) => {\n const openOnce = acquireGeneration(\n Effect.gen(function* () {\n const after = admissionAfter(state.value);\n\n if (exclusive && after !== undefined) yield* after;\n yield* options.admit?.({ number, after }) ?? Effect.void;\n\n return yield* options.open.pipe(\n Effect.provideService(Releasing, {\n released: (released) =>\n apply({ _tag: \"AttemptReleased\", released }).pipe(Effect.asVoid),\n }),\n );\n }),\n own,\n ).pipe(Effect.provideContext(context));\n\n return Effect.uninterruptibleMask((restore) =>\n restore(\n Effect.retry(openOnce, {\n schedule: reopen,\n while: (error) => !options.definite?.(error),\n }),\n ).pipe(\n Effect.exit,\n Effect.flatMap((exit) => {\n if (Exit.isSuccess(exit))\n return apply({ _tag: \"Opened\", live: { number, value: exit.value } });\n const cause = exit.cause;\n\n return apply(\n Cause.hasInterruptsOnly(cause)\n ? { _tag: \"Abandoned\", number }\n : { _tag: \"Failed\", number, detail: describe(cause), cause: Cause.squash(cause) },\n );\n }),\n ),\n );\n };\n\n const end = yield* Effect.cached(PubSub.publish(events, Exit.void));\n\n const stop = Effect.fnUntraced(function* (input: Input<A | void>) {\n yield* apply(input);\n yield* FiberHandle.clear(opening);\n yield* FiberMap.awaitEmpty(releases);\n if (yield* Deferred.isDone(releases.deferred)) yield* FiberMap.join(releases);\n }, Effect.ensuring(end));\n\n const retire = yield* Effect.cached(stop({ _tag: \"Retire\" }));\n\n yield* Effect.addFinalizer(() => (options.keep === true ? stop({ _tag: \"Keep\" }) : retire));\n yield* perform(started);\n\n return {\n browser: Effect.map(waitFor(state, waitTimeout, clock), (live) => live.value.opened.browser),\n use: leasing(state, apply, waitTimeout, now, clock),\n states: Stream.fromPubSubTake(events),\n rotate: apply({ _tag: \"Rotate\" }).pipe(\n Effect.flatMap(({ reply }) =>\n reply === undefined\n ? Effect.fail(retired())\n : Effect.map(\n waitFor(state, waitTimeout, clock, reply),\n (live) => live.value.opened.browser,\n ),\n ),\n ),\n retire,\n };\n});\n\n/** Supervise scoped generation values. Browser-only providers retain their existing void value. */\nexport function make<E, R, A = void>(\n options: Options<E, R, A>,\n): Effect.Effect<Supervisor<A>, never, Scope.Scope | Exclude<R, Scope.Scope>>;\n\nexport function make<E, R>(\n options: MakeOptions<E, R, never>,\n): Effect.Effect<Supervisor<void>, never, Scope.Scope | Exclude<R, Scope.Scope>>;\n\nexport function make<E, R, A>(options: MakeOptions<E, R, A>) {\n return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,KAAA,IACN,OAAO,KAAK,QAAQ,CAAC,IACrB,OAAO,IACL,QAAQ,OAAO,aAAa,OAAO,KAAK,IACvC,SAAS,KAAK,MAAM,OAAO,OAC9B,CACN,CACF;EACA;CACF;AACF,CAAC;AAWD,SAAgB,KAAc,SAA+B;CAC3D,OAAO,WAAW,OAAO;AAC3B"}
|
package/dist/Supervisor.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { Admission, Closed, Down, Draining, Generation, GenerationState, Kept, Lease, Lost, Open, Opened, Opening, Options, Released, Reopening, Settled, Superseded, Supervisor, Unavailable, Unconfirmed, UseOptions, make };
|
|
1
|
+
import { C as Settled, S as Reopening, _ as Kept, a as Options, b as Opening, c as Supervisor, d as UseOptions, f as make, g as GenerationState, h as Draining, i as Opened, m as Down, n as Generation, o as Releasing, p as Closed, r as Lease, s as Superseded, t as Admission, u as Unavailable, v as Lost, w as Unconfirmed, x as Released, y as Open } from "./Supervisor-5tZ47hR5.mjs";
|
|
2
|
+
export { Admission, Closed, Down, Draining, Generation, GenerationState, Kept, Lease, Lost, Open, Opened, Opening, Options, Released, Releasing, Reopening, Settled, Superseded, Supervisor, Unavailable, Unconfirmed, UseOptions, make };
|
package/dist/Supervisor.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { Closed, Down, Draining, Generation, GenerationState, Kept, Lost, Open, Opening, Released, Reopening, Settled, Superseded, Unavailable, Unconfirmed, make };
|
|
1
|
+
import { _ as Settled, a as Unavailable, c as Down, d as Kept, f as Lost, g as Reopening, h as Released, l as Draining, m as Opening, n as Releasing, o as make, p as Open, r as Superseded, s as Closed, t as Generation, u as GenerationState, v as Unconfirmed } from "./Supervisor-DaGlQVjv.mjs";
|
|
2
|
+
export { Closed, Down, Draining, Generation, GenerationState, Kept, Lost, Open, Opening, Released, Releasing, Reopening, Settled, Superseded, Unavailable, Unconfirmed, make };
|
package/dist/index.d.mts
CHANGED
|
@@ -13,5 +13,5 @@ import { r as Plan_d_exports } from "./Plan-6As6vcwT.mjs";
|
|
|
13
13
|
import { t as Policy_d_exports } from "./Policy.mjs";
|
|
14
14
|
import { t as Presentation_d_exports } from "./Presentation.mjs";
|
|
15
15
|
import { t as Stage_d_exports } from "./Stage.mjs";
|
|
16
|
-
import {
|
|
16
|
+
import { l as Supervisor_d_exports } from "./Supervisor-5tZ47hR5.mjs";
|
|
17
17
|
export { Browser_d_exports as Browser, BrowserError_d_exports as BrowserError, BrowserEvent_d_exports as BrowserEvent, Cdp_d_exports as Cdp, Change_d_exports as Change, Chromium_d_exports as Chromium, Expect_d_exports as Expect, Frame_d_exports as Frame, Moment_d_exports as Moment, Motion_d_exports as Motion, Page_d_exports as Page, Plan_d_exports as Plan, Policy_d_exports as Policy, Presentation_d_exports as Presentation, Snapshot_d_exports as Snapshot, Stage_d_exports as Stage, Supervisor_d_exports as Supervisor };
|
package/dist/index.mjs
CHANGED
|
@@ -14,5 +14,5 @@ import { r as Plan_exports } from "./Plan-CXA2BW-G.mjs";
|
|
|
14
14
|
import { t as Policy_exports } from "./Policy.mjs";
|
|
15
15
|
import { t as Presentation_exports } from "./Presentation.mjs";
|
|
16
16
|
import { t as Stage_exports } from "./Stage.mjs";
|
|
17
|
-
import {
|
|
17
|
+
import { i as Supervisor_exports } from "./Supervisor-DaGlQVjv.mjs";
|
|
18
18
|
export { Browser_exports as Browser, BrowserError_exports as BrowserError, BrowserEvent_exports as BrowserEvent, Cdp_exports as Cdp, Change_exports as Change, Chromium_exports as Chromium, Expect_exports as Expect, Frame_exports as Frame, Moment_exports as Moment, Motion_exports as Motion, Page_exports as Page, Plan_exports as Plan, Policy_exports as Policy, Presentation_exports as Presentation, Snapshot_exports as Snapshot, Stage_exports as Stage, Supervisor_exports as Supervisor };
|