brass-runtime 1.13.7 → 1.14.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 (37) hide show
  1. package/README.md +231 -55
  2. package/dist/agent/cli/main.cjs +43 -43
  3. package/dist/agent/cli/main.js +2 -2
  4. package/dist/agent/cli/main.mjs +2 -2
  5. package/dist/agent/index.cjs +3 -3
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +2 -2
  8. package/dist/agent/index.mjs +2 -2
  9. package/dist/chunk-4N2JEK4H.mjs +3897 -0
  10. package/dist/chunk-BKBFSOGT.cjs +3897 -0
  11. package/dist/{chunk-XNOTJSMZ.mjs → chunk-BMRF4FN6.js} +268 -8
  12. package/dist/chunk-JT7D6M5H.js +3897 -0
  13. package/dist/{chunk-3R7ZYRK2.mjs → chunk-MQF7HZ7Y.mjs} +1 -1
  14. package/dist/chunk-SKVY72E5.cjs +667 -0
  15. package/dist/{chunk-ATHSSDUF.js → chunk-UWMMYKVK.mjs} +268 -8
  16. package/dist/{chunk-INZBKOHY.js → chunk-WJESVBWN.js} +1 -1
  17. package/dist/{chunk-XDINDYNA.cjs → chunk-XTMZTVIT.cjs} +134 -134
  18. package/dist/{effect-ISvXPLgc.d.ts → effect-DM56H743.d.ts} +191 -21
  19. package/dist/http/index.cjs +808 -140
  20. package/dist/http/index.d.ts +181 -8
  21. package/dist/http/index.js +793 -125
  22. package/dist/http/index.mjs +793 -125
  23. package/dist/index.cjs +1785 -137
  24. package/dist/index.d.ts +979 -36
  25. package/dist/index.js +1675 -27
  26. package/dist/index.mjs +1675 -27
  27. package/dist/stream-Oqe6WeLE.d.ts +173 -0
  28. package/package.json +1 -1
  29. package/wasm/pkg/brass_runtime_wasm_engine.d.ts +95 -16
  30. package/wasm/pkg/brass_runtime_wasm_engine.js +715 -15
  31. package/wasm/pkg/brass_runtime_wasm_engine_bg.wasm +0 -0
  32. package/wasm/pkg/brass_runtime_wasm_engine_bg.wasm.d.ts +78 -7
  33. package/dist/chunk-2P4PD6D7.cjs +0 -2557
  34. package/dist/chunk-7F2R7A2V.mjs +0 -2557
  35. package/dist/chunk-L6KKKM66.js +0 -2557
  36. package/dist/chunk-ZTDK2DLG.cjs +0 -407
  37. package/dist/stream-BvukHxCv.d.ts +0 -66
