@invinite-org/chartlang-compiler 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +683 -0
- package/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/analysis/extractAlertConditions.d.ts +33 -0
- package/dist/analysis/extractAlertConditions.d.ts.map +1 -0
- package/dist/analysis/extractAlertConditions.js +118 -0
- package/dist/analysis/extractAlertConditions.js.map +1 -0
- package/dist/analysis/extractCapabilities.d.ts +22 -0
- package/dist/analysis/extractCapabilities.d.ts.map +1 -0
- package/dist/analysis/extractCapabilities.js +44 -0
- package/dist/analysis/extractCapabilities.js.map +1 -0
- package/dist/analysis/extractInputs.d.ts +44 -0
- package/dist/analysis/extractInputs.d.ts.map +1 -0
- package/dist/analysis/extractInputs.js +306 -0
- package/dist/analysis/extractInputs.js.map +1 -0
- package/dist/analysis/extractMaxLookback.d.ts +37 -0
- package/dist/analysis/extractMaxLookback.d.ts.map +1 -0
- package/dist/analysis/extractMaxLookback.js +90 -0
- package/dist/analysis/extractMaxLookback.js.map +1 -0
- package/dist/analysis/extractRequestedIntervals.d.ts +19 -0
- package/dist/analysis/extractRequestedIntervals.d.ts.map +1 -0
- package/dist/analysis/extractRequestedIntervals.js +85 -0
- package/dist/analysis/extractRequestedIntervals.js.map +1 -0
- package/dist/analysis/extractRequiresIntervals.d.ts +16 -0
- package/dist/analysis/extractRequiresIntervals.d.ts.map +1 -0
- package/dist/analysis/extractRequiresIntervals.js +71 -0
- package/dist/analysis/extractRequiresIntervals.js.map +1 -0
- package/dist/analysis/forbiddenConstructs.d.ts +22 -0
- package/dist/analysis/forbiddenConstructs.d.ts.map +1 -0
- package/dist/analysis/forbiddenConstructs.js +214 -0
- package/dist/analysis/forbiddenConstructs.js.map +1 -0
- package/dist/analysis/index.d.ts +15 -0
- package/dist/analysis/index.d.ts.map +1 -0
- package/dist/analysis/index.js +13 -0
- package/dist/analysis/index.js.map +1 -0
- package/dist/analysis/statefulCallInLoop.d.ts +26 -0
- package/dist/analysis/statefulCallInLoop.d.ts.map +1 -0
- package/dist/analysis/statefulCallInLoop.js +64 -0
- package/dist/analysis/statefulCallInLoop.js.map +1 -0
- package/dist/analysis/structuralChecks.d.ts +73 -0
- package/dist/analysis/structuralChecks.d.ts.map +1 -0
- package/dist/analysis/structuralChecks.js +243 -0
- package/dist/analysis/structuralChecks.js.map +1 -0
- package/dist/analysis/validateLowerTfIntervals.d.ts +26 -0
- package/dist/analysis/validateLowerTfIntervals.d.ts.map +1 -0
- package/dist/analysis/validateLowerTfIntervals.js +91 -0
- package/dist/analysis/validateLowerTfIntervals.js.map +1 -0
- package/dist/api.d.ts +205 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +354 -0
- package/dist/api.js.map +1 -0
- package/dist/bundle.d.ts +75 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +90 -0
- package/dist/bundle.js.map +1 -0
- package/dist/diagnostics.d.ts +88 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +95 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +40 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +57 -0
- package/dist/manifest.js.map +1 -0
- package/dist/program.d.ts +68 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +1391 -0
- package/dist/program.js.map +1 -0
- package/dist/transformers/callsiteIdInjection.d.ts +48 -0
- package/dist/transformers/callsiteIdInjection.d.ts.map +1 -0
- package/dist/transformers/callsiteIdInjection.js +91 -0
- package/dist/transformers/callsiteIdInjection.js.map +1 -0
- package/dist/transformers/index.d.ts +4 -0
- package/dist/transformers/index.d.ts.map +1 -0
- package/dist/transformers/index.js +5 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/resolveCallee.d.ts +39 -0
- package/dist/transformers/resolveCallee.d.ts.map +1 -0
- package/dist/transformers/resolveCallee.js +136 -0
- package/dist/transformers/resolveCallee.js.map +1 -0
- package/dist/typesEmit.d.ts +35 -0
- package/dist/typesEmit.d.ts.map +1 -0
- package/dist/typesEmit.js +27 -0
- package/dist/typesEmit.js.map +1 -0
- package/package.json +48 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
# @invinite-org/chartlang-compiler
|
|
2
|
+
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4d44a9c: Surface TypeScript semantic type errors from `compile()` and `createLanguageService().compileToDiagnostics()`.
|
|
8
|
+
|
|
9
|
+
The compiler was creating a `ts.Program` for symbol resolution but never requesting `program.getSemanticDiagnostics(sourceFile)`, so scripts like `const x: number = "oops"` slipped past the gate and reached the runtime. The pipeline now wires the program's semantic diagnostics into `transformAndAnalyse`, filtered to the user's source file and mapped to a new stable `type-error` diagnostic code (with the original `TS<code>` prefix preserved in the message so editor tooling can route to TypeScript documentation).
|
|
10
|
+
|
|
11
|
+
Companion fix: the in-memory `@invinite-org/chartlang-core` ambient shim in `packages/compiler/src/program.ts` was significantly out of lockstep with the real core surface. The shim now ships the full 61-method `DrawNamespace`, every missing `TaNamespace` method (`adx`, `dmi`, `trix`, `ichimoku`, `tsi`, `smi`, `pmo`, `stochRsi`, `ultimateOsc`, `coppock`, `vortex`, `trendStrengthIndex`, `ulcerIndex`, `adr`, `median`), and `ScalarOrSeries`-widened `ta.*` source parameters that match the runtime's `readSourceValue` contract.
|
|
12
|
+
|
|
13
|
+
- d1de692: Fix end-user-blocking bug where compiled scripts could not load in either sandbox host: `compile()` now emits a self-contained ESM bundle (`esbuild.build` with `bundle: true`) so the bare `@invinite-org/chartlang-core` import is inlined and tree-shaken, matching PLAN §5.2's "~5–50 KB ESM" contract. The host-worker `data:` URL load path now succeeds end-to-end. The host-quickjs `moduleSourceToScript` regex also accepts the `export { name as default };` form produced by `esbuild`'s bundled output (the previous regex only matched literal `export default <expr>;`, so every real compile output threw "compiled module did not declare an export default").
|
|
14
|
+
- d1de692: Fix end-user-blocking Node-ESM packaging bug. Every published `dist/index.js` previously failed to load under Node's strict ESM resolver because `tsc` had been configured with `moduleResolution: "Bundler"` and emitted relative specifiers verbatim, so `dist/index.js` carried `from "./api"` (extensionless) and Node rejected the resolution. Workspace consumers never saw this because tsx / vitest / Vite resolve loosely, but `npm install @invinite-org/chartlang-compiler` followed by `import` failed immediately for any Node consumer, and `examples/react-demo/vite.config.ts`'s server-side compile plugin broke at dev-config-load time.
|
|
15
|
+
|
|
16
|
+
This release switches `tsconfig.base.json` to `module: "NodeNext"` / `moduleResolution: "NodeNext"`, and rewrites every relative import / export / dynamic-import / `typeof import("…")` specifier across all packages' source to carry an explicit `.js` (or `/index.js`) suffix. The new resolution mode also surfaces this bug class as a compile error rather than runtime breakage, so it cannot regress.
|
|
17
|
+
|
|
18
|
+
No behavioural change for runtime consumers — the rewritten specifiers resolve to the same TypeScript sources at build time and the same `dist/<path>.js` files at consumer-load time.
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [d1de692]
|
|
21
|
+
- Updated dependencies [98599b2]
|
|
22
|
+
- @invinite-org/chartlang-core@1.0.1
|
|
23
|
+
|
|
24
|
+
## 1.0.0
|
|
25
|
+
|
|
26
|
+
### Major Changes
|
|
27
|
+
|
|
28
|
+
- chartlang `1.0.0` -- the `apiVersion: 1` standard.
|
|
29
|
+
|
|
30
|
+
- `apiVersion: 1` frozen: compiler accepts only the frozen language
|
|
31
|
+
version; `STATEFUL_PRIMITIVES` locked at 172 entries by exact
|
|
32
|
+
name-set; every shipping export `@stable`; pre-1.0 deprecations
|
|
33
|
+
removed (`PHASE_1_SCENARIOS`).
|
|
34
|
+
- Canonical language spec published (`docs/spec/`): grammar,
|
|
35
|
+
semantics, manifest, emissions, versioning -- self-contained for
|
|
36
|
+
alternate implementations. The `v1.0.0` tag is the frozen spec
|
|
37
|
+
snapshot.
|
|
38
|
+
- Public conformance reports: `pnpm conformance --report` emits
|
|
39
|
+
`CONFORMANCE.md` + `conformance-report.json`; canvas2d reference
|
|
40
|
+
report published and drift-gated.
|
|
41
|
+
- Adapter-author path proven end-to-end: scaffolded adapters ship a
|
|
42
|
+
wired conformance test; full writing-an-adapter tutorial +
|
|
43
|
+
Lightweight Charts porting walkthrough.
|
|
44
|
+
- Pine migration guide finalised with a pattern-coverage matrix
|
|
45
|
+
audited against the top ~50 Pine scripts.
|
|
46
|
+
|
|
47
|
+
### Minor Changes
|
|
48
|
+
|
|
49
|
+
- d14a034: Add phase 5 server alerts, multi-timeframe request handling, runtime persistence, QuickJS hosting, expanded plot and table rendering, color helpers, alert conditions, and volume profile primitives.
|
|
50
|
+
- 3cfff10: Phase 6 closeout for Tier-3 ergonomics and lower-timeframe support.
|
|
51
|
+
- 3cfff10: Add `request.lowerTf({ interval })` and compiler diagnostics for invalid lower-timeframe intervals.
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Freeze `apiVersion: 1`: release-grade compiler diagnostics for version
|
|
56
|
+
mismatches, an exact name-set lock on the 172-entry `STATEFUL_PRIMITIVES`
|
|
57
|
+
registry, and freeze-contract documentation on pinned surfaces. No behavioural
|
|
58
|
+
change: the structural check already enforced `apiVersion: 1`.
|
|
59
|
+
- Pre-1.0 surface cleanup: remove the deprecated `PHASE_1_SCENARIOS`
|
|
60
|
+
alias (use `ALL_SCENARIOS`) and promote every shipping export from
|
|
61
|
+
`@experimental` to `@stable` ahead of the `apiVersion: 1` freeze.
|
|
62
|
+
- Updated dependencies [d14a034]
|
|
63
|
+
- Updated dependencies [3cfff10]
|
|
64
|
+
- Updated dependencies [3cfff10]
|
|
65
|
+
- Updated dependencies [3cfff10]
|
|
66
|
+
- Updated dependencies [3cfff10]
|
|
67
|
+
- Updated dependencies
|
|
68
|
+
- Updated dependencies
|
|
69
|
+
- Updated dependencies
|
|
70
|
+
- @invinite-org/chartlang-core@1.0.0
|
|
71
|
+
|
|
72
|
+
## 0.5.0
|
|
73
|
+
|
|
74
|
+
### Phase 5
|
|
75
|
+
|
|
76
|
+
#### Minor Changes
|
|
77
|
+
|
|
78
|
+
- Ship Phase 5 color helpers from PLAN §11.4: `color.fromGradient`, `color.withAlpha`, `color.rgb`, and `color.hsl`.
|
|
79
|
+
- Add canonical StateSnapshot, StreamSnapshot, and StateStoreKey type declarations for PLAN.md §6.1 and §6.9 persistence.
|
|
80
|
+
- Ship Phase 5 `defineAlertCondition`, compiler manifest extraction, runtime `signal()` emissions, adapter validation, and conformance coverage per PLAN §11.2.
|
|
81
|
+
- Add `draw.table` with `TableCell`/`TablePosition` types, runtime emission,
|
|
82
|
+
viewport-anchored canvas2d rendering, and conformance coverage per PLAN §10.2.
|
|
83
|
+
- Add Phase 5 plot kinds, runtime emission dispatch, validation, conformance scenarios, and canvas2d reference renderers.
|
|
84
|
+
- Add `ta.fixedRangeVolumeProfile`, completing the Phase 5 volume-profile set
|
|
85
|
+
from PLAN §9.2 and §10.1.1 with fixed `[from, to]` anchors, frozen post-range
|
|
86
|
+
histograms, and `fixed-range-inverted` diagnostics. Ported from invinite
|
|
87
|
+
commit `3234c8c0c3f9880d9d1e3a3ee63ebd55ddd535f4`.
|
|
88
|
+
- Port `ta.sessionVolumeProfile` from invinite commit 3234c8c0c3f9880d9d1e3a3ee63ebd55ddd535f4, adding the PLAN §9.2 horizontal-histogram session volume-profile primitive, PLAN §4.8 syminfo-session fallback diagnostics, and compiler/runtime registration.
|
|
89
|
+
|
|
90
|
+
#### Patch Changes
|
|
91
|
+
|
|
92
|
+
- Add `ta.visibleRangeVolumeProfile` per PLAN §9.2, ported from invinite commit `3234c8c0c3f9880d9d1e3a3ee63ebd55ddd535f4`, with runtime histogram emission, compiler/core type surfaces, conformance coverage, and generated docs.
|
|
93
|
+
- Updated dependencies
|
|
94
|
+
- Updated dependencies
|
|
95
|
+
- Updated dependencies
|
|
96
|
+
- Updated dependencies
|
|
97
|
+
- Updated dependencies
|
|
98
|
+
- Updated dependencies
|
|
99
|
+
- Updated dependencies
|
|
100
|
+
- Updated dependencies
|
|
101
|
+
- Updated dependencies
|
|
102
|
+
- Updated dependencies
|
|
103
|
+
- Updated dependencies
|
|
104
|
+
- @invinite-org/chartlang-core@0.5.0
|
|
105
|
+
|
|
106
|
+
## 0.4.0
|
|
107
|
+
|
|
108
|
+
### Minor Changes
|
|
109
|
+
|
|
110
|
+
- 3f3ce38: Phase-1 AST surface: `transformAndAnalyse(source, opts)` driver that runs the
|
|
111
|
+
TS program builder, the structural / forbidden-construct / stateful-call-in-loop
|
|
112
|
+
checks, the §5.5 callsite-id injection transformer, and the capability /
|
|
113
|
+
maxLookback / input extractors, then assembles a deeply-immutable
|
|
114
|
+
`ScriptManifest`. Public `CompileDiagnostic` + `CompileDiagnosticCode` types
|
|
115
|
+
cover all nine Phase-1 codes (`unbounded-loop`, `recursion-not-allowed`,
|
|
116
|
+
`hostile-global`, `stateful-call-inside-loop`, `dynamic-series-index`,
|
|
117
|
+
`callsite-id-conflict`, `missing-default-export`, `api-version-mismatch`, plus
|
|
118
|
+
the reserved `request-security-interval-not-literal`). Bundling and the public
|
|
119
|
+
`compile` / `compileFile` / `compileProject` API land in Task 3.
|
|
120
|
+
- 3f3ce38: Phase-1 public compile API: `compile(source, opts)`, `compileFile(path, opts)`,
|
|
121
|
+
`compileProject(rootDir, opts)` wrap the Task-2 transformer + analysis driver
|
|
122
|
+
and feed the printed AST through esbuild to produce the `.chart.js` +
|
|
123
|
+
`manifest.json` + `.d.ts` triple per §5.2 / §5.3. Adds `CompileError` carrying
|
|
124
|
+
the full diagnostic array, `bundleModule` + `formatManifestAssignment` (esbuild
|
|
125
|
+
driver), `emitTypes` (minimal `.d.ts` generator), and `writeAtomic` +
|
|
126
|
+
`walkChartFiles` helpers. `compileFile` writes the triple atomically via
|
|
127
|
+
tmp + rename; sourcemaps support `false` / `"inline"` / `"external"`. The
|
|
128
|
+
sibling docs-check gate now compiles every qualifying `@example` block through
|
|
129
|
+
the compiler — `EXEMPT_EXPORTS` is empty, and placeholder packages keep a
|
|
130
|
+
JSDoc'd `PACKAGE_VERSION` shim until their Phase-1 tasks land.
|
|
131
|
+
- b0d296b: Phase 3 closeout — `0.3` "Full Drawing Parity".
|
|
132
|
+
|
|
133
|
+
61 drawing kinds across 13 categories ship under `draw.*` with the
|
|
134
|
+
full §22.10 set per kind (impl + property + golden + bench + JSDoc
|
|
135
|
+
|
|
136
|
+
- conformance scenario + auto-generated docs page). 5-bucket
|
|
137
|
+
`DrawingCounts` budget, per-kind capability gating, `DrawingHandle`
|
|
138
|
+
across-bar stability, real-impl `validateEmission` + `decodeDrawing`,
|
|
139
|
+
`drawing-hash` conformance assertion variant, 13 category + 1
|
|
140
|
+
umbrella capability builders, canvas2d reference adapter renders
|
|
141
|
+
every kind, `defineDrawing` constructor for interactive tools.
|
|
142
|
+
|
|
143
|
+
Final cardinalities: `STATEFUL_PRIMITIVES.size === 154` (93 Phase-2
|
|
144
|
+
|
|
145
|
+
- 61 Phase-3 `draw.*` entries); `DRAWING_KINDS.length === 61`.
|
|
146
|
+
|
|
147
|
+
Per-bucket kind tally pinned by `bucketFor` (6 + 5 + 6 + 25 + 19 = 61):
|
|
148
|
+
|
|
149
|
+
- `lines` (6): `line`, `horizontal-line`, `horizontal-ray`,
|
|
150
|
+
`vertical-line`, `cross-line`, `trend-angle`.
|
|
151
|
+
- `boxes` (5): `rectangle`, `rotated-rectangle`, `triangle`,
|
|
152
|
+
`circle`, `ellipse`.
|
|
153
|
+
- `labels` (6): `marker`, `text`, `arrow`, `arrow-marker`,
|
|
154
|
+
`arrow-mark-up`, `arrow-mark-down`.
|
|
155
|
+
- `polylines` (25): `polyline`, `path`, `arc`, `curve`,
|
|
156
|
+
`double-curve`, `pen`, `highlighter`, `brush`,
|
|
157
|
+
`trend-channel`, `flat-top-bottom`, `disjoint-channel`,
|
|
158
|
+
`regression-trend`, `pitchfork`, `pitchfan`, `xabcd-pattern`,
|
|
159
|
+
`cypher-pattern`, `head-and-shoulders`, `abcd-pattern`,
|
|
160
|
+
`triangle-pattern`, `three-drives-pattern`,
|
|
161
|
+
`elliott-impulse-wave`, `elliott-correction-wave`,
|
|
162
|
+
`elliott-triangle-wave`, `elliott-double-combo`,
|
|
163
|
+
`elliott-triple-combo`.
|
|
164
|
+
- `other` (19): 10 `fib-*` + 4 `gann-*` + 3 cycles
|
|
165
|
+
(`cyclic-lines`, `time-cycles`, `sine-line`) + 2 containers
|
|
166
|
+
(`group`, `frame`).
|
|
167
|
+
|
|
168
|
+
Conformance scenarios: 61 per-kind + 12 task bundles +
|
|
169
|
+
`drawAll61` + `drawBudgetOverflow` + `drawUnsupportedKind` = **76**.
|
|
170
|
+
Docs: 61 auto-generated `docs/primitives/draw/<kind>.md` pages +
|
|
171
|
+
1 hand-written `index.md`.
|
|
172
|
+
|
|
173
|
+
Variant collapses pinned in Task 1 (carried forward unchanged):
|
|
174
|
+
|
|
175
|
+
- `pitchfork.variant: "standard" | "schiff" | "modified-schiff" | "inside"`
|
|
176
|
+
collapses the 4 invinite pitchfork tools.
|
|
177
|
+
- `line.{extendLeft, extendRight}` collapses the `ray` /
|
|
178
|
+
`extended-line` tools.
|
|
179
|
+
- `cypherPattern` ships as a `defineDrawing`-only kind (no
|
|
180
|
+
standalone interactive tool).
|
|
181
|
+
|
|
182
|
+
Compiler: `callsiteIdInjection` recognises every `draw.*` callable
|
|
183
|
+
via the widened 154-entry `STATEFUL_PRIMITIVES`;
|
|
184
|
+
`statefulCallInLoop` flags `draw.*` in unbounded loops with the
|
|
185
|
+
existing `stateful-call-inside-loop` error.
|
|
186
|
+
|
|
187
|
+
Bench thresholds (re-verified post-Phase-3 on Apple-silicon):
|
|
188
|
+
|
|
189
|
+
- `pushDrawing.bench.test.ts` — 10 000 line drawings under 2 000ms
|
|
190
|
+
wall-clock (`ceil(median × 3)` per §22.10; no drift across
|
|
191
|
+
Tasks 4–18 — the budget/validate path is independent of
|
|
192
|
+
per-kind canvas renderers). `pnpm bench:ci` median ~180ms.
|
|
193
|
+
- The Phase-2 ta / ringBuffer / seriesView / onBarClose /
|
|
194
|
+
plot / hline bench thresholds were bumped from the
|
|
195
|
+
`200/250/300/400/500/600ms` solo-run pins to a uniform `1500ms`
|
|
196
|
+
(3000ms for plot + hline) to absorb the parallel-worker
|
|
197
|
+
scheduling overhead during workspace `pnpm test` (665 test
|
|
198
|
+
files in parallel). Solo `pnpm bench:ci` medians remain in the
|
|
199
|
+
10–200ms range — well under both old and new thresholds — so
|
|
200
|
+
this is a noise-floor adjustment, not a perf-regression
|
|
201
|
+
accommodation.
|
|
202
|
+
|
|
203
|
+
`apiVersion: 1` script header unchanged; Phase 3 is additive at
|
|
204
|
+
runtime.
|
|
205
|
+
|
|
206
|
+
- b0d296b: Phase 3 Task 20 — `defineDrawing` constructor + interactive-tool
|
|
207
|
+
conformance scenarios.
|
|
208
|
+
|
|
209
|
+
- **core** — new `defineDrawing(opts)` constructor + `DefineDrawingOpts`
|
|
210
|
+
type. Mirrors `defineIndicator` structurally; the only differences are
|
|
211
|
+
`manifest.kind === "drawing"` and `manifest.capabilities ===
|
|
212
|
+
["drawings"]`. The runtime treats indicator and drawing scripts
|
|
213
|
+
identically at the per-bar level — the discriminator is a host-side
|
|
214
|
+
hint the editor uses to distinguish drawing scripts in the
|
|
215
|
+
script-picker UI (PLAN.md §4.1). The constructor accepts the same
|
|
216
|
+
Phase-3 `maxDrawings?: DrawingCounts` per-bucket cap propagation as
|
|
217
|
+
`defineIndicator`.
|
|
218
|
+
- **compiler** — `analysis/structuralChecks.ts` widens its recognised
|
|
219
|
+
constructor set to include `defineDrawing` and maps it to
|
|
220
|
+
`manifest.kind === "drawing"`. `StructuralCheckResult.kind` widens
|
|
221
|
+
to `"indicator" | "drawing" | "alert"` (matches `buildManifest`'s
|
|
222
|
+
existing type). The in-memory ambient `.d.ts` shim in `program.ts`
|
|
223
|
+
declares `DefineDrawingOpts` + `defineDrawing` so a `defineDrawing`
|
|
224
|
+
script type-checks under the host-machine-independent program.
|
|
225
|
+
`extractCapabilities` now takes a `kind` parameter and seeds with
|
|
226
|
+
`"drawings"` (or `"alerts"`) when the script is a `defineDrawing`
|
|
227
|
+
(or `defineAlert`) — previously every script unconditionally
|
|
228
|
+
declared `"indicators"`. Error messages on
|
|
229
|
+
`missing-default-export` / `api-version-mismatch` now mention all
|
|
230
|
+
three constructor names.
|
|
231
|
+
- **conformance** — three new bundled scenarios, all default-exporting
|
|
232
|
+
through `defineDrawing`:
|
|
233
|
+
|
|
234
|
+
- `DEFINE_DRAWING_BASIC_SCENARIO` — single `draw.fibRetracement(...)`
|
|
235
|
+
emission on bar 0 through the new constructor. Verifies the
|
|
236
|
+
constructor + compiler structural-check + capability extraction
|
|
237
|
+
- runtime emit path end-to-end. Pinned `drawing-hash`:
|
|
238
|
+
`eae59a6d44c41ef3b08b20728a9ee723bf0a0cd62e1107c9ab19aa4efa27b488`.
|
|
239
|
+
- `DRAW_INTERACTIVE_UPDATE_SCENARIO` — captures the
|
|
240
|
+
`draw.horizontalLine(bar.close)` handle in module-level state
|
|
241
|
+
on bar 0, then calls `handle.update({ price: bar.close })` on
|
|
242
|
+
every subsequent bar across the 10 000-bar goldenBars stream.
|
|
243
|
+
Pins handle-id stability + the full emission sequence (1
|
|
244
|
+
`create` + 9 999 `update`s). Pinned `drawing-hash`:
|
|
245
|
+
`797d159809da91f43fc32149998da9e5d71b011134564d42c3e5da2027c22e6f`.
|
|
246
|
+
- `DRAW_HANDLE_REMOVE_SCENARIO` — creates a `draw.text(...)` on
|
|
247
|
+
bar 0, calls `handle.remove()` on bar 100 (= time
|
|
248
|
+
`1_708_640_000_000`; goldenBars are 1-day intervals). Pinned
|
|
249
|
+
`drawing-hash` captures both the `op: "create"` and
|
|
250
|
+
`op: "remove"` emissions; `drawing-budget-exceeded` absent.
|
|
251
|
+
Pinned `drawing-hash`:
|
|
252
|
+
`b742d39fe5d03cb211b57bc26f0d24a89f9db966c481279368cc083932394a09`.
|
|
253
|
+
|
|
254
|
+
Scenario cardinality after Task 20: \*\*61 per-kind + 12 task-bundles
|
|
255
|
+
|
|
256
|
+
- 3 (smoke + budget + capability) + 3 (Task-20 constructor) = 79\*\*,
|
|
257
|
+
of which 78 are in `ALL_SCENARIOS` (the Task-19
|
|
258
|
+
`DRAW_UNSUPPORTED_KIND_SCENARIO` remains opt-in only).
|
|
259
|
+
|
|
260
|
+
### Divergences from spec (`tasks/phase-3-drawing-parity/20-define-drawing.md`)
|
|
261
|
+
|
|
262
|
+
1. **Spec § Requirements §1 sketches a `compute` shape and a separate
|
|
263
|
+
`onCreate(ctx, anchors)` / `onUpdate(handle, ctx, anchors)`
|
|
264
|
+
callback pair.** Per the team-lead brief + the spec's own example
|
|
265
|
+
(lines 53–58, which uses `compute`), Phase 3 ships the
|
|
266
|
+
`compute`-based shape only. The `onCreate`/`onUpdate` interactive-
|
|
267
|
+
editor callbacks are Phase 4 sugar layered on top of the
|
|
268
|
+
constructor (PLAN.md §10.1.1).
|
|
269
|
+
2. **Spec § Requirements §4.2 asks for a new `manifest-kind`
|
|
270
|
+
`ScenarioAssertion` variant.** Deferred — adding a new assertion
|
|
271
|
+
variant is a runner-API change out of scope here. The
|
|
272
|
+
`manifest.kind === "drawing"` contract is covered by unit tests:
|
|
273
|
+
`defineDrawing.test.ts` (constructor side), `manifest.test.ts`
|
|
274
|
+
(compiler-builder side), `structuralChecks.test.ts` (AST-walk
|
|
275
|
+
side), and `compile.test.ts` (end-to-end compile of a
|
|
276
|
+
`defineDrawing` script). Flag as a Phase-4 follow-up if
|
|
277
|
+
downstream adapter authors accumulate similar capability/manifest
|
|
278
|
+
assertions.
|
|
279
|
+
3. **Spec § Files lists `defineDrawing.types.test.ts`.** Not created.
|
|
280
|
+
The sibling `defineIndicator.ts` / `defineAlert.ts` don't have
|
|
281
|
+
`.types.test.ts` files; the typings are covered through the
|
|
282
|
+
runtime tests' `script.manifest.kind` access.
|
|
283
|
+
4. **Spec § Requirements §6 mentions a "manifest extractor test in
|
|
284
|
+
compiler package".** Covered by widening
|
|
285
|
+
`structuralChecks.test.ts` (which captures `kind` from the
|
|
286
|
+
AST) + extending `manifest.test.ts` + adding the `compile.test.ts`
|
|
287
|
+
end-to-end row. No new file needed.
|
|
288
|
+
5. **`extractCapabilities` widening was not in the original task
|
|
289
|
+
list** — but is required so a `defineDrawing` script emits
|
|
290
|
+
`capabilities: ["drawings"]` instead of `["indicators"]`. The
|
|
291
|
+
change is backwards-compatible (the new `kind` parameter
|
|
292
|
+
defaults to `"indicator"`) and pinned with new test rows.
|
|
293
|
+
|
|
294
|
+
- b0d296b: Phase-3 Task 5 — first per-port task. Lands the 6 line-family drawing
|
|
295
|
+
kinds (`line`, `horizontalLine`, `horizontalRay`, `verticalLine`,
|
|
296
|
+
`crossLine`, `trendAngle`) per PLAN.md §10 and §22.10.
|
|
297
|
+
|
|
298
|
+
`@invinite-org/chartlang-runtime` ships 6 new `draw.<kind>(...)` emit
|
|
299
|
+
functions under `src/emit/draw/lines/` plus the `DRAW_NAMESPACE` swap
|
|
300
|
+
seam at `src/emit/draw/namespace.ts` — the namespace re-exports core's
|
|
301
|
+
throwing-stub Proxy for the 55 kinds that haven't shipped yet and
|
|
302
|
+
routes the 6 line kinds through their runtime impls. Each impl uses
|
|
303
|
+
the dual-overload pattern (`(a, b, opts?)` script-facing throw +
|
|
304
|
+
`(slotId, a, b, opts?)` compiler-injected) mirroring `plot` / `alert`.
|
|
305
|
+
Returns a `DrawingHandle` per PLAN.md §10.3; subsequent in-bar
|
|
306
|
+
`update(patch)` calls merge into the slot's state and re-emit the
|
|
307
|
+
full payload.
|
|
308
|
+
|
|
309
|
+
`@invinite-org/chartlang-compiler` widens the core ambient shim
|
|
310
|
+
(`program.ts`) with `WorldPoint`, `LineDrawStyle`, `DrawingHandle`,
|
|
311
|
+
`DrawNamespace` declarations + `export const draw: DrawNamespace` so
|
|
312
|
+
the callsite-id transformer recognises `draw.<kind>(...)` calls and
|
|
313
|
+
injects the slot id (entries already shipped in `STATEFUL_PRIMITIVES`
|
|
314
|
+
via Task 1).
|
|
315
|
+
|
|
316
|
+
`chartlang-example-canvas2d-adapter` ships 6 new renderers under
|
|
317
|
+
`src/render/draw/` — `line.ts`, `horizontalLine.ts`,
|
|
318
|
+
`horizontalRay.ts`, `verticalLine.ts`, `crossLine.ts`,
|
|
319
|
+
`trendAngle.ts` — plus the shared `extendLineSegment` helper that
|
|
320
|
+
projects a segment to the viewport edges (consumed by `line` when its
|
|
321
|
+
`extendLeft`/`extendRight` flags are set, and by `horizontalRay`
|
|
322
|
+
which always extends right). The `drawingDispatch` switch arms for
|
|
323
|
+
the 6 line kinds flip from no-op stubs to real-impl calls; the
|
|
324
|
+
exhaustive `satisfies never` default and `op: "remove"` short-circuit
|
|
325
|
+
are unaffected. The `trendAngle` renderer additionally draws a small
|
|
326
|
+
arc + angle text at the `from` anchor, mirroring the invinite tool's
|
|
327
|
+
`paintTrendAngleArc`.
|
|
328
|
+
|
|
329
|
+
`@invinite-org/chartlang-conformance` lands 7 new bundled scenarios:
|
|
330
|
+
6 per-kind (`DRAW_LINE_SCENARIO`, `DRAW_HORIZONTAL_LINE_SCENARIO`,
|
|
331
|
+
`DRAW_HORIZONTAL_RAY_SCENARIO`, `DRAW_VERTICAL_LINE_SCENARIO`,
|
|
332
|
+
`DRAW_CROSS_LINE_SCENARIO`, `DRAW_TREND_ANGLE_SCENARIO`) plus one
|
|
333
|
+
category bundle (`DRAW_LINES_AND_RAYS_SCENARIO`). Each uses
|
|
334
|
+
`inlineSource` and pins one `drawing-hash` assertion + asserts
|
|
335
|
+
`unsupported-drawing-kind` and `drawing-budget-exceeded` are absent.
|
|
336
|
+
The `TEST_CAPABILITIES` bag in the conformance test suite widens
|
|
337
|
+
`drawings` to `capabilities.allLineDrawings()` and lifts the `lines`
|
|
338
|
+
bucket budget from `0` to `100` so the new scenarios reach
|
|
339
|
+
`pushDrawing`'s happy path. All 7 scenarios pass against the
|
|
340
|
+
canvas2d default adapter (which already declared
|
|
341
|
+
`drawings: capabilities.allPhase3Drawings()` via Task 4).
|
|
342
|
+
|
|
343
|
+
All Phase-1 / Phase-2 / Tasks-1–4 gates remain green. 100% coverage
|
|
344
|
+
maintained across `runtime`, `canvas2d-adapter`, and `conformance`.
|
|
345
|
+
|
|
346
|
+
- Phase 4 - Editor + Inputs + Timeframes + Tier-1 Pine parity.
|
|
347
|
+
Adds: input._ builders, state._ / state.tick.\* slots,
|
|
348
|
+
barstate / syminfo / timeframe views, request.security typed
|
|
349
|
+
surface (NaN fallback), defineIndicator overrides,
|
|
350
|
+
Capabilities triad (intervals / multiTimeframe / subPanes /
|
|
351
|
+
symInfoFields / maxDrawingsPerScript / alertConditions / logs),
|
|
352
|
+
language-service hover registry + LSP-style API, CodeMirror 6
|
|
353
|
+
editor shell + /react sub-export, Inputs UI ViewModel + React
|
|
354
|
+
form. See tasks/phase-4-editor-tier1/README.md.
|
|
355
|
+
- Extract `input.*` descriptors into compiled script manifests and add input declaration diagnostics.
|
|
356
|
+
- Add compiler extraction for static `request.security` intervals and `requiresIntervals`, and register `request.security` for callsite slot ids.
|
|
357
|
+
|
|
358
|
+
### Patch Changes
|
|
359
|
+
|
|
360
|
+
- 3f3ce38: Phase-1 walking-skeleton: ship the conformance suite
|
|
361
|
+
(`@invinite-org/chartlang-conformance`). The package now exports
|
|
362
|
+
`runConformanceSuite(adapter, opts?)`, three pinned Phase-1
|
|
363
|
+
scenarios (`EMA_CROSS_SCENARIO`, `BOLLINGER_BANDS_SCENARIO`,
|
|
364
|
+
`RSI_DIVERGENCE_SCENARIO` + the `ALL_SCENARIOS` aggregate), the
|
|
365
|
+
deterministic 10 000-bar `goldenBars.json` fixture (Mulberry32 seed
|
|
366
|
+
`0xC0DE`, four 2 500-bar regimes), and the
|
|
367
|
+
`generateGoldenBars` / `serialiseGoldenBars` / `writeGoldenBars` /
|
|
368
|
+
`GOLDEN_BARS_PATH` helpers. Closes the Phase-0
|
|
369
|
+
`scripts/run-conformance.ts` short-circuit: `pnpm conformance` now
|
|
370
|
+
runs the three scenarios end-to-end through the compiler + runtime
|
|
371
|
+
against `examples/canvas2d-adapter`'s default export and prints
|
|
372
|
+
`conformance: 3 scenarios passed, 0 failures.`.
|
|
373
|
+
|
|
374
|
+
The `RSI_DIVERGENCE_SCENARIO` re-pins `alert-count` from `0` to
|
|
375
|
+
`433` and adds two `alert-message-contains` assertions
|
|
376
|
+
(`"RSI dropped below 70"`, `"RSI rose above 30"`). The original
|
|
377
|
+
scenario codified a dead-code path in
|
|
378
|
+
`examples/scripts/rsi-divergence-alert.chart.ts` — the `rsi.current
|
|
379
|
+
> 70 && ta.crossunder(rsi, 70).current` guard was a
|
|
380
|
+
contradiction (crossunder requires the current value to be below
|
|
381
|
+
the threshold) so the overbought / oversold exit alerts could
|
|
382
|
+
never fire. The script now uses `ta.crossunder(rsi, 70).current`
|
|
383
|
+
and `ta.crossover(rsi, 30).current` directly.
|
|
384
|
+
|
|
385
|
+
`@invinite-org/chartlang-compiler` rides along with a one-line patch
|
|
386
|
+
to `transformers/resolveCallee.ts`: the callsite-id transformer now
|
|
387
|
+
also rewrites stateful calls on parameters destructured from
|
|
388
|
+
`compute({ ta, plot, alert, hline })` (the previous code only
|
|
389
|
+
matched top-level imports, so the example scripts under
|
|
390
|
+
`examples/scripts/` would have thrown the "outside an active script
|
|
391
|
+
step" sentinel at runtime). Discovered while wiring the conformance
|
|
392
|
+
runner against the on-disk example scripts; covered by new
|
|
393
|
+
`resolveCallee.test.ts` cases.
|
|
394
|
+
|
|
395
|
+
- 38fb475: Phase-2 Task 5 — cross-functional `ta.*` primitives + `STATEFUL_PRIMITIVES`
|
|
396
|
+
shape evolution.
|
|
397
|
+
|
|
398
|
+
Ships six new Pine-canonical `ta.*` primitives under
|
|
399
|
+
`packages/runtime/src/ta/`:
|
|
400
|
+
|
|
401
|
+
- `ta.nz(value, replacement?)` — stateless NaN-replacement.
|
|
402
|
+
- `ta.highest(source, length)` — rolling max (monotone deque + window
|
|
403
|
+
recompute).
|
|
404
|
+
- `ta.lowest(source, length)` — rolling min (mirror of `highest`).
|
|
405
|
+
- `ta.change(source, opts)` — first-difference `source[0] − source[length]`.
|
|
406
|
+
- `ta.valuewhen(condition, source, occurrence)` — source value at the
|
|
407
|
+
n-th most recent matching bar.
|
|
408
|
+
- `ta.barssince(condition)` — bars since the last `condition === true`.
|
|
409
|
+
|
|
410
|
+
Each primitive ships the §22.10 set: impl + unit + property + golden +
|
|
411
|
+
bench pair + conformance scenario (using the Phase-2 `inlineSource`
|
|
412
|
+
extension from Task 1) + auto-generated `docs/primitives/ta/<id>.md`.
|
|
413
|
+
|
|
414
|
+
`STATEFUL_PRIMITIVES` widens from `ReadonlySet<string>` to
|
|
415
|
+
`ReadonlySet<{ name: string; slot: boolean }>` so `ta.nz` (the only
|
|
416
|
+
stateless cross-functional primitive) can opt out of compiler slot-id
|
|
417
|
+
injection. Phase-1 entries flip to `slot: true`; `ta.nz` is the only
|
|
418
|
+
`slot: false` entry; the set cardinality grows from 12 → 18. The shape
|
|
419
|
+
update cascades through every compiler consumer
|
|
420
|
+
(`packages/compiler/src/api.ts`, `program.ts`,
|
|
421
|
+
`analysis/statefulCallInLoop.ts`, `transformers/callsiteIdInjection.ts`,
|
|
422
|
+
and their tests). The `statefulCallInLoop` analysis still flags every
|
|
423
|
+
entry inside a loop body — `slot: false` primitives are forbidden in
|
|
424
|
+
loops by Pine-parity convention.
|
|
425
|
+
|
|
426
|
+
`TA_REGISTRY` cardinality grows from 9 → 15. `RuntimeTaNamespace`
|
|
427
|
+
mirrors core's `TaNamespace` 1:1 with the standard `slotId` first-arg
|
|
428
|
+
on every method except `nz` (which carries the script-author signature
|
|
429
|
+
verbatim).
|
|
430
|
+
|
|
431
|
+
Compiler change is `patch`-level — the public API surface is
|
|
432
|
+
unchanged; only the internal `STATEFUL_PRIMITIVES` parameter shape
|
|
433
|
+
widens. Core/runtime/conformance bump `minor` for the new exports and
|
|
434
|
+
the new scenarios.
|
|
435
|
+
|
|
436
|
+
- 38fb475: Phase-2 Task 7 — MA ports (`ta.dema`, `ta.tema`, `ta.kama`, `ta.alma`).
|
|
437
|
+
|
|
438
|
+
Adds four chained / adaptive moving averages on top of the Phase-1
|
|
439
|
+
EMA primitive + the Task-6 MA backbone. DEMA / TEMA compose EMA
|
|
440
|
+
sub-slots through `TA_REGISTRY` (`${slotId}/ema1` / `/ema2` / `/ema3`);
|
|
441
|
+
KAMA is Kaufman's adaptive MA with an efficiency-ratio-driven
|
|
442
|
+
smoothing constant; ALMA is the Arnaud Legoux MA with a precomputed
|
|
443
|
+
Gaussian weight kernel.
|
|
444
|
+
|
|
445
|
+
Each primitive ships the §22.10 set (impl + four test layers +
|
|
446
|
+
conformance scenario + auto-generated docs page). ALMA's `offset`
|
|
447
|
+
opt is the Gaussian-centre position in `[0, 1]` (default `0.85`) —
|
|
448
|
+
distinct from the universal bar-shift, which lives on `opts.barShift`
|
|
449
|
+
for ALMA only.
|
|
450
|
+
|
|
451
|
+
Compiler patch: the ambient shim mirrors the four new
|
|
452
|
+
`TaNamespace` methods + opt bags.
|
|
453
|
+
|
|
454
|
+
- 38fb475: Phase-2 Task 8 — final §9.2 MA ports (`ta.lsma`, `ta.mcginley`, `ta.maRibbon`).
|
|
455
|
+
|
|
456
|
+
Closes out the §9.2 moving-averages list. `ta.lsma` is the linear-
|
|
457
|
+
regression value at the trailing window (reuses Task-4's
|
|
458
|
+
`linearRegression` helper for the property-test reference);
|
|
459
|
+
`ta.mcginley` is the McGinley Dynamic recurrence with NaN-correct
|
|
460
|
+
zero-anchor handling; `ta.maRibbon` is a fan of K MAs at different
|
|
461
|
+
lengths, dispatched per-bar through `TA_REGISTRY`'s registered MA
|
|
462
|
+
primitives (`sma` / `ema` / `wma` / `smma`) via sub-slot ids
|
|
463
|
+
`${slotId}/ma_<length>`.
|
|
464
|
+
|
|
465
|
+
`MaRibbonResult` is a dynamic-keyed record `{ ma_<length>:
|
|
466
|
+
Series<number> }`. The exported `maRibbonOutputKeys(opts)` helper
|
|
467
|
+
returns the ordered keys for stable iteration. `maRibbon` is
|
|
468
|
+
registry-tagged as multi-output via `TA_REGISTRY_METADATA` with its
|
|
469
|
+
default `primarySeriesKey: "ma_50"` + default visible keys
|
|
470
|
+
`["ma_10", "ma_20", "ma_30", "ma_40", "ma_50"]` + `{ kind: "auto" }`
|
|
471
|
+
y-domain — runtime metadata for legend chips and pane axes.
|
|
472
|
+
|
|
473
|
+
Core also adds the `MaTypeNoVolume` string-literal union (parallel to
|
|
474
|
+
the runtime's `lib/maTypes.ts` alias) so script authors can type the
|
|
475
|
+
`maType` opt directly. Each primitive ships the §22.10 set (impl +
|
|
476
|
+
four test layers + conformance scenario + auto-generated docs page).
|
|
477
|
+
|
|
478
|
+
Compiler patch: the ambient shim mirrors the three new `TaNamespace`
|
|
479
|
+
methods + opt bags + `MaTypeNoVolume` alias + `MaRibbonResult` type.
|
|
480
|
+
|
|
481
|
+
- 38fb475: Phase-2 Task 6 — MA ports (`ta.wma`, `ta.vwma`, `ta.hma`, `ta.smma`).
|
|
482
|
+
|
|
483
|
+
Adds four moving-average primitives on top of the Task-3 chained-MA
|
|
484
|
+
helpers. `ta.wma` is a linear-weighted MA over the trailing window;
|
|
485
|
+
`ta.vwma` is the volume-weighted variant; `ta.smma` is Wilder's
|
|
486
|
+
smoothed MA (α = 1/N); `ta.hma` is the Hull MA composed via three WMA
|
|
487
|
+
sub-slots derived from the parent slot id (`${slotId}/half`,
|
|
488
|
+
`${slotId}/full`, `${slotId}/final`).
|
|
489
|
+
|
|
490
|
+
Each primitive ships the §22.10 set (impl + four test layers +
|
|
491
|
+
conformance scenario + auto-generated docs page). The opts bags
|
|
492
|
+
(`WmaOpts`, `VwmaOpts`, `HmaOpts`, `SmmaOpts`) carry the universal
|
|
493
|
+
`offset` + `lineStyle` fields — typed surface only; the runtime
|
|
494
|
+
wiring lands in Task 29's universal-offset backfill.
|
|
495
|
+
|
|
496
|
+
Compiler patch: the ambient shim mirrors the four new
|
|
497
|
+
`TaNamespace` methods + opt bags.
|
|
498
|
+
|
|
499
|
+
- 38fb475: Phase-2 Task 29 — Universal `opts.offset` backfill on Phase-1 primitives.
|
|
500
|
+
|
|
501
|
+
Wires the universal `opts.offset` (PLAN.md §9.1) onto every Phase-1
|
|
502
|
+
`ta.*` primitive: `sma`, `ema`, `stdev`, `bb`, `rsi`, `macd`, `atr`,
|
|
503
|
+
`crossover`, `crossunder`. Positive `offset` shifts the returned
|
|
504
|
+
series so `series.current` reads the value `offset` bars ago
|
|
505
|
+
(matching `lib/applyOffset`'s `out[i] = values[i − offset]`
|
|
506
|
+
semantics); negative `offset` reads into the future (NaN /
|
|
507
|
+
undefined at the head). `offset === 0` is the strict identity
|
|
508
|
+
fast path — returns the slot's cached un-shifted Series with the
|
|
509
|
+
same reference as before this change (existing identity-pinned
|
|
510
|
+
tests continue to pass).
|
|
511
|
+
|
|
512
|
+
Surface expansion (core, minor):
|
|
513
|
+
|
|
514
|
+
- `offset?: number` added to `SmaOpts`, `EmaOpts`, `StdevOpts`,
|
|
515
|
+
`BbOpts`, `RsiOpts`, `MacdOpts`, `AtrOpts` (Phase-1 opts types
|
|
516
|
+
that previously had no `offset` field).
|
|
517
|
+
- New `CrossoverOpts` / `CrossunderOpts` types (the two cross
|
|
518
|
+
primitives previously took no opts bag); `TaNamespace.crossover`
|
|
519
|
+
/ `crossunder` signatures gain an optional 3rd opts arg.
|
|
520
|
+
- New `makeShiftedSeriesView` runtime helper next to
|
|
521
|
+
`makeSeriesView` (in `packages/runtime/src/seriesView.ts`,
|
|
522
|
+
re-exported from the runtime barrel) — wraps a `RingBufferLike<T>`
|
|
523
|
+
in a Proxy that adjusts `at(n)` reads by `offset`.
|
|
524
|
+
|
|
525
|
+
Composite primitives (`bb`, `macd`) shift all outputs in lockstep
|
|
526
|
+
under a single `offset` value, returning a frozen result record
|
|
527
|
+
cached per offset on the slot. Sub-slot outputs (sma's middle,
|
|
528
|
+
ema's signal) are accessed through their captured ring-buffer
|
|
529
|
+
reference so the parent primitive doesn't re-enter the sub-slot's
|
|
530
|
+
compute on the shifted-view lookup.
|
|
531
|
+
|
|
532
|
+
Compiler patch: the ambient shim in `packages/compiler/src/program.ts`
|
|
533
|
+
mirrors the core type changes (new `offset?` fields + new
|
|
534
|
+
`CrossoverOpts` / `CrossunderOpts` types + extended `TaNamespace`
|
|
535
|
+
signatures).
|
|
536
|
+
|
|
537
|
+
Goldens, bench thresholds, and conformance scenarios are
|
|
538
|
+
unchanged — `offset === 0` is the default and exercises the
|
|
539
|
+
existing code paths. New per-primitive `<id>.test.ts` and
|
|
540
|
+
`<id>.property.test.ts` cases cover positive, negative, zero, and
|
|
541
|
+
identity-cache behaviour for offset.
|
|
542
|
+
|
|
543
|
+
- 38fb475: Phase 2 quality-pass fixes (cross-cutting).
|
|
544
|
+
|
|
545
|
+
- `@invinite-org/chartlang-core`: new `STATEFUL_PRIMITIVES_BY_NAME`
|
|
546
|
+
export — a `ReadonlyMap<string, StatefulPrimitiveEntry>` derived
|
|
547
|
+
from the same canonical entry list as `STATEFUL_PRIMITIVES`. Lets
|
|
548
|
+
the compiler look up entries by callee name in O(1) instead of an
|
|
549
|
+
O(n) scan over the 93-entry set on every visited call site.
|
|
550
|
+
- `@invinite-org/chartlang-compiler`: `callsiteIdInjection` and
|
|
551
|
+
`statefulCallInLoop` now consume `STATEFUL_PRIMITIVES_BY_NAME`
|
|
552
|
+
via a `statefulByName: ReadonlyMap<string, StatefulPrimitiveEntry>`
|
|
553
|
+
parameter (was `statefulSet: ReadonlySet<StatefulPrimitiveEntry>`).
|
|
554
|
+
Internal-only API change — neither pass is publicly exported from
|
|
555
|
+
`packages/compiler/src/index.ts`. The per-pass `hasName` /
|
|
556
|
+
`findEntry` helpers are dropped.
|
|
557
|
+
- `@invinite-org/chartlang-runtime`: `ta/lib/maTypes.ts` re-exports
|
|
558
|
+
`MaTypeNoVolume` from `@invinite-org/chartlang-core` instead of
|
|
559
|
+
re-declaring it locally — keeps the two definitions from drifting
|
|
560
|
+
when a 6th MA kind is added. `MaType` (which adds `"vwma"`) stays
|
|
561
|
+
local since core has no equivalent. `__fixtures__/syntheticBars.ts`
|
|
562
|
+
and `nanTick.test.ts`'s inline `Bar` literals now carry the
|
|
563
|
+
`hl2` / `hlc3` / `ohlc4` / `hlcc4` fields the Phase-2 `Bar`
|
|
564
|
+
extension made required (the per-package tsconfig had been hiding
|
|
565
|
+
the typecheck miss).
|
|
566
|
+
|
|
567
|
+
Also: `examples/canvas2d-adapter` — extracted the duplicated
|
|
568
|
+
`dashPattern(LineStyle)` from `render/area.ts` + `render/horizontalLine.ts`
|
|
569
|
+
into `render/lineDash.ts`, re-exported from `render/index.ts`. No
|
|
570
|
+
behaviour change.
|
|
571
|
+
|
|
572
|
+
- 38fb475: Phase-2 Task 27 — S/R ports: `ta.zigZag`, `ta.pivotsHighLow`,
|
|
573
|
+
`ta.pivotsStandard`, and `ta.volatilityStop` (closes §9.2's S/R
|
|
574
|
+
list).
|
|
575
|
+
|
|
576
|
+
Ships four new S/R `ta.*` primitives under
|
|
577
|
+
`packages/runtime/src/ta/`:
|
|
578
|
+
|
|
579
|
+
- `ta.zigZag(opts?)` — streaming swing-pivot detector. Walks the
|
|
580
|
+
close series tracking a running candidate pivot; confirms a new
|
|
581
|
+
pivot when the price has reversed by ≥ `deviation %` AND `depth`
|
|
582
|
+
bars have elapsed. Returns `{ value, direction }` where `value`
|
|
583
|
+
carries the most-recently-confirmed pivot price (held constant
|
|
584
|
+
between confirmations, NaN before the first) and `direction` is
|
|
585
|
+
`+1` / `-1` / NaN. Defaults `deviation = 5`, `depth = 10`.
|
|
586
|
+
Streaming adaptation of invinite's batch ZigZag — invinite's
|
|
587
|
+
linear-interpolation rendering between pivots isn't representable
|
|
588
|
+
in the append-only `Series` model, so the output is the closest
|
|
589
|
+
surface (a "trailing reference level").
|
|
590
|
+
- `ta.pivotsHighLow(opts?)` — centred-window swing-pivot detector
|
|
591
|
+
with asymmetric `(leftLength, rightLength)` confirmation windows.
|
|
592
|
+
Returns `{ high, low }` (price-level series — `bar.high(centre)`
|
|
593
|
+
or `bar.low(centre)` when a pivot confirms, NaN otherwise).
|
|
594
|
+
Mirrors invinite's tie-break: strict-greater on the left window,
|
|
595
|
+
geq on the right (matches Pine `ta.pivothigh`). Defaults
|
|
596
|
+
`leftLength = rightLength = 4` (9-bar window).
|
|
597
|
+
- `ta.pivotsStandard(opts?)` — classical daily pivot-point levels
|
|
598
|
+
(P, R1..R3, S1..S3) derived from the previous UTC-day's HLC.
|
|
599
|
+
Returns seven `Series<number>` (`{ pp, r1, s1, r2, s2, r3, s3 }`).
|
|
600
|
+
Four formula systems: `"classic"` (default), `"fibonacci"`,
|
|
601
|
+
`"camarilla"`, `"woodie"`. UTC-day boundary detection via
|
|
602
|
+
`Math.floor(bar.time / 86_400_000)`. R4 / R5 / S4 / S5 levels
|
|
603
|
+
(Camarilla's full table) and DeMark / Traditional systems
|
|
604
|
+
intentionally defer per the Phase-2 README "Deferred / Follow-Up
|
|
605
|
+
Work" footnote.
|
|
606
|
+
- `ta.volatilityStop(opts?)` — PSAR-like trend-following stop
|
|
607
|
+
driven by ATR. Composes Phase-1 `ta.atr` at sub-slot
|
|
608
|
+
`${slotId}/atr`. Returns `{ value, direction }` (`+1` uptrend →
|
|
609
|
+
stop is BELOW price; `-1` downtrend → stop ABOVE). Defaults
|
|
610
|
+
`length = 20`, `multiplier = 2`. Source hard-coded to `bar.close`
|
|
611
|
+
(Pine `ta.vstop` convention; invinite's `source` field is
|
|
612
|
+
omitted, a `source` opt could land in a follow-up).
|
|
613
|
+
|
|
614
|
+
All four primitives suspend their recurrence state on NaN OHLC so
|
|
615
|
+
the next finite bar resumes from the prior state. `replaceHead`
|
|
616
|
+
correctness is asserted via append-vs-replaceHead property tests
|
|
617
|
+
over `arbBar` fixtures — ZigZag and Volatility Stop snapshot their
|
|
618
|
+
state-machine state at the start of each bar BEFORE the close-side
|
|
619
|
+
recurrence advances so a final tick replays from the seed
|
|
620
|
+
(mirrors Task 25's PSAR / Supertrend pattern).
|
|
621
|
+
|
|
622
|
+
Each primitive ships the §22.10 set: impl + unit + property +
|
|
623
|
+
golden + bench pair + conformance scenario (using the Phase-2
|
|
624
|
+
`inlineSource` extension from Task 1) + auto-generated
|
|
625
|
+
`docs/primitives/ta/<id>.md`. `TA_REGISTRY_METADATA` carries the
|
|
626
|
+
multi-output / y-domain hints (all four use `yDomain: { kind:
|
|
627
|
+
"auto" }`).
|
|
628
|
+
|
|
629
|
+
Core adds `ZigZagOpts`, `ZigZagResult`, `PivotsHighLowOpts`,
|
|
630
|
+
`PivotsHighLowResult`, `PivotsStandardOpts`,
|
|
631
|
+
`PivotsStandardResult`, `PivotsStandardSystem`,
|
|
632
|
+
`VolatilityStopOpts`, and `VolatilityStopResult` exports + four
|
|
633
|
+
`TaNamespace` methods. `STATEFUL_PRIMITIVES` grows by 4 (all
|
|
634
|
+
`slot: true`). `TA_REGISTRY` mirrors with the leading
|
|
635
|
+
`slotId: string` on each method.
|
|
636
|
+
|
|
637
|
+
Compiler patch: the ambient shim mirrors the four new methods +
|
|
638
|
+
nine new types.
|
|
639
|
+
|
|
640
|
+
- Add Phase 4 script override fields to core define options and compiler manifests.
|
|
641
|
+
- Updated dependencies [3f3ce38]
|
|
642
|
+
- Updated dependencies [38fb475]
|
|
643
|
+
- Updated dependencies [38fb475]
|
|
644
|
+
- Updated dependencies [38fb475]
|
|
645
|
+
- Updated dependencies [38fb475]
|
|
646
|
+
- Updated dependencies [38fb475]
|
|
647
|
+
- Updated dependencies [38fb475]
|
|
648
|
+
- Updated dependencies [38fb475]
|
|
649
|
+
- Updated dependencies [38fb475]
|
|
650
|
+
- Updated dependencies [38fb475]
|
|
651
|
+
- Updated dependencies [38fb475]
|
|
652
|
+
- Updated dependencies [38fb475]
|
|
653
|
+
- Updated dependencies [38fb475]
|
|
654
|
+
- Updated dependencies [38fb475]
|
|
655
|
+
- Updated dependencies [38fb475]
|
|
656
|
+
- Updated dependencies [38fb475]
|
|
657
|
+
- Updated dependencies [38fb475]
|
|
658
|
+
- Updated dependencies [38fb475]
|
|
659
|
+
- Updated dependencies [38fb475]
|
|
660
|
+
- Updated dependencies [38fb475]
|
|
661
|
+
- Updated dependencies [38fb475]
|
|
662
|
+
- Updated dependencies [38fb475]
|
|
663
|
+
- Updated dependencies [38fb475]
|
|
664
|
+
- Updated dependencies [38fb475]
|
|
665
|
+
- Updated dependencies [38fb475]
|
|
666
|
+
- Updated dependencies [38fb475]
|
|
667
|
+
- Updated dependencies [38fb475]
|
|
668
|
+
- Updated dependencies [38fb475]
|
|
669
|
+
- Updated dependencies [38fb475]
|
|
670
|
+
- Updated dependencies [b0d296b]
|
|
671
|
+
- Updated dependencies [b0d296b]
|
|
672
|
+
- Updated dependencies [b0d296b]
|
|
673
|
+
- Updated dependencies [b0d296b]
|
|
674
|
+
- Updated dependencies [b0d296b]
|
|
675
|
+
- Updated dependencies
|
|
676
|
+
- Updated dependencies
|
|
677
|
+
- Updated dependencies
|
|
678
|
+
- Updated dependencies
|
|
679
|
+
- Updated dependencies
|
|
680
|
+
- Updated dependencies
|
|
681
|
+
- Updated dependencies
|
|
682
|
+
- Updated dependencies
|
|
683
|
+
- @invinite-org/chartlang-core@0.4.0
|