@rcrsr/rill 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/README.md +37 -21
  2. package/dist/ast-nodes.d.ts +2 -13
  3. package/dist/ast-nodes.js +0 -1
  4. package/dist/ast-unions.d.ts +0 -1
  5. package/dist/ast-unions.js +0 -1
  6. package/dist/constants.d.ts +0 -1
  7. package/dist/constants.js +0 -1
  8. package/dist/error-classes.d.ts +0 -1
  9. package/dist/error-classes.js +0 -1
  10. package/dist/error-formatter.d.ts +0 -1
  11. package/dist/error-formatter.js +0 -1
  12. package/dist/error-registry.d.ts +0 -1
  13. package/dist/error-registry.js +32 -1
  14. package/dist/ext/crypto/index.d.ts +3 -4
  15. package/dist/ext/crypto/index.js +66 -64
  16. package/dist/ext/exec/index.d.ts +3 -4
  17. package/dist/ext/exec/index.js +17 -12
  18. package/dist/ext/exec/runner.d.ts +0 -1
  19. package/dist/ext/exec/runner.js +0 -1
  20. package/dist/ext/fetch/index.d.ts +3 -4
  21. package/dist/ext/fetch/index.js +23 -49
  22. package/dist/ext/fetch/request.d.ts +0 -1
  23. package/dist/ext/fetch/request.js +0 -1
  24. package/dist/ext/fs/index.d.ts +3 -4
  25. package/dist/ext/fs/index.js +268 -266
  26. package/dist/ext/fs/sandbox.d.ts +0 -1
  27. package/dist/ext/fs/sandbox.js +0 -1
  28. package/dist/ext/kv/index.d.ts +3 -4
  29. package/dist/ext/kv/index.js +216 -215
  30. package/dist/ext/kv/store.d.ts +0 -1
  31. package/dist/ext/kv/store.js +2 -2
  32. package/dist/ext-parse-bridge.d.ts +10 -0
  33. package/dist/ext-parse-bridge.js +10 -0
  34. package/dist/generated/introspection-data.d.ts +1 -2
  35. package/dist/generated/introspection-data.js +385 -297
  36. package/dist/generated/version-data.d.ts +1 -2
  37. package/dist/generated/version-data.js +2 -3
  38. package/dist/highlight-map.d.ts +0 -1
  39. package/dist/highlight-map.js +0 -1
  40. package/dist/index.d.ts +15 -5
  41. package/dist/index.js +14 -6
  42. package/dist/lexer/errors.d.ts +0 -1
  43. package/dist/lexer/errors.js +0 -1
  44. package/dist/lexer/helpers.d.ts +0 -1
  45. package/dist/lexer/helpers.js +0 -1
  46. package/dist/lexer/index.d.ts +0 -1
  47. package/dist/lexer/index.js +0 -1
  48. package/dist/lexer/operators.d.ts +0 -1
  49. package/dist/lexer/operators.js +0 -1
  50. package/dist/lexer/readers.d.ts +0 -1
  51. package/dist/lexer/readers.js +0 -1
  52. package/dist/lexer/state.d.ts +0 -1
  53. package/dist/lexer/state.js +0 -1
  54. package/dist/lexer/tokenizer.d.ts +0 -1
  55. package/dist/lexer/tokenizer.js +0 -1
  56. package/dist/parser/helpers.d.ts +0 -1
  57. package/dist/parser/helpers.js +0 -1
  58. package/dist/parser/index.d.ts +0 -1
  59. package/dist/parser/index.js +0 -1
  60. package/dist/parser/parser-collect.d.ts +0 -1
  61. package/dist/parser/parser-collect.js +0 -1
  62. package/dist/parser/parser-control.d.ts +0 -1
  63. package/dist/parser/parser-control.js +0 -1
  64. package/dist/parser/parser-expr.d.ts +0 -1
  65. package/dist/parser/parser-expr.js +0 -1
  66. package/dist/parser/parser-extract.d.ts +0 -1
  67. package/dist/parser/parser-extract.js +0 -1
  68. package/dist/parser/parser-functions.d.ts +0 -1
  69. package/dist/parser/parser-functions.js +0 -1
  70. package/dist/parser/parser-literals.d.ts +0 -1
  71. package/dist/parser/parser-literals.js +4 -2
  72. package/dist/parser/parser-script.d.ts +0 -1
  73. package/dist/parser/parser-script.js +0 -1
  74. package/dist/parser/parser-shape.d.ts +2 -3
  75. package/dist/parser/parser-shape.js +8 -52
  76. package/dist/parser/parser-types.d.ts +28 -2
  77. package/dist/parser/parser-types.js +76 -13
  78. package/dist/parser/parser-use.d.ts +0 -1
  79. package/dist/parser/parser-use.js +7 -2
  80. package/dist/parser/parser-variables.d.ts +0 -1
  81. package/dist/parser/parser-variables.js +0 -1
  82. package/dist/parser/parser.d.ts +0 -1
  83. package/dist/parser/parser.js +0 -1
  84. package/dist/parser/state.d.ts +0 -1
  85. package/dist/parser/state.js +0 -1
  86. package/dist/runtime/core/callable.d.ts +59 -20
  87. package/dist/runtime/core/callable.js +188 -39
  88. package/dist/runtime/core/context.d.ts +0 -12
  89. package/dist/runtime/core/context.js +77 -77
  90. package/dist/runtime/core/equals.d.ts +0 -1
  91. package/dist/runtime/core/equals.js +35 -3
  92. package/dist/runtime/core/eval/base.d.ts +0 -1
  93. package/dist/runtime/core/eval/base.js +0 -1
  94. package/dist/runtime/core/eval/evaluator.d.ts +0 -1
  95. package/dist/runtime/core/eval/evaluator.js +0 -1
  96. package/dist/runtime/core/eval/index.d.ts +2 -3
  97. package/dist/runtime/core/eval/index.js +11 -1
  98. package/dist/runtime/core/eval/mixins/annotations.d.ts +0 -1
  99. package/dist/runtime/core/eval/mixins/annotations.js +0 -1
  100. package/dist/runtime/core/eval/mixins/closures.d.ts +0 -1
  101. package/dist/runtime/core/eval/mixins/closures.js +92 -70
  102. package/dist/runtime/core/eval/mixins/collections.d.ts +0 -1
  103. package/dist/runtime/core/eval/mixins/collections.js +9 -4
  104. package/dist/runtime/core/eval/mixins/control-flow.d.ts +0 -1
  105. package/dist/runtime/core/eval/mixins/control-flow.js +0 -1
  106. package/dist/runtime/core/eval/mixins/conversion.d.ts +0 -1
  107. package/dist/runtime/core/eval/mixins/conversion.js +196 -188
  108. package/dist/runtime/core/eval/mixins/core.d.ts +0 -1
  109. package/dist/runtime/core/eval/mixins/core.js +2 -3
  110. package/dist/runtime/core/eval/mixins/expressions.d.ts +0 -1
  111. package/dist/runtime/core/eval/mixins/expressions.js +35 -28
  112. package/dist/runtime/core/eval/mixins/extraction.d.ts +0 -1
  113. package/dist/runtime/core/eval/mixins/extraction.js +8 -9
  114. package/dist/runtime/core/eval/mixins/list-dispatch.d.ts +0 -1
  115. package/dist/runtime/core/eval/mixins/list-dispatch.js +0 -1
  116. package/dist/runtime/core/eval/mixins/literals.d.ts +0 -1
  117. package/dist/runtime/core/eval/mixins/literals.js +6 -10
  118. package/dist/runtime/core/eval/mixins/types.d.ts +2 -1
  119. package/dist/runtime/core/eval/mixins/types.js +231 -261
  120. package/dist/runtime/core/eval/mixins/use.d.ts +0 -1
  121. package/dist/runtime/core/eval/mixins/use.js +0 -1
  122. package/dist/runtime/core/eval/mixins/variables.d.ts +0 -1
  123. package/dist/runtime/core/eval/mixins/variables.js +16 -15
  124. package/dist/runtime/core/eval/types.d.ts +0 -1
  125. package/dist/runtime/core/eval/types.js +0 -1
  126. package/dist/runtime/core/execute.d.ts +0 -1
  127. package/dist/runtime/core/execute.js +0 -1
  128. package/dist/runtime/core/field-descriptor.d.ts +4 -5
  129. package/dist/runtime/core/field-descriptor.js +2 -2
  130. package/dist/runtime/core/introspection.d.ts +0 -1
  131. package/dist/runtime/core/introspection.js +6 -7
  132. package/dist/runtime/core/markers.d.ts +12 -0
  133. package/dist/runtime/core/markers.js +7 -0
  134. package/dist/runtime/core/resolvers.d.ts +0 -1
  135. package/dist/runtime/core/resolvers.js +0 -1
  136. package/dist/runtime/core/signals.d.ts +0 -1
  137. package/dist/runtime/core/signals.js +0 -1
  138. package/dist/runtime/core/type-registrations.d.ts +136 -0
  139. package/dist/runtime/core/type-registrations.js +749 -0
  140. package/dist/runtime/core/type-structures.d.ts +128 -0
  141. package/dist/runtime/core/type-structures.js +12 -0
  142. package/dist/runtime/core/types.d.ts +15 -4
  143. package/dist/runtime/core/types.js +0 -1
  144. package/dist/runtime/core/values.d.ts +88 -146
  145. package/dist/runtime/core/values.js +466 -470
  146. package/dist/runtime/ext/builtins.d.ts +0 -1
  147. package/dist/runtime/ext/builtins.js +125 -80
  148. package/dist/runtime/ext/extensions.d.ts +30 -125
  149. package/dist/runtime/ext/extensions.js +0 -94
  150. package/dist/runtime/ext/test-context.d.ts +28 -0
  151. package/dist/runtime/ext/test-context.js +154 -0
  152. package/dist/runtime/index.d.ts +22 -9
  153. package/dist/runtime/index.js +18 -5
  154. package/dist/signature-parser.d.ts +2 -3
  155. package/dist/signature-parser.js +19 -17
  156. package/dist/source-location.d.ts +0 -1
  157. package/dist/source-location.js +0 -1
  158. package/dist/token-types.d.ts +0 -1
  159. package/dist/token-types.js +0 -1
  160. package/dist/types.d.ts +0 -1
  161. package/dist/types.js +0 -1
  162. package/dist/value-types.d.ts +15 -12
  163. package/dist/value-types.js +0 -1
  164. package/package.json +2 -1
  165. package/dist/ast-nodes.d.ts.map +0 -1
  166. package/dist/ast-nodes.js.map +0 -1
  167. package/dist/ast-unions.d.ts.map +0 -1
  168. package/dist/ast-unions.js.map +0 -1
  169. package/dist/constants.d.ts.map +0 -1
  170. package/dist/constants.js.map +0 -1
  171. package/dist/error-classes.d.ts.map +0 -1
  172. package/dist/error-classes.js.map +0 -1
  173. package/dist/error-formatter.d.ts.map +0 -1
  174. package/dist/error-formatter.js.map +0 -1
  175. package/dist/error-registry.d.ts.map +0 -1
  176. package/dist/error-registry.js.map +0 -1
  177. package/dist/ext/crypto/index.d.ts.map +0 -1
  178. package/dist/ext/crypto/index.js.map +0 -1
  179. package/dist/ext/exec/index.d.ts.map +0 -1
  180. package/dist/ext/exec/index.js.map +0 -1
  181. package/dist/ext/exec/runner.d.ts.map +0 -1
  182. package/dist/ext/exec/runner.js.map +0 -1
  183. package/dist/ext/fetch/index.d.ts.map +0 -1
  184. package/dist/ext/fetch/index.js.map +0 -1
  185. package/dist/ext/fetch/request.d.ts.map +0 -1
  186. package/dist/ext/fetch/request.js.map +0 -1
  187. package/dist/ext/fs/index.d.ts.map +0 -1
  188. package/dist/ext/fs/index.js.map +0 -1
  189. package/dist/ext/fs/sandbox.d.ts.map +0 -1
  190. package/dist/ext/fs/sandbox.js.map +0 -1
  191. package/dist/ext/kv/index.d.ts.map +0 -1
  192. package/dist/ext/kv/index.js.map +0 -1
  193. package/dist/ext/kv/store.d.ts.map +0 -1
  194. package/dist/ext/kv/store.js.map +0 -1
  195. package/dist/generated/introspection-data.d.ts.map +0 -1
  196. package/dist/generated/introspection-data.js.map +0 -1
  197. package/dist/generated/version-data.d.ts.map +0 -1
  198. package/dist/generated/version-data.js.map +0 -1
  199. package/dist/highlight-map.d.ts.map +0 -1
  200. package/dist/highlight-map.js.map +0 -1
  201. package/dist/index.d.ts.map +0 -1
  202. package/dist/index.js.map +0 -1
  203. package/dist/lexer/errors.d.ts.map +0 -1
  204. package/dist/lexer/errors.js.map +0 -1
  205. package/dist/lexer/helpers.d.ts.map +0 -1
  206. package/dist/lexer/helpers.js.map +0 -1
  207. package/dist/lexer/index.d.ts.map +0 -1
  208. package/dist/lexer/index.js.map +0 -1
  209. package/dist/lexer/operators.d.ts.map +0 -1
  210. package/dist/lexer/operators.js.map +0 -1
  211. package/dist/lexer/readers.d.ts.map +0 -1
  212. package/dist/lexer/readers.js.map +0 -1
  213. package/dist/lexer/state.d.ts.map +0 -1
  214. package/dist/lexer/state.js.map +0 -1
  215. package/dist/lexer/tokenizer.d.ts.map +0 -1
  216. package/dist/lexer/tokenizer.js.map +0 -1
  217. package/dist/parser/helpers.d.ts.map +0 -1
  218. package/dist/parser/helpers.js.map +0 -1
  219. package/dist/parser/index.d.ts.map +0 -1
  220. package/dist/parser/index.js.map +0 -1
  221. package/dist/parser/parser-collect.d.ts.map +0 -1
  222. package/dist/parser/parser-collect.js.map +0 -1
  223. package/dist/parser/parser-control.d.ts.map +0 -1
  224. package/dist/parser/parser-control.js.map +0 -1
  225. package/dist/parser/parser-expr.d.ts.map +0 -1
  226. package/dist/parser/parser-expr.js.map +0 -1
  227. package/dist/parser/parser-extract.d.ts.map +0 -1
  228. package/dist/parser/parser-extract.js.map +0 -1
  229. package/dist/parser/parser-functions.d.ts.map +0 -1
  230. package/dist/parser/parser-functions.js.map +0 -1
  231. package/dist/parser/parser-literals.d.ts.map +0 -1
  232. package/dist/parser/parser-literals.js.map +0 -1
  233. package/dist/parser/parser-script.d.ts.map +0 -1
  234. package/dist/parser/parser-script.js.map +0 -1
  235. package/dist/parser/parser-shape.d.ts.map +0 -1
  236. package/dist/parser/parser-shape.js.map +0 -1
  237. package/dist/parser/parser-types.d.ts.map +0 -1
  238. package/dist/parser/parser-types.js.map +0 -1
  239. package/dist/parser/parser-use.d.ts.map +0 -1
  240. package/dist/parser/parser-use.js.map +0 -1
  241. package/dist/parser/parser-variables.d.ts.map +0 -1
  242. package/dist/parser/parser-variables.js.map +0 -1
  243. package/dist/parser/parser.d.ts.map +0 -1
  244. package/dist/parser/parser.js.map +0 -1
  245. package/dist/parser/state.d.ts.map +0 -1
  246. package/dist/parser/state.js.map +0 -1
  247. package/dist/runtime/core/callable.d.ts.map +0 -1
  248. package/dist/runtime/core/callable.js.map +0 -1
  249. package/dist/runtime/core/context.d.ts.map +0 -1
  250. package/dist/runtime/core/context.js.map +0 -1
  251. package/dist/runtime/core/equals.d.ts.map +0 -1
  252. package/dist/runtime/core/equals.js.map +0 -1
  253. package/dist/runtime/core/eval/base.d.ts.map +0 -1
  254. package/dist/runtime/core/eval/base.js.map +0 -1
  255. package/dist/runtime/core/eval/evaluator.d.ts.map +0 -1
  256. package/dist/runtime/core/eval/evaluator.js.map +0 -1
  257. package/dist/runtime/core/eval/index.d.ts.map +0 -1
  258. package/dist/runtime/core/eval/index.js.map +0 -1
  259. package/dist/runtime/core/eval/mixins/annotations.d.ts.map +0 -1
  260. package/dist/runtime/core/eval/mixins/annotations.js.map +0 -1
  261. package/dist/runtime/core/eval/mixins/closures.d.ts.map +0 -1
  262. package/dist/runtime/core/eval/mixins/closures.js.map +0 -1
  263. package/dist/runtime/core/eval/mixins/collections.d.ts.map +0 -1
  264. package/dist/runtime/core/eval/mixins/collections.js.map +0 -1
  265. package/dist/runtime/core/eval/mixins/control-flow.d.ts.map +0 -1
  266. package/dist/runtime/core/eval/mixins/control-flow.js.map +0 -1
  267. package/dist/runtime/core/eval/mixins/conversion.d.ts.map +0 -1
  268. package/dist/runtime/core/eval/mixins/conversion.js.map +0 -1
  269. package/dist/runtime/core/eval/mixins/core.d.ts.map +0 -1
  270. package/dist/runtime/core/eval/mixins/core.js.map +0 -1
  271. package/dist/runtime/core/eval/mixins/expressions.d.ts.map +0 -1
  272. package/dist/runtime/core/eval/mixins/expressions.js.map +0 -1
  273. package/dist/runtime/core/eval/mixins/extraction.d.ts.map +0 -1
  274. package/dist/runtime/core/eval/mixins/extraction.js.map +0 -1
  275. package/dist/runtime/core/eval/mixins/list-dispatch.d.ts.map +0 -1
  276. package/dist/runtime/core/eval/mixins/list-dispatch.js.map +0 -1
  277. package/dist/runtime/core/eval/mixins/literals.d.ts.map +0 -1
  278. package/dist/runtime/core/eval/mixins/literals.js.map +0 -1
  279. package/dist/runtime/core/eval/mixins/types.d.ts.map +0 -1
  280. package/dist/runtime/core/eval/mixins/types.js.map +0 -1
  281. package/dist/runtime/core/eval/mixins/use.d.ts.map +0 -1
  282. package/dist/runtime/core/eval/mixins/use.js.map +0 -1
  283. package/dist/runtime/core/eval/mixins/variables.d.ts.map +0 -1
  284. package/dist/runtime/core/eval/mixins/variables.js.map +0 -1
  285. package/dist/runtime/core/eval/types.d.ts.map +0 -1
  286. package/dist/runtime/core/eval/types.js.map +0 -1
  287. package/dist/runtime/core/execute.d.ts.map +0 -1
  288. package/dist/runtime/core/execute.js.map +0 -1
  289. package/dist/runtime/core/field-descriptor.d.ts.map +0 -1
  290. package/dist/runtime/core/field-descriptor.js.map +0 -1
  291. package/dist/runtime/core/introspection.d.ts.map +0 -1
  292. package/dist/runtime/core/introspection.js.map +0 -1
  293. package/dist/runtime/core/resolvers.d.ts.map +0 -1
  294. package/dist/runtime/core/resolvers.js.map +0 -1
  295. package/dist/runtime/core/signals.d.ts.map +0 -1
  296. package/dist/runtime/core/signals.js.map +0 -1
  297. package/dist/runtime/core/types.d.ts.map +0 -1
  298. package/dist/runtime/core/types.js.map +0 -1
  299. package/dist/runtime/core/values.d.ts.map +0 -1
  300. package/dist/runtime/core/values.js.map +0 -1
  301. package/dist/runtime/ext/builtins.d.ts.map +0 -1
  302. package/dist/runtime/ext/builtins.js.map +0 -1
  303. package/dist/runtime/ext/extensions.d.ts.map +0 -1
  304. package/dist/runtime/ext/extensions.js.map +0 -1
  305. package/dist/runtime/index.d.ts.map +0 -1
  306. package/dist/runtime/index.js.map +0 -1
  307. package/dist/signature-parser.d.ts.map +0 -1
  308. package/dist/signature-parser.js.map +0 -1
  309. package/dist/source-location.d.ts.map +0 -1
  310. package/dist/source-location.js.map +0 -1
  311. package/dist/token-types.d.ts.map +0 -1
  312. package/dist/token-types.js.map +0 -1
  313. package/dist/types.d.ts.map +0 -1
  314. package/dist/types.js.map +0 -1
  315. package/dist/value-types.d.ts.map +0 -1
  316. package/dist/value-types.js.map +0 -1
