@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.
Files changed (86) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +9 -0
  3. package/dist/createScriptRunner.d.ts +55 -4
  4. package/dist/createScriptRunner.d.ts.map +1 -1
  5. package/dist/createScriptRunner.js +103 -35
  6. package/dist/createScriptRunner.js.map +1 -1
  7. package/dist/dep/DepOutputStore.d.ts +92 -0
  8. package/dist/dep/DepOutputStore.d.ts.map +1 -0
  9. package/dist/dep/DepOutputStore.js +0 -0
  10. package/dist/dep/DepOutputStore.js.map +1 -0
  11. package/dist/dep/DepRunner.d.ts +146 -0
  12. package/dist/dep/DepRunner.d.ts.map +1 -0
  13. package/dist/dep/DepRunner.js +243 -0
  14. package/dist/dep/DepRunner.js.map +1 -0
  15. package/dist/dep/depOutput.d.ts +50 -0
  16. package/dist/dep/depOutput.d.ts.map +1 -0
  17. package/dist/dep/depOutput.js +92 -0
  18. package/dist/dep/depOutput.js.map +1 -0
  19. package/dist/dep/emissionFilter.d.ts +70 -0
  20. package/dist/dep/emissionFilter.d.ts.map +1 -0
  21. package/dist/dep/emissionFilter.js +105 -0
  22. package/dist/dep/emissionFilter.js.map +1 -0
  23. package/dist/dep/index.d.ts +8 -0
  24. package/dist/dep/index.d.ts.map +1 -0
  25. package/dist/dep/index.js +7 -0
  26. package/dist/dep/index.js.map +1 -0
  27. package/dist/emit/applyPlotOverride.d.ts +24 -0
  28. package/dist/emit/applyPlotOverride.d.ts.map +1 -0
  29. package/dist/emit/applyPlotOverride.js +48 -0
  30. package/dist/emit/applyPlotOverride.js.map +1 -0
  31. package/dist/emit/hline.d.ts +6 -4
  32. package/dist/emit/hline.d.ts.map +1 -1
  33. package/dist/emit/hline.js +5 -2
  34. package/dist/emit/hline.js.map +1 -1
  35. package/dist/emit/index.d.ts +2 -1
  36. package/dist/emit/index.d.ts.map +1 -1
  37. package/dist/emit/index.js +2 -1
  38. package/dist/emit/index.js.map +1 -1
  39. package/dist/emit/paneResolver.d.ts +52 -11
  40. package/dist/emit/paneResolver.d.ts.map +1 -1
  41. package/dist/emit/paneResolver.js +69 -26
  42. package/dist/emit/paneResolver.js.map +1 -1
  43. package/dist/emit/plot.d.ts.map +1 -1
  44. package/dist/emit/plot.js +2 -1
  45. package/dist/emit/plot.js.map +1 -1
  46. package/dist/execution/dispose.d.ts.map +1 -1
  47. package/dist/execution/dispose.js +7 -0
  48. package/dist/execution/dispose.js.map +1 -1
  49. package/dist/execution/onBarClose.d.ts +9 -13
  50. package/dist/execution/onBarClose.d.ts.map +1 -1
  51. package/dist/execution/onBarClose.js +28 -59
  52. package/dist/execution/onBarClose.js.map +1 -1
  53. package/dist/execution/onBarTick.d.ts +4 -10
  54. package/dist/execution/onBarTick.d.ts.map +1 -1
  55. package/dist/execution/onBarTick.js +24 -57
  56. package/dist/execution/onBarTick.js.map +1 -1
  57. package/dist/execution/runComputeStep.d.ts +68 -0
  58. package/dist/execution/runComputeStep.d.ts.map +1 -0
  59. package/dist/execution/runComputeStep.js +96 -0
  60. package/dist/execution/runComputeStep.js.map +1 -0
  61. package/dist/index.d.ts +3 -1
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +2 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/internal.d.ts +12 -0
  66. package/dist/internal.d.ts.map +1 -0
  67. package/dist/internal.js +14 -0
  68. package/dist/internal.js.map +1 -0
  69. package/dist/persistentStateStore.runtime.d.ts +18 -4
  70. package/dist/persistentStateStore.runtime.d.ts.map +1 -1
  71. package/dist/persistentStateStore.runtime.js +111 -18
  72. package/dist/persistentStateStore.runtime.js.map +1 -1
  73. package/dist/persistentStateStore.validate.d.ts +11 -1
  74. package/dist/persistentStateStore.validate.d.ts.map +1 -1
  75. package/dist/persistentStateStore.validate.js +32 -3
  76. package/dist/persistentStateStore.validate.js.map +1 -1
  77. package/dist/runtimeContext.d.ts +62 -4
  78. package/dist/runtimeContext.d.ts.map +1 -1
  79. package/dist/runtimeContext.js.map +1 -1
  80. package/dist/state/stateNamespace.d.ts.map +1 -1
  81. package/dist/state/stateNamespace.js +13 -2
  82. package/dist/state/stateNamespace.js.map +1 -1
  83. package/dist/stateStore.d.ts +6 -3
  84. package/dist/stateStore.d.ts.map +1 -1
  85. package/dist/stateStore.js.map +1 -1
  86. package/package.json +7 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,97 @@
