@forgecharts/sdk 1.1.32 → 1.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/api/IndicatorDAG.d.ts +2 -0
  2. package/dist/api/IndicatorDAG.d.ts.map +1 -1
  3. package/dist/api/TChart.d.ts +13 -0
  4. package/dist/api/TChart.d.ts.map +1 -1
  5. package/dist/api/drawingUtils.d.ts +6 -0
  6. package/dist/api/drawingUtils.d.ts.map +1 -1
  7. package/dist/core/Chart.d.ts +30 -1
  8. package/dist/core/Chart.d.ts.map +1 -1
  9. package/dist/core/Crosshair.d.ts.map +1 -1
  10. package/dist/core/InteractionManager.d.ts +16 -1
  11. package/dist/core/InteractionManager.d.ts.map +1 -1
  12. package/dist/core/TimeScale.d.ts.map +1 -1
  13. package/dist/datafeed/DatafeedConnector.d.ts.map +1 -1
  14. package/dist/forgecharts.css +4143 -0
  15. package/dist/{tscript/TScriptIndicator.d.ts → forgescript/ForgeScriptIndicator.d.ts} +19 -5
  16. package/dist/forgescript/ForgeScriptIndicator.d.ts.map +1 -0
  17. package/dist/forgescript/ForgeScriptTypes.d.ts +89 -0
  18. package/dist/forgescript/ForgeScriptTypes.d.ts.map +1 -0
  19. package/dist/forgescript/__tests__/ai-response-parser.test.d.ts +2 -0
  20. package/dist/forgescript/__tests__/ai-response-parser.test.d.ts.map +1 -0
  21. package/dist/forgescript/__tests__/language-detector.test.d.ts +2 -0
  22. package/dist/forgescript/__tests__/language-detector.test.d.ts.map +1 -0
  23. package/dist/forgescript/__tests__/lexer.test.d.ts +2 -0
  24. package/dist/forgescript/__tests__/lexer.test.d.ts.map +1 -0
  25. package/dist/forgescript/__tests__/orchestrator.test.d.ts +2 -0
  26. package/dist/forgescript/__tests__/orchestrator.test.d.ts.map +1 -0
  27. package/dist/forgescript/__tests__/parser.test.d.ts +2 -0
  28. package/dist/forgescript/__tests__/parser.test.d.ts.map +1 -0
  29. package/dist/forgescript/__tests__/pine-transpiler.test.d.ts +2 -0
  30. package/dist/forgescript/__tests__/pine-transpiler.test.d.ts.map +1 -0
  31. package/dist/forgescript/__tests__/runtime.test.d.ts +2 -0
  32. package/dist/forgescript/__tests__/runtime.test.d.ts.map +1 -0
  33. package/dist/forgescript/__tests__/sandbox.test.d.ts +2 -0
  34. package/dist/forgescript/__tests__/sandbox.test.d.ts.map +1 -0
  35. package/dist/forgescript/__tests__/save-gate.test.d.ts +2 -0
  36. package/dist/forgescript/__tests__/save-gate.test.d.ts.map +1 -0
  37. package/dist/forgescript/__tests__/series.test.d.ts +2 -0
  38. package/dist/forgescript/__tests__/series.test.d.ts.map +1 -0
  39. package/dist/forgescript/__tests__/telemetry.test.d.ts +2 -0
  40. package/dist/forgescript/__tests__/telemetry.test.d.ts.map +1 -0
  41. package/dist/forgescript/__tests__/validation.test.d.ts +2 -0
  42. package/dist/forgescript/__tests__/validation.test.d.ts.map +1 -0
  43. package/dist/forgescript/ast.d.ts +153 -0
  44. package/dist/forgescript/ast.d.ts.map +1 -0
  45. package/dist/forgescript/builtins/color.d.ts +29 -0
  46. package/dist/forgescript/builtins/color.d.ts.map +1 -0
  47. package/dist/forgescript/builtins/math.d.ts +22 -0
  48. package/dist/forgescript/builtins/math.d.ts.map +1 -0
  49. package/dist/forgescript/builtins/request.d.ts +22 -0
  50. package/dist/forgescript/builtins/request.d.ts.map +1 -0
  51. package/dist/forgescript/builtins/syminfo.d.ts +27 -0
  52. package/dist/forgescript/builtins/syminfo.d.ts.map +1 -0
  53. package/dist/forgescript/builtins/ta.d.ts +39 -0
  54. package/dist/forgescript/builtins/ta.d.ts.map +1 -0
  55. package/dist/forgescript/conversion/ai-conversion-agent.d.ts +41 -0
  56. package/dist/forgescript/conversion/ai-conversion-agent.d.ts.map +1 -0
  57. package/dist/forgescript/conversion/conversion-orchestrator.d.ts +44 -0
  58. package/dist/forgescript/conversion/conversion-orchestrator.d.ts.map +1 -0
  59. package/dist/forgescript/conversion/index.d.ts +19 -0
  60. package/dist/forgescript/conversion/index.d.ts.map +1 -0
  61. package/dist/forgescript/conversion/language-detector.d.ts +27 -0
  62. package/dist/forgescript/conversion/language-detector.d.ts.map +1 -0
  63. package/dist/forgescript/conversion/prompts/index.d.ts +17 -0
  64. package/dist/forgescript/conversion/prompts/index.d.ts.map +1 -0
  65. package/dist/forgescript/conversion/sandbox.d.ts +23 -0
  66. package/dist/forgescript/conversion/sandbox.d.ts.map +1 -0
  67. package/dist/forgescript/conversion/save-gate.d.ts +29 -0
  68. package/dist/forgescript/conversion/save-gate.d.ts.map +1 -0
  69. package/dist/forgescript/conversion/telemetry.d.ts +22 -0
  70. package/dist/forgescript/conversion/telemetry.d.ts.map +1 -0
  71. package/dist/forgescript/conversion/types.d.ts +120 -0
  72. package/dist/forgescript/conversion/types.d.ts.map +1 -0
  73. package/dist/forgescript/conversion/validation.d.ts +18 -0
  74. package/dist/forgescript/conversion/validation.d.ts.map +1 -0
  75. package/dist/{tscript → forgescript}/lexer.d.ts +7 -1
  76. package/dist/forgescript/lexer.d.ts.map +1 -0
  77. package/dist/{tscript → forgescript}/parser.d.ts +14 -0
  78. package/dist/forgescript/parser.d.ts.map +1 -0
  79. package/dist/{pine → forgescript/pine}/PineCompiler.d.ts +7 -4
  80. package/dist/forgescript/pine/PineCompiler.d.ts.map +1 -0
  81. package/dist/forgescript/pine/diagnostics.d.ts.map +1 -0
  82. package/dist/forgescript/pine/index.d.ts.map +1 -0
  83. package/dist/{pine → forgescript/pine}/pine-ast.d.ts +50 -2
  84. package/dist/forgescript/pine/pine-ast.d.ts.map +1 -0
  85. package/dist/forgescript/pine/pine-lexer.d.ts.map +1 -0
  86. package/dist/forgescript/pine/pine-parser.d.ts +108 -0
  87. package/dist/forgescript/pine/pine-parser.d.ts.map +1 -0
  88. package/dist/{pine → forgescript/pine}/pine-transpiler.d.ts +10 -3
  89. package/dist/forgescript/pine/pine-transpiler.d.ts.map +1 -0
  90. package/dist/forgescript/runtime.d.ts +307 -0
  91. package/dist/forgescript/runtime.d.ts.map +1 -0
  92. package/dist/forgescript/series.d.ts.map +1 -0
  93. package/dist/index.d.ts +9 -6
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +3365 -265
  96. package/dist/index.js.map +1 -1
  97. package/dist/internal.js +3409 -309
  98. package/dist/internal.js.map +1 -1
  99. package/dist/licensing/ChartRuntimeResolver.d.ts +4 -0
  100. package/dist/licensing/ChartRuntimeResolver.d.ts.map +1 -1
  101. package/dist/licensing/licenseTypes.d.ts +18 -0
  102. package/dist/licensing/licenseTypes.d.ts.map +1 -1
  103. package/dist/logo_dark-B2KCSRPJ.png +0 -0
  104. package/dist/logo_light-NAWNBY4G.png +0 -0
  105. package/dist/react/canvas/ChartCanvas.d.ts +18 -2
  106. package/dist/react/canvas/ChartCanvas.d.ts.map +1 -1
  107. package/dist/react/canvas/PointerOverlay.d.ts +3 -1
  108. package/dist/react/canvas/PointerOverlay.d.ts.map +1 -1
  109. package/dist/react/canvas/TableOverlay.d.ts +12 -0
  110. package/dist/react/canvas/TableOverlay.d.ts.map +1 -0
  111. package/dist/react/canvas/toolbars/LeftToolbar.d.ts +7 -1
  112. package/dist/react/canvas/toolbars/LeftToolbar.d.ts.map +1 -1
  113. package/dist/react/hooks/useBrokerEvents.d.ts +32 -0
  114. package/dist/react/hooks/useBrokerEvents.d.ts.map +1 -0
  115. package/dist/react/index.js +2506 -387
  116. package/dist/react/index.js.map +1 -1
  117. package/dist/react/internal.d.ts +1 -1
  118. package/dist/react/internal.d.ts.map +1 -1
  119. package/dist/react/internal.js +5103 -988
  120. package/dist/react/internal.js.map +1 -1
  121. package/dist/react/shell/ManagedAppShell.d.ts +20 -0
  122. package/dist/react/shell/ManagedAppShell.d.ts.map +1 -1
  123. package/dist/react/shell/OrderEntryPanel.d.ts +73 -1
  124. package/dist/react/shell/OrderEntryPanel.d.ts.map +1 -1
  125. package/dist/react/shell/ScriptDrawer.d.ts +5 -1
  126. package/dist/react/shell/ScriptDrawer.d.ts.map +1 -1
  127. package/dist/react/shell/TradeDrawer.d.ts +8 -1
  128. package/dist/react/shell/TradeDrawer.d.ts.map +1 -1
  129. package/dist/react/shell/WatchlistDrawer.d.ts.map +1 -1
  130. package/dist/react/shell/useWatchlistQuotes.d.ts +1 -0
  131. package/dist/react/shell/useWatchlistQuotes.d.ts.map +1 -1
  132. package/dist/react/workspace/ChartWorkspace.d.ts +5 -1
  133. package/dist/react/workspace/ChartWorkspace.d.ts.map +1 -1
  134. package/dist/react/workspace/SymbolSearchDialog.d.ts.map +1 -1
  135. package/dist/react/workspace/TabBar.d.ts.map +1 -1
  136. package/dist/react/workspace/toolbars/BottomToolbar.d.ts.map +1 -1
  137. package/dist/react/workspace/toolbars/TopToolbar.d.ts +2 -1
  138. package/dist/react/workspace/toolbars/TopToolbar.d.ts.map +1 -1
  139. package/dist/renderers/CandlestickRenderer.d.ts.map +1 -1
  140. package/dist/services/serverClock.d.ts +61 -0
  141. package/dist/services/serverClock.d.ts.map +1 -0
  142. package/package.json +3 -2
  143. package/dist/pine/PineCompiler.d.ts.map +0 -1
  144. package/dist/pine/diagnostics.d.ts.map +0 -1
  145. package/dist/pine/index.d.ts.map +0 -1
  146. package/dist/pine/pine-ast.d.ts.map +0 -1
  147. package/dist/pine/pine-lexer.d.ts.map +0 -1
  148. package/dist/pine/pine-parser.d.ts +0 -51
  149. package/dist/pine/pine-parser.d.ts.map +0 -1
  150. package/dist/pine/pine-transpiler.d.ts.map +0 -1
  151. package/dist/tscript/TScriptIndicator.d.ts.map +0 -1
  152. package/dist/tscript/ast.d.ts +0 -89
  153. package/dist/tscript/ast.d.ts.map +0 -1
  154. package/dist/tscript/lexer.d.ts.map +0 -1
  155. package/dist/tscript/parser.d.ts.map +0 -1
  156. package/dist/tscript/runtime.d.ts +0 -123
  157. package/dist/tscript/runtime.d.ts.map +0 -1
  158. package/dist/tscript/series.d.ts.map +0 -1
  159. /package/dist/{pine → forgescript/pine}/diagnostics.d.ts +0 -0
  160. /package/dist/{pine → forgescript/pine}/index.d.ts +0 -0
  161. /package/dist/{pine → forgescript/pine}/pine-lexer.d.ts +0 -0
  162. /package/dist/{tscript → forgescript}/series.d.ts +0 -0