@@ -22,4 +22,3 @@
22
22
  * @internal
23
23
  */
24
24
  export declare const UseMixin: any;
25
- //# sourceMappingURL=use.d.ts.map
@@ -179,4 +179,3 @@ function parseSchemeString(value, node) {
179
179
  // TypeScript can't generate declarations for functions returning classes with protected members
180
180
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
181
181
  export const UseMixin = createUseMixin;
182
- //# sourceMappingURL=use.js.map
@@ -31,4 +31,3 @@
31
31
  * @internal
32
32
  */
33
33
  export declare const VariablesMixin: any;
34
- //# sourceMappingURL=variables.d.ts.map
@@ -31,7 +31,7 @@
31
31
  * @internal
32
32
  */
33
33
  import { RuntimeError } from '../../../../types.js';
34
- import { formatStructuralType, inferType, isTypeValue, structuralTypeMatches, } from '../../values.js';
34
+ import { formatStructure, inferType, isTypeValue, structureMatches, } from '../../values.js';
35
35
  import { getVariable, hasVariable } from '../../context.js';
36
36
  import { isDict, isCallable } from '../../callable.js';
37
37
  /**
@@ -69,8 +69,8 @@ function createVariablesMixin(Base) {
69
69
  if (explicitType !== undefined) {
70
70
  if (typeof explicitType === 'object') {
71
71
  // Structural type check
72
- if (!structuralTypeMatches(value, explicitType)) {
73
- const expectedLabel = formatStructuralType(explicitType);
72
+ if (!structureMatches(value, explicitType)) {
73
+ const expectedLabel = formatStructure(explicitType);
74
74
  throw new RuntimeError('RILL-R001', `Type mismatch: cannot assign ${valueType} to $${name}:${expectedLabel}`, location, {
75
75
  variableName: name,
76
76
  expectedType: expectedLabel,
@@ -98,8 +98,8 @@ function createVariablesMixin(Base) {
98
98
  if (lockedType !== undefined && lockedType !== 'any') {
99
99
  if (typeof lockedType === 'object') {
100
100
  // Structural locked type — validate full shape
101
- if (!structuralTypeMatches(value, lockedType)) {
102
- const expectedLabel = formatStructuralType(lockedType);
101
+ if (!structureMatches(value, lockedType)) {
102
+ const expectedLabel = formatStructure(lockedType);
103
103
  throw new RuntimeError('RILL-R001', `Type mismatch: cannot assign ${valueType} to $${name} (locked as ${expectedLabel})`, location, {
104
104
  variableName: name,
105
105
  expectedType: expectedLabel,
@@ -120,7 +120,9 @@ function createVariablesMixin(Base) {
120
120
  if (!this.ctx.variableTypes.has(name)) {
121
121
  // Store structural type (object) directly so re-assignment checks
122
122
  // validate the full shape. Fall back to valueType when no annotation.
123
- const lockType = explicitType !== undefined ? explicitType : valueType;
123
+ const lockType = explicitType !== undefined
124
+ ? explicitType
125
+ : valueType;
124
126
  this.ctx.variableTypes.set(name, lockType);
125
127
  }
126
128
  }
@@ -260,7 +262,7 @@ function createVariablesMixin(Base) {
260
262
  value = value.typeName;
261
263
  }
262
264
  else if (field === 'signature') {
263
- value = formatStructuralType(value.structure);
265
+ value = formatStructure(value.structure);
264
266
  }
265
267
  else {
266
268
  throw new RuntimeError('RILL-R003', `Type value has no property "${field}"`, this.getNodeLocation(node));
@@ -317,12 +319,12 @@ function createVariablesMixin(Base) {
317
319
  const finalAccess = node.existenceCheck.finalAccess;
318
320
  const typeRef = node.existenceCheck.typeRef;
319
321
  // Helper: check type match using structural resolution (EC-4: mismatch returns false)
320
- const matchesType = (fieldValue) => {
322
+ const matchesType = async (fieldValue) => {
321
323
  if (typeRef === null)
322
324
  return true;
323
325
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
- const resolved = this.resolveTypeRef(typeRef, (name) => getVariable(this.ctx, name));
325
- return structuralTypeMatches(fieldValue, resolved.structure);
326
+ const resolved = await this.resolveTypeRef(typeRef, (name) => getVariable(this.ctx, name));
327
+ return structureMatches(fieldValue, resolved.structure);
326
328
  };
327
329
  if (finalAccess.kind === 'literal') {
328
330
  // Check if literal field exists in dict
@@ -331,7 +333,7 @@ function createVariablesMixin(Base) {
331
333
  const exists = fieldValue !== undefined && fieldValue !== null;
332
334
  // If type-qualified check, verify type matches
333
335
  if (exists && typeRef !== null) {
334
- return matchesType(fieldValue);
336
+ return await matchesType(fieldValue);
335
337
  }
336
338
  return exists;
337
339
  }
@@ -361,7 +363,7 @@ function createVariablesMixin(Base) {
361
363
  const exists = fieldValue !== undefined && fieldValue !== null;
362
364
  // If type-qualified check, verify type matches
363
365
  if (exists && typeRef !== null) {
364
- return matchesType(fieldValue);
366
+ return await matchesType(fieldValue);
365
367
  }
366
368
  return exists;
367
369
  }
@@ -388,7 +390,7 @@ function createVariablesMixin(Base) {
388
390
  const exists = fieldValue !== undefined && fieldValue !== null;
389
391
  // If type-qualified check, verify type matches
390
392
  if (exists && typeRef !== null) {
391
- return matchesType(fieldValue);
393
+ return await matchesType(fieldValue);
392
394
  }
393
395
  return exists;
394
396
  }
@@ -552,7 +554,7 @@ function createVariablesMixin(Base) {
552
554
  if (node.typeRef !== null) {
553
555
  // Resolve TypeRef and validate against the declared type
554
556
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
555
- const resolved = this.resolveTypeRef(node.typeRef, (name) => getVariable(this.ctx, name));
557
+ const resolved = await this.resolveTypeRef(node.typeRef, (name) => getVariable(this.ctx, name));
556
558
  this.setVariable(node.name, input, resolved.structure, node.span.start);
557
559
  }
558
560
  else {
@@ -578,4 +580,3 @@ function createVariablesMixin(Base) {
578
580
  // TypeScript can't generate declarations for functions returning classes with protected members
579
581
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
580
582
  export const VariablesMixin = createVariablesMixin;
581
- //# sourceMappingURL=variables.js.map
@@ -38,4 +38,3 @@ export type EvaluatorConstructor<TBase extends EvaluatorBase = EvaluatorBase> =
38
38
  * ```
39
39
  */
40
40
  export type Mixin<TBase extends EvaluatorBase = EvaluatorBase, TExtension extends TBase = TBase> = (Base: EvaluatorConstructor<TBase>) => EvaluatorConstructor<TExtension>;
41
- //# sourceMappingURL=types.d.ts.map
@@ -7,4 +7,3 @@
7
7
  * @internal
8
8
  */
9
9
  export {};
10
- //# sourceMappingURL=types.js.map
@@ -23,4 +23,3 @@ export declare function execute(script: ScriptNode, context: RuntimeContext): Pr
23
23
  * @returns A stepper for step-by-step execution
24
24
  */
25
25
  export declare function createStepper(script: ScriptNode, context: RuntimeContext): ExecutionStepper;
26
- //# sourceMappingURL=execute.d.ts.map
@@ -171,4 +171,3 @@ function isRecoveryErrorNode(stmt) {
171
171
  function getInnerStatement(stmt) {
172
172
  return stmt.type === 'AnnotatedStatement' ? stmt.statement : stmt;
173
173
  }
174
- //# sourceMappingURL=execute.js.map
@@ -8,7 +8,7 @@
8
8
  * @internal
9
9
  */
10
10
  import type { SourceLocation } from '../../types.js';
11
- import type { RillFieldType, RillType } from './values.js';
11
+ import type { RillFieldDef, TypeStructure } from './values.js';
12
12
  /**
13
13
  * Field descriptor — carries field name and structural type when accessing a
14
14
  * dict-kind RillType field.
@@ -16,14 +16,13 @@ import type { RillFieldType, RillType } from './values.js';
16
16
  export interface RillFieldDescriptor {
17
17
  readonly __rill_field_descriptor: true;
18
18
  readonly fieldName: string;
19
- readonly fieldType: RillFieldType;
19
+ readonly fieldType: RillFieldDef;
20
20
  }
21
21
  /**
22
22
  * Build a frozen RillFieldDescriptor for the given field in a structural dict type.
23
23
  *
24
24
  * EC-1: Throws RILL-R003 when fieldName is absent from structuralType.fields.
25
25
  */
26
- export declare function buildFieldDescriptor(structuralType: RillType & {
27
- type: 'dict';
26
+ export declare function buildFieldDescriptor(structuralType: TypeStructure & {
27
+ kind: 'dict';
28
28
  }, fieldName: string, location: SourceLocation): RillFieldDescriptor;
29
- //# sourceMappingURL=field-descriptor.d.ts.map
@@ -14,7 +14,8 @@ import { RuntimeError } from '../../types.js';
14
14
  * EC-1: Throws RILL-R003 when fieldName is absent from structuralType.fields.
15
15
  */
16
16
  export function buildFieldDescriptor(structuralType, fieldName, location) {
17
- const fieldType = structuralType.fields?.[fieldName];
17
+ const fields = structuralType.fields;
18
+ const fieldType = fields?.[fieldName];
18
19
  if (fieldType === undefined) {
19
20
  throw new RuntimeError('RILL-R003', `Shape has no field "${fieldName}"`, location);
20
21
  }
@@ -24,4 +25,3 @@ export function buildFieldDescriptor(structuralType, fieldName, location) {
24
25
  fieldType,
25
26
  });
26
27
  }
27
- //# sourceMappingURL=field-descriptor.js.map
@@ -101,4 +101,3 @@ export declare function getDocumentationCoverage(ctx: RuntimeContext): Documenta
101
101
  * @returns Language reference text
102
102
  */
103
103
  export declare function getLanguageReference(): string;
104
- //# sourceMappingURL=introspection.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * Functions for inspecting runtime context at runtime.
5
5
  * These enable host applications to discover available functions and their signatures.
6
6
  */
7
- import { formatStructuralType, formatValue } from './values.js';
7
+ import { formatStructure, formatValue } from './values.js';
8
8
  import { isApplicationCallable, isRuntimeCallable, isScriptCallable, } from './callable.js';
9
9
  import { LANGUAGE_REFERENCE } from '../../generated/introspection-data.js';
10
10
  import { BUILTIN_FUNCTIONS } from '../ext/builtins.js';
@@ -40,7 +40,7 @@ export function getFunctions(ctx) {
40
40
  if (callable.params) {
41
41
  const params = callable.params.map((p) => ({
42
42
  name: p.name,
43
- type: p.type !== undefined ? formatStructuralType(p.type) : 'any',
43
+ type: p.type !== undefined ? formatStructure(p.type) : 'any',
44
44
  description: typeof p.annotations['description'] === 'string'
45
45
  ? p.annotations['description']
46
46
  : '',
@@ -50,7 +50,7 @@ export function getFunctions(ctx) {
50
50
  name,
51
51
  description: callable.annotations?.['description'] ?? '',
52
52
  params,
53
- returnType: formatStructuralType(callable.returnType.structure),
53
+ returnType: formatStructure(callable.returnType.structure),
54
54
  });
55
55
  }
56
56
  else {
@@ -93,7 +93,7 @@ export function getFunctions(ctx) {
93
93
  // Convert params to ParamMetadata using RillParam.type (IC-5)
94
94
  const params = value.params.map((p) => ({
95
95
  name: p.name,
96
- type: p.type !== undefined ? formatStructuralType(p.type) : 'any',
96
+ type: p.type !== undefined ? formatStructure(p.type) : 'any',
97
97
  description: typeof p.annotations['description'] === 'string'
98
98
  ? p.annotations['description']
99
99
  : '',
@@ -131,7 +131,7 @@ function serializeParam(p) {
131
131
  parts.push(`^(description: "${desc}") `);
132
132
  }
133
133
  // Name and type
134
- const typeName = p.type !== undefined ? formatStructuralType(p.type) : 'any';
134
+ const typeName = p.type !== undefined ? formatStructure(p.type) : 'any';
135
135
  parts.push(`${p.name}: ${typeName}`);
136
136
  // Default value
137
137
  if (p.defaultValue !== undefined) {
@@ -189,7 +189,7 @@ export function generateManifest(ctx) {
189
189
  if (!isApplicationCallable(callable) || callable.params === undefined) {
190
190
  continue;
191
191
  }
192
- const signature = serializeClosureSignature(callable.params, formatStructuralType(callable.returnType.structure), callable.annotations?.['description'] ?? undefined);
192
+ const signature = serializeClosureSignature(callable.params, formatStructure(callable.returnType.structure), callable.annotations?.['description'] ?? undefined);
193
193
  entries.push(` "${name}": ${signature}`);
194
194
  }
195
195
  if (entries.length === 0) {
@@ -252,4 +252,3 @@ export function getDocumentationCoverage(ctx) {
252
252
  export function getLanguageReference() {
253
253
  return LANGUAGE_REFERENCE;
254
254
  }
255
- //# sourceMappingURL=introspection.js.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared marker interfaces for forward declarations.
3
+ *
4
+ * These interfaces break circular dependencies between values.ts,
5
+ * type-structures.ts, and callable.ts. Actual types are defined in callable.ts.
6
+ */
7
+ export interface CallableMarker {
8
+ readonly __type: 'callable';
9
+ }
10
+ export interface FieldDescriptorMarker {
11
+ readonly __rill_field_descriptor: true;
12
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared marker interfaces for forward declarations.
3
+ *
4
+ * These interfaces break circular dependencies between values.ts,
5
+ * type-structures.ts, and callable.ts. Actual types are defined in callable.ts.
6
+ */
7
+ export {};
@@ -51,4 +51,3 @@ export declare const moduleResolver: SchemeResolver;
51
51
  */
52
52
  export declare const contextResolver: SchemeResolver;
53
53
  export declare const extResolver: SchemeResolver;
54
- //# sourceMappingURL=resolvers.d.ts.map
@@ -119,4 +119,3 @@ export const extResolver = (resource, config) => {
119
119
  }
120
120
  return { kind: 'value', value };
121
121
  };
122
- //# sourceMappingURL=resolvers.js.map
@@ -16,4 +16,3 @@ export declare class ReturnSignal extends Error {
16
16
  readonly value: RillValue;
17
17
  constructor(value: RillValue);
18
18
  }
19
- //# sourceMappingURL=signals.d.ts.map
@@ -23,4 +23,3 @@ export class ReturnSignal extends Error {
23
23
  this.name = 'ReturnSignal';
24
24
  }
25
25
  }
26
- //# sourceMappingURL=signals.js.map
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Type Registration Definitions
3
+ *
4
+ * Defines the TypeDefinition interface, TypeProtocol interface, and
5
+ * BUILT_IN_TYPES registration array. Each of the 12 built-in types
6
+ * carries identity predicates, protocol functions (format, eq, compare,
7
+ * convertTo, serialize), and a methods record populated from BUILTIN_METHODS.
8
+ *
9
+ * Dispatch functions (inferType, formatValue, deepEquals, serializeValue,
10
+ * deserializeValue, copyValue) iterate registrations and delegate to
11
+ * per-type protocol implementations.
12
+ *
13
+ * Registration order:
14
+ * primitives -> discriminator-based -> structural -> list -> dict fallback
15
+ *
16
+ * @internal
17
+ */
18
+ import type { TypeStructure, RillValue, RillFieldDef, RillTuple, RillOrdered, RillVector, RillTypeValue, RillIterator } from './values.js';
19
+ import type { RillFunction } from './callable.js';
20
+ import { isTuple, isVector, isOrdered, isTypeValue, isIterator, createTuple, createOrdered, createVector } from './values.js';
21
+ /**
22
+ * Protocol functions that define per-type behavior.
23
+ * Every type must provide `format`. All other protocols are optional.
24
+ */
25
+ export interface TypeProtocol {
26
+ format: (v: RillValue) => string;
27
+ structure?: ((v: RillValue) => TypeStructure) | undefined;
28
+ eq?: ((a: RillValue, b: RillValue) => boolean) | undefined;
29
+ compare?: ((a: RillValue, b: RillValue) => number) | undefined;
30
+ convertTo?: Record<string, (v: RillValue) => RillValue> | undefined;
31
+ serialize?: ((v: RillValue) => unknown) | undefined;
32
+ deserialize?: ((data: unknown) => RillValue) | undefined;
33
+ }
34
+ /**
35
+ * A single type registration record. Each of the 12 built-in types
36
+ * has exactly one TypeDefinition in the BUILT_IN_TYPES array.
37
+ */
38
+ export interface TypeDefinition {
39
+ name: string;
40
+ identity: (v: RillValue) => boolean;
41
+ isLeaf: boolean;
42
+ immutable: boolean;
43
+ methods: Record<string, RillFunction>;
44
+ protocol: TypeProtocol;
45
+ }
46
+ /**
47
+ * All 12 built-in type registrations.
48
+ *
49
+ * Registration order:
50
+ * 1. Primitives: string, number, bool
51
+ * 2. Discriminator-based: tuple, ordered, vector, type, closure, field_descriptor
52
+ * 3. Structural: iterator
53
+ * 4. list
54
+ * 5. dict (fallback, must be last)
55
+ *
56
+ * AC-1: 12 registrations, one per type.
57
+ * BC-2: Vector identity checked before dict fallback.
58
+ * EC-3: Iterator has no protocol.eq.
59
+ * EC-4: Bool has no protocol.compare.
60
+ * EC-8: Non-serializable types throw plain Error.
61
+ */
62
+ export declare const BUILT_IN_TYPES: readonly TypeDefinition[];
63
+ /**
64
+ * Infer the Rill type name from a runtime value.
65
+ * Iterates registrations in order; returns first matching name.
66
+ * Returns 'string' as fallback (BC-1: null IS type string, not a coercion).
67
+ *
68
+ * IR-2: Return type widens from RillTypeName to string for extensibility.
69
+ */
70
+ export declare function inferType(value: RillValue): string;
71
+ /**
72
+ * Format a value as a human-readable string.
73
+ * Determines type via inferType, then calls protocol.format.
74
+ * Falls back to String(value) when no registration matches.
75
+ *
76
+ * IR-3: Protocol dispatcher for formatting.
77
+ */
78
+ export declare function formatValue(value: RillValue): string;
79
+ /**
80
+ * Deep equality comparison for two Rill values.
81
+ * Short-circuit: a === b returns true.
82
+ * Dispatches to left operand's protocol.eq.
83
+ * No protocol.eq returns false.
84
+ *
85
+ * IR-4: Container protocol.eq calls deepEquals recursively.
86
+ */
87
+ export declare function deepEquals(a: RillValue, b: RillValue): boolean;
88
+ /**
89
+ * Serialize a Rill value for JSON transport.
90
+ * Dispatches to protocol.serialize; container types recurse.
91
+ *
92
+ * IR-7: Renamed from valueToJSON.
93
+ */
94
+ export declare function serializeValue(value: RillValue): unknown;
95
+ /**
96
+ * Deserialize raw data into a Rill value.
97
+ * Dispatches to protocol.deserialize for the given type name.
98
+ * Falls back to raw value when no protocol.deserialize exists (primitives).
99
+ *
100
+ * IR-8: Raw value fallback rejects null/undefined inputs with RILL-R004.
101
+ * EC-9: Invalid data raises RILL-R004.
102
+ * EC-10: null/undefined input raises RILL-R004.
103
+ */
104
+ export declare function deserializeValue(data: unknown, typeName: string): RillValue;
105
+ /**
106
+ * Copy a Rill value.
107
+ * Reads immutable flag from registration.
108
+ * Immutable types return same reference.
109
+ * Mutable types (list, dict, iterator) recurse.
110
+ *
111
+ * IR-9: Renamed from deepCopyRillValue.
112
+ */
113
+ export declare function copyValue(value: RillValue): RillValue;
114
+ /**
115
+ * Populate registration `methods` fields from BUILTIN_METHODS.
116
+ *
117
+ * Called after builtins.ts finishes initialization to avoid circular
118
+ * dependency at module load time. The 6 method-bearing types (string,
119
+ * number, bool, list, dict, vector) receive their methods records;
120
+ * other types keep `methods: {}`.
121
+ *
122
+ * AC-3: Consolidates method data into registrations.
123
+ *
124
+ * MUTATION NOTE: BUILT_IN_TYPES is shallow-frozen (the array), but each
125
+ * registration object is mutable. This function relies on that mutability.
126
+ * If registration objects are ever deep-frozen (e.g. Object.freeze(reg)),
127
+ * this assignment will throw in strict mode. The runtime guard below catches
128
+ * that condition early with a clear error rather than a silent no-op.
129
+ */
130
+ export declare function populateBuiltinMethods(builtinMethods: Record<string, Record<string, RillFunction>>): void;
131
+ export { createTuple, createOrdered, createVector };
132
+ export { isTuple, isVector, isTypeValue, isOrdered, isIterator };
133
+ /** @deprecated Use isIterator instead. */
134
+ export declare const isRillIterator: typeof isIterator;
135
+ export type { TypeStructure };
136
+ export type { RillValue, RillTuple, RillOrdered, RillVector, RillTypeValue, RillIterator, RillFieldDef, };