1
1
  # @invinite-org/chartlang-runtime
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2123181: `createScriptRunner` accepts `CompiledScriptBundle`, mounting a
8
+ `DepRunner` per private dep + `SiblingRunner` per drawn export.
9
+ Executes deps + siblings before the primary each bar; filters
10
+ emissions per export-status; surfaces `dep-error` with parent-bar
11
+ halt semantics. `__chartlang_depOutput` is exposed via the new
12
+ `@invinite-org/chartlang-runtime/internal` subpath for compiler-
13
+ emitted bundles. Single-`CompiledScriptObject` callers byte-identical.
14
+ - 2123181: Structured `StateSnapshot` carrying per-runner slot sections (primary +
15
+ siblings + dependencies) so a `CompiledScriptBundle`'s cold-replay
16
+ emissions match its warm-restart emissions byte-identically. Slot keys
17
+ now carry the active runner's `slotIdPrefix` everywhere they reach a
18
+ `StateStore` (`dep:<localId>/` for deps, `export:<exportName>/` for
19
+ siblings, empty for the primary). Flat-shape snapshots from before this
20
+ release continue to load back-compat as primary-only.
21
+ - 2123181: Indicator composition (Phase 7 closeout): one chartlang indicator can
22
+ read another indicator's titled plot output as a typed `Series<number>`.
23
+
24
+ - Compose via local `const` binding plus `<binding>.output("title")` —
25
+ no new public API beyond the chainable `.output` / `.withInputs`
26
+ accessors on `CompiledScriptObject`.
27
+ - A single `.chart.ts` MAY declare a default export plus any number of
28
+ named exports plus any number of private `const` deps. Export form
29
+ determines render policy: drawn exports render with the
30
+ `export:<exportName>/` slot-id prefix; private `const` deps are data
31
+ feeds only and their visuals are dropped.
32
+ - Cross-file `import baseTrend from "./base-trend.chart"` resolves
33
+ recursively; shared producers inline exactly once per consumer.
34
+ - Additive within `apiVersion: 1.x`. The 172-entry
35
+ `STATEFUL_PRIMITIVES` set is unchanged. `DiagnosticCode` widens to 32
36
+ with the new `dep-*` codes (`dep-error`, `dep-cycle`,
37
+ `dep-unknown-output`, `dep-invalid-input-override`, `dep-dynamic`,
38
+ `dep-output-not-titled`).
39
+ - Five conformance scenarios in `@invinite-org/chartlang-conformance`
40
+ pin the runtime contract end-to-end (`dep-private-single-file`,
41
+ `dep-multi-export`, `dep-cross-file`, `dep-diamond`,
42
+ `dep-error-halts-parent`). `Scenario.additionalSources` lets
43
+ cross-file scenarios ship producer + consumer side-by-side.
44
+ - Two new example scripts in `examples/scripts/`:
45
+ `base-trend.chart.ts` (producer) + `trend-confirmation.chart.ts`
46
+ (multi-export consumer). React-demo gains a fifth catalogue entry
47
+ exercising the feature end-to-end in the browser.
48
+ - Docs: `docs/language/indicator-composition.md` narrative guide,
49
+ `docs/spec/manifest.md` + `docs/spec/semantics.md` +
50
+ `docs/spec/versioning.md` updates, five new glossary entries.
51
+
52
+ - 2123181: Light up the end-to-end cross-file dep path for indicator composition. The
53
+ compiler's `rewriteDependencyAccessors` transformer now collapses
54
+ `const <alias> = <root>.withInputs({...})...` chains to the bare root
55
+ identifier so the runtime sentinel never fires at module load; the merged
56
+ effective inputs flow through the `__dependencies[i].inputOverrides` slot
57
+ into the runtime's `DepRunner`. Cross-file producers' `@invinite-org/chartlang-core`
58
+ imports are hoisted above the inlined IIFE so esbuild dedupes them against
59
+ the consumer's imports and pulls in every symbol the producer uses
60
+ (`input.int`, `ta.ema`, …). The `__dependencies` export is now prepended
61
+ pre-bundle so esbuild's tree-shaker keeps each alias binding alive. The
62
+ `dep-cross-file` conformance scenario joins `ALL_SCENARIOS` and the suite
63
+ runs 225 scenarios green.
64
+ - 4d77f4d: Apply host-supplied plot overrides at emit time and add a live `setPlotOverrides` channel. The runtime resolves an initial `plotOverrides` map at mount (`args.plotOverrides ?? args.resolvePlotOverrides?.(...)`), applies the matching `PlotOverride` to every `PlotEmission` by `slotId` via the new pure `applyPlotOverride` helper (visibility / color / line width / line style for line-family kinds; silent no-op otherwise), and exposes `ScriptRunner.setPlotOverrides(next)` for a recompute-free live swap. Both `host-worker` and `host-quickjs` forward an initial `plotOverrides` on the `load` frame (mirroring `inputOverrides`) and relay a new `setPlotOverrides` host→guest frame; `ScriptHost.setPlotOverrides(...)` is added for cross-host parity. Fully additive: with no overrides supplied, every emission is byte-identical to before (the `visible` field is omitted unless a slot is explicitly hidden).
65
+ - 0427459: Turn `paneResolver.ts` into a real pane router. `RuntimeContext` now
66
+ carries mount-resolved `defaultPane` + `scriptPane` keys derived from
67
+ `manifest.overlay` / `manifest.name`: `overlay: false` scripts default
68
+ to a sanitised `script:<name>` subpane, and explicit `pane: "new"`
69
+ coalesces to one stable per-script subpane. Named panes pass through
70
+ unchanged when the adapter declares `subPanes >= 1`; on `subPanes: 0`
71
+ adapters everything still folds to overlay with the existing
72
+ `unsupported-pane` diagnostic. `hline()` now routes `opts.pane` through
73
+ the same resolver instead of hard-coding `pane: "overlay"`.
74
+
75
+ Step 2 of the `subpane-rendering` feature. Additive for `overlay: true`
76
+ and no-`overlay` scripts (byte-identical overlay emissions); `overlay:
77
+ false` scripts now emit a non-overlay pane string, which is the
78
+ explicit intent of the feature. The canvas2d adapter and demos consume
79
+ these keys in tasks 3-5.
80
+
81
+ ### Patch Changes
82
+
83
+ - Updated dependencies [d6d1a1f]
84
+ - Updated dependencies [f0c8eb8]
85
+ - Updated dependencies [2123181]
86
+ - Updated dependencies [2123181]
87
+ - Updated dependencies [2123181]
88
+ - Updated dependencies [2123181]
89
+ - Updated dependencies [4d77f4d]
90
+ - Updated dependencies [3b4952d]
91
+ - Updated dependencies [0427459]
92
+ - @invinite-org/chartlang-core@1.1.0
93
+ - @invinite-org/chartlang-adapter-kit@1.2.0
94
+
3
95
  ## 1.0.2
