@invinite-org/chartlang-core 1.2.0 → 1.3.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 +56 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/input/index.d.ts +1 -1
- package/dist/input/index.d.ts.map +1 -1
- package/dist/input/index.js.map +1 -1
- package/dist/input/input.d.ts +15 -1
- package/dist/input/input.d.ts.map +1 -1
- package/dist/input/input.js +14 -0
- package/dist/input/input.js.map +1 -1
- package/dist/input/inputDescriptor.d.ts +15 -2
- package/dist/input/inputDescriptor.d.ts.map +1 -1
- package/dist/input/inputDescriptor.js.map +1 -1
- package/dist/plot/plot.d.ts +60 -0
- package/dist/plot/plot.d.ts.map +1 -1
- package/dist/plot/plot.js +34 -0
- package/dist/plot/plot.js.map +1 -1
- package/dist/request/feedKey.d.ts +20 -0
- package/dist/request/feedKey.d.ts.map +1 -0
- package/dist/request/feedKey.js +29 -0
- package/dist/request/feedKey.js.map +1 -0
- package/dist/request/index.d.ts +2 -0
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js +1 -0
- package/dist/request/index.js.map +1 -1
- package/dist/request/request.d.ts +30 -5
- package/dist/request/request.d.ts.map +1 -1
- package/dist/request/request.js.map +1 -1
- package/dist/state/arraySlot.d.ts +38 -0
- package/dist/state/arraySlot.d.ts.map +1 -0
- package/dist/state/arraySlot.js +4 -0
- package/dist/state/arraySlot.js.map +1 -0
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js.map +1 -1
- package/dist/state/state.d.ts +19 -0
- package/dist/state/state.d.ts.map +1 -1
- package/dist/state/state.js +20 -0
- package/dist/state/state.js.map +1 -1
- package/dist/statefulPrimitives.d.ts +3 -3
- package/dist/statefulPrimitives.d.ts.map +1 -1
- package/dist/statefulPrimitives.js +23 -3
- package/dist/statefulPrimitives.js.map +1 -1
- package/dist/time-accessors/index.d.ts +5 -0
- package/dist/time-accessors/index.d.ts.map +1 -0
- package/dist/time-accessors/index.js +5 -0
- package/dist/time-accessors/index.js.map +1 -0
- package/dist/time-accessors/sessionAccessors.d.ts +43 -0
- package/dist/time-accessors/sessionAccessors.d.ts.map +1 -0
- package/dist/time-accessors/sessionAccessors.js +38 -0
- package/dist/time-accessors/sessionAccessors.js.map +1 -0
- package/dist/time-accessors/timeAccessors.d.ts +132 -0
- package/dist/time-accessors/timeAccessors.d.ts.map +1 -0
- package/dist/time-accessors/timeAccessors.js +143 -0
- package/dist/time-accessors/timeAccessors.js.map +1 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the composite secondary-feed key from a `(symbol, interval)` pair —
|
|
3
|
+
* the **single** source of the stream-key format shared by the runtime's
|
|
4
|
+
* stream/cache maps and the host wire (`CandleEvent.streamKey`). Like a slot
|
|
5
|
+
* id, this string is load-bearing: producer (adapter/host) and consumer
|
|
6
|
+
* (runtime) must agree byte-for-byte, so never re-derive it inline.
|
|
7
|
+
*
|
|
8
|
+
* An **omitted** symbol (the chart's own symbol / higher-timeframe-only case)
|
|
9
|
+
* encodes to the bare interval — `feedKey(undefined, "1D") === "1D"` — so the
|
|
10
|
+
* symbol-omitted wire and every key stay byte-identical to the pre-multi-symbol
|
|
11
|
+
* baseline. A present symbol encodes as `"<symbol>@<interval>"`.
|
|
12
|
+
*
|
|
13
|
+
* @since 1.3
|
|
14
|
+
* @stable
|
|
15
|
+
* @example
|
|
16
|
+
* feedKey(undefined, "1D"); // "1D" (chart symbol, back-compat)
|
|
17
|
+
* feedKey("AMEX:SPY", "1D"); // "AMEX:SPY@1D"
|
|
18
|
+
*/
|
|
19
|
+
export declare function feedKey(symbol: string | undefined, interval: string): string;
|
|
20
|
+
//# sourceMappingURL=feedKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedKey.d.ts","sourceRoot":"","sources":["../../src/request/feedKey.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO5E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
* Build the composite secondary-feed key from a `(symbol, interval)` pair —
|
|
5
|
+
* the **single** source of the stream-key format shared by the runtime's
|
|
6
|
+
* stream/cache maps and the host wire (`CandleEvent.streamKey`). Like a slot
|
|
7
|
+
* id, this string is load-bearing: producer (adapter/host) and consumer
|
|
8
|
+
* (runtime) must agree byte-for-byte, so never re-derive it inline.
|
|
9
|
+
*
|
|
10
|
+
* An **omitted** symbol (the chart's own symbol / higher-timeframe-only case)
|
|
11
|
+
* encodes to the bare interval — `feedKey(undefined, "1D") === "1D"` — so the
|
|
12
|
+
* symbol-omitted wire and every key stay byte-identical to the pre-multi-symbol
|
|
13
|
+
* baseline. A present symbol encodes as `"<symbol>@<interval>"`.
|
|
14
|
+
*
|
|
15
|
+
* @since 1.3
|
|
16
|
+
* @stable
|
|
17
|
+
* @example
|
|
18
|
+
* feedKey(undefined, "1D"); // "1D" (chart symbol, back-compat)
|
|
19
|
+
* feedKey("AMEX:SPY", "1D"); // "AMEX:SPY@1D"
|
|
20
|
+
*/
|
|
21
|
+
export function feedKey(symbol, interval) {
|
|
22
|
+
// The `@` separator is not a valid character in a chartlang interval
|
|
23
|
+
// literal (`/^\d+[smhdwM]$/`), so a `"<symbol>@<interval>"` key can never
|
|
24
|
+
// collide with a bare-interval (chart-symbol) key. An empty/undefined
|
|
25
|
+
// symbol collapsing to the bare interval is what gives the omitted-symbol
|
|
26
|
+
// path byte-identical keys + wire to the pre-multi-symbol baseline.
|
|
27
|
+
return symbol === undefined || symbol === "" ? interval : `${symbol}@${interval}`;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=feedKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedKey.js","sourceRoot":"","sources":["../../src/request/feedKey.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,OAAO,CAAC,MAA0B,EAAE,QAAgB;IAChE,qEAAqE;IACrE,0EAA0E;IAC1E,sEAAsE;IACtE,0EAA0E;IAC1E,oEAAoE;IACpE,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAC;AACtF,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\n/**\n * Build the composite secondary-feed key from a `(symbol, interval)` pair —\n * the **single** source of the stream-key format shared by the runtime's\n * stream/cache maps and the host wire (`CandleEvent.streamKey`). Like a slot\n * id, this string is load-bearing: producer (adapter/host) and consumer\n * (runtime) must agree byte-for-byte, so never re-derive it inline.\n *\n * An **omitted** symbol (the chart's own symbol / higher-timeframe-only case)\n * encodes to the bare interval — `feedKey(undefined, \"1D\") === \"1D\"` — so the\n * symbol-omitted wire and every key stay byte-identical to the pre-multi-symbol\n * baseline. A present symbol encodes as `\"<symbol>@<interval>\"`.\n *\n * @since 1.3\n * @stable\n * @example\n * feedKey(undefined, \"1D\"); // \"1D\" (chart symbol, back-compat)\n * feedKey(\"AMEX:SPY\", \"1D\"); // \"AMEX:SPY@1D\"\n */\nexport function feedKey(symbol: string | undefined, interval: string): string {\n // The `@` separator is not a valid character in a chartlang interval\n // literal (`/^\\d+[smhdwM]$/`), so a `\"<symbol>@<interval>\"` key can never\n // collide with a bare-interval (chart-symbol) key. An empty/undefined\n // symbol collapsing to the bare interval is what gives the omitted-symbol\n // path byte-identical keys + wire to the pre-multi-symbol baseline.\n return symbol === undefined || symbol === \"\" ? interval : `${symbol}@${interval}`;\n}\n"]}
|
package/dist/request/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { request, type RequestNamespace, type RequestLowerTfOpts, type RequestSecurityOpts, type SecurityBar, type SecurityExpr, } from "./request.js";
|
|
2
|
+
export { feedKey } from "./feedKey.js";
|
|
3
|
+
export type { RequestedFeed } from "../types.js";
|
|
2
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,OAAO,EACP,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,YAAY,GACpB,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,OAAO,EACP,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,YAAY,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/request/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EACH,OAAO,GAMV,MAAM,cAAc,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nexport {\n request,\n type RequestNamespace,\n type RequestLowerTfOpts,\n type RequestSecurityOpts,\n type SecurityBar,\n type SecurityExpr,\n} from \"./request.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EACH,OAAO,GAMV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nexport {\n request,\n type RequestNamespace,\n type RequestLowerTfOpts,\n type RequestSecurityOpts,\n type SecurityBar,\n type SecurityExpr,\n} from \"./request.js\";\nexport { feedKey } from \"./feedKey.js\";\nexport type { RequestedFeed } from \"../types.js\";\n"]}
|
|
@@ -9,8 +9,24 @@ import type { Bar, Price, Series, Time, Volume } from "../types.js";
|
|
|
9
9
|
* @example
|
|
10
10
|
* const opts: RequestSecurityOpts = { interval: "1D" };
|
|
11
11
|
* void opts;
|
|
12
|
+
* @example
|
|
13
|
+
* // read a different instrument (requires Capabilities.multiSymbol)
|
|
14
|
+
* const spy: RequestSecurityOpts = { symbol: "AMEX:SPY", interval: "1D" };
|
|
15
|
+
* void spy;
|
|
12
16
|
*/
|
|
13
17
|
export type RequestSecurityOpts = Readonly<{
|
|
18
|
+
/**
|
|
19
|
+
* The instrument to read. Omit for the chart's own symbol (the existing
|
|
20
|
+
* behavior). Must be a compile-time literal — a string literal, an
|
|
21
|
+
* `input.symbol` default, or an `input.enum` value; the compiler's
|
|
22
|
+
* literal-only pass rejects a dynamic expression with
|
|
23
|
+
* `request-security-symbol-not-literal`. A non-chart symbol additionally
|
|
24
|
+
* requires `Capabilities.multiSymbol`; otherwise the series degrades to
|
|
25
|
+
* all-NaN.
|
|
26
|
+
*
|
|
27
|
+
* @since 1.2
|
|
28
|
+
*/
|
|
29
|
+
readonly symbol?: string;
|
|
14
30
|
readonly interval: string;
|
|
15
31
|
}>;
|
|
16
32
|
/**
|
|
@@ -96,11 +112,15 @@ export type SecurityExpr = (bar: SecurityBar) => Series<number> | number;
|
|
|
96
112
|
* clocked to the main timeline, so `ta.ema(weekly.close, 20)` would
|
|
97
113
|
* average 20 *main* bars.
|
|
98
114
|
*
|
|
99
|
-
*
|
|
100
|
-
* `input.enum` value); the compiler
|
|
101
|
-
* `manifest.
|
|
102
|
-
* `
|
|
103
|
-
*
|
|
115
|
+
* Both `symbol` and `interval` must be compile-time literals (a string
|
|
116
|
+
* literal, an `input.symbol` default, or an `input.enum` value); the compiler
|
|
117
|
+
* walks every call to populate `manifest.requestedFeeds` (and the main-symbol
|
|
118
|
+
* projection `manifest.requestedIntervals`). `symbol` is **optional** —
|
|
119
|
+
* omitting it reads the chart's own symbol (the higher-timeframe-only case).
|
|
120
|
+
* When the adapter does not advertise `Capabilities.multiTimeframe`, the
|
|
121
|
+
* series degrades to all-NaN rather than erroring; a non-chart `symbol`
|
|
122
|
+
* additionally requires `Capabilities.multiSymbol` and otherwise degrades to
|
|
123
|
+
* all-NaN. See the multi-timeframe guide for alignment and interval-format
|
|
104
124
|
* details.
|
|
105
125
|
*
|
|
106
126
|
* @since 0.4
|
|
@@ -113,6 +133,11 @@ export type SecurityExpr = (bar: SecurityBar) => Series<number> | number;
|
|
|
113
133
|
* // data form — aligned weekly close
|
|
114
134
|
* const weekly = request.security({ interval: "1W" });
|
|
115
135
|
* plot(weekly.close, { title: "Weekly close" });
|
|
136
|
+
* @example
|
|
137
|
+
* // different symbol — a ratio against another instrument (needs multiSymbol)
|
|
138
|
+
* const spy = request.security({ symbol: "AMEX:SPY", interval: "1D" });
|
|
139
|
+
* const qqq = request.security({ symbol: "NASDAQ:QQQ", interval: "1D" });
|
|
140
|
+
* plot(spy.close.current / qqq.close.current, { title: "SPY/QQQ" });
|
|
116
141
|
*/
|
|
117
142
|
declare function security(opts: RequestSecurityOpts): SecurityBar;
|
|
118
143
|
declare function security(opts: RequestSecurityOpts, expr: SecurityExpr): Series<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpE
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACvC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,M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":["../../src/request/request.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAwG/D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAS,EAAE;IACrC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,uCAAuC,CAAC,CAAC;AACpE,CAAC,CAAC;AAgDF,SAAS,QAAQ,CAAC,KAA0B,EAAE,KAAoB;IAC9D,OAAO,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,OAAO,CAAC,KAAyB;IACtC,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { Bar, Price, Series, Time, Volume } from \"../types.js\";\n\n/**\n * Argument to {@link request.security}. The `interval` must be a string\n * literal or an `input.enum` value; the compiler's literal-only pass rejects\n * dynamic expressions with `request-security-interval-not-literal`.\n *\n * @since 0.4\n * @stable\n * @example\n * const opts: RequestSecurityOpts = { interval: \"1D\" };\n * void opts;\n * @example\n * // read a different instrument (requires Capabilities.multiSymbol)\n * const spy: RequestSecurityOpts = { symbol: \"AMEX:SPY\", interval: \"1D\" };\n * void spy;\n */\nexport type RequestSecurityOpts = Readonly<{\n /**\n * The instrument to read. Omit for the chart's own symbol (the existing\n * behavior). Must be a compile-time literal — a string literal, an\n * `input.symbol` default, or an `input.enum` value; the compiler's\n * literal-only pass rejects a dynamic expression with\n * `request-security-symbol-not-literal`. A non-chart symbol additionally\n * requires `Capabilities.multiSymbol`; otherwise the series degrades to\n * all-NaN.\n *\n * @since 1.2\n */\n readonly symbol?: string;\n readonly interval: string;\n}>;\n\n/**\n * Argument to {@link request.lowerTf}. The `interval` must be strictly lower\n * than the script's main interval; invalid orderings are rejected by the\n * compiler's `lower-tf-not-lower` diagnostic when statically known.\n *\n * @since 0.6\n * @stable\n * @example\n * const opts: RequestLowerTfOpts = { interval: \"30s\" };\n * void opts;\n */\nexport type RequestLowerTfOpts = Readonly<{\n readonly interval: string;\n}>;\n\n/**\n * Secondary-stream bar returned by {@link request.security}. Each field is a\n * `Series<...>` aligned from the runtime's secondary-stream ring buffer to\n * the current main stream, or by the all-NaN fallback when\n * `Capabilities.multiTimeframe` is `false`, the interval is unsupported, or\n * the host fails to register the secondary stream.\n *\n * This is intentionally a series-shaped view rather than the scalar\n * {@link Bar} shape so scripts can read historical secondary values aligned\n * to main bars, such as `daily.close[5]`.\n *\n * @since 0.4\n * @stable\n * @example\n * const close: SecurityBar[\"close\"] = { current: 1, length: 1 };\n * void close;\n */\nexport type SecurityBar = Readonly<{\n readonly time: Series<Time>;\n readonly open: Series<Price>;\n readonly high: Series<Price>;\n readonly low: Series<Price>;\n readonly close: Series<Price>;\n readonly volume: Series<Volume>;\n readonly hl2: Series<Price>;\n readonly hlc3: Series<Price>;\n readonly ohlc4: Series<Price>;\n readonly hlcc4: Series<Price>;\n readonly symbol: Series<string>;\n readonly interval: Series<string>;\n}>;\n\n/**\n * A higher-timeframe expression callback for {@link RequestNamespace.security}.\n * Receives the HTF {@link SecurityBar} (OHLCV series on the secondary\n * stream's own clock) and returns the value to evaluate per HTF bar.\n * The body may reference only the `bar` parameter, the ambient `ta`\n * namespace, `inputs`, safe `Math.*` globals, and literal constants —\n * capturing any other outer binding is a compile error\n * (`request-security-expr-captures-local`).\n *\n * Returning a `Series<number>` (e.g. `(bar) => ta.ema(bar.close, 20)`)\n * lets `ta.*` accumulate over HTF bars; returning a bare `number`\n * (e.g. `(bar) => bar.close.current * 2`) samples the scalar once per\n * HTF bar. Either way the result aligns no-lookahead to the main timeline.\n *\n * @since 0.7\n * @stable\n * @example\n * const trend: SecurityExpr = (bar) => bar.close;\n * void trend;\n */\nexport type SecurityExpr = (bar: SecurityBar) => Series<number> | number;\n\nconst sentinel = (name: string): never => {\n throw new Error(`${name} called outside an active script step`);\n};\n\n/**\n * Read a secondary candle stream at a script-author-fixed **higher**\n * interval. Two forms:\n *\n * - **Data**: `request.security({ interval })` → a `SecurityBar`.\n * Every OHLCV field — plus the derived `hl2` / `hlc3` / `ohlc4` /\n * `hlcc4` and `symbol` / `interval` — is a `Series<...>` aligned\n * no-lookahead to the chart's bars, so a script can read prior secondary\n * values such as `weekly.close[5]`.\n * - **Expression**: `request.security({ interval }, (bar) => …)` →\n * `Series<number>`. The callback runs **on the higher-timeframe clock**\n * (once per HTF bar), so `ta.*` inside it accumulate over HTF bars; the\n * result is aligned no-lookahead down to the main timeline. This is the\n * only correct way to get a \"weekly EMA(20)\" — the data form's series is\n * clocked to the main timeline, so `ta.ema(weekly.close, 20)` would\n * average 20 *main* bars.\n *\n * Both `symbol` and `interval` must be compile-time literals (a string\n * literal, an `input.symbol` default, or an `input.enum` value); the compiler\n * walks every call to populate `manifest.requestedFeeds` (and the main-symbol\n * projection `manifest.requestedIntervals`). `symbol` is **optional** —\n * omitting it reads the chart's own symbol (the higher-timeframe-only case).\n * When the adapter does not advertise `Capabilities.multiTimeframe`, the\n * series degrades to all-NaN rather than erroring; a non-chart `symbol`\n * additionally requires `Capabilities.multiSymbol` and otherwise degrades to\n * all-NaN. See the multi-timeframe guide for alignment and interval-format\n * details.\n *\n * @since 0.4\n * @stable\n * @example\n * // weekly EMA(20) — computed over weekly bars, drawn on the chart\n * const trend = request.security({ interval: \"1W\" }, (bar) => ta.ema(bar.close, 20));\n * plot(trend, { title: \"Weekly EMA(20)\" });\n * @example\n * // data form — aligned weekly close\n * const weekly = request.security({ interval: \"1W\" });\n * plot(weekly.close, { title: \"Weekly close\" });\n * @example\n * // different symbol — a ratio against another instrument (needs multiSymbol)\n * const spy = request.security({ symbol: \"AMEX:SPY\", interval: \"1D\" });\n * const qqq = request.security({ symbol: \"NASDAQ:QQQ\", interval: \"1D\" });\n * plot(spy.close.current / qqq.close.current, { title: \"SPY/QQQ\" });\n */\nfunction security(opts: RequestSecurityOpts): SecurityBar;\nfunction security(opts: RequestSecurityOpts, expr: SecurityExpr): Series<number>;\nfunction security(_opts: RequestSecurityOpts, _expr?: SecurityExpr): SecurityBar | Series<number> {\n return sentinel(\"request.security\");\n}\n\n/**\n * Read **lower**-timeframe bars contained by each main-stream bar. The\n * result is a `Series<ReadonlyArray<Bar>>` — for every main bar, the array\n * of finer-grained bars that fall inside it (an empty frozen array for\n * out-of-range or unsupported reads). The requested `interval` must be a\n * compile-time literal and **strictly lower** than the chart interval; an\n * equal-or-higher ordering is rejected at compile time with\n * `lower-tf-not-lower` when statically known. Like `request.security`, it\n * degrades to empty arrays when the adapter lacks\n * `Capabilities.multiTimeframe`. See the multi-timeframe guide for the\n * contained-bar model and interval format.\n *\n * @since 0.6\n * @stable\n * @example\n * // Each main bar carries the array of intrabar 30-second candles.\n * const intrabar = request.lowerTf({ interval: \"30s\" });\n * const count = intrabar.current.length;\n * void count;\n */\nfunction lowerTf(_opts: RequestLowerTfOpts): Series<ReadonlyArray<Bar>> {\n return sentinel(\"request.lowerTf\");\n}\n\n/**\n * `request.*` namespace for secondary timeframe reads. The compiler walks\n * `request.security(...)` calls to populate `manifest.requestedIntervals`;\n * the runtime replaces this callable hole with a slot-aware implementation\n * through `ComputeContext.request`.\n *\n * @since 0.4\n * @stable\n * @example\n * const ns: typeof request = request;\n * void ns;\n */\nexport const request = Object.freeze({ security, lowerTf });\n\n/**\n * Static type of the `request` namespace. Runtime implementations satisfy\n * this shape structurally when installed on `ComputeContext.request`.\n *\n * @since 0.4\n * @stable\n * @example\n * const ns: RequestNamespace = request;\n * void ns;\n */\nexport type RequestNamespace = typeof request;\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script-facing handle on a persistent, bounded **FIFO collection** —
|
|
3
|
+
* Pine's `var array<…>` with capacity eviction. Unlike {@link MutableSlot}
|
|
4
|
+
* (one value's history) or a `Series` (bar-indexed history), this is a
|
|
5
|
+
* **collection** you push many values into: `push` appends (evicting the
|
|
6
|
+
* oldest once `capacity` is reached), `get(n)` reads the `n`-th element from
|
|
7
|
+
* the newest (`n = 0`), `last()` is the newest, `size` is the current filled
|
|
8
|
+
* count, `capacity` is the fixed bound, and `clear()` empties it.
|
|
9
|
+
*
|
|
10
|
+
* The collection persists across bars with `state.*` committed/tentative
|
|
11
|
+
* semantics: pushes during a tick are tentative and discarded if a later
|
|
12
|
+
* tick replaces the head bar; on bar close they commit. `capacity` is a
|
|
13
|
+
* required compile-time numeric literal so the store is bounded and
|
|
14
|
+
* snapshot-clean.
|
|
15
|
+
*
|
|
16
|
+
* Out-of-range `get(n)` returns the element type's empty value (`NaN` for
|
|
17
|
+
* `number`); it never throws. This is **not** number-coercible — there is no
|
|
18
|
+
* `+a` / `valueOf`; it is a collection, not a value.
|
|
19
|
+
*
|
|
20
|
+
* @since 1.3
|
|
21
|
+
* @stable
|
|
22
|
+
* @example
|
|
23
|
+
* function rollingMean(a: MutableArraySlot<number>, x: number): number {
|
|
24
|
+
* a.push(x);
|
|
25
|
+
* let sum = 0;
|
|
26
|
+
* for (let i = 0; i < a.size; i++) sum += a.get(i);
|
|
27
|
+
* return sum / a.size;
|
|
28
|
+
* }
|
|
29
|
+
*/
|
|
30
|
+
export type MutableArraySlot<T> = {
|
|
31
|
+
push(value: T): void;
|
|
32
|
+
get(n: number): T;
|
|
33
|
+
last(): T;
|
|
34
|
+
clear(): void;
|
|
35
|
+
readonly size: number;
|
|
36
|
+
readonly capacity: number;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=arraySlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arraySlot.d.ts","sourceRoot":"","sources":["../../src/state/arraySlot.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAC9B,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACrB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;IAClB,IAAI,IAAI,CAAC,CAAC;IACV,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arraySlot.js","sourceRoot":"","sources":["../../src/state/arraySlot.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\n/**\n * Script-facing handle on a persistent, bounded **FIFO collection** —\n * Pine's `var array<…>` with capacity eviction. Unlike {@link MutableSlot}\n * (one value's history) or a `Series` (bar-indexed history), this is a\n * **collection** you push many values into: `push` appends (evicting the\n * oldest once `capacity` is reached), `get(n)` reads the `n`-th element from\n * the newest (`n = 0`), `last()` is the newest, `size` is the current filled\n * count, `capacity` is the fixed bound, and `clear()` empties it.\n *\n * The collection persists across bars with `state.*` committed/tentative\n * semantics: pushes during a tick are tentative and discarded if a later\n * tick replaces the head bar; on bar close they commit. `capacity` is a\n * required compile-time numeric literal so the store is bounded and\n * snapshot-clean.\n *\n * Out-of-range `get(n)` returns the element type's empty value (`NaN` for\n * `number`); it never throws. This is **not** number-coercible — there is no\n * `+a` / `valueOf`; it is a collection, not a value.\n *\n * @since 1.3\n * @stable\n * @example\n * function rollingMean(a: MutableArraySlot<number>, x: number): number {\n * a.push(x);\n * let sum = 0;\n * for (let i = 0; i < a.size; i++) sum += a.get(i);\n * return sum / a.size;\n * }\n */\nexport type MutableArraySlot<T> = {\n push(value: T): void;\n get(n: number): T;\n last(): T;\n clear(): void;\n readonly size: number;\n readonly capacity: number;\n};\n"]}
|
package/dist/state/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { state } from "./state.js";
|
|
2
2
|
export type { StateNamespace } from "./state.js";
|
|
3
|
+
export type { MutableArraySlot } from "./arraySlot.js";
|
|
3
4
|
export type { MutableSlot } from "./mutableSlot.js";
|
|
4
5
|
export type { RunnerSnapshot, StateSnapshot, StateStoreKey, StreamSnapshot, } from "./snapshot.js";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EACR,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,GACjB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EACR,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,GACjB,MAAM,eAAe,CAAC"}
|
package/dist/state/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nexport { state } from \"./state.js\";\nexport type { StateNamespace } from \"./state.js\";\nexport type { MutableSlot } from \"./mutableSlot.js\";\nexport type {\n RunnerSnapshot,\n StateSnapshot,\n StateStoreKey,\n StreamSnapshot,\n} from \"./snapshot.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nexport { state } from \"./state.js\";\nexport type { StateNamespace } from \"./state.js\";\nexport type { MutableArraySlot } from \"./arraySlot.js\";\nexport type { MutableSlot } from \"./mutableSlot.js\";\nexport type {\n RunnerSnapshot,\n StateSnapshot,\n StateStoreKey,\n StreamSnapshot,\n} from \"./snapshot.js\";\n"]}
|
package/dist/state/state.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NumberSeriesSlot } from "../types.js";
|
|
2
|
+
import type { MutableArraySlot } from "./arraySlot.js";
|
|
2
3
|
import type { MutableSlot } from "./mutableSlot.js";
|
|
3
4
|
/**
|
|
4
5
|
* Persistent state slots, Pine `var` semantics. Writes during a tick are
|
|
@@ -72,6 +73,24 @@ export declare const state: Readonly<{
|
|
|
72
73
|
* void fn;
|
|
73
74
|
*/
|
|
74
75
|
series(_init: number): NumberSeriesSlot;
|
|
76
|
+
/**
|
|
77
|
+
* Allocate or read a persistent **bounded collection** slot — a
|
|
78
|
+
* fixed-capacity FIFO ring you push values into across bars. `a.push(v)`
|
|
79
|
+
* appends (evicting the oldest once full); `a.get(n)` reads the `n`-th
|
|
80
|
+
* element from the newest; `a.last()` is the newest; `a.size` is the
|
|
81
|
+
* filled count; `a.capacity` is the bound; `a.clear()` empties it.
|
|
82
|
+
* `capacity` must be a compile-time numeric literal (the slot is bounded
|
|
83
|
+
* so it serializes). Unlike {@link state}.series (one value's bar-indexed
|
|
84
|
+
* history), this is a collection of many pushed values. v1 supports
|
|
85
|
+
* `number` element type.
|
|
86
|
+
*
|
|
87
|
+
* @since 1.3
|
|
88
|
+
* @stable
|
|
89
|
+
* @example
|
|
90
|
+
* const fn: typeof state.array = state.array;
|
|
91
|
+
* void fn;
|
|
92
|
+
*/
|
|
93
|
+
array<T>(_capacity: number): MutableArraySlot<T>;
|
|
75
94
|
/**
|
|
76
95
|
* Tick-persistent state slots, Pine `varip` semantics. Writes commit
|
|
77
96
|
* immediately, even during a tick.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAMpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;IACd;;;;;;;;OAQG;iBACU,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAIzC;;;;;;;;OAQG;eACQ,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAIvC;;;;;;;;OAQG;gBACS,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;IAI1C;;;;;;;;OAQG;kBACW,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAI1C;;;;;;;;;;;;;;OAcG;kBACW,MAAM,GAAG,gBAAgB;IAIvC;;;;;;;;;OASG;;qBAEc,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;mBAG9B,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;oBAG3B,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;sBAG5B,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;;EAIhD,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAMpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;IACd;;;;;;;;OAQG;iBACU,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAIzC;;;;;;;;OAQG;eACQ,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAIvC;;;;;;;;OAQG;gBACS,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;IAI1C;;;;;;;;OAQG;kBACW,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAI1C;;;;;;;;;;;;;;OAcG;kBACW,MAAM,GAAG,gBAAgB;IAIvC;;;;;;;;;;;;;;;;OAgBG;UACG,CAAC,aAAa,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC;IAIhD;;;;;;;;;OASG;;qBAEc,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;mBAG9B,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;oBAG3B,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;sBAG5B,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;;EAIhD,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,KAAK,CAAC"}
|
package/dist/state/state.js
CHANGED
|
@@ -85,6 +85,26 @@ export const state = Object.freeze({
|
|
|
85
85
|
series(_init) {
|
|
86
86
|
return sentinel("state.series");
|
|
87
87
|
},
|
|
88
|
+
/**
|
|
89
|
+
* Allocate or read a persistent **bounded collection** slot — a
|
|
90
|
+
* fixed-capacity FIFO ring you push values into across bars. `a.push(v)`
|
|
91
|
+
* appends (evicting the oldest once full); `a.get(n)` reads the `n`-th
|
|
92
|
+
* element from the newest; `a.last()` is the newest; `a.size` is the
|
|
93
|
+
* filled count; `a.capacity` is the bound; `a.clear()` empties it.
|
|
94
|
+
* `capacity` must be a compile-time numeric literal (the slot is bounded
|
|
95
|
+
* so it serializes). Unlike {@link state}.series (one value's bar-indexed
|
|
96
|
+
* history), this is a collection of many pushed values. v1 supports
|
|
97
|
+
* `number` element type.
|
|
98
|
+
*
|
|
99
|
+
* @since 1.3
|
|
100
|
+
* @stable
|
|
101
|
+
* @example
|
|
102
|
+
* const fn: typeof state.array = state.array;
|
|
103
|
+
* void fn;
|
|
104
|
+
*/
|
|
105
|
+
array(_capacity) {
|
|
106
|
+
return sentinel("state.array");
|
|
107
|
+
},
|
|
88
108
|
/**
|
|
89
109
|
* Tick-persistent state slots, Pine `varip` semantics. Writes commit
|
|
90
110
|
* immediately, even during a tick.
|
package/dist/state/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAM/D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAS,EAAE;IACrC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,uCAAuC,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/B;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAa;QACf,OAAO,QAAQ,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,KAAa;QACb,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,KAAc;QACf,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAa;QAChB,OAAO,QAAQ,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,KAAa;QAChB,OAAO,QAAQ,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAI,SAAiB;QACtB,OAAO,QAAQ,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;QAChB,KAAK,CAAC,KAAa;YACf,OAAO,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QACxC,CAAC;QACD,GAAG,CAAC,KAAa;YACb,OAAO,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,KAAc;YACf,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QACvC,CAAC;QACD,MAAM,CAAC,KAAa;YAChB,OAAO,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QACzC,CAAC;KACJ,CAAC;CACL,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type { NumberSeriesSlot } from \"../types.js\";\nimport type { MutableArraySlot } from \"./arraySlot.js\";\nimport type { MutableSlot } from \"./mutableSlot.js\";\n\nconst sentinel = (name: string): never => {\n throw new Error(`${name} called outside an active script step`);\n};\n\n/**\n * Persistent state slots, Pine `var` semantics. Writes during a tick are\n * tentative and discarded if a later tick replaces the head bar; on bar\n * close the tentative value commits. Reads return the active tentative\n * value for the current step.\n *\n * The runtime replaces this compile-time callable hole with a slot-aware\n * namespace through `ComputeContext.state`.\n *\n * @since 0.4\n * @stable\n * @example\n * const ns: typeof state = state;\n * void ns;\n */\nexport const state = Object.freeze({\n /**\n * Allocate or read a persistent number slot.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.float = state.float;\n * void fn;\n */\n float(_init: number): MutableSlot<number> {\n return sentinel(\"state.float\");\n },\n\n /**\n * Allocate or read a persistent integer slot.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.int = state.int;\n * void fn;\n */\n int(_init: number): MutableSlot<number> {\n return sentinel(\"state.int\");\n },\n\n /**\n * Allocate or read a persistent boolean slot.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.bool = state.bool;\n * void fn;\n */\n bool(_init: boolean): MutableSlot<boolean> {\n return sentinel(\"state.bool\");\n },\n\n /**\n * Allocate or read a persistent string slot.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.string = state.string;\n * void fn;\n */\n string(_init: string): MutableSlot<string> {\n return sentinel(\"state.string\");\n },\n\n /**\n * Allocate or read a persistent **series** slot — a writable, indexable\n * number history. `s.value = expr` writes the current bar's value;\n * `s[0]` / `s.current` / `+s` read it back, `s[1]` reads one bar ago.\n * The allocation bar's pre-write head is seeded with `init`; unwritten later\n * bars and out-of-range history reads are `NaN`. Unlike `state.float`, the\n * slot retains a bounded window of prior committed values (sized to the\n * script's deepest literal `s[n]` lookback).\n *\n * @since 1.3\n * @stable\n * @example\n * const fn: typeof state.series = state.series;\n * void fn;\n */\n series(_init: number): NumberSeriesSlot {\n return sentinel(\"state.series\");\n },\n\n /**\n * Allocate or read a persistent **bounded collection** slot — a\n * fixed-capacity FIFO ring you push values into across bars. `a.push(v)`\n * appends (evicting the oldest once full); `a.get(n)` reads the `n`-th\n * element from the newest; `a.last()` is the newest; `a.size` is the\n * filled count; `a.capacity` is the bound; `a.clear()` empties it.\n * `capacity` must be a compile-time numeric literal (the slot is bounded\n * so it serializes). Unlike {@link state}.series (one value's bar-indexed\n * history), this is a collection of many pushed values. v1 supports\n * `number` element type.\n *\n * @since 1.3\n * @stable\n * @example\n * const fn: typeof state.array = state.array;\n * void fn;\n */\n array<T>(_capacity: number): MutableArraySlot<T> {\n return sentinel(\"state.array\");\n },\n\n /**\n * Tick-persistent state slots, Pine `varip` semantics. Writes commit\n * immediately, even during a tick.\n *\n * @since 0.4\n * @stable\n * @example\n * const fn: typeof state.tick.float = state.tick.float;\n * void fn;\n */\n tick: Object.freeze({\n float(_init: number): MutableSlot<number> {\n return sentinel(\"state.tick.float\");\n },\n int(_init: number): MutableSlot<number> {\n return sentinel(\"state.tick.int\");\n },\n bool(_init: boolean): MutableSlot<boolean> {\n return sentinel(\"state.tick.bool\");\n },\n string(_init: string): MutableSlot<string> {\n return sentinel(\"state.tick.string\");\n },\n }),\n});\n\n/**\n * Static type of the `state` namespace. Runtime implementations satisfy\n * this shape structurally when they are installed on `ComputeContext.state`.\n *\n * @since 0.4\n * @stable\n * @example\n * const ns: StateNamespace = state;\n * void ns;\n */\nexport type StateNamespace = typeof state;\n"]}
|
|
@@ -33,7 +33,7 @@ export type StatefulPrimitiveEntry = Readonly<{
|
|
|
33
33
|
* logging/error as stateless loop-diagnostic entries plus `draw.table`
|
|
34
34
|
* as a slot-backed viewport drawing.
|
|
35
35
|
*
|
|
36
|
-
* Additive within `apiVersion: 1` (currently
|
|
36
|
+
* Additive within `apiVersion: 1` (currently 189 entries): new entries MAY
|
|
37
37
|
* be appended in a `1.x` release (a new call name is additive — new callsites
|
|
38
38
|
* only, no change to any existing script). Removing or renaming an entry, or
|
|
39
39
|
* flipping its `slot`, is a language change and requires `apiVersion: 2` — see
|
|
@@ -54,11 +54,11 @@ export declare const STATEFUL_PRIMITIVES: ReadonlySet<StatefulPrimitiveEntry>;
|
|
|
54
54
|
* Name → entry index of {@link STATEFUL_PRIMITIVES}. The compiler's
|
|
55
55
|
* `callsiteIdInjection` and `statefulCallInLoop` passes consult this map
|
|
56
56
|
* by callee name once per call site — O(1) lookup instead of an O(n) scan
|
|
57
|
-
* over the
|
|
57
|
+
* over the 179-entry set on every visited call. The map is derived from
|
|
58
58
|
* the same canonical entry list as {@link STATEFUL_PRIMITIVES} so adding
|
|
59
59
|
* a primitive to the set adds it here automatically.
|
|
60
60
|
*
|
|
61
|
-
* Additive within `apiVersion: 1` (currently
|
|
61
|
+
* Additive within `apiVersion: 1` (currently 189 entries): new entries MAY
|
|
62
62
|
* be appended in a `1.x` release (a new call name is additive — new callsites
|
|
63
63
|
* only, no change to any existing script). Removing or renaming an entry, or
|
|
64
64
|
* flipping its `slot`, is a language change and requires `apiVersion: 2` — see
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statefulPrimitives.d.ts","sourceRoot":"","sources":["../src/statefulPrimitives.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"statefulPrimitives.d.ts","sourceRoot":"","sources":["../src/statefulPrimitives.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAgN/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,sBAAsB,CAEnE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAGnB,CAAC"}
|
|
@@ -99,6 +99,11 @@ const STATEFUL_PRIMITIVE_ENTRIES = [
|
|
|
99
99
|
{ name: "ta.nz", slot: false },
|
|
100
100
|
{ name: "plot", slot: true },
|
|
101
101
|
{ name: "hline", slot: true },
|
|
102
|
+
// Pine-ergonomic aliases lowering to the `bg-color` / `bar-color` plot
|
|
103
|
+
// styles. Slot-injected like `plot`/`hline` so each callsite gets a
|
|
104
|
+
// stable slot id and is listed in `manifest.plots` with its kind.
|
|
105
|
+
{ name: "bgcolor", slot: true },
|
|
106
|
+
{ name: "barcolor", slot: true },
|
|
102
107
|
{ name: "alert", slot: true },
|
|
103
108
|
// Phase 3 — draw.* namespace. One entry per kind in DRAWING_KINDS
|
|
104
109
|
// order. Names are camelCase (`draw.<kindCamelCase>`); the wire
|
|
@@ -175,12 +180,27 @@ const STATEFUL_PRIMITIVE_ENTRIES = [
|
|
|
175
180
|
{ name: "state.tick.int", slot: true },
|
|
176
181
|
{ name: "state.tick.bool", slot: true },
|
|
177
182
|
{ name: "state.tick.string", slot: true },
|
|
183
|
+
{ name: "state.array", slot: true },
|
|
178
184
|
// Both the data form `request.security({ interval })` and the expression
|
|
179
185
|
// form `request.security({ interval }, (bar) => …)` route through this one
|
|
180
186
|
// entry: `slot: true` injects the slot id as the first argument regardless
|
|
181
187
|
// of the optional second (callback) argument.
|
|
182
188
|
{ name: "request.security", slot: true },
|
|
183
189
|
{ name: "request.lowerTf", slot: true },
|
|
190
|
+
// Calendar / session accessors — stateless (slot: false). Like `ta.nz`,
|
|
191
|
+
// they ride the registry for the `stateful-call-inside-loop` diagnostic
|
|
192
|
+
// (Pine-parity) but take NO injected slot id: the runtime function
|
|
193
|
+
// receives the author's arguments directly.
|
|
194
|
+
{ name: "time.year", slot: false },
|
|
195
|
+
{ name: "time.month", slot: false },
|
|
196
|
+
{ name: "time.dayofmonth", slot: false },
|
|
197
|
+
{ name: "time.dayofweek", slot: false },
|
|
198
|
+
{ name: "time.hour", slot: false },
|
|
199
|
+
{ name: "time.minute", slot: false },
|
|
200
|
+
{ name: "time.second", slot: false },
|
|
201
|
+
{ name: "time.timestamp", slot: false },
|
|
202
|
+
{ name: "time.timeClose", slot: false },
|
|
203
|
+
{ name: "session.isOpen", slot: false },
|
|
184
204
|
{ name: "defineAlertCondition.signal", slot: false },
|
|
185
205
|
{ name: "runtime.log", slot: false },
|
|
186
206
|
{ name: "runtime.error", slot: false },
|
|
@@ -204,7 +224,7 @@ const STATEFUL_PRIMITIVE_ENTRIES = [
|
|
|
204
224
|
* logging/error as stateless loop-diagnostic entries plus `draw.table`
|
|
205
225
|
* as a slot-backed viewport drawing.
|
|
206
226
|
*
|
|
207
|
-
* Additive within `apiVersion: 1` (currently
|
|
227
|
+
* Additive within `apiVersion: 1` (currently 189 entries): new entries MAY
|
|
208
228
|
* be appended in a `1.x` release (a new call name is additive — new callsites
|
|
209
229
|
* only, no change to any existing script). Removing or renaming an entry, or
|
|
210
230
|
* flipping its `slot`, is a language change and requires `apiVersion: 2` — see
|
|
@@ -225,11 +245,11 @@ export const STATEFUL_PRIMITIVES = Object.freeze(new Set(STATEFUL_PRIMITIVE_ENTR
|
|
|
225
245
|
* Name → entry index of {@link STATEFUL_PRIMITIVES}. The compiler's
|
|
226
246
|
* `callsiteIdInjection` and `statefulCallInLoop` passes consult this map
|
|
227
247
|
* by callee name once per call site — O(1) lookup instead of an O(n) scan
|
|
228
|
-
* over the
|
|
248
|
+
* over the 179-entry set on every visited call. The map is derived from
|
|
229
249
|
* the same canonical entry list as {@link STATEFUL_PRIMITIVES} so adding
|
|
230
250
|
* a primitive to the set adds it here automatically.
|
|
231
251
|
*
|
|
232
|
-
* Additive within `apiVersion: 1` (currently
|
|
252
|
+
* Additive within `apiVersion: 1` (currently 189 entries): new entries MAY
|
|
233
253
|
* be appended in a `1.x` release (a new call name is additive — new callsites
|
|
234
254
|
* only, no change to any existing script). Removing or renaming an entry, or
|
|
235
255
|
* flipping its `slot`, is a language change and requires `apiVersion: 2` — see
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statefulPrimitives.js","sourceRoot":"","sources":["../src/statefulPrimitives.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAgB/D,MAAM,0BAA0B,GAA0C;IACtE,EAAE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AI,GAAG,CAAyB,0BAA0B,CAAC,CAC9D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAgD,IAAI,GAAG,CAG7F,0BAA0B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\n/**\n * Per-entry shape of {@link STATEFUL_PRIMITIVES}. `name` is the\n * fully-qualified call (`ta.ema`, `plot`, `hline`, `alert`); `slot`\n * is `true` for every primitive whose call site needs a compiler-\n * injected slot id, `false` for the stateless helpers that ride along\n * in the set for in-loop diagnostics (currently only `ta.nz`).\n *\n * @since 0.1\n * @stable\n * @example\n * const entry: StatefulPrimitiveEntry = { name: \"ta.nz\", slot: false };\n */\nexport type StatefulPrimitiveEntry = Readonly<{ name: string; slot: boolean }>;\n\nconst STATEFUL_PRIMITIVE_ENTRIES: ReadonlyArray<StatefulPrimitiveEntry> = [\n { name: \"ta.sma\", slot: true },\n { name: \"ta.ema\", slot: true },\n { name: \"ta.stdev\", slot: true },\n { name: \"ta.bb\", slot: true },\n { name: \"ta.rsi\", slot: true },\n { name: \"ta.macd\", slot: true },\n { name: \"ta.atr\", slot: true },\n { name: \"ta.crossover\", slot: true },\n { name: \"ta.crossunder\", slot: true },\n { name: \"ta.highest\", slot: true },\n { name: \"ta.lowest\", slot: true },\n { name: \"ta.highestbars\", slot: true },\n { name: \"ta.lowestbars\", slot: true },\n { name: \"ta.change\", slot: true },\n { name: \"ta.valuewhen\", slot: true },\n { name: \"ta.barssince\", slot: true },\n { name: \"ta.wma\", slot: true },\n { name: \"ta.vwma\", slot: true },\n { name: \"ta.hma\", slot: true },\n { name: \"ta.smma\", slot: true },\n { name: \"ta.dema\", slot: true },\n { name: \"ta.tema\", slot: true },\n { name: \"ta.kama\", slot: true },\n { name: \"ta.alma\", slot: true },\n { name: \"ta.lsma\", slot: true },\n { name: \"ta.mcginley\", slot: true },\n { name: \"ta.maRibbon\", slot: true },\n { name: \"ta.cci\", slot: true },\n { name: \"ta.stoch\", slot: true },\n { name: \"ta.williamsR\", slot: true },\n { name: \"ta.stochRsi\", slot: true },\n { name: \"ta.ultimateOsc\", slot: true },\n { name: \"ta.coppock\", slot: true },\n { name: \"ta.ppo\", slot: true },\n { name: \"ta.dpo\", slot: true },\n { name: \"ta.connorsRsi\", slot: true },\n { name: \"ta.kst\", slot: true },\n { name: \"ta.fisher\", slot: true },\n { name: \"ta.klinger\", slot: true },\n { name: \"ta.rvgi\", slot: true },\n { name: \"ta.ao\", slot: true },\n { name: \"ta.cmo\", slot: true },\n { name: \"ta.momentum\", slot: true },\n { name: \"ta.roc\", slot: true },\n { name: \"ta.pmo\", slot: true },\n { name: \"ta.smi\", slot: true },\n { name: \"ta.tsi\", slot: true },\n { name: \"ta.aroon\", slot: true },\n { name: \"ta.aroonOsc\", slot: true },\n { name: \"ta.adx\", slot: true },\n { name: \"ta.dmi\", slot: true },\n { name: \"ta.trix\", slot: true },\n { name: \"ta.vortex\", slot: true },\n { name: \"ta.trendStrengthIndex\", slot: true },\n { name: \"ta.ichimoku\", slot: true },\n { name: \"ta.vol\", slot: true },\n { name: \"ta.vwap\", slot: true },\n { name: \"ta.anchoredVwap\", slot: true },\n { name: \"ta.obv\", slot: true },\n { name: \"ta.adl\", slot: true },\n { name: \"ta.bop\", slot: true },\n { name: \"ta.cmf\", slot: true },\n { name: \"ta.chaikinOsc\", slot: true },\n { name: \"ta.mfi\", slot: true },\n { name: \"ta.netVolume\", slot: true },\n { name: \"ta.pvo\", slot: true },\n { name: \"ta.pvt\", slot: true },\n { name: \"ta.eom\", slot: true },\n { name: \"ta.nvi\", slot: true },\n { name: \"ta.pvi\", slot: true },\n { name: \"ta.visibleRangeVolumeProfile\", slot: true },\n { name: \"ta.anchoredVolumeProfile\", slot: true },\n { name: \"ta.sessionVolumeProfile\", slot: true },\n { name: \"ta.fixedRangeVolumeProfile\", slot: true },\n { name: \"ta.median\", slot: true },\n { name: \"ta.adr\", slot: true },\n { name: \"ta.ulcerIndex\", slot: true },\n { name: \"ta.bbPercentB\", slot: true },\n { name: \"ta.bbw\", slot: true },\n { name: \"ta.donchian\", slot: true },\n { name: \"ta.keltner\", slot: true },\n { name: \"ta.envelope\", slot: true },\n { name: \"ta.chop\", slot: true },\n { name: \"ta.historicalVolatility\", slot: true },\n { name: \"ta.rvi\", slot: true },\n { name: \"ta.massIndex\", slot: true },\n { name: \"ta.psar\", slot: true },\n { name: \"ta.supertrend\", slot: true },\n { name: \"ta.chandelier\", slot: true },\n { name: \"ta.chandeKrollStop\", slot: true },\n { name: \"ta.williamsFractal\", slot: true },\n { name: \"ta.zigZag\", slot: true },\n { name: \"ta.pivotsHighLow\", slot: true },\n { name: \"ta.pivotsStandard\", slot: true },\n { name: \"ta.volatilityStop\", slot: true },\n { name: \"ta.nz\", slot: false },\n { name: \"plot\", slot: true },\n { name: \"hline\", slot: true },\n { name: \"alert\", slot: true },\n // Phase 3 — draw.* namespace. One entry per kind in DRAWING_KINDS\n // order. Names are camelCase (`draw.<kindCamelCase>`); the wire\n // format keeps the kebab-case `DrawingKind`.\n { name: \"draw.line\", slot: true },\n { name: \"draw.horizontalLine\", slot: true },\n { name: \"draw.horizontalRay\", slot: true },\n { name: \"draw.verticalLine\", slot: true },\n { name: \"draw.crossLine\", slot: true },\n { name: \"draw.trendAngle\", slot: true },\n { name: \"draw.rectangle\", slot: true },\n { name: \"draw.rotatedRectangle\", slot: true },\n { name: \"draw.triangle\", slot: true },\n { name: \"draw.polyline\", slot: true },\n { name: \"draw.circle\", slot: true },\n { name: \"draw.ellipse\", slot: true },\n { name: \"draw.path\", slot: true },\n { name: \"draw.fillBetween\", slot: true },\n { name: \"draw.marker\", slot: true },\n { name: \"draw.arc\", slot: true },\n { name: \"draw.curve\", slot: true },\n { name: \"draw.doubleCurve\", slot: true },\n { name: \"draw.pen\", slot: true },\n { name: \"draw.highlighter\", slot: true },\n { name: \"draw.brush\", slot: true },\n { name: \"draw.text\", slot: true },\n { name: \"draw.arrow\", slot: true },\n { name: \"draw.arrowMarker\", slot: true },\n { name: \"draw.arrowMarkUp\", slot: true },\n { name: \"draw.arrowMarkDown\", slot: true },\n { name: \"draw.trendChannel\", slot: true },\n { name: \"draw.flatTopBottom\", slot: true },\n { name: \"draw.disjointChannel\", slot: true },\n { name: \"draw.regressionTrend\", slot: true },\n { name: \"draw.fibRetracement\", slot: true },\n { name: \"draw.fibTrendExtension\", slot: true },\n { name: \"draw.fibChannel\", slot: true },\n { name: \"draw.fibTimeZone\", slot: true },\n { name: \"draw.fibWedge\", slot: true },\n { name: \"draw.fibSpeedFan\", slot: true },\n { name: \"draw.fibSpeedArcs\", slot: true },\n { name: \"draw.fibSpiral\", slot: true },\n { name: \"draw.fibCircles\", slot: true },\n { name: \"draw.fibTrendTime\", slot: true },\n { name: \"draw.gannBox\", slot: true },\n { name: \"draw.gannSquareFixed\", slot: true },\n { name: \"draw.gannSquare\", slot: true },\n { name: \"draw.gannFan\", slot: true },\n { name: \"draw.pitchfork\", slot: true },\n { name: \"draw.pitchfan\", slot: true },\n { name: \"draw.xabcdPattern\", slot: true },\n { name: \"draw.cypherPattern\", slot: true },\n { name: \"draw.headAndShoulders\", slot: true },\n { name: \"draw.abcdPattern\", slot: true },\n { name: \"draw.trianglePattern\", slot: true },\n { name: \"draw.threeDrivesPattern\", slot: true },\n { name: \"draw.elliottImpulseWave\", slot: true },\n { name: \"draw.elliottCorrectionWave\", slot: true },\n { name: \"draw.elliottTriangleWave\", slot: true },\n { name: \"draw.elliottDoubleCombo\", slot: true },\n { name: \"draw.elliottTripleCombo\", slot: true },\n { name: \"draw.cyclicLines\", slot: true },\n { name: \"draw.timeCycles\", slot: true },\n { name: \"draw.sineLine\", slot: true },\n { name: \"draw.group\", slot: true },\n { name: \"draw.frame\", slot: true },\n { name: \"draw.table\", slot: true },\n { name: \"state.float\", slot: true },\n { name: \"state.int\", slot: true },\n { name: \"state.bool\", slot: true },\n { name: \"state.string\", slot: true },\n { name: \"state.series\", slot: true },\n { name: \"state.tick.float\", slot: true },\n { name: \"state.tick.int\", slot: true },\n { name: \"state.tick.bool\", slot: true },\n { name: \"state.tick.string\", slot: true },\n // Both the data form `request.security({ interval })` and the expression\n // form `request.security({ interval }, (bar) => …)` route through this one\n // entry: `slot: true` injects the slot id as the first argument regardless\n // of the optional second (callback) argument.\n { name: \"request.security\", slot: true },\n { name: \"request.lowerTf\", slot: true },\n { name: \"defineAlertCondition.signal\", slot: false },\n { name: \"runtime.log\", slot: false },\n { name: \"runtime.error\", slot: false },\n];\n\n/**\n * Frozen set of every fully-qualified call name the compiler tracks for\n * static-analysis (`stateful-call-inside-loop`) and slot-id injection\n *. Each entry carries a `slot` flag: `slot: true`\n * primitives allocate per-callsite hidden state and get a string-literal\n * slot id injected as their first argument; `slot: false` primitives are\n * pure helpers that ride along in the set because Pine still forbids\n * them inside loops (e.g. `ta.nz`).\n *\n * Phase 1 shipped 12 `slot: true` entries. Phase 2 widens the shape to\n * `{ name, slot }` so `ta.nz` (the only stateless Phase-2 cross-functional\n * primitive) can opt out of slot-id injection without losing the\n * in-loop diagnostic. Subsequent Phase-2 batch tasks (Tasks 6–28) each\n * append `slot: true` entries; Phase 3 appends 61 `draw.<camelKind>`\n * entries (all `slot: true`), and Phase 4 appends 8 `state.*` /\n * `state.tick.*` entries plus request primitives. Phase 5 appends alert-condition signalling plus runtime\n * logging/error as stateless loop-diagnostic entries plus `draw.table`\n * as a slot-backed viewport drawing.\n *\n * Additive within `apiVersion: 1` (currently 176 entries): new entries MAY\n * be appended in a `1.x` release (a new call name is additive — new callsites\n * only, no change to any existing script). Removing or renaming an entry, or\n * flipping its `slot`, is a language change and requires `apiVersion: 2` — see\n * `docs/spec/versioning.md`.\n *\n * @since 0.1\n * @stable\n * @example\n * import { STATEFUL_PRIMITIVES } from \"@invinite-org/chartlang-core\";\n * for (const entry of STATEFUL_PRIMITIVES) {\n * if (entry.name === \"ta.ema\" && entry.slot) {\n * // compiler injects an id here\n * }\n * }\n */\nexport const STATEFUL_PRIMITIVES: ReadonlySet<StatefulPrimitiveEntry> = Object.freeze(\n new Set<StatefulPrimitiveEntry>(STATEFUL_PRIMITIVE_ENTRIES),\n);\n\n/**\n * Name → entry index of {@link STATEFUL_PRIMITIVES}. The compiler's\n * `callsiteIdInjection` and `statefulCallInLoop` passes consult this map\n * by callee name once per call site — O(1) lookup instead of an O(n) scan\n * over the 176-entry set on every visited call. The map is derived from\n * the same canonical entry list as {@link STATEFUL_PRIMITIVES} so adding\n * a primitive to the set adds it here automatically.\n *\n * Additive within `apiVersion: 1` (currently 176 entries): new entries MAY\n * be appended in a `1.x` release (a new call name is additive — new callsites\n * only, no change to any existing script). Removing or renaming an entry, or\n * flipping its `slot`, is a language change and requires `apiVersion: 2` — see\n * `docs/spec/versioning.md`.\n *\n * @since 0.2\n * @stable\n * @example\n * import { STATEFUL_PRIMITIVES_BY_NAME } from \"@invinite-org/chartlang-core\";\n * const entry = STATEFUL_PRIMITIVES_BY_NAME.get(\"ta.ema\");\n * // entry is { name: \"ta.ema\", slot: true } | undefined\n */\nexport const STATEFUL_PRIMITIVES_BY_NAME: ReadonlyMap<string, StatefulPrimitiveEntry> = new Map<\n string,\n StatefulPrimitiveEntry\n>(STATEFUL_PRIMITIVE_ENTRIES.map((entry) => [entry.name, entry]));\n"]}
|
|
1
|
+
{"version":3,"file":"statefulPrimitives.js","sourceRoot":"","sources":["../src/statefulPrimitives.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAgB/D,MAAM,0BAA0B,GAA0C;IACtE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9B,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9B,EAAE,IAAI,EAAE,UA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,KAAK,EAAE;IACxC,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE;IACvC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE;IAClC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE;IACpC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE;IACpC,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE;IACvC,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE;IACvC,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE;IACvC,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,EAAE,KAAK,EAAE;IACpD,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE;IACpC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE;CACzC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAwC,MAAM,CAAC,MAAM,CACjF,IAAI,GAAG,CAAyB,0BAA0B,CAAC,CAC9D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAgD,IAAI,GAAG,CAG7F,0BAA0B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\n/**\n * Per-entry shape of {@link STATEFUL_PRIMITIVES}. `name` is the\n * fully-qualified call (`ta.ema`, `plot`, `hline`, `alert`); `slot`\n * is `true` for every primitive whose call site needs a compiler-\n * injected slot id, `false` for the stateless helpers that ride along\n * in the set for in-loop diagnostics (currently only `ta.nz`).\n *\n * @since 0.1\n * @stable\n * @example\n * const entry: StatefulPrimitiveEntry = { name: \"ta.nz\", slot: false };\n */\nexport type StatefulPrimitiveEntry = Readonly<{ name: string; slot: boolean }>;\n\nconst STATEFUL_PRIMITIVE_ENTRIES: ReadonlyArray<StatefulPrimitiveEntry> = [\n { name: \"ta.sma\", slot: true },\n { name: \"ta.ema\", slot: true },\n { name: \"ta.stdev\", slot: true },\n { name: \"ta.bb\", slot: true },\n { name: \"ta.rsi\", slot: true },\n { name: \"ta.macd\", slot: true },\n { name: \"ta.atr\", slot: true },\n { name: \"ta.crossover\", slot: true },\n { name: \"ta.crossunder\", slot: true },\n { name: \"ta.highest\", slot: true },\n { name: \"ta.lowest\", slot: true },\n { name: \"ta.highestbars\", slot: true },\n { name: \"ta.lowestbars\", slot: true },\n { name: \"ta.change\", slot: true },\n { name: \"ta.valuewhen\", slot: true },\n { name: \"ta.barssince\", slot: true },\n { name: \"ta.wma\", slot: true },\n { name: \"ta.vwma\", slot: true },\n { name: \"ta.hma\", slot: true },\n { name: \"ta.smma\", slot: true },\n { name: \"ta.dema\", slot: true },\n { name: \"ta.tema\", slot: true },\n { name: \"ta.kama\", slot: true },\n { name: \"ta.alma\", slot: true },\n { name: \"ta.lsma\", slot: true },\n { name: \"ta.mcginley\", slot: true },\n { name: \"ta.maRibbon\", slot: true },\n { name: \"ta.cci\", slot: true },\n { name: \"ta.stoch\", slot: true },\n { name: \"ta.williamsR\", slot: true },\n { name: \"ta.stochRsi\", slot: true },\n { name: \"ta.ultimateOsc\", slot: true },\n { name: \"ta.coppock\", slot: true },\n { name: \"ta.ppo\", slot: true },\n { name: \"ta.dpo\", slot: true },\n { name: \"ta.connorsRsi\", slot: true },\n { name: \"ta.kst\", slot: true },\n { name: \"ta.fisher\", slot: true },\n { name: \"ta.klinger\", slot: true },\n { name: \"ta.rvgi\", slot: true },\n { name: \"ta.ao\", slot: true },\n { name: \"ta.cmo\", slot: true },\n { name: \"ta.momentum\", slot: true },\n { name: \"ta.roc\", slot: true },\n { name: \"ta.pmo\", slot: true },\n { name: \"ta.smi\", slot: true },\n { name: \"ta.tsi\", slot: true },\n { name: \"ta.aroon\", slot: true },\n { name: \"ta.aroonOsc\", slot: true },\n { name: \"ta.adx\", slot: true },\n { name: \"ta.dmi\", slot: true },\n { name: \"ta.trix\", slot: true },\n { name: \"ta.vortex\", slot: true },\n { name: \"ta.trendStrengthIndex\", slot: true },\n { name: \"ta.ichimoku\", slot: true },\n { name: \"ta.vol\", slot: true },\n { name: \"ta.vwap\", slot: true },\n { name: \"ta.anchoredVwap\", slot: true },\n { name: \"ta.obv\", slot: true },\n { name: \"ta.adl\", slot: true },\n { name: \"ta.bop\", slot: true },\n { name: \"ta.cmf\", slot: true },\n { name: \"ta.chaikinOsc\", slot: true },\n { name: \"ta.mfi\", slot: true },\n { name: \"ta.netVolume\", slot: true },\n { name: \"ta.pvo\", slot: true },\n { name: \"ta.pvt\", slot: true },\n { name: \"ta.eom\", slot: true },\n { name: \"ta.nvi\", slot: true },\n { name: \"ta.pvi\", slot: true },\n { name: \"ta.visibleRangeVolumeProfile\", slot: true },\n { name: \"ta.anchoredVolumeProfile\", slot: true },\n { name: \"ta.sessionVolumeProfile\", slot: true },\n { name: \"ta.fixedRangeVolumeProfile\", slot: true },\n { name: \"ta.median\", slot: true },\n { name: \"ta.adr\", slot: true },\n { name: \"ta.ulcerIndex\", slot: true },\n { name: \"ta.bbPercentB\", slot: true },\n { name: \"ta.bbw\", slot: true },\n { name: \"ta.donchian\", slot: true },\n { name: \"ta.keltner\", slot: true },\n { name: \"ta.envelope\", slot: true },\n { name: \"ta.chop\", slot: true },\n { name: \"ta.historicalVolatility\", slot: true },\n { name: \"ta.rvi\", slot: true },\n { name: \"ta.massIndex\", slot: true },\n { name: \"ta.psar\", slot: true },\n { name: \"ta.supertrend\", slot: true },\n { name: \"ta.chandelier\", slot: true },\n { name: \"ta.chandeKrollStop\", slot: true },\n { name: \"ta.williamsFractal\", slot: true },\n { name: \"ta.zigZag\", slot: true },\n { name: \"ta.pivotsHighLow\", slot: true },\n { name: \"ta.pivotsStandard\", slot: true },\n { name: \"ta.volatilityStop\", slot: true },\n { name: \"ta.nz\", slot: false },\n { name: \"plot\", slot: true },\n { name: \"hline\", slot: true },\n // Pine-ergonomic aliases lowering to the `bg-color` / `bar-color` plot\n // styles. Slot-injected like `plot`/`hline` so each callsite gets a\n // stable slot id and is listed in `manifest.plots` with its kind.\n { name: \"bgcolor\", slot: true },\n { name: \"barcolor\", slot: true },\n { name: \"alert\", slot: true },\n // Phase 3 — draw.* namespace. One entry per kind in DRAWING_KINDS\n // order. Names are camelCase (`draw.<kindCamelCase>`); the wire\n // format keeps the kebab-case `DrawingKind`.\n { name: \"draw.line\", slot: true },\n { name: \"draw.horizontalLine\", slot: true },\n { name: \"draw.horizontalRay\", slot: true },\n { name: \"draw.verticalLine\", slot: true },\n { name: \"draw.crossLine\", slot: true },\n { name: \"draw.trendAngle\", slot: true },\n { name: \"draw.rectangle\", slot: true },\n { name: \"draw.rotatedRectangle\", slot: true },\n { name: \"draw.triangle\", slot: true },\n { name: \"draw.polyline\", slot: true },\n { name: \"draw.circle\", slot: true },\n { name: \"draw.ellipse\", slot: true },\n { name: \"draw.path\", slot: true },\n { name: \"draw.fillBetween\", slot: true },\n { name: \"draw.marker\", slot: true },\n { name: \"draw.arc\", slot: true },\n { name: \"draw.curve\", slot: true },\n { name: \"draw.doubleCurve\", slot: true },\n { name: \"draw.pen\", slot: true },\n { name: \"draw.highlighter\", slot: true },\n { name: \"draw.brush\", slot: true },\n { name: \"draw.text\", slot: true },\n { name: \"draw.arrow\", slot: true },\n { name: \"draw.arrowMarker\", slot: true },\n { name: \"draw.arrowMarkUp\", slot: true },\n { name: \"draw.arrowMarkDown\", slot: true },\n { name: \"draw.trendChannel\", slot: true },\n { name: \"draw.flatTopBottom\", slot: true },\n { name: \"draw.disjointChannel\", slot: true },\n { name: \"draw.regressionTrend\", slot: true },\n { name: \"draw.fibRetracement\", slot: true },\n { name: \"draw.fibTrendExtension\", slot: true },\n { name: \"draw.fibChannel\", slot: true },\n { name: \"draw.fibTimeZone\", slot: true },\n { name: \"draw.fibWedge\", slot: true },\n { name: \"draw.fibSpeedFan\", slot: true },\n { name: \"draw.fibSpeedArcs\", slot: true },\n { name: \"draw.fibSpiral\", slot: true },\n { name: \"draw.fibCircles\", slot: true },\n { name: \"draw.fibTrendTime\", slot: true },\n { name: \"draw.gannBox\", slot: true },\n { name: \"draw.gannSquareFixed\", slot: true },\n { name: \"draw.gannSquare\", slot: true },\n { name: \"draw.gannFan\", slot: true },\n { name: \"draw.pitchfork\", slot: true },\n { name: \"draw.pitchfan\", slot: true },\n { name: \"draw.xabcdPattern\", slot: true },\n { name: \"draw.cypherPattern\", slot: true },\n { name: \"draw.headAndShoulders\", slot: true },\n { name: \"draw.abcdPattern\", slot: true },\n { name: \"draw.trianglePattern\", slot: true },\n { name: \"draw.threeDrivesPattern\", slot: true },\n { name: \"draw.elliottImpulseWave\", slot: true },\n { name: \"draw.elliottCorrectionWave\", slot: true },\n { name: \"draw.elliottTriangleWave\", slot: true },\n { name: \"draw.elliottDoubleCombo\", slot: true },\n { name: \"draw.elliottTripleCombo\", slot: true },\n { name: \"draw.cyclicLines\", slot: true },\n { name: \"draw.timeCycles\", slot: true },\n { name: \"draw.sineLine\", slot: true },\n { name: \"draw.group\", slot: true },\n { name: \"draw.frame\", slot: true },\n { name: \"draw.table\", slot: true },\n { name: \"state.float\", slot: true },\n { name: \"state.int\", slot: true },\n { name: \"state.bool\", slot: true },\n { name: \"state.string\", slot: true },\n { name: \"state.series\", slot: true },\n { name: \"state.tick.float\", slot: true },\n { name: \"state.tick.int\", slot: true },\n { name: \"state.tick.bool\", slot: true },\n { name: \"state.tick.string\", slot: true },\n { name: \"state.array\", slot: true },\n // Both the data form `request.security({ interval })` and the expression\n // form `request.security({ interval }, (bar) => …)` route through this one\n // entry: `slot: true` injects the slot id as the first argument regardless\n // of the optional second (callback) argument.\n { name: \"request.security\", slot: true },\n { name: \"request.lowerTf\", slot: true },\n // Calendar / session accessors — stateless (slot: false). Like `ta.nz`,\n // they ride the registry for the `stateful-call-inside-loop` diagnostic\n // (Pine-parity) but take NO injected slot id: the runtime function\n // receives the author's arguments directly.\n { name: \"time.year\", slot: false },\n { name: \"time.month\", slot: false },\n { name: \"time.dayofmonth\", slot: false },\n { name: \"time.dayofweek\", slot: false },\n { name: \"time.hour\", slot: false },\n { name: \"time.minute\", slot: false },\n { name: \"time.second\", slot: false },\n { name: \"time.timestamp\", slot: false },\n { name: \"time.timeClose\", slot: false },\n { name: \"session.isOpen\", slot: false },\n { name: \"defineAlertCondition.signal\", slot: false },\n { name: \"runtime.log\", slot: false },\n { name: \"runtime.error\", slot: false },\n];\n\n/**\n * Frozen set of every fully-qualified call name the compiler tracks for\n * static-analysis (`stateful-call-inside-loop`) and slot-id injection\n *. Each entry carries a `slot` flag: `slot: true`\n * primitives allocate per-callsite hidden state and get a string-literal\n * slot id injected as their first argument; `slot: false` primitives are\n * pure helpers that ride along in the set because Pine still forbids\n * them inside loops (e.g. `ta.nz`).\n *\n * Phase 1 shipped 12 `slot: true` entries. Phase 2 widens the shape to\n * `{ name, slot }` so `ta.nz` (the only stateless Phase-2 cross-functional\n * primitive) can opt out of slot-id injection without losing the\n * in-loop diagnostic. Subsequent Phase-2 batch tasks (Tasks 6–28) each\n * append `slot: true` entries; Phase 3 appends 61 `draw.<camelKind>`\n * entries (all `slot: true`), and Phase 4 appends 8 `state.*` /\n * `state.tick.*` entries plus request primitives. Phase 5 appends alert-condition signalling plus runtime\n * logging/error as stateless loop-diagnostic entries plus `draw.table`\n * as a slot-backed viewport drawing.\n *\n * Additive within `apiVersion: 1` (currently 189 entries): new entries MAY\n * be appended in a `1.x` release (a new call name is additive — new callsites\n * only, no change to any existing script). Removing or renaming an entry, or\n * flipping its `slot`, is a language change and requires `apiVersion: 2` — see\n * `docs/spec/versioning.md`.\n *\n * @since 0.1\n * @stable\n * @example\n * import { STATEFUL_PRIMITIVES } from \"@invinite-org/chartlang-core\";\n * for (const entry of STATEFUL_PRIMITIVES) {\n * if (entry.name === \"ta.ema\" && entry.slot) {\n * // compiler injects an id here\n * }\n * }\n */\nexport const STATEFUL_PRIMITIVES: ReadonlySet<StatefulPrimitiveEntry> = Object.freeze(\n new Set<StatefulPrimitiveEntry>(STATEFUL_PRIMITIVE_ENTRIES),\n);\n\n/**\n * Name → entry index of {@link STATEFUL_PRIMITIVES}. The compiler's\n * `callsiteIdInjection` and `statefulCallInLoop` passes consult this map\n * by callee name once per call site — O(1) lookup instead of an O(n) scan\n * over the 179-entry set on every visited call. The map is derived from\n * the same canonical entry list as {@link STATEFUL_PRIMITIVES} so adding\n * a primitive to the set adds it here automatically.\n *\n * Additive within `apiVersion: 1` (currently 189 entries): new entries MAY\n * be appended in a `1.x` release (a new call name is additive — new callsites\n * only, no change to any existing script). Removing or renaming an entry, or\n * flipping its `slot`, is a language change and requires `apiVersion: 2` — see\n * `docs/spec/versioning.md`.\n *\n * @since 0.2\n * @stable\n * @example\n * import { STATEFUL_PRIMITIVES_BY_NAME } from \"@invinite-org/chartlang-core\";\n * const entry = STATEFUL_PRIMITIVES_BY_NAME.get(\"ta.ema\");\n * // entry is { name: \"ta.ema\", slot: true } | undefined\n */\nexport const STATEFUL_PRIMITIVES_BY_NAME: ReadonlyMap<string, StatefulPrimitiveEntry> = new Map<\n string,\n StatefulPrimitiveEntry\n>(STATEFUL_PRIMITIVE_ENTRIES.map((entry) => [entry.name, entry]));\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/time-accessors/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|