solve-engine 1.0.0-beta.0 → 1.0.0-beta.2

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 (253) hide show
  1. package/dist/BytecodeBuilder-3egMyuDi.d.cts +274 -0
  2. package/dist/BytecodeBuilder-3egMyuDi.d.ts +274 -0
  3. package/dist/Configuration-fVpd-HC-.d.cts +228 -0
  4. package/dist/Configuration-fVpd-HC-.d.ts +228 -0
  5. package/dist/EngineError-DvPSnhZi.d.cts +304 -0
  6. package/dist/EngineError-DvPSnhZi.d.ts +304 -0
  7. package/dist/Lexer-BJdhlnej.d.cts +531 -0
  8. package/dist/Lexer-D9l4Yrk2.d.ts +531 -0
  9. package/dist/NormalizerRule-BrVoVjmP.d.cts +163 -0
  10. package/dist/NormalizerRule-CEjf1FyD.d.ts +163 -0
  11. package/dist/PackageRegistry-D-Tv_7ca.d.cts +2572 -0
  12. package/dist/PackageRegistry-DaH4aIKP.d.ts +2572 -0
  13. package/dist/Parselet-CK8cQu2a.d.cts +299 -0
  14. package/dist/Parselet-ConOIdRO.d.ts +299 -0
  15. package/dist/ScopeManager-B5k0nk05.d.ts +559 -0
  16. package/dist/ScopeManager-CKfQtl7l.d.cts +559 -0
  17. package/dist/Token-0jpvUdPY.d.cts +245 -0
  18. package/dist/Token-0jpvUdPY.d.ts +245 -0
  19. package/dist/VMCheckpoints-BmDwIXgK.d.ts +171 -0
  20. package/dist/VMCheckpoints-CqFuLwrT.d.cts +171 -0
  21. package/dist/Value-KtAQNHur.d.cts +295 -0
  22. package/dist/Value-KtAQNHur.d.ts +295 -0
  23. package/dist/chunk-2RWAXT6O.js +3 -0
  24. package/dist/chunk-2RWAXT6O.js.map +1 -0
  25. package/dist/chunk-34RRD7PC.js +1492 -0
  26. package/dist/chunk-34RRD7PC.js.map +1 -0
  27. package/dist/chunk-3PPFLFH4.js +5097 -0
  28. package/dist/chunk-3PPFLFH4.js.map +1 -0
  29. package/dist/chunk-3VGDNEE3.js +84 -0
  30. package/dist/chunk-3VGDNEE3.js.map +1 -0
  31. package/dist/chunk-3YNVWKR2.cjs +370 -0
  32. package/dist/chunk-3YNVWKR2.cjs.map +1 -0
  33. package/dist/chunk-47LRVGOT.cjs +316 -0
  34. package/dist/chunk-47LRVGOT.cjs.map +1 -0
  35. package/dist/chunk-4MG4XKO2.js +1644 -0
  36. package/dist/chunk-4MG4XKO2.js.map +1 -0
  37. package/dist/chunk-4QADQTWS.js +2392 -0
  38. package/dist/chunk-4QADQTWS.js.map +1 -0
  39. package/dist/chunk-53B6KDDJ.cjs +1651 -0
  40. package/dist/chunk-53B6KDDJ.cjs.map +1 -0
  41. package/dist/chunk-5X2PTP6F.cjs +104 -0
  42. package/dist/chunk-5X2PTP6F.cjs.map +1 -0
  43. package/dist/chunk-5YEMOYSE.js +264 -0
  44. package/dist/chunk-5YEMOYSE.js.map +1 -0
  45. package/dist/chunk-64W6GLLZ.js +481 -0
  46. package/dist/chunk-64W6GLLZ.js.map +1 -0
  47. package/dist/chunk-6BKTCEUP.cjs +233 -0
  48. package/dist/chunk-6BKTCEUP.cjs.map +1 -0
  49. package/dist/chunk-6NTVRDQV.cjs +1642 -0
  50. package/dist/chunk-6NTVRDQV.cjs.map +1 -0
  51. package/dist/chunk-6RDSQURE.js +290 -0
  52. package/dist/chunk-6RDSQURE.js.map +1 -0
  53. package/dist/chunk-75JP4BZX.js +93 -0
  54. package/dist/chunk-75JP4BZX.js.map +1 -0
  55. package/dist/chunk-B7LXJ6LC.cjs +36 -0
  56. package/dist/chunk-B7LXJ6LC.cjs.map +1 -0
  57. package/dist/chunk-BVAR5J2F.js +257 -0
  58. package/dist/chunk-BVAR5J2F.js.map +1 -0
  59. package/dist/chunk-C4XZV6E7.cjs +269 -0
  60. package/dist/chunk-C4XZV6E7.cjs.map +1 -0
  61. package/dist/chunk-CCJPSHGI.cjs +40 -0
  62. package/dist/chunk-CCJPSHGI.cjs.map +1 -0
  63. package/dist/chunk-CLL7RUQV.cjs +316 -0
  64. package/dist/chunk-CLL7RUQV.cjs.map +1 -0
  65. package/dist/chunk-DM3LMRBC.js +329 -0
  66. package/dist/chunk-DM3LMRBC.js.map +1 -0
  67. package/dist/chunk-DUEZFTK2.js +38 -0
  68. package/dist/chunk-DUEZFTK2.js.map +1 -0
  69. package/dist/chunk-EBSPLUW4.cjs +489 -0
  70. package/dist/chunk-EBSPLUW4.cjs.map +1 -0
  71. package/dist/chunk-EHAHVROS.cjs +261 -0
  72. package/dist/chunk-EHAHVROS.cjs.map +1 -0
  73. package/dist/chunk-EIGTWK5N.js +167 -0
  74. package/dist/chunk-EIGTWK5N.js.map +1 -0
  75. package/dist/chunk-EPOXXJBK.js +96 -0
  76. package/dist/chunk-EPOXXJBK.js.map +1 -0
  77. package/dist/chunk-FEAIOR7N.cjs +91 -0
  78. package/dist/chunk-FEAIOR7N.cjs.map +1 -0
  79. package/dist/chunk-G535KJEG.js +312 -0
  80. package/dist/chunk-G535KJEG.js.map +1 -0
  81. package/dist/chunk-GCM5JHMX.js +88 -0
  82. package/dist/chunk-GCM5JHMX.js.map +1 -0
  83. package/dist/chunk-GOLDJNMZ.js +368 -0
  84. package/dist/chunk-GOLDJNMZ.js.map +1 -0
  85. package/dist/chunk-GW32KPCU.cjs +360 -0
  86. package/dist/chunk-GW32KPCU.cjs.map +1 -0
  87. package/dist/chunk-HTXVVJRA.cjs +1549 -0
  88. package/dist/chunk-HTXVVJRA.cjs.map +1 -0
  89. package/dist/chunk-HWSZJQCI.js +311 -0
  90. package/dist/chunk-HWSZJQCI.js.map +1 -0
  91. package/dist/chunk-IF532O7C.js +101 -0
  92. package/dist/chunk-IF532O7C.js.map +1 -0
  93. package/dist/chunk-J73SJHR3.cjs +2415 -0
  94. package/dist/chunk-J73SJHR3.cjs.map +1 -0
  95. package/dist/chunk-JBSYC7BB.cjs +7473 -0
  96. package/dist/chunk-JBSYC7BB.cjs.map +1 -0
  97. package/dist/chunk-KVILKGMS.js +228 -0
  98. package/dist/chunk-KVILKGMS.js.map +1 -0
  99. package/dist/chunk-LIPPNDBE.js +258 -0
  100. package/dist/chunk-LIPPNDBE.js.map +1 -0
  101. package/dist/chunk-LR7YASZF.cjs +172 -0
  102. package/dist/chunk-LR7YASZF.cjs.map +1 -0
  103. package/dist/chunk-M4N5GA5Z.cjs +309 -0
  104. package/dist/chunk-M4N5GA5Z.cjs.map +1 -0
  105. package/dist/chunk-M5LX5AOO.js +7459 -0
  106. package/dist/chunk-M5LX5AOO.js.map +1 -0
  107. package/dist/chunk-MZOVP3WI.cjs +96 -0
  108. package/dist/chunk-MZOVP3WI.cjs.map +1 -0
  109. package/dist/chunk-N5YFR4UP.cjs +10 -0
  110. package/dist/chunk-N5YFR4UP.cjs.map +1 -0
  111. package/dist/chunk-NGBBNL4K.cjs +4 -0
  112. package/dist/chunk-NGBBNL4K.cjs.map +1 -0
  113. package/dist/chunk-NH2O2AUR.js +146 -0
  114. package/dist/chunk-NH2O2AUR.js.map +1 -0
  115. package/dist/chunk-NLNDMWZC.js +31 -0
  116. package/dist/chunk-NLNDMWZC.js.map +1 -0
  117. package/dist/chunk-NMCRQP3Z.cjs +778 -0
  118. package/dist/chunk-NMCRQP3Z.cjs.map +1 -0
  119. package/dist/chunk-NMD5VRN4.cjs +1327 -0
  120. package/dist/chunk-NMD5VRN4.cjs.map +1 -0
  121. package/dist/chunk-OC6LTXYS.cjs +286 -0
  122. package/dist/chunk-OC6LTXYS.cjs.map +1 -0
  123. package/dist/chunk-OT6OJY7C.cjs +114 -0
  124. package/dist/chunk-OT6OJY7C.cjs.map +1 -0
  125. package/dist/chunk-PFSDGGYL.js +8 -0
  126. package/dist/chunk-PFSDGGYL.js.map +1 -0
  127. package/dist/chunk-QNJ4ACRT.cjs +155 -0
  128. package/dist/chunk-QNJ4ACRT.cjs.map +1 -0
  129. package/dist/chunk-QWY3VEZN.js +1637 -0
  130. package/dist/chunk-QWY3VEZN.js.map +1 -0
  131. package/dist/chunk-RFYD5TJE.js +111 -0
  132. package/dist/chunk-RFYD5TJE.js.map +1 -0
  133. package/dist/chunk-RIN643A3.js +354 -0
  134. package/dist/chunk-RIN643A3.js.map +1 -0
  135. package/dist/chunk-RZCWSXTA.cjs +5122 -0
  136. package/dist/chunk-RZCWSXTA.cjs.map +1 -0
  137. package/dist/chunk-SDGRK7EP.js +774 -0
  138. package/dist/chunk-SDGRK7EP.js.map +1 -0
  139. package/dist/chunk-VEKIWQ3F.cjs +39 -0
  140. package/dist/chunk-VEKIWQ3F.cjs.map +1 -0
  141. package/dist/chunk-WQTTOGXC.cjs +99 -0
  142. package/dist/chunk-WQTTOGXC.cjs.map +1 -0
  143. package/dist/chunk-X6K3HUOY.cjs +86 -0
  144. package/dist/chunk-X6K3HUOY.cjs.map +1 -0
  145. package/dist/chunk-XJCMXB2E.cjs +333 -0
  146. package/dist/chunk-XJCMXB2E.cjs.map +1 -0
  147. package/dist/chunk-XVWCOTR6.js +1324 -0
  148. package/dist/chunk-XVWCOTR6.js.map +1 -0
  149. package/dist/chunk-YLJ4XMA6.js +33 -0
  150. package/dist/chunk-YLJ4XMA6.js.map +1 -0
  151. package/dist/chunk-Z2XP767T.cjs +35 -0
  152. package/dist/chunk-Z2XP767T.cjs.map +1 -0
  153. package/dist/chunk-Z4X2RWOF.js +37 -0
  154. package/dist/chunk-Z4X2RWOF.js.map +1 -0
  155. package/dist/constants.cjs +22 -0
  156. package/dist/constants.cjs.map +1 -0
  157. package/dist/constants.d.cts +12 -0
  158. package/dist/constants.d.ts +12 -0
  159. package/dist/constants.js +5 -0
  160. package/dist/constants.js.map +1 -0
  161. package/dist/engine.cjs +79 -0
  162. package/dist/engine.cjs.map +1 -0
  163. package/dist/engine.d.cts +587 -0
  164. package/dist/engine.d.ts +587 -0
  165. package/dist/engine.js +34 -0
  166. package/dist/engine.js.map +1 -0
  167. package/dist/errors.cjs +81 -0
  168. package/dist/errors.cjs.map +1 -0
  169. package/dist/errors.d.cts +95 -0
  170. package/dist/errors.d.ts +95 -0
  171. package/dist/errors.js +4 -0
  172. package/dist/errors.js.map +1 -0
  173. package/dist/format.cjs +171 -0
  174. package/dist/format.cjs.map +1 -0
  175. package/dist/format.d.cts +51 -0
  176. package/dist/format.d.ts +51 -0
  177. package/dist/format.js +168 -0
  178. package/dist/format.js.map +1 -0
  179. package/dist/index.cjs +97 -0
  180. package/dist/index.cjs.map +1 -0
  181. package/dist/index.d.cts +152 -0
  182. package/dist/index.d.ts +152 -0
  183. package/dist/index.js +75 -0
  184. package/dist/index.js.map +1 -0
  185. package/dist/language.cjs +308 -0
  186. package/dist/language.cjs.map +1 -0
  187. package/dist/language.d.cts +110 -0
  188. package/dist/language.d.ts +110 -0
  189. package/dist/language.js +287 -0
  190. package/dist/language.js.map +1 -0
  191. package/dist/lexer.cjs +64 -0
  192. package/dist/lexer.cjs.map +1 -0
  193. package/dist/lexer.d.cts +56 -0
  194. package/dist/lexer.d.ts +56 -0
  195. package/dist/lexer.js +11 -0
  196. package/dist/lexer.js.map +1 -0
  197. package/dist/normalizer.cjs +40 -0
  198. package/dist/normalizer.cjs.map +1 -0
  199. package/dist/normalizer.d.cts +364 -0
  200. package/dist/normalizer.d.ts +364 -0
  201. package/dist/normalizer.js +11 -0
  202. package/dist/normalizer.js.map +1 -0
  203. package/dist/packages.cjs +121 -0
  204. package/dist/packages.cjs.map +1 -0
  205. package/dist/packages.d.cts +691 -0
  206. package/dist/packages.d.ts +691 -0
  207. package/dist/packages.js +24 -0
  208. package/dist/packages.js.map +1 -0
  209. package/dist/parser.cjs +55 -0
  210. package/dist/parser.cjs.map +1 -0
  211. package/dist/parser.d.cts +46 -0
  212. package/dist/parser.d.ts +46 -0
  213. package/dist/parser.js +10 -0
  214. package/dist/parser.js.map +1 -0
  215. package/dist/pipeline-CrsRPmsv.d.ts +285 -0
  216. package/dist/pipeline-DPUQt7yL.d.cts +285 -0
  217. package/dist/resolvers.cjs +13 -0
  218. package/dist/resolvers.cjs.map +1 -0
  219. package/dist/resolvers.d.cts +111 -0
  220. package/dist/resolvers.d.ts +111 -0
  221. package/dist/resolvers.js +4 -0
  222. package/dist/resolvers.js.map +1 -0
  223. package/dist/services.cjs +21 -0
  224. package/dist/services.cjs.map +1 -0
  225. package/dist/services.d.cts +30 -0
  226. package/dist/services.d.ts +30 -0
  227. package/dist/services.js +4 -0
  228. package/dist/services.js.map +1 -0
  229. package/dist/uom.cjs +56 -0
  230. package/dist/uom.cjs.map +1 -0
  231. package/dist/uom.d.cts +224 -0
  232. package/dist/uom.d.ts +224 -0
  233. package/dist/uom.js +11 -0
  234. package/dist/uom.js.map +1 -0
  235. package/dist/utilities.cjs +32 -0
  236. package/dist/utilities.cjs.map +1 -0
  237. package/dist/utilities.d.cts +113 -0
  238. package/dist/utilities.d.ts +113 -0
  239. package/dist/utilities.js +7 -0
  240. package/dist/utilities.js.map +1 -0
  241. package/dist/variables.cjs +17 -0
  242. package/dist/variables.cjs.map +1 -0
  243. package/dist/variables.d.cts +87 -0
  244. package/dist/variables.d.ts +87 -0
  245. package/dist/variables.js +4 -0
  246. package/dist/variables.js.map +1 -0
  247. package/dist/vm.cjs +284 -0
  248. package/dist/vm.cjs.map +1 -0
  249. package/dist/vm.d.cts +68 -0
  250. package/dist/vm.d.ts +68 -0
  251. package/dist/vm.js +194 -0
  252. package/dist/vm.js.map +1 -0
  253. package/package.json +4 -4