4
96
 
5
97
  ### Patch Changes
package/README.md CHANGED
@@ -31,6 +31,15 @@ pnpm add @invinite-org/chartlang-runtime
31
31
  - Emissions: `plot`, `hline`, `alert`, `draw`, drawing handles, budget checks,
32
32
  and validation-backed diagnostic drops.
33
33
  - Context: `ACTIVE_RUNTIME_CONTEXT` is set only around script steps.
34
+ - Composition (Phase 7): `createScriptRunner` accepts a `CompiledScriptBundle`
35
+ in addition to a single `CompiledScriptObject`. Mounts one `DepRunner`
36
+ per private dep and one `SiblingRunner` per drawn export; runs deps then
37
+ siblings then primary each bar; filters emissions per export-status
38
+ (private dep visuals dropped, sibling visuals forwarded with
39
+ `export:<name>/` slot-id prefix). Dep halts drop the primary's bar.
40
+ - Internal subpath `@invinite-org/chartlang-runtime/internal`: exports
41
+ `__chartlang_depOutput` for compiler-emitted bundles. Not a script-author
42
+ surface.
34
43
 
35
44
  ## Minimum-viable API call
36
45
 
@@ -1,5 +1,6 @@
1
- import type { CandleEvent, Capabilities, RunnerEmissions } from "@invinite-org/chartlang-adapter-kit";
2
- import type { Bar, CompiledScriptObject, ComputeFn, ScriptManifest } from "@invinite-org/chartlang-core";
1
+ import type { CandleEvent, Capabilities, PlotOverride, RunnerEmissions } from "@invinite-org/chartlang-adapter-kit";
2
+ import type { Bar, CompiledScriptBundle, CompiledScriptObject, ComputeFn, ScriptManifest } from "@invinite-org/chartlang-core";
3
+ import { type DepOutputStore, type DepRunner, type SiblingRunner } from "./dep/index.js";
3
4
  import type { PersistentStateStore } from "./persistentStateStore.js";
