brass-runtime 1.14.0 → 1.16.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 (90) hide show
  1. package/README.md +410 -135
  2. package/dist/agent/cli/main.cjs +49 -43
  3. package/dist/agent/cli/main.js +11 -5
  4. package/dist/agent/cli/main.mjs +11 -5
  5. package/dist/agent/index.cjs +8 -3
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +7 -2
  8. package/dist/agent/index.mjs +7 -2
  9. package/dist/{chunk-BMRF4FN6.js → chunk-2WC63LJK.mjs} +68 -242
  10. package/dist/chunk-3RG5ZIWI.js +10 -0
  11. package/dist/chunk-45F7OKGT.cjs +104 -0
  12. package/dist/chunk-5YOQOXEQ.cjs +2491 -0
  13. package/dist/chunk-7HUOJA4W.cjs +493 -0
  14. package/dist/{chunk-4N2JEK4H.mjs → chunk-7LVI2GIN.js} +252 -495
  15. package/dist/chunk-7TL2LHQJ.js +2491 -0
  16. package/dist/chunk-7V4KY4RL.mjs +104 -0
  17. package/dist/chunk-7XOPAB5Q.js +2143 -0
  18. package/dist/chunk-CCKHV5BT.mjs +193 -0
  19. package/dist/chunk-CY33PGEX.mjs +1110 -0
  20. package/dist/chunk-DJQ7OMMB.cjs +144 -0
  21. package/dist/chunk-F5EUMJL7.mjs +2143 -0
  22. package/dist/chunk-FM4W4QPL.js +193 -0
  23. package/dist/chunk-G3XGCZDQ.js +131 -0
  24. package/dist/{chunk-JT7D6M5H.js → chunk-G6IQOE4P.mjs} +252 -495
  25. package/dist/chunk-GOV47PPB.mjs +552 -0
  26. package/dist/chunk-H55LI6WY.js +93 -0
  27. package/dist/chunk-IJT6RRQ5.cjs +93 -0
  28. package/dist/chunk-J3H54ZRV.mjs +131 -0
  29. package/dist/chunk-JF4XXPZ5.cjs +552 -0
  30. package/dist/chunk-JNFRRJYH.cjs +2143 -0
  31. package/dist/chunk-JX3LZQJH.cjs +354 -0
  32. package/dist/chunk-K2T3DV26.mjs +93 -0
  33. package/dist/chunk-KCPT2D6G.js +552 -0
  34. package/dist/chunk-MWXMNYJS.cjs +1110 -0
  35. package/dist/{chunk-XTMZTVIT.cjs → chunk-N6VHMOWB.cjs} +140 -134
  36. package/dist/{chunk-WJESVBWN.js → chunk-NC5SDRYE.js} +16 -10
  37. package/dist/chunk-NOYZIMUJ.mjs +144 -0
  38. package/dist/chunk-NYL4D7SK.cjs +131 -0
  39. package/dist/chunk-OBGZSXTJ.cjs +10 -0
  40. package/dist/{chunk-UWMMYKVK.mjs → chunk-OOGJ73B6.js} +68 -242
  41. package/dist/chunk-PNVFW245.js +144 -0
  42. package/dist/chunk-PRWCB3QL.mjs +2491 -0
  43. package/dist/chunk-QY5FKYEQ.js +1110 -0
  44. package/dist/chunk-ROJC3NBJ.js +104 -0
  45. package/dist/chunk-SPUEME2B.cjs +343 -0
  46. package/dist/chunk-TDVMADDN.js +343 -0
  47. package/dist/chunk-TVN5I4U6.cjs +193 -0
  48. package/dist/chunk-U5KWK3PX.mjs +343 -0
  49. package/dist/chunk-VFIUZG7J.mjs +354 -0
  50. package/dist/{chunk-BKBFSOGT.cjs → chunk-WQ5QNU5R.cjs} +460 -703
  51. package/dist/chunk-XDZOO4L5.js +354 -0
  52. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  53. package/dist/{chunk-MQF7HZ7Y.mjs → chunk-ZGLD4TVZ.mjs} +16 -10
  54. package/dist/client-CtFmoDvM.d.ts +645 -0
  55. package/dist/core/index.cjs +284 -0
  56. package/dist/core/index.d.ts +567 -0
  57. package/dist/core/index.js +284 -0
  58. package/dist/core/index.mjs +284 -0
  59. package/dist/{effect-DM56H743.d.ts → effect-CGNl5Rqp.d.ts} +118 -11
  60. package/dist/effectRunner-3ZHAD3LE.cjs +8 -0
  61. package/dist/effectRunner-A4CHJXJI.js +8 -0
  62. package/dist/effectRunner-OPUF6QRN.mjs +8 -0
  63. package/dist/http/index.cjs +4130 -890
  64. package/dist/http/index.d.ts +2289 -219
  65. package/dist/http/index.js +4116 -876
  66. package/dist/http/index.mjs +4116 -876
  67. package/dist/http/testing.cjs +159 -0
  68. package/dist/http/testing.d.ts +42 -0
  69. package/dist/http/testing.js +159 -0
  70. package/dist/http/testing.mjs +159 -0
  71. package/dist/index.cjs +305 -1168
  72. package/dist/index.d.ts +9 -701
  73. package/dist/index.js +176 -1039
  74. package/dist/index.mjs +176 -1039
  75. package/dist/observability/index.cjs +677 -0
  76. package/dist/observability/index.d.ts +79 -0
  77. package/dist/observability/index.js +677 -0
  78. package/dist/observability/index.mjs +677 -0
  79. package/dist/schedule-Fque9Abz.d.ts +70 -0
  80. package/dist/schema/index.cjs +25 -0
  81. package/dist/schema/index.d.ts +177 -0
  82. package/dist/schema/index.js +25 -0
  83. package/dist/schema/index.mjs +25 -0
  84. package/dist/server-C8hDXA74.d.ts +674 -0
  85. package/dist/stream-dvSs0QS5.d.ts +74 -0
  86. package/dist/tracer-B5tRH9H7.d.ts +230 -0
  87. package/dist/tracing-Dt9S_6V8.d.ts +148 -0
  88. package/package.json +37 -3
  89. package/dist/chunk-SKVY72E5.cjs +0 -667
  90. package/dist/stream-Oqe6WeLE.d.ts +0 -173
