brass-runtime 1.16.0 → 1.16.1
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/CHANGELOG.md +17 -0
- package/README.md +283 -18
- package/dist/agent/cli/main.cjs +38 -38
- package/dist/agent/cli/main.js +6 -6
- package/dist/agent/cli/main.mjs +6 -6
- package/dist/agent/index.cjs +7 -7
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +6 -6
- package/dist/agent/index.mjs +6 -6
- package/dist/chunk-2HQTDLHF.mjs +683 -0
- package/dist/chunk-36I3M4UC.mjs +370 -0
- package/dist/{chunk-QY5FKYEQ.js → chunk-3AYM6WPJ.js} +570 -51
- package/dist/chunk-3LOYJFRR.cjs +300 -0
- package/dist/chunk-3Y2RIUMM.js +300 -0
- package/dist/{chunk-N6VHMOWB.cjs → chunk-4ROBZFL6.cjs} +128 -128
- package/dist/{chunk-NC5SDRYE.js → chunk-52OB2ROS.js} +4 -4
- package/dist/{chunk-JX3LZQJH.cjs → chunk-52PPNNI4.cjs} +82 -20
- package/dist/{chunk-5YOQOXEQ.cjs → chunk-5EC274J5.cjs} +676 -293
- package/dist/chunk-5QC7LRZ3.js +229 -0
- package/dist/{chunk-7TL2LHQJ.js → chunk-5VRJNBLZ.mjs} +524 -141
- package/dist/chunk-62AZW6UT.cjs +313 -0
- package/dist/chunk-6IXXWIUM.js +683 -0
- package/dist/chunk-74ZTY6CP.js +2871 -0
- package/dist/chunk-76YMRMH2.cjs +777 -0
- package/dist/chunk-7CMJS3QE.mjs +2871 -0
- package/dist/{chunk-2WC63LJK.mjs → chunk-7JIJOVCT.js} +20 -10
- package/dist/{chunk-FM4W4QPL.js → chunk-A2OM6NEH.mjs} +5 -4
- package/dist/chunk-AGR5B2BC.cjs +683 -0
- package/dist/chunk-AVNQLJ5V.js +777 -0
- package/dist/chunk-B33ICAKP.js +313 -0
- package/dist/{chunk-J3H54ZRV.mjs → chunk-B5JD23U7.mjs} +1 -1
- package/dist/chunk-BABBZK4Y.js +2024 -0
- package/dist/{chunk-U5KWK3PX.mjs → chunk-C3MDXTRZ.js} +11 -0
- package/dist/{chunk-F5EUMJL7.mjs → chunk-CIZFIMK5.js} +55 -5
- package/dist/{chunk-SPUEME2B.cjs → chunk-CZIVE6NT.cjs} +12 -1
- package/dist/{chunk-TDVMADDN.js → chunk-DNFJLJMW.mjs} +11 -0
- package/dist/chunk-DNFO2EIZ.mjs +777 -0
- package/dist/{chunk-XDZOO4L5.js → chunk-EJ6BPYVR.mjs} +79 -17
- package/dist/{chunk-JNFRRJYH.cjs → chunk-ENKODRU3.cjs} +242 -192
- package/dist/chunk-EOC4UHBS.mjs +229 -0
- package/dist/{chunk-7LVI2GIN.js → chunk-FH2X7BVP.js} +507 -72
- package/dist/{chunk-OOGJ73B6.js → chunk-FHQGHPMO.mjs} +20 -10
- package/dist/{chunk-WQ5QNU5R.cjs → chunk-GLE2WY7Z.cjs} +652 -217
- package/dist/{chunk-G6IQOE4P.mjs → chunk-GYM3LLGS.mjs} +507 -72
- package/dist/chunk-HLWLMW2F.mjs +2024 -0
- package/dist/{chunk-TVN5I4U6.cjs → chunk-JF5WGYJJ.cjs} +25 -24
- package/dist/{chunk-CY33PGEX.mjs → chunk-KH4SYAOS.mjs} +570 -51
- package/dist/chunk-KN32XNTH.mjs +313 -0
- package/dist/chunk-KQLYONSE.cjs +2871 -0
- package/dist/{chunk-7HUOJA4W.cjs → chunk-KZJQ723N.cjs} +90 -80
- package/dist/{chunk-CCKHV5BT.mjs → chunk-L2SYFEBS.js} +5 -4
- package/dist/{chunk-IJT6RRQ5.cjs → chunk-L6VB5N7Q.cjs} +20 -9
- package/dist/{chunk-ZGLD4TVZ.mjs → chunk-MBEJI5HF.mjs} +4 -4
- package/dist/{chunk-PRWCB3QL.mjs → chunk-MIIYDLGM.js} +524 -141
- package/dist/{chunk-H55LI6WY.js → chunk-MOO4L7F4.mjs} +15 -4
- package/dist/{chunk-7XOPAB5Q.js → chunk-MT3OWDPC.mjs} +55 -5
- package/dist/chunk-MVGUEJ5Z.cjs +370 -0
- package/dist/chunk-PD4EJTQC.cjs +229 -0
- package/dist/chunk-PWC3RBQE.mjs +300 -0
- package/dist/{chunk-MWXMNYJS.cjs → chunk-Q2I37RP3.cjs} +643 -124
- package/dist/{chunk-VFIUZG7J.mjs → chunk-RKGKFN2A.js} +79 -17
- package/dist/{chunk-NYL4D7SK.cjs → chunk-SA6HUJVI.cjs} +5 -5
- package/dist/{chunk-K2T3DV26.mjs → chunk-TRM4JUZQ.js} +15 -4
- package/dist/chunk-UB4B6OFY.js +370 -0
- package/dist/{chunk-G3XGCZDQ.js → chunk-UCUBNWM2.js} +1 -1
- package/dist/chunk-VN44DYYT.cjs +2024 -0
- package/dist/{client-CtFmoDvM.d.ts → client-CZHU674n.d.ts} +211 -36
- package/dist/core/index.cjs +135 -9
- package/dist/core/index.d.ts +238 -33
- package/dist/core/index.js +155 -29
- package/dist/core/index.mjs +155 -29
- package/dist/{effect-CGNl5Rqp.d.ts → effect-DIUHZ9IN.d.ts} +89 -1
- package/dist/effectRunner-CFLC32IK.cjs +8 -0
- package/dist/{effectRunner-A4CHJXJI.js → effectRunner-L4S7IPT3.js} +2 -2
- package/dist/{effectRunner-OPUF6QRN.mjs → effectRunner-NNGG75QA.mjs} +2 -2
- package/dist/http/index.cjs +324 -2986
- package/dist/http/index.d.ts +54 -68
- package/dist/http/index.js +238 -2900
- package/dist/http/index.mjs +238 -2900
- package/dist/http/testing.cjs +14 -12
- package/dist/http/testing.d.ts +5 -4
- package/dist/http/testing.js +10 -8
- package/dist/http/testing.mjs +10 -8
- package/dist/index.cjs +423 -255
- package/dist/index.d.ts +87 -69
- package/dist/index.js +301 -133
- package/dist/index.mjs +301 -133
- package/dist/observability/index.cjs +16 -531
- package/dist/observability/index.d.ts +81 -8
- package/dist/observability/index.js +23 -538
- package/dist/observability/index.mjs +23 -538
- package/dist/perf/cli.cjs +401 -0
- package/dist/perf/cli.d.ts +1 -0
- package/dist/perf/cli.js +401 -0
- package/dist/perf/cli.mjs +401 -0
- package/dist/perf/index.cjs +141 -0
- package/dist/perf/index.d.ts +483 -0
- package/dist/perf/index.js +141 -0
- package/dist/perf/index.mjs +141 -0
- package/dist/schedule-CK3Ml_7p.d.ts +259 -0
- package/dist/schema/index.cjs +6 -2
- package/dist/schema/index.d.ts +3 -1
- package/dist/schema/index.js +5 -1
- package/dist/schema/index.mjs +5 -1
- package/dist/{server-C8hDXA74.d.ts → server-GJPg8ZSG.d.ts} +4 -3
- package/dist/{stream-dvSs0QS5.d.ts → stream-B4oK9JFP.d.ts} +1 -1
- package/dist/{tracer-B5tRH9H7.d.ts → tracer-Hwt1cl7h.d.ts} +13 -54
- package/dist/{tracing-Dt9S_6V8.d.ts → tracing-DqbTKGcf.d.ts} +1 -1
- package/docs/ARCHITECTURE.md +292 -0
- package/docs/README.md +63 -0
- package/docs/adr/0001-ai-context-pack.md +32 -0
- package/docs/agent-apply-mode.md +104 -0
- package/docs/agent-approvals.md +110 -0
- package/docs/agent-batch.md +185 -0
- package/docs/agent-boundaries.md +112 -0
- package/docs/agent-chat-sessions.md +160 -0
- package/docs/agent-ci.md +17 -0
- package/docs/agent-cli.md +405 -0
- package/docs/agent-config.md +480 -0
- package/docs/agent-context-discovery.md +159 -0
- package/docs/agent-copilot-like-dx.md +126 -0
- package/docs/agent-declarative-optimized-planning.md +138 -0
- package/docs/agent-dx.md +224 -0
- package/docs/agent-env-files.md +126 -0
- package/docs/agent-follow-up-context.md +43 -0
- package/docs/agent-global-usage.md +180 -0
- package/docs/agent-init.md +109 -0
- package/docs/agent-install-and-configure.md +516 -0
- package/docs/agent-language-workspace-ux.md +99 -0
- package/docs/agent-llm-adapters.md +123 -0
- package/docs/agent-local-install.md +190 -0
- package/docs/agent-local-tests.md +51 -0
- package/docs/agent-observability.md +155 -0
- package/docs/agent-patch-quality-loop.md +162 -0
- package/docs/agent-presets.md +22 -0
- package/docs/agent-project-commands.md +237 -0
- package/docs/agent-project-intelligence.md +156 -0
- package/docs/agent-redaction.md +18 -0
- package/docs/agent-release-readiness.md +76 -0
- package/docs/agent-rollback-safety.md +162 -0
- package/docs/agent-rollback.md +23 -0
- package/docs/agent-run-artifacts.md +16 -0
- package/docs/agent-vscode-auto-discovery.md +137 -0
- package/docs/agent-vscode-batch-runner.md +100 -0
- package/docs/agent-vscode-chat-layout.md +90 -0
- package/docs/agent-vscode-clean-install.md +147 -0
- package/docs/agent-vscode-code-actions.md +70 -0
- package/docs/agent-vscode-diff-preview.md +45 -0
- package/docs/agent-vscode-inline-assist.md +56 -0
- package/docs/agent-vscode-install.md +186 -0
- package/docs/agent-vscode-model-setup.md +97 -0
- package/docs/agent-vscode-patch-preview.md +92 -0
- package/docs/agent-vscode-problems.md +79 -0
- package/docs/agent-vscode-project-dashboard.md +106 -0
- package/docs/agent-vscode-run-history.md +92 -0
- package/docs/agent-vscode-ux.md +73 -0
- package/docs/ai/INVARIANTS.md +84 -0
- package/docs/ai/PROJECT_MAP.md +338 -0
- package/docs/ai/PUBLIC_API.md +336 -0
- package/docs/ai/VALIDATION_MATRIX.md +67 -0
- package/docs/api-polish.md +37 -0
- package/docs/cancellation.md +162 -0
- package/docs/coverage.md +46 -0
- package/docs/getting-started.md +159 -0
- package/docs/guides/README.md +40 -0
- package/docs/guides/circuit-breaker.md +89 -0
- package/docs/guides/error-handling.md +91 -0
- package/docs/guides/getting-started.md +107 -0
- package/docs/guides/layers.md +189 -0
- package/docs/guides/metrics.md +101 -0
- package/docs/guides/resource-management.md +141 -0
- package/docs/guides/retry.md +215 -0
- package/docs/guides/semaphore.md +66 -0
- package/docs/guides/streams.md +117 -0
- package/docs/guides/supervisors.md +98 -0
- package/docs/guides/testing.md +162 -0
- package/docs/guides/tracing.md +71 -0
- package/docs/http-recipes.md +399 -0
- package/docs/http.md +749 -0
- package/docs/modules.md +285 -0
- package/docs/observability-collector-smoke.md +31 -0
- package/docs/observability-framework-examples.md +98 -0
- package/docs/observability.md +542 -0
- package/docs/otel-collector-smoke.yaml +27 -0
- package/docs/performance-profiler.md +199 -0
- package/docs/production-readiness.md +73 -0
- package/docs/recipes/README.md +12 -0
- package/docs/recipes/http-server.md +45 -0
- package/docs/recipes/layers.md +44 -0
- package/docs/recipes/performance.md +47 -0
- package/docs/recipes/runtime.md +41 -0
- package/docs/recipes/testing.md +41 -0
- package/docs/release.md +53 -0
- package/docs/wasm-bounded-queues.md +44 -0
- package/docs/wasm-engine-observability-benchmarks.md +85 -0
- package/docs/wasm-fiber-engine.md +117 -0
- package/docs/wasm-scheduler-state-machine.md +122 -0
- package/docs/wasm-stream-chunks.md +54 -0
- package/package.json +22 -2
- package/dist/chunk-45F7OKGT.cjs +0 -104
- package/dist/chunk-7V4KY4RL.mjs +0 -104
- package/dist/chunk-DJQ7OMMB.cjs +0 -144
- package/dist/chunk-GOV47PPB.mjs +0 -552
- package/dist/chunk-JF4XXPZ5.cjs +0 -552
- package/dist/chunk-KCPT2D6G.js +0 -552
- package/dist/chunk-NOYZIMUJ.mjs +0 -144
- package/dist/chunk-PNVFW245.js +0 -144
- package/dist/chunk-ROJC3NBJ.js +0 -104
- package/dist/effectRunner-3ZHAD3LE.cjs +0 -8
- package/dist/schedule-Fque9Abz.d.ts +0 -70
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkMVGUEJ5Zcjs = require('./chunk-MVGUEJ5Z.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkCZIVE6NTcjs = require('./chunk-CZIVE6NT.cjs');
|
|
11
11
|
|
|
12
12
|
// src/core/runtime/ringBuffer.ts
|
|
13
13
|
var PushStatus = /* @__PURE__ */ ((PushStatus3) => {
|
|
@@ -1029,16 +1029,17 @@ function makeForkPolicy(env, hooks) {
|
|
|
1029
1029
|
const trace = forkTrace(svc, _nullishCoalesce(_optionalChain([parentCtx, 'optionalAccess', _5 => _5.trace]), () => ( null)));
|
|
1030
1030
|
fiber.fiberContext = {
|
|
1031
1031
|
log: _nullishCoalesce(_optionalChain([parentCtx, 'optionalAccess', _6 => _6.log]), () => ( emptyContext)),
|
|
1032
|
-
trace
|
|
1032
|
+
trace,
|
|
1033
|
+
fiberRefs: _optionalChain([parentCtx, 'optionalAccess', _7 => _7.fiberRefs]) ? new Map(parentCtx.fiberRefs) : void 0
|
|
1033
1034
|
};
|
|
1034
|
-
fiber.parentFiberId = _optionalChain([parent, 'optionalAccess',
|
|
1035
|
-
fiber.name = svc.childName(_optionalChain([parent, 'optionalAccess',
|
|
1035
|
+
fiber.parentFiberId = _optionalChain([parent, 'optionalAccess', _8 => _8.id]);
|
|
1036
|
+
fiber.name = svc.childName(_optionalChain([parent, 'optionalAccess', _9 => _9.name]));
|
|
1036
1037
|
if (scopeId !== void 0) fiber.scopeId = scopeId;
|
|
1037
1038
|
hooks.emit(
|
|
1038
1039
|
{
|
|
1039
1040
|
type: "fiber.start",
|
|
1040
1041
|
fiberId: fiber.id,
|
|
1041
|
-
parentFiberId: _optionalChain([parent, 'optionalAccess',
|
|
1042
|
+
parentFiberId: _optionalChain([parent, 'optionalAccess', _10 => _10.id]),
|
|
1042
1043
|
scopeId: fiber.scopeId,
|
|
1043
1044
|
// ✅ ahora viaja
|
|
1044
1045
|
name: fiber.name
|
|
@@ -1046,12 +1047,12 @@ function makeForkPolicy(env, hooks) {
|
|
|
1046
1047
|
{
|
|
1047
1048
|
fiberId: fiber.id,
|
|
1048
1049
|
scopeId: fiber.scopeId,
|
|
1049
|
-
traceId: _optionalChain([trace, 'optionalAccess',
|
|
1050
|
-
spanId: _optionalChain([trace, 'optionalAccess',
|
|
1051
|
-
parentSpanId: _optionalChain([trace, 'optionalAccess',
|
|
1052
|
-
traceState: _optionalChain([trace, 'optionalAccess',
|
|
1053
|
-
baggage: _optionalChain([trace, 'optionalAccess',
|
|
1054
|
-
sampled: _optionalChain([trace, 'optionalAccess',
|
|
1050
|
+
traceId: _optionalChain([trace, 'optionalAccess', _11 => _11.traceId]),
|
|
1051
|
+
spanId: _optionalChain([trace, 'optionalAccess', _12 => _12.spanId]),
|
|
1052
|
+
parentSpanId: _optionalChain([trace, 'optionalAccess', _13 => _13.parentSpanId]),
|
|
1053
|
+
traceState: _optionalChain([trace, 'optionalAccess', _14 => _14.traceState]),
|
|
1054
|
+
baggage: _optionalChain([trace, 'optionalAccess', _15 => _15.baggage]),
|
|
1055
|
+
sampled: _optionalChain([trace, 'optionalAccess', _16 => _16.sampled])
|
|
1055
1056
|
}
|
|
1056
1057
|
);
|
|
1057
1058
|
}
|
|
@@ -1062,16 +1063,16 @@ function resolveForkServices(env) {
|
|
|
1062
1063
|
newTraceId: () => randomRuntimeId("trace"),
|
|
1063
1064
|
newSpanId: () => randomRuntimeId("span")
|
|
1064
1065
|
};
|
|
1065
|
-
const brass = _optionalChain([env, 'optionalAccess',
|
|
1066
|
-
const tracer = _nullishCoalesce(_optionalChain([brass, 'optionalAccess',
|
|
1067
|
-
const seed = _optionalChain([brass, 'optionalAccess',
|
|
1068
|
-
const baggage = _optionalChain([brass, 'optionalAccess',
|
|
1069
|
-
const childName = _nullishCoalesce(_optionalChain([brass, 'optionalAccess',
|
|
1066
|
+
const brass = _optionalChain([env, 'optionalAccess', _17 => _17.brass]);
|
|
1067
|
+
const tracer = _nullishCoalesce(_optionalChain([brass, 'optionalAccess', _18 => _18.tracer]), () => ( defaultTracer));
|
|
1068
|
+
const seed = _optionalChain([brass, 'optionalAccess', _19 => _19.traceSeed]);
|
|
1069
|
+
const baggage = _optionalChain([brass, 'optionalAccess', _20 => _20.baggage]);
|
|
1070
|
+
const childName = _nullishCoalesce(_optionalChain([brass, 'optionalAccess', _21 => _21.childName]), () => ( ((p) => p ? `${p}/child` : void 0)));
|
|
1070
1071
|
return { tracer, seed, baggage, childName };
|
|
1071
1072
|
}
|
|
1072
1073
|
function randomRuntimeId(prefix) {
|
|
1073
1074
|
const cryptoLike = globalThis.crypto;
|
|
1074
|
-
if (typeof _optionalChain([cryptoLike, 'optionalAccess',
|
|
1075
|
+
if (typeof _optionalChain([cryptoLike, 'optionalAccess', _22 => _22.randomUUID]) === "function") {
|
|
1075
1076
|
return cryptoLike.randomUUID();
|
|
1076
1077
|
}
|
|
1077
1078
|
return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
@@ -1169,7 +1170,7 @@ var HostRegistry = (_class9 = class {constructor() { _class9.prototype.__init46.
|
|
|
1169
1170
|
clear() {
|
|
1170
1171
|
for (let index = 1; index < this.slots.length; index++) {
|
|
1171
1172
|
const slot = this.slots[index];
|
|
1172
|
-
if (!_optionalChain([slot, 'optionalAccess',
|
|
1173
|
+
if (!_optionalChain([slot, 'optionalAccess', _23 => _23.occupied])) continue;
|
|
1173
1174
|
slot.value = void 0;
|
|
1174
1175
|
slot.occupied = false;
|
|
1175
1176
|
this.free.push(index);
|
|
@@ -1249,6 +1250,13 @@ var ProgramBuilder = (_class10 = class {constructor() { _class10.prototype.__ini
|
|
|
1249
1250
|
};
|
|
1250
1251
|
return this.add(current.scopeId === void 0 ? base : { ...base, scopeId: current.scopeId });
|
|
1251
1252
|
}
|
|
1253
|
+
case "Interruptibility":
|
|
1254
|
+
case "InterruptibilityRestore":
|
|
1255
|
+
return this.visit(current.effect);
|
|
1256
|
+
case "FiberRefLocally":
|
|
1257
|
+
return this.visit(desugarFiberRefLocally(current.refId, current.value, current.effect));
|
|
1258
|
+
case "InterruptibilityMask":
|
|
1259
|
+
return this.visit(current.body((effect2) => effect2));
|
|
1252
1260
|
case "HostAction": {
|
|
1253
1261
|
const base = {
|
|
1254
1262
|
tag: "HostAction",
|
|
@@ -1257,10 +1265,53 @@ var ProgramBuilder = (_class10 = class {constructor() { _class10.prototype.__ini
|
|
|
1257
1265
|
return this.add(current.decode === void 0 ? base : { ...base, decodeRef: this.registry.register(current.decode) });
|
|
1258
1266
|
}
|
|
1259
1267
|
default:
|
|
1260
|
-
return this.add({ tag: "Fail", errorRef: this.registry.register(new Error(`Unknown Async opcode: ${_optionalChain([current, 'optionalAccess',
|
|
1268
|
+
return this.add({ tag: "Fail", errorRef: this.registry.register(new Error(`Unknown Async opcode: ${_optionalChain([current, 'optionalAccess', _24 => _24._tag])}`)) });
|
|
1261
1269
|
}
|
|
1262
1270
|
}
|
|
1263
1271
|
}, _class10);
|
|
1272
|
+
function desugarFiberRefLocally(refId, value, effect) {
|
|
1273
|
+
return {
|
|
1274
|
+
_tag: "FlatMap",
|
|
1275
|
+
first: {
|
|
1276
|
+
_tag: "Sync",
|
|
1277
|
+
thunk: () => enterFiberRefLocal(refId, value)
|
|
1278
|
+
},
|
|
1279
|
+
andThen: (restore) => ({
|
|
1280
|
+
_tag: "Fold",
|
|
1281
|
+
first: effect,
|
|
1282
|
+
onFailure: (error) => restoreThen(restore, { _tag: "Fail", error }),
|
|
1283
|
+
onSuccess: (result) => restoreThen(restore, { _tag: "Succeed", value: result })
|
|
1284
|
+
})
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
function restoreThen(restore, next) {
|
|
1288
|
+
return {
|
|
1289
|
+
_tag: "FlatMap",
|
|
1290
|
+
first: {
|
|
1291
|
+
_tag: "Sync",
|
|
1292
|
+
thunk: () => restore()
|
|
1293
|
+
},
|
|
1294
|
+
andThen: () => next
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
function enterFiberRefLocal(refId, value) {
|
|
1298
|
+
const fiber = getCurrentFiber();
|
|
1299
|
+
if (!fiber) return () => void 0;
|
|
1300
|
+
fiber.fiberContext ??= { log: emptyContext, trace: null };
|
|
1301
|
+
const refs = fiber.fiberContext.fiberRefs ??= /* @__PURE__ */ new Map();
|
|
1302
|
+
const hadValue = refs.has(refId);
|
|
1303
|
+
const previousValue = refs.get(refId);
|
|
1304
|
+
refs.set(refId, value);
|
|
1305
|
+
let active = true;
|
|
1306
|
+
const restore = () => {
|
|
1307
|
+
if (!active) return;
|
|
1308
|
+
active = false;
|
|
1309
|
+
if (hadValue) refs.set(refId, previousValue);
|
|
1310
|
+
else refs.delete(refId);
|
|
1311
|
+
};
|
|
1312
|
+
_optionalChain([fiber, 'access', _25 => _25.addFinalizer, 'optionalCall', _26 => _26(() => restore())]);
|
|
1313
|
+
return restore;
|
|
1314
|
+
}
|
|
1264
1315
|
|
|
1265
1316
|
// src/core/runtime/engine/FiberHandleImpl.ts
|
|
1266
1317
|
var EngineFiberHandle = (_class11 = class {
|
|
@@ -1295,7 +1346,7 @@ var EngineFiberHandle = (_class11 = class {
|
|
|
1295
1346
|
__init60() {this.queued = false}
|
|
1296
1347
|
status() {
|
|
1297
1348
|
if (this.result == null) return "Running";
|
|
1298
|
-
if (this.result._tag === "Failure" && this.result.cause
|
|
1349
|
+
if (this.result._tag === "Failure" && _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(this.result.cause)) return "Interrupted";
|
|
1299
1350
|
return "Done";
|
|
1300
1351
|
}
|
|
1301
1352
|
engineStatus() {
|
|
@@ -1313,13 +1364,13 @@ var EngineFiberHandle = (_class11 = class {
|
|
|
1313
1364
|
join(cb) {
|
|
1314
1365
|
if (this.result != null) cb(this.result);
|
|
1315
1366
|
else {
|
|
1316
|
-
_optionalChain([this, 'access',
|
|
1367
|
+
_optionalChain([this, 'access', _27 => _27.onJoiner, 'optionalCall', _28 => _28(this.id)]);
|
|
1317
1368
|
this.joiners.push(cb);
|
|
1318
1369
|
}
|
|
1319
1370
|
}
|
|
1320
1371
|
interrupt() {
|
|
1321
1372
|
if (this.result != null) return;
|
|
1322
|
-
this.onInterrupt(this.id,
|
|
1373
|
+
this.onInterrupt(this.id, _chunkMVGUEJ5Zcjs.Cause.interrupt());
|
|
1323
1374
|
}
|
|
1324
1375
|
addFinalizer(f) {
|
|
1325
1376
|
this.finalizers.push(f);
|
|
@@ -1328,12 +1379,12 @@ var EngineFiberHandle = (_class11 = class {
|
|
|
1328
1379
|
if (this.result != null || this.queued) return;
|
|
1329
1380
|
this.queued = true;
|
|
1330
1381
|
this.internalStatus = "queued";
|
|
1331
|
-
_optionalChain([this, 'access',
|
|
1382
|
+
_optionalChain([this, 'access', _29 => _29.onQueued, 'optionalCall', _30 => _30(this.id)]);
|
|
1332
1383
|
const label = `wasm-fiber#${this.id}.${tag}`;
|
|
1333
1384
|
const result = this.onScheduleRequest ? this.onScheduleRequest(this.id, label) : this.scheduleWithRuntime(label);
|
|
1334
1385
|
if (result === "dropped") {
|
|
1335
1386
|
this.queued = false;
|
|
1336
|
-
_optionalChain([this, 'access',
|
|
1387
|
+
_optionalChain([this, 'access', _31 => _31.onScheduleDropped, 'optionalCall', _32 => _32(this.id, label)]);
|
|
1337
1388
|
}
|
|
1338
1389
|
}
|
|
1339
1390
|
scheduleWithRuntime(label) {
|
|
@@ -1348,28 +1399,28 @@ var EngineFiberHandle = (_class11 = class {
|
|
|
1348
1399
|
this.runtime.hooks.emit(ev, {
|
|
1349
1400
|
fiberId: this.id,
|
|
1350
1401
|
scopeId: this.scopeId,
|
|
1351
|
-
traceId: _optionalChain([this, 'access',
|
|
1352
|
-
spanId: _optionalChain([this, 'access',
|
|
1402
|
+
traceId: _optionalChain([this, 'access', _33 => _33.fiberContext, 'optionalAccess', _34 => _34.trace, 'optionalAccess', _35 => _35.traceId]),
|
|
1403
|
+
spanId: _optionalChain([this, 'access', _36 => _36.fiberContext, 'optionalAccess', _37 => _37.trace, 'optionalAccess', _38 => _38.spanId])
|
|
1353
1404
|
});
|
|
1354
1405
|
}
|
|
1355
1406
|
succeed(value) {
|
|
1356
|
-
this.complete(
|
|
1407
|
+
this.complete(_chunkMVGUEJ5Zcjs.Exit.succeed(value));
|
|
1357
1408
|
}
|
|
1358
1409
|
fail(error) {
|
|
1359
|
-
this.complete(
|
|
1410
|
+
this.complete(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(error)));
|
|
1360
1411
|
}
|
|
1361
1412
|
die(defect) {
|
|
1362
|
-
this.complete(
|
|
1413
|
+
this.complete(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(defect)));
|
|
1363
1414
|
}
|
|
1364
1415
|
interrupted() {
|
|
1365
|
-
this.complete(
|
|
1416
|
+
this.complete(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.interrupt()));
|
|
1366
1417
|
}
|
|
1367
1418
|
complete(exit) {
|
|
1368
1419
|
if (this.result != null) return;
|
|
1369
1420
|
this.runFinalizersOnce(exit);
|
|
1370
1421
|
this.result = exit;
|
|
1371
|
-
this.internalStatus = exit._tag === "Success" ? "done" : exit.cause
|
|
1372
|
-
const status = exit._tag === "Success" ? "success" : exit.cause
|
|
1422
|
+
this.internalStatus = exit._tag === "Success" ? "done" : _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(exit.cause) ? "interrupted" : "failed";
|
|
1423
|
+
const status = exit._tag === "Success" ? "success" : _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(exit.cause) ? "interrupted" : "failure";
|
|
1373
1424
|
this.emit({
|
|
1374
1425
|
type: "fiber.end",
|
|
1375
1426
|
fiberId: this.id,
|
|
@@ -1382,16 +1433,18 @@ var EngineFiberHandle = (_class11 = class {
|
|
|
1382
1433
|
runFinalizersOnce(exit) {
|
|
1383
1434
|
if (this.finalizersDrained) return;
|
|
1384
1435
|
this.finalizersDrained = true;
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1436
|
+
withCurrentFiber(this, () => {
|
|
1437
|
+
while (this.finalizers.length > 0) {
|
|
1438
|
+
const finalizer = this.finalizers.pop();
|
|
1439
|
+
try {
|
|
1440
|
+
const eff = finalizer(exit);
|
|
1441
|
+
if (eff && typeof eff === "object" && "_tag" in eff) {
|
|
1442
|
+
this.runtime.fork(eff);
|
|
1443
|
+
}
|
|
1444
|
+
} catch (e6) {
|
|
1391
1445
|
}
|
|
1392
|
-
} catch (e6) {
|
|
1393
1446
|
}
|
|
1394
|
-
}
|
|
1447
|
+
});
|
|
1395
1448
|
}
|
|
1396
1449
|
}, _class11);
|
|
1397
1450
|
|
|
@@ -1684,7 +1737,7 @@ var WasmPackFiberBridge = (_class12 = class {
|
|
|
1684
1737
|
}
|
|
1685
1738
|
decodeZeroCopy(ptr) {
|
|
1686
1739
|
this.zeroCopyEventCalls += 1;
|
|
1687
|
-
const len = _nullishCoalesce(_optionalChain([this, 'access',
|
|
1740
|
+
const len = _nullishCoalesce(_optionalChain([this, 'access', _39 => _39.vm, 'access', _40 => _40.event_batch_len, 'optionalCall', _41 => _41()]), () => ( 0));
|
|
1688
1741
|
const words = this.readU32(ptr, len);
|
|
1689
1742
|
const events = decodeEventBatch(words);
|
|
1690
1743
|
this.eventsReceived += events.length;
|
|
@@ -1692,8 +1745,8 @@ var WasmPackFiberBridge = (_class12 = class {
|
|
|
1692
1745
|
return events;
|
|
1693
1746
|
}
|
|
1694
1747
|
memory() {
|
|
1695
|
-
const memory = _optionalChain([this, 'access',
|
|
1696
|
-
if (!_optionalChain([memory, 'optionalAccess',
|
|
1748
|
+
const memory = _optionalChain([this, 'access', _42 => _42.vm, 'access', _43 => _43.memory, 'optionalCall', _44 => _44()]);
|
|
1749
|
+
if (!_optionalChain([memory, 'optionalAccess', _45 => _45.buffer])) throw new Error("brass-runtime WASM memory is not available");
|
|
1697
1750
|
return memory;
|
|
1698
1751
|
}
|
|
1699
1752
|
readU32(ptr, len) {
|
|
@@ -1709,8 +1762,8 @@ var WasmPackFiberBridge = (_class12 = class {
|
|
|
1709
1762
|
new Uint32Array(this.memory().buffer, ptr, words.length).set(words);
|
|
1710
1763
|
}
|
|
1711
1764
|
readMetricsSnapshot() {
|
|
1712
|
-
const ptr = _nullishCoalesce(_optionalChain([this, 'access',
|
|
1713
|
-
const len = _nullishCoalesce(_optionalChain([this, 'access',
|
|
1765
|
+
const ptr = _nullishCoalesce(_optionalChain([this, 'access', _46 => _46.vm, 'access', _47 => _47.metrics_snapshot_ptr, 'optionalCall', _48 => _48()]), () => ( 0));
|
|
1766
|
+
const len = _nullishCoalesce(_optionalChain([this, 'access', _49 => _49.vm, 'access', _50 => _50.metrics_snapshot_len, 'optionalCall', _51 => _51()]), () => ( 0));
|
|
1714
1767
|
const view = this.readF64(ptr, len);
|
|
1715
1768
|
const out = {};
|
|
1716
1769
|
for (let i = 0; i < Math.min(view.length, VM_METRIC_NAMES.length); i++) {
|
|
@@ -1742,7 +1795,7 @@ var WasmFiberRegistryBridge = class {
|
|
|
1742
1795
|
|
|
1743
1796
|
constructor() {
|
|
1744
1797
|
const mod = resolveWasmModule();
|
|
1745
|
-
const Ctor = _optionalChain([mod, 'optionalAccess',
|
|
1798
|
+
const Ctor = _optionalChain([mod, 'optionalAccess', _52 => _52.BrassWasmFiberRegistry]);
|
|
1746
1799
|
if (!Ctor) {
|
|
1747
1800
|
throw new Error("brass-runtime wasm fiber registry is not available. Run npm run build:wasm first.");
|
|
1748
1801
|
}
|
|
@@ -1841,7 +1894,7 @@ var DEFAULT_LANE_BUDGET2 = 64;
|
|
|
1841
1894
|
var DEFAULT_MAX_LANES2 = 256;
|
|
1842
1895
|
function resolveWasmReadyQueue() {
|
|
1843
1896
|
const mod = resolveWasmModule();
|
|
1844
|
-
return _nullishCoalesce(_optionalChain([mod, 'optionalAccess',
|
|
1897
|
+
return _nullishCoalesce(_optionalChain([mod, 'optionalAccess', _53 => _53.BrassWasmFiberReadyQueue]), () => ( null));
|
|
1845
1898
|
}
|
|
1846
1899
|
function decodePolicy(policy) {
|
|
1847
1900
|
switch (policy) {
|
|
@@ -2156,7 +2209,7 @@ var WasmTimerWheelBridge = class {
|
|
|
2156
2209
|
};
|
|
2157
2210
|
function makeWasmTimerWheel(options) {
|
|
2158
2211
|
const mod = resolveWasmModule();
|
|
2159
|
-
const Ctor = _optionalChain([mod, 'optionalAccess',
|
|
2212
|
+
const Ctor = _optionalChain([mod, 'optionalAccess', _54 => _54.BrassWasmTimerWheel]);
|
|
2160
2213
|
if (!Ctor) throw new Error("brass-runtime wasm timer wheel is not available. Run npm run build:wasm first.");
|
|
2161
2214
|
return new WasmTimerWheelBridge(Ctor, options);
|
|
2162
2215
|
}
|
|
@@ -2206,8 +2259,8 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2206
2259
|
this.runtime,
|
|
2207
2260
|
(id) => this.driveById(id),
|
|
2208
2261
|
(id, reason) => this.interruptById(id, reason),
|
|
2209
|
-
(id) => _optionalChain([this, 'access',
|
|
2210
|
-
(id) => _optionalChain([this, 'access',
|
|
2262
|
+
(id) => _optionalChain([this, 'access', _55 => _55.fiberRegistry, 'optionalAccess', _56 => _56.addJoiner, 'call', _57 => _57(id)]),
|
|
2263
|
+
(id) => _optionalChain([this, 'access', _58 => _58.fiberRegistry, 'optionalAccess', _59 => _59.markQueued, 'call', _60 => _60(id)]),
|
|
2211
2264
|
(id, label) => this.schedulerDropped(id, label),
|
|
2212
2265
|
(id, label) => this.enqueueFiberById(id, label)
|
|
2213
2266
|
);
|
|
@@ -2225,7 +2278,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2225
2278
|
hostActionToken: 0
|
|
2226
2279
|
};
|
|
2227
2280
|
this.states.set(fiberId, state);
|
|
2228
|
-
_optionalChain([this, 'access',
|
|
2281
|
+
_optionalChain([this, 'access', _61 => _61.fiberRegistry, 'optionalAccess', _62 => _62.registerFiber, 'call', _63 => _63(fiberId, void 0, scopeId)]);
|
|
2229
2282
|
this.startedFibers += 1;
|
|
2230
2283
|
this.runningFibers += 1;
|
|
2231
2284
|
return handle;
|
|
@@ -2266,17 +2319,17 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2266
2319
|
staleReads: hostStaleReads
|
|
2267
2320
|
},
|
|
2268
2321
|
wasm: this.bridge.stats(),
|
|
2269
|
-
fiberRegistry: _optionalChain([this, 'access',
|
|
2322
|
+
fiberRegistry: _optionalChain([this, 'access', _64 => _64.fiberRegistry, 'optionalAccess', _65 => _65.stats, 'call', _66 => _66()]),
|
|
2270
2323
|
readyQueue: this.readyQueue.stats(),
|
|
2271
|
-
timerWheel: _optionalChain([this, 'access',
|
|
2324
|
+
timerWheel: _optionalChain([this, 'access', _67 => _67.timerWheel, 'optionalAccess', _68 => _68.stats, 'call', _69 => _69()])
|
|
2272
2325
|
};
|
|
2273
2326
|
}
|
|
2274
2327
|
async shutdown() {
|
|
2275
2328
|
for (const state of Array.from(this.states.values())) {
|
|
2276
|
-
this.interruptState(state,
|
|
2329
|
+
this.interruptState(state, _chunkMVGUEJ5Zcjs.Cause.interrupt());
|
|
2277
2330
|
}
|
|
2278
2331
|
this.readyQueue.clear();
|
|
2279
|
-
_optionalChain([this, 'access',
|
|
2332
|
+
_optionalChain([this, 'access', _70 => _70.timerWheel, 'optionalAccess', _71 => _71.dispose, 'call', _72 => _72()]);
|
|
2280
2333
|
}
|
|
2281
2334
|
scheduleWakeup(fiberId) {
|
|
2282
2335
|
const state = this.states.get(fiberId);
|
|
@@ -2350,7 +2403,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2350
2403
|
const state = this.states.get(fiberId);
|
|
2351
2404
|
if (!state || state.completed) return;
|
|
2352
2405
|
state.handle.markDequeued();
|
|
2353
|
-
_optionalChain([this, 'access',
|
|
2406
|
+
_optionalChain([this, 'access', _73 => _73.fiberRegistry, 'optionalAccess', _74 => _74.markRunning, 'call', _75 => _75(fiberId)]);
|
|
2354
2407
|
const initialEvents = this.consumePendingResume(state);
|
|
2355
2408
|
withCurrentFiber(state.handle, () => this.drive(state, initialEvents));
|
|
2356
2409
|
}
|
|
@@ -2359,9 +2412,9 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2359
2412
|
if (!pending) return void 0;
|
|
2360
2413
|
this.pendingResumes.delete(state.fiberId);
|
|
2361
2414
|
if (pending.kind === "value") {
|
|
2362
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2415
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _76 => _76.bridge, 'access', _77 => _77.provideValueBatch, 'optionalCall', _78 => _78(state.fiberId, pending.ref, DEFAULT_BUDGET)]), () => ( [this.bridge.provideValue(state.fiberId, pending.ref)]));
|
|
2363
2416
|
}
|
|
2364
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2417
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _79 => _79.bridge, 'access', _80 => _80.provideErrorBatch, 'optionalCall', _81 => _81(state.fiberId, pending.ref, DEFAULT_BUDGET)]), () => ( [this.bridge.provideError(state.fiberId, pending.ref)]));
|
|
2365
2418
|
}
|
|
2366
2419
|
drive(state, initialEvents) {
|
|
2367
2420
|
if (state.completed) return;
|
|
@@ -2372,7 +2425,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2372
2425
|
while (!state.completed && budget-- > 0) {
|
|
2373
2426
|
try {
|
|
2374
2427
|
if (events.length === 0) {
|
|
2375
|
-
const next = _nullishCoalesce(_optionalChain([this, 'access',
|
|
2428
|
+
const next = _nullishCoalesce(_optionalChain([this, 'access', _82 => _82.bridge, 'access', _83 => _83.driveBatch, 'optionalCall', _84 => _84(state.fiberId, budget + 1)]), () => ( [this.bridge.poll(state.fiberId)]));
|
|
2376
2429
|
events.push(...next);
|
|
2377
2430
|
if (events.length === 0) events.push({ kind: "Continue", fiberId: state.fiberId });
|
|
2378
2431
|
}
|
|
@@ -2398,9 +2451,9 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2398
2451
|
const fn = state.registry.get(event.fnRef);
|
|
2399
2452
|
try {
|
|
2400
2453
|
const valueRef = state.registry.register(fn(this.runtime.env));
|
|
2401
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2454
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _85 => _85.bridge, 'access', _86 => _86.provideValueBatch, 'optionalCall', _87 => _87(state.fiberId, valueRef, budget + 1)]), () => ( [this.bridge.provideValue(state.fiberId, valueRef)])));
|
|
2402
2455
|
} catch (error) {
|
|
2403
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2456
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _88 => _88.bridge, 'access', _89 => _89.provideErrorBatch, 'optionalCall', _90 => _90(state.fiberId, state.registry.register(error), budget + 1)]), () => ( [this.bridge.provideError(state.fiberId, state.registry.register(error))])));
|
|
2404
2457
|
}
|
|
2405
2458
|
continue;
|
|
2406
2459
|
}
|
|
@@ -2410,9 +2463,9 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2410
2463
|
try {
|
|
2411
2464
|
const next = fn(value);
|
|
2412
2465
|
const patch = state.builder.append(next);
|
|
2413
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2466
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _91 => _91.bridge, 'access', _92 => _92.provideEffectBatch, 'optionalCall', _93 => _93(state.fiberId, patch.root, patch.nodes, budget + 1)]), () => ( [this.bridge.provideEffect(state.fiberId, patch.root, patch.nodes)])));
|
|
2414
2467
|
} catch (error) {
|
|
2415
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2468
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _94 => _94.bridge, 'access', _95 => _95.provideErrorBatch, 'optionalCall', _96 => _96(state.fiberId, state.registry.register(error), budget + 1)]), () => ( [this.bridge.provideError(state.fiberId, state.registry.register(error))])));
|
|
2416
2469
|
}
|
|
2417
2470
|
continue;
|
|
2418
2471
|
}
|
|
@@ -2422,9 +2475,9 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2422
2475
|
try {
|
|
2423
2476
|
const next = fn(errorValue);
|
|
2424
2477
|
const patch = state.builder.append(next);
|
|
2425
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2478
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _97 => _97.bridge, 'access', _98 => _98.provideEffectBatch, 'optionalCall', _99 => _99(state.fiberId, patch.root, patch.nodes, budget + 1)]), () => ( [this.bridge.provideEffect(state.fiberId, patch.root, patch.nodes)])));
|
|
2426
2479
|
} catch (error) {
|
|
2427
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2480
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _100 => _100.bridge, 'access', _101 => _101.provideErrorBatch, 'optionalCall', _102 => _102(state.fiberId, state.registry.register(error), budget + 1)]), () => ( [this.bridge.provideError(state.fiberId, state.registry.register(error))])));
|
|
2428
2481
|
}
|
|
2429
2482
|
continue;
|
|
2430
2483
|
}
|
|
@@ -2434,9 +2487,9 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2434
2487
|
try {
|
|
2435
2488
|
const next = fn(value);
|
|
2436
2489
|
const patch = state.builder.append(next);
|
|
2437
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2490
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _103 => _103.bridge, 'access', _104 => _104.provideEffectBatch, 'optionalCall', _105 => _105(state.fiberId, patch.root, patch.nodes, budget + 1)]), () => ( [this.bridge.provideEffect(state.fiberId, patch.root, patch.nodes)])));
|
|
2438
2491
|
} catch (error) {
|
|
2439
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2492
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _106 => _106.bridge, 'access', _107 => _107.provideErrorBatch, 'optionalCall', _108 => _108(state.fiberId, state.registry.register(error), budget + 1)]), () => ( [this.bridge.provideError(state.fiberId, state.registry.register(error))])));
|
|
2440
2493
|
}
|
|
2441
2494
|
continue;
|
|
2442
2495
|
}
|
|
@@ -2444,9 +2497,9 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2444
2497
|
const effect = state.registry.get(event.effectRef);
|
|
2445
2498
|
try {
|
|
2446
2499
|
const child = this.runtime.fork(effect, event.scopeId);
|
|
2447
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2500
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _109 => _109.bridge, 'access', _110 => _110.provideValueBatch, 'optionalCall', _111 => _111(state.fiberId, state.registry.register(child), budget + 1)]), () => ( [this.bridge.provideValue(state.fiberId, state.registry.register(child))])));
|
|
2448
2501
|
} catch (error) {
|
|
2449
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2502
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _112 => _112.bridge, 'access', _113 => _113.provideErrorBatch, 'optionalCall', _114 => _114(state.fiberId, state.registry.register(error), budget + 1)]), () => ( [this.bridge.provideError(state.fiberId, state.registry.register(error))])));
|
|
2450
2503
|
}
|
|
2451
2504
|
continue;
|
|
2452
2505
|
}
|
|
@@ -2460,7 +2513,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2460
2513
|
}
|
|
2461
2514
|
}
|
|
2462
2515
|
} catch (error) {
|
|
2463
|
-
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access',
|
|
2516
|
+
events.unshift(..._nullishCoalesce(_optionalChain([this, 'access', _115 => _115.bridge, 'access', _116 => _116.provideErrorBatch, 'optionalCall', _117 => _117(state.fiberId, state.registry.register(error), budget + 1)]), () => ( [this.bridge.provideError(state.fiberId, state.registry.register(error))])));
|
|
2464
2517
|
}
|
|
2465
2518
|
}
|
|
2466
2519
|
if (!state.completed) this.enqueueFiber(state, "budget-yield");
|
|
@@ -2516,7 +2569,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2516
2569
|
}
|
|
2517
2570
|
};
|
|
2518
2571
|
state.pendingCleanups.add(cancelCleanup);
|
|
2519
|
-
state.handle.addFinalizer(() => _optionalChain([cancelCleanup, 'optionalCall',
|
|
2572
|
+
state.handle.addFinalizer(() => _optionalChain([cancelCleanup, 'optionalCall', _118 => _118()]));
|
|
2520
2573
|
}
|
|
2521
2574
|
} catch (error) {
|
|
2522
2575
|
cleanup();
|
|
@@ -2533,7 +2586,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2533
2586
|
const deadlineAt = action.timeoutMs === void 0 ? void 0 : Date.now() + action.timeoutMs;
|
|
2534
2587
|
const cleanup = () => {
|
|
2535
2588
|
state.pendingCleanups.delete(cleanup);
|
|
2536
|
-
_optionalChain([this, 'access',
|
|
2589
|
+
_optionalChain([this, 'access', _119 => _119.timerWheel, 'optionalAccess', _120 => _120.cancel, 'call', _121 => _121(state.deadlineTimerId)]);
|
|
2537
2590
|
if (state.hostActionToken === token) state.deadlineTimerId = void 0;
|
|
2538
2591
|
};
|
|
2539
2592
|
state.pendingCleanups.add(cleanup);
|
|
@@ -2594,15 +2647,32 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2594
2647
|
return;
|
|
2595
2648
|
}
|
|
2596
2649
|
const cause = exit.cause;
|
|
2597
|
-
if (cause
|
|
2650
|
+
if (_chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(cause)) {
|
|
2598
2651
|
this.interruptState(state, cause);
|
|
2599
2652
|
return;
|
|
2600
2653
|
}
|
|
2601
|
-
if (cause
|
|
2602
|
-
|
|
2603
|
-
|
|
2654
|
+
if (_chunkMVGUEJ5Zcjs.Cause.isFailureOnly(cause)) {
|
|
2655
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(cause);
|
|
2656
|
+
if (failure._tag === "Some") {
|
|
2657
|
+
this.resumeWithError(state, failure.value);
|
|
2658
|
+
return;
|
|
2659
|
+
}
|
|
2604
2660
|
}
|
|
2605
|
-
this.
|
|
2661
|
+
this.completeCause(state, cause);
|
|
2662
|
+
}
|
|
2663
|
+
completeCause(state, cause) {
|
|
2664
|
+
if (state.completed) return;
|
|
2665
|
+
state.completed = true;
|
|
2666
|
+
const interrupted = _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(cause);
|
|
2667
|
+
state.status = interrupted ? "interrupted" : "failed";
|
|
2668
|
+
_optionalChain([this, 'access', _122 => _122.fiberRegistry, 'optionalAccess', _123 => _123.markDone, 'call', _124 => _124(state.fiberId, interrupted ? "interrupted" : "failed")]);
|
|
2669
|
+
if (interrupted) {
|
|
2670
|
+
this.interruptedFibers += 1;
|
|
2671
|
+
} else {
|
|
2672
|
+
this.failedFibers += 1;
|
|
2673
|
+
}
|
|
2674
|
+
this.cleanupState(state);
|
|
2675
|
+
state.handle.complete(_chunkMVGUEJ5Zcjs.Exit.failCause(cause));
|
|
2606
2676
|
}
|
|
2607
2677
|
resumeWithValue(state, value) {
|
|
2608
2678
|
this.pendingResumes.set(state.fiberId, { kind: "value", ref: state.registry.register(value) });
|
|
@@ -2630,14 +2700,14 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2630
2700
|
if (state.completed) return;
|
|
2631
2701
|
if (!state.controller.signal.aborted) state.controller.abort(reason);
|
|
2632
2702
|
for (const cleanup of Array.from(state.pendingCleanups)) cleanup();
|
|
2633
|
-
const events = _nullishCoalesce(_optionalChain([this, 'access',
|
|
2703
|
+
const events = _nullishCoalesce(_optionalChain([this, 'access', _125 => _125.bridge, 'access', _126 => _126.interruptBatch, 'optionalCall', _127 => _127(state.fiberId, state.registry.register(reason), DEFAULT_BUDGET)]), () => ( [this.bridge.interrupt(state.fiberId, state.registry.register(reason))]));
|
|
2634
2704
|
this.drive(state, events);
|
|
2635
2705
|
}
|
|
2636
2706
|
markSuspended(state, reason) {
|
|
2637
2707
|
if (state.status !== "suspended") {
|
|
2638
2708
|
this.suspendedFibers += 1;
|
|
2639
2709
|
state.status = "suspended";
|
|
2640
|
-
_optionalChain([this, 'access',
|
|
2710
|
+
_optionalChain([this, 'access', _128 => _128.fiberRegistry, 'optionalAccess', _129 => _129.markSuspended, 'call', _130 => _130(state.fiberId)]);
|
|
2641
2711
|
state.handle.setEngineStatus("suspended");
|
|
2642
2712
|
state.handle.emit({ type: "fiber.suspend", fiberId: state.fiberId, reason });
|
|
2643
2713
|
}
|
|
@@ -2646,7 +2716,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2646
2716
|
if (state.status === "suspended") {
|
|
2647
2717
|
this.suspendedFibers = Math.max(0, this.suspendedFibers - 1);
|
|
2648
2718
|
state.status = "running";
|
|
2649
|
-
_optionalChain([this, 'access',
|
|
2719
|
+
_optionalChain([this, 'access', _131 => _131.fiberRegistry, 'optionalAccess', _132 => _132.markRunning, 'call', _133 => _133(state.fiberId)]);
|
|
2650
2720
|
state.handle.setEngineStatus("running");
|
|
2651
2721
|
state.handle.emit({ type: "fiber.resume", fiberId: state.fiberId });
|
|
2652
2722
|
}
|
|
@@ -2655,7 +2725,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2655
2725
|
if (state.completed) return;
|
|
2656
2726
|
state.completed = true;
|
|
2657
2727
|
state.status = "done";
|
|
2658
|
-
_optionalChain([this, 'access',
|
|
2728
|
+
_optionalChain([this, 'access', _134 => _134.fiberRegistry, 'optionalAccess', _135 => _135.markDone, 'call', _136 => _136(state.fiberId, "done")]);
|
|
2659
2729
|
this.completedFibers += 1;
|
|
2660
2730
|
this.cleanupState(state);
|
|
2661
2731
|
state.handle.succeed(value);
|
|
@@ -2664,7 +2734,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2664
2734
|
if (state.completed) return;
|
|
2665
2735
|
state.completed = true;
|
|
2666
2736
|
state.status = "failed";
|
|
2667
|
-
_optionalChain([this, 'access',
|
|
2737
|
+
_optionalChain([this, 'access', _137 => _137.fiberRegistry, 'optionalAccess', _138 => _138.markDone, 'call', _139 => _139(state.fiberId, "failed")]);
|
|
2668
2738
|
this.failedFibers += 1;
|
|
2669
2739
|
this.cleanupState(state);
|
|
2670
2740
|
state.handle.fail(error);
|
|
@@ -2673,7 +2743,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2673
2743
|
if (state.completed) return;
|
|
2674
2744
|
state.completed = true;
|
|
2675
2745
|
state.status = "failed";
|
|
2676
|
-
_optionalChain([this, 'access',
|
|
2746
|
+
_optionalChain([this, 'access', _140 => _140.fiberRegistry, 'optionalAccess', _141 => _141.markDone, 'call', _142 => _142(state.fiberId, "failed")]);
|
|
2677
2747
|
this.failedFibers += 1;
|
|
2678
2748
|
this.cleanupState(state);
|
|
2679
2749
|
state.handle.die(defect);
|
|
@@ -2682,7 +2752,7 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2682
2752
|
if (state.completed) return;
|
|
2683
2753
|
state.completed = true;
|
|
2684
2754
|
state.status = "interrupted";
|
|
2685
|
-
_optionalChain([this, 'access',
|
|
2755
|
+
_optionalChain([this, 'access', _143 => _143.fiberRegistry, 'optionalAccess', _144 => _144.markDone, 'call', _145 => _145(state.fiberId, "interrupted")]);
|
|
2686
2756
|
this.interruptedFibers += 1;
|
|
2687
2757
|
this.cleanupState(state);
|
|
2688
2758
|
state.handle.interrupted();
|
|
@@ -2690,13 +2760,13 @@ var WasmFiberEngine = (_class15 = class {
|
|
|
2690
2760
|
cleanupState(state) {
|
|
2691
2761
|
this.runningFibers = Math.max(0, this.runningFibers - 1);
|
|
2692
2762
|
if (state.status === "suspended") this.suspendedFibers = Math.max(0, this.suspendedFibers - 1);
|
|
2693
|
-
_optionalChain([this, 'access',
|
|
2763
|
+
_optionalChain([this, 'access', _146 => _146.timerWheel, 'optionalAccess', _147 => _147.cancel, 'call', _148 => _148(state.deadlineTimerId)]);
|
|
2694
2764
|
state.deadlineTimerId = void 0;
|
|
2695
2765
|
for (const cleanup of Array.from(state.pendingCleanups)) cleanup();
|
|
2696
2766
|
state.pendingCleanups.clear();
|
|
2697
2767
|
this.pendingResumes.delete(state.fiberId);
|
|
2698
2768
|
this.bridge.dropFiber(state.fiberId);
|
|
2699
|
-
_optionalChain([this, 'access',
|
|
2769
|
+
_optionalChain([this, 'access', _149 => _149.fiberRegistry, 'optionalAccess', _150 => _150.dropFiber, 'call', _151 => _151(state.fiberId)]);
|
|
2700
2770
|
state.registry.clear();
|
|
2701
2771
|
this.states.delete(state.fiberId);
|
|
2702
2772
|
}
|
|
@@ -2707,17 +2777,17 @@ function runtimeCapabilities() {
|
|
|
2707
2777
|
const mod = resolveWasmModule();
|
|
2708
2778
|
return {
|
|
2709
2779
|
wasmAvailable: !!mod,
|
|
2710
|
-
wasmFiberEngine: typeof _optionalChain([mod, 'optionalAccess',
|
|
2711
|
-
wasmRingBuffer: typeof _optionalChain([mod, 'optionalAccess',
|
|
2712
|
-
wasmScheduler: typeof _optionalChain([mod, 'optionalAccess',
|
|
2713
|
-
wasmFiberRegistry: typeof _optionalChain([mod, 'optionalAccess',
|
|
2714
|
-
wasmFiberReadyQueue: typeof _optionalChain([mod, 'optionalAccess',
|
|
2780
|
+
wasmFiberEngine: typeof _optionalChain([mod, 'optionalAccess', _152 => _152.BrassWasmVm]) === "function",
|
|
2781
|
+
wasmRingBuffer: typeof _optionalChain([mod, 'optionalAccess', _153 => _153.BrassWasmRingBuffer]) === "function",
|
|
2782
|
+
wasmScheduler: typeof _optionalChain([mod, 'optionalAccess', _154 => _154.BrassWasmSchedulerStateMachine]) === "function",
|
|
2783
|
+
wasmFiberRegistry: typeof _optionalChain([mod, 'optionalAccess', _155 => _155.BrassWasmFiberRegistry]) === "function",
|
|
2784
|
+
wasmFiberReadyQueue: typeof _optionalChain([mod, 'optionalAccess', _156 => _156.BrassWasmFiberReadyQueue]) === "function",
|
|
2715
2785
|
wasmBinaryAbi: hasBinaryVmAbi(mod),
|
|
2716
|
-
wasmStreamChunks: typeof _optionalChain([mod, 'optionalAccess',
|
|
2786
|
+
wasmStreamChunks: typeof _optionalChain([mod, 'optionalAccess', _157 => _157.BrassWasmChunkBuffer]) === "function"
|
|
2717
2787
|
};
|
|
2718
2788
|
}
|
|
2719
2789
|
function hasBinaryVmAbi(mod) {
|
|
2720
|
-
const Ctor = _optionalChain([mod, 'optionalAccess',
|
|
2790
|
+
const Ctor = _optionalChain([mod, 'optionalAccess', _158 => _158.BrassWasmVm]);
|
|
2721
2791
|
if (typeof Ctor !== "function") return false;
|
|
2722
2792
|
try {
|
|
2723
2793
|
const vm = new Ctor();
|
|
@@ -2727,6 +2797,21 @@ function hasBinaryVmAbi(mod) {
|
|
|
2727
2797
|
}
|
|
2728
2798
|
}
|
|
2729
2799
|
|
|
2800
|
+
// src/core/runtime/clock.ts
|
|
2801
|
+
var liveClock = {
|
|
2802
|
+
now: () => {
|
|
2803
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
2804
|
+
return performance.now();
|
|
2805
|
+
}
|
|
2806
|
+
return Date.now();
|
|
2807
|
+
},
|
|
2808
|
+
setTimeout: (task, ms) => setTimeout(task, Math.max(0, Math.floor(ms))),
|
|
2809
|
+
clearTimeout: (timer) => clearTimeout(timer)
|
|
2810
|
+
};
|
|
2811
|
+
function runtimeClockFromEnv(env) {
|
|
2812
|
+
return _nullishCoalesce(_optionalChain([env, 'optionalAccess', _159 => _159.brass, 'optionalAccess', _160 => _160.clock]), () => ( liveClock));
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2730
2815
|
// src/core/runtime/runtime.ts
|
|
2731
2816
|
var NoopHooks = {
|
|
2732
2817
|
emit() {
|
|
@@ -2739,11 +2824,11 @@ function normalizeRuntimeEngineMode(value) {
|
|
|
2739
2824
|
function unreachableEngine(value) {
|
|
2740
2825
|
throw new Error(`brass-runtime unsupported engine '${String(value)}'`);
|
|
2741
2826
|
}
|
|
2742
|
-
var runtimeOptionsSchema =
|
|
2743
|
-
env:
|
|
2744
|
-
lane:
|
|
2745
|
-
inferLane:
|
|
2746
|
-
engine:
|
|
2827
|
+
var runtimeOptionsSchema = _chunkCZIVE6NTcjs.Schema.object({
|
|
2828
|
+
env: _chunkCZIVE6NTcjs.Schema.any(),
|
|
2829
|
+
lane: _chunkCZIVE6NTcjs.Schema.string({ minLength: 1 }).optional(),
|
|
2830
|
+
inferLane: _chunkCZIVE6NTcjs.Schema.boolean().optional(),
|
|
2831
|
+
engine: _chunkCZIVE6NTcjs.Schema.enum(["ts", "wasm"]).optional()
|
|
2747
2832
|
}, { unknownKeys: "passthrough" });
|
|
2748
2833
|
var Runtime = class _Runtime {
|
|
2749
2834
|
|
|
@@ -2760,7 +2845,7 @@ var Runtime = class _Runtime {
|
|
|
2760
2845
|
// opcional: registry para observabilidad
|
|
2761
2846
|
|
|
2762
2847
|
constructor(args) {
|
|
2763
|
-
|
|
2848
|
+
_chunkCZIVE6NTcjs.parseConfig.call(void 0, "RuntimeOptions", runtimeOptionsSchema, args);
|
|
2764
2849
|
this.env = args.env;
|
|
2765
2850
|
this.scheduler = _nullishCoalesce(args.scheduler, () => ( globalScheduler));
|
|
2766
2851
|
this.lane = args.lane;
|
|
@@ -2813,7 +2898,7 @@ var Runtime = class _Runtime {
|
|
|
2813
2898
|
}
|
|
2814
2899
|
resolveFiberLane(parent) {
|
|
2815
2900
|
if (this.lane !== void 0) return this.lane;
|
|
2816
|
-
const parentLane = _optionalChain([parent, 'optionalAccess',
|
|
2901
|
+
const parentLane = _optionalChain([parent, 'optionalAccess', _161 => _161.lane]);
|
|
2817
2902
|
if (typeof parentLane === "string" && parentLane.length > 0) return parentLane;
|
|
2818
2903
|
if (!this.inferLane) return void 0;
|
|
2819
2904
|
return inferCallerLaneFromStack(void 0, "runtime");
|
|
@@ -2822,15 +2907,15 @@ var Runtime = class _Runtime {
|
|
|
2822
2907
|
if (this.hooks === NoopHooks) return;
|
|
2823
2908
|
const f = getCurrentFiber();
|
|
2824
2909
|
const ctx = {
|
|
2825
|
-
fiberId: _optionalChain([f, 'optionalAccess',
|
|
2826
|
-
scopeId: _optionalChain([f, 'optionalAccess',
|
|
2910
|
+
fiberId: _optionalChain([f, 'optionalAccess', _162 => _162.id]),
|
|
2911
|
+
scopeId: _optionalChain([f, 'optionalAccess', _163 => _163.scopeId]),
|
|
2827
2912
|
// ✅ FIX: era f?.scope
|
|
2828
|
-
traceId: _optionalChain([f, 'optionalAccess',
|
|
2829
|
-
spanId: _optionalChain([f, 'optionalAccess',
|
|
2830
|
-
parentSpanId: _optionalChain([f, 'optionalAccess',
|
|
2831
|
-
traceState: _optionalChain([f, 'optionalAccess',
|
|
2832
|
-
baggage: _optionalChain([f, 'optionalAccess',
|
|
2833
|
-
sampled: _optionalChain([f, 'optionalAccess',
|
|
2913
|
+
traceId: _optionalChain([f, 'optionalAccess', _164 => _164.fiberContext, 'optionalAccess', _165 => _165.trace, 'optionalAccess', _166 => _166.traceId]),
|
|
2914
|
+
spanId: _optionalChain([f, 'optionalAccess', _167 => _167.fiberContext, 'optionalAccess', _168 => _168.trace, 'optionalAccess', _169 => _169.spanId]),
|
|
2915
|
+
parentSpanId: _optionalChain([f, 'optionalAccess', _170 => _170.fiberContext, 'optionalAccess', _171 => _171.trace, 'optionalAccess', _172 => _172.parentSpanId]),
|
|
2916
|
+
traceState: _optionalChain([f, 'optionalAccess', _173 => _173.fiberContext, 'optionalAccess', _174 => _174.trace, 'optionalAccess', _175 => _175.traceState]),
|
|
2917
|
+
baggage: _optionalChain([f, 'optionalAccess', _176 => _176.fiberContext, 'optionalAccess', _177 => _177.trace, 'optionalAccess', _178 => _178.baggage]),
|
|
2918
|
+
sampled: _optionalChain([f, 'optionalAccess', _179 => _179.fiberContext, 'optionalAccess', _180 => _180.trace, 'optionalAccess', _181 => _181.sampled])
|
|
2834
2919
|
};
|
|
2835
2920
|
this.hooks.emit(ev, ctx);
|
|
2836
2921
|
}
|
|
@@ -2844,7 +2929,7 @@ var Runtime = class _Runtime {
|
|
|
2844
2929
|
if (lane !== void 0) fiber.lane = lane;
|
|
2845
2930
|
if (scopeId !== void 0) fiber.scopeId = scopeId;
|
|
2846
2931
|
this.forkPolicy.initChild(fiber, parent, scopeId);
|
|
2847
|
-
_optionalChain([fiber, 'access',
|
|
2932
|
+
_optionalChain([fiber, 'access', _182 => _182.schedule, 'optionalCall', _183 => _183("initial-step")]);
|
|
2848
2933
|
return fiber;
|
|
2849
2934
|
}
|
|
2850
2935
|
stats() {
|
|
@@ -2855,37 +2940,61 @@ var Runtime = class _Runtime {
|
|
|
2855
2940
|
return runtimeCapabilities();
|
|
2856
2941
|
}
|
|
2857
2942
|
shutdown() {
|
|
2858
|
-
return _optionalChain([this, 'access',
|
|
2943
|
+
return _optionalChain([this, 'access', _184 => _184.fiberEngine, 'access', _185 => _185.shutdown, 'optionalCall', _186 => _186()]);
|
|
2859
2944
|
}
|
|
2860
2945
|
unsafeRunAsync(effect, cb) {
|
|
2946
|
+
if (this.tryRunNativeTopLevel(effect, cb)) return;
|
|
2861
2947
|
const fiber = this.fork(effect);
|
|
2862
2948
|
fiber.join(cb);
|
|
2863
2949
|
}
|
|
2864
2950
|
toPromise(effect) {
|
|
2865
2951
|
return new Promise((resolve, reject) => {
|
|
2866
|
-
const
|
|
2867
|
-
|
|
2868
|
-
|
|
2952
|
+
const complete = (exit) => {
|
|
2953
|
+
if (exit._tag === "Success") {
|
|
2954
|
+
resolve(exit.value);
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(exit.cause);
|
|
2958
|
+
if (failure._tag === "Some") reject(failure.value);
|
|
2869
2959
|
else {
|
|
2870
|
-
const
|
|
2871
|
-
if (
|
|
2872
|
-
|
|
2873
|
-
else
|
|
2960
|
+
const defect = _chunkMVGUEJ5Zcjs.Cause.firstDefect(exit.cause);
|
|
2961
|
+
if (defect._tag === "Some") {
|
|
2962
|
+
reject(defect.value instanceof Error ? defect.value : new Error(String(defect.value)));
|
|
2963
|
+
} else if (_chunkMVGUEJ5Zcjs.Cause.containsInterrupt(exit.cause)) {
|
|
2964
|
+
reject(new Error("Interrupted"));
|
|
2965
|
+
} else {
|
|
2966
|
+
reject(_chunkMVGUEJ5Zcjs.Cause.toError(exit.cause));
|
|
2967
|
+
}
|
|
2874
2968
|
}
|
|
2969
|
+
};
|
|
2970
|
+
if (this.tryRunNativeTopLevel(effect, complete)) return;
|
|
2971
|
+
const fiber = this.fork(effect);
|
|
2972
|
+
fiber.join((exit) => {
|
|
2973
|
+
complete(exit);
|
|
2875
2974
|
});
|
|
2876
2975
|
});
|
|
2877
2976
|
}
|
|
2977
|
+
tryRunNativeTopLevel(effect, cb) {
|
|
2978
|
+
if (this.hooks !== NoopHooks) return false;
|
|
2979
|
+
if (getCurrentFiber() !== null) return false;
|
|
2980
|
+
if (this.scheduler !== globalScheduler) return false;
|
|
2981
|
+
if (this.lane !== void 0 || this.inferLane) return false;
|
|
2982
|
+
if (this.engineMode !== "ts") return false;
|
|
2983
|
+
new NativeTopLevelRunner(this, effect, cb).start();
|
|
2984
|
+
return true;
|
|
2985
|
+
}
|
|
2878
2986
|
// helper: correr un efecto y “tirar” el resultado
|
|
2879
2987
|
unsafeRun(effect) {
|
|
2880
2988
|
this.unsafeRunAsync(effect, () => {
|
|
2881
2989
|
});
|
|
2882
2990
|
}
|
|
2883
2991
|
delay(ms, eff) {
|
|
2884
|
-
return
|
|
2885
|
-
const
|
|
2992
|
+
return _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
2993
|
+
const clock = runtimeClockFromEnv(this.env);
|
|
2994
|
+
const handle = clock.setTimeout(() => {
|
|
2886
2995
|
this.unsafeRunAsync(eff, cb);
|
|
2887
2996
|
}, ms);
|
|
2888
|
-
return () => clearTimeout(handle);
|
|
2997
|
+
return () => clock.clearTimeout(handle);
|
|
2889
2998
|
});
|
|
2890
2999
|
}
|
|
2891
3000
|
// util para crear runtime default
|
|
@@ -2900,6 +3009,243 @@ var Runtime = class _Runtime {
|
|
|
2900
3009
|
this.emit({ type: "log", level, message, fields });
|
|
2901
3010
|
}
|
|
2902
3011
|
};
|
|
3012
|
+
var NATIVE_FAST_PATH_STEP_BUDGET = 32768;
|
|
3013
|
+
var NativeTopLevelRunner = (_class16 = class {
|
|
3014
|
+
constructor(runtime, effect, cb) {;_class16.prototype.__init99.call(this);_class16.prototype.__init100.call(this);_class16.prototype.__init101.call(this);_class16.prototype.__init102.call(this);
|
|
3015
|
+
this.runtime = runtime;
|
|
3016
|
+
this.current = effect;
|
|
3017
|
+
this.joiners.push(cb);
|
|
3018
|
+
this.frame = {
|
|
3019
|
+
id: 0,
|
|
3020
|
+
runtime,
|
|
3021
|
+
name: "native-fast-path",
|
|
3022
|
+
fiberContext: { trace: null },
|
|
3023
|
+
lane: runtime.lane,
|
|
3024
|
+
status: () => this.result ? "Done" : "Running",
|
|
3025
|
+
join: (joiner) => {
|
|
3026
|
+
if (this.result) joiner(this.result);
|
|
3027
|
+
else this.joiners.push(joiner);
|
|
3028
|
+
},
|
|
3029
|
+
interrupt: () => void 0,
|
|
3030
|
+
addFinalizer: (finalizer) => {
|
|
3031
|
+
this.finalizers.push(finalizer);
|
|
3032
|
+
}
|
|
3033
|
+
};
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
|
|
3037
|
+
__init99() {this.stack = []}
|
|
3038
|
+
__init100() {this.joiners = []}
|
|
3039
|
+
__init101() {this.finalizers = []}
|
|
3040
|
+
|
|
3041
|
+
__init102() {this.yielded = false}
|
|
3042
|
+
|
|
3043
|
+
start() {
|
|
3044
|
+
this.runLoop();
|
|
3045
|
+
}
|
|
3046
|
+
runLoop() {
|
|
3047
|
+
this.withFrame(() => {
|
|
3048
|
+
this.yielded = false;
|
|
3049
|
+
let budget = NATIVE_FAST_PATH_STEP_BUDGET;
|
|
3050
|
+
while (!this.result && budget-- > 0) {
|
|
3051
|
+
const current = this.current;
|
|
3052
|
+
switch (current._tag) {
|
|
3053
|
+
case "Succeed":
|
|
3054
|
+
this.onSuccess(current.value);
|
|
3055
|
+
break;
|
|
3056
|
+
case "Fail":
|
|
3057
|
+
this.onCause(_chunkMVGUEJ5Zcjs.Cause.fail(current.error));
|
|
3058
|
+
break;
|
|
3059
|
+
case "Sync":
|
|
3060
|
+
try {
|
|
3061
|
+
this.onSuccess(current.thunk(this.runtime.env));
|
|
3062
|
+
} catch (error) {
|
|
3063
|
+
this.onCause(_chunkMVGUEJ5Zcjs.Cause.fail(error));
|
|
3064
|
+
}
|
|
3065
|
+
break;
|
|
3066
|
+
case "FlatMap":
|
|
3067
|
+
this.stack.push({ _tag: "SuccessCont", k: current.andThen });
|
|
3068
|
+
this.current = current.first;
|
|
3069
|
+
break;
|
|
3070
|
+
case "Fold":
|
|
3071
|
+
this.stack.push({
|
|
3072
|
+
_tag: "FoldCont",
|
|
3073
|
+
onFailure: current.onFailure,
|
|
3074
|
+
onSuccess: current.onSuccess
|
|
3075
|
+
});
|
|
3076
|
+
this.current = current.first;
|
|
3077
|
+
break;
|
|
3078
|
+
case "Async":
|
|
3079
|
+
if (this.runAsync(current)) break;
|
|
3080
|
+
return;
|
|
3081
|
+
case "Fork":
|
|
3082
|
+
this.onSuccess(this.runtime.fork(current.effect, current.scopeId));
|
|
3083
|
+
break;
|
|
3084
|
+
case "Interruptibility":
|
|
3085
|
+
this.stack.push({ _tag: "InterruptibilityCont" });
|
|
3086
|
+
this.current = current.effect;
|
|
3087
|
+
break;
|
|
3088
|
+
case "InterruptibilityMask":
|
|
3089
|
+
this.stack.push({ _tag: "InterruptibilityCont" });
|
|
3090
|
+
try {
|
|
3091
|
+
this.current = current.body((effect) => ({
|
|
3092
|
+
_tag: "InterruptibilityRestore",
|
|
3093
|
+
depth: 0,
|
|
3094
|
+
effect
|
|
3095
|
+
}));
|
|
3096
|
+
} catch (error) {
|
|
3097
|
+
this.onCause(_chunkMVGUEJ5Zcjs.Cause.die(error));
|
|
3098
|
+
}
|
|
3099
|
+
break;
|
|
3100
|
+
case "InterruptibilityRestore":
|
|
3101
|
+
this.stack.push({ _tag: "InterruptibilityCont" });
|
|
3102
|
+
this.current = current.effect;
|
|
3103
|
+
break;
|
|
3104
|
+
case "FiberRefLocally": {
|
|
3105
|
+
const refs = this.fiberRefs();
|
|
3106
|
+
const hadValue = refs.has(current.refId);
|
|
3107
|
+
const previousValue = refs.get(current.refId);
|
|
3108
|
+
refs.set(current.refId, current.value);
|
|
3109
|
+
this.stack.push({
|
|
3110
|
+
_tag: "FiberRefCont",
|
|
3111
|
+
refId: current.refId,
|
|
3112
|
+
hadValue,
|
|
3113
|
+
previousValue
|
|
3114
|
+
});
|
|
3115
|
+
this.current = current.effect;
|
|
3116
|
+
break;
|
|
3117
|
+
}
|
|
3118
|
+
default:
|
|
3119
|
+
this.onCause(_chunkMVGUEJ5Zcjs.Cause.fail(new Error(`Unknown opcode: ${current._tag}`)));
|
|
3120
|
+
break;
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
if (!this.result && !this.yielded) {
|
|
3124
|
+
this.yielded = true;
|
|
3125
|
+
queueMicrotask(() => this.runLoop());
|
|
3126
|
+
}
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3129
|
+
runAsync(current) {
|
|
3130
|
+
let registered = false;
|
|
3131
|
+
let settled = false;
|
|
3132
|
+
let syncExit;
|
|
3133
|
+
const resume = (exit) => {
|
|
3134
|
+
if (settled) return;
|
|
3135
|
+
settled = true;
|
|
3136
|
+
if (!registered) {
|
|
3137
|
+
syncExit = exit;
|
|
3138
|
+
return;
|
|
3139
|
+
}
|
|
3140
|
+
queueMicrotask(() => this.resumeAsync(exit));
|
|
3141
|
+
};
|
|
3142
|
+
try {
|
|
3143
|
+
current.register(this.runtime.env, resume);
|
|
3144
|
+
} catch (error) {
|
|
3145
|
+
this.onCause(_chunkMVGUEJ5Zcjs.Cause.die(error));
|
|
3146
|
+
return true;
|
|
3147
|
+
}
|
|
3148
|
+
registered = true;
|
|
3149
|
+
if (syncExit) {
|
|
3150
|
+
this.consumeExit(syncExit);
|
|
3151
|
+
return true;
|
|
3152
|
+
}
|
|
3153
|
+
return false;
|
|
3154
|
+
}
|
|
3155
|
+
resumeAsync(exit) {
|
|
3156
|
+
if (this.result) return;
|
|
3157
|
+
this.withFrame(() => this.consumeExit(exit));
|
|
3158
|
+
if (!this.result) this.runLoop();
|
|
3159
|
+
}
|
|
3160
|
+
consumeExit(exit) {
|
|
3161
|
+
if (exit._tag === "Success") this.onSuccess(exit.value);
|
|
3162
|
+
else this.onCause(exit.cause);
|
|
3163
|
+
}
|
|
3164
|
+
onSuccess(value) {
|
|
3165
|
+
let currentValue = value;
|
|
3166
|
+
while (true) {
|
|
3167
|
+
const frame = this.stack.pop();
|
|
3168
|
+
if (!frame) {
|
|
3169
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.succeed(currentValue));
|
|
3170
|
+
return;
|
|
3171
|
+
}
|
|
3172
|
+
if (frame._tag === "InterruptibilityCont") continue;
|
|
3173
|
+
if (frame._tag === "FiberRefCont") {
|
|
3174
|
+
this.restoreFiberRef(frame);
|
|
3175
|
+
continue;
|
|
3176
|
+
}
|
|
3177
|
+
if (frame._tag === "SuccessCont") {
|
|
3178
|
+
try {
|
|
3179
|
+
this.current = frame.k(currentValue);
|
|
3180
|
+
} catch (error) {
|
|
3181
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(error)));
|
|
3182
|
+
}
|
|
3183
|
+
return;
|
|
3184
|
+
}
|
|
3185
|
+
try {
|
|
3186
|
+
this.current = frame.onSuccess(currentValue);
|
|
3187
|
+
} catch (error) {
|
|
3188
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(error)));
|
|
3189
|
+
}
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
onCause(cause) {
|
|
3194
|
+
let currentCause = cause;
|
|
3195
|
+
while (this.stack.length > 0) {
|
|
3196
|
+
const frame = this.stack.pop();
|
|
3197
|
+
if (frame._tag === "InterruptibilityCont") continue;
|
|
3198
|
+
if (frame._tag === "FiberRefCont") {
|
|
3199
|
+
this.restoreFiberRef(frame);
|
|
3200
|
+
continue;
|
|
3201
|
+
}
|
|
3202
|
+
if (frame._tag === "FoldCont") {
|
|
3203
|
+
if (!_chunkMVGUEJ5Zcjs.Cause.isFailureOnly(currentCause)) continue;
|
|
3204
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(currentCause);
|
|
3205
|
+
if (failure._tag === "None") break;
|
|
3206
|
+
try {
|
|
3207
|
+
this.current = frame.onFailure(failure.value);
|
|
3208
|
+
return;
|
|
3209
|
+
} catch (error) {
|
|
3210
|
+
currentCause = _chunkMVGUEJ5Zcjs.Cause.fail(error);
|
|
3211
|
+
continue;
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(currentCause));
|
|
3216
|
+
}
|
|
3217
|
+
notify(exit) {
|
|
3218
|
+
if (this.result) return;
|
|
3219
|
+
this.result = exit;
|
|
3220
|
+
this.runFinalizers(exit);
|
|
3221
|
+
for (const joiner of this.joiners) joiner(exit);
|
|
3222
|
+
this.joiners.length = 0;
|
|
3223
|
+
}
|
|
3224
|
+
runFinalizers(exit) {
|
|
3225
|
+
while (this.finalizers.length > 0) {
|
|
3226
|
+
const finalizer = this.finalizers.pop();
|
|
3227
|
+
try {
|
|
3228
|
+
const result = finalizer(exit);
|
|
3229
|
+
if (result && typeof result === "object" && "_tag" in result) {
|
|
3230
|
+
this.runtime.unsafeRunAsync(result, () => void 0);
|
|
3231
|
+
}
|
|
3232
|
+
} catch (e9) {
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
fiberRefs() {
|
|
3237
|
+
this.frame.fiberContext.fiberRefs ??= /* @__PURE__ */ new Map();
|
|
3238
|
+
return this.frame.fiberContext.fiberRefs;
|
|
3239
|
+
}
|
|
3240
|
+
restoreFiberRef(frame) {
|
|
3241
|
+
const refs = this.fiberRefs();
|
|
3242
|
+
if (frame.hadValue) refs.set(frame.refId, frame.previousValue);
|
|
3243
|
+
else refs.delete(frame.refId);
|
|
3244
|
+
}
|
|
3245
|
+
withFrame(body) {
|
|
3246
|
+
return withCurrentFiber(this.frame, body);
|
|
3247
|
+
}
|
|
3248
|
+
}, _class16);
|
|
2903
3249
|
function fork(effect, env) {
|
|
2904
3250
|
return Runtime.make(_nullishCoalesce(env, () => ( {}))).fork(effect);
|
|
2905
3251
|
}
|
|
@@ -2993,7 +3339,7 @@ function resetAbortablePromiseStats() {
|
|
|
2993
3339
|
abortablePromiseLabels.clear();
|
|
2994
3340
|
}
|
|
2995
3341
|
var normalizeAbortablePromiseLabel = (label) => {
|
|
2996
|
-
const value = _optionalChain([label, 'optionalAccess',
|
|
3342
|
+
const value = _optionalChain([label, 'optionalAccess', _187 => _187.trim, 'call', _188 => _188()]);
|
|
2997
3343
|
return value && value.length > 0 ? value.slice(0, 160) : "anonymous";
|
|
2998
3344
|
};
|
|
2999
3345
|
var makeTimeoutReason = (timeoutMs, label) => ({
|
|
@@ -3022,7 +3368,7 @@ function fromPromiseAbortable(make, onReject, options = {}) {
|
|
|
3022
3368
|
done = true;
|
|
3023
3369
|
cleanup();
|
|
3024
3370
|
recordAbortablePromiseFinish(label, outcome);
|
|
3025
|
-
_optionalChain([options, 'access',
|
|
3371
|
+
_optionalChain([options, 'access', _189 => _189.onFinish, 'optionalCall', _190 => _190({
|
|
3026
3372
|
label,
|
|
3027
3373
|
outcome,
|
|
3028
3374
|
durationMs: Math.round(performance.now() - startedAt),
|
|
@@ -3031,23 +3377,23 @@ function fromPromiseAbortable(make, onReject, options = {}) {
|
|
|
3031
3377
|
cb(exit);
|
|
3032
3378
|
};
|
|
3033
3379
|
recordAbortablePromiseStart(label);
|
|
3034
|
-
_optionalChain([options, 'access',
|
|
3380
|
+
_optionalChain([options, 'access', _191 => _191.onStart, 'optionalCall', _192 => _192(label)]);
|
|
3035
3381
|
if (timeoutMs !== void 0 && timeoutMs > 0) {
|
|
3036
3382
|
timeoutHandle = setTimeout(() => {
|
|
3037
|
-
const reason = _nullishCoalesce(_optionalChain([options, 'access',
|
|
3383
|
+
const reason = _nullishCoalesce(_optionalChain([options, 'access', _193 => _193.timeoutReason, 'optionalCall', _194 => _194()]), () => ( makeTimeoutReason(timeoutMs, label)));
|
|
3038
3384
|
try {
|
|
3039
3385
|
controller.abort(reason);
|
|
3040
|
-
} catch (
|
|
3386
|
+
} catch (e10) {
|
|
3041
3387
|
controller.abort();
|
|
3042
3388
|
}
|
|
3043
|
-
finish("timeout",
|
|
3389
|
+
finish("timeout", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(reason))), reason);
|
|
3044
3390
|
}, timeoutMs);
|
|
3045
3391
|
}
|
|
3046
3392
|
let promise;
|
|
3047
3393
|
try {
|
|
3048
3394
|
promise = make(controller.signal, env);
|
|
3049
3395
|
} catch (err) {
|
|
3050
|
-
finish("failure",
|
|
3396
|
+
finish("failure", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(err))), err);
|
|
3051
3397
|
return () => void 0;
|
|
3052
3398
|
}
|
|
3053
3399
|
promise.then((value) => {
|
|
@@ -3055,21 +3401,21 @@ function fromPromiseAbortable(make, onReject, options = {}) {
|
|
|
3055
3401
|
recordAbortablePromiseLateSettlement(label);
|
|
3056
3402
|
return;
|
|
3057
3403
|
}
|
|
3058
|
-
finish("success",
|
|
3404
|
+
finish("success", _chunkMVGUEJ5Zcjs.Exit.succeed(value));
|
|
3059
3405
|
}).catch((err) => {
|
|
3060
3406
|
if (done) {
|
|
3061
3407
|
recordAbortablePromiseLateSettlement(label);
|
|
3062
3408
|
return;
|
|
3063
3409
|
}
|
|
3064
|
-
finish("failure",
|
|
3410
|
+
finish("failure", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.fail(onReject(err))), err);
|
|
3065
3411
|
});
|
|
3066
3412
|
return () => {
|
|
3067
3413
|
if (done) return;
|
|
3068
3414
|
try {
|
|
3069
3415
|
controller.abort();
|
|
3070
|
-
} catch (
|
|
3416
|
+
} catch (e11) {
|
|
3071
3417
|
}
|
|
3072
|
-
finish("interrupt",
|
|
3418
|
+
finish("interrupt", _chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.interrupt()));
|
|
3073
3419
|
};
|
|
3074
3420
|
}
|
|
3075
3421
|
};
|
|
@@ -3111,21 +3457,22 @@ function setBenchmarkBudget(budget) {
|
|
|
3111
3457
|
function getBenchmarkBudget() {
|
|
3112
3458
|
return __benchmarkBudget;
|
|
3113
3459
|
}
|
|
3114
|
-
var RuntimeFiber = (
|
|
3460
|
+
var RuntimeFiber = (_class17 = class {
|
|
3115
3461
|
|
|
3116
3462
|
// 👇 CLAVE: guardar el runtime en el fiber (para getCurrentRuntime())
|
|
3117
3463
|
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3464
|
+
__init103() {this.closing = null}
|
|
3465
|
+
__init104() {this.finishing = false}
|
|
3466
|
+
__init105() {this.runState = RUN.RUNNING}
|
|
3467
|
+
__init106() {this.interrupted = false}
|
|
3468
|
+
__init107() {this.result = null}
|
|
3469
|
+
__init108() {this.joiners = []}
|
|
3124
3470
|
// estado de evaluación
|
|
3125
3471
|
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3472
|
+
__init109() {this.stack = []}
|
|
3473
|
+
__init110() {this.fiberFinalizers = []}
|
|
3474
|
+
__init111() {this.finalizersDrained = false}
|
|
3475
|
+
__init112() {this.interruptibilityDepth = 0}
|
|
3129
3476
|
|
|
3130
3477
|
|
|
3131
3478
|
|
|
@@ -3139,12 +3486,12 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3139
3486
|
|
|
3140
3487
|
// Reusable async callback state — avoids allocating a closure per Async step.
|
|
3141
3488
|
// These fields are reset at the start of each Async case and reused.
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3489
|
+
__init113() {this._syncResolved = false}
|
|
3490
|
+
__init114() {this._syncExit = null}
|
|
3491
|
+
__init115() {this._asyncRegistered = false}
|
|
3145
3492
|
|
|
3146
3493
|
|
|
3147
|
-
constructor(runtime, effect) {;
|
|
3494
|
+
constructor(runtime, effect) {;_class17.prototype.__init103.call(this);_class17.prototype.__init104.call(this);_class17.prototype.__init105.call(this);_class17.prototype.__init106.call(this);_class17.prototype.__init107.call(this);_class17.prototype.__init108.call(this);_class17.prototype.__init109.call(this);_class17.prototype.__init110.call(this);_class17.prototype.__init111.call(this);_class17.prototype.__init112.call(this);_class17.prototype.__init113.call(this);_class17.prototype.__init114.call(this);_class17.prototype.__init115.call(this);_class17.prototype.__init116.call(this);
|
|
3148
3495
|
this.id = nextId++;
|
|
3149
3496
|
this.runtime = runtime;
|
|
3150
3497
|
this.current = effect;
|
|
@@ -3157,21 +3504,15 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3157
3504
|
return;
|
|
3158
3505
|
}
|
|
3159
3506
|
this._syncResolved = true;
|
|
3160
|
-
_optionalChain([this, 'access',
|
|
3507
|
+
_optionalChain([this, 'access', _195 => _195._asyncDetach, 'optionalCall', _196 => _196()]);
|
|
3161
3508
|
this._asyncDetach = void 0;
|
|
3162
3509
|
if (exit._tag === "Success") {
|
|
3163
|
-
this.current =
|
|
3510
|
+
this.current = _chunkMVGUEJ5Zcjs.Async.succeed(exit.value);
|
|
3164
3511
|
this.schedule("async-resume");
|
|
3165
3512
|
return;
|
|
3166
3513
|
}
|
|
3167
|
-
|
|
3168
|
-
if (cause._tag === "Interrupt") {
|
|
3169
|
-
this.notify(_chunkDJQ7OMMBcjs.Exit.failCause(_chunkDJQ7OMMBcjs.Cause.interrupt()));
|
|
3170
|
-
} else if (cause._tag === "Fail") {
|
|
3171
|
-
this.current = _chunkDJQ7OMMBcjs.Async.fail(cause.error);
|
|
3514
|
+
if (this.onCause(exit.cause)) {
|
|
3172
3515
|
this.schedule("async-resume");
|
|
3173
|
-
} else {
|
|
3174
|
-
this.notify(_chunkDJQ7OMMBcjs.Exit.failCause(_chunkDJQ7OMMBcjs.Cause.die(cause.defect)));
|
|
3175
3516
|
}
|
|
3176
3517
|
};
|
|
3177
3518
|
this.boundStep = () => {
|
|
@@ -3205,12 +3546,12 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3205
3546
|
this.runtime.hooks.emit(ev, {
|
|
3206
3547
|
fiberId: this.id,
|
|
3207
3548
|
scopeId: this.scopeId,
|
|
3208
|
-
traceId: _optionalChain([this, 'access',
|
|
3209
|
-
spanId: _optionalChain([this, 'access',
|
|
3210
|
-
parentSpanId: _optionalChain([this, 'access',
|
|
3211
|
-
traceState: _optionalChain([this, 'access',
|
|
3212
|
-
baggage: _optionalChain([this, 'access',
|
|
3213
|
-
sampled: _optionalChain([this, 'access',
|
|
3549
|
+
traceId: _optionalChain([this, 'access', _197 => _197.fiberContext, 'optionalAccess', _198 => _198.trace, 'optionalAccess', _199 => _199.traceId]),
|
|
3550
|
+
spanId: _optionalChain([this, 'access', _200 => _200.fiberContext, 'optionalAccess', _201 => _201.trace, 'optionalAccess', _202 => _202.spanId]),
|
|
3551
|
+
parentSpanId: _optionalChain([this, 'access', _203 => _203.fiberContext, 'optionalAccess', _204 => _204.trace, 'optionalAccess', _205 => _205.parentSpanId]),
|
|
3552
|
+
traceState: _optionalChain([this, 'access', _206 => _206.fiberContext, 'optionalAccess', _207 => _207.trace, 'optionalAccess', _208 => _208.traceState]),
|
|
3553
|
+
baggage: _optionalChain([this, 'access', _209 => _209.fiberContext, 'optionalAccess', _210 => _210.trace, 'optionalAccess', _211 => _211.baggage]),
|
|
3554
|
+
sampled: _optionalChain([this, 'access', _212 => _212.fiberContext, 'optionalAccess', _213 => _213.trace, 'optionalAccess', _214 => _214.sampled])
|
|
3214
3555
|
});
|
|
3215
3556
|
}
|
|
3216
3557
|
addFinalizer(f) {
|
|
@@ -3230,7 +3571,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3230
3571
|
}
|
|
3231
3572
|
status() {
|
|
3232
3573
|
if (this.result == null) return "Running";
|
|
3233
|
-
if (this.result._tag === "Failure" && this.result.cause
|
|
3574
|
+
if (this.result._tag === "Failure" && _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(this.result.cause)) return "Interrupted";
|
|
3234
3575
|
return "Done";
|
|
3235
3576
|
}
|
|
3236
3577
|
join(cb) {
|
|
@@ -3241,7 +3582,9 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3241
3582
|
if (this.result != null) return;
|
|
3242
3583
|
if (this.interrupted) return;
|
|
3243
3584
|
this.interrupted = true;
|
|
3244
|
-
this.
|
|
3585
|
+
if (this.isInterruptible()) {
|
|
3586
|
+
this.schedule("interrupt-step");
|
|
3587
|
+
}
|
|
3245
3588
|
}
|
|
3246
3589
|
schedule(tag = "step") {
|
|
3247
3590
|
if (this.runState === RUN.DONE || this.runState === RUN.QUEUED) return;
|
|
@@ -3256,7 +3599,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3256
3599
|
);
|
|
3257
3600
|
if (result === "dropped") {
|
|
3258
3601
|
this.runState = RUN.DONE;
|
|
3259
|
-
this.notify(
|
|
3602
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(new Error(`Brass scheduler dropped ${label} because the lane queue is full`))));
|
|
3260
3603
|
}
|
|
3261
3604
|
}
|
|
3262
3605
|
runFinalizersOnce(exit) {
|
|
@@ -3273,7 +3616,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3273
3616
|
unsafeRunAsync(eff, this.env, () => {
|
|
3274
3617
|
});
|
|
3275
3618
|
}
|
|
3276
|
-
} catch (
|
|
3619
|
+
} catch (e12) {
|
|
3277
3620
|
}
|
|
3278
3621
|
}
|
|
3279
3622
|
}
|
|
@@ -3284,7 +3627,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3284
3627
|
this.closing = exit;
|
|
3285
3628
|
this.runFinalizersOnce(exit);
|
|
3286
3629
|
this.result = exit;
|
|
3287
|
-
const status = exit._tag === "Success" ? "success" : exit.cause
|
|
3630
|
+
const status = exit._tag === "Success" ? "success" : _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(exit.cause) ? "interrupted" : "failure";
|
|
3288
3631
|
this.emit({
|
|
3289
3632
|
type: "fiber.end",
|
|
3290
3633
|
fiberId: this.id,
|
|
@@ -3294,46 +3637,109 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3294
3637
|
for (const j of this.joiners) j(exit);
|
|
3295
3638
|
this.joiners.length = 0;
|
|
3296
3639
|
}
|
|
3640
|
+
isInterruptible() {
|
|
3641
|
+
return this.interruptibilityDepth === 0;
|
|
3642
|
+
}
|
|
3643
|
+
shouldInterruptNow() {
|
|
3644
|
+
return this.interrupted && this.isInterruptible();
|
|
3645
|
+
}
|
|
3646
|
+
enterInterruptibility(mode) {
|
|
3647
|
+
const previousDepth = this.interruptibilityDepth;
|
|
3648
|
+
this.interruptibilityDepth = mode === "uninterruptible" ? previousDepth + 1 : 0;
|
|
3649
|
+
return previousDepth;
|
|
3650
|
+
}
|
|
3651
|
+
restoreInterruptibility(previousDepth) {
|
|
3652
|
+
this.interruptibilityDepth = Math.max(0, previousDepth);
|
|
3653
|
+
}
|
|
3654
|
+
fiberRefs() {
|
|
3655
|
+
const ctx = this.fiberContext;
|
|
3656
|
+
if (!ctx.fiberRefs) ctx.fiberRefs = /* @__PURE__ */ new Map();
|
|
3657
|
+
return ctx.fiberRefs;
|
|
3658
|
+
}
|
|
3659
|
+
restoreFiberRef(frame) {
|
|
3660
|
+
const refs = this.fiberRefs();
|
|
3661
|
+
if (frame.hadValue) refs.set(frame.refId, frame.previousValue);
|
|
3662
|
+
else refs.delete(frame.refId);
|
|
3663
|
+
}
|
|
3297
3664
|
onSuccess(value) {
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
this.
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3665
|
+
let currentValue = value;
|
|
3666
|
+
while (true) {
|
|
3667
|
+
const frame = this.stack.pop();
|
|
3668
|
+
if (!frame) {
|
|
3669
|
+
if (this.shouldInterruptNow()) {
|
|
3670
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.interrupt()));
|
|
3671
|
+
} else {
|
|
3672
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.succeed(currentValue));
|
|
3673
|
+
}
|
|
3674
|
+
return;
|
|
3675
|
+
}
|
|
3676
|
+
if (frame._tag === "InterruptibilityCont") {
|
|
3677
|
+
this.restoreInterruptibility(frame.previousDepth);
|
|
3678
|
+
if (this.shouldInterruptNow()) {
|
|
3679
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.interrupt()));
|
|
3680
|
+
return;
|
|
3681
|
+
}
|
|
3682
|
+
continue;
|
|
3683
|
+
}
|
|
3684
|
+
if (frame._tag === "FiberRefCont") {
|
|
3685
|
+
this.restoreFiberRef(frame);
|
|
3686
|
+
continue;
|
|
3687
|
+
}
|
|
3688
|
+
if (frame._tag === "SuccessCont") {
|
|
3689
|
+
try {
|
|
3690
|
+
this.current = frame.k(currentValue);
|
|
3691
|
+
} catch (e) {
|
|
3692
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(e)));
|
|
3693
|
+
}
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3304
3696
|
try {
|
|
3305
|
-
this.current = frame.
|
|
3697
|
+
this.current = frame.onSuccess(currentValue);
|
|
3306
3698
|
} catch (e) {
|
|
3307
|
-
this.notify(
|
|
3699
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(e)));
|
|
3308
3700
|
}
|
|
3309
3701
|
return;
|
|
3310
3702
|
}
|
|
3311
|
-
try {
|
|
3312
|
-
this.current = frame.onSuccess(value);
|
|
3313
|
-
} catch (e) {
|
|
3314
|
-
this.notify(_chunkDJQ7OMMBcjs.Exit.failCause(_chunkDJQ7OMMBcjs.Cause.die(e)));
|
|
3315
|
-
}
|
|
3316
3703
|
}
|
|
3317
3704
|
onFailure(error) {
|
|
3705
|
+
this.onCause(_chunkMVGUEJ5Zcjs.Cause.fail(error));
|
|
3706
|
+
}
|
|
3707
|
+
onCause(cause) {
|
|
3708
|
+
let currentCause = cause;
|
|
3318
3709
|
while (this.stack.length > 0) {
|
|
3319
3710
|
const fr = this.stack.pop();
|
|
3711
|
+
if (fr._tag === "InterruptibilityCont") {
|
|
3712
|
+
this.restoreInterruptibility(fr.previousDepth);
|
|
3713
|
+
if (this.shouldInterruptNow() && !_chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(currentCause)) {
|
|
3714
|
+
currentCause = _chunkMVGUEJ5Zcjs.Cause.then(currentCause, _chunkMVGUEJ5Zcjs.Cause.interrupt());
|
|
3715
|
+
}
|
|
3716
|
+
continue;
|
|
3717
|
+
}
|
|
3718
|
+
if (fr._tag === "FiberRefCont") {
|
|
3719
|
+
this.restoreFiberRef(fr);
|
|
3720
|
+
continue;
|
|
3721
|
+
}
|
|
3320
3722
|
if (fr._tag === "FoldCont") {
|
|
3723
|
+
if (!_chunkMVGUEJ5Zcjs.Cause.isFailureOnly(currentCause)) continue;
|
|
3724
|
+
const failure = _chunkMVGUEJ5Zcjs.Cause.firstFailure(currentCause);
|
|
3725
|
+
if (failure._tag === "None") break;
|
|
3321
3726
|
try {
|
|
3322
|
-
this.current = fr.onFailure(
|
|
3323
|
-
return;
|
|
3727
|
+
this.current = fr.onFailure(failure.value);
|
|
3728
|
+
return true;
|
|
3324
3729
|
} catch (e) {
|
|
3325
|
-
|
|
3730
|
+
currentCause = _chunkMVGUEJ5Zcjs.Cause.fail(e);
|
|
3326
3731
|
continue;
|
|
3327
3732
|
}
|
|
3328
3733
|
}
|
|
3329
3734
|
}
|
|
3330
|
-
this.notify(
|
|
3735
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(currentCause));
|
|
3736
|
+
return false;
|
|
3331
3737
|
}
|
|
3332
|
-
|
|
3738
|
+
__init116() {this.budget = DEFAULT_BUDGET2}
|
|
3333
3739
|
step() {
|
|
3334
3740
|
if (this.result != null) return STEP.DONE;
|
|
3335
|
-
if (this.
|
|
3336
|
-
this.
|
|
3741
|
+
if (this.shouldInterruptNow()) {
|
|
3742
|
+
this.onCause(_chunkMVGUEJ5Zcjs.Cause.interrupt());
|
|
3337
3743
|
return STEP.DONE;
|
|
3338
3744
|
}
|
|
3339
3745
|
this.budget = _nullishCoalesce(__benchmarkBudget, () => ( DEFAULT_BUDGET2));
|
|
@@ -3388,14 +3794,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3388
3794
|
if (resolvedExit._tag === "Success") {
|
|
3389
3795
|
this.onSuccess(resolvedExit.value);
|
|
3390
3796
|
} else {
|
|
3391
|
-
|
|
3392
|
-
if (cause._tag === "Interrupt") {
|
|
3393
|
-
this.notify(_chunkDJQ7OMMBcjs.Exit.failCause(_chunkDJQ7OMMBcjs.Cause.interrupt()));
|
|
3394
|
-
} else if (cause._tag === "Fail") {
|
|
3395
|
-
this.onFailure(cause.error);
|
|
3396
|
-
} else {
|
|
3397
|
-
this.notify(_chunkDJQ7OMMBcjs.Exit.failCause(_chunkDJQ7OMMBcjs.Cause.die(cause.defect)));
|
|
3398
|
-
}
|
|
3797
|
+
this.onCause(resolvedExit.cause);
|
|
3399
3798
|
}
|
|
3400
3799
|
break;
|
|
3401
3800
|
}
|
|
@@ -3406,7 +3805,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3406
3805
|
this._asyncDetach = void 0;
|
|
3407
3806
|
try {
|
|
3408
3807
|
canceler();
|
|
3409
|
-
} catch (
|
|
3808
|
+
} catch (e13) {
|
|
3410
3809
|
}
|
|
3411
3810
|
});
|
|
3412
3811
|
}
|
|
@@ -3417,6 +3816,47 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3417
3816
|
this.onSuccess(child);
|
|
3418
3817
|
break;
|
|
3419
3818
|
}
|
|
3819
|
+
case "Interruptibility": {
|
|
3820
|
+
const previousDepth = this.enterInterruptibility(current.mode);
|
|
3821
|
+
this.stack.push({ _tag: "InterruptibilityCont", previousDepth });
|
|
3822
|
+
this.current = current.effect;
|
|
3823
|
+
break;
|
|
3824
|
+
}
|
|
3825
|
+
case "InterruptibilityMask": {
|
|
3826
|
+
const previousDepth = this.enterInterruptibility("uninterruptible");
|
|
3827
|
+
this.stack.push({ _tag: "InterruptibilityCont", previousDepth });
|
|
3828
|
+
try {
|
|
3829
|
+
this.current = current.body((effect) => ({
|
|
3830
|
+
_tag: "InterruptibilityRestore",
|
|
3831
|
+
depth: previousDepth,
|
|
3832
|
+
effect
|
|
3833
|
+
}));
|
|
3834
|
+
} catch (e) {
|
|
3835
|
+
this.onCause(_chunkMVGUEJ5Zcjs.Cause.die(e));
|
|
3836
|
+
}
|
|
3837
|
+
break;
|
|
3838
|
+
}
|
|
3839
|
+
case "InterruptibilityRestore": {
|
|
3840
|
+
const previousDepth = this.interruptibilityDepth;
|
|
3841
|
+
this.restoreInterruptibility(current.depth);
|
|
3842
|
+
this.stack.push({ _tag: "InterruptibilityCont", previousDepth });
|
|
3843
|
+
this.current = current.effect;
|
|
3844
|
+
break;
|
|
3845
|
+
}
|
|
3846
|
+
case "FiberRefLocally": {
|
|
3847
|
+
const refs = this.fiberRefs();
|
|
3848
|
+
const hadValue = refs.has(current.refId);
|
|
3849
|
+
const previousValue = refs.get(current.refId);
|
|
3850
|
+
refs.set(current.refId, current.value);
|
|
3851
|
+
this.stack.push({
|
|
3852
|
+
_tag: "FiberRefCont",
|
|
3853
|
+
refId: current.refId,
|
|
3854
|
+
hadValue,
|
|
3855
|
+
previousValue
|
|
3856
|
+
});
|
|
3857
|
+
this.current = current.effect;
|
|
3858
|
+
break;
|
|
3859
|
+
}
|
|
3420
3860
|
case "Sync": {
|
|
3421
3861
|
try {
|
|
3422
3862
|
const a = current.thunk(this.env);
|
|
@@ -3450,7 +3890,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3450
3890
|
syncTrampoline() {
|
|
3451
3891
|
while (this.budget-- > 0) {
|
|
3452
3892
|
let cur = this.current;
|
|
3453
|
-
while (cur._tag === "FlatMap" && _optionalChain([cur, 'access',
|
|
3893
|
+
while (cur._tag === "FlatMap" && _optionalChain([cur, 'access', _215 => _215.first, 'optionalAccess', _216 => _216._tag]) === "FlatMap") {
|
|
3454
3894
|
this.stack.push({ _tag: "SuccessCont", k: cur.andThen });
|
|
3455
3895
|
cur = cur.first;
|
|
3456
3896
|
}
|
|
@@ -3465,7 +3905,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3465
3905
|
try {
|
|
3466
3906
|
this.current = andThen(first.value);
|
|
3467
3907
|
} catch (e) {
|
|
3468
|
-
this.notify(
|
|
3908
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(e)));
|
|
3469
3909
|
return TRAMPOLINE.DONE;
|
|
3470
3910
|
}
|
|
3471
3911
|
continue;
|
|
@@ -3475,7 +3915,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3475
3915
|
const value = first.thunk(this.env);
|
|
3476
3916
|
this.current = andThen(value);
|
|
3477
3917
|
} catch (e) {
|
|
3478
|
-
this.notify(
|
|
3918
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(e)));
|
|
3479
3919
|
return TRAMPOLINE.DONE;
|
|
3480
3920
|
}
|
|
3481
3921
|
continue;
|
|
@@ -3502,20 +3942,13 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3502
3942
|
try {
|
|
3503
3943
|
this.current = andThen(exit.value);
|
|
3504
3944
|
} catch (e) {
|
|
3505
|
-
this.notify(
|
|
3945
|
+
this.notify(_chunkMVGUEJ5Zcjs.Exit.failCause(_chunkMVGUEJ5Zcjs.Cause.die(e)));
|
|
3506
3946
|
return TRAMPOLINE.DONE;
|
|
3507
3947
|
}
|
|
3508
3948
|
continue;
|
|
3509
3949
|
} else {
|
|
3510
3950
|
this.stack.push({ _tag: "SuccessCont", k: andThen });
|
|
3511
|
-
|
|
3512
|
-
if (cause._tag === "Fail") {
|
|
3513
|
-
this.onFailure(cause.error);
|
|
3514
|
-
} else if (cause._tag === "Interrupt") {
|
|
3515
|
-
this.notify(_chunkDJQ7OMMBcjs.Exit.failCause(_chunkDJQ7OMMBcjs.Cause.interrupt()));
|
|
3516
|
-
} else {
|
|
3517
|
-
this.notify(_chunkDJQ7OMMBcjs.Exit.failCause(_chunkDJQ7OMMBcjs.Cause.die(cause.defect)));
|
|
3518
|
-
}
|
|
3951
|
+
this.onCause(exit.cause);
|
|
3519
3952
|
return this.result != null ? TRAMPOLINE.DONE : TRAMPOLINE.CONTINUE;
|
|
3520
3953
|
}
|
|
3521
3954
|
}
|
|
@@ -3527,7 +3960,7 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3527
3960
|
this._asyncDetach = void 0;
|
|
3528
3961
|
try {
|
|
3529
3962
|
canceler();
|
|
3530
|
-
} catch (
|
|
3963
|
+
} catch (e14) {
|
|
3531
3964
|
}
|
|
3532
3965
|
});
|
|
3533
3966
|
}
|
|
@@ -3552,13 +3985,13 @@ var RuntimeFiber = (_class16 = class {
|
|
|
3552
3985
|
}
|
|
3553
3986
|
return TRAMPOLINE.CONTINUE;
|
|
3554
3987
|
}
|
|
3555
|
-
},
|
|
3988
|
+
}, _class17);
|
|
3556
3989
|
function getCurrentFiber() {
|
|
3557
3990
|
return _current;
|
|
3558
3991
|
}
|
|
3559
3992
|
function unsafeGetCurrentRuntime() {
|
|
3560
3993
|
const f = getCurrentFiber();
|
|
3561
|
-
if (!_optionalChain([f, 'optionalAccess',
|
|
3994
|
+
if (!_optionalChain([f, 'optionalAccess', _217 => _217.runtime])) {
|
|
3562
3995
|
throw new Error("unsafeGetCurrentRuntime: no current fiber/runtime");
|
|
3563
3996
|
}
|
|
3564
3997
|
return f.runtime;
|
|
@@ -3574,13 +4007,13 @@ function withCurrentFiber(fiber, f) {
|
|
|
3574
4007
|
}
|
|
3575
4008
|
|
|
3576
4009
|
// src/core/runtime/engine/JsFiberEngine.ts
|
|
3577
|
-
var JsFiberEngine = (
|
|
3578
|
-
constructor(runtime) {;
|
|
4010
|
+
var JsFiberEngine = (_class18 = class {
|
|
4011
|
+
constructor(runtime) {;_class18.prototype.__init117.call(this);_class18.prototype.__init118.call(this);
|
|
3579
4012
|
this.runtime = runtime;
|
|
3580
4013
|
}
|
|
3581
4014
|
|
|
3582
|
-
|
|
3583
|
-
|
|
4015
|
+
__init117() {this.kind = "ts"}
|
|
4016
|
+
__init118() {this.startedFibers = 0}
|
|
3584
4017
|
fork(effect, scopeId) {
|
|
3585
4018
|
this.startedFibers += 1;
|
|
3586
4019
|
const fiber = new RuntimeFiber(this.runtime, effect);
|
|
@@ -3600,7 +4033,9 @@ var JsFiberEngine = (_class17 = class {
|
|
|
3600
4033
|
pendingHostEffects: 0
|
|
3601
4034
|
};
|
|
3602
4035
|
}
|
|
3603
|
-
},
|
|
4036
|
+
}, _class18);
|
|
4037
|
+
|
|
4038
|
+
|
|
3604
4039
|
|
|
3605
4040
|
|
|
3606
4041
|
|
|
@@ -3651,4 +4086,4 @@ var JsFiberEngine = (_class17 = class {
|
|
|
3651
4086
|
|
|
3652
4087
|
|
|
3653
4088
|
|
|
3654
|
-
exports.PushStatus = PushStatus; exports.RingBuffer = RingBuffer; exports.resolveWasmModule = resolveWasmModule; exports.makeBoundedRingBuffer = makeBoundedRingBuffer; exports.sanitizeLaneKey = sanitizeLaneKey; exports.laneTag = laneTag; exports.inferCallerLaneFromStack = inferCallerLaneFromStack; exports.Scheduler = Scheduler; exports.globalScheduler = globalScheduler; exports.emptyContext = emptyContext; exports.ctxExtend = ctxExtend; exports.ctxToObject = ctxToObject; exports.DefaultHostExecutor = DefaultHostExecutor; exports.JsFiberEngine = JsFiberEngine; exports.HostRegistry = HostRegistry; exports.ProgramBuilder = ProgramBuilder; exports.EngineFiberHandle = EngineFiberHandle; exports.ABI_VERSION = ABI_VERSION; exports.EVENT_WORDS = EVENT_WORDS; exports.NONE_U32 = NONE_U32; exports.OpcodeTagCode = OpcodeTagCode; exports.EventKindCode = EventKindCode; exports.encodeOpcodeProgram = encodeOpcodeProgram; exports.encodeOpcodeNodes = encodeOpcodeNodes; exports.decodeEvent = decodeEvent; exports.decodeEventBatch = decodeEventBatch; exports.WasmPackFiberBridge = WasmPackFiberBridge; exports.WasmFiberRegistryBridge = WasmFiberRegistryBridge; exports.makeFiberReadyQueue = makeFiberReadyQueue; exports.WasmFiberEngine = WasmFiberEngine; exports.runtimeCapabilities = runtimeCapabilities; exports.NoopHooks = NoopHooks; exports.Runtime = Runtime; exports.fork = fork; exports.runtimeForCaller = runtimeForCaller; exports.toPromiseByCaller = toPromiseByCaller; exports.unsafeRunAsync = unsafeRunAsync; exports.toPromise = toPromise; exports.abortablePromiseStats = abortablePromiseStats; exports.resetAbortablePromiseStats = resetAbortablePromiseStats; exports.fromPromiseAbortable = fromPromiseAbortable; exports.unsafeRunFoldWithEnv = unsafeRunFoldWithEnv; exports.setBenchmarkBudget = setBenchmarkBudget; exports.getBenchmarkBudget = getBenchmarkBudget; exports.RuntimeFiber = RuntimeFiber; exports.getCurrentFiber = getCurrentFiber; exports.unsafeGetCurrentRuntime = unsafeGetCurrentRuntime; exports.withCurrentFiber = withCurrentFiber;
|
|
4089
|
+
exports.PushStatus = PushStatus; exports.RingBuffer = RingBuffer; exports.resolveWasmModule = resolveWasmModule; exports.makeBoundedRingBuffer = makeBoundedRingBuffer; exports.sanitizeLaneKey = sanitizeLaneKey; exports.laneTag = laneTag; exports.inferCallerLaneFromStack = inferCallerLaneFromStack; exports.Scheduler = Scheduler; exports.globalScheduler = globalScheduler; exports.emptyContext = emptyContext; exports.ctxExtend = ctxExtend; exports.ctxToObject = ctxToObject; exports.DefaultHostExecutor = DefaultHostExecutor; exports.JsFiberEngine = JsFiberEngine; exports.HostRegistry = HostRegistry; exports.ProgramBuilder = ProgramBuilder; exports.EngineFiberHandle = EngineFiberHandle; exports.ABI_VERSION = ABI_VERSION; exports.EVENT_WORDS = EVENT_WORDS; exports.NONE_U32 = NONE_U32; exports.OpcodeTagCode = OpcodeTagCode; exports.EventKindCode = EventKindCode; exports.encodeOpcodeProgram = encodeOpcodeProgram; exports.encodeOpcodeNodes = encodeOpcodeNodes; exports.decodeEvent = decodeEvent; exports.decodeEventBatch = decodeEventBatch; exports.WasmPackFiberBridge = WasmPackFiberBridge; exports.WasmFiberRegistryBridge = WasmFiberRegistryBridge; exports.makeFiberReadyQueue = makeFiberReadyQueue; exports.WasmFiberEngine = WasmFiberEngine; exports.runtimeCapabilities = runtimeCapabilities; exports.liveClock = liveClock; exports.runtimeClockFromEnv = runtimeClockFromEnv; exports.NoopHooks = NoopHooks; exports.Runtime = Runtime; exports.fork = fork; exports.runtimeForCaller = runtimeForCaller; exports.toPromiseByCaller = toPromiseByCaller; exports.unsafeRunAsync = unsafeRunAsync; exports.toPromise = toPromise; exports.abortablePromiseStats = abortablePromiseStats; exports.resetAbortablePromiseStats = resetAbortablePromiseStats; exports.fromPromiseAbortable = fromPromiseAbortable; exports.unsafeRunFoldWithEnv = unsafeRunFoldWithEnv; exports.setBenchmarkBudget = setBenchmarkBudget; exports.getBenchmarkBudget = getBenchmarkBudget; exports.RuntimeFiber = RuntimeFiber; exports.getCurrentFiber = getCurrentFiber; exports.unsafeGetCurrentRuntime = unsafeGetCurrentRuntime; exports.withCurrentFiber = withCurrentFiber;
|