@shajara/kernel 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/README.md +67 -0
- package/dist/.vite/license.md +27 -0
- package/dist/contracts/context-key.d.ts +10 -0
- package/dist/contracts/context-key.d.ts.map +1 -0
- package/dist/contracts/failure.d.ts +5 -0
- package/dist/contracts/failure.d.ts.map +1 -0
- package/dist/contracts/future-key.d.ts +16 -0
- package/dist/contracts/future-key.d.ts.map +1 -0
- package/dist/contracts/index.d.ts +11 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/message-key.d.ts +10 -0
- package/dist/contracts/message-key.d.ts.map +1 -0
- package/dist/contracts/process.d.ts +7 -0
- package/dist/contracts/process.d.ts.map +1 -0
- package/dist/contracts/scope.d.ts +7 -0
- package/dist/contracts/scope.d.ts.map +1 -0
- package/dist/contracts/sigil.d.ts +7 -0
- package/dist/contracts/sigil.d.ts.map +1 -0
- package/dist/contracts/suppressor.d.ts +4 -0
- package/dist/contracts/suppressor.d.ts.map +1 -0
- package/dist/contracts/token.d.ts +4 -0
- package/dist/contracts/token.d.ts.map +1 -0
- package/dist/contracts/wisp.d.ts +19 -0
- package/dist/contracts/wisp.d.ts.map +1 -0
- package/dist/executor/autonomy.d.ts +24 -0
- package/dist/executor/autonomy.d.ts.map +1 -0
- package/dist/executor/domain-interpreter.d.ts +15 -0
- package/dist/executor/domain-interpreter.d.ts.map +1 -0
- package/dist/executor/domains/domain.d.ts +14 -0
- package/dist/executor/domains/domain.d.ts.map +1 -0
- package/dist/executor/domains/index.d.ts +4 -0
- package/dist/executor/domains/index.d.ts.map +1 -0
- package/dist/executor/domains/reaper.d.ts +26 -0
- package/dist/executor/domains/reaper.d.ts.map +1 -0
- package/dist/executor/domains/scheduler.d.ts +15 -0
- package/dist/executor/domains/scheduler.d.ts.map +1 -0
- package/dist/executor/execution-scope.d.ts +7 -0
- package/dist/executor/execution-scope.d.ts.map +1 -0
- package/dist/executor/executor-driver.d.ts +14 -0
- package/dist/executor/executor-driver.d.ts.map +1 -0
- package/dist/executor/executor.d.ts +13 -0
- package/dist/executor/executor.d.ts.map +1 -0
- package/dist/executor/fault-sink.d.ts +12 -0
- package/dist/executor/fault-sink.d.ts.map +1 -0
- package/dist/executor/index.d.ts +8 -0
- package/dist/executor/index.d.ts.map +1 -0
- package/dist/executor/launch-handle.d.ts +33 -0
- package/dist/executor/launch-handle.d.ts.map +1 -0
- package/dist/executor/pacer.d.ts +9 -0
- package/dist/executor/pacer.d.ts.map +1 -0
- package/dist/executor/primitives/autonomy.d.ts +4 -0
- package/dist/executor/primitives/autonomy.d.ts.map +1 -0
- package/dist/executor/primitives/index.d.ts +2 -0
- package/dist/executor/primitives/index.d.ts.map +1 -0
- package/dist/executor/processor.d.ts +9 -0
- package/dist/executor/processor.d.ts.map +1 -0
- package/dist/executor/round-limit-reaper.d.ts +11 -0
- package/dist/executor/round-limit-reaper.d.ts.map +1 -0
- package/dist/failures/canceled.d.ts +6 -0
- package/dist/failures/canceled.d.ts.map +1 -0
- package/dist/failures/external.d.ts +7 -0
- package/dist/failures/external.d.ts.map +1 -0
- package/dist/failures/index.d.ts +10 -0
- package/dist/failures/index.d.ts.map +1 -0
- package/dist/failures/interrupted.d.ts +7 -0
- package/dist/failures/interrupted.d.ts.map +1 -0
- package/dist/failures/scope.d.ts +19 -0
- package/dist/failures/scope.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1986 -0
- package/dist/internal/fp/index.d.ts +6 -0
- package/dist/internal/fp/index.d.ts.map +1 -0
- package/dist/internal/fp/lifting.d.ts +21 -0
- package/dist/internal/fp/lifting.d.ts.map +1 -0
- package/dist/internal/fp/sigil.d.ts +11 -0
- package/dist/internal/fp/sigil.d.ts.map +1 -0
- package/dist/internal/fp/wisp-either.d.ts +53 -0
- package/dist/internal/fp/wisp-either.d.ts.map +1 -0
- package/dist/internal/fp/wisp-option.d.ts +52 -0
- package/dist/internal/fp/wisp-option.d.ts.map +1 -0
- package/dist/internal/fp/wisp.d.ts +37 -0
- package/dist/internal/fp/wisp.d.ts.map +1 -0
- package/dist/interpreter/index.d.ts +4 -0
- package/dist/interpreter/index.d.ts.map +1 -0
- package/dist/interpreter/interpreter.d.ts +48 -0
- package/dist/interpreter/interpreter.d.ts.map +1 -0
- package/dist/interpreter/process-step.d.ts +21 -0
- package/dist/interpreter/process-step.d.ts.map +1 -0
- package/dist/interpreter/runtime-future.d.ts +14 -0
- package/dist/interpreter/runtime-future.d.ts.map +1 -0
- package/dist/interpreter/runtime-process/handle.d.ts +9 -0
- package/dist/interpreter/runtime-process/handle.d.ts.map +1 -0
- package/dist/interpreter/runtime-process/index.d.ts +5 -0
- package/dist/interpreter/runtime-process/index.d.ts.map +1 -0
- package/dist/interpreter/runtime-process/keeper.d.ts +39 -0
- package/dist/interpreter/runtime-process/keeper.d.ts.map +1 -0
- package/dist/interpreter/runtime-process/process.d.ts +54 -0
- package/dist/interpreter/runtime-process/process.d.ts.map +1 -0
- package/dist/interpreter/runtime-process/runner.d.ts +45 -0
- package/dist/interpreter/runtime-process/runner.d.ts.map +1 -0
- package/dist/interpreter/runtime-process/stepper.d.ts +9 -0
- package/dist/interpreter/runtime-process/stepper.d.ts.map +1 -0
- package/dist/interpreter/runtime-scope/index.d.ts +2 -0
- package/dist/interpreter/runtime-scope/index.d.ts.map +1 -0
- package/dist/interpreter/runtime-scope/runtime-mailbox.d.ts +11 -0
- package/dist/interpreter/runtime-scope/runtime-mailbox.d.ts.map +1 -0
- package/dist/interpreter/runtime-scope/runtime-scope.d.ts +58 -0
- package/dist/interpreter/runtime-scope/runtime-scope.d.ts.map +1 -0
- package/dist/interpreter/runtime-scope/scope-failure-draft.d.ts +12 -0
- package/dist/interpreter/runtime-scope/scope-failure-draft.d.ts.map +1 -0
- package/dist/interpreter/scope-zone.d.ts +6 -0
- package/dist/interpreter/scope-zone.d.ts.map +1 -0
- package/dist/primitives/all.d.ts +7 -0
- package/dist/primitives/all.d.ts.map +1 -0
- package/dist/primitives/bind.d.ts +3 -0
- package/dist/primitives/bind.d.ts.map +1 -0
- package/dist/primitives/cancel.d.ts +3 -0
- package/dist/primitives/cancel.d.ts.map +1 -0
- package/dist/primitives/cede.d.ts +3 -0
- package/dist/primitives/cede.d.ts.map +1 -0
- package/dist/primitives/defer.d.ts +3 -0
- package/dist/primitives/defer.d.ts.map +1 -0
- package/dist/primitives/enclose.d.ts +4 -0
- package/dist/primitives/enclose.d.ts.map +1 -0
- package/dist/primitives/future.d.ts +3 -0
- package/dist/primitives/future.d.ts.map +1 -0
- package/dist/primitives/guard.d.ts +6 -0
- package/dist/primitives/guard.d.ts.map +1 -0
- package/dist/primitives/halt.d.ts +3 -0
- package/dist/primitives/halt.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +21 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/lookup.d.ts +4 -0
- package/dist/primitives/lookup.d.ts.map +1 -0
- package/dist/primitives/park.d.ts +3 -0
- package/dist/primitives/park.d.ts.map +1 -0
- package/dist/primitives/poll.d.ts +4 -0
- package/dist/primitives/poll.d.ts.map +1 -0
- package/dist/primitives/race.d.ts +8 -0
- package/dist/primitives/race.d.ts.map +1 -0
- package/dist/primitives/resource.d.ts +5 -0
- package/dist/primitives/resource.d.ts.map +1 -0
- package/dist/primitives/resumable.d.ts +3 -0
- package/dist/primitives/resumable.d.ts.map +1 -0
- package/dist/primitives/self.d.ts +5 -0
- package/dist/primitives/self.d.ts.map +1 -0
- package/dist/primitives/settle.d.ts +3 -0
- package/dist/primitives/settle.d.ts.map +1 -0
- package/dist/primitives/spawn.d.ts +3 -0
- package/dist/primitives/spawn.d.ts.map +1 -0
- package/dist/primitives/unbind.d.ts +3 -0
- package/dist/primitives/unbind.d.ts.map +1 -0
- package/dist/primitives/wait.d.ts +3 -0
- package/dist/primitives/wait.d.ts.map +1 -0
- package/dist/primitives-kit/index.d.ts +3 -0
- package/dist/primitives-kit/index.d.ts.map +1 -0
- package/dist/primitives-kit/process.d.ts +7 -0
- package/dist/primitives-kit/process.d.ts.map +1 -0
- package/dist/primitives-kit/resumable.d.ts +9 -0
- package/dist/primitives-kit/resumable.d.ts.map +1 -0
- package/dist/primitives.d.ts +2 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/sigils/bind.d.ts +9 -0
- package/dist/sigils/bind.d.ts.map +1 -0
- package/dist/sigils/branch.d.ts +17 -0
- package/dist/sigils/branch.d.ts.map +1 -0
- package/dist/sigils/cancel.d.ts +7 -0
- package/dist/sigils/cancel.d.ts.map +1 -0
- package/dist/sigils/cede.d.ts +7 -0
- package/dist/sigils/cede.d.ts.map +1 -0
- package/dist/sigils/defer.d.ts +8 -0
- package/dist/sigils/defer.d.ts.map +1 -0
- package/dist/sigils/future.d.ts +7 -0
- package/dist/sigils/future.d.ts.map +1 -0
- package/dist/sigils/halt.d.ts +8 -0
- package/dist/sigils/halt.d.ts.map +1 -0
- package/dist/sigils/index.d.ts +34 -0
- package/dist/sigils/index.d.ts.map +1 -0
- package/dist/sigils/lookup.d.ts +9 -0
- package/dist/sigils/lookup.d.ts.map +1 -0
- package/dist/sigils/poll.d.ts +9 -0
- package/dist/sigils/poll.d.ts.map +1 -0
- package/dist/sigils/receive.d.ts +8 -0
- package/dist/sigils/receive.d.ts.map +1 -0
- package/dist/sigils/self.d.ts +11 -0
- package/dist/sigils/self.d.ts.map +1 -0
- package/dist/sigils/send.d.ts +10 -0
- package/dist/sigils/send.d.ts.map +1 -0
- package/dist/sigils/settle.d.ts +9 -0
- package/dist/sigils/settle.d.ts.map +1 -0
- package/dist/sigils/spawn.d.ts +13 -0
- package/dist/sigils/spawn.d.ts.map +1 -0
- package/dist/sigils/unbind.d.ts +8 -0
- package/dist/sigils/unbind.d.ts.map +1 -0
- package/dist/sigils/wait.d.ts +8 -0
- package/dist/sigils/wait.d.ts.map +1 -0
- package/dist/sigils.cjs +1 -0
- package/dist/sigils.d.ts +2 -0
- package/dist/sigils.d.ts.map +1 -0
- package/dist/sigils.js +125 -0
- package/dist/utils/disposer.d.ts +2 -0
- package/dist/utils/disposer.d.ts.map +1 -0
- package/dist/utils/either.d.ts +2 -0
- package/dist/utils/either.d.ts.map +1 -0
- package/dist/utils/iife.d.ts +2 -0
- package/dist/utils/iife.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/narrow.d.ts +4 -0
- package/dist/utils/narrow.d.ts.map +1 -0
- package/dist/utils/noop.d.ts +2 -0
- package/dist/utils/noop.d.ts.map +1 -0
- package/dist/utils/option.d.ts +2 -0
- package/dist/utils/option.d.ts.map +1 -0
- package/dist/utils/unreachable.d.ts +2 -0
- package/dist/utils/unreachable.d.ts.map +1 -0
- package/dist/utils-O8j9DzUQ.cjs +1 -0
- package/dist/utils-PwEUjNtC.js +327 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +2 -0
- package/package.json +73 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1986 @@
|
|
|
1
|
+
import { A as e, B as t, C as n, D as r, E as i, F as a, I as o, J as s, L as c, N as l, O as u, P as d, R as f, S as p, V as m, W as h, X as g, Y as _, _ as v, a as ee, b as te, c as y, d as b, f as x, g as ne, h as re, i as ie, j as ae, k as S, l as C, m as oe, n as se, o as ce, p as le, q as ue, r as de, t as w, u as T, v as fe, w as E, x as pe, y as me, z as he } from "./utils-PwEUjNtC.js";
|
|
2
|
+
import { bind as ge, branch as D, cancel as _e, cede as ve, defer as ye, future as O, halt as be, lookup as xe, poll as Se, receive as Ce, self as we, send as Te, settle as k, spawn as A, unbind as Ee, wait as j } from "./sigils.js";
|
|
3
|
+
//#region src/contracts/wisp.ts
|
|
4
|
+
function M(e, t) {
|
|
5
|
+
return {
|
|
6
|
+
bearing: "stirring",
|
|
7
|
+
resonate: t,
|
|
8
|
+
sigil: e
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function N(e) {
|
|
12
|
+
return {
|
|
13
|
+
bearing: "resting",
|
|
14
|
+
relic: e
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function De(e) {
|
|
18
|
+
return M(e, N);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/contracts/message-key.ts
|
|
22
|
+
function Oe() {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/contracts/context-key.ts
|
|
27
|
+
function ke() {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region ../../../../home/vscode/.yarn/berry/cache/fp-ts-npm-2.16.11-62e43e1078-10c0.zip/node_modules/fp-ts/es6/ReadonlyNonEmptyArray.js
|
|
32
|
+
var Ae = function(e, t, n) {
|
|
33
|
+
if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
|
|
34
|
+
return e.concat(a || Array.prototype.slice.call(t));
|
|
35
|
+
}, je = t, Me = h, Ne = function(e) {
|
|
36
|
+
return function(t) {
|
|
37
|
+
return Ae(Ae([], t, !0), [e], !1);
|
|
38
|
+
};
|
|
39
|
+
}, Pe = function(e) {
|
|
40
|
+
return e.length === 0;
|
|
41
|
+
}, Fe = Me, Ie = Ne, Le = function(e, t, n) {
|
|
42
|
+
return g(e, ze(t, n));
|
|
43
|
+
}, Re = function() {
|
|
44
|
+
return Ve;
|
|
45
|
+
}, P = function(e) {
|
|
46
|
+
return function(t) {
|
|
47
|
+
return t.map(function(t) {
|
|
48
|
+
return e(t);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}, ze = function(e, t) {
|
|
52
|
+
return Be(e, function(e, n, r) {
|
|
53
|
+
return t(n, r);
|
|
54
|
+
});
|
|
55
|
+
}, Be = function(e, t) {
|
|
56
|
+
return function(n) {
|
|
57
|
+
for (var r = n.length, i = e, a = 0; a < r; a++) i = t(a, i, n[a]);
|
|
58
|
+
return i;
|
|
59
|
+
};
|
|
60
|
+
}, F = function(e) {
|
|
61
|
+
return function(t) {
|
|
62
|
+
return Le(t, e.of(Re()), function(t, n) {
|
|
63
|
+
return e.ap(e.map(t, function(e) {
|
|
64
|
+
return function(t) {
|
|
65
|
+
return g(e, Ie(t));
|
|
66
|
+
};
|
|
67
|
+
}), n);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
}, Ve = je;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region ../../../../home/vscode/.yarn/berry/cache/fp-ts-npm-2.16.11-62e43e1078-10c0.zip/node_modules/fp-ts/es6/EitherT.js
|
|
73
|
+
function He(e) {
|
|
74
|
+
return _(S, e.of);
|
|
75
|
+
}
|
|
76
|
+
function Ue(e) {
|
|
77
|
+
return _(i, e.of);
|
|
78
|
+
}
|
|
79
|
+
function We(e) {
|
|
80
|
+
return function(t) {
|
|
81
|
+
return e.map(t, S);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function Ge(e) {
|
|
85
|
+
return function(t) {
|
|
86
|
+
return e.map(t, i);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function Ke(e) {
|
|
90
|
+
return function(t) {
|
|
91
|
+
return _(pe(t), e.of);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function qe(e) {
|
|
95
|
+
var t = Ke(e);
|
|
96
|
+
return function(e) {
|
|
97
|
+
var n = t(e);
|
|
98
|
+
return function(e) {
|
|
99
|
+
return _(e, n);
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function Je(e) {
|
|
104
|
+
var t = Ze(e), n = qe(e);
|
|
105
|
+
return function(e) {
|
|
106
|
+
var r = n(e);
|
|
107
|
+
return function(e) {
|
|
108
|
+
return t(r(e));
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function Ye(e) {
|
|
113
|
+
return f(e, v);
|
|
114
|
+
}
|
|
115
|
+
function Xe(e) {
|
|
116
|
+
return he(e, ne);
|
|
117
|
+
}
|
|
118
|
+
function Ze(e) {
|
|
119
|
+
var t = Qe(e);
|
|
120
|
+
return function(e) {
|
|
121
|
+
return function(n) {
|
|
122
|
+
return t(n, e);
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function Qe(e) {
|
|
127
|
+
return function(t, n) {
|
|
128
|
+
return e.chain(t, function(t) {
|
|
129
|
+
return E(t) ? e.of(t) : n(t.right);
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function $e(e) {
|
|
134
|
+
return function(t) {
|
|
135
|
+
return function(n) {
|
|
136
|
+
return e.chain(n, function(n) {
|
|
137
|
+
return E(n) ? t() : e.of(n);
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function et(e) {
|
|
143
|
+
var t = tt(e);
|
|
144
|
+
return function(e, n) {
|
|
145
|
+
return function(r) {
|
|
146
|
+
return t(r, e, n);
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function tt(e) {
|
|
151
|
+
return function(t, n, r) {
|
|
152
|
+
return e.map(t, fe(n, r));
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function nt(e) {
|
|
156
|
+
var t = rt(e);
|
|
157
|
+
return function(e) {
|
|
158
|
+
return function(n) {
|
|
159
|
+
return t(n, e);
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function rt(e) {
|
|
164
|
+
return function(t, n) {
|
|
165
|
+
return e.map(t, r(n));
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function it(e) {
|
|
169
|
+
return function(t, n) {
|
|
170
|
+
return function(r) {
|
|
171
|
+
return e.map(r, u(t, n));
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function at(e) {
|
|
176
|
+
return function(t, n) {
|
|
177
|
+
return function(r) {
|
|
178
|
+
return e.chain(r, u(t, n));
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function ot(e) {
|
|
183
|
+
return function(t) {
|
|
184
|
+
return function(n) {
|
|
185
|
+
return e.chain(n, u(t, e.of));
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function st(e) {
|
|
190
|
+
return function(t) {
|
|
191
|
+
return function(n) {
|
|
192
|
+
return e.chain(n, function(n) {
|
|
193
|
+
return E(n) ? t(n.left) : e.of(n);
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function ct(e) {
|
|
199
|
+
var t = lt(e);
|
|
200
|
+
return function(e) {
|
|
201
|
+
return function(n) {
|
|
202
|
+
return t(n, e);
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function lt(e) {
|
|
207
|
+
var t = st(e);
|
|
208
|
+
return function(n, r) {
|
|
209
|
+
return g(n, t(function(t) {
|
|
210
|
+
return e.map(r(t), function(e) {
|
|
211
|
+
return E(e) ? e : i(t);
|
|
212
|
+
});
|
|
213
|
+
}));
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function ut(e) {
|
|
217
|
+
return function(t) {
|
|
218
|
+
return function(n) {
|
|
219
|
+
return e.chain(n, u(function(n) {
|
|
220
|
+
return e.map(t(n), i);
|
|
221
|
+
}, function(t) {
|
|
222
|
+
return e.of(S(t));
|
|
223
|
+
}));
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function dt(t) {
|
|
228
|
+
return function(n) {
|
|
229
|
+
return t.map(n, e);
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function ft(e) {
|
|
233
|
+
return function(t) {
|
|
234
|
+
return e.map(t, ae);
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region ../../../../home/vscode/.yarn/berry/cache/fp-ts-npm-2.16.11-62e43e1078-10c0.zip/node_modules/fp-ts/es6/FromIO.js
|
|
239
|
+
function I(e, t) {
|
|
240
|
+
return function(n) {
|
|
241
|
+
var r = _(n, e.fromIO);
|
|
242
|
+
return function(e) {
|
|
243
|
+
return t.chain(e, r);
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function L(e, t) {
|
|
248
|
+
var n = pt(e, t);
|
|
249
|
+
return function(e) {
|
|
250
|
+
return function(t) {
|
|
251
|
+
return n(t, e);
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function pt(e, t) {
|
|
256
|
+
var n = a(t);
|
|
257
|
+
return function(t, r) {
|
|
258
|
+
return n(t, _(r, e.fromIO));
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region ../../../../home/vscode/.yarn/berry/cache/fp-ts-npm-2.16.11-62e43e1078-10c0.zip/node_modules/fp-ts/es6/IO.js
|
|
263
|
+
var mt = function(e, t) {
|
|
264
|
+
return function() {
|
|
265
|
+
return t(e());
|
|
266
|
+
};
|
|
267
|
+
}, ht = function(e, t) {
|
|
268
|
+
return function() {
|
|
269
|
+
return e()(t());
|
|
270
|
+
};
|
|
271
|
+
}, gt = ue, _t = /* @__PURE__ */ s(2, function(e, t) {
|
|
272
|
+
return function() {
|
|
273
|
+
return t(e())();
|
|
274
|
+
};
|
|
275
|
+
}), vt = {
|
|
276
|
+
URI: "IO",
|
|
277
|
+
map: mt
|
|
278
|
+
};
|
|
279
|
+
s(2, o(vt)), c(vt), a({
|
|
280
|
+
URI: "IO",
|
|
281
|
+
map: mt,
|
|
282
|
+
ap: ht,
|
|
283
|
+
chain: _t
|
|
284
|
+
});
|
|
285
|
+
var yt = /* @__PURE__ */ gt(m);
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region ../../../../home/vscode/.yarn/berry/cache/fp-ts-npm-2.16.11-62e43e1078-10c0.zip/node_modules/fp-ts/es6/OptionT.js
|
|
288
|
+
function bt(e) {
|
|
289
|
+
return _(b, e.of);
|
|
290
|
+
}
|
|
291
|
+
function xt(e) {
|
|
292
|
+
return ue(e.of(T));
|
|
293
|
+
}
|
|
294
|
+
function St(e) {
|
|
295
|
+
return function(t) {
|
|
296
|
+
return e.map(t, b);
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function Ct(e) {
|
|
300
|
+
return _(ee, e.of);
|
|
301
|
+
}
|
|
302
|
+
function wt(e) {
|
|
303
|
+
var t = Ct(e);
|
|
304
|
+
return function(e) {
|
|
305
|
+
return _(e, t);
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function Tt(e) {
|
|
309
|
+
var t = R(e), n = wt(e);
|
|
310
|
+
return function(e) {
|
|
311
|
+
return t(n(e));
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function Et(e) {
|
|
315
|
+
return function(t) {
|
|
316
|
+
return _(t, e.of);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function Dt(e) {
|
|
320
|
+
var t = R(e), n = Et(e);
|
|
321
|
+
return function(e) {
|
|
322
|
+
return t(n(e));
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function Ot(e) {
|
|
326
|
+
return function(t) {
|
|
327
|
+
return function(n) {
|
|
328
|
+
return e.of(ce(t)(n));
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function kt(e) {
|
|
333
|
+
return _(ie, e.of);
|
|
334
|
+
}
|
|
335
|
+
function At(e) {
|
|
336
|
+
return function(t, n) {
|
|
337
|
+
return function(r) {
|
|
338
|
+
return e.map(r, C(t, n));
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function jt(e) {
|
|
343
|
+
return function(t, n) {
|
|
344
|
+
return function(r) {
|
|
345
|
+
return e.chain(r, C(t, n));
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function Mt(e) {
|
|
350
|
+
return function(t) {
|
|
351
|
+
return function(n) {
|
|
352
|
+
return e.chain(n, C(t, e.of));
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function Nt(e) {
|
|
357
|
+
return f(e, de);
|
|
358
|
+
}
|
|
359
|
+
function Pt(e) {
|
|
360
|
+
return he(e, se);
|
|
361
|
+
}
|
|
362
|
+
function R(e) {
|
|
363
|
+
var t = Ft(e);
|
|
364
|
+
return function(e) {
|
|
365
|
+
return function(n) {
|
|
366
|
+
return t(n, e);
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function Ft(e) {
|
|
371
|
+
var t = xt(e);
|
|
372
|
+
return function(n, r) {
|
|
373
|
+
return e.chain(n, C(function() {
|
|
374
|
+
return t();
|
|
375
|
+
}, r));
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function It(e) {
|
|
379
|
+
var t = bt(e);
|
|
380
|
+
return function(n) {
|
|
381
|
+
return function(r) {
|
|
382
|
+
return e.chain(r, C(n, t));
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region ../../../../home/vscode/.yarn/berry/cache/fp-ts-npm-2.16.11-62e43e1078-10c0.zip/node_modules/fp-ts/es6/pipeable.js
|
|
388
|
+
function Lt(e) {
|
|
389
|
+
return function(t) {
|
|
390
|
+
return function(n) {
|
|
391
|
+
return e.map(n, t);
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
function Rt(e) {
|
|
396
|
+
return function(t) {
|
|
397
|
+
return function(n) {
|
|
398
|
+
return e.ap(n, t);
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function zt(e) {
|
|
403
|
+
return function(t) {
|
|
404
|
+
return function(n) {
|
|
405
|
+
return e.chain(n, t);
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region ../../../../home/vscode/.yarn/berry/cache/fp-ts-npm-2.16.11-62e43e1078-10c0.zip/node_modules/fp-ts/es6/ReadonlySet.js
|
|
411
|
+
var z = function(e) {
|
|
412
|
+
return e.size === 0;
|
|
413
|
+
}, B;
|
|
414
|
+
(function(e) {
|
|
415
|
+
function t(e) {
|
|
416
|
+
let t = zt(e);
|
|
417
|
+
return (n) => t(_(n, e.liftF));
|
|
418
|
+
}
|
|
419
|
+
e.chainF = t;
|
|
420
|
+
function n(e) {
|
|
421
|
+
let t = d(e);
|
|
422
|
+
return (n) => t(_(n, e.liftF));
|
|
423
|
+
}
|
|
424
|
+
e.chainFirstF = n;
|
|
425
|
+
function r(e) {
|
|
426
|
+
let t = l(e);
|
|
427
|
+
return (n, r) => t(n, _(r, e.liftF));
|
|
428
|
+
}
|
|
429
|
+
e.bindF = r;
|
|
430
|
+
})(B ||= {});
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/internal/fp/wisp.ts
|
|
433
|
+
var V;
|
|
434
|
+
(function(e) {
|
|
435
|
+
let t = e.URI = "Wisp", n = e.Pointed = {
|
|
436
|
+
URI: t,
|
|
437
|
+
of: N
|
|
438
|
+
}, r = e.Functor = {
|
|
439
|
+
URI: t,
|
|
440
|
+
map: (e, t) => e.bearing === "resting" ? N(t(e.relic)) : M(e.sigil, (n) => r.map(e.resonate(n), t))
|
|
441
|
+
}, i = e.Apply = {
|
|
442
|
+
URI: t,
|
|
443
|
+
ap: (e, t) => e.bearing === "resting" ? r.map(t, e.relic) : M(e.sigil, (n) => i.ap(e.resonate(n), t)),
|
|
444
|
+
map: r.map
|
|
445
|
+
}, a = e.Applicative = {
|
|
446
|
+
URI: t,
|
|
447
|
+
ap: i.ap,
|
|
448
|
+
map: r.map,
|
|
449
|
+
of: n.of
|
|
450
|
+
}, o = e.Chain = {
|
|
451
|
+
URI: t,
|
|
452
|
+
ap: i.ap,
|
|
453
|
+
chain: (e, t) => e.bearing === "resting" ? t(e.relic) : M(e.sigil, (n) => o.chain(e.resonate(n), t)),
|
|
454
|
+
map: r.map
|
|
455
|
+
};
|
|
456
|
+
e.Monad = {
|
|
457
|
+
URI: t,
|
|
458
|
+
ap: i.ap,
|
|
459
|
+
chain: o.chain,
|
|
460
|
+
map: r.map,
|
|
461
|
+
of: n.of
|
|
462
|
+
}, e.Do = N(null);
|
|
463
|
+
let s = e.Lifting = {
|
|
464
|
+
URI: t,
|
|
465
|
+
ap: i.ap,
|
|
466
|
+
chain: o.chain,
|
|
467
|
+
liftF: De,
|
|
468
|
+
map: r.map
|
|
469
|
+
}, c = e.FromIO = {
|
|
470
|
+
URI: t,
|
|
471
|
+
fromIO: (e) => n.of(e())
|
|
472
|
+
}, { of: u } = n;
|
|
473
|
+
e.of = u, e.map = Lt(r), e.ap = Rt(i), e.chain = zt(o), e.bind = l(o), e.chainFirst = d(o), e.sequence = F(a);
|
|
474
|
+
let { liftF: f } = s;
|
|
475
|
+
e.liftF = f, e.bindF = B.bindF(s), e.chainF = B.chainF(s), e.chainFirstF = B.chainFirstF(s);
|
|
476
|
+
let { fromIO: p } = c;
|
|
477
|
+
e.fromIO = p, e.chainFirstIOK = L(c, o), e.chainIOK = I(c, o);
|
|
478
|
+
})(V ||= {});
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/internal/fp/wisp-either.ts
|
|
481
|
+
var H;
|
|
482
|
+
(function(e) {
|
|
483
|
+
let t = e.URI = "WispEither";
|
|
484
|
+
e.left = Ue(V.Pointed);
|
|
485
|
+
let n = e.right = He(V.Pointed), r = e.map = Ye(V.Functor), i = e.ap = Xe(V.Apply), a = e.chain = Ze(V.Monad);
|
|
486
|
+
e.leftWisp = Ge(V.Functor);
|
|
487
|
+
let o = e.rightWisp = We(V.Functor), s = e.Pointed = {
|
|
488
|
+
URI: t,
|
|
489
|
+
of: n
|
|
490
|
+
}, c = e.Functor = {
|
|
491
|
+
URI: t,
|
|
492
|
+
map: (e, t) => r(t)(e)
|
|
493
|
+
}, u = e.Apply = {
|
|
494
|
+
URI: t,
|
|
495
|
+
ap: (e, t) => i(t)(e),
|
|
496
|
+
map: c.map
|
|
497
|
+
}, f = e.Applicative = {
|
|
498
|
+
URI: t,
|
|
499
|
+
ap: u.ap,
|
|
500
|
+
map: c.map,
|
|
501
|
+
of: s.of
|
|
502
|
+
}, p = e.Chain = {
|
|
503
|
+
URI: t,
|
|
504
|
+
ap: u.ap,
|
|
505
|
+
chain: (e, t) => a(t)(e),
|
|
506
|
+
map: c.map
|
|
507
|
+
};
|
|
508
|
+
e.Monad = {
|
|
509
|
+
URI: t,
|
|
510
|
+
ap: u.ap,
|
|
511
|
+
chain: p.chain,
|
|
512
|
+
map: c.map,
|
|
513
|
+
of: s.of
|
|
514
|
+
};
|
|
515
|
+
let m = e.Lifting = {
|
|
516
|
+
URI: t,
|
|
517
|
+
ap: u.ap,
|
|
518
|
+
chain: p.chain,
|
|
519
|
+
liftF: _(V.liftF, o),
|
|
520
|
+
map: c.map
|
|
521
|
+
}, h = e.FromIO = {
|
|
522
|
+
URI: t,
|
|
523
|
+
fromIO: (e) => s.of(e())
|
|
524
|
+
};
|
|
525
|
+
e.bind = l(p), e.chainFirst = d(p), e.sequence = F(f);
|
|
526
|
+
let { liftF: g } = m;
|
|
527
|
+
e.liftF = g, e.bindF = B.bindF(m), e.chainF = B.chainF(m), e.chainFirstF = B.chainFirstF(m);
|
|
528
|
+
let { fromIO: v } = h;
|
|
529
|
+
e.fromIO = v, e.chainFirstIOK = L(h, p), e.chainIOK = I(h, p), e.alt = $e(V.Monad), e.bimap = et(V.Monad), e.chainNullableK = Je(V.Monad), e.fromNullable = Ke(V.Pointed), e.getOrElse = ot(V.Monad), e.mapLeft = nt(V.Functor), e.match = it(V.Chain), e.matchE = at(V.Chain), e.orElse = st(V.Monad), e.orElseFirst = ct(V.Monad), e.orLeft = ut(V.Monad), e.swap = dt(V.Functor), e.toUnion = ft(V.Functor);
|
|
530
|
+
})(H ||= {});
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/internal/fp/wisp-option.ts
|
|
533
|
+
var Bt;
|
|
534
|
+
(function(e) {
|
|
535
|
+
let t = e.URI = "WispOption", n = e.some = bt(V.Pointed), r = e.map = Nt(V.Functor), i = e.ap = Pt(V.Apply), a = e.chain = R(V.Monad), o = e.fromWisp = St(V.Functor), s = e.Pointed = {
|
|
536
|
+
URI: t,
|
|
537
|
+
of: n
|
|
538
|
+
}, c = e.Functor = {
|
|
539
|
+
URI: t,
|
|
540
|
+
map: (e, t) => r(t)(e)
|
|
541
|
+
}, u = e.Apply = {
|
|
542
|
+
URI: t,
|
|
543
|
+
ap: (e, t) => i(t)(e),
|
|
544
|
+
map: c.map
|
|
545
|
+
}, f = e.Applicative = {
|
|
546
|
+
URI: t,
|
|
547
|
+
ap: u.ap,
|
|
548
|
+
map: c.map,
|
|
549
|
+
of: s.of
|
|
550
|
+
}, p = e.Chain = {
|
|
551
|
+
URI: t,
|
|
552
|
+
ap: u.ap,
|
|
553
|
+
chain: (e, t) => a(t)(e),
|
|
554
|
+
map: c.map
|
|
555
|
+
};
|
|
556
|
+
e.Monad = {
|
|
557
|
+
URI: t,
|
|
558
|
+
ap: u.ap,
|
|
559
|
+
chain: p.chain,
|
|
560
|
+
map: c.map,
|
|
561
|
+
of: s.of
|
|
562
|
+
};
|
|
563
|
+
let m = e.Lifting = {
|
|
564
|
+
URI: t,
|
|
565
|
+
ap: u.ap,
|
|
566
|
+
chain: p.chain,
|
|
567
|
+
liftF: _(V.liftF, o),
|
|
568
|
+
map: c.map
|
|
569
|
+
}, h = e.FromIO = {
|
|
570
|
+
URI: t,
|
|
571
|
+
fromIO: (e) => s.of(e())
|
|
572
|
+
};
|
|
573
|
+
e.bind = l(p), e.chainFirst = d(p), e.sequence = F(f);
|
|
574
|
+
let { liftF: g } = m;
|
|
575
|
+
e.liftF = g, e.bindF = B.bindF(m), e.chainF = B.chainF(m), e.chainFirstF = B.chainFirstF(m);
|
|
576
|
+
let { fromIO: v } = h;
|
|
577
|
+
e.fromIO = v, e.chainFirstIOK = L(h, p), e.chainIOK = I(h, p), e.alt = It(V.Monad), e.chainNullableK = Tt(V.Monad), e.chainOptionK = Dt(V.Monad), e.fromEither = kt(V.Pointed), e.fromNullable = Ct(V.Pointed), e.fromPredicate = Ot(V.Pointed), e.getOrElse = Mt(V.Monad), e.match = At(V.Functor), e.matchE = jt(V.Chain), e.zero = xt(V.Pointed);
|
|
578
|
+
})(Bt ||= {});
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/internal/fp/sigil.ts
|
|
581
|
+
var Vt;
|
|
582
|
+
(function(e) {
|
|
583
|
+
e.URI = "Sigil";
|
|
584
|
+
})(Vt ||= {});
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/primitives-kit/process.ts
|
|
587
|
+
function Ht(e) {
|
|
588
|
+
return g(j(e.exitFuture), V.liftF, V.map(oe()), V.map(({ right: e }) => e));
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/primitives-kit/resumable.ts
|
|
592
|
+
var Ut = ke(), Wt = Oe();
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region src/primitives/all.ts
|
|
595
|
+
function Gt(e) {
|
|
596
|
+
return g(A(Kt(e)), V.liftF, V.map((e) => e.exitFuture));
|
|
597
|
+
}
|
|
598
|
+
function Kt(e) {
|
|
599
|
+
return () => g(e, P(_(A, V.liftF)), V.sequence, V.map(P(Ht)), V.chain(V.sequence), V.map(le()));
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/primitives/wait.ts
|
|
603
|
+
function qt(e) {
|
|
604
|
+
return V.liftF(j(e));
|
|
605
|
+
}
|
|
606
|
+
//#endregion
|
|
607
|
+
//#region src/primitives/bind.ts
|
|
608
|
+
function Jt(e, t) {
|
|
609
|
+
return V.liftF(ge(e, t));
|
|
610
|
+
}
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region src/primitives/cancel.ts
|
|
613
|
+
function Yt() {
|
|
614
|
+
return V.liftF(_e());
|
|
615
|
+
}
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/primitives/cede.ts
|
|
618
|
+
function Xt() {
|
|
619
|
+
return V.liftF(ve());
|
|
620
|
+
}
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/primitives/defer.ts
|
|
623
|
+
function Zt(e) {
|
|
624
|
+
return V.liftF(ye(e));
|
|
625
|
+
}
|
|
626
|
+
//#endregion
|
|
627
|
+
//#region src/primitives/spawn.ts
|
|
628
|
+
function Qt(e) {
|
|
629
|
+
return g(A(e), V.liftF, V.map((e) => e.exitFuture));
|
|
630
|
+
}
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region src/primitives/future.ts
|
|
633
|
+
function $t() {
|
|
634
|
+
return V.liftF(O());
|
|
635
|
+
}
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region src/primitives/halt.ts
|
|
638
|
+
function en(e) {
|
|
639
|
+
return V.liftF(be(e));
|
|
640
|
+
}
|
|
641
|
+
//#endregion
|
|
642
|
+
//#region src/primitives/lookup.ts
|
|
643
|
+
function tn(e) {
|
|
644
|
+
return V.liftF(xe(e));
|
|
645
|
+
}
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region src/primitives/poll.ts
|
|
648
|
+
function nn(e) {
|
|
649
|
+
return V.liftF(Se(e));
|
|
650
|
+
}
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region src/primitives/park.ts
|
|
653
|
+
function rn() {
|
|
654
|
+
return V.liftF(Ce(an));
|
|
655
|
+
}
|
|
656
|
+
var an = Oe();
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region src/primitives/race.ts
|
|
659
|
+
function on(e) {
|
|
660
|
+
return g(O(), V.liftF, V.chainFirstF(([, t]) => D(sn(e, t))), V.map(([e]) => e));
|
|
661
|
+
}
|
|
662
|
+
function sn(e, t) {
|
|
663
|
+
return () => g(e, P((e) => g(A(cn(e, t)), V.liftF)), V.sequence);
|
|
664
|
+
}
|
|
665
|
+
function cn(e, t) {
|
|
666
|
+
return () => g(e(), V.chainF((e) => k(t, S(e))), V.chainF(_e));
|
|
667
|
+
}
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region src/primitives/resource.ts
|
|
670
|
+
function ln(e) {
|
|
671
|
+
return g(O(), V.liftF, V.chainFirstF(([, t]) => A(un(e, t))), V.map(([e]) => e));
|
|
672
|
+
}
|
|
673
|
+
function un(e, t) {
|
|
674
|
+
return () => e((e) => g(k(t, S(e)), V.liftF, V.chain(rn)));
|
|
675
|
+
}
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/primitives/resumable.ts
|
|
678
|
+
function dn(e) {
|
|
679
|
+
return g(D(e, { failureMode: "contain" }), V.liftF, V.chainF(({ scope: e }) => A(fn(e.exitFuture))), V.map(({ exitFuture: e }) => e));
|
|
680
|
+
}
|
|
681
|
+
function fn(e) {
|
|
682
|
+
return () => g(j(e), V.liftF, H.orElse((e) => g(xe(Ut), V.liftF, V.map(p(() => e)), H.map((e) => ({ delegateScope: e })), H.bindF("resolver", () => O()), H.chainFirstF(({ resolver: [, t], delegateScope: n }) => Te(n, Wt, {
|
|
683
|
+
failure: e,
|
|
684
|
+
recoverySettle: t
|
|
685
|
+
})), H.chainF(({ resolver: [e] }) => j(e)), V.map(te))), H.getOrElse(_(be, V.liftF)));
|
|
686
|
+
}
|
|
687
|
+
//#endregion
|
|
688
|
+
//#region src/primitives/guard.ts
|
|
689
|
+
function pn(e, t) {
|
|
690
|
+
return g(D(mn(e, t)), V.liftF, V.map(({ scope: e }) => e.exitFuture));
|
|
691
|
+
}
|
|
692
|
+
function mn(e, t) {
|
|
693
|
+
return () => g(we(), V.liftF, V.chainF(({ scope: e }) => ge(Ut, e)), V.chainF(() => A(hn(t), { completionMode: "detached" })), V.chain(e));
|
|
694
|
+
}
|
|
695
|
+
function hn(e) {
|
|
696
|
+
return function t() {
|
|
697
|
+
return g(Ce(Wt), V.liftF, V.chainF((t) => A(gn(t, e))), V.chain(t));
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
function gn(e, t) {
|
|
701
|
+
return () => g(t(e.failure), V.chainF((t) => k(e.recoverySettle, t)));
|
|
702
|
+
}
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/primitives/enclose.ts
|
|
705
|
+
function _n(e) {
|
|
706
|
+
return g(D(e, { failureMode: "contain" }), V.liftF, V.chainF(({ scope: e }) => j(e.exitFuture)));
|
|
707
|
+
}
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/primitives/self.ts
|
|
710
|
+
function vn() {
|
|
711
|
+
return V.liftF(we());
|
|
712
|
+
}
|
|
713
|
+
//#endregion
|
|
714
|
+
//#region src/primitives/settle.ts
|
|
715
|
+
function yn(e, t) {
|
|
716
|
+
return V.liftF(k(e, t));
|
|
717
|
+
}
|
|
718
|
+
//#endregion
|
|
719
|
+
//#region src/primitives/unbind.ts
|
|
720
|
+
function bn(e) {
|
|
721
|
+
return V.liftF(Ee(e));
|
|
722
|
+
}
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region src/failures/canceled.ts
|
|
725
|
+
var U = {
|
|
726
|
+
kind: "canceled",
|
|
727
|
+
message: "Canceled before completion"
|
|
728
|
+
};
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/failures/external.ts
|
|
731
|
+
function xn(e, t) {
|
|
732
|
+
return {
|
|
733
|
+
kind: "external",
|
|
734
|
+
message: t,
|
|
735
|
+
raw: e
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
//#endregion
|
|
739
|
+
//#region src/failures/interrupted.ts
|
|
740
|
+
function W(e) {
|
|
741
|
+
return {
|
|
742
|
+
cause: e,
|
|
743
|
+
kind: "interrupted",
|
|
744
|
+
message: "Scope progression was interrupted by an out-of-band failure"
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/failures/scope.ts
|
|
749
|
+
function Sn(e, t) {
|
|
750
|
+
return {
|
|
751
|
+
cause: e,
|
|
752
|
+
kind: "scope",
|
|
753
|
+
message: "Scope failed during closing",
|
|
754
|
+
suppressed: t
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region src/executor/domains/domain.ts
|
|
759
|
+
var Cn = class e {
|
|
760
|
+
static *domains(e) {
|
|
761
|
+
yield e;
|
|
762
|
+
for (let t of e.#t) yield* this.domains(t);
|
|
763
|
+
}
|
|
764
|
+
static sentinel() {
|
|
765
|
+
return e.#e;
|
|
766
|
+
}
|
|
767
|
+
constructor(e) {
|
|
768
|
+
this.parent = e;
|
|
769
|
+
}
|
|
770
|
+
close() {
|
|
771
|
+
this.parent.removeChild(this);
|
|
772
|
+
}
|
|
773
|
+
addChild(e) {
|
|
774
|
+
this.#t.add(e);
|
|
775
|
+
}
|
|
776
|
+
removeChild(e) {
|
|
777
|
+
this.#t.delete(e);
|
|
778
|
+
}
|
|
779
|
+
get isRoot() {
|
|
780
|
+
return this.parent === e.#e;
|
|
781
|
+
}
|
|
782
|
+
static #e = null;
|
|
783
|
+
#t = /* @__PURE__ */ new Set();
|
|
784
|
+
}, wn = class e extends Cn {
|
|
785
|
+
static root(t) {
|
|
786
|
+
return new e(e.sentinel(), t);
|
|
787
|
+
}
|
|
788
|
+
nest(t) {
|
|
789
|
+
let n = new e(this, t);
|
|
790
|
+
return super.addChild(n), n;
|
|
791
|
+
}
|
|
792
|
+
setScopeRoot(e) {
|
|
793
|
+
this.#e = e, this.addLeafScope(e);
|
|
794
|
+
}
|
|
795
|
+
addLeafScope(e) {
|
|
796
|
+
this.#n.add(e);
|
|
797
|
+
}
|
|
798
|
+
removeLeafScope(e) {
|
|
799
|
+
this.#n.delete(e);
|
|
800
|
+
}
|
|
801
|
+
trackScope(e, t) {
|
|
802
|
+
t.status === "closing" ? this.#t.add(e) : z(this.#t) || this.#t.delete(e);
|
|
803
|
+
}
|
|
804
|
+
*createWorkers(e) {
|
|
805
|
+
for (let t of this.#n) e(t).status === "closing" && (yield {
|
|
806
|
+
scope: t,
|
|
807
|
+
worker: () => this.reaper.adjudicate(t)
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
close() {
|
|
811
|
+
this.#t.clear(), this.#n.clear(), super.close();
|
|
812
|
+
}
|
|
813
|
+
get hasClosingScope() {
|
|
814
|
+
return !z(this.#t);
|
|
815
|
+
}
|
|
816
|
+
get scopeRoot() {
|
|
817
|
+
return this.#e;
|
|
818
|
+
}
|
|
819
|
+
constructor(e, t) {
|
|
820
|
+
super(e), this.reaper = t;
|
|
821
|
+
}
|
|
822
|
+
#e;
|
|
823
|
+
#t = /* @__PURE__ */ new Set();
|
|
824
|
+
#n = /* @__PURE__ */ new Set();
|
|
825
|
+
}, Tn = class e extends Cn {
|
|
826
|
+
static root(t, n) {
|
|
827
|
+
return new e(e.sentinel(), t, n);
|
|
828
|
+
}
|
|
829
|
+
nest(t, n) {
|
|
830
|
+
let r = new e(this, t, n);
|
|
831
|
+
return super.addChild(r), r;
|
|
832
|
+
}
|
|
833
|
+
admitProcess(e, t) {
|
|
834
|
+
t.status === "open" && t.activity === "running" && this.scheduler.assign(e).admit(this.createTask(e));
|
|
835
|
+
}
|
|
836
|
+
constructor(e, t, n) {
|
|
837
|
+
super(e), this.scheduler = t, this.createTask = n;
|
|
838
|
+
}
|
|
839
|
+
}, G = class {
|
|
840
|
+
constructor(e) {
|
|
841
|
+
this.message = e;
|
|
842
|
+
}
|
|
843
|
+
capture(e) {
|
|
844
|
+
this.#e.push(e);
|
|
845
|
+
}
|
|
846
|
+
drain() {
|
|
847
|
+
let e = this.#e;
|
|
848
|
+
switch (this.#e = [], e.length) {
|
|
849
|
+
case 0: return T;
|
|
850
|
+
case 1: return b(e[0]);
|
|
851
|
+
default: return b(AggregateError(e, this.message));
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
throwIfAny() {
|
|
855
|
+
let e = this.drain();
|
|
856
|
+
if (y(e)) throw e.value;
|
|
857
|
+
}
|
|
858
|
+
[Symbol.dispose]() {
|
|
859
|
+
this.throwIfAny();
|
|
860
|
+
}
|
|
861
|
+
#e = [];
|
|
862
|
+
};
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region src/interpreter/process-step.ts
|
|
865
|
+
function K() {
|
|
866
|
+
return { disposition: "waiting" };
|
|
867
|
+
}
|
|
868
|
+
function En() {
|
|
869
|
+
return { disposition: "ceded" };
|
|
870
|
+
}
|
|
871
|
+
function q() {
|
|
872
|
+
return { disposition: "interpreted" };
|
|
873
|
+
}
|
|
874
|
+
function Dn() {
|
|
875
|
+
return { disposition: "resonated" };
|
|
876
|
+
}
|
|
877
|
+
function J(e) {
|
|
878
|
+
return {
|
|
879
|
+
disposition: "exited",
|
|
880
|
+
result: e
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/interpreter/runtime-future.ts
|
|
885
|
+
var Y = class {
|
|
886
|
+
poll() {
|
|
887
|
+
return this.#t ? b(this.#t) : T;
|
|
888
|
+
}
|
|
889
|
+
wait(e) {
|
|
890
|
+
if (this.#t) return w();
|
|
891
|
+
let t = [e];
|
|
892
|
+
return this.#e.add(t), () => {
|
|
893
|
+
this.#e.delete(t);
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
settle(e) {
|
|
897
|
+
return this.#t ? () => [] : (this.#t = e, (t) => {
|
|
898
|
+
for (let [n] of this.#e) n(e, t);
|
|
899
|
+
this.#e.clear();
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
handle() {
|
|
903
|
+
return [this, this];
|
|
904
|
+
}
|
|
905
|
+
#e = /* @__PURE__ */ new Set();
|
|
906
|
+
#t = null;
|
|
907
|
+
}, On = class {
|
|
908
|
+
current() {
|
|
909
|
+
switch (this.#t.status) {
|
|
910
|
+
case "echo": {
|
|
911
|
+
let { wisp: e } = this.#t;
|
|
912
|
+
return {
|
|
913
|
+
accept: (t) => {
|
|
914
|
+
this.#e(e, t);
|
|
915
|
+
},
|
|
916
|
+
kind: "echo",
|
|
917
|
+
sigil: this.#t.wisp.sigil
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
case "relic": return {
|
|
921
|
+
kind: "relic",
|
|
922
|
+
relic: this.#t.relic
|
|
923
|
+
};
|
|
924
|
+
case "resonate": return w();
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
next() {
|
|
928
|
+
switch (this.#t.status) {
|
|
929
|
+
case "echo": {
|
|
930
|
+
let { wisp: e } = this.#t;
|
|
931
|
+
return {
|
|
932
|
+
accept: (t) => {
|
|
933
|
+
this.#e(e, t);
|
|
934
|
+
},
|
|
935
|
+
kind: "echo",
|
|
936
|
+
sigil: this.#t.wisp.sigil
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
case "relic": return {
|
|
940
|
+
kind: "relic",
|
|
941
|
+
relic: this.#t.relic
|
|
942
|
+
};
|
|
943
|
+
case "resonate": {
|
|
944
|
+
let e = this.#t.resonate();
|
|
945
|
+
return e.bearing === "resting" ? (this.#t = {
|
|
946
|
+
relic: e.relic,
|
|
947
|
+
status: "relic"
|
|
948
|
+
}, {
|
|
949
|
+
kind: "relic",
|
|
950
|
+
relic: e.relic
|
|
951
|
+
}) : (this.#t = {
|
|
952
|
+
status: "echo",
|
|
953
|
+
wisp: e
|
|
954
|
+
}, {
|
|
955
|
+
kind: "resonate",
|
|
956
|
+
sigil: this.#t.wisp.sigil
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
constructor(e) {
|
|
962
|
+
this.#t = {
|
|
963
|
+
resonate: e,
|
|
964
|
+
status: "resonate"
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
#e(e, t) {
|
|
968
|
+
this.#t = {
|
|
969
|
+
resonate: () => e.resonate(t),
|
|
970
|
+
status: "resonate"
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
#t;
|
|
974
|
+
}, kn = class e {
|
|
975
|
+
static create(t, n, r) {
|
|
976
|
+
return new e(t, n, r);
|
|
977
|
+
}
|
|
978
|
+
selfHandle() {
|
|
979
|
+
return {
|
|
980
|
+
process: this,
|
|
981
|
+
scope: this.scopeRef
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
runner() {
|
|
985
|
+
return this;
|
|
986
|
+
}
|
|
987
|
+
keeper() {
|
|
988
|
+
return this;
|
|
989
|
+
}
|
|
990
|
+
stateAs(e) {
|
|
991
|
+
return this.#i;
|
|
992
|
+
}
|
|
993
|
+
resume(e) {
|
|
994
|
+
let t = this.stateAs("waiting");
|
|
995
|
+
t.stepper.current().accept(e), this.#i = An(t.stepper);
|
|
996
|
+
}
|
|
997
|
+
wait(e) {
|
|
998
|
+
this.#i = {
|
|
999
|
+
dispose: e,
|
|
1000
|
+
status: "waiting",
|
|
1001
|
+
stepper: this.stateAs("running").stepper
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
complete(e) {
|
|
1005
|
+
return this.#t(), this.#i = {
|
|
1006
|
+
result: e,
|
|
1007
|
+
status: "completed"
|
|
1008
|
+
}, this.#e(S(e));
|
|
1009
|
+
}
|
|
1010
|
+
fail(e) {
|
|
1011
|
+
return this.#t(), this.#i = {
|
|
1012
|
+
failure: e,
|
|
1013
|
+
status: "failed"
|
|
1014
|
+
}, this.#e(i(e));
|
|
1015
|
+
}
|
|
1016
|
+
cancel() {
|
|
1017
|
+
return this.#t(), this.#i = { status: "canceled" }, this.#e(i(U));
|
|
1018
|
+
}
|
|
1019
|
+
defer(e) {
|
|
1020
|
+
this.#r.push(e);
|
|
1021
|
+
}
|
|
1022
|
+
get exitFuture() {
|
|
1023
|
+
return this.#n;
|
|
1024
|
+
}
|
|
1025
|
+
get descriptor() {
|
|
1026
|
+
return this.processDescriptor;
|
|
1027
|
+
}
|
|
1028
|
+
get scopeRef() {
|
|
1029
|
+
return this.scopeReference;
|
|
1030
|
+
}
|
|
1031
|
+
get status() {
|
|
1032
|
+
return this.#i.status;
|
|
1033
|
+
}
|
|
1034
|
+
get isClosed() {
|
|
1035
|
+
switch (this.status) {
|
|
1036
|
+
case "running":
|
|
1037
|
+
case "waiting": return !1;
|
|
1038
|
+
case "completed":
|
|
1039
|
+
case "canceled":
|
|
1040
|
+
case "failed": return !0;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
constructor(e, t, n) {
|
|
1044
|
+
this.scopeReference = e, this.processDescriptor = n, this.#i = An(new On(t));
|
|
1045
|
+
}
|
|
1046
|
+
#e(e) {
|
|
1047
|
+
let t = this.#r;
|
|
1048
|
+
return this.#r = [], {
|
|
1049
|
+
cleanups: t,
|
|
1050
|
+
notification: this.#n.settle(e)
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
#t() {
|
|
1054
|
+
this.#i.status === "waiting" && this.#i.dispose();
|
|
1055
|
+
}
|
|
1056
|
+
#n = new Y();
|
|
1057
|
+
#r = [];
|
|
1058
|
+
#i;
|
|
1059
|
+
};
|
|
1060
|
+
function An(e) {
|
|
1061
|
+
return {
|
|
1062
|
+
next: () => e.next(),
|
|
1063
|
+
status: "running",
|
|
1064
|
+
stepper: e
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
//#endregion
|
|
1068
|
+
//#region src/interpreter/runtime-scope/runtime-mailbox.ts
|
|
1069
|
+
var jn = class {
|
|
1070
|
+
tryReceive(e) {
|
|
1071
|
+
let t = this.#n.get(e);
|
|
1072
|
+
if (t) switch (t.length) {
|
|
1073
|
+
case 0:
|
|
1074
|
+
this.#n.delete(e);
|
|
1075
|
+
break;
|
|
1076
|
+
case 1: return this.#n.delete(e), b(t[0]);
|
|
1077
|
+
default: return b(t.shift());
|
|
1078
|
+
}
|
|
1079
|
+
return T;
|
|
1080
|
+
}
|
|
1081
|
+
enqueueReceiver(e, t) {
|
|
1082
|
+
this.#i.getOrInsertComputed(e, () => /* @__PURE__ */ new Set()).add(t), this.#r.getOrInsertComputed(t, () => []).push(e);
|
|
1083
|
+
}
|
|
1084
|
+
send(e, t) {
|
|
1085
|
+
let n = this.#r.get(e);
|
|
1086
|
+
if (n) switch (n.length) {
|
|
1087
|
+
case 0:
|
|
1088
|
+
this.#r.delete(e);
|
|
1089
|
+
break;
|
|
1090
|
+
case 1: {
|
|
1091
|
+
this.#r.delete(e);
|
|
1092
|
+
let [t] = n;
|
|
1093
|
+
return t;
|
|
1094
|
+
}
|
|
1095
|
+
default: return n.shift();
|
|
1096
|
+
}
|
|
1097
|
+
return this.#t(e, t), null;
|
|
1098
|
+
}
|
|
1099
|
+
cancelReceiver(e) {
|
|
1100
|
+
let t = this.#i.get(e);
|
|
1101
|
+
if (t) {
|
|
1102
|
+
for (let n of t) this.#e(n, e);
|
|
1103
|
+
this.#i.delete(e);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
clear() {
|
|
1107
|
+
this.#n.clear(), this.#r.clear(), this.#i.clear();
|
|
1108
|
+
}
|
|
1109
|
+
#e(e, t) {
|
|
1110
|
+
let n = this.#r.get(e);
|
|
1111
|
+
if (!n) return;
|
|
1112
|
+
let r = n.filter((e) => e !== t);
|
|
1113
|
+
Pe(r) ? this.#r.delete(e) : n.splice(0, n.length, ...r);
|
|
1114
|
+
}
|
|
1115
|
+
#t(e, t) {
|
|
1116
|
+
this.#n.getOrInsertComputed(e, () => []).push(t);
|
|
1117
|
+
}
|
|
1118
|
+
#n = /* @__PURE__ */ new Map();
|
|
1119
|
+
#r = /* @__PURE__ */ new Map();
|
|
1120
|
+
#i = /* @__PURE__ */ new Map();
|
|
1121
|
+
}, X = class {
|
|
1122
|
+
constructor(e, t) {
|
|
1123
|
+
this.cause = e, this.resolveFailure = t;
|
|
1124
|
+
}
|
|
1125
|
+
capture(e) {
|
|
1126
|
+
this.#e.push(e);
|
|
1127
|
+
}
|
|
1128
|
+
build() {
|
|
1129
|
+
return Sn({
|
|
1130
|
+
...this.cause,
|
|
1131
|
+
failure: this.resolveFailure()
|
|
1132
|
+
}, this.#e);
|
|
1133
|
+
}
|
|
1134
|
+
#e = [];
|
|
1135
|
+
}, Mn = class e {
|
|
1136
|
+
static root(t, n, r, i) {
|
|
1137
|
+
let a = new e(t, n, e.#w, r);
|
|
1138
|
+
return r.trackProcess(a.entryProcess, i), r.trackScope(a, i), a;
|
|
1139
|
+
}
|
|
1140
|
+
complete(e, t, n) {
|
|
1141
|
+
let r = e.complete(t);
|
|
1142
|
+
this.#p(e).delete(e), this.#m(r.cleanups, n), this.scopeZone.trackProcess(e, n), this.#e([r.notification], n);
|
|
1143
|
+
}
|
|
1144
|
+
halt(e, t, n) {
|
|
1145
|
+
let r = "failed", i = e.fail(t);
|
|
1146
|
+
this.#p(e).delete(e);
|
|
1147
|
+
let a = () => this.#m(i.cleanups, n);
|
|
1148
|
+
this.scopeZone.trackProcess(e, n);
|
|
1149
|
+
let o = [i.notification], s = this.#D;
|
|
1150
|
+
if (s.status === "failing") {
|
|
1151
|
+
re(() => {
|
|
1152
|
+
s.draft.capture(e.stateAs(r).failure), this.#i(s.draft, a, o, { propagateFailure: this.#S }, n);
|
|
1153
|
+
});
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
this.#i(new X({
|
|
1157
|
+
kind: "process",
|
|
1158
|
+
process: e
|
|
1159
|
+
}, () => e.stateAs(r).failure), a, o, { propagateFailure: this.#S }, n);
|
|
1160
|
+
}
|
|
1161
|
+
cancel(e) {
|
|
1162
|
+
this.#D.status === "failing" ? this.#i(this.#D.draft, x, [], { propagateFailure: !1 }, e) : this.#r(e);
|
|
1163
|
+
}
|
|
1164
|
+
branch(t, n, r, i) {
|
|
1165
|
+
let a = new e(t, n, this, r);
|
|
1166
|
+
return this.#k.add(a), r.trackProcess(a.entryProcess, i), r.trackScope(a, i), a;
|
|
1167
|
+
}
|
|
1168
|
+
spawn(e, t, n) {
|
|
1169
|
+
let r = e(this, t);
|
|
1170
|
+
return this.#p(r).add(r), this.scopeZone.trackProcess(r, n), r;
|
|
1171
|
+
}
|
|
1172
|
+
createFuture() {
|
|
1173
|
+
let e = new Y();
|
|
1174
|
+
return this.#j.add(e), e.wait(() => {
|
|
1175
|
+
this.#j.delete(e);
|
|
1176
|
+
}), e;
|
|
1177
|
+
}
|
|
1178
|
+
wait(e, t, n) {
|
|
1179
|
+
let r = t.wait((t, n) => {
|
|
1180
|
+
e.resume(t), this.scopeZone.trackProcess(e, n);
|
|
1181
|
+
});
|
|
1182
|
+
e.wait(r), this.scopeZone.trackProcess(e, n);
|
|
1183
|
+
}
|
|
1184
|
+
send(e, t, n, r) {
|
|
1185
|
+
e.#f(t, n, r);
|
|
1186
|
+
}
|
|
1187
|
+
receive(e, t, n) {
|
|
1188
|
+
this.#A.enqueueReceiver(e, t), e.wait(() => {
|
|
1189
|
+
this.#A.cancelReceiver(e);
|
|
1190
|
+
}), this.scopeZone.trackProcess(e, n);
|
|
1191
|
+
}
|
|
1192
|
+
tryReceive(e) {
|
|
1193
|
+
return this.#A.tryReceive(e);
|
|
1194
|
+
}
|
|
1195
|
+
lookup(e) {
|
|
1196
|
+
return this.#P.has(e) ? b(this.#P.get(e)) : this.#C ? T : this.parentScope.lookup(e);
|
|
1197
|
+
}
|
|
1198
|
+
bind(e, t) {
|
|
1199
|
+
this.#P.set(e, t);
|
|
1200
|
+
}
|
|
1201
|
+
unbind(e) {
|
|
1202
|
+
this.#P.delete(e);
|
|
1203
|
+
}
|
|
1204
|
+
forceFailed(e, t) {
|
|
1205
|
+
let n = new X({
|
|
1206
|
+
kind: "scope",
|
|
1207
|
+
scope: this
|
|
1208
|
+
}, () => e);
|
|
1209
|
+
for (this.#D.status === "failing" && n.capture(this.#D.draft.build()), this.#i(n, x, [], { propagateFailure: this.#S }, t); this.#D.status === "failing";) this.#i(this.#D.draft, x, [], { propagateFailure: !1 }, t);
|
|
1210
|
+
}
|
|
1211
|
+
get descriptor() {
|
|
1212
|
+
return this.scopeDescriptor;
|
|
1213
|
+
}
|
|
1214
|
+
get entryProcess() {
|
|
1215
|
+
return this.#E;
|
|
1216
|
+
}
|
|
1217
|
+
get zone() {
|
|
1218
|
+
return this.scopeZone;
|
|
1219
|
+
}
|
|
1220
|
+
get parent() {
|
|
1221
|
+
return this.#C ? null : this.parentScope;
|
|
1222
|
+
}
|
|
1223
|
+
get children() {
|
|
1224
|
+
return [...this.#k];
|
|
1225
|
+
}
|
|
1226
|
+
get exitFuture() {
|
|
1227
|
+
return this.#T;
|
|
1228
|
+
}
|
|
1229
|
+
get status() {
|
|
1230
|
+
return this.#D.status;
|
|
1231
|
+
}
|
|
1232
|
+
get isClosed() {
|
|
1233
|
+
switch (this.status) {
|
|
1234
|
+
case "running":
|
|
1235
|
+
case "closing":
|
|
1236
|
+
case "canceling":
|
|
1237
|
+
case "failing": return !1;
|
|
1238
|
+
case "completed":
|
|
1239
|
+
case "canceled":
|
|
1240
|
+
case "failed": return !0;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
constructor(e, t, n, r) {
|
|
1244
|
+
this.scopeDescriptor = t, this.parentScope = n, this.scopeZone = r, this.#T = new Y();
|
|
1245
|
+
let i = e(this, { completionMode: "structural" });
|
|
1246
|
+
this.#p(i).add(i), this.#E = i;
|
|
1247
|
+
}
|
|
1248
|
+
#e(e, t) {
|
|
1249
|
+
switch (this.#D.status) {
|
|
1250
|
+
case "running":
|
|
1251
|
+
this.#t(e, t);
|
|
1252
|
+
return;
|
|
1253
|
+
case "closing":
|
|
1254
|
+
this.#a(e, t);
|
|
1255
|
+
return;
|
|
1256
|
+
case "canceling":
|
|
1257
|
+
this.#o(e, t);
|
|
1258
|
+
return;
|
|
1259
|
+
case "failing":
|
|
1260
|
+
this.#s(this.#D.draft, e, t);
|
|
1261
|
+
return;
|
|
1262
|
+
case "canceled":
|
|
1263
|
+
case "completed":
|
|
1264
|
+
case "failed": return w();
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
#t(e, t) {
|
|
1268
|
+
if (this.#b) {
|
|
1269
|
+
this.#n(e, t);
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
Z(e, t);
|
|
1273
|
+
}
|
|
1274
|
+
#n(e, t) {
|
|
1275
|
+
using n = this.#v();
|
|
1276
|
+
this.#c({ status: "closing" }, e, t), this.#a([], t);
|
|
1277
|
+
}
|
|
1278
|
+
#r(e) {
|
|
1279
|
+
using t = this.#v();
|
|
1280
|
+
this.#c({ status: "canceling" }, [], e), this.#o([], e);
|
|
1281
|
+
}
|
|
1282
|
+
#i(e, t, n, r, i) {
|
|
1283
|
+
using a = this.#v();
|
|
1284
|
+
this.#c({
|
|
1285
|
+
draft: e,
|
|
1286
|
+
status: "failing"
|
|
1287
|
+
}, n, i), t(), r.propagateFailure && this.parentScope.#y(Nn) && this.parentScope.#h(this, i), this.#s(e, [], i);
|
|
1288
|
+
}
|
|
1289
|
+
#a(e, t) {
|
|
1290
|
+
if (this.#x) {
|
|
1291
|
+
let { result: n } = this.#E.stateAs("completed");
|
|
1292
|
+
this.#c({
|
|
1293
|
+
result: n,
|
|
1294
|
+
status: "completed"
|
|
1295
|
+
}, e, t), !this.#C && this.parentScope.#y(Pn) && this.parentScope.#e([], t);
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
Z(e, t);
|
|
1299
|
+
}
|
|
1300
|
+
#o(e, t) {
|
|
1301
|
+
if (this.#x) {
|
|
1302
|
+
this.#c({ status: "canceled" }, e, t), !this.#C && this.parentScope.#y(Pn) && this.parentScope.#e([], t);
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
Z(e, t);
|
|
1306
|
+
}
|
|
1307
|
+
#s(e, t, n) {
|
|
1308
|
+
if (this.#x) {
|
|
1309
|
+
this.#c({
|
|
1310
|
+
failure: e.build(),
|
|
1311
|
+
status: "failed"
|
|
1312
|
+
}, t, n), !this.#C && this.parentScope.#y(Pn) && this.parentScope.#e([], n);
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
Z(t, n);
|
|
1316
|
+
}
|
|
1317
|
+
#c(e, t, n) {
|
|
1318
|
+
switch (this.#D = e, e.status) {
|
|
1319
|
+
case "running": return w();
|
|
1320
|
+
case "closing":
|
|
1321
|
+
t.push(...this.#u(n));
|
|
1322
|
+
break;
|
|
1323
|
+
case "canceling":
|
|
1324
|
+
case "failing":
|
|
1325
|
+
t.push(...this.#l(n));
|
|
1326
|
+
break;
|
|
1327
|
+
case "canceled":
|
|
1328
|
+
t.push(...this.#d(i(U)));
|
|
1329
|
+
break;
|
|
1330
|
+
case "completed":
|
|
1331
|
+
t.push(...this.#d(S(e.result)));
|
|
1332
|
+
break;
|
|
1333
|
+
case "failed":
|
|
1334
|
+
t.push(...this.#d(i(e.failure)));
|
|
1335
|
+
break;
|
|
1336
|
+
}
|
|
1337
|
+
Z(t, n), this.scopeZone.trackScope(this, n);
|
|
1338
|
+
}
|
|
1339
|
+
#l(e) {
|
|
1340
|
+
let t = [...this.#M, ...this.#N], n = [...this.#k];
|
|
1341
|
+
this.#M.clear(), this.#N.clear();
|
|
1342
|
+
let r = [];
|
|
1343
|
+
for (let n of t) {
|
|
1344
|
+
let t = n.cancel();
|
|
1345
|
+
this.#m(t.cleanups, e), this.scopeZone.trackProcess(n, e), r.push(t.notification);
|
|
1346
|
+
}
|
|
1347
|
+
for (let t of n) t.#y(Fn) && t.cancel(e);
|
|
1348
|
+
return r;
|
|
1349
|
+
}
|
|
1350
|
+
#u(e) {
|
|
1351
|
+
let t = [...this.#N];
|
|
1352
|
+
this.#N.clear();
|
|
1353
|
+
let n = [];
|
|
1354
|
+
for (let r of t) {
|
|
1355
|
+
let t = r.cancel();
|
|
1356
|
+
this.#m(t.cleanups, e), this.scopeZone.trackProcess(r, e), n.push(t.notification);
|
|
1357
|
+
}
|
|
1358
|
+
return n;
|
|
1359
|
+
}
|
|
1360
|
+
#d(e) {
|
|
1361
|
+
this.#C || this.parentScope.#g(this), this.#A.clear();
|
|
1362
|
+
let t = i(U);
|
|
1363
|
+
return [...Array.from(this.#j, (e) => e.settle(t)), this.#T.settle(e)];
|
|
1364
|
+
}
|
|
1365
|
+
#f(e, t, n) {
|
|
1366
|
+
let r = this.#A.send(e, t);
|
|
1367
|
+
r && (r.resume(t), this.scopeZone.trackProcess(r, n));
|
|
1368
|
+
}
|
|
1369
|
+
#p(e) {
|
|
1370
|
+
return e.descriptor.completionMode === "structural" ? this.#M : this.#N;
|
|
1371
|
+
}
|
|
1372
|
+
#m(e, t) {
|
|
1373
|
+
let n = (e) => {
|
|
1374
|
+
this.spawn(e, { completionMode: "structural" }, t);
|
|
1375
|
+
};
|
|
1376
|
+
for (let t of e) t(n);
|
|
1377
|
+
}
|
|
1378
|
+
#h(e, t) {
|
|
1379
|
+
if (this.#D.status === "failing") {
|
|
1380
|
+
this.#i(this.#D.draft, x, [], { propagateFailure: this.#S }, t);
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
this.#i(new X({
|
|
1384
|
+
kind: "scope",
|
|
1385
|
+
scope: e
|
|
1386
|
+
}, () => e.#_("failed").failure), x, [], { propagateFailure: this.#S }, t);
|
|
1387
|
+
}
|
|
1388
|
+
#g(e) {
|
|
1389
|
+
this.#D.status === "failing" && e.status === "failed" && e.descriptor.failureMode === "propagate" && this.#D.draft.capture(e.#_(e.status).failure), this.#k.delete(e);
|
|
1390
|
+
}
|
|
1391
|
+
#_(e) {
|
|
1392
|
+
return this.#D;
|
|
1393
|
+
}
|
|
1394
|
+
#v() {
|
|
1395
|
+
let e = this.#O;
|
|
1396
|
+
return this.#O = !0, { [Symbol.dispose]: () => {
|
|
1397
|
+
this.#O = e;
|
|
1398
|
+
} };
|
|
1399
|
+
}
|
|
1400
|
+
#y(e) {
|
|
1401
|
+
return !this.#O || !e(this.status);
|
|
1402
|
+
}
|
|
1403
|
+
get #b() {
|
|
1404
|
+
return z(this.#M) && z(this.#k);
|
|
1405
|
+
}
|
|
1406
|
+
get #x() {
|
|
1407
|
+
return this.#b && z(this.#N);
|
|
1408
|
+
}
|
|
1409
|
+
get #S() {
|
|
1410
|
+
return this.scopeDescriptor.failureMode === "propagate";
|
|
1411
|
+
}
|
|
1412
|
+
get #C() {
|
|
1413
|
+
return this.parentScope === e.#w;
|
|
1414
|
+
}
|
|
1415
|
+
static #w = null;
|
|
1416
|
+
#T;
|
|
1417
|
+
#E;
|
|
1418
|
+
#D = { status: "running" };
|
|
1419
|
+
#O = !1;
|
|
1420
|
+
#k = /* @__PURE__ */ new Set();
|
|
1421
|
+
#A = new jn();
|
|
1422
|
+
#j = /* @__PURE__ */ new Set();
|
|
1423
|
+
#M = /* @__PURE__ */ new Set();
|
|
1424
|
+
#N = /* @__PURE__ */ new Set();
|
|
1425
|
+
#P = /* @__PURE__ */ new Map();
|
|
1426
|
+
};
|
|
1427
|
+
function Z(e, t) {
|
|
1428
|
+
for (let n of e) n(t);
|
|
1429
|
+
}
|
|
1430
|
+
function Nn(e) {
|
|
1431
|
+
return e === "failing";
|
|
1432
|
+
}
|
|
1433
|
+
function Pn(e) {
|
|
1434
|
+
return !0;
|
|
1435
|
+
}
|
|
1436
|
+
function Fn(e) {
|
|
1437
|
+
return e === "canceling" || e === "failing";
|
|
1438
|
+
}
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region src/interpreter/interpreter.ts
|
|
1441
|
+
var In = class e {
|
|
1442
|
+
static create(t, n) {
|
|
1443
|
+
let r = new e(t, n);
|
|
1444
|
+
return r.initialize(), r;
|
|
1445
|
+
}
|
|
1446
|
+
step(e, t) {
|
|
1447
|
+
let n = this.#r(e), r = n.runner();
|
|
1448
|
+
switch (r.status) {
|
|
1449
|
+
case "waiting": return K();
|
|
1450
|
+
case "completed": return J(S(r.stateAs(r.status).result));
|
|
1451
|
+
case "canceled": return J(i(U));
|
|
1452
|
+
case "failed": return J(i(r.stateAs(r.status).failure));
|
|
1453
|
+
case "running": {
|
|
1454
|
+
let e;
|
|
1455
|
+
try {
|
|
1456
|
+
e = r.stateAs(r.status).next();
|
|
1457
|
+
} catch (e) {
|
|
1458
|
+
return Un(this.#r(n.scopeRef), n.keeper(), W(e), t), J(i(r.stateAs("failed").failure));
|
|
1459
|
+
}
|
|
1460
|
+
switch (e.kind) {
|
|
1461
|
+
case "echo": return this.#e(n, e, t);
|
|
1462
|
+
case "resonate": return Dn();
|
|
1463
|
+
case "relic": return this.#r(n.scopeRef).complete(n.keeper(), e.relic, t), J(S(e.relic));
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
spawn(e, t, n) {
|
|
1469
|
+
return this.#r(e).spawn(this.#t(t), { completionMode: "structural" }, n);
|
|
1470
|
+
}
|
|
1471
|
+
lookup(e, t) {
|
|
1472
|
+
return this.#r(e).lookup(t);
|
|
1473
|
+
}
|
|
1474
|
+
poll(e) {
|
|
1475
|
+
return this.#r(e).poll();
|
|
1476
|
+
}
|
|
1477
|
+
wait(e, t) {
|
|
1478
|
+
return this.#r(e).wait(t);
|
|
1479
|
+
}
|
|
1480
|
+
forceFailed(e, t, n) {
|
|
1481
|
+
this.#r(e).forceFailed(t, n);
|
|
1482
|
+
}
|
|
1483
|
+
scopeState(e) {
|
|
1484
|
+
let t = this.#r(e);
|
|
1485
|
+
switch (t.status) {
|
|
1486
|
+
case "running": return {
|
|
1487
|
+
...Q(t),
|
|
1488
|
+
status: "open"
|
|
1489
|
+
};
|
|
1490
|
+
case "closing": return {
|
|
1491
|
+
...Q(t),
|
|
1492
|
+
status: "closing"
|
|
1493
|
+
};
|
|
1494
|
+
case "canceling": return {
|
|
1495
|
+
...Q(t),
|
|
1496
|
+
status: "closing"
|
|
1497
|
+
};
|
|
1498
|
+
case "failing": return {
|
|
1499
|
+
...Q(t),
|
|
1500
|
+
status: "closing"
|
|
1501
|
+
};
|
|
1502
|
+
case "canceled":
|
|
1503
|
+
case "completed":
|
|
1504
|
+
case "failed": return {
|
|
1505
|
+
...Q(t),
|
|
1506
|
+
status: "closed"
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
processState(e) {
|
|
1511
|
+
switch (this.#r(e).runner().status) {
|
|
1512
|
+
case "running": return {
|
|
1513
|
+
activity: "running",
|
|
1514
|
+
status: "open"
|
|
1515
|
+
};
|
|
1516
|
+
case "waiting": return {
|
|
1517
|
+
activity: "waiting",
|
|
1518
|
+
status: "open"
|
|
1519
|
+
};
|
|
1520
|
+
case "completed":
|
|
1521
|
+
case "canceled":
|
|
1522
|
+
case "failed": return { status: "closed" };
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
scope(e) {
|
|
1526
|
+
return this.#r(e).scopeRef;
|
|
1527
|
+
}
|
|
1528
|
+
get scopeRoot() {
|
|
1529
|
+
return this.#i;
|
|
1530
|
+
}
|
|
1531
|
+
get processRoot() {
|
|
1532
|
+
return this.#i.entryProcess;
|
|
1533
|
+
}
|
|
1534
|
+
get isClosed() {
|
|
1535
|
+
return this.#i.isClosed;
|
|
1536
|
+
}
|
|
1537
|
+
constructor(e, t) {
|
|
1538
|
+
this.entry = e, this.zoneRoot = t;
|
|
1539
|
+
}
|
|
1540
|
+
scopeBranch(e, t, n, r, i) {
|
|
1541
|
+
let a = zn(this.#r(e), this.#t(t), n, r, i);
|
|
1542
|
+
return this.#n(a), a;
|
|
1543
|
+
}
|
|
1544
|
+
initialize() {
|
|
1545
|
+
this.#i = Mn.root(this.#t(this.entry), { failureMode: "contain" }, this.zoneRoot, { capture: w }), this.#n(this.#i);
|
|
1546
|
+
}
|
|
1547
|
+
#e(e, t, n) {
|
|
1548
|
+
let r = this.#r(e.scopeRef), a = e.runner(), [o, s, c] = Ln(t);
|
|
1549
|
+
switch (o) {
|
|
1550
|
+
case "bind": return Rn(r, s.key, s.value), c($), q();
|
|
1551
|
+
case "branch": {
|
|
1552
|
+
let e = this.scopeBranch(r, s.entry, s.descriptor, r.zone, n), t = this.#r(e);
|
|
1553
|
+
return c({
|
|
1554
|
+
process: t.entryProcess,
|
|
1555
|
+
scope: t
|
|
1556
|
+
}), q();
|
|
1557
|
+
}
|
|
1558
|
+
case "cede": return c($), En();
|
|
1559
|
+
case "cancel": return Vn(r, n), J(i(U));
|
|
1560
|
+
case "defer": return Bn(a, (e) => {
|
|
1561
|
+
e(this.#t(s.cleanup));
|
|
1562
|
+
}), c($), q();
|
|
1563
|
+
case "future": {
|
|
1564
|
+
let e = Hn(r);
|
|
1565
|
+
return this.#n(e), c(e.handle()), q();
|
|
1566
|
+
}
|
|
1567
|
+
case "halt": return Un(r, e.keeper(), s.failure, n), J(i(a.stateAs("failed").failure));
|
|
1568
|
+
case "lookup": return c(Kn(r, s.key)), q();
|
|
1569
|
+
case "poll": return c(qn(this.#r(s.future))), q();
|
|
1570
|
+
case "self": return c(Jn(a)), q();
|
|
1571
|
+
case "settle": return Wn(this.#r(s.futureSettle), s.result, n), c($), q();
|
|
1572
|
+
case "spawn": return c(Gn(r, this.#t(s.worker), s.descriptor, n)), q();
|
|
1573
|
+
case "unbind": return Zn(r, s.key), c($), q();
|
|
1574
|
+
case "wait": {
|
|
1575
|
+
let t = this.#r(s.future), i = Yn(t);
|
|
1576
|
+
return y(i) ? (c(i.value), q()) : (Xn(r, e.keeper(), t, n), K());
|
|
1577
|
+
}
|
|
1578
|
+
case "receive": {
|
|
1579
|
+
let t = Qn(r, s.messageKey);
|
|
1580
|
+
return y(t) ? (c(t.value), q()) : ($n(r, e.keeper(), s.messageKey, n), K());
|
|
1581
|
+
}
|
|
1582
|
+
case "send": return er(r, this.#r(s.scope), s.messageKey, s.value, n), c($), q();
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
#t(e) {
|
|
1586
|
+
return (t, n) => {
|
|
1587
|
+
let r = kn.create(t, e, n);
|
|
1588
|
+
return this.#n(r), r.keeper();
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
#n(e) {}
|
|
1592
|
+
#r(e) {
|
|
1593
|
+
return e;
|
|
1594
|
+
}
|
|
1595
|
+
#i;
|
|
1596
|
+
};
|
|
1597
|
+
function Ln(e) {
|
|
1598
|
+
return [
|
|
1599
|
+
e.sigil.kind,
|
|
1600
|
+
e.sigil,
|
|
1601
|
+
e.accept
|
|
1602
|
+
];
|
|
1603
|
+
}
|
|
1604
|
+
function Rn(e, t, n) {
|
|
1605
|
+
e.bind(t, n);
|
|
1606
|
+
}
|
|
1607
|
+
function zn(e, t, n, r, i) {
|
|
1608
|
+
return e.branch(t, n, r, i);
|
|
1609
|
+
}
|
|
1610
|
+
function Bn(e, t) {
|
|
1611
|
+
e.defer(t);
|
|
1612
|
+
}
|
|
1613
|
+
function Vn(e, t) {
|
|
1614
|
+
e.cancel(t);
|
|
1615
|
+
}
|
|
1616
|
+
function Hn(e) {
|
|
1617
|
+
return e.createFuture();
|
|
1618
|
+
}
|
|
1619
|
+
function Un(e, t, n, r) {
|
|
1620
|
+
e.halt(t, n, r);
|
|
1621
|
+
}
|
|
1622
|
+
function Wn(e, t, n) {
|
|
1623
|
+
e.settle(t)(n);
|
|
1624
|
+
}
|
|
1625
|
+
function Gn(e, t, n, r) {
|
|
1626
|
+
return e.spawn(t, n, r);
|
|
1627
|
+
}
|
|
1628
|
+
function Kn(e, t) {
|
|
1629
|
+
return e.lookup(t);
|
|
1630
|
+
}
|
|
1631
|
+
function qn(e) {
|
|
1632
|
+
return e.poll();
|
|
1633
|
+
}
|
|
1634
|
+
function Jn(e) {
|
|
1635
|
+
return e.selfHandle();
|
|
1636
|
+
}
|
|
1637
|
+
function Yn(e) {
|
|
1638
|
+
return e.poll();
|
|
1639
|
+
}
|
|
1640
|
+
function Xn(e, t, n, r) {
|
|
1641
|
+
e.wait(t, n, r);
|
|
1642
|
+
}
|
|
1643
|
+
function Zn(e, t) {
|
|
1644
|
+
e.unbind(t);
|
|
1645
|
+
}
|
|
1646
|
+
function Qn(e, t) {
|
|
1647
|
+
return e.tryReceive(t);
|
|
1648
|
+
}
|
|
1649
|
+
function $n(e, t, n, r) {
|
|
1650
|
+
e.receive(t, n, r);
|
|
1651
|
+
}
|
|
1652
|
+
function er(e, t, n, r, i) {
|
|
1653
|
+
e.send(t, n, r, i);
|
|
1654
|
+
}
|
|
1655
|
+
function Q(e) {
|
|
1656
|
+
return {
|
|
1657
|
+
children: e.children,
|
|
1658
|
+
descriptor: e.descriptor,
|
|
1659
|
+
parent: e.parent,
|
|
1660
|
+
zone: e.zone
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
var $ = void 0;
|
|
1664
|
+
//#endregion
|
|
1665
|
+
//#region src/executor/autonomy.ts
|
|
1666
|
+
function tr(e) {
|
|
1667
|
+
return {
|
|
1668
|
+
autonomy: e,
|
|
1669
|
+
failureMode: "propagate"
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
function nr(e) {
|
|
1673
|
+
return rr(e) ? e.autonomy : null;
|
|
1674
|
+
}
|
|
1675
|
+
function rr(e) {
|
|
1676
|
+
return "autonomy" in e;
|
|
1677
|
+
}
|
|
1678
|
+
//#endregion
|
|
1679
|
+
//#region src/executor/domain-interpreter.ts
|
|
1680
|
+
var ir = class e extends In {
|
|
1681
|
+
static createByAutonomy(t, n) {
|
|
1682
|
+
let r = new e(t, n);
|
|
1683
|
+
return r.initialize(), r;
|
|
1684
|
+
}
|
|
1685
|
+
*startReaperTasks(e) {
|
|
1686
|
+
for (let t of wn.domains(this.#s)) if (t.hasClosingScope) for (let { scope: n, worker: r } of t.createWorkers((e) => this.scopeState(e))) {
|
|
1687
|
+
using i = new G("Out-of-band failures occurred while spawning a reaper adjudication process");
|
|
1688
|
+
let a = this.spawn(t.scopeRoot, r, i), o = i.drain();
|
|
1689
|
+
if (y(o)) {
|
|
1690
|
+
this.forceFailed(n, W(o.value), e);
|
|
1691
|
+
continue;
|
|
1692
|
+
}
|
|
1693
|
+
yield [n, a];
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
constructor(e, t) {
|
|
1697
|
+
let n = Tn.root(t.scheduler, (e) => this.#a(e)), r = wn.root(t.reaper);
|
|
1698
|
+
super(e, {
|
|
1699
|
+
reaperDomain: r,
|
|
1700
|
+
schedulerDomain: n,
|
|
1701
|
+
trackProcess: (e) => {
|
|
1702
|
+
n.admitProcess(e, this.processState(e));
|
|
1703
|
+
},
|
|
1704
|
+
trackScope: (e) => {
|
|
1705
|
+
r.trackScope(e, this.scopeState(e));
|
|
1706
|
+
}
|
|
1707
|
+
}), this.#s = r;
|
|
1708
|
+
}
|
|
1709
|
+
initialize() {
|
|
1710
|
+
super.initialize(), this.#s.setScopeRoot(this.scopeRoot);
|
|
1711
|
+
}
|
|
1712
|
+
scopeBranch(e, t, n, r, i) {
|
|
1713
|
+
let a = ar(r), o = nr(n), s = o ? this.#r(a, o) : or(a), c = s.zone, l = super.scopeBranch(e, t, n, c, i);
|
|
1714
|
+
return this.#i(l) ? (s.rollback(), l) : (this.#e(a.reaperDomain, c.reaperDomain, e, l), this.#n(a.schedulerDomain, c.schedulerDomain, l), l);
|
|
1715
|
+
}
|
|
1716
|
+
#e(e, t, n, r) {
|
|
1717
|
+
if (t === e) {
|
|
1718
|
+
this.#t(e, n, r);
|
|
1719
|
+
return;
|
|
1720
|
+
}
|
|
1721
|
+
t.setScopeRoot(r), this.wait(r.exitFuture, () => {
|
|
1722
|
+
t.close(), this.#o(e, n);
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
#t(e, t, n) {
|
|
1726
|
+
e.removeLeafScope(t), e.addLeafScope(n), this.wait(n.exitFuture, () => {
|
|
1727
|
+
e.removeLeafScope(n), this.#o(e, t);
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
#n(e, t, n) {
|
|
1731
|
+
t !== e && this.wait(n.exitFuture, () => {
|
|
1732
|
+
t.close();
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
#r(e, t) {
|
|
1736
|
+
let n = "scheduler" in t ? e.schedulerDomain.nest(t.scheduler, (e) => this.#a(e)) : e.schedulerDomain, r = "reaper" in t ? e.reaperDomain.nest(t.reaper) : e.reaperDomain, i = "scheduler" in t ? (e, t) => {
|
|
1737
|
+
try {
|
|
1738
|
+
n.admitProcess(e, this.processState(e));
|
|
1739
|
+
} catch (n) {
|
|
1740
|
+
this.forceFailed(this.scope(e), W(n), t);
|
|
1741
|
+
}
|
|
1742
|
+
} : e.trackProcess, a = "reaper" in t ? (e) => {
|
|
1743
|
+
r.trackScope(e, this.scopeState(e));
|
|
1744
|
+
} : e.trackScope;
|
|
1745
|
+
function o() {
|
|
1746
|
+
n !== e.schedulerDomain && n.close(), r !== e.reaperDomain && r.close();
|
|
1747
|
+
}
|
|
1748
|
+
return {
|
|
1749
|
+
rollback: o,
|
|
1750
|
+
zone: {
|
|
1751
|
+
reaperDomain: r,
|
|
1752
|
+
schedulerDomain: n,
|
|
1753
|
+
trackProcess: i,
|
|
1754
|
+
trackScope: a
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
#i(e) {
|
|
1759
|
+
return this.scopeState(e).status === "closed";
|
|
1760
|
+
}
|
|
1761
|
+
#a(e) {
|
|
1762
|
+
return { step: (t) => {
|
|
1763
|
+
switch (this.step(e, t).disposition) {
|
|
1764
|
+
case "waiting": return "waiting";
|
|
1765
|
+
case "exited": return "exited";
|
|
1766
|
+
case "ceded": return "cede";
|
|
1767
|
+
case "interpreted":
|
|
1768
|
+
case "resonated": return "ready";
|
|
1769
|
+
}
|
|
1770
|
+
} };
|
|
1771
|
+
}
|
|
1772
|
+
#o(e, t) {
|
|
1773
|
+
let n = this.scopeState(t);
|
|
1774
|
+
n.status === "closed" || Fe(n.children) || e.addLeafScope(t);
|
|
1775
|
+
}
|
|
1776
|
+
#s;
|
|
1777
|
+
};
|
|
1778
|
+
function ar(e) {
|
|
1779
|
+
return e;
|
|
1780
|
+
}
|
|
1781
|
+
function or(e) {
|
|
1782
|
+
return {
|
|
1783
|
+
rollback: () => {},
|
|
1784
|
+
zone: e
|
|
1785
|
+
};
|
|
1786
|
+
}
|
|
1787
|
+
//#endregion
|
|
1788
|
+
//#region src/executor/executor-driver.ts
|
|
1789
|
+
var sr = class {
|
|
1790
|
+
stop() {
|
|
1791
|
+
this.#i = !0;
|
|
1792
|
+
}
|
|
1793
|
+
driveSyncUnsafely(e) {
|
|
1794
|
+
for (;;) {
|
|
1795
|
+
let t = this.stepProcess(e);
|
|
1796
|
+
switch (t.disposition) {
|
|
1797
|
+
case "interpreted":
|
|
1798
|
+
case "resonated": continue;
|
|
1799
|
+
case "ceded":
|
|
1800
|
+
case "waiting":
|
|
1801
|
+
case "exited": return t;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
constructor(e, t) {
|
|
1806
|
+
this.pacer = e, this.stepProcess = t;
|
|
1807
|
+
}
|
|
1808
|
+
get processor() {
|
|
1809
|
+
return this.#s;
|
|
1810
|
+
}
|
|
1811
|
+
#e() {
|
|
1812
|
+
this.#i || this.#a || !this.#r || (this.#a = !0, this.pacer.continueLater(() => {
|
|
1813
|
+
if (this.#i) {
|
|
1814
|
+
this.#a = !1;
|
|
1815
|
+
return;
|
|
1816
|
+
}
|
|
1817
|
+
try {
|
|
1818
|
+
this.#t();
|
|
1819
|
+
} finally {
|
|
1820
|
+
this.#a = !1, this.#e();
|
|
1821
|
+
}
|
|
1822
|
+
}));
|
|
1823
|
+
}
|
|
1824
|
+
#t() {
|
|
1825
|
+
let e = this.pacer.beginSlice();
|
|
1826
|
+
for (; this.#r && !e.shouldYield();) this.#n();
|
|
1827
|
+
}
|
|
1828
|
+
#n() {
|
|
1829
|
+
let [e] = this.#o;
|
|
1830
|
+
for (;;) {
|
|
1831
|
+
using t = new G("Out-of-band failures occurred while processing executor work");
|
|
1832
|
+
switch (e.step(t)) {
|
|
1833
|
+
case "ready": continue;
|
|
1834
|
+
case "cede":
|
|
1835
|
+
this.#o.shift(), this.#o.push(e);
|
|
1836
|
+
return;
|
|
1837
|
+
case "waiting":
|
|
1838
|
+
case "exited":
|
|
1839
|
+
this.#o.shift();
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
get #r() {
|
|
1845
|
+
return Fe(this.#o);
|
|
1846
|
+
}
|
|
1847
|
+
#i = !1;
|
|
1848
|
+
#a = !1;
|
|
1849
|
+
#o = [];
|
|
1850
|
+
#s = { admit: (e) => {
|
|
1851
|
+
this.#o.push(e), this.#e();
|
|
1852
|
+
} };
|
|
1853
|
+
}, cr = class {
|
|
1854
|
+
constructor(e) {
|
|
1855
|
+
this.roundLimit = e;
|
|
1856
|
+
}
|
|
1857
|
+
adjudicate(e) {
|
|
1858
|
+
let t = this.#t.getOrInsertComputed(e, () => ({ round: 0 })), { round: n } = t;
|
|
1859
|
+
return t.round += 1, n >= this.roundLimit ? V.of(b(this.#e(n))) : V.of(T);
|
|
1860
|
+
}
|
|
1861
|
+
#e(e) {
|
|
1862
|
+
return xn({
|
|
1863
|
+
round: e,
|
|
1864
|
+
roundLimit: this.roundLimit
|
|
1865
|
+
}, "Scope did not finish closing within the executor reaper round limit");
|
|
1866
|
+
}
|
|
1867
|
+
#t = /* @__PURE__ */ new WeakMap();
|
|
1868
|
+
}, lr = class {
|
|
1869
|
+
onSettled(e) {
|
|
1870
|
+
return this.lifecycle.onSettled(this.executionScope, e);
|
|
1871
|
+
}
|
|
1872
|
+
constructor(e, t) {
|
|
1873
|
+
this.executionScope = e, this.lifecycle = t;
|
|
1874
|
+
}
|
|
1875
|
+
get scope() {
|
|
1876
|
+
return this.executionScope;
|
|
1877
|
+
}
|
|
1878
|
+
get status() {
|
|
1879
|
+
return this.lifecycle.status(this.executionScope);
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
//#endregion
|
|
1883
|
+
//#region src/executor/executor.ts
|
|
1884
|
+
function ur(e) {
|
|
1885
|
+
return new dr(e);
|
|
1886
|
+
}
|
|
1887
|
+
var dr = class {
|
|
1888
|
+
constructor(e) {
|
|
1889
|
+
this.#s = new sr(e(() => {
|
|
1890
|
+
this.#e();
|
|
1891
|
+
}), (e) => this.#c.step(e, { capture: w })), this.#c = ir.createByAutonomy(rn, {
|
|
1892
|
+
reaper: new cr(mr),
|
|
1893
|
+
scheduler: { assign: () => this.#s.processor }
|
|
1894
|
+
}), this.#l = this.#a(this.#c.scopeRoot), this.#c.wait(this.#l.exitFuture, () => {
|
|
1895
|
+
this.#s.stop();
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
launch(e, t) {
|
|
1899
|
+
if (!this.#t(e)) return T;
|
|
1900
|
+
using n = new G("Out-of-band failures occurred while spawning a launched scope");
|
|
1901
|
+
let r = this.#c.spawn(e, fr(t), n), i = n.drain();
|
|
1902
|
+
if (y(i)) return this.#n(e, i.value), T;
|
|
1903
|
+
let a = this.#s.driveSyncUnsafely(r).result.right;
|
|
1904
|
+
return b(new lr(this.#a(a), {
|
|
1905
|
+
onSettled: (e, t) => this.#r(e, t),
|
|
1906
|
+
status: (e) => this.#i(e)
|
|
1907
|
+
}));
|
|
1908
|
+
}
|
|
1909
|
+
settle(e, t) {
|
|
1910
|
+
return y(this.#c.poll(e)) ? !1 : (this.#c.spawn(this.scope, () => yn(e, t), { capture: w }), !0);
|
|
1911
|
+
}
|
|
1912
|
+
cancel(e) {
|
|
1913
|
+
if (!this.#t(e)) return !1;
|
|
1914
|
+
using t = new G("Out-of-band failures occurred while spawning a cancellation process");
|
|
1915
|
+
this.#c.spawn(e, Yt, t);
|
|
1916
|
+
let n = t.drain();
|
|
1917
|
+
return y(n) ? (this.#n(e, n.value), !1) : !0;
|
|
1918
|
+
}
|
|
1919
|
+
onSettled(e) {
|
|
1920
|
+
return this.#r(this.#l, e);
|
|
1921
|
+
}
|
|
1922
|
+
get scope() {
|
|
1923
|
+
return this.#l;
|
|
1924
|
+
}
|
|
1925
|
+
get status() {
|
|
1926
|
+
return this.#i(this.#l);
|
|
1927
|
+
}
|
|
1928
|
+
#e() {
|
|
1929
|
+
using e = new G("Out-of-band failures occurred while starting a reaper round");
|
|
1930
|
+
for (let [t, r] of this.#c.startReaperTasks(e)) this.#c.wait(r.exitFuture, (e, r) => {
|
|
1931
|
+
this.#c.scopeState(t).status !== "closed" && g(e, me(C(() => S(yt), (e) => i(e))), n((e) => () => {
|
|
1932
|
+
this.#c.spawn(t, () => en(e), r);
|
|
1933
|
+
}), (e) => e());
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
#t(e) {
|
|
1937
|
+
return this.#o(e) && this.#c.scopeState(e).status === "open";
|
|
1938
|
+
}
|
|
1939
|
+
#n(e, t) {
|
|
1940
|
+
using n = new G("Out-of-band failures occurred while force failing a scope");
|
|
1941
|
+
this.#c.forceFailed(e, W(t), n);
|
|
1942
|
+
}
|
|
1943
|
+
#r(e, t) {
|
|
1944
|
+
let n = this.#c.poll(e.exitFuture);
|
|
1945
|
+
return y(n) ? (t(pr(n.value)), x) : this.#c.wait(e.exitFuture, (e, n) => {
|
|
1946
|
+
try {
|
|
1947
|
+
t(pr(e));
|
|
1948
|
+
} catch (e) {
|
|
1949
|
+
n.capture(e);
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
#i(e) {
|
|
1954
|
+
return this.#c.scopeState(e).status;
|
|
1955
|
+
}
|
|
1956
|
+
#a(e) {
|
|
1957
|
+
return this.#u.add(e), e;
|
|
1958
|
+
}
|
|
1959
|
+
#o(e) {
|
|
1960
|
+
return this.#u.has(e);
|
|
1961
|
+
}
|
|
1962
|
+
#s;
|
|
1963
|
+
#c;
|
|
1964
|
+
#l;
|
|
1965
|
+
#u = /* @__PURE__ */ new WeakSet();
|
|
1966
|
+
};
|
|
1967
|
+
function fr(e) {
|
|
1968
|
+
return () => g(D(e, { failureMode: "contain" }), V.liftF, V.map(({ scope: e }) => e));
|
|
1969
|
+
}
|
|
1970
|
+
function pr(e) {
|
|
1971
|
+
return E(e) ? e.left === U ? { kind: "canceled" } : {
|
|
1972
|
+
failure: e.left,
|
|
1973
|
+
kind: "failure"
|
|
1974
|
+
} : {
|
|
1975
|
+
kind: "success",
|
|
1976
|
+
result: e.right
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
var mr = 2;
|
|
1980
|
+
//#endregion
|
|
1981
|
+
//#region src/executor/primitives/autonomy.ts
|
|
1982
|
+
function hr(e, t) {
|
|
1983
|
+
return g(D(e, tr(t)), V.liftF, V.map(({ scope: e }) => e.exitFuture));
|
|
1984
|
+
}
|
|
1985
|
+
//#endregion
|
|
1986
|
+
export { Gt as all, hr as autonomy, Jt as bind, Yt as cancel, U as canceledFailure, Xt as cede, ke as contextKey, ur as createExecutor, Zt as defer, _n as enclose, De as evoke, xn as externalFailure, $t as future, pn as guard, en as halt, W as interruptedFailure, tn as lookup, Oe as messageKey, rn as park, nn as poll, on as race, ln as resource, N as restingWisp, dn as resumable, Sn as scopeFailure, vn as self, yn as settle, Qt as spawn, M as stirringWisp, bn as unbind, qt as wait };
|