@@ -85,6 +85,119 @@ class BrassWasmChunkBuffer {
85
85
  if (Symbol.dispose) BrassWasmChunkBuffer.prototype[Symbol.dispose] = BrassWasmChunkBuffer.prototype.free;
86
86
  exports.BrassWasmChunkBuffer = BrassWasmChunkBuffer;
87
87
 
88
+ class BrassWasmFiberReadyQueue {
89
+ __destroy_into_raw() {
90
+ const ptr = this.__wbg_ptr;
91
+ this.__wbg_ptr = 0;
92
+ BrassWasmFiberReadyQueueFinalization.unregister(this);
93
+ return ptr;
94
+ }
95
+ free() {
96
+ const ptr = this.__destroy_into_raw();
97
+ wasm.__wbg_brasswasmfiberreadyqueue_free(ptr, 0);
98
+ }
99
+ /**
100
+ * @returns {number}
101
+ */
102
+ begin_flush() {
103
+ const ret = wasm.brasswasmfiberreadyqueue_begin_flush(this.__wbg_ptr);
104
+ return ret >>> 0;
105
+ }
106
+ clear() {
107
+ wasm.brasswasmfiberreadyqueue_clear(this.__wbg_ptr);
108
+ }
109
+ /**
110
+ * @param {number} ran
111
+ * @returns {number}
112
+ */
113
+ end_flush(ran) {
114
+ const ret = wasm.brasswasmfiberreadyqueue_end_flush(this.__wbg_ptr, ran);
115
+ return ret >>> 0;
116
+ }
117
+ /**
118
+ * @param {number} fiber_id
119
+ * @param {string} tag
120
+ * @returns {number}
121
+ */
122
+ enqueue_fiber(fiber_id, tag) {
123
+ const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
124
+ const len0 = WASM_VECTOR_LEN;
125
+ const ret = wasm.brasswasmfiberreadyqueue_enqueue_fiber(this.__wbg_ptr, fiber_id, ptr0, len0);
126
+ return ret >>> 0;
127
+ }
128
+ /**
129
+ * @param {number} fiber_id
130
+ * @param {number} lane_id
131
+ * @returns {number}
132
+ */
133
+ enqueue_fiber_lane(fiber_id, lane_id) {
134
+ const ret = wasm.brasswasmfiberreadyqueue_enqueue_fiber_lane(this.__wbg_ptr, fiber_id, lane_id);
135
+ return ret >>> 0;
136
+ }
137
+ /**
138
+ * @param {string} key
139
+ * @returns {number}
140
+ */
141
+ intern_lane(key) {
142
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
143
+ const len0 = WASM_VECTOR_LEN;
144
+ const ret = wasm.brasswasmfiberreadyqueue_intern_lane(this.__wbg_ptr, ptr0, len0);
145
+ return ret >>> 0;
146
+ }
147
+ /**
148
+ * @returns {number}
149
+ */
150
+ len() {
151
+ const ret = wasm.brasswasmfiberreadyqueue_len(this.__wbg_ptr);
152
+ return ret >>> 0;
153
+ }
154
+ /**
155
+ * @param {number} id
156
+ * @returns {number}
157
+ */
158
+ metric_u64(id) {
159
+ const ret = wasm.brasswasmfiberreadyqueue_metric_u64(this.__wbg_ptr, id);
160
+ return ret;
161
+ }
162
+ /**
163
+ * @param {number} flush_budget
164
+ * @param {number} micro_threshold
165
+ * @param {number} lane_capacity
166
+ * @param {number} lane_budget
167
+ * @param {number} max_lanes
168
+ */
169
+ constructor(flush_budget, micro_threshold, lane_capacity, lane_budget, max_lanes) {
170
+ const ret = wasm.brasswasmfiberreadyqueue_new(flush_budget, micro_threshold, lane_capacity, lane_budget, max_lanes);
171
+ this.__wbg_ptr = ret;
172
+ BrassWasmFiberReadyQueueFinalization.register(this, this.__wbg_ptr, this);
173
+ return this;
174
+ }
175
+ /**
176
+ * @returns {number}
177
+ */
178
+ shift_fiber() {
179
+ const ret = wasm.brasswasmfiberreadyqueue_shift_fiber(this.__wbg_ptr);
180
+ return ret >>> 0;
181
+ }
182
+ /**
183
+ * @returns {string}
184
+ */
185
+ stats_json() {
186
+ let deferred1_0;
187
+ let deferred1_1;
188
+ try {
189
+ const ret = wasm.brasswasmfiberreadyqueue_stats_json(this.__wbg_ptr);
190
+ deferred1_0 = ret[0];
191
+ deferred1_1 = ret[1];
192
+ return getStringFromWasm0(ret[0], ret[1]);
193
+ } finally {
194
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
195
+ }
196
+ }
197
+ }
198
+ if (Symbol.dispose) BrassWasmFiberReadyQueue.prototype[Symbol.dispose] = BrassWasmFiberReadyQueue.prototype.free;
199
+ exports.BrassWasmFiberReadyQueue = BrassWasmFiberReadyQueue;
200
+
88
201
  class BrassWasmFiberRegistry {
89
202
  __destroy_into_raw() {
90
203
  const ptr = this.__wbg_ptr;
@@ -215,6 +328,209 @@ class BrassWasmFiberRegistry {
215
328
  if (Symbol.dispose) BrassWasmFiberRegistry.prototype[Symbol.dispose] = BrassWasmFiberRegistry.prototype.free;
216
329
  exports.BrassWasmFiberRegistry = BrassWasmFiberRegistry;
217
330
 
331
+ class BrassWasmHttpPermitPool {
332
+ __destroy_into_raw() {
333
+ const ptr = this.__wbg_ptr;
334
+ this.__wbg_ptr = 0;
335
+ BrassWasmHttpPermitPoolFinalization.unregister(this);
336
+ return ptr;
337
+ }
338
+ free() {
339
+ const ptr = this.__destroy_into_raw();
340
+ wasm.__wbg_brasswasmhttppermitpool_free(ptr, 0);
341
+ }
342
+ /**
343
+ * @param {number} subject_id
344
+ * @param {number} key_id
345
+ * @param {bigint} now_ms
346
+ * @returns {number}
347
+ */
348
+ acquire(subject_id, key_id, now_ms) {
349
+ const ret = wasm.brasswasmhttppermitpool_acquire(this.__wbg_ptr, subject_id, key_id, now_ms);
350
+ return ret >>> 0;
351
+ }
352
+ /**
353
+ * @param {bigint} now_ms
354
+ * @returns {number}
355
+ */
356
+ advance_time(now_ms) {
357
+ const ret = wasm.brasswasmhttppermitpool_advance_time(this.__wbg_ptr, now_ms);
358
+ return ret >>> 0;
359
+ }
360
+ /**
361
+ * @param {number} permit_id
362
+ * @returns {boolean}
363
+ */
364
+ cancel(permit_id) {
365
+ const ret = wasm.brasswasmhttppermitpool_cancel(this.__wbg_ptr, permit_id);
366
+ return ret !== 0;
367
+ }
368
+ /**
369
+ * @param {string} key
370
+ * @returns {number}
371
+ */
372
+ intern_key(key) {
373
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
374
+ const len0 = WASM_VECTOR_LEN;
375
+ const ret = wasm.brasswasmhttppermitpool_intern_key(this.__wbg_ptr, ptr0, len0);
376
+ return ret >>> 0;
377
+ }
378
+ /**
379
+ * @returns {number}
380
+ */
381
+ last_permit_id() {
382
+ const ret = wasm.brasswasmhttppermitpool_last_permit_id(this.__wbg_ptr);
383
+ return ret >>> 0;
384
+ }
385
+ /**
386
+ * @returns {any}
387
+ */
388
+ memory() {
389
+ const ret = wasm.brasswasmhttppermitpool_memory(this.__wbg_ptr);
390
+ return ret;
391
+ }
392
+ /**
393
+ * @param {number} id
394
+ * @returns {number}
395
+ */
396
+ metric_u64(id) {
397
+ const ret = wasm.brasswasmhttppermitpool_metric_u64(this.__wbg_ptr, id);
398
+ return ret;
399
+ }
400
+ /**
401
+ * @returns {number}
402
+ */
403
+ metrics_snapshot_len() {
404
+ const ret = wasm.brasswasmhttppermitpool_metrics_snapshot_len(this.__wbg_ptr);
405
+ return ret >>> 0;
406
+ }
407
+ /**
408
+ * @returns {number}
409
+ */
410
+ metrics_snapshot_ptr() {
411
+ const ret = wasm.brasswasmhttppermitpool_metrics_snapshot_ptr(this.__wbg_ptr);
412
+ return ret >>> 0;
413
+ }
414
+ /**
415
+ * @param {number} concurrency
416
+ * @param {number} max_queue
417
+ * @param {bigint} queue_timeout_ms
418
+ */
419
+ constructor(concurrency, max_queue, queue_timeout_ms) {
420
+ const ret = wasm.brasswasmhttppermitpool_new(concurrency, max_queue, queue_timeout_ms);
421
+ this.__wbg_ptr = ret;
422
+ BrassWasmHttpPermitPoolFinalization.register(this, this.__wbg_ptr, this);
423
+ return this;
424
+ }
425
+ /**
426
+ * @returns {number}
427
+ */
428
+ next_deadline_ms() {
429
+ const ret = wasm.brasswasmhttppermitpool_next_deadline_ms(this.__wbg_ptr);
430
+ return ret;
431
+ }
432
+ /**
433
+ * @returns {number}
434
+ */
435
+ permit_events_len() {
436
+ const ret = wasm.brasswasmhttppermitpool_permit_events_len(this.__wbg_ptr);
437
+ return ret >>> 0;
438
+ }
439
+ /**
440
+ * @param {number} key_id
441
+ * @param {bigint} now_ms
442
+ * @returns {number}
443
+ */
444
+ release(key_id, now_ms) {
445
+ const ret = wasm.brasswasmhttppermitpool_release(this.__wbg_ptr, key_id, now_ms);
446
+ return ret >>> 0;
447
+ }
448
+ }
449
+ if (Symbol.dispose) BrassWasmHttpPermitPool.prototype[Symbol.dispose] = BrassWasmHttpPermitPool.prototype.free;
450
+ exports.BrassWasmHttpPermitPool = BrassWasmHttpPermitPool;
451
+
452
+ class BrassWasmRetryPlanner {
453
+ __destroy_into_raw() {
454
+ const ptr = this.__wbg_ptr;
455
+ this.__wbg_ptr = 0;
456
+ BrassWasmRetryPlannerFinalization.unregister(this);
457
+ return ptr;
458
+ }
459
+ free() {
460
+ const ptr = this.__destroy_into_raw();
461
+ wasm.__wbg_brasswasmretryplanner_free(ptr, 0);
462
+ }
463
+ /**
464
+ * @param {number} retry_id
465
+ * @returns {boolean}
466
+ */
467
+ drop_state(retry_id) {
468
+ const ret = wasm.brasswasmretryplanner_drop_state(this.__wbg_ptr, retry_id);
469
+ return ret !== 0;
470
+ }
471
+ /**
472
+ * @returns {any}
473
+ */
474
+ memory() {
475
+ const ret = wasm.brasswasmretryplanner_memory(this.__wbg_ptr);
476
+ return ret;
477
+ }
478
+ /**
479
+ * @param {number} id
480
+ * @returns {number}
481
+ */
482
+ metric_u64(id) {
483
+ const ret = wasm.brasswasmretryplanner_metric_u64(this.__wbg_ptr, id);
484
+ return ret;
485
+ }
486
+ /**
487
+ * @returns {number}
488
+ */
489
+ metrics_snapshot_len() {
490
+ const ret = wasm.brasswasmretryplanner_metrics_snapshot_len(this.__wbg_ptr);
491
+ return ret >>> 0;
492
+ }
493
+ /**
494
+ * @returns {number}
495
+ */
496
+ metrics_snapshot_ptr() {
497
+ const ret = wasm.brasswasmretryplanner_metrics_snapshot_ptr(this.__wbg_ptr);
498
+ return ret >>> 0;
499
+ }
500
+ constructor() {
501
+ const ret = wasm.brasswasmretryplanner_new();
502
+ this.__wbg_ptr = ret;
503
+ BrassWasmRetryPlannerFinalization.register(this, this.__wbg_ptr, this);
504
+ return this;
505
+ }
506
+ /**
507
+ * @param {number} retry_id
508
+ * @param {number} now_ms
509
+ * @param {boolean} retryable
510
+ * @param {number} retry_after_ms
511
+ * @returns {number}
512
+ */
513
+ next_delay_ms(retry_id, now_ms, retryable, retry_after_ms) {
514
+ const ret = wasm.brasswasmretryplanner_next_delay_ms(this.__wbg_ptr, retry_id, now_ms, retryable, retry_after_ms);
515
+ return ret;
516
+ }
517
+ /**
518
+ * @param {number} now_ms
519
+ * @param {number} max_retries
520
+ * @param {number} base_delay_ms
521
+ * @param {number} max_delay_ms
522
+ * @param {number} max_elapsed_ms
523
+ * @param {bigint} seed
524
+ * @returns {number}
525
+ */
526
+ start(now_ms, max_retries, base_delay_ms, max_delay_ms, max_elapsed_ms, seed) {
527
+ const ret = wasm.brasswasmretryplanner_start(this.__wbg_ptr, now_ms, max_retries, base_delay_ms, max_delay_ms, max_elapsed_ms, seed);
528
+ return ret >>> 0;
529
+ }
530
+ }
531
+ if (Symbol.dispose) BrassWasmRetryPlanner.prototype[Symbol.dispose] = BrassWasmRetryPlanner.prototype.free;
532
+ exports.BrassWasmRetryPlanner = BrassWasmRetryPlanner;
533
+
218
534
  class BrassWasmRingBuffer {
219
535
  __destroy_into_raw() {
220
536
  const ptr = this.__wbg_ptr;
@@ -291,7 +607,6 @@ class BrassWasmSchedulerStateMachine {
291
607
  wasm.__wbg_brasswasmschedulerstatemachine_free(ptr, 0);
292
608
  }
293
609
  /**
294
- * Enter flushing. Returns the number of tasks this flush may run.
295
610
  * @returns {number}
296
611
  */
297
612
  begin_flush() {
@@ -309,10 +624,6 @@ class BrassWasmSchedulerStateMachine {
309
624
  wasm.brasswasmschedulerstatemachine_clear(this.__wbg_ptr);
310
625
  }
311
626
  /**
312
- * Finish a flush. Returns the scheduling policy for the next flush:
313
- * - 0 => schedule a micro flush
314
- * - 1 => schedule a macro flush
315
- * - 2 => no more work
316
627
  * @param {number} ran
317
628
  * @returns {number}
318
629
  */
@@ -321,16 +632,50 @@ class BrassWasmSchedulerStateMachine {
321
632
  return ret >>> 0;
322
633
  }
323
634
  /**
324
- * Enqueue a task ref and return the scheduling policy:
325
- * - 0 => schedule a micro flush
326
- * - 1 => schedule a macro flush
327
- * - 2 => no new flush needed
328
- * - 3 => queue full / task dropped
329
635
  * @param {number} task_ref
636
+ * @param {string} tag
330
637
  * @returns {number}
331
638
  */
332
- enqueue(task_ref) {
333
- const ret = wasm.brasswasmschedulerstatemachine_enqueue(this.__wbg_ptr, task_ref);
639
+ enqueue(task_ref, tag) {
640
+ const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
641
+ const len0 = WASM_VECTOR_LEN;
642
+ const ret = wasm.brasswasmschedulerstatemachine_enqueue(this.__wbg_ptr, task_ref, ptr0, len0);
643
+ return ret >>> 0;
644
+ }
645
+ /**
646
+ * Enqueue multiple tasks in a single boundary crossing.
647
+ * Returns a Uint32Array of policies (one per task):
648
+ * - 0 = SCHEDULER_POLICY_MICRO
649
+ * - 1 = SCHEDULER_POLICY_MACRO
650
+ * - 2 = SCHEDULER_POLICY_NONE (already scheduled)
651
+ * - 3 = SCHEDULER_POLICY_DROPPED
652
+ * @param {Uint32Array} task_refs
653
+ * @param {Array<any>} tags
654
+ * @returns {Uint32Array}
655
+ */
656
+ enqueue_batch(task_refs, tags) {
657
+ const ptr0 = passArray32ToWasm0(task_refs, wasm.__wbindgen_malloc);
658
+ const len0 = WASM_VECTOR_LEN;
659
+ const ret = wasm.brasswasmschedulerstatemachine_enqueue_batch(this.__wbg_ptr, ptr0, len0, tags);
660
+ return ret;
661
+ }
662
+ /**
663
+ * @param {number} task_ref
664
+ * @param {number} lane_id
665
+ * @returns {number}
666
+ */
667
+ enqueue_lane(task_ref, lane_id) {
668
+ const ret = wasm.brasswasmschedulerstatemachine_enqueue_lane(this.__wbg_ptr, task_ref, lane_id);
669
+ return ret >>> 0;
670
+ }
671
+ /**
672
+ * @param {string} key
673
+ * @returns {number}
674
+ */
675
+ intern_lane(key) {
676
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
677
+ const len0 = WASM_VECTOR_LEN;
678
+ const ret = wasm.brasswasmschedulerstatemachine_intern_lane(this.__wbg_ptr, ptr0, len0);
334
679
  return ret >>> 0;
335
680
  }
336
681
  /**
@@ -347,6 +692,14 @@ class BrassWasmSchedulerStateMachine {
347
692
  const ret = wasm.brasswasmschedulerstatemachine_is_scheduled(this.__wbg_ptr);
348
693
  return ret !== 0;
349
694
  }
695
+ /**
696
+ * @param {number} lane_id
697
+ * @returns {number}
698
+ */
699
+ lane_len(lane_id) {
700
+ const ret = wasm.brasswasmschedulerstatemachine_lane_len(this.__wbg_ptr, lane_id);
701
+ return ret >>> 0;
702
+ }
350
703
  /**
351
704
  * @returns {number}
352
705
  */
@@ -355,13 +708,24 @@ class BrassWasmSchedulerStateMachine {
355
708
  return ret >>> 0;
356
709
  }
357
710
  /**
358
- * @param {number} initial_capacity
711
+ * @param {number} id
712
+ * @returns {number}
713
+ */
714
+ metric_u64(id) {
715
+ const ret = wasm.brasswasmschedulerstatemachine_metric_u64(this.__wbg_ptr, id);
716
+ return ret;
717
+ }
718
+ /**
719
+ * @param {number} _initial_capacity
359
720
  * @param {number} max_capacity
360
721
  * @param {number} flush_budget
361
722
  * @param {number} micro_threshold
723
+ * @param {number} lane_capacity
724
+ * @param {number} lane_budget
725
+ * @param {number} max_lanes
362
726
  */
363
- constructor(initial_capacity, max_capacity, flush_budget, micro_threshold) {
364
- const ret = wasm.brasswasmschedulerstatemachine_new(initial_capacity, max_capacity, flush_budget, micro_threshold);
727
+ constructor(_initial_capacity, max_capacity, flush_budget, micro_threshold, lane_capacity, lane_budget, max_lanes) {
728
+ const ret = wasm.brasswasmschedulerstatemachine_new(_initial_capacity, max_capacity, flush_budget, micro_threshold, lane_capacity, lane_budget, max_lanes);
365
729
  this.__wbg_ptr = ret;
366
730
  BrassWasmSchedulerStateMachineFinalization.register(this, this.__wbg_ptr, this);
367
731
  return this;
@@ -392,6 +756,100 @@ class BrassWasmSchedulerStateMachine {
392
756
  if (Symbol.dispose) BrassWasmSchedulerStateMachine.prototype[Symbol.dispose] = BrassWasmSchedulerStateMachine.prototype.free;
393
757
  exports.BrassWasmSchedulerStateMachine = BrassWasmSchedulerStateMachine;
394
758
 
759
+ class BrassWasmTimerWheel {
760
+ __destroy_into_raw() {
761
+ const ptr = this.__wbg_ptr;
762
+ this.__wbg_ptr = 0;
763
+ BrassWasmTimerWheelFinalization.unregister(this);
764
+ return ptr;
765
+ }
766
+ free() {
767
+ const ptr = this.__destroy_into_raw();
768
+ wasm.__wbg_brasswasmtimerwheel_free(ptr, 0);
769
+ }
770
+ /**
771
+ * @param {bigint} now_ms
772
+ * @returns {number}
773
+ */
774
+ advance_time(now_ms) {
775
+ const ret = wasm.brasswasmtimerwheel_advance_time(this.__wbg_ptr, now_ms);
776
+ return ret >>> 0;
777
+ }
778
+ /**
779
+ * @param {number} timer_id
780
+ * @returns {boolean}
781
+ */
782
+ cancel(timer_id) {
783
+ const ret = wasm.brasswasmtimerwheel_cancel(this.__wbg_ptr, timer_id);
784
+ return ret !== 0;
785
+ }
786
+ /**
787
+ * @returns {number}
788
+ */
789
+ expired_len() {
790
+ const ret = wasm.brasswasmtimerwheel_expired_len(this.__wbg_ptr);
791
+ return ret >>> 0;
792
+ }
793
+ /**
794
+ * @returns {any}
795
+ */
796
+ memory() {
797
+ const ret = wasm.brasswasmtimerwheel_memory(this.__wbg_ptr);
798
+ return ret;
799
+ }
800
+ /**
801
+ * @param {number} id
802
+ * @returns {number}
803
+ */
804
+ metric_u64(id) {
805
+ const ret = wasm.brasswasmtimerwheel_metric_u64(this.__wbg_ptr, id);
806
+ return ret;
807
+ }
808
+ /**
809
+ * @returns {number}
810
+ */
811
+ metrics_snapshot_len() {
812
+ const ret = wasm.brasswasmtimerwheel_metrics_snapshot_len(this.__wbg_ptr);
813
+ return ret >>> 0;
814
+ }
815
+ /**
816
+ * @returns {number}
817
+ */
818
+ metrics_snapshot_ptr() {
819
+ const ret = wasm.brasswasmtimerwheel_metrics_snapshot_ptr(this.__wbg_ptr);
820
+ return ret >>> 0;
821
+ }
822
+ /**
823
+ * @param {bigint} tick_ms
824
+ * @param {number} bucket_count
825
+ */
826
+ constructor(tick_ms, bucket_count) {
827
+ const ret = wasm.brasswasmtimerwheel_new(tick_ms, bucket_count);
828
+ this.__wbg_ptr = ret;
829
+ BrassWasmTimerWheelFinalization.register(this, this.__wbg_ptr, this);
830
+ return this;
831
+ }
832
+ /**
833
+ * @returns {number}
834
+ */
835
+ next_deadline_ms() {
836
+ const ret = wasm.brasswasmtimerwheel_next_deadline_ms(this.__wbg_ptr);
837
+ return ret;
838
+ }
839
+ /**
840
+ * @param {number} subject_id
841
+ * @param {number} kind
842
+ * @param {bigint} deadline_ms
843
+ * @returns {number}
844
+ */
845
+ schedule_deadline(subject_id, kind, deadline_ms) {
846
+ const ret = wasm.brasswasmtimerwheel_schedule_deadline(this.__wbg_ptr, subject_id, kind, deadline_ms);
847
+ return ret >>> 0;
848
+ }
849
+ }
850
+ if (Symbol.dispose) BrassWasmTimerWheel.prototype[Symbol.dispose] = BrassWasmTimerWheel.prototype.free;
851
+ exports.BrassWasmTimerWheel = BrassWasmTimerWheel;
852
+
395
853
  class BrassWasmVm {
396
854
  __destroy_into_raw() {
397
855
  const ptr = this.__wbg_ptr;
@@ -413,12 +871,55 @@ class BrassWasmVm {
413
871
  const ret = wasm.brasswasmvm_create_fiber(this.__wbg_ptr, ptr0, len0);
414
872
  return ret >>> 0;
415
873
  }
874
+ /**
875
+ * @param {Uint32Array} program_words
876
+ * @returns {number}
877
+ */
878
+ create_fiber_bin(program_words) {
879
+ const ptr0 = passArray32ToWasm0(program_words, wasm.__wbindgen_malloc);
880
+ const len0 = WASM_VECTOR_LEN;
881
+ const ret = wasm.brasswasmvm_create_fiber_bin(this.__wbg_ptr, ptr0, len0);
882
+ return ret >>> 0;
883
+ }
884
+ /**
885
+ * @param {number} word_len
886
+ * @returns {number}
887
+ */
888
+ create_fiber_from_program_words(word_len) {
889
+ const ret = wasm.brasswasmvm_create_fiber_from_program_words(this.__wbg_ptr, word_len);
890
+ return ret >>> 0;
891
+ }
892
+ /**
893
+ * @param {number} fiber_id
894
+ * @param {number} budget
895
+ * @returns {Uint32Array}
896
+ */
897
+ drive_batch_bin(fiber_id, budget) {
898
+ const ret = wasm.brasswasmvm_drive_batch_bin(this.__wbg_ptr, fiber_id, budget);
899
+ return ret;
900
+ }
901
+ /**
902
+ * @param {number} fiber_id
903
+ * @param {number} budget
904
+ * @returns {number}
905
+ */
906
+ drive_batch_ptr(fiber_id, budget) {
907
+ const ret = wasm.brasswasmvm_drive_batch_ptr(this.__wbg_ptr, fiber_id, budget);
908
+ return ret >>> 0;
909
+ }
416
910
  /**
417
911
  * @param {number} fiber_id
418
912
  */
419
913
  drop_fiber(fiber_id) {
420
914
  wasm.brasswasmvm_drop_fiber(this.__wbg_ptr, fiber_id);
421
915
  }
916
+ /**
917
+ * @returns {number}
918
+ */
919
+ event_batch_len() {
920
+ const ret = wasm.brasswasmvm_event_batch_len(this.__wbg_ptr);
921
+ return ret >>> 0;
922
+ }
422
923
  /**
423
924
  * @param {number} fiber_id
424
925
  * @param {number} reason_ref
@@ -436,6 +937,55 @@ class BrassWasmVm {
436
937
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
437
938
  }
438
939
  }
940
+ /**
941
+ * @param {number} fiber_id
942
+ * @param {number} reason_ref
943
+ * @param {number} budget
944
+ * @returns {Uint32Array}
945
+ */
946
+ interrupt_bin(fiber_id, reason_ref, budget) {
947
+ const ret = wasm.brasswasmvm_interrupt_bin(this.__wbg_ptr, fiber_id, reason_ref, budget);
948
+ return ret;
949
+ }
950
+ /**
951
+ * @param {number} fiber_id
952
+ * @param {number} reason_ref
953
+ * @param {number} budget
954
+ * @returns {number}
955
+ */
956
+ interrupt_ptr(fiber_id, reason_ref, budget) {
957
+ const ret = wasm.brasswasmvm_interrupt_ptr(this.__wbg_ptr, fiber_id, reason_ref, budget);
958
+ return ret >>> 0;
959
+ }
960
+ /**
961
+ * @returns {any}
962
+ */
963
+ memory() {
964
+ const ret = wasm.brasswasmvm_memory(this.__wbg_ptr);
965
+ return ret;
966
+ }
967
+ /**
968
+ * @param {number} id
969
+ * @returns {number}
970
+ */
971
+ metric_u64(id) {
972
+ const ret = wasm.brasswasmvm_metric_u64(this.__wbg_ptr, id);
973
+ return ret;
974
+ }
975
+ /**
976
+ * @returns {number}
977
+ */
978
+ metrics_snapshot_len() {
979
+ const ret = wasm.brasswasmvm_metrics_snapshot_len(this.__wbg_ptr);
980
+ return ret >>> 0;
981
+ }
982
+ /**
983
+ * @returns {number}
984
+ */
985
+ metrics_snapshot_ptr() {
986
+ const ret = wasm.brasswasmvm_metrics_snapshot_ptr(this.__wbg_ptr);
987
+ return ret >>> 0;
988
+ }
439
989
  constructor() {
440
990
  const ret = wasm.brasswasmvm_new();
441
991
  this.__wbg_ptr = ret;
@@ -458,6 +1008,30 @@ class BrassWasmVm {
458
1008
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
459
1009
  }
460
1010
  }
1011
+ /**
1012
+ * @param {number} fiber_id
1013
+ * @returns {Uint32Array}
1014
+ */
1015
+ poll_bin(fiber_id) {
1016
+ const ret = wasm.brasswasmvm_poll_bin(this.__wbg_ptr, fiber_id);
1017
+ return ret;
1018
+ }
1019
+ /**
1020
+ * @param {number} word_len
1021
+ * @returns {number}
1022
+ */
1023
+ prepare_patch_words(word_len) {
1024
+ const ret = wasm.brasswasmvm_prepare_patch_words(this.__wbg_ptr, word_len);
1025
+ return ret >>> 0;
1026
+ }
1027
+ /**
1028
+ * @param {number} word_len
1029
+ * @returns {number}
1030
+ */
1031
+ prepare_program_words(word_len) {
1032
+ const ret = wasm.brasswasmvm_prepare_program_words(this.__wbg_ptr, word_len);
1033
+ return ret >>> 0;
1034
+ }
461
1035
  /**
462
1036
  * @param {number} fiber_id
463
1037
  * @param {number} root
@@ -478,6 +1052,30 @@ class BrassWasmVm {
478
1052
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
479
1053
  }
480
1054
  }
1055
+ /**
1056
+ * @param {number} fiber_id
1057
+ * @param {number} root
1058
+ * @param {Uint32Array} nodes_words
1059
+ * @param {number} budget
1060
+ * @returns {Uint32Array}
1061
+ */
1062
+ provide_effect_bin(fiber_id, root, nodes_words, budget) {
1063
+ const ptr0 = passArray32ToWasm0(nodes_words, wasm.__wbindgen_malloc);
1064
+ const len0 = WASM_VECTOR_LEN;
1065
+ const ret = wasm.brasswasmvm_provide_effect_bin(this.__wbg_ptr, fiber_id, root, ptr0, len0, budget);
1066
+ return ret;
1067
+ }
1068
+ /**
1069
+ * @param {number} fiber_id
1070
+ * @param {number} root
1071
+ * @param {number} word_len
1072
+ * @param {number} budget
1073
+ * @returns {number}
1074
+ */
1075
+ provide_effect_from_words(fiber_id, root, word_len, budget) {
1076
+ const ret = wasm.brasswasmvm_provide_effect_from_words(this.__wbg_ptr, fiber_id, root, word_len, budget);
1077
+ return ret >>> 0;
1078
+ }
481
1079
  /**
482
1080
  * @param {number} fiber_id
483
1081
  * @param {number} error_ref
@@ -495,6 +1093,26 @@ class BrassWasmVm {
495
1093
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
496
1094
  }
497
1095
  }
1096
+ /**
1097
+ * @param {number} fiber_id
1098
+ * @param {number} error_ref
1099
+ * @param {number} budget
1100
+ * @returns {Uint32Array}
1101
+ */
1102
+ provide_error_bin(fiber_id, error_ref, budget) {
1103
+ const ret = wasm.brasswasmvm_provide_error_bin(this.__wbg_ptr, fiber_id, error_ref, budget);
1104
+ return ret;
1105
+ }
1106
+ /**
1107
+ * @param {number} fiber_id
1108
+ * @param {number} error_ref
1109
+ * @param {number} budget
1110
+ * @returns {number}
1111
+ */
1112
+ provide_error_ptr(fiber_id, error_ref, budget) {
1113
+ const ret = wasm.brasswasmvm_provide_error_ptr(this.__wbg_ptr, fiber_id, error_ref, budget);
1114
+ return ret >>> 0;
1115
+ }
498
1116
  /**
499
1117
  * @param {number} fiber_id
500
1118
  * @param {number} value_ref
@@ -512,6 +1130,26 @@ class BrassWasmVm {
512
1130
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
513
1131
  }
514
1132
  }
1133
+ /**
1134
+ * @param {number} fiber_id
1135
+ * @param {number} value_ref
1136
+ * @param {number} budget
1137
+ * @returns {Uint32Array}
1138
+ */
1139
+ provide_value_bin(fiber_id, value_ref, budget) {
1140
+ const ret = wasm.brasswasmvm_provide_value_bin(this.__wbg_ptr, fiber_id, value_ref, budget);
1141
+ return ret;
1142
+ }
1143
+ /**
1144
+ * @param {number} fiber_id
1145
+ * @param {number} value_ref
1146
+ * @param {number} budget
1147
+ * @returns {number}
1148
+ */
1149
+ provide_value_ptr(fiber_id, value_ref, budget) {
1150
+ const ret = wasm.brasswasmvm_provide_value_ptr(this.__wbg_ptr, fiber_id, value_ref, budget);
1151
+ return ret >>> 0;
1152
+ }
515
1153
  /**
516
1154
  * @returns {string}
517
1155
  */
@@ -533,9 +1171,25 @@ exports.BrassWasmVm = BrassWasmVm;
533
1171
  function __wbg_get_imports() {
534
1172
  const import0 = {
535
1173
  __proto__: null,
1174
+ __wbg___wbindgen_memory_c2356dd1a089dfbd: function() {
1175
+ const ret = wasm.memory;
1176
+ return ret;
1177
+ },
1178
+ __wbg___wbindgen_string_get_965592073e5d848c: function(arg0, arg1) {
1179
+ const obj = arg1;
1180
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1181
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1182
+ var len1 = WASM_VECTOR_LEN;
1183
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1184
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1185
+ },
536
1186
  __wbg___wbindgen_throw_9c75d47bf9e7731e: function(arg0, arg1) {
537
1187
  throw new Error(getStringFromWasm0(arg0, arg1));
538
1188
  },
1189
+ __wbg_get_652f640b3b0b6e3e: function(arg0, arg1) {
1190
+ const ret = arg0[arg1 >>> 0];
1191
+ return ret;
1192
+ },
539
1193
  __wbg_length_0a6ce016dc1460b0: function(arg0) {
540
1194
  const ret = arg0.length;
541
1195
  return ret;
@@ -544,9 +1198,16 @@ function __wbg_get_imports() {
544
1198
  const ret = new Array(arg0 >>> 0);
545
1199
  return ret;
546
1200
  },
1201
+ __wbg_new_with_length_b91f070a091394cc: function(arg0) {
1202
+ const ret = new Uint32Array(arg0 >>> 0);
1203
+ return ret;
1204
+ },
547
1205
  __wbg_set_f614f6a0608d1d1d: function(arg0, arg1, arg2) {
548
1206
  arg0[arg1 >>> 0] = arg2;
549
1207
  },
1208
+ __wbg_set_index_9fd290d1cce481b3: function(arg0, arg1, arg2) {
1209
+ arg0[arg1 >>> 0] = arg2 >>> 0;
1210
+ },
550
1211
  __wbindgen_init_externref_table: function() {
551
1212
  const table = wasm.__wbindgen_externrefs;
552
1213
  const offset = table.grow(4);
@@ -566,23 +1227,51 @@ function __wbg_get_imports() {
566
1227
  const BrassWasmChunkBufferFinalization = (typeof FinalizationRegistry === 'undefined')
567
1228
  ? { register: () => {}, unregister: () => {} }
568
1229
  : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmchunkbuffer_free(ptr, 1));
1230
+ const BrassWasmFiberReadyQueueFinalization = (typeof FinalizationRegistry === 'undefined')
1231
+ ? { register: () => {}, unregister: () => {} }
1232
+ : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmfiberreadyqueue_free(ptr, 1));
569
1233
  const BrassWasmFiberRegistryFinalization = (typeof FinalizationRegistry === 'undefined')
570
1234
  ? { register: () => {}, unregister: () => {} }
571
1235
  : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmfiberregistry_free(ptr, 1));
1236
+ const BrassWasmHttpPermitPoolFinalization = (typeof FinalizationRegistry === 'undefined')
1237
+ ? { register: () => {}, unregister: () => {} }
1238
+ : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmhttppermitpool_free(ptr, 1));
1239
+ const BrassWasmRetryPlannerFinalization = (typeof FinalizationRegistry === 'undefined')
1240
+ ? { register: () => {}, unregister: () => {} }
1241
+ : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmretryplanner_free(ptr, 1));
572
1242
  const BrassWasmRingBufferFinalization = (typeof FinalizationRegistry === 'undefined')
573
1243
  ? { register: () => {}, unregister: () => {} }
574
1244
  : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmringbuffer_free(ptr, 1));
575
1245
  const BrassWasmSchedulerStateMachineFinalization = (typeof FinalizationRegistry === 'undefined')
576
1246
  ? { register: () => {}, unregister: () => {} }
577
1247
  : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmschedulerstatemachine_free(ptr, 1));
1248
+ const BrassWasmTimerWheelFinalization = (typeof FinalizationRegistry === 'undefined')
1249
+ ? { register: () => {}, unregister: () => {} }
1250
+ : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmtimerwheel_free(ptr, 1));
578
1251
  const BrassWasmVmFinalization = (typeof FinalizationRegistry === 'undefined')
579
1252
  ? { register: () => {}, unregister: () => {} }
580
1253
  : new FinalizationRegistry(ptr => wasm.__wbg_brasswasmvm_free(ptr, 1));
581
1254
 
1255
+ let cachedDataViewMemory0 = null;
1256
+ function getDataViewMemory0() {
1257
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1258
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1259
+ }
1260
+ return cachedDataViewMemory0;
1261
+ }
1262
+
582
1263
  function getStringFromWasm0(ptr, len) {
583
1264
  return decodeText(ptr >>> 0, len);
584
1265
  }
585
1266
 
1267
+ let cachedUint32ArrayMemory0 = null;
1268
+ function getUint32ArrayMemory0() {
1269
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1270
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1271
+ }
1272
+ return cachedUint32ArrayMemory0;
1273
+ }
1274
+
586
1275
  let cachedUint8ArrayMemory0 = null;
587
1276
  function getUint8ArrayMemory0() {
588
1277
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
@@ -591,6 +1280,17 @@ function getUint8ArrayMemory0() {
591
1280
  return cachedUint8ArrayMemory0;
592
1281
  }
593
1282
 
1283
+ function isLikeNone(x) {
1284
+ return x === undefined || x === null;
1285
+ }
1286
+
1287
+ function passArray32ToWasm0(arg, malloc) {
1288
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1289
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1290
+ WASM_VECTOR_LEN = arg.length;
1291
+ return ptr;
1292
+ }
1293
+
594
1294
  function passStringToWasm0(arg, malloc, realloc) {
595
1295
  if (realloc === undefined) {
596
1296
  const buf = cachedTextEncoder.encode(arg);