@@ -1,10 +1,10 @@
1
1
  /**
2
- * TScriptIndicator — compiles and executes a TScript program, exposing its
3
- * plot() outputs as IndicatorPoint arrays compatible with the DAG DAGResult format.
2
+ * ForgeScriptIndicator — compiles and executes a ForgeScript program, exposing
3
+ * its plot() outputs as IndicatorPoint arrays compatible with the DAG format.
4
4
  *
5
5
  * @example
6
6
  * ```ts
7
- * const ind = new TScriptIndicator(`
7
+ * const ind = new ForgeScriptIndicator(`
8
8
  * indicator("My SMA")
9
9
  * length = input(14)
10
10
  * value = sma(close, length)
@@ -17,11 +17,15 @@
17
17
  */
18
18
  import type { OHLCV } from '@forgecharts/types';
19
19
  import type { IndicatorPoint } from '../core/IndicatorEngine';
20
- export declare class TScriptIndicator {
20
+ import type { ScriptResult } from './runtime';
21
+ export { ScriptResult };
22
+ export declare class ForgeScriptIndicator {
21
23
  private readonly _runtime;
22
24
  /** Title from the `indicator("...")` declaration, or `'Script'` if absent. */
23
25
  readonly title: string;
24
26
  constructor(src: string);
27
+ /** Strip common leading whitespace from template-literal source. */
28
+ private static _dedent;
25
29
  /**
26
30
  * Execute the script over the full bar history.
27
31
  *
@@ -32,10 +36,20 @@ export declare class TScriptIndicator {
32
36
  * `plot()` call in source, `plots[1]` to the second, etc.
33
37
  */
34
38
  run(bars: readonly OHLCV[]): IndicatorPoint[][];
39
+ /**
40
+ * Return the full ScriptResult from the most recent `run()` or `runFull()`.
41
+ * Must be called after `run()` — otherwise returns empty data.
42
+ */
43
+ getLastResult(bars: readonly OHLCV[]): ScriptResult;
44
+ /**
45
+ * Execute the script and return the full result including shapes, hlines,
46
+ * fills, bgcolors, barcolors, and plot metadata.
47
+ */
48
+ runFull(bars: readonly OHLCV[]): ScriptResult;
35
49
  /**
36
50
  * Reset all persistent series state (ring buffers) without re-parsing.
37
51
  * Call when the chart symbol or timeframe changes.
38
52
  */
39
53
  reset(): void;
40
54
  }
41
- //# sourceMappingURL=TScriptIndicator.d.ts.map
55
+ //# sourceMappingURL=ForgeScriptIndicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForgeScriptIndicator.d.ts","sourceRoot":"","sources":["../../src/forgescript/ForgeScriptIndicator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAEX,GAAG,EAAE,MAAM;IAKvB,oEAAoE;IACpE,OAAO,CAAC,MAAM,CAAC,OAAO;IAWtB;;;;;;;;OAQG;IACH,GAAG,CAAC,IAAI,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,EAAE,EAAE;IAI/C;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,SAAS,KAAK,EAAE,GAAG,YAAY;IAInD;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,KAAK,EAAE,GAAG,YAAY;IAS7C;;;OAGG;IACH,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * ForgeScript type contracts — public API surface for the scripting engine.
3
+ *
4
+ * Mirrors the Pine Script v5 study manifest structure and provides typed
5
+ * interfaces for host-side integration (UI input binding, plot rendering, etc.)
6
+ */
7
+ import type { IndicatorPoint } from '../core/IndicatorEngine';
8
+ export type ScriptDiagnosticSeverity = 'error' | 'warning' | 'info';
9
+ export interface ScriptDiagnostic {
10
+ readonly severity: ScriptDiagnosticSeverity;
11
+ readonly message: string;
12
+ readonly line: number;
13
+ readonly col: number;
14
+ /** Machine-readable code, e.g. 'FORGESCRIPT_UNKNOWN_FN' */
15
+ readonly code: string;
16
+ }
17
+ export type StudyInputType = 'float' | 'int' | 'bool' | 'string' | 'source';
18
+ export interface StudyInput {
19
+ readonly name: string;
20
+ readonly type: StudyInputType;
21
+ readonly defval: number | boolean | string;
22
+ readonly title?: string;
23
+ readonly minval?: number;
24
+ readonly maxval?: number;
25
+ readonly step?: number;
26
+ }
27
+ export type PlotStyle = 'line' | 'histogram' | 'circles' | 'cross' | 'area' | 'columns' | 'stepline' | 'stepline_diamond';
28
+ export interface StudyPlot {
29
+ readonly title: string;
30
+ readonly points: readonly IndicatorPoint[];
31
+ readonly style: PlotStyle;
32
+ readonly color: string;
33
+ readonly linewidth: number;
34
+ }
35
+ export type ShapeStyle = 'xcross' | 'cross' | 'circle' | 'triangleup' | 'triangledown' | 'flag' | 'diamond' | 'arrowup' | 'arrowdown' | 'square' | 'label_up' | 'label_down';
36
+ export type ShapeLocation = 'abovebar' | 'belowbar' | 'top' | 'bottom' | 'absolute';
37
+ export interface StudyShape {
38
+ readonly time: number;
39
+ readonly style: string;
40
+ readonly location: string;
41
+ readonly color: string;
42
+ readonly text?: string;
43
+ readonly title?: string;
44
+ }
45
+ export interface StudyHLine {
46
+ readonly id: string;
47
+ readonly price: number;
48
+ readonly title?: string;
49
+ readonly color: string;
50
+ readonly lineStyle: string;
51
+ readonly lineWidth: number;
52
+ }
53
+ export interface StudyFill {
54
+ readonly id1: string;
55
+ readonly id2: string;
56
+ readonly color: string;
57
+ readonly title?: string;
58
+ }
59
+ export interface StudyBgColor {
60
+ readonly time: number;
61
+ readonly color: string;
62
+ }
63
+ export interface StudyBarColor {
64
+ readonly time: number;
65
+ readonly color: string;
66
+ }
67
+ /**
68
+ * The full resolved output of a compiled + executed ForgeScript study.
69
+ * Produced by `ForgeScriptIndicator.run()`.
70
+ */
71
+ export interface StudyManifest {
72
+ /** From `indicator("title")` or `"Script"` if absent. */
73
+ readonly title: string;
74
+ /** When true the study should render in the price pane (not a sub-pane). */
75
+ readonly overlay: boolean;
76
+ readonly inputs: readonly StudyInput[];
77
+ readonly plots: readonly StudyPlot[];
78
+ readonly shapes: readonly StudyShape[];
79
+ readonly hlines: readonly StudyHLine[];
80
+ readonly fills: readonly StudyFill[];
81
+ readonly bgcolors: readonly StudyBgColor[];
82
+ readonly barcolors: readonly StudyBarColor[];
83
+ }
84
+ export interface ForgeScriptCompileResult {
85
+ /** The parsed + validated program is ready to run. */
86
+ readonly ok: boolean;
87
+ readonly diagnostics: readonly ScriptDiagnostic[];
88
+ }
89
+ //# sourceMappingURL=ForgeScriptTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForgeScriptTypes.d.ts","sourceRoot":"","sources":["../../src/forgescript/ForgeScriptTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAM,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAO,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAM,MAAM,CAAC;CAC3B;AAID,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAK,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAK,cAAc,CAAC;IACjC,QAAQ,CAAC,MAAM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C5C,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;CAC9C;AAID,MAAM,WAAW,wBAAwB;IACvC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,EAAW,OAAO,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACnD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ai-response-parser.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-response-parser.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/ai-response-parser.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=language-detector.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-detector.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/language-detector.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=lexer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexer.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/lexer.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=orchestrator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/orchestrator.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parser.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/parser.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pine-transpiler.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pine-transpiler.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/pine-transpiler.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtime.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/runtime.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sandbox.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/sandbox.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=save-gate.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save-gate.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/save-gate.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=series.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"series.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/series.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=telemetry.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/telemetry.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validation.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.test.d.ts","sourceRoot":"","sources":["../../../src/forgescript/__tests__/validation.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * TScript Abstract Syntax Tree node types.
3
+ *
4
+ * Grammar (simplified):
5
+ * program → stmt*
6
+ * stmt → indicator_decl | var_decl | assign | reassign | for | while | if | expr_stmt
7
+ * var_decl → ('var' | 'varip') IDENT '=' expr
8
+ * assign → IDENT '=' expr
9
+ * reassign → IDENT ':=' expr
10
+ * for → 'for' IDENT '=' expr 'to' expr ('by' expr)? NEWLINE block
11
+ * indicator → 'indicator' '(' STRING (',' namedArgs)* ')'
12
+ * expr → ternary
13
+ * ternary → or ('?' expr ':' expr)?
14
+ * or → and ('or' and)*
15
+ * and → not ('and' not)*
16
+ * not → 'not' comparison | comparison
17
+ * comparison → addition (('<'|'>'|'<='|'>='|'=='|'!=') addition)*
18
+ * addition → multiplication (('+' | '-') multiplication)*
19
+ * multiplication→ unary (('*' | '/' | '%') unary)*
20
+ * unary → '-' unary | primary
21
+ * primary → NUMBER | STRING | BOOL | COLOR | IDENT ('[' expr ']')? | ns_call | call | '(' expr ')'
22
+ * ns_call → IDENT '.' IDENT '(' args ')'
23
+ * call → IDENT '(' args (',' IDENT '=' expr)* ')'
24
+ */
25
+ export type NumberLit = {
26
+ kind: 'NumberLit';
27
+ value: number;
28
+ };
29
+ export type StringLit = {
30
+ kind: 'StringLit';
31
+ value: string;
32
+ };
33
+ export type BoolLit = {
34
+ kind: 'BoolLit';
35
+ value: boolean;
36
+ };
37
+ export type ColorLit = {
38
+ kind: 'ColorLit';
39
+ value: string;
40
+ };
41
+ export type Identifier = {
42
+ kind: 'Identifier';
43
+ name: string;
44
+ };
45
+ export type IndexExpr = {
46
+ kind: 'IndexExpr';
47
+ series: Expr;
48
+ index: Expr;
49
+ };
50
+ export type CallExpr = {
51
+ kind: 'CallExpr';
52
+ callee: string;
53
+ args: Expr[];
54
+ namedArgs: Map<string, Expr>;
55
+ };
56
+ /** Namespace-qualified call: ta.sma(close, 14), math.abs(x), color.new(...) */
57
+ export type NsCallExpr = {
58
+ kind: 'NsCallExpr';
59
+ namespace: string;
60
+ fn: string;
61
+ args: Expr[];
62
+ namedArgs: Map<string, Expr>;
63
+ };
64
+ /** Namespace member access: color.red, syminfo.tickerid */
65
+ export type MemberExpr = {
66
+ kind: 'MemberExpr';
67
+ object: string;
68
+ prop: string;
69
+ };
70
+ export type BinaryExpr = {
71
+ kind: 'BinaryExpr';
72
+ op: '+' | '-' | '*' | '/' | '%' | '<' | '>' | '<=' | '>=' | '==' | '!=';
73
+ left: Expr;
74
+ right: Expr;
75
+ };
76
+ export type UnaryExpr = {
77
+ kind: 'UnaryExpr';
78
+ op: '-' | 'not';
79
+ operand: Expr;
80
+ };
81
+ export type TernaryExpr = {
82
+ kind: 'TernaryExpr';
83
+ condition: Expr;
84
+ consequent: Expr;
85
+ alternate: Expr;
86
+ };
87
+ export type LogicalExpr = {
88
+ kind: 'LogicalExpr';
89
+ op: 'and' | 'or';
90
+ left: Expr;
91
+ right: Expr;
92
+ };
93
+ export type Expr = NumberLit | StringLit | BoolLit | ColorLit | Identifier | IndexExpr | CallExpr | NsCallExpr | MemberExpr | BinaryExpr | UnaryExpr | TernaryExpr | LogicalExpr;
94
+ export type IndicatorDecl = {
95
+ kind: 'IndicatorDecl';
96
+ title: string;
97
+ namedArgs: Map<string, Expr>;
98
+ };
99
+ /** var x = expr (init once on bar 0) or varip x = expr (init once, update intra-bar) */
100
+ export type VarDeclStmt = {
101
+ kind: 'VarDeclStmt';
102
+ modifier: 'var' | 'varip';
103
+ name: string;
104
+ value: Expr;
105
+ };
106
+ export type AssignStmt = {
107
+ kind: 'AssignStmt';
108
+ name: string;
109
+ value: Expr;
110
+ };
111
+ /** x := expr (reassignment — variable must already exist) */
112
+ export type ReassignStmt = {
113
+ kind: 'ReassignStmt';
114
+ name: string;
115
+ value: Expr;
116
+ };
117
+ export type ExprStmt = {
118
+ kind: 'ExprStmt';
119
+ expr: Expr;
120
+ };
121
+ export type IfStmt = {
122
+ kind: 'IfStmt';
123
+ condition: Expr;
124
+ then: Stmt[];
125
+ else_: Stmt[];
126
+ };
127
+ export type WhileStmt = {
128
+ kind: 'WhileStmt';
129
+ condition: Expr;
130
+ body: Stmt[];
131
+ };
132
+ /** for i = start to end [by step] */
133
+ export type ForStmt = {
134
+ kind: 'ForStmt';
135
+ name: string;
136
+ start: Expr;
137
+ end: Expr;
138
+ step: Expr | null;
139
+ body: Stmt[];
140
+ };
141
+ /** User-defined function: name(params) => body_expr OR name(params) => INDENT block DEDENT */
142
+ export type FnDeclStmt = {
143
+ kind: 'FnDeclStmt';
144
+ name: string;
145
+ params: string[];
146
+ body: Stmt[];
147
+ };
148
+ export type Stmt = IndicatorDecl | VarDeclStmt | AssignStmt | ReassignStmt | ExprStmt | IfStmt | WhileStmt | ForStmt | FnDeclStmt;
149
+ export type Program = {
150
+ kind: 'Program';
151
+ stmts: Stmt[];
152
+ };
153
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/forgescript/ast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,MAAM,MAAM,SAAS,GAAI;IAAE,IAAI,EAAE,WAAW,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,MAAM,MAAM,SAAS,GAAI;IAAE,IAAI,EAAE,WAAW,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,MAAM,MAAM,OAAO,GAAM;IAAE,IAAI,EAAE,SAAS,CAAC;IAAI,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAChE,MAAM,MAAM,QAAQ,GAAK;IAAE,IAAI,EAAE,UAAU,CAAC;IAAG,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAI9D,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAI,WAAW,CAAC;IACpB,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAG,IAAI,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAO,UAAU,CAAC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IAAI,CAAC;IAChB,IAAI,EAAO,IAAI,EAAE,CAAC;CACnB,CAAC;AAEF,qCAAqC;AACrC,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAG,SAAS,CAAC;IACjB,IAAI,EAAG,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAI,IAAI,CAAC;IACZ,IAAI,EAAG,IAAI,GAAG,IAAI,CAAC;IACnB,IAAI,EAAG,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,gGAAgG;AAChG,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAI,YAAY,CAAC;IACrB,IAAI,EAAI,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAI,IAAI,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;AAElI,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAG,SAAS,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * ForgeScript color.* namespace — color constants and constructor.
3
+ *
4
+ * Color values are CSS hex strings (#rrggbb or #rrggbbaa).
5
+ */
6
+ export type ColorNamespace = {
7
+ red: string;
8
+ green: string;
9
+ blue: string;
10
+ white: string;
11
+ black: string;
12
+ yellow: string;
13
+ orange: string;
14
+ purple: string;
15
+ aqua: string;
16
+ gray: string;
17
+ silver: string;
18
+ lime: string;
19
+ maroon: string;
20
+ navy: string;
21
+ olive: string;
22
+ teal: string;
23
+ fuchsia: string;
24
+ /** Create a CSS hex color string from RGBA components (0–255). */
25
+ new: (r: number, g: number, b: number, a?: number) => string;
26
+ };
27
+ /** Built-in color constants matching Pine Script v5. */
28
+ export declare const COLORS: Readonly<Record<string, string>>;
29
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/forgescript/builtins/color.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAM,MAAM,CAAC;IAChB,KAAK,EAAI,MAAM,CAAC;IAChB,IAAI,EAAK,MAAM,CAAC;IAChB,KAAK,EAAI,MAAM,CAAC;IAChB,KAAK,EAAI,MAAM,CAAC;IAChB,MAAM,EAAG,MAAM,CAAC;IAChB,MAAM,EAAG,MAAM,CAAC;IAChB,MAAM,EAAG,MAAM,CAAC;IAChB,IAAI,EAAK,MAAM,CAAC;IAChB,IAAI,EAAK,MAAM,CAAC;IAChB,MAAM,EAAG,MAAM,CAAC;IAChB,IAAI,EAAK,MAAM,CAAC;IAChB,MAAM,EAAG,MAAM,CAAC;IAChB,IAAI,EAAK,MAAM,CAAC;IAChB,KAAK,EAAI,MAAM,CAAC;IAChB,IAAI,EAAK,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,GAAG,EAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAClE,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkB1C,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * ForgeScript math.* namespace — mathematical function type contracts.
3
+ */
4
+ export type MathNamespace = {
5
+ abs: (x: number) => number;
6
+ max: (...args: number[]) => number;
7
+ min: (...args: number[]) => number;
8
+ round: (x: number) => number;
9
+ floor: (x: number) => number;
10
+ ceil: (x: number) => number;
11
+ sqrt: (x: number) => number;
12
+ log: (x: number) => number;
13
+ /** Natural exponent: e^x */
14
+ exp: (x: number) => number;
15
+ pow: (base: number, exp: number) => number;
16
+ sign: (x: number) => number;
17
+ /** Mathematical constant π ≈ 3.14159 */
18
+ pi: number;
19
+ /** Mathematical constant e ≈ 2.71828 */
20
+ e: number;
21
+ };
22
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/forgescript/builtins/math.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAI,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,GAAG,EAAI,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;IACrC,GAAG,EAAI,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,IAAI,EAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,IAAI,EAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,GAAG,EAAI,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,4BAA4B;IAC5B,GAAG,EAAI,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,GAAG,EAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,IAAI,EAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,wCAAwC;IACxC,EAAE,EAAK,MAAM,CAAC;IACd,wCAAwC;IACxC,CAAC,EAAM,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * ForgeScript request.* namespace — external data request functions.
3
+ *
4
+ * PERMISSION-GATED: Only available to scripts that have been granted
5
+ * `request` capability by the platform. Untrusted / user scripts that
6
+ * call `request.security()` will have the call replaced with `0` by the
7
+ * Pine transpiler's UNSUPPORTED_FN guard, and the native parser will throw
8
+ * at runtime if invoked directly.
9
+ */
10
+ export type RequestNamespace = {
11
+ /**
12
+ * Fetch a value from a different symbol or timeframe context.
13
+ *
14
+ * @param symbol Ticker id, e.g. `"CME:NQ1!"`
15
+ * @param timeframe Timeframe string, e.g. `"D"`, `"60"`, `"1"`
16
+ * @param expression The series value to retrieve from that context
17
+ * @returns The value of `expression` in the requested context,
18
+ * or `NaN` if unavailable.
19
+ */
20
+ security: (symbol: string, timeframe: string, expression: number) => number;
21
+ };
22
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/forgescript/builtins/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7E,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * ForgeScript syminfo.* namespace — symbol metadata constants.
3
+ *
4
+ * Values are injected by the host before script execution via
5
+ * `ForgeScriptRuntime.setSyminfo()` (not yet implemented — returns defaults).
6
+ */
7
+ export type SyminfoNamespace = {
8
+ /** Full ticker id, e.g. "CME:ES1!" */
9
+ tickerid: string;
10
+ /** Human-readable description, e.g. "E-mini S&P 500 Futures" */
11
+ description: string;
12
+ /** Exchange prefix, e.g. "CME" */
13
+ prefix: string;
14
+ /** Ticker without exchange, e.g. "ES1!" */
15
+ ticker: string;
16
+ /** Minimum tick size (price increment) */
17
+ mintick: number;
18
+ /** Dollar value of one point movement */
19
+ pointvalue: number;
20
+ /** Asset class: "futures" | "forex" | "crypto" | "stock" */
21
+ type: string;
22
+ /** Active session string, e.g. "0830-1515:23456" */
23
+ session: string;
24
+ /** IANA timezone, e.g. "America/Chicago" */
25
+ timezone: string;
26
+ };
27
+ //# sourceMappingURL=syminfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syminfo.d.ts","sourceRoot":"","sources":["../../../src/forgescript/builtins/syminfo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,sCAAsC;IACtC,QAAQ,EAAK,MAAM,CAAC;IACpB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,MAAM,EAAO,MAAM,CAAC;IACpB,2CAA2C;IAC3C,MAAM,EAAO,MAAM,CAAC;IACpB,0CAA0C;IAC1C,OAAO,EAAM,MAAM,CAAC;IACpB,yCAAyC;IACzC,UAAU,EAAG,MAAM,CAAC;IACpB,4DAA4D;IAC5D,IAAI,EAAS,MAAM,CAAC;IACpB,oDAAoD;IACpD,OAAO,EAAM,MAAM,CAAC;IACpB,4CAA4C;IAC5C,QAAQ,EAAK,MAAM,CAAC;CACrB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * ForgeScript ta.* namespace — technical analysis function type contracts.
3
+ *
4
+ * These describe the public surface for the `ta.` namespace. In ForgeScript
5
+ * native syntax the dot-notation will eventually be parsed and dispatched here.
6
+ * The actual computation is handled by ForgeScriptRuntime's built-in flat
7
+ * function dispatch (sma, ema, rsi, ...) which these map 1-to-1 with.
8
+ */
9
+ export type TANamespace = {
10
+ /** Simple Moving Average */
11
+ sma: (src: number, length: number) => number;
12
+ /** Exponential Moving Average */
13
+ ema: (src: number, length: number) => number;
14
+ /** Weighted Moving Average */
15
+ wma: (src: number, length: number) => number;
16
+ /** Wilder's Moving Average (RMA) */
17
+ rma: (src: number, length: number) => number;
18
+ /** Relative Strength Index */
19
+ rsi: (src: number, length: number) => number;
20
+ /** Rolling Standard Deviation */
21
+ stdev: (src: number, length: number) => number;
22
+ /** Rolling maximum over `length` bars */
23
+ highest: (src: number, length: number) => number;
24
+ /** Rolling minimum over `length` bars */
25
+ lowest: (src: number, length: number) => number;
26
+ /** `src - src[n]`, default n=1 */
27
+ change: (src: number, length?: number) => number;
28
+ /** Momentum = change(src, length) */
29
+ mom: (src: number, length: number) => number;
30
+ /** Average True Range */
31
+ atr: (length: number) => number;
32
+ /** True when `a` crosses above `b` */
33
+ crossover: (a: number, b: number) => boolean;
34
+ /** True when `a` crosses below `b` */
35
+ crossunder: (a: number, b: number) => boolean;
36
+ /** Bars since `condition` was last true */
37
+ barssince: (condition: boolean) => number;
38
+ };
39
+ //# sourceMappingURL=ta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ta.d.ts","sourceRoot":"","sources":["../../../src/forgescript/builtins/ta.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,4BAA4B;IAC5B,GAAG,EAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,iCAAiC;IACjC,GAAG,EAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,8BAA8B;IAC9B,GAAG,EAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,oCAAoC;IACpC,GAAG,EAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,8BAA8B;IAC9B,GAAG,EAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,iCAAiC;IACjC,KAAK,EAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,yCAAyC;IACzC,OAAO,EAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,yCAAyC;IACzC,MAAM,EAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,kCAAkC;IAClC,MAAM,EAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACrD,qCAAqC;IACrC,GAAG,EAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,yBAAyB;IACzB,GAAG,EAAS,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,sCAAsC;IACtC,SAAS,EAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,sCAAsC;IACtC,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,2CAA2C;IAC3C,SAAS,EAAG,CAAC,SAAS,EAAE,OAAO,KAAK,MAAM,CAAC;CAC5C,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * AI Conversion Agent — interface between the conversion pipeline and an LLM.
3
+ *
4
+ * This module:
5
+ * 1. Accepts source code + detected language
6
+ * 2. Builds a prompt using the language-specific template
7
+ * 3. Calls the injected LLM provider
8
+ * 4. Parses the response — tries JSON first (structured output from
9
+ * the Responses API), then falls back to markdown section parsing
10
+ *
11
+ * The AI is an ASSISTIVE layer — its output ALWAYS passes through validation
12
+ * before the user can save. No AI output bypasses the validation layer.
13
+ */
14
+ import type { SourceLanguage, AIConversionResponse } from './types';
15
+ /** Message format for the LLM chat completion. */
16
+ export interface ChatMessage {
17
+ role: 'system' | 'user' | 'assistant';
18
+ content: string;
19
+ }
20
+ /**
21
+ * Pluggable LLM provider. Implementations call an external AI service.
22
+ *
23
+ * Returning `null` indicates the provider is unavailable / rate-limited.
24
+ * The orchestrator will handle graceful fallback.
25
+ */
26
+ export type LLMProvider = (messages: ChatMessage[]) => Promise<string | null>;
27
+ /**
28
+ * Parse the structured 6-section response from the AI.
29
+ * Returns a typed AIConversionResponse or throws if the format is unrecognisable.
30
+ */
31
+ export declare function parseAIResponse(raw: string): AIConversionResponse;
32
+ /**
33
+ * Run the AI conversion agent.
34
+ *
35
+ * @param source - The original source code to convert.
36
+ * @param language - The detected or user-selected source language.
37
+ * @param llm - The LLM provider to call.
38
+ * @returns A parsed AIConversionResponse, or null if the LLM is unavailable.
39
+ */
40
+ export declare function runAIConversion(source: string, language: SourceLanguage, llm: LLMProvider): Promise<AIConversionResponse | null>;
41
+ //# sourceMappingURL=ai-conversion-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-conversion-agent.d.ts","sourceRoot":"","sources":["../../../src/forgescript/conversion/ai-conversion-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAiC,MAAM,SAAS,CAAC;AAKnG,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAM9E;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAmCjE;AAID;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAsBtC"}