4
5
  import type { MutableRunnerEmissions, RuntimeContext } from "./runtimeContext.js";
5
6
  import { type StateStore } from "./stateStore.js";
@@ -27,6 +28,32 @@ export type RunnerState = {
27
28
  readonly mainStream: StreamState;
28
29
  readonly runtimeContext: RuntimeContext;
29
30
  readonly emissions: MutableRunnerEmissions;
31
+ /**
32
+ * Sub-runners for every private dep entry of a
33
+ * `CompiledScriptBundle`. Empty array for single-script callers.
34
+ * Walked in declaration order before the primary's compute each
35
+ * bar. @since 0.7
36
+ */
37
+ readonly depRunners: ReadonlyArray<DepRunner>;
38
+ /**
39
+ * Sub-runners for every drawn named-export entry of a
40
+ * `CompiledScriptBundle`. Empty for single-script callers.
41
+ * Walked in declaration order after deps, before the primary's
42
+ * compute. @since 0.7
43
+ */
44
+ readonly siblingRunners: ReadonlyArray<SiblingRunner>;
45
+ /**
46
+ * Shared titled-output buffer for the bundle. `null` for
47
+ * single-script callers (no deps to read from). @since 0.7
48
+ */
49
+ readonly depOutputStore: DepOutputStore | null;
50
+ /**
51
+ * Per-bar flag set by `runDepStep` when any dep halts. Read by
52
+ * `onBarClose` / `onBarTick` after the primary's compute returns,
53
+ * clearing the primary's plot/drawing/alert queues. Reset at the
54
+ * top of every bar. @since 0.7
55
+ */
56
+ depErroredThisBar: boolean;
30
57
  barIndex: number;
31
58
  };
32
59
  /**
@@ -56,6 +83,20 @@ export type ScriptRunner = {
56
83
  push(event: CandleEvent): Promise<void>;
57
84
  warmStart(currentMainBarTime: number): Promise<void>;
58
85
  drain(): RunnerEmissions;
86
+ /**
87
+ * Replace the per-slot presentation override map live. Cheap and
88
+ * recompute-free — the swap takes effect on the NEXT push's
89
+ * `compute`; the just-pushed bar's drain returns the pre-swap
90
+ * emissions (already baked during that bar's `compute`). Entries
91
+ * are frozen on assignment; overrides are presentation-only and
92
+ * never feed `compute`.
93
+ *
94
+ * @since 0.8
95
+ * @stable
96
+ * @example
97
+ * // runner.setPlotOverrides({ "ema.chart.ts:12:5#0": { visible: false } });
98
+ */
99
+ setPlotOverrides(next: Readonly<Record<string, PlotOverride>>): void;
59
100
  dispose(): Promise<void>;
60
101
  };
61
102
  /**
@@ -77,7 +118,15 @@ export type ScriptRunner = {
77
118
  * // };
78
119
  */