@@ -0,0 +1,285 @@
1
+ import { M as MatrixData, R as RangeData, S as SymbolicNode } from './Value-KtAQNHur.cjs';
2
+
3
+ /** Base event, all events include a timestamp relative to pipeline start */
4
+ interface BaseEvent {
5
+ readonly type: string;
6
+ readonly elapsedNs: number;
7
+ readonly expression: string;
8
+ }
9
+ /** Emitted after each token is produced by the lexer */
10
+ interface TokenEmittedEvent extends BaseEvent {
11
+ readonly type: "token_emitted";
12
+ readonly token: {
13
+ readonly type: string;
14
+ readonly value: string;
15
+ readonly offset: number;
16
+ readonly line: number;
17
+ readonly col: number;
18
+ };
19
+ }
20
+ /** Emitted when the parser resolves a parselet for a token */
21
+ interface ParseletMatchedEvent extends BaseEvent {
22
+ readonly type: "parselet_matched";
23
+ readonly tokenType: string;
24
+ readonly tokenValue: string;
25
+ readonly parseletCategory: string;
26
+ readonly parseletType: string;
27
+ readonly isPrefix: boolean;
28
+ readonly bindingPower?: number;
29
+ readonly tokenOffset: number;
30
+ }
31
+ /** Emitted after bytecode is built */
32
+ interface BytecodeBuiltEvent extends BaseEvent {
33
+ readonly type: "bytecode_built";
34
+ readonly opcodesLength: number;
35
+ readonly numbersLength: number;
36
+ readonly stringsLength: number;
37
+ readonly isCached: boolean;
38
+ }
39
+ /** Emitted after each VM opcode execution (only when vmTrace is enabled) */
40
+ interface VmStepEvent extends BaseEvent {
41
+ readonly type: "vm_step";
42
+ readonly opcode: number;
43
+ readonly opcodeName: string;
44
+ readonly ip: number;
45
+ readonly stackDepth: number;
46
+ readonly instructionNumber: number;
47
+ readonly stack: ReadonlyArray<{
48
+ readonly type: number;
49
+ readonly value: number | bigint | string | boolean | MatrixData | RangeData | SymbolicNode;
50
+ readonly unit?: string;
51
+ }>;
52
+ }
53
+ /** Emitted when the VM halts with a result */
54
+ interface VmHaltEvent extends BaseEvent {
55
+ readonly type: "vm_halt";
56
+ readonly result?: {
57
+ readonly type: number;
58
+ readonly value: number | bigint | string | boolean | MatrixData | RangeData | SymbolicNode;
59
+ readonly unit?: string;
60
+ };
61
+ }
62
+ /** Emitted on cache hit */
63
+ interface CacheHitEvent extends BaseEvent {
64
+ readonly type: "cache_hit";
65
+ readonly cache: "bytecode" | "line";
66
+ readonly key: string;
67
+ }
68
+ /** Emitted on cache miss */
69
+ interface CacheMissEvent extends BaseEvent {
70
+ readonly type: "cache_miss";
71
+ readonly cache: "bytecode" | "line";
72
+ readonly key: string;
73
+ }
74
+ /** Emitted when a pipeline evaluation begins */
75
+ interface PipelineStartEvent extends BaseEvent {
76
+ readonly type: "pipeline_start";
77
+ readonly inputType: string;
78
+ }
79
+ /** Emitted when a pipeline evaluation completes */
80
+ interface PipelineEndEvent extends BaseEvent {
81
+ readonly type: "pipeline_end";
82
+ readonly success: boolean;
83
+ readonly error?: string;
84
+ readonly totalTokens: number;
85
+ readonly totalOpcodes: number;
86
+ }
87
+ /** Emitted when the normalizer begins its pass */
88
+ interface NormalizerStartEvent extends BaseEvent {
89
+ readonly type: "normalizer_start";
90
+ readonly inputTokenCount: number;
91
+ }
92
+ /** Emitted when the normalizer fuses tokens */
93
+ interface TokenFusedEvent extends BaseEvent {
94
+ readonly type: "token_fused";
95
+ readonly ruleName: string;
96
+ readonly sourceTokenCount: number;
97
+ readonly fusedTokenType: string;
98
+ readonly fusedTokenValue: string;
99
+ }
100
+ /** Emitted when the normalizer completes its pass */
101
+ interface NormalizerEndEvent extends BaseEvent {
102
+ readonly type: "normalizer_end";
103
+ readonly outputTokenCount: number;
104
+ readonly fusionsCount: number;
105
+ }
106
+ /** Union of all event types */
107
+ type DiagnosticEvent = TokenEmittedEvent | NormalizerStartEvent | TokenFusedEvent | NormalizerEndEvent | ParseletMatchedEvent | BytecodeBuiltEvent | VmStepEvent | VmHaltEvent | CacheHitEvent | CacheMissEvent | PipelineStartEvent | PipelineEndEvent;
108
+ /** Categorized parselet info */
109
+ interface CategorizedParselet {
110
+ readonly tokenType: string;
111
+ readonly tokenValue: string;
112
+ readonly parseletCategory: string;
113
+ readonly parseletType: string;
114
+ readonly isPrefix: boolean;
115
+ readonly bindingPower?: number;
116
+ readonly tokenOffset: number;
117
+ }
118
+ /** Structured diagnostic report */
119
+ interface DiagnosticReport {
120
+ readonly events: readonly DiagnosticEvent[];
121
+ readonly parselets: readonly CategorizedParselet[];
122
+ readonly summary: {
123
+ readonly totalTokens: number;
124
+ readonly totalParselets: number;
125
+ readonly totalOpcodes: number;
126
+ readonly cacheHit: boolean;
127
+ readonly elapsedNs: number;
128
+ readonly parseCategories: ReadonlyMap<string, number>;
129
+ };
130
+ readonly metadata: {
131
+ readonly expression: string;
132
+ readonly inputType: string;
133
+ readonly timestamp: number;
134
+ readonly vmTraceEnabled: boolean;
135
+ };
136
+ /** Serialize to a JSON-safe plain object */
137
+ toJSON(): DiagnosticReportJSON;
138
+ }
139
+ /** JSON-serializable representation of a DiagnosticReport */
140
+ interface DiagnosticReportJSON {
141
+ readonly events: readonly DiagnosticEvent[];
142
+ readonly parselets: readonly CategorizedParselet[];
143
+ readonly summary: {
144
+ readonly totalTokens: number;
145
+ readonly totalParselets: number;
146
+ readonly totalOpcodes: number;
147
+ readonly cacheHit: boolean;
148
+ readonly elapsedNs: number;
149
+ readonly parseCategories: Record<string, number>;
150
+ };
151
+ readonly metadata: {
152
+ readonly expression: string;
153
+ readonly inputType: string;
154
+ readonly timestamp: number;
155
+ readonly vmTraceEnabled: boolean;
156
+ };
157
+ }
158
+ /** JSON-serializable representation of a DiagnosticReport */
159
+ interface DiagnosticReportJSON {
160
+ readonly events: readonly DiagnosticEvent[];
161
+ readonly parselets: readonly CategorizedParselet[];
162
+ readonly summary: {
163
+ readonly totalTokens: number;
164
+ readonly totalParselets: number;
165
+ readonly totalOpcodes: number;
166
+ readonly cacheHit: boolean;
167
+ readonly elapsedNs: number;
168
+ readonly parseCategories: Record<string, number>;
169
+ };
170
+ readonly metadata: {
171
+ readonly expression: string;
172
+ readonly inputType: string;
173
+ readonly timestamp: number;
174
+ readonly vmTraceEnabled: boolean;
175
+ };
176
+ }
177
+
178
+ /**
179
+ * Interface for collecting diagnostic data during pipeline execution.
180
+ *
181
+ * All methods are implemented as concrete no-ops so subclasses only
182
+ * need to override the ones they care about. This avoids optional
183
+ * method issues with TypeScript's strict mode.
184
+ *
185
+ * The parameters are named `_event` because these base implementations
186
+ * deliberately ignore them. Overrides are free to name theirs `event` and use
187
+ * it; TypeScript does not match parameter names when checking overrides.
188
+ */
189
+ declare abstract class DiagnosticCollector {
190
+ onPipelineStart(_event: DiagnosticEvent & {
191
+ type: "pipeline_start";
192
+ }): void;
193
+ onTokenEmitted(_event: DiagnosticEvent & {
194
+ type: "token_emitted";
195
+ }): void;
196
+ onNormalizerStart(_event: DiagnosticEvent & {
197
+ type: "normalizer_start";
198
+ }): void;
199
+ onTokenFused(_event: DiagnosticEvent & {
200
+ type: "token_fused";
201
+ }): void;
202
+ onNormalizerEnd(_event: DiagnosticEvent & {
203
+ type: "normalizer_end";
204
+ }): void;
205
+ onParseletMatched(_event: DiagnosticEvent & {
206
+ type: "parselet_matched";
207
+ }): void;
208
+ onBytecodeBuilt(_event: DiagnosticEvent & {
209
+ type: "bytecode_built";
210
+ }): void;
211
+ onVmStep(_event: DiagnosticEvent & {
212
+ type: "vm_step";
213
+ }): void;
214
+ onVmHalt(_event: DiagnosticEvent & {
215
+ type: "vm_halt";
216
+ }): void;
217
+ onCacheHit(_event: DiagnosticEvent & {
218
+ type: "cache_hit";
219
+ }): void;
220
+ onCacheMiss(_event: DiagnosticEvent & {
221
+ type: "cache_miss";
222
+ }): void;
223
+ onPipelineEnd(_event: DiagnosticEvent & {
224
+ type: "pipeline_end";
225
+ }): void;
226
+ abstract getReport(): DiagnosticReport | undefined;
227
+ abstract reset(): void;
228
+ }
229
+
230
+ /**
231
+ * Dispatches diagnostic events to all registered collectors.
232
+ *
233
+ * Performance guarantee: when no collectors are registered (production mode),
234
+ * every dispatch method is a branch on `this.collectors.length === 0` which
235
+ * modern JS engines will predict and eliminate. The overhead is a single
236
+ * comparison per call, effectively zero.
237
+ */
238
+ declare class DiagnosticPipeline {
239
+ private collectors;
240
+ register(collector: DiagnosticCollector): void;
241
+ unregister(collector: DiagnosticCollector): void;
242
+ clear(): void;
243
+ get hasCollectors(): boolean;
244
+ get collectorCount(): number;
245
+ firePipelineStart(event: DiagnosticEvent & {
246
+ type: "pipeline_start";
247
+ }): void;
248
+ fireTokenEmitted(event: DiagnosticEvent & {
249
+ type: "token_emitted";
250
+ }): void;
251
+ fireNormalizerStart(event: DiagnosticEvent & {
252
+ type: "normalizer_start";
253
+ }): void;
254
+ fireTokenFused(event: DiagnosticEvent & {
255
+ type: "token_fused";
256
+ }): void;
257
+ fireNormalizerEnd(event: DiagnosticEvent & {
258
+ type: "normalizer_end";
259
+ }): void;
260
+ fireParseletMatched(event: DiagnosticEvent & {
261
+ type: "parselet_matched";
262
+ }): void;
263
+ fireBytecodeBuilt(event: DiagnosticEvent & {
264
+ type: "bytecode_built";
265
+ }): void;
266
+ fireVmStep(event: DiagnosticEvent & {
267
+ type: "vm_step";
268
+ }): void;
269
+ fireVmHalt(event: DiagnosticEvent & {
270
+ type: "vm_halt";
271
+ }): void;
272
+ fireCacheHit(event: DiagnosticEvent & {
273
+ type: "cache_hit";
274
+ }): void;
275
+ fireCacheMiss(event: DiagnosticEvent & {
276
+ type: "cache_miss";
277
+ }): void;
278
+ firePipelineEnd(event: DiagnosticEvent & {
279
+ type: "pipeline_end";
280
+ }): void;
281
+ collectReports(): DiagnosticReport[];
282
+ reset(): void;
283
+ }
284
+
285
+ export { DiagnosticPipeline as D, type DiagnosticReportJSON as a };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var chunkX6K3HUOY_cjs = require('./chunk-X6K3HUOY.cjs');
4
+ require('./chunk-B7LXJ6LC.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "ResolverRegistry", {
9
+ enumerable: true,
10
+ get: function () { return chunkX6K3HUOY_cjs.ResolverRegistry; }
11
+ });
12
+ //# sourceMappingURL=resolvers.cjs.map
13
+ //# sourceMappingURL=resolvers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"resolvers.cjs"}
@@ -0,0 +1,111 @@
1
+ import { QueryClient } from '@tanstack/query-core';
2
+ import { T as Token } from './Token-0jpvUdPY.cjs';
3
+ import { a as BytecodeProgram } from './BytecodeBuilder-3egMyuDi.cjs';
4
+ import { V as Value } from './Value-KtAQNHur.cjs';
5
+
6
+ /**
7
+ * Result from a resolver's preflight() check.
8
+ * Returned when async data is needed, the orchestrator uses this
9
+ * to subscribe to the resolver and return a Pending value immediately.
10
+ */
11
+ interface AsyncCheckResult {
12
+ /** Unique cache key for deduplication (e.g., "{packageId}:rates:USD:GBP") */
13
+ queryKey: string;
14
+ /** Promise that resolves to the final Value */
15
+ resolver: Promise<Value>;
16
+ /** Package owning this resolver */
17
+ packageId: string;
18
+ /** AbortSignal for stale-data prevention */
19
+ signal: AbortSignal;
20
+ /** Optional metadata for diagnostics */
21
+ metadata?: Record<string, unknown>;
22
+ }
23
+ /**
24
+ * Interface for async resolvers registered by packages/plugins.
25
+ *
26
+ * Each resolver handles a domain of async data (currency rates,
27
+ * weather, stock prices, etc.). The preflight() method is called
28
+ * BEFORE VM execution to check if all data is cached. If not,
29
+ * it returns an AsyncCheckResult and the engine skips the VM,
30
+ * returning a Pending value instead.
31
+ */
32
+ interface IAsyncResolver {
33
+ /** Unique namespace for cache key scoping (e.g., "currency", "weather") */
34
+ readonly namespace: string;
35
+ /**
36
+ * Pre-flight check: called BEFORE VM execution.
37
+ *
38
+ * Returns null if all data for this expression is cached and ready.
39
+ * Returns an AsyncCheckResult if async work is needed.
40
+ *
41
+ * This method is synchronous, it only checks caches, never fetches.
42
+ * If data is missing, it creates a Promise and returns immediately.
43
+ *
44
+ * @param tokens - The lexed tokens for the expression
45
+ * @param bytecode - The compiled bytecode program
46
+ * @param pluginId - The plugin ID (for cache key scoping)
47
+ * @param signal - AbortSignal for the current evaluation
48
+ */
49
+ preflight?(tokens: Token[], bytecode: BytecodeProgram, packageId: string, signal: AbortSignal, queryClient: QueryClient): AsyncCheckResult | null;
50
+ /**
51
+ * Called when the resolver's namespace is being unregistered.
52
+ * Clean up any in-flight promises, clear caches, unsubscribe.
53
+ */
54
+ destroy(): void;
55
+ }
56
+ /**
57
+ * Registry of async resolvers, keyed by namespace.
58
+ *
59
+ * Plugins/packages register resolvers alongside their parselets
60
+ * and opcode handlers. The engine calls preflightAll() before
61
+ * VM execution to short-circuit async expressions.
62
+ *
63
+ * Lifecycle:
64
+ * - register(), when a package is loaded
65
+ * - unregister(), when a package is unloaded (clears cache entries)
66
+ * - clear(), on document switch (clears all resolvers)
67
+ */
68
+ declare class ResolverRegistry {
69
+ private resolvers;
70
+ /**
71
+ * Register an async resolver.
72
+ *
73
+ * Each resolver must have a unique `namespace`. If a resolver with the
74
+ * same namespace is already registered, the old one is destroyed and
75
+ * replaced (with a console warning). Packages that need multiple async
76
+ * operations should use `asyncResolvers: [...]` with distinct namespaces
77
+ * (e.g., `"weather:current"`, `"weather:forecast"`).
78
+ */
79
+ register(resolver: IAsyncResolver): void;
80
+ /**
81
+ * Unregister a resolver by namespace.
82
+ * Calls destroy() and clears all cache entries with that namespace prefix.
83
+ */
84
+ unregister(namespace: string, queryClient?: QueryClient): void;
85
+ /**
86
+ * Run all registered resolvers' preflight checks against compiled bytecode.
87
+ *
88
+ * Returns the first AsyncCheckResult found, or null if all data is ready.
89
+ * Short-circuits on first pending, subsequent pending ops will be
90
+ * discovered on re-evaluation when the first resolves.
91
+ */
92
+ preflightAll(tokens: Token[], bytecode: BytecodeProgram, packageId: string, signal: AbortSignal, queryClient: QueryClient): AsyncCheckResult | null;
93
+ /**
94
+ * Get a resolver by namespace.
95
+ * Returns undefined if no resolver is registered for that namespace.
96
+ */
97
+ get(namespace: string): IAsyncResolver | undefined;
98
+ /** Number of registered resolvers. */
99
+ get size(): number;
100
+ /**
101
+ * Check if a resolver is registered for the given namespace.
102
+ */
103
+ has(namespace: string): boolean;
104
+ /**
105
+ * Clear all resolvers (document switch, engine reset).
106
+ * Calls destroy() on each resolver and clears the map.
107
+ */
108
+ clear(): void;
109
+ }
110
+
111
+ export { type AsyncCheckResult, type IAsyncResolver, ResolverRegistry };
@@ -0,0 +1,111 @@
1
+ import { QueryClient } from '@tanstack/query-core';
2
+ import { T as Token } from './Token-0jpvUdPY.js';
3
+ import { a as BytecodeProgram } from './BytecodeBuilder-3egMyuDi.js';
4
+ import { V as Value } from './Value-KtAQNHur.js';
5
+
6
+ /**
7
+ * Result from a resolver's preflight() check.
8
+ * Returned when async data is needed, the orchestrator uses this
9
+ * to subscribe to the resolver and return a Pending value immediately.
10
+ */
11
+ interface AsyncCheckResult {
12
+ /** Unique cache key for deduplication (e.g., "{packageId}:rates:USD:GBP") */
13
+ queryKey: string;
14
+ /** Promise that resolves to the final Value */
15
+ resolver: Promise<Value>;
16
+ /** Package owning this resolver */
17
+ packageId: string;
18
+ /** AbortSignal for stale-data prevention */
19
+ signal: AbortSignal;
20
+ /** Optional metadata for diagnostics */
21
+ metadata?: Record<string, unknown>;
22
+ }
23
+ /**
24
+ * Interface for async resolvers registered by packages/plugins.
25
+ *
26
+ * Each resolver handles a domain of async data (currency rates,
27
+ * weather, stock prices, etc.). The preflight() method is called
28
+ * BEFORE VM execution to check if all data is cached. If not,
29
+ * it returns an AsyncCheckResult and the engine skips the VM,
30
+ * returning a Pending value instead.
31
+ */
32
+ interface IAsyncResolver {
33
+ /** Unique namespace for cache key scoping (e.g., "currency", "weather") */
34
+ readonly namespace: string;
35
+ /**
36
+ * Pre-flight check: called BEFORE VM execution.
37
+ *
38
+ * Returns null if all data for this expression is cached and ready.
39
+ * Returns an AsyncCheckResult if async work is needed.
40
+ *
41
+ * This method is synchronous, it only checks caches, never fetches.
42
+ * If data is missing, it creates a Promise and returns immediately.
43
+ *
44
+ * @param tokens - The lexed tokens for the expression
45
+ * @param bytecode - The compiled bytecode program
46
+ * @param pluginId - The plugin ID (for cache key scoping)
47
+ * @param signal - AbortSignal for the current evaluation
48
+ */
49
+ preflight?(tokens: Token[], bytecode: BytecodeProgram, packageId: string, signal: AbortSignal, queryClient: QueryClient): AsyncCheckResult | null;
50
+ /**
51
+ * Called when the resolver's namespace is being unregistered.
52
+ * Clean up any in-flight promises, clear caches, unsubscribe.
53
+ */
54
+ destroy(): void;
55
+ }
56
+ /**
57
+ * Registry of async resolvers, keyed by namespace.
58
+ *
59
+ * Plugins/packages register resolvers alongside their parselets
60
+ * and opcode handlers. The engine calls preflightAll() before
61
+ * VM execution to short-circuit async expressions.
62
+ *
63
+ * Lifecycle:
64
+ * - register(), when a package is loaded
65
+ * - unregister(), when a package is unloaded (clears cache entries)
66
+ * - clear(), on document switch (clears all resolvers)
67
+ */
68
+ declare class ResolverRegistry {
69
+ private resolvers;
70
+ /**
71
+ * Register an async resolver.
72
+ *
73
+ * Each resolver must have a unique `namespace`. If a resolver with the
74
+ * same namespace is already registered, the old one is destroyed and
75
+ * replaced (with a console warning). Packages that need multiple async
76
+ * operations should use `asyncResolvers: [...]` with distinct namespaces
77
+ * (e.g., `"weather:current"`, `"weather:forecast"`).
78
+ */
79
+ register(resolver: IAsyncResolver): void;
80
+ /**
81
+ * Unregister a resolver by namespace.
82
+ * Calls destroy() and clears all cache entries with that namespace prefix.
83
+ */
84
+ unregister(namespace: string, queryClient?: QueryClient): void;
85
+ /**
86
+ * Run all registered resolvers' preflight checks against compiled bytecode.
87
+ *
88
+ * Returns the first AsyncCheckResult found, or null if all data is ready.
89
+ * Short-circuits on first pending, subsequent pending ops will be
90
+ * discovered on re-evaluation when the first resolves.
91
+ */
92
+ preflightAll(tokens: Token[], bytecode: BytecodeProgram, packageId: string, signal: AbortSignal, queryClient: QueryClient): AsyncCheckResult | null;
93
+ /**
94
+ * Get a resolver by namespace.
95
+ * Returns undefined if no resolver is registered for that namespace.
96
+ */
97
+ get(namespace: string): IAsyncResolver | undefined;
98
+ /** Number of registered resolvers. */
99
+ get size(): number;
100
+ /**
101
+ * Check if a resolver is registered for the given namespace.
102
+ */
103
+ has(namespace: string): boolean;
104
+ /**
105
+ * Clear all resolvers (document switch, engine reset).
106
+ * Calls destroy() on each resolver and clears the map.
107
+ */
108
+ clear(): void;
109
+ }
110
+
111
+ export { type AsyncCheckResult, type IAsyncResolver, ResolverRegistry };
@@ -0,0 +1,4 @@
1
+ export { ResolverRegistry } from './chunk-3VGDNEE3.js';
2
+ import './chunk-YLJ4XMA6.js';
3
+ //# sourceMappingURL=resolvers.js.map
4
+ //# sourceMappingURL=resolvers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"resolvers.js"}
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var chunkZ2XP767T_cjs = require('./chunk-Z2XP767T.cjs');
4
+ require('./chunk-B7LXJ6LC.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "createQueryClient", {
9
+ enumerable: true,
10
+ get: function () { return chunkZ2XP767T_cjs.createQueryClient; }
11
+ });
12
+ Object.defineProperty(exports, "getActiveQueryClient", {
13
+ enumerable: true,
14
+ get: function () { return chunkZ2XP767T_cjs.getActiveQueryClient; }
15
+ });
16
+ Object.defineProperty(exports, "setActiveQueryClient", {
17
+ enumerable: true,
18
+ get: function () { return chunkZ2XP767T_cjs.setActiveQueryClient; }
19
+ });
20
+ //# sourceMappingURL=services.cjs.map
21
+ //# sourceMappingURL=services.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"services.cjs"}
@@ -0,0 +1,30 @@
1
+ import { QueryClient } from '@tanstack/query-core';
2
+
3
+ /**
4
+ * QueryClient factory for the solve-js engine.
5
+ *
6
+ * Creates a TanStack Query QueryClient with sensible defaults for
7
+ * stale-while-revalidate, garbage collection, and retry behavior.
8
+ * The QueryClient is injected into resolvers via the engine, so
9
+ * no global singleton is needed.
10
+ *
11
+ * Removed in this refactor:
12
+ * - DataQueryWorker (worker thread), doesn't solve anything in Obsidian's single-threaded env
13
+ * - localCache (raw Map), replaced by TanStack Query's built-in cache
14
+ * - pendingQueries (manual promise plumbing), TanStack Query handles dedup
15
+ * - DataSourceHandle, registerDataSource, unregisterDataSource, no longer needed
16
+ * - cleanupCache timer, TanStack Query's gc does this automatically
17
+ * - cacheUpdateListeners / errorListeners, TanStack Query has its own observer API
18
+ */
19
+
20
+ /** Publish the QueryClient for the execution about to run. Set by the engine. */
21
+ declare function setActiveQueryClient(qc: QueryClient | null): void;
22
+ /** Read the QueryClient of the currently executing engine, if any. */
23
+ declare function getActiveQueryClient(): QueryClient | null;
24
+ /**
25
+ * Create a new TanStack Query QueryClient with project defaults.
26
+ * Each engine instance gets its own client for isolation.
27
+ */
28
+ declare function createQueryClient(): QueryClient;
29
+
30
+ export { createQueryClient, getActiveQueryClient, setActiveQueryClient };
@@ -0,0 +1,30 @@
1
+ import { QueryClient } from '@tanstack/query-core';
2
+
3
+ /**
4
+ * QueryClient factory for the solve-js engine.
5
+ *
6
+ * Creates a TanStack Query QueryClient with sensible defaults for
7
+ * stale-while-revalidate, garbage collection, and retry behavior.
8
+ * The QueryClient is injected into resolvers via the engine, so
9
+ * no global singleton is needed.
10
+ *
11
+ * Removed in this refactor:
12
+ * - DataQueryWorker (worker thread), doesn't solve anything in Obsidian's single-threaded env
13
+ * - localCache (raw Map), replaced by TanStack Query's built-in cache
14
+ * - pendingQueries (manual promise plumbing), TanStack Query handles dedup
15
+ * - DataSourceHandle, registerDataSource, unregisterDataSource, no longer needed
16
+ * - cleanupCache timer, TanStack Query's gc does this automatically
17
+ * - cacheUpdateListeners / errorListeners, TanStack Query has its own observer API
18
+ */
19
+
20
+ /** Publish the QueryClient for the execution about to run. Set by the engine. */
21
+ declare function setActiveQueryClient(qc: QueryClient | null): void;
22
+ /** Read the QueryClient of the currently executing engine, if any. */
23
+ declare function getActiveQueryClient(): QueryClient | null;
24
+ /**
25
+ * Create a new TanStack Query QueryClient with project defaults.
26
+ * Each engine instance gets its own client for isolation.
27
+ */
28
+ declare function createQueryClient(): QueryClient;
29
+
30
+ export { createQueryClient, getActiveQueryClient, setActiveQueryClient };
@@ -0,0 +1,4 @@
1
+ export { createQueryClient, getActiveQueryClient, setActiveQueryClient } from './chunk-NLNDMWZC.js';
2
+ import './chunk-YLJ4XMA6.js';
3
+ //# sourceMappingURL=services.js.map
4
+ //# sourceMappingURL=services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"services.js"}
package/dist/uom.cjs ADDED
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var chunkWQTTOGXC_cjs = require('./chunk-WQTTOGXC.cjs');
4
+ var chunkXJCMXB2E_cjs = require('./chunk-XJCMXB2E.cjs');
5
+ require('./chunk-MZOVP3WI.cjs');
6
+ require('./chunk-VEKIWQ3F.cjs');
7
+ require('./chunk-OC6LTXYS.cjs');
8
+ var chunkQNJ4ACRT_cjs = require('./chunk-QNJ4ACRT.cjs');
9
+ require('./chunk-53B6KDDJ.cjs');
10
+ require('./chunk-M4N5GA5Z.cjs');
11
+ require('./chunk-B7LXJ6LC.cjs');
12
+
13
+
14
+
15
+ Object.defineProperty(exports, "CurrencyAsyncResolver", {
16
+ enumerable: true,
17
+ get: function () { return chunkWQTTOGXC_cjs.CurrencyAsyncResolver; }
18
+ });
19
+ Object.defineProperty(exports, "CurrencyExchangeService", {
20
+ enumerable: true,
21
+ get: function () { return chunkXJCMXB2E_cjs.CurrencyExchangeService; }
22
+ });
23
+ Object.defineProperty(exports, "currencyExchangeService", {
24
+ enumerable: true,
25
+ get: function () { return chunkXJCMXB2E_cjs.currencyExchangeService; }
26
+ });
27
+ Object.defineProperty(exports, "sharedCurrencyExchange", {
28
+ enumerable: true,
29
+ get: function () { return chunkXJCMXB2E_cjs.sharedCurrencyExchange; }
30
+ });
31
+ Object.defineProperty(exports, "canConvert", {
32
+ enumerable: true,
33
+ get: function () { return chunkQNJ4ACRT_cjs.canConvert; }
34
+ });
35
+ Object.defineProperty(exports, "convertUnit", {
36
+ enumerable: true,
37
+ get: function () { return chunkQNJ4ACRT_cjs.convertUnit; }
38
+ });
39
+ Object.defineProperty(exports, "getBestUnit", {
40
+ enumerable: true,
41
+ get: function () { return chunkQNJ4ACRT_cjs.getBestUnit; }
42
+ });
43
+ Object.defineProperty(exports, "getMeasure", {
44
+ enumerable: true,
45
+ get: function () { return chunkQNJ4ACRT_cjs.getMeasure; }
46
+ });
47
+ Object.defineProperty(exports, "isConvertibleUnit", {
48
+ enumerable: true,
49
+ get: function () { return chunkQNJ4ACRT_cjs.isConvertibleUnit; }
50
+ });
51
+ Object.defineProperty(exports, "resolveUnit", {
52
+ enumerable: true,
53
+ get: function () { return chunkQNJ4ACRT_cjs.resolveUnit; }
54
+ });
55
+ //# sourceMappingURL=uom.cjs.map
56
+ //# sourceMappingURL=uom.cjs.map