package/dist/index.js CHANGED
@@ -1,3 +1,77 @@
1
+ import {
2
+ LinkedQueue,
3
+ RuntimeRegistry,
4
+ Supervisor,
5
+ assertCompletesWithin,
6
+ assertFails,
7
+ assertFailsWith,
8
+ assertSucceeds,
9
+ catchTag,
10
+ catchTags,
11
+ compose,
12
+ consoleJsonLogger,
13
+ defaultTracer,
14
+ delayedEffect,
15
+ derivedRef,
16
+ dumpAllFibers,
17
+ flakyEffect,
18
+ gracefulShutdown,
19
+ joinSupervised,
20
+ layer,
21
+ layerFail,
22
+ layerFrom,
23
+ layerSucceed,
24
+ linkAbortController,
25
+ makeCancelToken,
26
+ makeRef,
27
+ makeSemaphore,
28
+ makeSupervisor,
29
+ makeTestRuntime,
30
+ makeTracer,
31
+ makeWorkerPool,
32
+ mapError as mapError2,
33
+ mapLayer,
34
+ merge,
35
+ neverEffect,
36
+ orElse,
37
+ provideLayer,
38
+ registerShutdownHooks,
39
+ supervise,
40
+ tagError
41
+ } from "./chunk-QY5FKYEQ.js";
42
+ import {
43
+ Resource,
44
+ andThen,
45
+ bracket,
46
+ contramap,
47
+ elapsed,
48
+ ensuring,
49
+ exponential,
50
+ fibonacci,
51
+ fixed,
52
+ intersect,
53
+ jitter,
54
+ jittered,
55
+ jitteredSchedule,
56
+ makeCircuitBreaker,
57
+ makeResource,
58
+ managed,
59
+ managedAll,
60
+ map as map2,
61
+ recurs,
62
+ repeatWithSchedule,
63
+ resource,
64
+ resourceAll,
65
+ resourceFromManaged,
66
+ resourceSucceed,
67
+ retryWithSchedule,
68
+ take,
69
+ union,
70
+ useManaged,
71
+ useResource,
72
+ whileInput,
73
+ windowed
74
+ } from "./chunk-KCPT2D6G.js";
1
75
  import {
2
76
  assertNever,
3
77
  collectStream,
@@ -8,32 +82,49 @@ import {
8
82
  foreachStream,
9
83
  fromArray,
10
84
  fromPull,
11
- makeCircuitBreaker,
12
85
  managedStream,
13
86
  mapStream,
14
- merge,
87
+ merge as merge2,
15
88
  mergeStream,
16
89
  rangeStream,
17
- retry,
18
- retryN,
19
- retryWithBackoff,
20
- sleep,
21
90
  streamFromReadableStream,
22
- timeout,
23
91
  uncons,
24
92
  unwrapScoped,
25
93
  widenOpt,
26
94
  zip
27
- } from "./chunk-BMRF4FN6.js";
95
+ } from "./chunk-OOGJ73B6.js";
96
+ import {
97
+ retry,
98
+ retryN,
99
+ retryWithBackoff,
100
+ sleep,
101
+ timeout
102
+ } from "./chunk-ROJC3NBJ.js";
103
+ import {
104
+ EventBus,
105
+ InMemoryTracer,
106
+ makeMetrics,
107
+ makeRuntimeEventRecord,
108
+ runtimeEventRecordContext,
109
+ runtimeHooksToEventHandler
110
+ } from "./chunk-XDZOO4L5.js";
111
+ import {
112
+ collectAllPar,
113
+ race,
114
+ raceWith,
115
+ zipPar
116
+ } from "./chunk-G3XGCZDQ.js";
117
+ import {
118
+ Scope,
119
+ withScope,
120
+ withScopeAsync
121
+ } from "./chunk-FM4W4QPL.js";
28
122
  import {
29
123
  ABI_VERSION,
30
- Async,
31
- Cause,
32
124
  DefaultHostExecutor,
33
125
  EVENT_WORDS,
34
126
  EngineFiberHandle,
35
127
  EventKindCode,
36
- Exit,
37
128
  HostRegistry,
38
129
  JsFiberEngine,
39
130
  NONE_U32,
@@ -45,14 +136,46 @@ import {
45
136
  Runtime,
46
137
  RuntimeFiber,
47
138
  Scheduler,
48
- Scope,
49
139
  WasmFiberEngine,
50
140
  WasmFiberRegistryBridge,
51
141
  WasmPackFiberBridge,
52
142
  abortablePromiseStats,
143
+ ctxExtend,
144
+ ctxToObject,
145
+ decodeEvent,
146
+ decodeEventBatch,
147
+ emptyContext,
148
+ encodeOpcodeNodes,
149
+ encodeOpcodeProgram,
150
+ fork,
151
+ fromPromiseAbortable,
152
+ getBenchmarkBudget,
153
+ getCurrentFiber,
154
+ globalScheduler,
155
+ inferCallerLaneFromStack,
156
+ laneTag,
157
+ makeBoundedRingBuffer,
158
+ makeFiberReadyQueue,
159
+ resetAbortablePromiseStats,
160
+ resolveWasmModule,
161
+ runtimeCapabilities,
162
+ runtimeForCaller,
163
+ sanitizeLaneKey,
164
+ setBenchmarkBudget,
165
+ toPromise,
166
+ toPromiseByCaller,
167
+ unsafeGetCurrentRuntime,
168
+ unsafeRunAsync,
169
+ unsafeRunFoldWithEnv,
170
+ withCurrentFiber
171
+ } from "./chunk-7LVI2GIN.js";
172
+ import {
173
+ Async,
174
+ Cause,
175
+ Exit,
53
176
  acquireRelease,
54
- async,
55
177
  asyncCatchAll,
178
+ asyncEffect,
56
179
  asyncFail,
57
180
  asyncFlatMap,
58
181
  asyncFold,
@@ -63,1038 +186,23 @@ import {
63
186
  asyncSync,
64
187
  asyncTotal,
65
188
  catchAll,
66
- collectAllPar,
67
- decodeEvent,
68
- decodeEventBatch,
69
- encodeOpcodeNodes,
70
- encodeOpcodeProgram,
71
189
  end,
72
190
  fail,
73
191
  flatMap,
74
- fork,
75
- fromPromiseAbortable,
76
- getBenchmarkBudget,
77
- getCurrentFiber,
78
- globalScheduler,
79
- inferCallerLaneFromStack,
80
- laneTag,
81
- makeBoundedRingBuffer,
82
- makeFiberReadyQueue,
83
192
  map,
84
193
  mapAsync,
85
194
  mapError,
86
195
  mapTryAsync,
87
196
  none,
88
197
  orElseOptional,
89
- race,
90
- raceWith,
91
- resetAbortablePromiseStats,
92
- resolveWasmModule,
93
- runtimeCapabilities,
94
- runtimeForCaller,
95
- sanitizeLaneKey,
96
- setBenchmarkBudget,
97
198
  some,
98
199
  succeed,
99
200
  sync,
100
- toPromise,
101
- toPromiseByCaller,
102
201
  unit,
103
- unsafeGetCurrentRuntime,
104
- unsafeRunAsync,
105
- unsafeRunFoldWithEnv,
106
- withAsyncPromise,
107
- withCurrentFiber,
108
- withScope,
109
- withScopeAsync,
110
- zipPar
111
- } from "./chunk-JT7D6M5H.js";
112
-
113
- // src/core/types/cancel.ts
114
- function makeCancelToken() {
115
- let cancelled = false;
116
- const listeners = /* @__PURE__ */ new Set();
117
- const cancel = () => {
118
- if (cancelled) return;
119
- cancelled = true;
120
- listeners.forEach((f) => f());
121
- listeners.clear();
122
- };
123
- return {
124
- isCancelled: () => cancelled,
125
- onCancel: (f) => {
126
- if (cancelled) {
127
- try {
128
- f();
129
- } catch {
130
- }
131
- return () => {
132
- };
133
- }
134
- listeners.add(f);
135
- return () => {
136
- listeners.delete(f);
137
- };
138
- },
139
- cancel
140
- };
141
- }
142
- function linkAbortController(token, ac) {
143
- return token.onCancel(() => ac.abort());
144
- }
145
-
146
- // src/core/runtime/resource.ts
147
- function bracket(acquire, use, release) {
148
- return async((env, cb) => {
149
- const runtime = unsafeGetCurrentRuntime();
150
- const scope = new Scope(runtime);
151
- const acquireFiber = scope.fork(acquire);
152
- acquireFiber.join((acquireExit) => {
153
- if (acquireExit._tag === "Failure") {
154
- scope.close(acquireExit);
155
- cb(acquireExit);
156
- return;
157
- }
158
- const resource = acquireExit.value;
159
- const useFiber = scope.fork(use(resource));
160
- useFiber.join((useExit) => {
161
- const releaseEffect = safeRelease(release, resource, useExit);
162
- const releaseFiber = runtime.fork(releaseEffect);
163
- releaseFiber.join(() => {
164
- scope.close(useExit);
165
- cb(useExit);
166
- });
167
- });
168
- });
169
- return () => {
170
- scope.close(Exit.failCause(Cause.interrupt()));
171
- };
172
- });
173
- }
174
- function safeRelease(release, resource, exit) {
175
- return asyncFold(
176
- (() => {
177
- try {
178
- return release(resource, exit);
179
- } catch {
180
- return unit();
181
- }
182
- })(),
183
- () => unit(),
184
- () => unit()
185
- );
186
- }
187
- function ensuring(effect, finalizer) {
188
- return async((env, cb) => {
189
- const runtime = unsafeGetCurrentRuntime();
190
- const fiber = runtime.fork(effect);
191
- fiber.join((exit) => {
192
- const fin = asyncFold(
193
- (() => {
194
- try {
195
- return finalizer(exit);
196
- } catch {
197
- return unit();
198
- }
199
- })(),
200
- () => unit(),
201
- () => unit()
202
- );
203
- runtime.fork(fin).join(() => {
204
- cb(exit);
205
- });
206
- });
207
- return () => {
208
- fiber.interrupt();
209
- };
210
- });
211
- }
212
- function managed(acquire, release) {
213
- return {
214
- _tag: "Managed",
215
- acquire,
216
- release: (resource, exit) => release(resource, exit)
217
- };
218
- }
219
- function useManaged(m, body) {
220
- return bracket(m.acquire, body, m.release);
221
- }
222
- function managedAll(manageds) {
223
- const acquire = async((env, cb) => {
224
- const runtime = unsafeGetCurrentRuntime();
225
- const resources = [];
226
- let i = 0;
227
- const acquireNext = () => {
228
- if (i >= manageds.length) {
229
- cb({ _tag: "Success", value: resources });
230
- return;
231
- }
232
- const m = manageds[i];
233
- const fiber = runtime.fork(m.acquire);
234
- fiber.join((exit) => {
235
- if (exit._tag === "Failure") {
236
- releaseAcquired(runtime, manageds, resources, exit).then(() => {
237
- cb(exit);
238
- });
239
- return;
240
- }
241
- resources.push(exit.value);
242
- i++;
243
- acquireNext();
244
- });
245
- };
246
- acquireNext();
247
- });
248
- const release = (resources, exit) => {
249
- return async((_env, cb) => {
250
- const runtime = unsafeGetCurrentRuntime();
251
- releaseAcquired(runtime, manageds, resources, exit).then(() => {
252
- cb({ _tag: "Success", value: void 0 });
253
- });
254
- });
255
- };
256
- return { _tag: "Managed", acquire, release };
257
- }
258
- async function releaseAcquired(runtime, manageds, resources, exit) {
259
- for (let i = resources.length - 1; i >= 0; i--) {
260
- try {
261
- const m = manageds[i];
262
- await new Promise((resolve) => {
263
- const releaseEff = asyncFold(
264
- m.release(resources[i], exit),
265
- () => unit(),
266
- () => unit()
267
- );
268
- runtime.fork(releaseEff).join(() => resolve());
269
- });
270
- } catch {
271
- }
272
- }
273
- }
274
-
275
- // src/core/runtime/linkedQueue.ts
276
- var LinkedQueue = class {
277
- head = null;
278
- tail = null;
279
- len = 0;
280
- get length() {
281
- return this.len;
282
- }
283
- isEmpty() {
284
- return this.len === 0;
285
- }
286
- push(value) {
287
- const node = { value, next: null, prev: this.tail, removed: false };
288
- if (this.tail) this.tail.next = node;
289
- else this.head = node;
290
- this.tail = node;
291
- this.len++;
292
- return node;
293
- }
294
- shift() {
295
- const h = this.head;
296
- if (!h) return void 0;
297
- this.unlink(h);
298
- return h.value;
299
- }
300
- remove(node) {
301
- if (node.removed) return;
302
- this.unlink(node);
303
- }
304
- unlink(node) {
305
- node.removed = true;
306
- const { prev, next } = node;
307
- if (prev) prev.next = next;
308
- else this.head = next;
309
- if (next) next.prev = prev;
310
- else this.tail = prev;
311
- node.next = null;
312
- node.prev = null;
313
- this.len--;
314
- }
315
- };
316
-
317
- // src/core/runtime/semaphore.ts
318
- function makeSemaphore(n) {
319
- const capacity = Math.max(1, Math.floor(n));
320
- let available = capacity;
321
- let totalAcquired = 0;
322
- let totalReleased = 0;
323
- const waiters = new LinkedQueue();
324
- const acquire = () => {
325
- return async((_env, cb) => {
326
- if (available > 0) {
327
- available--;
328
- totalAcquired++;
329
- cb({ _tag: "Success", value: void 0 });
330
- return;
331
- }
332
- const node = waiters.push(cb);
333
- return () => {
334
- waiters.remove(node);
335
- };
336
- });
337
- };
338
- const release = () => {
339
- totalReleased++;
340
- if (waiters.length > 0) {
341
- const waiter = waiters.shift();
342
- totalAcquired++;
343
- waiter({ _tag: "Success", value: void 0 });
344
- return;
345
- }
346
- available++;
347
- };
348
- const withPermit = (effect) => {
349
- return asyncFlatMap(
350
- acquire(),
351
- () => async((_env, cb) => {
352
- const runtime = unsafeGetCurrentRuntime();
353
- const fiber = runtime.fork(effect);
354
- fiber.join((exit) => {
355
- release();
356
- cb(exit);
357
- });
358
- return () => {
359
- fiber.interrupt();
360
- release();
361
- };
362
- })
363
- );
364
- };
365
- return {
366
- capacity,
367
- available: () => available,
368
- waiting: () => waiters.length,
369
- withPermit,
370
- acquire,
371
- release
372
- };
373
- }
374
-
375
- // src/core/runtime/ref.ts
376
- function makeRef(initial) {
377
- let value = initial;
378
- return {
379
- get: () => asyncSync(() => value),
380
- set: (v) => asyncSync(() => {
381
- value = v;
382
- }),
383
- update: (f) => asyncSync(() => {
384
- value = f(value);
385
- return value;
386
- }),
387
- modify: (f) => asyncSync(() => {
388
- const [result, next] = f(value);
389
- value = next;
390
- return result;
391
- }),
392
- unsafeGet: () => value
393
- };
394
- }
395
- function derivedRef(parent, get, set) {
396
- return {
397
- get: () => asyncSync(() => get(parent.unsafeGet())),
398
- set: (b) => asyncSync(() => {
399
- const current = parent.unsafeGet();
400
- parent.set(set(current, b));
401
- }),
402
- update: (f) => asyncSync(() => {
403
- const parentVal = parent.unsafeGet();
404
- const currentB = get(parentVal);
405
- const newB = f(currentB);
406
- const newParent = set(parentVal, newB);
407
- parent.unsafeGet = () => newParent;
408
- return newB;
409
- }),
410
- modify: (f) => asyncSync(() => {
411
- const parentVal = parent.unsafeGet();
412
- const currentB = get(parentVal);
413
- const [result, newB] = f(currentB);
414
- const newParent = set(parentVal, newB);
415
- parent.unsafeGet = () => newParent;
416
- return result;
417
- }),
418
- unsafeGet: () => get(parent.unsafeGet())
419
- };
420
- }
421
-
422
- // src/core/runtime/schedule.ts
423
- function recurs(n) {
424
- return {
425
- _tag: "Schedule",
426
- initial: () => 0,
427
- step: (count, _input) => {
428
- const next = count + 1;
429
- return [{ continue: next < n, delayMs: 0 }, next, next];
430
- }
431
- };
432
- }
433
- function fixed(delayMs) {
434
- return {
435
- _tag: "Schedule",
436
- initial: () => 0,
437
- step: (count, _input) => {
438
- return [{ continue: true, delayMs }, count + 1, count + 1];
439
- }
440
- };
441
- }
442
- function exponential(baseMs, maxMs = Infinity) {
443
- return {
444
- _tag: "Schedule",
445
- initial: () => 0,
446
- step: (count, _input) => {
447
- const delay = Math.min(baseMs * Math.pow(2, count), maxMs);
448
- return [{ continue: true, delayMs: delay }, count + 1, count + 1];
449
- }
450
- };
451
- }
452
- function jittered(baseMs, maxMs = Infinity) {
453
- return {
454
- _tag: "Schedule",
455
- initial: () => 0,
456
- step: (count, _input) => {
457
- const cap = Math.min(baseMs * Math.pow(2, count), maxMs);
458
- const delay = Math.floor(Math.random() * cap);
459
- return [{ continue: true, delayMs: delay }, count + 1, count + 1];
460
- }
461
- };
462
- }
463
- function elapsed(maxMs) {
464
- return {
465
- _tag: "Schedule",
466
- initial: () => performance.now(),
467
- step: (startedAt, _input) => {
468
- const el = performance.now() - startedAt;
469
- return [{ continue: el < maxMs, delayMs: 0 }, startedAt, el];
470
- }
471
- };
472
- }
473
- function whileInput(pred) {
474
- return {
475
- _tag: "Schedule",
476
- initial: () => void 0,
477
- step: (_state, input) => {
478
- return [{ continue: pred(input), delayMs: 0 }, void 0, input];
479
- }
480
- };
481
- }
482
- function take(schedule, n) {
483
- return {
484
- _tag: "Schedule",
485
- initial: () => ({ inner: schedule.initial(), count: 0 }),
486
- step: (state, input) => {
487
- if (state.count >= n) return [{ continue: false, delayMs: 0 }, state, void 0];
488
- const [decision, nextInner, output] = schedule.step(state.inner, input);
489
- const nextState = { inner: nextInner, count: state.count + 1 };
490
- return [{ continue: decision.continue && state.count + 1 < n, delayMs: decision.delayMs }, nextState, output];
491
- }
492
- };
493
- }
494
- function andThen(first, second) {
495
- return {
496
- _tag: "Schedule",
497
- initial: () => ({ phase: "first", inner: first.initial() }),
498
- step: (state, input) => {
499
- if (state.phase === "first") {
500
- const [decision2, nextInner2, output2] = first.step(state.inner, input);
501
- if (decision2.continue) {
502
- return [decision2, { phase: "first", inner: nextInner2 }, output2];
503
- }
504
- return [{ continue: true, delayMs: decision2.delayMs }, { phase: "second", inner: second.initial() }, output2];
505
- }
506
- const [decision, nextInner, output] = second.step(state.inner, input);
507
- return [decision, { phase: "second", inner: nextInner }, output];
508
- }
509
- };
510
- }
511
- function intersect(left, right) {
512
- return {
513
- _tag: "Schedule",
514
- initial: () => ({ left: left.initial(), right: right.initial() }),
515
- step: (state, input) => {
516
- const [ld, ls, lo] = left.step(state.left, input);
517
- const [rd, rs, ro] = right.step(state.right, input);
518
- const cont = ld.continue && rd.continue;
519
- const delay = Math.max(ld.delayMs, rd.delayMs);
520
- return [{ continue: cont, delayMs: delay }, { left: ls, right: rs }, [lo, ro]];
521
- }
522
- };
523
- }
524
- function union(left, right) {
525
- return {
526
- _tag: "Schedule",
527
- initial: () => ({ left: left.initial(), right: right.initial() }),
528
- step: (state, input) => {
529
- const [ld, ls, lo] = left.step(state.left, input);
530
- const [rd, rs, ro] = right.step(state.right, input);
531
- const cont = ld.continue || rd.continue;
532
- const delay = Math.min(ld.delayMs, rd.delayMs);
533
- return [{ continue: cont, delayMs: delay }, { left: ls, right: rs }, [lo, ro]];
534
- }
535
- };
536
- }
537
- function retryWithSchedule(effect, schedule) {
538
- const loop = (state) => asyncFold(
539
- effect,
540
- (error) => {
541
- const [decision, nextState, _output] = schedule.step(state, error);
542
- if (!decision.continue) return asyncFail(error);
543
- if (decision.delayMs <= 0) return loop(nextState);
544
- return asyncFlatMap(sleep(decision.delayMs), () => loop(nextState));
545
- },
546
- (value) => asyncSucceed(value)
547
- );
548
- return loop(schedule.initial());
549
- }
550
- function repeatWithSchedule(effect, schedule) {
551
- const loop = (state, lastValue) => {
552
- const [decision, nextState, _output] = schedule.step(state, lastValue);
553
- if (!decision.continue) return asyncSucceed(lastValue);
554
- if (decision.delayMs <= 0) {
555
- return asyncFold(
556
- effect,
557
- (error) => asyncFail(error),
558
- (value) => loop(nextState, value)
559
- );
560
- }
561
- return asyncFlatMap(
562
- sleep(decision.delayMs),
563
- () => asyncFold(
564
- effect,
565
- (error) => asyncFail(error),
566
- (value) => loop(nextState, value)
567
- )
568
- );
569
- };
570
- return asyncFold(
571
- effect,
572
- (error) => asyncFail(error),
573
- (value) => loop(schedule.initial(), value)
574
- );
575
- }
576
-
577
- // src/core/runtime/shutdown.ts
578
- async function gracefulShutdown(runtime, config = {}) {
579
- const timeoutMs = config.timeoutMs ?? 3e4;
580
- const startedAt = Date.now();
581
- config.onStart?.();
582
- let timedOut = false;
583
- const shutdownPromise = (async () => {
584
- try {
585
- await runtime.shutdown();
586
- } catch {
587
- }
588
- })();
589
- const timeoutPromise = new Promise((resolve) => {
590
- setTimeout(() => {
591
- timedOut = true;
592
- resolve();
593
- }, timeoutMs);
594
- });
595
- await Promise.race([shutdownPromise, timeoutPromise]);
596
- const completedAt = Date.now();
597
- const stats = {
598
- startedAt,
599
- completedAt,
600
- elapsedMs: completedAt - startedAt,
601
- timedOut
602
- };
603
- if (timedOut) {
604
- config.onTimeout?.(stats);
605
- } else {
606
- config.onComplete?.(stats);
607
- }
608
- return stats;
609
- }
610
- function registerShutdownHooks(runtime, config = {}) {
611
- let shuttingDown = false;
612
- const handler = (signal) => {
613
- if (shuttingDown) {
614
- process.exit(1);
615
- }
616
- shuttingDown = true;
617
- console.log(`
618
- [brass-runtime] Received ${signal}, shutting down gracefully...`);
619
- gracefulShutdown(runtime, {
620
- ...config,
621
- onComplete: (stats) => {
622
- config.onComplete?.(stats);
623
- if (!config.onComplete) {
624
- console.log(`[brass-runtime] Shutdown complete (${stats.elapsedMs}ms)`);
625
- process.exit(0);
626
- }
627
- },
628
- onTimeout: (stats) => {
629
- config.onTimeout?.(stats);
630
- if (!config.onTimeout) {
631
- console.log(`[brass-runtime] Shutdown timed out after ${stats.elapsedMs}ms, forcing exit`);
632
- process.exit(1);
633
- }
634
- }
635
- });
636
- };
637
- process.on("SIGTERM", () => handler("SIGTERM"));
638
- process.on("SIGINT", () => handler("SIGINT"));
639
- return () => {
640
- process.removeAllListeners("SIGTERM");
641
- process.removeAllListeners("SIGINT");
642
- };
643
- }
644
-
645
- // src/core/runtime/testing.ts
646
- function makeTestRuntime(env, options) {
647
- const runtime = Runtime.make(env ?? {});
648
- const run = (effect) => runtime.toPromise(effect);
649
- const runExit = (effect) => new Promise((resolve) => {
650
- runtime.unsafeRunAsync(effect, resolve);
651
- });
652
- return { runtime, run, runExit };
653
- }
654
- async function assertSucceeds(effect, expected, runtime) {
655
- const rt = runtime ?? Runtime.make({});
656
- const exit = await new Promise((resolve) => {
657
- rt.unsafeRunAsync(effect, resolve);
658
- });
659
- if (exit._tag !== "Success") {
660
- throw new Error(`Expected success with ${JSON.stringify(expected)}, got failure: ${JSON.stringify(exit.cause)}`);
661
- }
662
- if (JSON.stringify(exit.value) !== JSON.stringify(expected)) {
663
- throw new Error(`Expected ${JSON.stringify(expected)}, got ${JSON.stringify(exit.value)}`);
664
- }
665
- }
666
- async function assertFails(effect, expectedError, runtime) {
667
- const rt = runtime ?? Runtime.make({});
668
- const exit = await new Promise((resolve) => {
669
- rt.unsafeRunAsync(effect, resolve);
670
- });
671
- if (exit._tag !== "Failure") {
672
- throw new Error(`Expected failure with ${JSON.stringify(expectedError)}, got success: ${JSON.stringify(exit.value)}`);
673
- }
674
- const error = exit.cause.error;
675
- if (JSON.stringify(error) !== JSON.stringify(expectedError)) {
676
- throw new Error(`Expected error ${JSON.stringify(expectedError)}, got ${JSON.stringify(error)}`);
677
- }
678
- }
679
- async function assertFailsWith(effect, predicate, runtime) {
680
- const rt = runtime ?? Runtime.make({});
681
- const exit = await new Promise((resolve) => {
682
- rt.unsafeRunAsync(effect, resolve);
683
- });
684
- if (exit._tag !== "Failure") {
685
- throw new Error(`Expected failure, got success: ${JSON.stringify(exit.value)}`);
686
- }
687
- const error = exit.cause.error;
688
- if (!predicate(error)) {
689
- throw new Error(`Error did not match predicate: ${JSON.stringify(error)}`);
690
- }
691
- }
692
- async function assertCompletesWithin(effect, maxMs, runtime) {
693
- const rt = runtime ?? Runtime.make({});
694
- const start = performance.now();
695
- const result = await rt.toPromise(effect);
696
- const elapsed2 = performance.now() - start;
697
- if (elapsed2 > maxMs) {
698
- throw new Error(`Effect took ${elapsed2.toFixed(1)}ms, expected < ${maxMs}ms`);
699
- }
700
- return result;
701
- }
702
- function flakyEffect(failCount, successValue, errorValue) {
703
- let calls = 0;
704
- return async((_env, cb) => {
705
- calls++;
706
- if (calls <= failCount) {
707
- cb({ _tag: "Failure", cause: { _tag: "Fail", error: errorValue } });
708
- } else {
709
- cb({ _tag: "Success", value: successValue });
710
- }
711
- });
712
- }
713
- function delayedEffect(ms, value) {
714
- return async((_env, cb) => {
715
- const id = setTimeout(() => cb({ _tag: "Success", value }), ms);
716
- return () => clearTimeout(id);
717
- });
718
- }
719
- function neverEffect() {
720
- return async(() => {
721
- return () => {
722
- };
723
- });
724
- }
725
-
726
- // src/core/runtime/layer.ts
727
- function layer(acquire, release) {
728
- return {
729
- _tag: "Layer",
730
- build: (_deps) => asyncFlatMap(acquire(), (service) => asyncSucceed({
731
- service,
732
- release: release ? () => release(service) : () => unit()
733
- }))
734
- };
735
- }
736
- function layerFrom() {
737
- return (acquire, release) => ({
738
- _tag: "Layer",
739
- build: (deps) => asyncFlatMap(acquire(deps), (service) => asyncSucceed({
740
- service,
741
- release: release ? () => release(service) : () => unit()
742
- }))
743
- });
744
- }
745
- function layerSucceed(value) {
746
- return {
747
- _tag: "Layer",
748
- build: () => asyncSucceed({ service: value, release: () => unit() })
749
- };
750
- }
751
- function layerFail(error) {
752
- return {
753
- _tag: "Layer",
754
- build: () => asyncFail(error)
755
- };
756
- }
757
- function compose(from, to) {
758
- return {
759
- _tag: "Layer",
760
- build: (deps) => asyncFlatMap(
761
- from.build(deps),
762
- ({ service: mid, release: releaseMid }) => asyncFold(
763
- to.build(mid),
764
- (error) => asyncFlatMap(releaseMid(), () => asyncFail(error)),
765
- ({ service: out, release: releaseOut }) => asyncSucceed({
766
- service: out,
767
- release: () => asyncFlatMap(releaseOut(), () => releaseMid())
768
- })
769
- )
770
- )
771
- };
772
- }
773
- function merge2(left, right) {
774
- return {
775
- _tag: "Layer",
776
- build: (deps) => asyncFlatMap(
777
- left.build(deps),
778
- ({ service: a, release: releaseA }) => asyncFold(
779
- right.build(deps),
780
- (error) => asyncFlatMap(releaseA(), () => asyncFail(error)),
781
- ({ service: b, release: releaseB }) => asyncSucceed({
782
- service: { ...a, ...b },
783
- release: () => asyncFlatMap(releaseB(), () => releaseA())
784
- })
785
- )
786
- )
787
- };
788
- }
789
- function mapLayer(l, f) {
790
- return {
791
- _tag: "Layer",
792
- build: (deps) => asyncFlatMap(
793
- l.build(deps),
794
- ({ service, release }) => asyncSucceed({ service: f(service), release })
795
- )
796
- };
797
- }
798
- function provideLayer(l, use, deps) {
799
- return asyncFlatMap(
800
- l.build(deps ?? {}),
801
- ({ service, release }) => asyncFold(
802
- use(service),
803
- (error) => asyncFlatMap(release(), () => asyncFail(error)),
804
- (value) => asyncFlatMap(release(), () => asyncSucceed(value))
805
- )
806
- );
807
- }
808
-
809
- // src/core/runtime/workerPool.ts
810
- function makeWorkerPool(config = {}) {
811
- const size = config.size ?? 4;
812
- const maxQueue = config.maxQueue ?? 1e3;
813
- const taskTimeoutMs = config.taskTimeoutMs ?? 3e4;
814
- let closed = false;
815
- let busy = 0;
816
- let completed = 0;
817
- let failed = 0;
818
- let timedOut = 0;
819
- const queue = [];
820
- const processNext = () => {
821
- if (queue.length === 0 || busy >= size) return;
822
- const task = queue.shift();
823
- busy++;
824
- setImmediate(() => {
825
- if (task.timeoutId) clearTimeout(task.timeoutId);
826
- try {
827
- const result = task.fn();
828
- busy--;
829
- completed++;
830
- task.resolve(result);
831
- processNext();
832
- } catch (e) {
833
- busy--;
834
- failed++;
835
- task.reject({ _tag: "WorkerTaskError", message: String(e) });
836
- processNext();
837
- }
838
- });
839
- };
840
- const execute = (fn) => {
841
- if (closed) return asyncFail({ _tag: "WorkerPoolClosed" });
842
- if (queue.length >= maxQueue) {
843
- return asyncFail({ _tag: "WorkerPoolFull", queued: queue.length });
844
- }
845
- return async((_env, cb) => {
846
- const task = {
847
- fn,
848
- resolve: (value) => cb({ _tag: "Success", value }),
849
- reject: (error) => cb({ _tag: "Failure", cause: { _tag: "Fail", error } })
850
- };
851
- task.timeoutId = setTimeout(() => {
852
- const idx = queue.indexOf(task);
853
- if (idx >= 0) {
854
- queue.splice(idx, 1);
855
- timedOut++;
856
- task.reject({ _tag: "WorkerTaskTimeout", ms: taskTimeoutMs });
857
- }
858
- }, taskTimeoutMs);
859
- queue.push(task);
860
- processNext();
861
- return () => {
862
- const idx = queue.indexOf(task);
863
- if (idx >= 0) {
864
- queue.splice(idx, 1);
865
- if (task.timeoutId) clearTimeout(task.timeoutId);
866
- }
867
- };
868
- });
869
- };
870
- const run = (taskSource, args = []) => {
871
- return execute(() => {
872
- const fn = new Function(...args.map((_, i) => `arg${i}`), taskSource);
873
- return fn(...args);
874
- });
875
- };
876
- return {
877
- execute,
878
- run,
879
- stats: () => ({
880
- size,
881
- busy,
882
- idle: size - busy,
883
- queued: queue.length,
884
- completed,
885
- failed,
886
- timedOut
887
- }),
888
- shutdown: async () => {
889
- closed = true;
890
- while (queue.length > 0) {
891
- const task = queue.shift();
892
- if (task.timeoutId) clearTimeout(task.timeoutId);
893
- task.reject({ _tag: "WorkerPoolClosed" });
894
- }
895
- }
896
- };
897
- }
898
-
899
- // src/core/runtime/tracing.ts
900
- var idCounter = 0;
901
- function generateId() {
902
- return (++idCounter).toString(16).padStart(16, "0");
903
- }
904
- function makeTracer(config) {
905
- const completedSpans = [];
906
- const sampleRate = config.sampleRate ?? 1;
907
- const shouldSample = () => {
908
- if (sampleRate >= 1) return true;
909
- if (sampleRate <= 0) return false;
910
- return Math.random() < sampleRate;
911
- };
912
- const span = (name, effect, attributes) => {
913
- if (!shouldSample()) return effect;
914
- const spanObj = {
915
- name,
916
- context: {
917
- traceId: generateId(),
918
- spanId: generateId()
919
- },
920
- startTime: performance.now(),
921
- status: "unset",
922
- attributes: { "service.name": config.serviceName, ...attributes },
923
- events: []
924
- };
925
- return asyncFold(
926
- effect,
927
- (error) => {
928
- spanObj.endTime = performance.now();
929
- spanObj.status = "error";
930
- spanObj.events.push({
931
- name: "error",
932
- time: performance.now(),
933
- attributes: { "error.message": String(error) }
934
- });
935
- completedSpans.push(spanObj);
936
- config.onSpanEnd?.(spanObj);
937
- return asyncFail(error);
938
- },
939
- (value) => {
940
- spanObj.endTime = performance.now();
941
- spanObj.status = "ok";
942
- completedSpans.push(spanObj);
943
- config.onSpanEnd?.(spanObj);
944
- return asyncSucceed(value);
945
- }
946
- );
947
- };
948
- return {
949
- span,
950
- spans: () => completedSpans,
951
- clear: () => {
952
- completedSpans.length = 0;
953
- }
954
- };
955
- }
956
-
957
- // src/core/runtime/metrics.ts
958
- var DEFAULT_BOUNDARIES = [1, 5, 10, 25, 50, 100, 250, 500, 1e3, 5e3, 1e4];
959
- function makeMetrics() {
960
- const counters = /* @__PURE__ */ new Map();
961
- const gauges = /* @__PURE__ */ new Map();
962
- const histograms = /* @__PURE__ */ new Map();
963
- const key = (name, labels) => labels ? `${name}|${Object.entries(labels).sort().map(([k, v]) => `${k}=${v}`).join(",")}` : name;
964
- const counter = (name, labels = {}) => {
965
- const k = key(name, labels);
966
- if (!counters.has(k)) counters.set(k, { labels, value: 0 });
967
- const entry = counters.get(k);
968
- return {
969
- increment: (n = 1) => {
970
- entry.value += Math.max(0, n);
971
- },
972
- value: () => entry.value
973
- };
974
- };
975
- const gauge = (name, labels = {}) => {
976
- const k = key(name, labels);
977
- if (!gauges.has(k)) gauges.set(k, { labels, value: 0 });
978
- const entry = gauges.get(k);
979
- return {
980
- set: (v) => {
981
- entry.value = v;
982
- },
983
- increment: (n = 1) => {
984
- entry.value += n;
985
- },
986
- decrement: (n = 1) => {
987
- entry.value -= n;
988
- },
989
- value: () => entry.value
990
- };
991
- };
992
- const histogram = (name, boundaries = DEFAULT_BOUNDARIES, labels = {}) => {
993
- const k = key(name, labels);
994
- if (!histograms.has(k)) {
995
- const sorted = [...boundaries].sort((a, b) => a - b);
996
- histograms.set(k, {
997
- labels,
998
- boundaries: sorted,
999
- data: { boundaries: sorted, counts: new Array(sorted.length + 1).fill(0), sum: 0, count: 0, min: Infinity, max: -Infinity }
1000
- });
1001
- }
1002
- const entry = histograms.get(k);
1003
- return {
1004
- observe: (value) => {
1005
- entry.data.sum += value;
1006
- entry.data.count++;
1007
- entry.data.min = Math.min(entry.data.min, value);
1008
- entry.data.max = Math.max(entry.data.max, value);
1009
- let placed = false;
1010
- for (let i = 0; i < entry.boundaries.length; i++) {
1011
- if (value <= entry.boundaries[i]) {
1012
- entry.data.counts[i]++;
1013
- placed = true;
1014
- break;
1015
- }
1016
- }
1017
- if (!placed) entry.data.counts[entry.boundaries.length]++;
1018
- },
1019
- buckets: () => ({ ...entry.data }),
1020
- percentile: (p) => {
1021
- const target = Math.ceil(entry.data.count * (p / 100));
1022
- let cumulative = 0;
1023
- for (let i = 0; i < entry.boundaries.length; i++) {
1024
- cumulative += entry.data.counts[i];
1025
- if (cumulative >= target) return entry.boundaries[i];
1026
- }
1027
- return entry.data.max;
1028
- }
1029
- };
1030
- };
1031
- return {
1032
- counter,
1033
- gauge,
1034
- histogram,
1035
- snapshot: () => ({
1036
- counters: Array.from(counters.entries()).map(([k, v]) => ({ name: k.split("|")[0], labels: v.labels, value: v.value })),
1037
- gauges: Array.from(gauges.entries()).map(([k, v]) => ({ name: k.split("|")[0], labels: v.labels, value: v.value })),
1038
- histograms: Array.from(histograms.entries()).map(([k, v]) => ({ name: k.split("|")[0], labels: v.labels, buckets: v.data }))
1039
- }),
1040
- reset: () => {
1041
- counters.clear();
1042
- gauges.clear();
1043
- histograms.clear();
1044
- }
1045
- };
1046
- }
1047
-
1048
- // src/core/types/typedError.ts
1049
- function catchTag(effect, tag, handler) {
1050
- return asyncFold(
1051
- effect,
1052
- (error) => {
1053
- if (typeof error === "object" && error !== null && "_tag" in error && error._tag === tag) {
1054
- return handler(error);
1055
- }
1056
- return asyncFail(error);
1057
- },
1058
- (value) => asyncSucceed(value)
1059
- );
1060
- }
1061
- function catchTags(effect, handlers) {
1062
- return asyncFold(
1063
- effect,
1064
- (error) => {
1065
- if (typeof error === "object" && error !== null && "_tag" in error) {
1066
- const handler = handlers[error._tag];
1067
- if (handler) return handler(error);
1068
- }
1069
- return asyncFail(error);
1070
- },
1071
- (value) => asyncSucceed(value)
1072
- );
1073
- }
1074
- function mapError2(effect, f) {
1075
- return asyncFold(
1076
- effect,
1077
- (error) => asyncFail(f(error)),
1078
- (value) => asyncSucceed(value)
1079
- );
1080
- }
1081
- function tagError(effect, tag, enrich) {
1082
- return asyncFold(
1083
- effect,
1084
- (error) => {
1085
- const fields = enrich ? enrich(error) : {};
1086
- return asyncFail({ _tag: tag, ...fields });
1087
- },
1088
- (value) => asyncSucceed(value)
1089
- );
1090
- }
1091
- function orElse(effect, fallback) {
1092
- return asyncFold(
1093
- effect,
1094
- (error) => fallback(error),
1095
- (value) => asyncSucceed(value)
1096
- );
1097
- }
202
+ withAsyncPromise
203
+ } from "./chunk-PNVFW245.js";
204
+ import "./chunk-TDVMADDN.js";
205
+ import "./chunk-3RG5ZIWI.js";
1098
206
 
1099
207
  // src/core/stream/queue.ts
1100
208
  function bounded(capacity, strategy = "backpressure", options = {}) {
@@ -1122,7 +230,7 @@ function makeQueue(capacity, strategy, options) {
1122
230
  return {
1123
231
  size: () => items.length,
1124
232
  shutdown,
1125
- offer: (a) => async((_env, cb) => {
233
+ offer: (a) => asyncEffect((_env, cb) => {
1126
234
  if (closed) {
1127
235
  cb({ _tag: "Success", value: false });
1128
236
  return;
@@ -1157,7 +265,7 @@ function makeQueue(capacity, strategy, options) {
1157
265
  };
1158
266
  return canceler;
1159
267
  }),
1160
- take: () => async((_env, cb) => {
268
+ take: () => asyncEffect((_env, cb) => {
1161
269
  if (items.length > 0) {
1162
270
  const a = items.shift();
1163
271
  cb({ _tag: "Success", value: a });
@@ -2155,7 +1263,7 @@ function throttle(stream, intervalMs) {
2155
1263
  }
2156
1264
  function debounce(stream, delayMs) {
2157
1265
  return fromPull(
2158
- async((_env, cb) => {
1266
+ asyncEffect((_env, cb) => {
2159
1267
  let lastValue;
2160
1268
  let hasValue = false;
2161
1269
  let timerId;
@@ -2164,7 +1272,7 @@ function debounce(stream, delayMs) {
2164
1272
  const pullNext = () => {
2165
1273
  if (done) return;
2166
1274
  const pull = uncons(tail);
2167
- pull(_env, (exit) => {
1275
+ unsafeRunAsync(pull, _env, (exit) => {
2168
1276
  if (done) return;
2169
1277
  if (exit._tag === "Failure") {
2170
1278
  if (hasValue) {
@@ -2305,9 +1413,11 @@ export {
2305
1413
  DefaultHostExecutor,
2306
1414
  EVENT_WORDS,
2307
1415
  EngineFiberHandle,
1416
+ EventBus,
2308
1417
  EventKindCode,
2309
1418
  Exit,
2310
1419
  HostRegistry,
1420
+ InMemoryTracer,
2311
1421
  JsFiberEngine,
2312
1422
  NONE_U32,
2313
1423
  NoopHooks,
@@ -2315,11 +1425,14 @@ export {
2315
1425
  PURE_PIPELINE_TAG,
2316
1426
  ProgramBuilder,
2317
1427
  PushStatus,
1428
+ Resource,
2318
1429
  RingBuffer,
2319
1430
  Runtime,
2320
1431
  RuntimeFiber,
1432
+ RuntimeRegistry,
2321
1433
  Scheduler,
2322
1434
  Scope,
1435
+ Supervisor,
2323
1436
  WasmFiberEngine,
2324
1437
  WasmFiberRegistryBridge,
2325
1438
  WasmPackFiberBridge,
@@ -2333,7 +1446,7 @@ export {
2333
1446
  assertFailsWith,
2334
1447
  assertNever,
2335
1448
  assertSucceeds,
2336
- async,
1449
+ asyncEffect as async,
2337
1450
  asyncCatchAll,
2338
1451
  asyncFail,
2339
1452
  asyncFlatMap,
@@ -2360,16 +1473,23 @@ export {
2360
1473
  compose2 as compose,
2361
1474
  compose as composeLayer,
2362
1475
  concatStream,
1476
+ consoleJsonLogger,
1477
+ contramap as contramapSchedule,
1478
+ ctxExtend,
1479
+ ctxToObject,
2363
1480
  debounce,
2364
1481
  decodeEvent,
2365
1482
  decodeEventBatch,
1483
+ defaultTracer,
2366
1484
  delayedEffect,
2367
1485
  derivedRef,
2368
1486
  deserializeFusedPipeline,
2369
1487
  dropP,
2370
1488
  drop as dropStream,
1489
+ dumpAllFibers,
2371
1490
  elapsed,
2372
1491
  emitStream,
1492
+ emptyContext,
2373
1493
  emptyStream,
2374
1494
  encodeOpcodeNodes,
2375
1495
  encodeOpcodeProgram,
@@ -2378,6 +1498,7 @@ export {
2378
1498
  ensuring,
2379
1499
  exponential,
2380
1500
  fail,
1501
+ fibonacci,
2381
1502
  filterMapP,
2382
1503
  filterP,
2383
1504
  fixed,
@@ -2404,7 +1525,10 @@ export {
2404
1525
  intersect,
2405
1526
  isFusionEnabled,
2406
1527
  isFusionVerbose,
1528
+ jitter,
2407
1529
  jittered,
1530
+ jitteredSchedule,
1531
+ joinSupervised,
2408
1532
  laneTag,
2409
1533
  layer,
2410
1534
  layerFail,
@@ -2418,8 +1542,11 @@ export {
2418
1542
  makeHub,
2419
1543
  makeMetrics,
2420
1544
  makeRef,
1545
+ makeResource,
1546
+ makeRuntimeEventRecord,
2421
1547
  makeSemaphore,
2422
1548
  makeStreamChunker,
1549
+ makeSupervisor,
2423
1550
  makeTestRuntime,
2424
1551
  makeTracer,
2425
1552
  makeWorkerPool,
@@ -2436,10 +1563,11 @@ export {
2436
1563
  mapError2 as mapErrorTyped,
2437
1564
  mapLayer,
2438
1565
  mapP,
1566
+ map2 as mapSchedule,
2439
1567
  mapStream,
2440
1568
  mapTryAsync,
2441
- merge,
2442
- merge2 as mergeLayer,
1569
+ merge2 as merge,
1570
+ merge as mergeLayer,
2443
1571
  mergeStream,
2444
1572
  neverEffect,
2445
1573
  none,
@@ -2453,13 +1581,19 @@ export {
2453
1581
  registerShutdownHooks,
2454
1582
  repeatWithSchedule,
2455
1583
  resetAbortablePromiseStats,
1584
+ resource,
1585
+ resourceAll,
1586
+ resourceFromManaged,
1587
+ resourceSucceed,
2456
1588
  retry,
2457
1589
  retryN,
2458
1590
  retryWithBackoff,
2459
1591
  retryWithSchedule,
2460
1592
  runFusedArray,
2461
1593
  runtimeCapabilities,
1594
+ runtimeEventRecordContext,
2462
1595
  runtimeForCaller,
1596
+ runtimeHooksToEventHandler,
2463
1597
  sanitizeLaneKey,
2464
1598
  scan,
2465
1599
  selectedEngineStats,
@@ -2471,6 +1605,7 @@ export {
2471
1605
  some,
2472
1606
  streamFromReadableStream,
2473
1607
  succeed,
1608
+ supervise,
2474
1609
  sync,
2475
1610
  tagError,
2476
1611
  takeP,
@@ -2489,9 +1624,11 @@ export {
2489
1624
  unsafeRunFoldWithEnv,
2490
1625
  unwrapScoped,
2491
1626
  useManaged,
1627
+ useResource,
2492
1628
  via,
2493
1629
  whileInput,
2494
1630
  widenOpt,
1631
+ windowed,
2495
1632
  withAsyncPromise,
2496
1633
  withCurrentFiber,
2497
1634
  withScope,