79
120
  export type CreateScriptRunnerArgs = {
80
- readonly compiled: CompiledScriptObject;
121
+ /**
122
+ * Either a single `CompiledScriptObject` (Phase-1 contract — preserved
123
+ * byte-identically) or a `CompiledScriptBundle` whose primary script
124
+ * is mounted alongside one `DepRunner` per private dep entry and one
125
+ * `SiblingRunner` per drawn named export.
126
+ *
127
+ * @since 0.1 — widened to bundle in 0.7
128
+ */
129
+ readonly compiled: CompiledScriptObject | CompiledScriptBundle;
81
130
  readonly capabilities: Capabilities;
82
131
  readonly stateStore?: StateStore;
83
132
  readonly persistentStateStore?: PersistentStateStore;
@@ -86,6 +135,8 @@ export type CreateScriptRunnerArgs = {
86
135
  readonly symInfo?: AdapterSymInfo;
87
136
  readonly resolveInputs?: (scriptId: string) => Readonly<Record<string, unknown>>;
88
137
  readonly inputOverrides?: Readonly<Record<string, unknown>>;
138
+ readonly resolvePlotOverrides?: (scriptId: string) => Readonly<Record<string, PlotOverride>>;
139
+ readonly plotOverrides?: Readonly<Record<string, PlotOverride>>;
89
140
  };
90
141
  /**
91
142
  * Build a `ScriptRunner` for a compiled chartlang script. The runner
@@ -99,7 +150,7 @@ export type CreateScriptRunnerArgs = {
99
150
  * lookback) and fall back to `manifest.maxLookback + 1`, clamped to a
100
151
  * minimum of 1 so an empty-history script still has a valid head slot.
101
152
  *
102
- * @since 0.1
153
+ * @since 0.1 — widened to accept `CompiledScriptBundle` in 0.7.
103
154
  * @example
104
155
  * // import { createScriptRunner } from "@invinite-org/chartlang-runtime";
105
156
  * // const runner = createScriptRunner({ compiled, capabilities });
@@ -1 +1 @@
1
- {"version":3,"file":"createScriptRunner.d.ts","sourceRoot":"","sources":["../src/createScriptRunner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,WAAW,EACX,YAAY,EACZ,eAAe,EAClB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EACR,GAAG,EACH,oBAAoB,EACpB,SAAS,EACT,cAAc,EACjB,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAQtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,KAAK,UAAU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,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CACnE,CAAC;AA8NF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,YAAY,CA6E7E"}
@@ -1,6 +1,8 @@
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 { pushDiagnostic } from "./emit/index.js";
3
+ import { isCompiledScriptBundle } from "@invinite-org/chartlang-core";
4
+ import { createDepOutputStore, createDepRunner, createSiblingRunner, installDepOutputGlobal, } from "./dep/index.js";
5
+ import { pushDiagnostic, resolveDefaultPane, resolveScriptPane } from "./emit/index.js";
4
6
  import { dispose as disposeImpl, drain as drainImpl, onBarClose as onBarCloseImpl, onBarTick as onBarTickImpl, onHistory as onHistoryImpl, } from "./execution/index.js";
5
7
  import { appendSecondaryBar, appendSecondaryHistory, replaceSecondaryHead, } from "./execution/secondaryStream.js";
6
8
  import { resolveInputs } from "./inputs/index.js";
@@ -65,30 +67,13 @@ function pushSecondaryEvent(state, streamKey, event) {
65
67
  return;
66
68
  }
67
69
  }
68
- /**
69
- * Build a `ScriptRunner` for a compiled chartlang script. The runner
70
- * owns one `StreamState`, one `MutableRunnerEmissions` queue set, and
71
- * the `RuntimeContext` Task 7-8 primitives read through
72
- * `ACTIVE_RUNTIME_CONTEXT`. Phase 1 ships a single-stream model; the
73
- * `requestedIntervals` field on the manifest is always empty.
74
- *
75
- * Capacity sizing follows PLAN §6.6: prefer
76
- * `manifest.seriesCapacities.ohlcv` (compiler-emitted per-series
77
- * lookback) and fall back to `manifest.maxLookback + 1`, clamped to a
78
- * minimum of 1 so an empty-history script still has a valid head slot.
79
- *
80
- * @since 0.1
81
- * @example
82
- * // import { createScriptRunner } from "@invinite-org/chartlang-runtime";
83
- * // const runner = createScriptRunner({ compiled, capabilities });
84
- * // await runner.onHistory([]);
85
- * // runner.drain();
86
- * // runner.dispose();
87
- */
88
- export function createScriptRunner(args) {
89
- const capacity = resolveCapacity(args.compiled.manifest);
70
+ function primaryOf(compiled) {
71
+ return isCompiledScriptBundle(compiled) ? compiled.primary : compiled;
72
+ }
73
+ function buildPrimaryState(args, primary) {
74
+ const capacity = resolveCapacity(primary.manifest);
90
75
  const mainStream = createStreamState({ interval: "", capacity, symbol: "" });
91
- const secondaryStreams = createSecondaryStreams(args.compiled.manifest, capacity);
76
+ const secondaryStreams = createSecondaryStreams(primary.manifest, capacity);
92
77
  const stateStore = args.stateStore ?? inMemoryStateStore();
93
78
  const now = args.now ?? Date.now;
94
79
  const views = createRuntimeViews({
@@ -104,13 +89,10 @@ export function createScriptRunner(args) {
104
89
  fromBar: 0,
105
90
  toBar: 0,
106
91
  };
107
- const alertConditions = new Map((args.compiled.manifest.alertConditions ?? []).map((condition) => [
108
- condition.id,
109
- condition,
110
- ]));
92
+ const alertConditions = new Map((primary.manifest.alertConditions ?? []).map((condition) => [condition.id, condition]));
111
93
  const state = {
112
- manifest: args.compiled.manifest,
113
- compute: args.compiled.compute,
94
+ manifest: primary.manifest,
95
+ compute: primary.compute,
114
96
  capabilities: args.capabilities,
115
97
  stateStore,
116
98
  persistenceIntervalMs: args.persistenceIntervalMs ?? PERSISTENCE_INTERVAL_MS,
@@ -136,7 +118,7 @@ export function createScriptRunner(args) {
136
118
  polylines: 0,
137
119
  other: 0,
138
120
  },
139
- scriptMaxDrawings: args.compiled.manifest.maxDrawings ?? null,
121
+ scriptMaxDrawings: primary.manifest.maxDrawings ?? null,
140
122
  stateSlots: new Map(),
141
123
  secondaryStreams,
142
124
  requestSecurityBars: new Map(),
@@ -149,16 +131,99 @@ export function createScriptRunner(args) {
149
131
  logBudget: 0,
150
132
  logBudgetExceededDiagnosed: false,
151
133
  resolvedInputs: Object.freeze({}),
134
+ defaultPane: resolveDefaultPane(primary.manifest),
135
+ scriptPane: resolveScriptPane(primary.manifest),
136
+ plotOverrides: Object.freeze({}),
152
137
  diagnosedInputKeys: new Set(),
153
138
  views,
154
139
  },
155
140
  emissions,
141
+ depRunners: [],
142
+ siblingRunners: [],
143
+ depOutputStore: null,
144
+ depErroredThisBar: false,
156
145
  barIndex: 0,
157
146
  };
158
- const overrides = args.inputOverrides ??
159
- args.resolveInputs?.(args.compiled.manifest.name) ??
160
- Object.freeze({});
161
- state.runtimeContext.resolvedInputs = resolveInputs(args.compiled.manifest, overrides, state.runtimeContext);
147
+ const overrides = args.inputOverrides ?? args.resolveInputs?.(primary.manifest.name) ?? Object.freeze({});
148
+ state.runtimeContext.resolvedInputs = resolveInputs(primary.manifest, overrides, state.runtimeContext);
149
+ state.runtimeContext.plotOverrides =
150
+ args.plotOverrides ??
151
+ args.resolvePlotOverrides?.(primary.manifest.name) ??
152
+ Object.freeze({});
153
+ return state;
154
+ }
155
+ function attachBundle(primary, bundle, capabilities, now) {
156
+ const consumerLookback = Math.max(primary.manifest.maxLookback, ...bundle.siblings.map((s) => s.compiled.manifest.maxLookback));
157
+ const storeCapacity = Math.max(1, consumerLookback + 1);
158
+ const producers = [
159
+ ...bundle.dependencies.map((d) => ({
160
+ producerId: d.localId,
161
+ outputs: (d.compiled.manifest.outputs ?? []).map((o) => ({
162
+ title: o.title,
163
+ })),
164
+ })),
165
+ ...bundle.siblings.map((s) => ({
166
+ producerId: s.exportName,
167
+ outputs: (s.compiled.manifest.outputs ?? []).map((o) => ({
168
+ title: o.title,
169
+ })),
170
+ })),
171
+ ];
172
+ const store = createDepOutputStore({ producers, capacity: storeCapacity });
173
+ const depRunners = bundle.dependencies.map((entry) => createDepRunner({
174
+ compiled: entry.compiled,
175
+ localId: entry.localId,
176
+ parentCapabilities: capabilities,
177
+ mainStream: primary.mainStream,
178
+ secondaryStreams: primary.runtimeContext.secondaryStreams,
179
+ depOutputStore: store,
180
+ inputOverrides: entry.inputOverrides ?? Object.freeze({}),
181
+ now,
182
+ }));
183
+ const siblingRunners = bundle.siblings.map((entry) => createSiblingRunner({
184
+ compiled: entry.compiled,
185
+ exportName: entry.exportName,
186
+ parentCapabilities: capabilities,
187
+ mainStream: primary.mainStream,
188
+ secondaryStreams: primary.runtimeContext.secondaryStreams,
189
+ depOutputStore: store,
190
+ inputOverrides: Object.freeze({}),
191
+ now,
192
+ }));
193
+ Object.assign(primary, {
194
+ depRunners,
195
+ siblingRunners,
196
+ depOutputStore: store,
197
+ });
198
+ primary.runtimeContext.depOutputStore = store;
199
+ installDepOutputGlobal();
200
+ }
201
+ /**
202
+ * Build a `ScriptRunner` for a compiled chartlang script. The runner
203
+ * owns one `StreamState`, one `MutableRunnerEmissions` queue set, and
204
+ * the `RuntimeContext` Task 7-8 primitives read through
205
+ * `ACTIVE_RUNTIME_CONTEXT`. Phase 1 ships a single-stream model; the
206
+ * `requestedIntervals` field on the manifest is always empty.
207
+ *
208
+ * Capacity sizing follows PLAN §6.6: prefer
209
+ * `manifest.seriesCapacities.ohlcv` (compiler-emitted per-series
210
+ * lookback) and fall back to `manifest.maxLookback + 1`, clamped to a
211
+ * minimum of 1 so an empty-history script still has a valid head slot.
212
+ *
213
+ * @since 0.1 — widened to accept `CompiledScriptBundle` in 0.7.
214
+ * @example
215
+ * // import { createScriptRunner } from "@invinite-org/chartlang-runtime";
216
+ * // const runner = createScriptRunner({ compiled, capabilities });
217
+ * // await runner.onHistory([]);
218
+ * // runner.drain();
219
+ * // runner.dispose();
220
+ */
221
+ export function createScriptRunner(args) {
222
+ const primary = primaryOf(args.compiled);
223
+ const state = buildPrimaryState(args, primary);
224
+ if (isCompiledScriptBundle(args.compiled)) {
225
+ attachBundle(state, args.compiled, args.capabilities, state.now);
226
+ }
162
227
  return Object.freeze({
163
228
  async onHistory(bars) {
164
229
  await onHistoryImpl(state, bars);
@@ -224,6 +289,9 @@ export function createScriptRunner(args) {
224
289
  drain() {
225
290
  return drainImpl(state);
226
291
  },
292
+ setPlotOverrides(next) {
293
+ state.runtimeContext.plotOverrides = Object.freeze({ ...next });
294
+ },
227
295
  async dispose() {
228
296
  const finalSave = saveStateSnapshot(state, state.now());
229
297
  disposeImpl(state);
@@ -1 +1 @@
1
- {"version":3,"file":"createScriptRunner.js","sourceRoot":"","sources":["../src/createScriptRunner.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAc/D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACH,OAAO,IAAI,WAAW,EACtB,KAAK,IAAI,SAAS,EAClB,UAAU,IAAI,cAAc,EAC5B,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EAAmB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAoB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAuB,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAuF5F,SAAS,eAAe,CAAC,QAAwB;IAC7C,MAAM,SAAS,GAAG,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC;IAClD,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,IAAI,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,sBAAsB,CAC3B,QAAwB,EACxB,QAAgB;IAEhB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC/C,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,kBAAkB,EAAE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org/chartlang-core";
2
+ /**
3
+ * One producer's contribution to a {@link DepOutputStore}. `producerId`
4
+ * is the dep's `localId` (private dep) or the sibling's `exportName`
5
+ * (drawn export). `outputs` mirrors the producer manifest's titled
6
+ * `plot(value, { title })` declarations.
7
+ *
8
+ * @since 0.7
9
+ * @stable
10
+ * @example
11
+ * const decl: DepOutputDeclaration = {
12
+ * producerId: "fastTrend",
13
+ * outputs: [{ title: "line" }],
14
+ * };
15
+ * void decl;
16
+ */
17
+ export type DepOutputDeclaration = Readonly<{
18
+ readonly producerId: string;
19
+ readonly outputs: ReadonlyArray<{
20
+ readonly title: string;
21
+ }>;
22
+ }>;
23
+ /**
24
+ * Per-bar titled-output buffer shared by the primary script and every
25
+ * sibling drawn export within a `CompiledScriptBundle`. Each
26
+ * `(producerId, title)` pair owns a `Float64RingBuffer`; the runtime
27
+ * appends to it once per bar via {@link applyDepEmissionPolicy}, and
28
+ * consumers read it through `__chartlang_depOutput`.
29
+ *
30
+ * The store pre-allocates a buffer for every declared output of every
31
+ * dep + sibling at mount time. Buffer capacity is sized for the
32
+ * consumer's `manifest.maxLookback + 1`, so `series[n]` lookback works
33
+ * up to the script's declared horizon.
34
+ *
35
+ * @since 0.7
36
+ * @stable
37
+ * @example
38
+ * // import { createDepOutputStore } from "@invinite-org/chartlang-runtime";
39
+ * // const store = createDepOutputStore({
40
+ * // producers: [{ producerId: "fast", outputs: [{ title: "line" }] }],
41
+ * // capacity: 32,
42
+ * // });
43
+ */
44
+ export type DepOutputStore = Readonly<{
45
+ /**
46
+ * Append `value` to the producer's titled buffer for the current
47
+ * bar. Throws when `(producerId, title)` is not declared. Called by
48
+ * {@link applyDepEmissionPolicy} after each dep/sibling's compute.
49
+ */
50
+ push(producerId: string, title: string, value: number): void;
51
+ /**
52
+ * Return the producer's stable `Series<number>` view for `title`.
53
+ * Throws when `(producerId, title)` is not declared. Called by the
54
+ * compiler-emitted `__chartlang_depOutput` helper during the
55
+ * consumer's compute.
56
+ */
57
+ read(producerId: string, title: string): Series<number>;
58
+ /**
59
+ * Called by the executor before any dep/sibling/primary compute on
60
+ * a new bar. Reserved for per-bar reset state; the current
61
+ * implementation has no per-bar bookkeeping but the hook stays
62
+ * stable so Task 5 can extend it.
63
+ */
64
+ beginBar(): void;
65
+ /**
66
+ * Drop every entry. Called by `dispose`.
67
+ */
68
+ dispose(): void;
69
+ }>;
70
+ /**
71
+ * Construct a fresh {@link DepOutputStore}. Pre-allocates one buffer +
72
+ * one `Series<number>` Proxy per declared `(producerId, title)`. The
73
+ * proxy identity is stable for the store's lifetime so a
74
+ * `const fast = baseTrend.output("line")` at the top of the consumer's
75
+ * compute keeps seeing the live values.
76
+ *
77
+ * @since 0.7
78
+ * @stable
79
+ * @example
80
+ * // const store = createDepOutputStore({
81
+ * // producers: [{ producerId: "fast", outputs: [{ title: "line" }] }],
82
+ * // capacity: 100,
83
+ * // });
84
+ * // store.beginBar();
85
+ * // store.push("fast", "line", 42);
86
+ * // store.read("fast", "line").current; // 42
87
+ */
88
+ export declare function createDepOutputStore(args: {
89
+ readonly producers: ReadonlyArray<DepOutputDeclaration>;
90
+ readonly capacity: number;
91
+ }): DepOutputStore;
92
+ //# sourceMappingURL=DepOutputStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepOutputStore.d.ts","sourceRoot":"","sources":["../../src/dep/DepOutputStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAK3D;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/D,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,CA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