@sensigo/realm 0.31.1 → 0.32.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/dist/engine/apply-resume.d.ts +34 -0
- package/dist/engine/apply-resume.d.ts.map +1 -0
- package/dist/engine/apply-resume.js +69 -0
- package/dist/engine/apply-resume.js.map +1 -0
- package/dist/engine/comparison-expr.d.ts.map +1 -1
- package/dist/engine/comparison-expr.js.map +1 -1
- package/dist/engine/defaulted-steps.d.ts +17 -0
- package/dist/engine/defaulted-steps.d.ts.map +1 -0
- package/dist/engine/defaulted-steps.js +26 -0
- package/dist/engine/defaulted-steps.js.map +1 -0
- package/dist/engine/execution-loop.d.ts +32 -0
- package/dist/engine/execution-loop.d.ts.map +1 -1
- package/dist/engine/execution-loop.js +704 -39
- package/dist/engine/execution-loop.js.map +1 -1
- package/dist/engine/lifecycle.d.ts +14 -0
- package/dist/engine/lifecycle.d.ts.map +1 -1
- package/dist/engine/lifecycle.js +14 -0
- package/dist/engine/lifecycle.js.map +1 -1
- package/dist/engine/run-health.d.ts +1 -1
- package/dist/engine/run-health.d.ts.map +1 -1
- package/dist/engine/run-health.js +26 -3
- package/dist/engine/run-health.js.map +1 -1
- package/dist/engine/settlement.d.ts +27 -0
- package/dist/engine/settlement.d.ts.map +1 -0
- package/dist/engine/settlement.js +414 -0
- package/dist/engine/settlement.js.map +1 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/store/json-file-store.d.ts +54 -3
- package/dist/store/json-file-store.d.ts.map +1 -1
- package/dist/store/json-file-store.js +156 -17
- package/dist/store/json-file-store.js.map +1 -1
- package/dist/store/store-interface.d.ts +47 -1
- package/dist/store/store-interface.d.ts.map +1 -1
- package/dist/types/run-record.d.ts +67 -0
- package/dist/types/run-record.d.ts.map +1 -1
- package/dist/types/settlement.d.ts +124 -0
- package/dist/types/settlement.d.ts.map +1 -0
- package/dist/types/settlement.js +2 -0
- package/dist/types/settlement.js.map +1 -0
- package/dist/types/workflow-definition.d.ts.map +1 -1
- package/dist/types/workflow-definition.js.map +1 -1
- package/dist/types/workflow-error.d.ts +1 -1
- package/dist/types/workflow-error.d.ts.map +1 -1
- package/dist/types/workflow-error.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RunRecord } from '../types/run-record.js';
|
|
2
|
+
import type { WorkflowDefinition } from '../types/workflow-definition.js';
|
|
3
|
+
/** One finalizer voided by a resume, with its lease-discriminated disclosure message (design
|
|
4
|
+
* record §5: "never executed, superseded by resume" vs "may have executed without a recorded
|
|
5
|
+
* mark — may re-execute at the next terminal edge"). */
|
|
6
|
+
export interface ApplyResumeVoidedFinalizer {
|
|
7
|
+
name: string;
|
|
8
|
+
disclosure: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ApplyResumeResult {
|
|
11
|
+
/** The fully-mutated record — pass directly to `store.update()` for the atomic write. */
|
|
12
|
+
run: RunRecord;
|
|
13
|
+
/** Every pending finalizer ledger entry this resume voided, in `Object.entries` order. Empty
|
|
14
|
+
* when the run carried no pending finalizers (the common case). */
|
|
15
|
+
voided: ApplyResumeVoidedFinalizer[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resumes `stepName` (design record §5) — filters it out of `failed_steps`, wipes and re-derives
|
|
19
|
+
* `skipped_steps`/`skip_details` from scratch (NOTE — final-gate F9 cross-reference: this
|
|
20
|
+
* wipe+re-derive relies on the premise that handler/guard-abort runs are never resumable; the
|
|
21
|
+
* CLI's own `aborted_at` refusal, run BEFORE this function, is what makes that premise
|
|
22
|
+
* STRUCTURALLY true rather than merely conventional), resets `terminal_state:false`, strips
|
|
23
|
+
* `terminal_reason` AND `abandoned_at` (issue #281 — the load-bearing fix for the `aborted_at`
|
|
24
|
+
* mask: leaving a stale `abandoned_at` on a resumed-and-re-terminalized run would let a future
|
|
25
|
+
* PR-A-vintage `isTerminal` reader mis-read it as abandoned again), projects `settled` down to
|
|
26
|
+
* still-live membership (L17: `settled′ = {s ∈ settled | s ∈ completed′∪failed′∪skipped′}`), VOIDS
|
|
27
|
+
* every pending finalizer ledger entry (leases dropped, each disclosed), and releases every
|
|
28
|
+
* remaining claim unconditionally.
|
|
29
|
+
*
|
|
30
|
+
* Pure — no I/O, no `Date.now()`/randomness. Returns the mutated record; the caller performs the
|
|
31
|
+
* single atomic `store.update()`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function applyResume(snapshot: RunRecord, stepName: string, definition: WorkflowDefinition): ApplyResumeResult;
|
|
34
|
+
//# sourceMappingURL=apply-resume.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-resume.d.ts","sourceRoot":"","sources":["../../src/engine/apply-resume.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAG1E;;yDAEyD;AACzD,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,yFAAyF;IACzF,GAAG,EAAE,SAAS,CAAC;IACf;wEACoE;IACpE,MAAM,EAAE,0BAA0B,EAAE,CAAC;CACtC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,kBAAkB,GAC7B,iBAAiB,CA0DnB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { propagateSkips } from './eligibility.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resumes `stepName` (design record §5) — filters it out of `failed_steps`, wipes and re-derives
|
|
4
|
+
* `skipped_steps`/`skip_details` from scratch (NOTE — final-gate F9 cross-reference: this
|
|
5
|
+
* wipe+re-derive relies on the premise that handler/guard-abort runs are never resumable; the
|
|
6
|
+
* CLI's own `aborted_at` refusal, run BEFORE this function, is what makes that premise
|
|
7
|
+
* STRUCTURALLY true rather than merely conventional), resets `terminal_state:false`, strips
|
|
8
|
+
* `terminal_reason` AND `abandoned_at` (issue #281 — the load-bearing fix for the `aborted_at`
|
|
9
|
+
* mask: leaving a stale `abandoned_at` on a resumed-and-re-terminalized run would let a future
|
|
10
|
+
* PR-A-vintage `isTerminal` reader mis-read it as abandoned again), projects `settled` down to
|
|
11
|
+
* still-live membership (L17: `settled′ = {s ∈ settled | s ∈ completed′∪failed′∪skipped′}`), VOIDS
|
|
12
|
+
* every pending finalizer ledger entry (leases dropped, each disclosed), and releases every
|
|
13
|
+
* remaining claim unconditionally.
|
|
14
|
+
*
|
|
15
|
+
* Pure — no I/O, no `Date.now()`/randomness. Returns the mutated record; the caller performs the
|
|
16
|
+
* single atomic `store.update()`.
|
|
17
|
+
*/
|
|
18
|
+
export function applyResume(snapshot, stepName, definition) {
|
|
19
|
+
const failedSteps = snapshot.failed_steps.filter((s) => s !== stepName);
|
|
20
|
+
const { skipped: skippedSteps, details: skipDetails } = propagateSkips({
|
|
21
|
+
...snapshot,
|
|
22
|
+
failed_steps: failedSteps,
|
|
23
|
+
skipped_steps: [],
|
|
24
|
+
skip_details: {},
|
|
25
|
+
}, definition);
|
|
26
|
+
// settled L17 PROJECTION.
|
|
27
|
+
const liveMembership = new Set([...snapshot.completed_steps, ...failedSteps, ...skippedSteps]);
|
|
28
|
+
const settled = snapshot.settled !== undefined
|
|
29
|
+
? Object.fromEntries(Object.entries(snapshot.settled).filter(([s]) => liveMembership.has(s)))
|
|
30
|
+
: undefined;
|
|
31
|
+
// VOID every pending finalizer ledger entry, loudly, with lease discrimination.
|
|
32
|
+
const voided = [];
|
|
33
|
+
let finalizerLedger = snapshot.finalizer_ledger;
|
|
34
|
+
if (finalizerLedger !== undefined) {
|
|
35
|
+
const nextLedger = {};
|
|
36
|
+
for (const [name, entry] of Object.entries(finalizerLedger)) {
|
|
37
|
+
if (entry.status !== 'pending') {
|
|
38
|
+
nextLedger[name] = entry;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const neverLeased = entry.lease_token === undefined;
|
|
42
|
+
nextLedger[name] = { status: 'voided', rank: entry.rank };
|
|
43
|
+
voided.push({
|
|
44
|
+
name,
|
|
45
|
+
disclosure: neverLeased
|
|
46
|
+
? `finalizer '${name}' voided by resume — never executed, superseded by resume`
|
|
47
|
+
: `finalizer '${name}' voided by resume — may have executed without a recorded mark; ` +
|
|
48
|
+
`may re-execute at the next terminal edge`,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
finalizerLedger = nextLedger;
|
|
52
|
+
}
|
|
53
|
+
// Strip terminal_reason + abandoned_at (issue #281); release ALL remaining claims
|
|
54
|
+
// unconditionally (the CLI refusals guarantee none are healthy by the time this runs).
|
|
55
|
+
const { terminal_reason: _tr, abandoned_at: _aa, ...rest } = snapshot;
|
|
56
|
+
const run = {
|
|
57
|
+
...rest,
|
|
58
|
+
failed_steps: failedSteps,
|
|
59
|
+
skipped_steps: skippedSteps,
|
|
60
|
+
skip_details: skipDetails,
|
|
61
|
+
terminal_state: false,
|
|
62
|
+
in_progress_steps: [],
|
|
63
|
+
claims: {},
|
|
64
|
+
...(settled !== undefined ? { settled } : {}),
|
|
65
|
+
...(finalizerLedger !== undefined ? { finalizer_ledger: finalizerLedger } : {}),
|
|
66
|
+
};
|
|
67
|
+
return { run, voided };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=apply-resume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-resume.js","sourceRoot":"","sources":["../../src/engine/apply-resume.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBlD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CACzB,QAAmB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MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"comparison-expr.d.ts","sourceRoot":"","sources":["../../src/engine/comparison-expr.ts"],"names":[],"mappings":"AAWA,4FAA4F;AAC5F,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAEjE,MAAM,MAAM,uBAAuB,GACjC,OAAO,GAAG,cAAc,GAAG,aAAa,GAAG,oBAAoB,CAAC;AAElE,oGAAoG;AACpG,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,uBAAuB,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAyBnF;AAiED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAiC9D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comparison-expr.js","sourceRoot":"","sources":["../../src/engine/comparison-expr.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,EAAE;AACF,8FAA8F;AAC9F,mEAAmE;AACnE,oGAAoG;AACpG,qGAAqG;AACrG,wGAAwG;AACxG,EAAE;AACF,qGAAqG;AACrG,iDAAiD;
|
|
1
|
+
{"version":3,"file":"comparison-expr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_by_default === true` and returns their
|
|
4
|
+
* distinct `step_id`s, deduped in first-occurrence (declaration) order — identical to
|
|
5
|
+
* `stampDefaultedSteps`'s own loop, now shared. Pure, no I/O, and safe to call on ANY evidence
|
|
6
|
+
* array regardless of the run's terminal state or how it sealed (complete/failed/aborted/still
|
|
7
|
+
* running) — the derivation itself carries no seal-outcome assumption; callers decide what to do
|
|
8
|
+
* with an empty result (e.g. `stampDefaultedSteps` still applies it ONLY at the `'complete'` seal;
|
|
9
|
+
* the read surfaces call it unconditionally and simply omit the field when empty).
|
|
10
|
+
*
|
|
11
|
+
* `gate_response` evidence snapshots carry no `diagnostics.settled_by_default` (that diagnostic is
|
|
12
|
+
* only ever stamped on the ONE synthesized SUCCESS execution snapshot a declared default-settle
|
|
13
|
+
* mints — see `StepDiagnostics.settled_by_default`'s own doc) — no special-casing needed here
|
|
14
|
+
* beyond reusing the same `=== true` predicate every other consumer of this diagnostic uses.
|
|
15
|
+
*/
|
|
16
|
+
export declare function deriveDefaultedSteps(evidence: RunRecord['evidence']): string[];
|
|
17
|
+
//# sourceMappingURL=defaulted-steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaulted-steps.d.ts","sourceRoot":"","sources":["../../src/engine/defaulted-steps.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,MAAM,EAAE,CAU9E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scans `evidence` for entries stamped `diagnostics.settled_by_default === true` and returns their
|
|
3
|
+
* distinct `step_id`s, deduped in first-occurrence (declaration) order — identical to
|
|
4
|
+
* `stampDefaultedSteps`'s own loop, now shared. Pure, no I/O, and safe to call on ANY evidence
|
|
5
|
+
* array regardless of the run's terminal state or how it sealed (complete/failed/aborted/still
|
|
6
|
+
* running) — the derivation itself carries no seal-outcome assumption; callers decide what to do
|
|
7
|
+
* with an empty result (e.g. `stampDefaultedSteps` still applies it ONLY at the `'complete'` seal;
|
|
8
|
+
* the read surfaces call it unconditionally and simply omit the field when empty).
|
|
9
|
+
*
|
|
10
|
+
* `gate_response` evidence snapshots carry no `diagnostics.settled_by_default` (that diagnostic is
|
|
11
|
+
* only ever stamped on the ONE synthesized SUCCESS execution snapshot a declared default-settle
|
|
12
|
+
* mints — see `StepDiagnostics.settled_by_default`'s own doc) — no special-casing needed here
|
|
13
|
+
* beyond reusing the same `=== true` predicate every other consumer of this diagnostic uses.
|
|
14
|
+
*/
|
|
15
|
+
export function deriveDefaultedSteps(evidence) {
|
|
16
|
+
const steps = [];
|
|
17
|
+
const seen = new Set();
|
|
18
|
+
for (const snap of evidence) {
|
|
19
|
+
if (snap.diagnostics?.settled_by_default === true && !seen.has(snap.step_id)) {
|
|
20
|
+
seen.add(snap.step_id);
|
|
21
|
+
steps.push(snap.step_id);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return steps;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=defaulted-steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaulted-steps.js","sourceRoot":"","sources":["../../src/engine/defaulted-steps.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA+B;IAClE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,WAAW,EAAE,kBAAkB,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7E,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -118,6 +118,38 @@ export declare function executeStep(store: RunStore, definition: WorkflowDefinit
|
|
|
118
118
|
* Validates the gate_id and choice, then moves the step to completed_steps.
|
|
119
119
|
*/
|
|
120
120
|
export declare function submitHumanResponse(store: RunStore, definition: WorkflowDefinition, options: SubmitGateOptions): Promise<ResponseEnvelope>;
|
|
121
|
+
/**
|
|
122
|
+
* Post-commit finalizer drain (design record §6, D2, issue #279 increment 1 PR-B). Drains the
|
|
123
|
+
* LOWEST-ranked pending finalizer, re-reading the record returned by the LAST settle/lease/mark at
|
|
124
|
+
* every step — NEVER a pass-start snapshot (the DRAIN_REREADS_LEDGER pin: a snapshot taken once at
|
|
125
|
+
* the top of this function would go stale the instant the first lease/mark commits, silently
|
|
126
|
+
* reintroducing exactly the kind of pre-commit assumption #279 exists to eliminate).
|
|
127
|
+
*
|
|
128
|
+
* Lives here (not in settlement.ts) so the module-private `withTimeout`/`callHandler` — already
|
|
129
|
+
* proven by `buildFinalizedSeal` above — are reused without exporting them; `settlement.ts` stays
|
|
130
|
+
* pure/no-I/O (design record §7 CS-purity).
|
|
131
|
+
*
|
|
132
|
+
* Registry pre-check: an absent handler leaves the entry pending and discloses why, rather than
|
|
133
|
+
* burning it (leasing it, failing the call, and marking it 'failed' would destroy the "recoverable
|
|
134
|
+
* on a capable runner" property a still-pending entry carries). Rank-monotonic: a pass HALTS at the
|
|
135
|
+
* first entry it cannot lease/execute, so a lower-ranked absent-handler or held-lease entry
|
|
136
|
+
* withholds every higher-ranked (later) finalizer behind it (R11) — this is deliberate: rank order
|
|
137
|
+
* is a DELIVERY order guarantee, not just a preference.
|
|
138
|
+
*
|
|
139
|
+
* `not_eligible` at lease OR mark time is a contract violation (an unknown finalizer id — mintFresh
|
|
140
|
+
* only ever mints real workflow finalizer names) and aborts the pass LOUD (throws), distinct from
|
|
141
|
+
* `ledger_not_pending` at lease time, which ADVANCES (someone else already resolved it). A
|
|
142
|
+
* non-BUSY infra throw from `mark_finalizer` also aborts loud, with the remaining-pending list in
|
|
143
|
+
* the message. The executed-but-not-recorded warning (three reasons: `lease_lost`,
|
|
144
|
+
* `ledger_not_pending`-AFTER-execution, `run_not_terminal`) halts the pass rather than continuing —
|
|
145
|
+
* each of those three reasons refuses the mark WITHOUT mutating the ledger entry's `'pending'`
|
|
146
|
+
* status, so continuing would re-select the SAME entry next iteration (an infinite loop); halting
|
|
147
|
+
* is the only forward-progress-safe response until an operator or a later terminal edge resolves it.
|
|
148
|
+
*/
|
|
149
|
+
export declare function drainFinalizers(store: RunStore, definition: WorkflowDefinition, registry: ExtensionRegistry | undefined, runId: string): Promise<{
|
|
150
|
+
run: RunRecord;
|
|
151
|
+
warnings: string[];
|
|
152
|
+
}>;
|
|
121
153
|
/**
|
|
122
154
|
* Executes a step and automatically chains into subsequent `execution: auto` steps.
|
|
123
155
|
* Stops at agent steps, gate steps (returning confirm_required), errors, or terminal state.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-loop.d.ts","sourceRoot":"","sources":["../../src/engine/execution-loop.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EAIT,eAAe,EAEhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EACV,kBAAkB,
|
|
1
|
+
{"version":3,"file":"execution-loop.d.ts","sourceRoot":"","sources":["../../src/engine/execution-loop.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EAIT,eAAe,EAEhB,MAAM,wBAAwB,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