@invinite-org/chartlang-runtime 1.0.2 → 1.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/CHANGELOG.md +92 -0
- package/README.md +9 -0
- package/dist/createScriptRunner.d.ts +55 -4
- package/dist/createScriptRunner.d.ts.map +1 -1
- package/dist/createScriptRunner.js +103 -35
- package/dist/createScriptRunner.js.map +1 -1
- package/dist/dep/DepOutputStore.d.ts +92 -0
- package/dist/dep/DepOutputStore.d.ts.map +1 -0
- package/dist/dep/DepOutputStore.js +0 -0
- package/dist/dep/DepOutputStore.js.map +1 -0
- package/dist/dep/DepRunner.d.ts +146 -0
- package/dist/dep/DepRunner.d.ts.map +1 -0
- package/dist/dep/DepRunner.js +243 -0
- package/dist/dep/DepRunner.js.map +1 -0
- package/dist/dep/depOutput.d.ts +50 -0
- package/dist/dep/depOutput.d.ts.map +1 -0
- package/dist/dep/depOutput.js +92 -0
- package/dist/dep/depOutput.js.map +1 -0
- package/dist/dep/emissionFilter.d.ts +70 -0
- package/dist/dep/emissionFilter.d.ts.map +1 -0
- package/dist/dep/emissionFilter.js +105 -0
- package/dist/dep/emissionFilter.js.map +1 -0
- package/dist/dep/index.d.ts +8 -0
- package/dist/dep/index.d.ts.map +1 -0
- package/dist/dep/index.js +7 -0
- package/dist/dep/index.js.map +1 -0
- package/dist/emit/applyPlotOverride.d.ts +24 -0
- package/dist/emit/applyPlotOverride.d.ts.map +1 -0
- package/dist/emit/applyPlotOverride.js +48 -0
- package/dist/emit/applyPlotOverride.js.map +1 -0
- package/dist/emit/hline.d.ts +6 -4
- package/dist/emit/hline.d.ts.map +1 -1
- package/dist/emit/hline.js +5 -2
- package/dist/emit/hline.js.map +1 -1
- package/dist/emit/index.d.ts +2 -1
- package/dist/emit/index.d.ts.map +1 -1
- package/dist/emit/index.js +2 -1
- package/dist/emit/index.js.map +1 -1
- package/dist/emit/paneResolver.d.ts +52 -11
- package/dist/emit/paneResolver.d.ts.map +1 -1
- package/dist/emit/paneResolver.js +69 -26
- package/dist/emit/paneResolver.js.map +1 -1
- package/dist/emit/plot.d.ts.map +1 -1
- package/dist/emit/plot.js +2 -1
- package/dist/emit/plot.js.map +1 -1
- package/dist/execution/dispose.d.ts.map +1 -1
- package/dist/execution/dispose.js +7 -0
- package/dist/execution/dispose.js.map +1 -1
- package/dist/execution/onBarClose.d.ts +9 -13
- package/dist/execution/onBarClose.d.ts.map +1 -1
- package/dist/execution/onBarClose.js +28 -59
- package/dist/execution/onBarClose.js.map +1 -1
- package/dist/execution/onBarTick.d.ts +4 -10
- package/dist/execution/onBarTick.d.ts.map +1 -1
- package/dist/execution/onBarTick.js +24 -57
- package/dist/execution/onBarTick.js.map +1 -1
- package/dist/execution/runComputeStep.d.ts +68 -0
- package/dist/execution/runComputeStep.d.ts.map +1 -0
- package/dist/execution/runComputeStep.js +96 -0
- package/dist/execution/runComputeStep.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +12 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +14 -0
- package/dist/internal.js.map +1 -0
- package/dist/persistentStateStore.runtime.d.ts +18 -4
- package/dist/persistentStateStore.runtime.d.ts.map +1 -1
- package/dist/persistentStateStore.runtime.js +111 -18
- package/dist/persistentStateStore.runtime.js.map +1 -1
- package/dist/persistentStateStore.validate.d.ts +11 -1
- package/dist/persistentStateStore.validate.d.ts.map +1 -1
- package/dist/persistentStateStore.validate.js +32 -3
- package/dist/persistentStateStore.validate.js.map +1 -1
- package/dist/runtimeContext.d.ts +62 -4
- package/dist/runtimeContext.d.ts.map +1 -1
- package/dist/runtimeContext.js.map +1 -1
- package/dist/state/stateNamespace.d.ts.map +1 -1
- package/dist/state/stateNamespace.js +13 -2
- package/dist/state/stateNamespace.js.map +1 -1
- package/dist/stateStore.d.ts +6 -3
- package/dist/stateStore.d.ts.map +1 -1
- package/dist/stateStore.js.map +1 -1
- package/package.json +7 -3
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import type { Bar } from "@invinite-org/chartlang-core";
|
|
2
2
|
import type { RunnerState } from "../createScriptRunner.js";
|
|
3
|
-
import {
|
|
3
|
+
import type { EventKind } from "../views/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* §6.7 main step. Appends every OHLCV ring buffer, mutates the runner's
|
|
6
|
-
* shared `BarView` in place,
|
|
7
|
-
* runs the
|
|
8
|
-
*
|
|
6
|
+
* shared `BarView` in place, walks the bundle's dep + sibling sub-runners
|
|
7
|
+
* (no-op for single-script callers), then runs the primary's `compute`.
|
|
8
|
+
* If any dep halted this bar, the primary's plot / drawing / alert / log
|
|
9
|
+
* queues are dropped (diagnostics stay).
|
|
9
10
|
*
|
|
10
|
-
* The
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
* values either way.
|
|
11
|
+
* The four §6.7 invariants hold at the end of the primary's compute.
|
|
12
|
+
* `barIndex` advances exactly once per close. Errors thrown by `compute`
|
|
13
|
+
* propagate out of `onBarClose`; the host (Task 9) owns containment.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* `compute` propagate out of `onBarClose`; the host (Task 9) owns
|
|
17
|
-
* containment.
|
|
18
|
-
*
|
|
19
|
-
* @since 0.1
|
|
15
|
+
* @since 0.1 — extended to walk dep + sibling sub-runners in 0.7.
|
|
20
16
|
* @example
|
|
21
17
|
* // import { onBarClose } from "@invinite-org/chartlang-runtime";
|
|
22
18
|
* // await onBarClose(state, rawBar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onBarClose.d.ts","sourceRoot":"","sources":["../../src/execution/onBarClose.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"onBarClose.d.ts","sourceRoot":"","sources":["../../src/execution/onBarClose.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,UAAU,CAC5B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,GAAG,EACX,SAAS,GAAE,SAAmB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAsBf"}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
2
|
// See the LICENSE file in the repo root for full license text.
|
|
3
|
-
import {
|
|
4
|
-
import { isRuntimeErrorHalt, pushDiagnostic } from "../emit/index.js";
|
|
5
|
-
import { resetSubIdCounters } from "../emit/draw/index.js";
|
|
6
|
-
import { ACTIVE_RUNTIME_CONTEXT } from "../runtimeContext.js";
|
|
7
|
-
import { commitStateSlots, flushStateSlots } from "../state/index.js";
|
|
3
|
+
import { runDepStep, runSiblingStep } from "../dep/index.js";
|
|
8
4
|
import { appendBarToStream, updateFallbackViewport } from "../streamState.js";
|
|
9
|
-
import {
|
|
5
|
+
import { resetBarEmissions, runComputeBody } from "./runComputeStep.js";
|
|
6
|
+
function clearVisualEmissions(state) {
|
|
7
|
+
state.emissions.plots = [];
|
|
8
|
+
state.emissions.drawings = [];
|
|
9
|
+
state.emissions.alerts = [];
|
|
10
|
+
state.emissions.alertConditions = [];
|
|
11
|
+
state.emissions.logs = [];
|
|
12
|
+
}
|
|
10
13
|
/**
|
|
11
14
|
* §6.7 main step. Appends every OHLCV ring buffer, mutates the runner's
|
|
12
|
-
* shared `BarView` in place,
|
|
13
|
-
* runs the
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* The derived sources (`hl2` / `hlc3` / `ohlc4` / `hlcc4`) come from
|
|
17
|
-
* `rawBar` directly — cheaper than `ohlcv.X.at(0)` and sidesteps
|
|
18
|
-
* `noNonNullAssertion`. The buffer and the `BarView` carry identical
|
|
19
|
-
* values either way.
|
|
15
|
+
* shared `BarView` in place, walks the bundle's dep + sibling sub-runners
|
|
16
|
+
* (no-op for single-script callers), then runs the primary's `compute`.
|
|
17
|
+
* If any dep halted this bar, the primary's plot / drawing / alert / log
|
|
18
|
+
* queues are dropped (diagnostics stay).
|
|
20
19
|
*
|
|
21
|
-
*
|
|
22
|
-
* `
|
|
23
|
-
* containment.
|
|
20
|
+
* The four §6.7 invariants hold at the end of the primary's compute.
|
|
21
|
+
* `barIndex` advances exactly once per close. Errors thrown by `compute`
|
|
22
|
+
* propagate out of `onBarClose`; the host (Task 9) owns containment.
|
|
24
23
|
*
|
|
25
|
-
* @since 0.1
|
|
24
|
+
* @since 0.1 — extended to walk dep + sibling sub-runners in 0.7.
|
|
26
25
|
* @example
|
|
27
26
|
* // import { onBarClose } from "@invinite-org/chartlang-runtime";
|
|
28
27
|
* // await onBarClose(state, rawBar);
|
|
@@ -30,48 +29,18 @@ import { refreshRuntimeViews } from "../views/index.js";
|
|
|
30
29
|
export async function onBarClose(state, rawBar, eventKind = "close") {
|
|
31
30
|
appendBarToStream(state.mainStream, rawBar);
|
|
32
31
|
updateFallbackViewport(state.mainStream);
|
|
33
|
-
state.
|
|
34
|
-
state
|
|
35
|
-
state.
|
|
36
|
-
state.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
state.runtimeContext.requestSecurityAlignments.clear();
|
|
42
|
-
state.runtimeContext.requestSecurityAscendingBars.clear();
|
|
43
|
-
state.runtimeContext.logBudget = 0;
|
|
44
|
-
state.runtimeContext.logBudgetExceededDiagnosed = false;
|
|
45
|
-
ACTIVE_RUNTIME_CONTEXT.current = state.runtimeContext;
|
|
46
|
-
state.runtimeContext.isTick = false;
|
|
47
|
-
try {
|
|
48
|
-
resetSubIdCounters(state.runtimeContext);
|
|
49
|
-
refreshRuntimeViews(state, eventKind);
|
|
50
|
-
try {
|
|
51
|
-
await Promise.resolve(state.compute(buildComputeContext(state)));
|
|
52
|
-
commitStateSlots(state.runtimeContext);
|
|
53
|
-
flushStateSlots(state.runtimeContext);
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
if (!isRuntimeErrorHalt(err))
|
|
57
|
-
throw err;
|
|
58
|
-
state.emissions.plots = [];
|
|
59
|
-
state.emissions.drawings = [];
|
|
60
|
-
state.emissions.alerts = [];
|
|
61
|
-
state.emissions.alertConditions = [];
|
|
62
|
-
state.emissions.logs = [];
|
|
63
|
-
pushDiagnostic(state.emissions, {
|
|
64
|
-
kind: "diagnostic",
|
|
65
|
-
severity: "error",
|
|
66
|
-
code: "runtime-error-thrown",
|
|
67
|
-
message: err.message,
|
|
68
|
-
slotId: null,
|
|
69
|
-
bar: state.barIndex,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
32
|
+
state.depErroredThisBar = false;
|
|
33
|
+
resetBarEmissions(state);
|
|
34
|
+
state.depOutputStore?.beginBar();
|
|
35
|
+
for (const dep of state.depRunners) {
|
|
36
|
+
await runDepStep(dep, state, rawBar, eventKind, false);
|
|
37
|
+
}
|
|
38
|
+
for (const sibling of state.siblingRunners) {
|
|
39
|
+
await runSiblingStep(sibling, state, rawBar, eventKind, false);
|
|
72
40
|
}
|
|
73
|
-
|
|
74
|
-
|
|
41
|
+
await runComputeBody({ state, eventKind, isTick: false });
|
|
42
|
+
if (state.depErroredThisBar) {
|
|
43
|
+
clearVisualEmissions(state);
|
|
75
44
|
}
|
|
76
45
|
state.barIndex += 1;
|
|
77
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onBarClose.js","sourceRoot":"","sources":["../../src/execution/onBarClose.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;
|
|
1
|
+
{"version":3,"file":"onBarClose.js","sourceRoot":"","sources":["../../src/execution/onBarClose.ts"],"names":[],"mappings":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AC;IAED,MAAM,cAAc,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAE1D,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -2,20 +2,14 @@ import type { Bar } from "@invinite-org/chartlang-core";
|
|
|
2
2
|
import type { RunnerState } from "../createScriptRunner.js";
|
|
3
3
|
/**
|
|
4
4
|
* §6.7 tick path. Replaces the head slot on every close-side OHLCV
|
|
5
|
-
* buffer
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* preceding `onBarClose`.
|
|
9
|
-
*
|
|
10
|
-
* The runtime exposes `state.runtimeContext.isTick = true` for the
|
|
11
|
-
* duration of `compute`. Task 7 stateful primitives read this flag to
|
|
12
|
-
* switch between `append` and `replaceHead` slot updates. `isTick` is
|
|
13
|
-
* reset to `false` in the finally block regardless of compute outcome.
|
|
5
|
+
* buffer — does NOT advance the buffer length. `time` and `open` are
|
|
6
|
+
* NOT replaced. Walks the bundle's dep + sibling sub-runners (no-op for
|
|
7
|
+
* single-script callers) before driving the primary's `compute`.
|
|
14
8
|
*
|
|
15
9
|
* `state.barIndex` is NOT incremented — consecutive ticks share the
|
|
16
10
|
* in-progress bar's index.
|
|
17
11
|
*
|
|
18
|
-
* @since 0.1
|
|
12
|
+
* @since 0.1 — extended to walk dep + sibling sub-runners in 0.7.
|
|
19
13
|
* @example
|
|
20
14
|
* // import { onBarTick } from "@invinite-org/chartlang-runtime";
|
|
21
15
|
* // await onBarTick(state, tickBar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onBarTick.d.ts","sourceRoot":"","sources":["../../src/execution/onBarTick.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"onBarTick.d.ts","sourceRoot":"","sources":["../../src/execution/onBarTick.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAa5D;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB9E"}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
2
|
// See the LICENSE file in the repo root for full license text.
|
|
3
|
-
import {
|
|
4
|
-
import { isRuntimeErrorHalt, pushDiagnostic } from "../emit/index.js";
|
|
5
|
-
import { resetSubIdCounters } from "../emit/draw/index.js";
|
|
6
|
-
import { ACTIVE_RUNTIME_CONTEXT } from "../runtimeContext.js";
|
|
7
|
-
import { resetTentativeStateSlots } from "../state/index.js";
|
|
3
|
+
import { runDepStep, runSiblingStep } from "../dep/index.js";
|
|
8
4
|
import { replaceTickHead, updateFallbackViewport } from "../streamState.js";
|
|
9
|
-
import {
|
|
5
|
+
import { resetBarEmissions, runComputeBody } from "./runComputeStep.js";
|
|
6
|
+
function clearVisualEmissions(state) {
|
|
7
|
+
state.emissions.plots = [];
|
|
8
|
+
state.emissions.drawings = [];
|
|
9
|
+
state.emissions.alerts = [];
|
|
10
|
+
state.emissions.alertConditions = [];
|
|
11
|
+
state.emissions.logs = [];
|
|
12
|
+
}
|
|
10
13
|
/**
|
|
11
14
|
* §6.7 tick path. Replaces the head slot on every close-side OHLCV
|
|
12
|
-
* buffer
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* preceding `onBarClose`.
|
|
16
|
-
*
|
|
17
|
-
* The runtime exposes `state.runtimeContext.isTick = true` for the
|
|
18
|
-
* duration of `compute`. Task 7 stateful primitives read this flag to
|
|
19
|
-
* switch between `append` and `replaceHead` slot updates. `isTick` is
|
|
20
|
-
* reset to `false` in the finally block regardless of compute outcome.
|
|
15
|
+
* buffer — does NOT advance the buffer length. `time` and `open` are
|
|
16
|
+
* NOT replaced. Walks the bundle's dep + sibling sub-runners (no-op for
|
|
17
|
+
* single-script callers) before driving the primary's `compute`.
|
|
21
18
|
*
|
|
22
19
|
* `state.barIndex` is NOT incremented — consecutive ticks share the
|
|
23
20
|
* in-progress bar's index.
|
|
24
21
|
*
|
|
25
|
-
* @since 0.1
|
|
22
|
+
* @since 0.1 — extended to walk dep + sibling sub-runners in 0.7.
|
|
26
23
|
* @example
|
|
27
24
|
* // import { onBarTick } from "@invinite-org/chartlang-runtime";
|
|
28
25
|
* // await onBarTick(state, tickBar);
|
|
@@ -30,48 +27,18 @@ import { refreshRuntimeViews } from "../views/index.js";
|
|
|
30
27
|
export async function onBarTick(state, rawBar) {
|
|
31
28
|
replaceTickHead(state.mainStream, rawBar);
|
|
32
29
|
updateFallbackViewport(state.mainStream);
|
|
33
|
-
state.
|
|
34
|
-
state
|
|
35
|
-
state.
|
|
36
|
-
state.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
state.runtimeContext.requestSecurityAlignments.clear();
|
|
42
|
-
state.runtimeContext.requestSecurityAscendingBars.clear();
|
|
43
|
-
state.runtimeContext.logBudget = 0;
|
|
44
|
-
state.runtimeContext.logBudgetExceededDiagnosed = false;
|
|
45
|
-
ACTIVE_RUNTIME_CONTEXT.current = state.runtimeContext;
|
|
46
|
-
state.runtimeContext.isTick = true;
|
|
47
|
-
try {
|
|
48
|
-
resetSubIdCounters(state.runtimeContext);
|
|
49
|
-
resetTentativeStateSlots(state.runtimeContext);
|
|
50
|
-
refreshRuntimeViews(state, "tick");
|
|
51
|
-
try {
|
|
52
|
-
await Promise.resolve(state.compute(buildComputeContext(state)));
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
if (!isRuntimeErrorHalt(err))
|
|
56
|
-
throw err;
|
|
57
|
-
state.emissions.plots = [];
|
|
58
|
-
state.emissions.drawings = [];
|
|
59
|
-
state.emissions.alerts = [];
|
|
60
|
-
state.emissions.alertConditions = [];
|
|
61
|
-
state.emissions.logs = [];
|
|
62
|
-
pushDiagnostic(state.emissions, {
|
|
63
|
-
kind: "diagnostic",
|
|
64
|
-
severity: "error",
|
|
65
|
-
code: "runtime-error-thrown",
|
|
66
|
-
message: err.message,
|
|
67
|
-
slotId: null,
|
|
68
|
-
bar: state.barIndex,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
30
|
+
state.depErroredThisBar = false;
|
|
31
|
+
resetBarEmissions(state);
|
|
32
|
+
state.depOutputStore?.beginBar();
|
|
33
|
+
for (const dep of state.depRunners) {
|
|
34
|
+
await runDepStep(dep, state, rawBar, "tick", true);
|
|
35
|
+
}
|
|
36
|
+
for (const sibling of state.siblingRunners) {
|
|
37
|
+
await runSiblingStep(sibling, state, rawBar, "tick", true);
|
|
71
38
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
39
|
+
await runComputeBody({ state, eventKind: "tick", isTick: true });
|
|
40
|
+
if (state.depErroredThisBar) {
|
|
41
|
+
clearVisualEmissions(state);
|
|
75
42
|
}
|
|
76
43
|
}
|
|
77
44
|
//# sourceMappingURL=onBarTick.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onBarTick.js","sourceRoot":"","sources":["../../src/execution/onBarTick.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;
|
|
1
|
+
{"version":3,"file":"onBarTick.js","sourceRoot":"","sources":["../../src/execution/onBarTick.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAK/D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,O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CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { RunnerState } from "../createScriptRunner.js";
|
|
2
|
+
import { type EventKind } from "../views/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Outcome of a single compute step. `ok` means the script's `compute`
|
|
5
|
+
* returned normally; `halt` means `runtime.error(...)` was thrown (the
|
|
6
|
+
* compute body deliberately aborted the bar). Non-halt throws propagate
|
|
7
|
+
* out of {@link runComputeStep} unchanged.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.7
|
|
10
|
+
* @stable
|
|
11
|
+
* @example
|
|
12
|
+
* const r: RunComputeStepOutcome = { kind: "ok" };
|
|
13
|
+
* void r;
|
|
14
|
+
*/
|
|
15
|
+
export type RunComputeStepOutcome = Readonly<{
|
|
16
|
+
kind: "ok";
|
|
17
|
+
}> | Readonly<{
|
|
18
|
+
kind: "halt";
|
|
19
|
+
readonly message: string;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Configuration for {@link runComputeStep}. `eventKind` reaches the
|
|
23
|
+
* runtime views so `barstate.*` picks up the right snapshot; `isTick`
|
|
24
|
+
* discriminates the close-vs-tick state-slot lifecycle.
|
|
25
|
+
*
|
|
26
|
+
* @since 0.7
|
|
27
|
+
* @stable
|
|
28
|
+
* @example
|
|
29
|
+
* const args = { state, eventKind: "close" as const, isTick: false };
|
|
30
|
+
* void args;
|
|
31
|
+
*/
|
|
32
|
+
export type RunComputeStepArgs = Readonly<{
|
|
33
|
+
readonly state: RunnerState;
|
|
34
|
+
readonly eventKind: EventKind;
|
|
35
|
+
readonly isTick: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Reset the per-bar emission queues on a runner before its compute
|
|
39
|
+
* runs. Exported for the dep / sibling step driver — single-script
|
|
40
|
+
* callers go through {@link runComputeStep} which calls this
|
|
41
|
+
* internally.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.7
|
|
44
|
+
* @stable
|
|
45
|
+
* @example
|
|
46
|
+
* // resetBarEmissions(state);
|
|
47
|
+
*/
|
|
48
|
+
export declare function resetBarEmissions(state: RunnerState): void;
|
|
49
|
+
/**
|
|
50
|
+
* Run the inner compute body of `state.compute` — set
|
|
51
|
+
* `ACTIVE_RUNTIME_CONTEXT`, reset sub-id counters, optionally reset
|
|
52
|
+
* tentative state slots, refresh views, invoke `compute`, commit /
|
|
53
|
+
* flush state slots on close. Does NOT reset the per-bar emission
|
|
54
|
+
* queues; callers do that exactly once via {@link resetBarEmissions}.
|
|
55
|
+
*
|
|
56
|
+
* `runtime.error(...)` halts clear the runner's visual emissions and
|
|
57
|
+
* push a `runtime-error-thrown` diagnostic, matching the Phase-1
|
|
58
|
+
* single-script behaviour byte-for-byte. Non-halt throws propagate
|
|
59
|
+
* out unchanged.
|
|
60
|
+
*
|
|
61
|
+
* @since 0.7
|
|
62
|
+
* @stable
|
|
63
|
+
* @example
|
|
64
|
+
* // const outcome = await runComputeBody({ state, eventKind: "close", isTick: false });
|
|
65
|
+
* // void outcome;
|
|
66
|
+
*/
|
|
67
|
+
export declare function runComputeBody(args: RunComputeStepArgs): Promise<RunComputeStepOutcome>;
|
|
68
|
+
//# sourceMappingURL=runComputeStep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runComputeStep.d.ts","sourceRoot":"","sources":["../../src/execution/runComputeStep.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK5D,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,mBAAmB,CAAC;AAExE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAC3B,QAAQ,CAAC;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,GACxB,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAa1D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuC7F"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
import { buildComputeContext } from "../buildComputeContext.js";
|
|
4
|
+
import { resetSubIdCounters } from "../emit/draw/index.js";
|
|
5
|
+
import { isRuntimeErrorHalt, pushDiagnostic } from "../emit/index.js";
|
|
6
|
+
import { ACTIVE_RUNTIME_CONTEXT } from "../runtimeContext.js";
|
|
7
|
+
import { commitStateSlots, flushStateSlots, resetTentativeStateSlots } from "../state/index.js";
|
|
8
|
+
import { refreshRuntimeViews } from "../views/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* Reset the per-bar emission queues on a runner before its compute
|
|
11
|
+
* runs. Exported for the dep / sibling step driver — single-script
|
|
12
|
+
* callers go through {@link runComputeStep} which calls this
|
|
13
|
+
* internally.
|
|
14
|
+
*
|
|
15
|
+
* @since 0.7
|
|
16
|
+
* @stable
|
|
17
|
+
* @example
|
|
18
|
+
* // resetBarEmissions(state);
|
|
19
|
+
*/
|
|
20
|
+
export function resetBarEmissions(state) {
|
|
21
|
+
state.emissions.plots = [];
|
|
22
|
+
state.emissions.drawings = [];
|
|
23
|
+
state.emissions.alerts = [];
|
|
24
|
+
state.emissions.alertConditions = [];
|
|
25
|
+
state.emissions.logs = [];
|
|
26
|
+
state.emissions.diagnostics = [];
|
|
27
|
+
state.emissions.fromBar = state.barIndex;
|
|
28
|
+
state.emissions.toBar = state.barIndex;
|
|
29
|
+
state.runtimeContext.requestSecurityAlignments.clear();
|
|
30
|
+
state.runtimeContext.requestSecurityAscendingBars.clear();
|
|
31
|
+
state.runtimeContext.logBudget = 0;
|
|
32
|
+
state.runtimeContext.logBudgetExceededDiagnosed = false;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Run the inner compute body of `state.compute` — set
|
|
36
|
+
* `ACTIVE_RUNTIME_CONTEXT`, reset sub-id counters, optionally reset
|
|
37
|
+
* tentative state slots, refresh views, invoke `compute`, commit /
|
|
38
|
+
* flush state slots on close. Does NOT reset the per-bar emission
|
|
39
|
+
* queues; callers do that exactly once via {@link resetBarEmissions}.
|
|
40
|
+
*
|
|
41
|
+
* `runtime.error(...)` halts clear the runner's visual emissions and
|
|
42
|
+
* push a `runtime-error-thrown` diagnostic, matching the Phase-1
|
|
43
|
+
* single-script behaviour byte-for-byte. Non-halt throws propagate
|
|
44
|
+
* out unchanged.
|
|
45
|
+
*
|
|
46
|
+
* @since 0.7
|
|
47
|
+
* @stable
|
|
48
|
+
* @example
|
|
49
|
+
* // const outcome = await runComputeBody({ state, eventKind: "close", isTick: false });
|
|
50
|
+
* // void outcome;
|
|
51
|
+
*/
|
|
52
|
+
export async function runComputeBody(args) {
|
|
53
|
+
const { state, eventKind, isTick } = args;
|
|
54
|
+
ACTIVE_RUNTIME_CONTEXT.current = state.runtimeContext;
|
|
55
|
+
state.runtimeContext.isTick = isTick;
|
|
56
|
+
let outcome = { kind: "ok" };
|
|
57
|
+
try {
|
|
58
|
+
resetSubIdCounters(state.runtimeContext);
|
|
59
|
+
if (isTick) {
|
|
60
|
+
resetTentativeStateSlots(state.runtimeContext);
|
|
61
|
+
}
|
|
62
|
+
refreshRuntimeViews(state, eventKind);
|
|
63
|
+
try {
|
|
64
|
+
await Promise.resolve(state.compute(buildComputeContext(state)));
|
|
65
|
+
if (!isTick) {
|
|
66
|
+
commitStateSlots(state.runtimeContext);
|
|
67
|
+
flushStateSlots(state.runtimeContext);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
if (!isRuntimeErrorHalt(err))
|
|
72
|
+
throw err;
|
|
73
|
+
state.emissions.plots = [];
|
|
74
|
+
state.emissions.drawings = [];
|
|
75
|
+
state.emissions.alerts = [];
|
|
76
|
+
state.emissions.alertConditions = [];
|
|
77
|
+
state.emissions.logs = [];
|
|
78
|
+
pushDiagnostic(state.emissions, {
|
|
79
|
+
kind: "diagnostic",
|
|
80
|
+
severity: "error",
|
|
81
|
+
code: "runtime-error-thrown",
|
|
82
|
+
message: err.message,
|
|
83
|
+
slotId: null,
|
|
84
|
+
bar: state.barIndex,
|
|
85
|
+
});
|
|
86
|
+
outcome = { kind: "halt", message: err.message };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
if (isTick)
|
|
91
|
+
state.runtimeContext.isTick = false;
|
|
92
|
+
ACTIVE_RUNTIME_CONTEXT.current = null;
|
|
93
|
+
}
|
|
94
|
+
return outcome;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=runComputeStep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runComputeStep.js","sourceRoot":"","sources":["../../src/execution/runComputeStep.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,wBAAwB,EAA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M,GAAG,KAAK,CAAC;QAChD,sBAAsB,CAAC,OAAO,GAAG,IAAI,CAAC;IAC1C,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,10 +16,12 @@ export type { AdapterSymInfo, BarStateInputs, EventKind, RuntimeViews } from "./
|
|
|
16
16
|
export { ACTIVE_RUNTIME_CONTEXT } from "./runtimeContext.js";
|
|
17
17
|
export { createScriptRunner } from "./createScriptRunner.js";
|
|
18
18
|
export type { CreateScriptRunnerArgs, ScriptRunner } from "./createScriptRunner.js";
|
|
19
|
-
export { alert, draw, hline, plot, pushDrawing } from "./emit/index.js";
|
|
19
|
+
export { alert, applyPlotOverride, draw, hline, plot, pushDrawing } from "./emit/index.js";
|
|
20
20
|
export { TA_REGISTRY, ta } from "./ta/index.js";
|
|
21
21
|
export { maRibbonOutputKeys } from "./ta/index.js";
|
|
22
22
|
export type { RuntimeTaNamespace, ScalarOrSeries } from "./ta/index.js";
|
|
23
23
|
export { linearRegression } from "./ta/lib/linearRegression.js";
|
|
24
24
|
export type { LinearRegressionFrame } from "./ta/lib/linearRegression.js";
|
|
25
|
+
export type { CreateDepRunnerArgs, DepOutputDeclaration, DepOutputStore, DepRunner, DepRunnerLike, SiblingRunner, SiblingRunnerLike, } from "./dep/index.js";
|
|
26
|
+
export { applyDepEmissionPolicy, createDepOutputStore, createDepRunner, createSiblingRunner, runDepStep, runSiblingStep, } from "./dep/index.js";
|
|
25
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,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,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAOxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E,YAAY,EACR,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,cAAc,GACjB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { buildRequestNamespace, makeNanSecurityBar } from "./request/index.js";
|
|
|
11
11
|
export { createRuntimeViews, makeBarStateView, makeSymInfoView, makeTimeframeView, } from "./views/index.js";
|
|
12
12
|
export { ACTIVE_RUNTIME_CONTEXT } from "./runtimeContext.js";
|
|
13
13
|
export { createScriptRunner } from "./createScriptRunner.js";
|
|
14
|
-
export { alert, draw, hline, plot, pushDrawing } from "./emit/index.js";
|
|
14
|
+
export { alert, applyPlotOverride, draw, hline, plot, pushDrawing } from "./emit/index.js";
|
|
15
15
|
export { TA_REGISTRY, ta } from "./ta/index.js";
|
|
16
16
|
export { maRibbonOutputKeys } from "./ta/index.js";
|
|
17
17
|
// Public re-export added in Phase 3 Task 10 so consumer adapters that
|
|
@@ -21,4 +21,5 @@ export { maRibbonOutputKeys } from "./ta/index.js";
|
|
|
21
21
|
// pass `length === source.length` for a single-window fit over the
|
|
22
22
|
// bar range; the line value at the last index is the end-of-range fit.
|
|
23
23
|
export { linearRegression } from "./ta/lib/linearRegression.js";
|
|
24
|
+
export { applyDepEmissionPolicy, createDepOutputStore, createDepRunner, createSiblingRunner, runDepStep, runSiblingStep, } from "./dep/index.js";
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,sEAAsE;AACtE,gEAAgE;AAChE,uDAAuD;AACvD,oEAAoE;AACpE,mEAAmE;AACnE,uEAAuE;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAYhE,OAAO,EACH,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,cAAc,GACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal runtime entrypoint consumed by compiler-emitted bundles.
|
|
3
|
+
* NOT a script-author surface — user `.chart.ts` files cannot import
|
|
4
|
+
* from this module; the compiler's `extractDependencyGraph` rewrites
|
|
5
|
+
* every `<binding>.output("title")` call into the runtime helper
|
|
6
|
+
* exposed here.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.7
|
|
9
|
+
* @stable
|
|
10
|
+
*/
|
|
11
|
+
export { DEP_OUTPUT_GLOBAL_KEY, __chartlang_depOutput, installDepOutputGlobal, } from "./dep/depOutput.js";
|
|
12
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,GACzB,MAAM,oBAAoB,CAAC"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) 2026 Invinite. Licensed under the MIT License.
|
|
2
|
+
// See the LICENSE file in the repo root for full license text.
|
|
3
|
+
/**
|
|
4
|
+
* Internal runtime entrypoint consumed by compiler-emitted bundles.
|
|
5
|
+
* NOT a script-author surface — user `.chart.ts` files cannot import
|
|
6
|
+
* from this module; the compiler's `extractDependencyGraph` rewrites
|
|
7
|
+
* every `<binding>.output("title")` call into the runtime helper
|
|
8
|
+
* exposed here.
|
|
9
|
+
*
|
|
10
|
+
* @since 0.7
|
|
11
|
+
* @stable
|
|
12
|
+
*/
|
|
13
|
+
export { DEP_OUTPUT_GLOBAL_KEY, __chartlang_depOutput, installDepOutputGlobal, } from "./dep/depOutput.js";
|
|
14
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D;;;;;;;;;GASG;AAEH,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
@@ -11,9 +11,14 @@ import type { RunnerState } from "./createScriptRunner.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const PERSISTENCE_INTERVAL_MS = 60000;
|
|
13
13
|
/**
|
|
14
|
-
* Capture the runner's current stream
|
|
14
|
+
* Capture the runner's current stream + per-runner state-slot snapshot.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* Returns the structured shape carrying `primary.slots`, optional
|
|
17
|
+
* `siblings[exportName].slots`, and optional `dependencies[localId].slots`.
|
|
18
|
+
* TA slots live in `primary.slots` because the bundle's deps and siblings
|
|
19
|
+
* share the primary's `mainStream` (Task-4 invariant).
|
|
20
|
+
*
|
|
21
|
+
* @since 0.5 — widened to per-runner sections in 0.7.
|
|
17
22
|
* @internal
|
|
18
23
|
* @example
|
|
19
24
|
* // const snapshot = captureStateSnapshot(state, Date.now());
|
|
@@ -22,9 +27,18 @@ export declare const PERSISTENCE_INTERVAL_MS = 60000;
|
|
|
22
27
|
*/
|
|
23
28
|
export declare function captureStateSnapshot(state: RunnerState, savedAt: number): StateSnapshot | null;
|
|
24
29
|
/**
|
|
25
|
-
* Restore a validated snapshot into the runner's stream
|
|
30
|
+
* Restore a validated snapshot into the runner's stream + slot stores.
|
|
26
31
|
*
|
|
27
|
-
*
|
|
32
|
+
* Walks every per-runner section: `primary.slots` rehydrates the
|
|
33
|
+
* primary's `state.*` slots (and TA slots on the shared mainStream);
|
|
34
|
+
* `siblings[exportName].slots` and `dependencies[localId].slots`
|
|
35
|
+
* rehydrate each matching sub-runner. Snapshot sections whose id is not
|
|
36
|
+
* declared by the current bundle are skipped with a
|
|
37
|
+
* `state-snapshot-malformed` diagnostic.
|
|
38
|
+
*
|
|
39
|
+
* Legacy flat-shape snapshots (pre-0.7) restore into the primary only.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.5 — widened to per-runner sections in 0.7.
|
|
28
42
|
* @internal
|
|
29
43
|
* @example
|
|
30
44
|
* // restoreStateSnapshot(state, snapshot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistentStateStore.runtime.d.ts","sourceRoot":"","sources":["../src/persistentStateStore.runtime.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"persistentStateStore.runtime.d.ts","sourceRoot":"","sources":["../src/persistentStateStore.runtime.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGR,aAAa,EAEhB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAO3D;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAoD9C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAe9F;AAyED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAuBtF;AA2BD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA8B7F;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CACxC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf"}
|