@rcrsr/rill 0.8.5 → 0.9.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 (190) hide show
  1. package/dist/ast-nodes.d.ts +189 -49
  2. package/dist/ast-nodes.d.ts.map +1 -1
  3. package/dist/ast-unions.d.ts +1 -1
  4. package/dist/ast-unions.d.ts.map +1 -1
  5. package/dist/constants.d.ts +14 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +29 -0
  8. package/dist/constants.js.map +1 -0
  9. package/dist/error-classes.d.ts +3 -1
  10. package/dist/error-classes.d.ts.map +1 -1
  11. package/dist/error-classes.js +11 -5
  12. package/dist/error-classes.js.map +1 -1
  13. package/dist/error-registry.d.ts.map +1 -1
  14. package/dist/error-registry.js +293 -9
  15. package/dist/error-registry.js.map +1 -1
  16. package/dist/ext/crypto/index.d.ts +2 -1
  17. package/dist/ext/crypto/index.d.ts.map +1 -1
  18. package/dist/ext/crypto/index.js +7 -0
  19. package/dist/ext/crypto/index.js.map +1 -1
  20. package/dist/ext/exec/index.d.ts +2 -1
  21. package/dist/ext/exec/index.d.ts.map +1 -1
  22. package/dist/ext/exec/index.js +6 -0
  23. package/dist/ext/exec/index.js.map +1 -1
  24. package/dist/ext/fetch/index.d.ts +2 -1
  25. package/dist/ext/fetch/index.d.ts.map +1 -1
  26. package/dist/ext/fetch/index.js +6 -0
  27. package/dist/ext/fetch/index.js.map +1 -1
  28. package/dist/ext/fs/index.d.ts +2 -1
  29. package/dist/ext/fs/index.d.ts.map +1 -1
  30. package/dist/ext/fs/index.js +3 -0
  31. package/dist/ext/fs/index.js.map +1 -1
  32. package/dist/ext/kv/index.d.ts +48 -12
  33. package/dist/ext/kv/index.d.ts.map +1 -1
  34. package/dist/ext/kv/index.js +225 -63
  35. package/dist/ext/kv/index.js.map +1 -1
  36. package/dist/ext/kv/store.d.ts +4 -0
  37. package/dist/ext/kv/store.d.ts.map +1 -1
  38. package/dist/ext/kv/store.js +14 -0
  39. package/dist/ext/kv/store.js.map +1 -1
  40. package/dist/generated/introspection-data.d.ts +1 -1
  41. package/dist/generated/introspection-data.d.ts.map +1 -1
  42. package/dist/generated/introspection-data.js +194 -185
  43. package/dist/generated/introspection-data.js.map +1 -1
  44. package/dist/generated/version-data.d.ts +1 -1
  45. package/dist/generated/version-data.js +3 -3
  46. package/dist/highlight-map.d.ts.map +1 -1
  47. package/dist/highlight-map.js +8 -2
  48. package/dist/highlight-map.js.map +1 -1
  49. package/dist/index.d.ts +2 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +5 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/lexer/operators.d.ts.map +1 -1
  54. package/dist/lexer/operators.js +0 -2
  55. package/dist/lexer/operators.js.map +1 -1
  56. package/dist/lexer/readers.d.ts +18 -1
  57. package/dist/lexer/readers.d.ts.map +1 -1
  58. package/dist/lexer/readers.js +55 -0
  59. package/dist/lexer/readers.js.map +1 -1
  60. package/dist/parser/helpers.d.ts +8 -13
  61. package/dist/parser/helpers.d.ts.map +1 -1
  62. package/dist/parser/helpers.js +42 -35
  63. package/dist/parser/helpers.js.map +1 -1
  64. package/dist/parser/index.d.ts +1 -0
  65. package/dist/parser/index.d.ts.map +1 -1
  66. package/dist/parser/index.js +1 -0
  67. package/dist/parser/index.js.map +1 -1
  68. package/dist/parser/parser-collect.d.ts.map +1 -1
  69. package/dist/parser/parser-collect.js +34 -5
  70. package/dist/parser/parser-collect.js.map +1 -1
  71. package/dist/parser/parser-control.d.ts.map +1 -1
  72. package/dist/parser/parser-control.js +9 -0
  73. package/dist/parser/parser-control.js.map +1 -1
  74. package/dist/parser/parser-expr.d.ts +3 -1
  75. package/dist/parser/parser-expr.d.ts.map +1 -1
  76. package/dist/parser/parser-expr.js +377 -100
  77. package/dist/parser/parser-expr.js.map +1 -1
  78. package/dist/parser/parser-extract.d.ts +3 -5
  79. package/dist/parser/parser-extract.d.ts.map +1 -1
  80. package/dist/parser/parser-extract.js +37 -69
  81. package/dist/parser/parser-extract.js.map +1 -1
  82. package/dist/parser/parser-functions.d.ts +2 -2
  83. package/dist/parser/parser-functions.d.ts.map +1 -1
  84. package/dist/parser/parser-functions.js +112 -36
  85. package/dist/parser/parser-functions.js.map +1 -1
  86. package/dist/parser/parser-literals.d.ts +4 -3
  87. package/dist/parser/parser-literals.d.ts.map +1 -1
  88. package/dist/parser/parser-literals.js +257 -42
  89. package/dist/parser/parser-literals.js.map +1 -1
  90. package/dist/parser/parser-script.d.ts.map +1 -1
  91. package/dist/parser/parser-script.js +25 -12
  92. package/dist/parser/parser-script.js.map +1 -1
  93. package/dist/parser/parser-shape.d.ts +13 -0
  94. package/dist/parser/parser-shape.d.ts.map +1 -0
  95. package/dist/parser/parser-shape.js +72 -0
  96. package/dist/parser/parser-shape.js.map +1 -0
  97. package/dist/parser/parser-types.d.ts +21 -0
  98. package/dist/parser/parser-types.d.ts.map +1 -0
  99. package/dist/parser/parser-types.js +30 -0
  100. package/dist/parser/parser-types.js.map +1 -0
  101. package/dist/parser/parser-variables.d.ts.map +1 -1
  102. package/dist/parser/parser-variables.js +10 -1
  103. package/dist/parser/parser-variables.js.map +1 -1
  104. package/dist/runtime/core/callable.d.ts +25 -22
  105. package/dist/runtime/core/callable.d.ts.map +1 -1
  106. package/dist/runtime/core/callable.js +43 -36
  107. package/dist/runtime/core/callable.js.map +1 -1
  108. package/dist/runtime/core/context.d.ts.map +1 -1
  109. package/dist/runtime/core/context.js +8 -8
  110. package/dist/runtime/core/context.js.map +1 -1
  111. package/dist/runtime/core/equals.d.ts.map +1 -1
  112. package/dist/runtime/core/equals.js +142 -30
  113. package/dist/runtime/core/equals.js.map +1 -1
  114. package/dist/runtime/core/eval/base.d.ts +2 -2
  115. package/dist/runtime/core/eval/base.d.ts.map +1 -1
  116. package/dist/runtime/core/eval/evaluator.d.ts.map +1 -1
  117. package/dist/runtime/core/eval/evaluator.js +3 -1
  118. package/dist/runtime/core/eval/evaluator.js.map +1 -1
  119. package/dist/runtime/core/eval/index.d.ts +16 -1
  120. package/dist/runtime/core/eval/index.d.ts.map +1 -1
  121. package/dist/runtime/core/eval/index.js +22 -2
  122. package/dist/runtime/core/eval/index.js.map +1 -1
  123. package/dist/runtime/core/eval/mixins/annotations.d.ts.map +1 -1
  124. package/dist/runtime/core/eval/mixins/annotations.js +14 -8
  125. package/dist/runtime/core/eval/mixins/annotations.js.map +1 -1
  126. package/dist/runtime/core/eval/mixins/closures.d.ts +0 -2
  127. package/dist/runtime/core/eval/mixins/closures.d.ts.map +1 -1
  128. package/dist/runtime/core/eval/mixins/closures.js +286 -105
  129. package/dist/runtime/core/eval/mixins/closures.js.map +1 -1
  130. package/dist/runtime/core/eval/mixins/collections.d.ts.map +1 -1
  131. package/dist/runtime/core/eval/mixins/collections.js +65 -25
  132. package/dist/runtime/core/eval/mixins/collections.js.map +1 -1
  133. package/dist/runtime/core/eval/mixins/control-flow.d.ts.map +1 -1
  134. package/dist/runtime/core/eval/mixins/control-flow.js +21 -17
  135. package/dist/runtime/core/eval/mixins/control-flow.js.map +1 -1
  136. package/dist/runtime/core/eval/mixins/conversion.d.ts +30 -0
  137. package/dist/runtime/core/eval/mixins/conversion.d.ts.map +1 -0
  138. package/dist/runtime/core/eval/mixins/conversion.js +203 -0
  139. package/dist/runtime/core/eval/mixins/conversion.js.map +1 -0
  140. package/dist/runtime/core/eval/mixins/core.d.ts.map +1 -1
  141. package/dist/runtime/core/eval/mixins/core.js +101 -32
  142. package/dist/runtime/core/eval/mixins/core.js.map +1 -1
  143. package/dist/runtime/core/eval/mixins/extraction.d.ts.map +1 -1
  144. package/dist/runtime/core/eval/mixins/extraction.js +136 -30
  145. package/dist/runtime/core/eval/mixins/extraction.js.map +1 -1
  146. package/dist/runtime/core/eval/mixins/list-dispatch.d.ts +17 -0
  147. package/dist/runtime/core/eval/mixins/list-dispatch.d.ts.map +1 -0
  148. package/dist/runtime/core/eval/mixins/list-dispatch.js +97 -0
  149. package/dist/runtime/core/eval/mixins/list-dispatch.js.map +1 -0
  150. package/dist/runtime/core/eval/mixins/literals.d.ts.map +1 -1
  151. package/dist/runtime/core/eval/mixins/literals.js +64 -82
  152. package/dist/runtime/core/eval/mixins/literals.js.map +1 -1
  153. package/dist/runtime/core/eval/mixins/types.d.ts +4 -0
  154. package/dist/runtime/core/eval/mixins/types.d.ts.map +1 -1
  155. package/dist/runtime/core/eval/mixins/types.js +202 -3
  156. package/dist/runtime/core/eval/mixins/types.js.map +1 -1
  157. package/dist/runtime/core/eval/mixins/variables.d.ts.map +1 -1
  158. package/dist/runtime/core/eval/mixins/variables.js +42 -7
  159. package/dist/runtime/core/eval/mixins/variables.js.map +1 -1
  160. package/dist/runtime/core/execute.d.ts.map +1 -1
  161. package/dist/runtime/core/execute.js +2 -15
  162. package/dist/runtime/core/execute.js.map +1 -1
  163. package/dist/runtime/core/field-descriptor.d.ts +29 -0
  164. package/dist/runtime/core/field-descriptor.d.ts.map +1 -0
  165. package/dist/runtime/core/field-descriptor.js +27 -0
  166. package/dist/runtime/core/field-descriptor.js.map +1 -0
  167. package/dist/runtime/core/types.d.ts +15 -6
  168. package/dist/runtime/core/types.d.ts.map +1 -1
  169. package/dist/runtime/core/types.js.map +1 -1
  170. package/dist/runtime/core/values.d.ts +107 -9
  171. package/dist/runtime/core/values.d.ts.map +1 -1
  172. package/dist/runtime/core/values.js +453 -43
  173. package/dist/runtime/core/values.js.map +1 -1
  174. package/dist/runtime/ext/builtins.d.ts.map +1 -1
  175. package/dist/runtime/ext/builtins.js +47 -107
  176. package/dist/runtime/ext/builtins.js.map +1 -1
  177. package/dist/runtime/ext/extensions.d.ts +134 -1
  178. package/dist/runtime/ext/extensions.d.ts.map +1 -1
  179. package/dist/runtime/ext/extensions.js.map +1 -1
  180. package/dist/runtime/index.d.ts +7 -4
  181. package/dist/runtime/index.d.ts.map +1 -1
  182. package/dist/runtime/index.js +7 -2
  183. package/dist/runtime/index.js.map +1 -1
  184. package/dist/token-types.d.ts +7 -2
  185. package/dist/token-types.d.ts.map +1 -1
  186. package/dist/token-types.js +9 -2
  187. package/dist/token-types.js.map +1 -1
  188. package/dist/value-types.d.ts +19 -1
  189. package/dist/value-types.d.ts.map +1 -1
  190. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../../../src/runtime/core/eval/mixins/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,sCAAsC;AACtC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AACH,SAAS,sBAAsB,CAAC,IAAyC;IACvE,OAAO,MAAM,oBAAqB,SAAQ,IAAI;QAC5C;;;;;;WAMG;QACH,KAAK,CAAC,gBAAgB,CACpB,IAA4C;YAE5C,8BAA8B;YAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;gBACvC,OAAO,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;YAC9C,CAAC;YAED,yCAAyC;YACzC,8DAA8D;YAC9D,MAAM,KAAK,GAAG,MAAO,IAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAEtE,+CAA+C;YAC/C,0EAA0E;YAC1E,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAEtC,6DAA6D;YAC7D,+DAA+D;YAE/D,OAAO,KAAK,CAAC;QACf,CAAC;QAED;;;;;;WAMG;QACK,KAAK,CAAC,yBAAyB,CACrC,IAA4B;YAE5B,iEAAiE;YACjE,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAExE,2DAA2D;YAC3D,MAAM,SAAS,GAAG,IAAI,CAA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BACrC,CAAC;yBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;wBACtC,0DAA0D;wBAC1D,MAAM,IAAI,YAAY,CACpB,WAAW,EACX,2DAA2D,EAC3D,SAAS,CAAC,IAAI,CAAC,KAAK,CACrB,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,MAAM,IAAI,YAAY,CACpB,WAAW,EACX,wCAAwC,OAAO,WAAW,EAAE,EAC5D,SAAS,CAAC,IAAI,CAAC,KAAK,CACrB,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAED;;;;WAIG;QACH,aAAa,CAAC,GAAW;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC;QAED;;;;WAIG;QACH,iBAAiB;YACf,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;YACD,OAAO,sBAAsB,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,gGAAgG;AAChG,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAA6B,CAAC"}
1
+ {"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../../../../src/runtime/core/eval/mixins/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,sCAAsC;AACtC,MAAM,sBAAsB,GAAG,KAAK,CAAC;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,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC;QAED;;;;;;;;WAQG;QACH,iBAAiB,CAAC,mBAA+C;YAC/D,MAAM,KAAK,GAAG,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC;YAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;YACD,OAAO,sBAAsB,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,gGAAgG;AAChG,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAA6B,CAAC"}
@@ -8,7 +8,6 @@
8
8
  * - Invoke operations
9
9
  * - Pipe invocations
10
10
  * - Property access on piped values
11
- * - Closure chains
12
11
  *
13
12
  * Interface requirements (from spec):
14
13
  * - invokeCallable(callable, args, location) -> Promise<RillValue>
@@ -20,7 +19,6 @@
20
19
  * - evaluatePipeInvoke(node, input) -> Promise<RillValue>
21
20
  * - evaluateMethod(node, receiver) -> Promise<RillValue>
22
21
  * - evaluateInvoke(node, receiver) -> Promise<RillValue>
23
- * - evaluateClosureChain(node, input) -> Promise<RillValue>
24
22
  *
25
23
  * Error Handling:
26
24
  * - Undefined functions throw RuntimeError(RUNTIME_UNDEFINED_FUNCTION) [EC-18]
@@ -1 +1 @@
1
- {"version":3,"file":"closures.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/core/eval/mixins/closures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AA+2BH,eAAO,MAAM,aAAa,EAA0B,GAAG,CAAC"}
1
+ {"version":3,"file":"closures.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/core/eval/mixins/closures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAmoCH,eAAO,MAAM,aAAa,EAA0B,GAAG,CAAC"}
@@ -8,7 +8,6 @@
8
8
  * - Invoke operations
9
9
  * - Pipe invocations
10
10
  * - Property access on piped values
11
- * - Closure chains
12
11
  *
13
12
  * Interface requirements (from spec):
14
13
  * - invokeCallable(callable, args, location) -> Promise<RillValue>
@@ -20,7 +19,6 @@
20
19
  * - evaluatePipeInvoke(node, input) -> Promise<RillValue>
21
20
  * - evaluateMethod(node, receiver) -> Promise<RillValue>
22
21
  * - evaluateInvoke(node, receiver) -> Promise<RillValue>
23
- * - evaluateClosureChain(node, input) -> Promise<RillValue>
24
22
  *
25
23
  * Error Handling:
26
24
  * - Undefined functions throw RuntimeError(RUNTIME_UNDEFINED_FUNCTION) [EC-18]
@@ -46,9 +44,9 @@
46
44
  * @internal
47
45
  */
48
46
  import { RuntimeError } from '../../../../types.js';
49
- import { isCallable, isScriptCallable, isApplicationCallable, isDict, validateCallableArgs, } from '../../callable.js';
47
+ import { isCallable, isScriptCallable, isApplicationCallable, isDict, validateCallableArgs, paramsToStructuralType, } from '../../callable.js';
50
48
  import { getVariable, pushCallFrame, popCallFrame } from '../../context.js';
51
- import { inferType, isTuple } from '../../values.js';
49
+ import { inferType, isTypeValue, isTuple, isOrdered, inferStructuralType, } from '../../values.js';
52
50
  /**
53
51
  * ClosuresMixin implementation.
54
52
  *
@@ -70,14 +68,13 @@ import { inferType, isTuple } from '../../values.js';
70
68
  * - evaluatePipeInvoke(node, input) -> Promise<RillValue>
71
69
  * - evaluateMethod(node, receiver) -> Promise<RillValue>
72
70
  * - evaluateInvoke(node, receiver) -> Promise<RillValue>
73
- * - evaluateClosureChain(node, input) -> Promise<RillValue>
74
71
  * - evaluateArgs(argExprs) -> Promise<RillValue[]> (helper)
75
72
  * - invokeFnCallable(callable, args, location) -> Promise<RillValue> (helper)
76
73
  * - invokeScriptCallable(callable, args, location) -> Promise<RillValue> (helper)
77
- * - invokeScriptCallableWithArgs(callable, tuple, location) -> Promise<RillValue> (helper)
78
74
  * - createCallableContext(callable) -> RuntimeContext (helper)
79
75
  * - validateParamType(param, value, location) -> void (helper)
80
76
  * - inferTypeFromDefault(defaultValue) -> RillTypeName | null (helper)
77
+ * - bindArgsToParams(argNodes, callable, callLocation) -> Promise<BoundArgs> (helper)
81
78
  */
82
79
  function createClosuresMixin(Base) {
83
80
  return class ClosuresEvaluator extends Base {
@@ -89,8 +86,9 @@ function createClosuresMixin(Base) {
89
86
  const savedPipeValue = this.ctx.pipeValue;
90
87
  const args = [];
91
88
  for (const arg of argExprs) {
89
+ const expr = arg.type === 'SpreadArg' ? arg.expression : arg;
92
90
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
- args.push(await this.evaluateExpression(arg));
91
+ args.push(await this.evaluateExpression(expr));
94
92
  }
95
93
  this.ctx.pipeValue = savedPipeValue;
96
94
  return args;
@@ -189,6 +187,8 @@ function createClosuresMixin(Base) {
189
187
  */
190
188
  validateParamType(param, value, callLocation) {
191
189
  const expectedType = param.typeName ?? this.inferTypeFromDefault(param.defaultValue);
190
+ if (expectedType === 'any')
191
+ return;
192
192
  if (expectedType !== null) {
193
193
  const valueType = inferType(value);
194
194
  if (valueType !== expectedType) {
@@ -201,10 +201,6 @@ function createClosuresMixin(Base) {
201
201
  * Handles parameter binding, default values, and type checking.
202
202
  */
203
203
  async invokeScriptCallable(callable, args, callLocation) {
204
- const firstArg = args[0];
205
- if (args.length === 1 && firstArg !== undefined && isTuple(firstArg)) {
206
- return this.invokeScriptCallableWithArgs(callable, firstArg, callLocation);
207
- }
208
204
  const callableCtx = this.createCallableContext(callable);
209
205
  // Validate excess arguments (EC-8)
210
206
  if (args.length > callable.params.length) {
@@ -234,73 +230,14 @@ function createClosuresMixin(Base) {
234
230
  this.ctx = callableCtx;
235
231
  try {
236
232
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
237
- return await this.evaluateBodyExpression(callable.body);
238
- }
239
- finally {
240
- this.ctx = savedCtx;
241
- }
242
- }
243
- /**
244
- * Invoke script callable with tuple arguments (named or positional).
245
- * Handles *[...] and *[name: val] argument unpacking.
246
- */
247
- async invokeScriptCallableWithArgs(closure, tupleValue, callLocation) {
248
- const closureCtx = this.createCallableContext(closure);
249
- const hasNumericKeys = [...tupleValue.entries.keys()].some((k) => typeof k === 'number');
250
- const hasStringKeys = [...tupleValue.entries.keys()].some((k) => typeof k === 'string');
251
- if (hasNumericKeys && hasStringKeys) {
252
- throw new RuntimeError('RILL-R001', 'Tuple cannot mix positional (numeric) and named (string) keys', callLocation);
253
- }
254
- const boundParams = new Set();
255
- if (hasNumericKeys) {
256
- for (const [key, value] of tupleValue.entries) {
257
- const position = key;
258
- const param = closure.params[position];
259
- if (param === undefined) {
260
- throw new RuntimeError('RILL-R001', `Extra argument at position ${position} (closure has ${closure.params.length} params)`, callLocation, { position, paramCount: closure.params.length });
261
- }
262
- this.validateParamType(param, value, callLocation);
263
- closureCtx.variables.set(param.name, value);
264
- boundParams.add(param.name);
233
+ const result = await this.evaluateBodyExpression(callable.body);
234
+ // IR-4: Assert return value against declared returnShape (AC-14, AC-15, AC-16)
235
+ if (callable.returnShape !== undefined) {
236
+ // EC-4: Type assertion — value must match the declared scalar type
237
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
238
+ this.assertType(result, callable.returnShape.typeName, callLocation);
265
239
  }
266
- }
267
- else if (hasStringKeys) {
268
- const paramNames = new Set(closure.params.map((p) => p.name));
269
- for (const [key, value] of tupleValue.entries) {
270
- const name = key;
271
- if (!paramNames.has(name)) {
272
- throw new RuntimeError('RILL-R001', `Unknown argument '${name}' (valid params: ${[...paramNames].join(', ')})`, callLocation, { argName: name, validParams: [...paramNames] });
273
- }
274
- const param = closure.params.find((p) => p.name === name);
275
- this.validateParamType(param, value, callLocation);
276
- closureCtx.variables.set(name, value);
277
- // Block-closures have param named '$': sync with pipeValue for bare $ references
278
- if (name === '$') {
279
- closureCtx.pipeValue = value;
280
- }
281
- boundParams.add(name);
282
- }
283
- }
284
- for (const param of closure.params) {
285
- if (!boundParams.has(param.name)) {
286
- if (param.defaultValue !== null) {
287
- closureCtx.variables.set(param.name, param.defaultValue);
288
- // Block-closures have param named '$': sync with pipeValue for bare $ references
289
- if (param.name === '$') {
290
- closureCtx.pipeValue = param.defaultValue;
291
- }
292
- }
293
- else {
294
- throw new RuntimeError('RILL-R001', `Missing argument '${param.name}' (no default value)`, callLocation, { paramName: param.name });
295
- }
296
- }
297
- }
298
- // Switch context to callable context
299
- const savedCtx = this.ctx;
300
- this.ctx = closureCtx;
301
- try {
302
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
303
- return await this.evaluateBodyExpression(closure.body);
240
+ return result;
304
241
  }
305
242
  finally {
306
243
  this.ctx = savedCtx;
@@ -316,6 +253,32 @@ function createClosuresMixin(Base) {
316
253
  if (!fn) {
317
254
  throw new RuntimeError('RILL-R006', `Unknown function: ${node.name}`, this.getNodeLocation(node), { functionName: node.name });
318
255
  }
256
+ // EC-10/EC-11: spread-aware path for host calls
257
+ const hasSpread = node.args.some((a) => a.type === 'SpreadArg');
258
+ if (hasSpread) {
259
+ if (typeof fn === 'function') {
260
+ // EC-10: raw built-in (RuntimeCallable) — spread not supported
261
+ throw new RuntimeError('RILL-R001', `Spread not supported for built-in function '${node.name}'`, this.getNodeLocation(node), { functionName: node.name });
262
+ }
263
+ // EC-11: ApplicationCallable — bindArgsToParams handles no-params guard
264
+ const boundArgs = await this.bindArgsToParams(node.args, fn, node.span.start);
265
+ const orderedArgs = fn.params.map((p) => boundArgs.params.get(p.name));
266
+ // Observability: onHostCall before execution
267
+ this.ctx.observability.onHostCall?.({
268
+ name: node.name,
269
+ args: orderedArgs,
270
+ });
271
+ const startTime = performance.now();
272
+ const wrappedPromise = this.withTimeout(this.invokeCallable(fn, orderedArgs, node.span.start, node.name), this.ctx.timeout, node.name, node);
273
+ const result = await wrappedPromise;
274
+ const durationMs = performance.now() - startTime;
275
+ this.ctx.observability.onFunctionReturn?.({
276
+ name: node.name,
277
+ value: result,
278
+ durationMs,
279
+ });
280
+ return result;
281
+ }
319
282
  const args = await this.evaluateArgs(node.args);
320
283
  // Add pipe value to empty args list UNLESS function has typed params with length 0
321
284
  // (typed functions with params: [] explicitly declare zero parameters)
@@ -359,6 +322,50 @@ function createClosuresMixin(Base) {
359
322
  });
360
323
  return result;
361
324
  }
325
+ /**
326
+ * Evaluate host function reference: ns::name (no parens, namespaced).
327
+ *
328
+ * When pipeValue is null (value-capture context): returns the
329
+ * ApplicationCallable directly without invoking [IR-4].
330
+ *
331
+ * When pipeValue is set (pipe/branch context): invokes the callable
332
+ * with the pipe value as the implicit argument, consistent with how
333
+ * bare HostRef behaves as a pipe-stage expression [IR-4].
334
+ *
335
+ * Throws RILL-R006 when the function name is not registered [EC-4].
336
+ */
337
+ async evaluateHostRef(node) {
338
+ this.checkAborted(node);
339
+ const fn = this.ctx.functions.get(node.name);
340
+ if (!fn) {
341
+ throw new RuntimeError('RILL-R006', `Function "${node.name}" not found`, this.getNodeLocation(node), { functionName: node.name });
342
+ }
343
+ // Build ApplicationCallable wrapper for raw CallableFn; pass through
344
+ // ApplicationCallable objects directly.
345
+ let appCallable;
346
+ if (typeof fn === 'function') {
347
+ appCallable = {
348
+ __type: 'callable',
349
+ kind: 'application',
350
+ fn,
351
+ params: undefined,
352
+ isProperty: false,
353
+ };
354
+ }
355
+ else {
356
+ appCallable = fn;
357
+ }
358
+ // Value-capture context: no pipe value → return callable without invoking [IR-4]
359
+ if (this.ctx.pipeValue === null) {
360
+ return appCallable;
361
+ }
362
+ // Pipe/branch context: pipe value present → invoke with it as implicit argument
363
+ const fnHasTypedZeroParams = appCallable.params !== undefined && appCallable.params.length === 0;
364
+ const args = fnHasTypedZeroParams
365
+ ? []
366
+ : [this.ctx.pipeValue];
367
+ return this.invokeCallable(appCallable, args, this.getNodeLocation(node), node.name);
368
+ }
362
369
  /**
363
370
  * Evaluate closure call: $fn(args)
364
371
  * Delegates to evaluateClosureCallWithPipe using current pipe value.
@@ -396,6 +403,15 @@ function createClosuresMixin(Base) {
396
403
  throw new RuntimeError('RILL-R002', `'${fullPath}' is not callable`, this.getNodeLocation(node), { path: fullPath, actualType: inferType(value) });
397
404
  }
398
405
  const closure = value;
406
+ // Spread-aware path: when args contain a SpreadArgNode use bindArgsToParams
407
+ if (node.args.some((a) => a.type === 'SpreadArg')) {
408
+ if (!isScriptCallable(closure) && !isApplicationCallable(closure)) {
409
+ throw new RuntimeError('RILL-R001', `Spread not supported for built-in callable at '${fullPath}'`, this.getNodeLocation(node));
410
+ }
411
+ const boundArgs = await this.bindArgsToParams(node.args, closure, node.span.start);
412
+ const orderedArgs = closure.params.map((p) => boundArgs.params.get(p.name));
413
+ return this.invokeCallable(closure, orderedArgs, node.span.start, fullPath);
414
+ }
399
415
  const args = await this.evaluateArgs(node.args);
400
416
  // If no explicit args and has pipe input, add pipe value as first arg
401
417
  // UNLESS closure has zero parameters (explicit zero-param signature)
@@ -464,6 +480,12 @@ function createClosuresMixin(Base) {
464
480
  if (!isScriptCallable(input)) {
465
481
  throw new RuntimeError('RILL-R002', `Cannot invoke non-closure value (got ${typeof input})`, this.getNodeLocation(node));
466
482
  }
483
+ // Spread-aware path: when args contain a SpreadArgNode use bindArgsToParams
484
+ if (node.args.some((a) => a.type === 'SpreadArg')) {
485
+ const boundArgs = await this.bindArgsToParams(node.args, input, node.span.start);
486
+ const orderedArgs = input.params.map((p) => boundArgs.params.get(p.name));
487
+ return this.invokeScriptCallable(input, orderedArgs, node.span.start);
488
+ }
467
489
  const args = await this.evaluateArgs(node.args);
468
490
  return this.invokeScriptCallable(input, args, node.span.start);
469
491
  }
@@ -480,6 +502,10 @@ function createClosuresMixin(Base) {
480
502
  if (isCallable(receiver)) {
481
503
  throw new RuntimeError('RILL-R003', `Method .${node.name} not available on callable (invoke with -> $() first)`, this.getNodeLocation(node), { methodName: node.name, receiverType: 'callable' });
482
504
  }
505
+ // IR-3: .name on type values returns the typeName string (method path)
506
+ if (isTypeValue(receiver) && node.name === 'name') {
507
+ return receiver.typeName;
508
+ }
483
509
  const args = await this.evaluateArgs(node.args);
484
510
  if (isDict(receiver)) {
485
511
  const dictValue = receiver[node.name];
@@ -506,35 +532,17 @@ function createClosuresMixin(Base) {
506
532
  if (!isCallable(receiver)) {
507
533
  throw new RuntimeError('RILL-R002', `Cannot invoke non-callable value (got ${inferType(receiver)})`, this.getNodeLocation(node), { actualType: inferType(receiver) });
508
534
  }
509
- const args = await this.evaluateArgs(node.args);
510
- return this.invokeCallable(receiver, args, this.getNodeLocation(node));
511
- }
512
- /**
513
- * Evaluate closure chain: >>expr
514
- * Chains multiple closures for composition.
515
- */
516
- async evaluateClosureChain(node, input) {
517
- // Evaluate the target expression to get the closure(s)
518
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
519
- const target = await this.evaluateExpression(node.target);
520
- if (Array.isArray(target)) {
521
- // List of closures: chain them left-to-right
522
- let result = input;
523
- for (const closure of target) {
524
- if (!isCallable(closure)) {
525
- throw new RuntimeError('RILL-R002', `Closure chain element must be callable, got ${inferType(closure)}`, this.getNodeLocation(node));
526
- }
527
- result = await this.invokeCallable(closure, [result], this.getNodeLocation(node));
535
+ // Spread-aware path: when args contain a SpreadArgNode use bindArgsToParams
536
+ if (node.args.some((a) => a.type === 'SpreadArg')) {
537
+ if (!isScriptCallable(receiver) && !isApplicationCallable(receiver)) {
538
+ throw new RuntimeError('RILL-R001', `Spread not supported for built-in callable`, this.getNodeLocation(node));
528
539
  }
529
- return result;
530
- }
531
- else if (isCallable(target)) {
532
- // Single closure: invoke with input
533
- return this.invokeCallable(target, [input], this.getNodeLocation(node));
534
- }
535
- else {
536
- throw new RuntimeError('RILL-R002', `Closure chain requires callable or list of callables, got ${inferType(target)}`, this.getNodeLocation(node));
540
+ const boundArgs = await this.bindArgsToParams(node.args, receiver, node.span.start);
541
+ const orderedArgs = receiver.params.map((p) => boundArgs.params.get(p.name));
542
+ return this.invokeCallable(receiver, orderedArgs, node.span.start);
537
543
  }
544
+ const args = await this.evaluateArgs(node.args);
545
+ return this.invokeCallable(receiver, args, this.getNodeLocation(node));
538
546
  }
539
547
  /**
540
548
  * Evaluate annotation reflection access: .^key
@@ -545,9 +553,52 @@ function createClosuresMixin(Base) {
545
553
  * Throws RUNTIME_UNDEFINED_ANNOTATION for missing annotations.
546
554
  */
547
555
  async evaluateAnnotationAccess(value, key, location) {
556
+ // IR-2: .^type returns a RillTypeValue for any rill value
557
+ if (key === 'type') {
558
+ const typeValue = Object.freeze({
559
+ __rill_type: true,
560
+ typeName: inferType(value),
561
+ structure: inferStructuralType(value),
562
+ });
563
+ return typeValue;
564
+ }
565
+ // IR-3: .name on type values returns the typeName string
566
+ if (isTypeValue(value) && key === 'name') {
567
+ return value.typeName;
568
+ }
569
+ // IR-2/IR-5: .^input returns the input shape for callable values
570
+ if (key === 'input') {
571
+ if (isScriptCallable(value)) {
572
+ return value.inputShape;
573
+ }
574
+ if (isApplicationCallable(value)) {
575
+ if (value.params === undefined) {
576
+ // IR-5: untyped host function — no shape available
577
+ return false;
578
+ }
579
+ return paramsToStructuralType(value.params);
580
+ }
581
+ // Non-callable: fall through to existing RILL-R003 guard below
582
+ }
583
+ // IR-3: .^output returns the declared output contract for callable values
584
+ if (key === 'output') {
585
+ if (isScriptCallable(value)) {
586
+ if (value.returnShape !== undefined) {
587
+ return value.returnShape;
588
+ }
589
+ // No :type-target declared — return type value `any` (AC-17, AC-18, AC-19)
590
+ const anyTypeValue = Object.freeze({
591
+ __rill_type: true,
592
+ typeName: 'any',
593
+ structure: { kind: 'any' },
594
+ });
595
+ return anyTypeValue;
596
+ }
597
+ // Non-callable: fall through to existing RILL-R003 guard below
598
+ }
548
599
  // Only ScriptCallable supports annotation reflection
549
600
  if (!isScriptCallable(value)) {
550
- throw new RuntimeError('RILL-R003', `Cannot access annotation on ${inferType(value)}`, location, { actualType: inferType(value) });
601
+ throw new RuntimeError('RILL-R003', `annotation not found: ^${key}`, location, { actualType: inferType(value) });
551
602
  }
552
603
  // Access annotation from ScriptCallable
553
604
  const annotationValue = value.annotations[key];
@@ -557,6 +608,136 @@ function createClosuresMixin(Base) {
557
608
  }
558
609
  return annotationValue;
559
610
  }
611
+ /**
612
+ * Bind argument nodes to callable parameters when a SpreadArgNode is present.
613
+ *
614
+ * Evaluates positional args LTR, evaluates the spread expression, dispatches
615
+ * by value type (Tuple, Ordered, or Dict), validates bindings, and returns
616
+ * a Map of param name → value.
617
+ *
618
+ * EC-3: bare ... with null pipe value → RuntimeError
619
+ * EC-4: spread value is not tuple/dict/ordered → RuntimeError
620
+ * EC-5: dict spread key matches no parameter → RuntimeError
621
+ * EC-6: ordered spread key at position N mismatches param at position N → RuntimeError
622
+ * EC-7: duplicate binding (positional + spread) → RuntimeError
623
+ * EC-8: missing required parameter after all args processed → RuntimeError
624
+ * EC-9: extra tuple values exceed param count → RuntimeError
625
+ * EC-11: ApplicationCallable with no params metadata → RuntimeError
626
+ */
627
+ async bindArgsToParams(argNodes, callable, callLocation) {
628
+ // EC-11: ApplicationCallable must have params metadata for spread to work
629
+ if (callable.kind === 'application' && callable.params === undefined) {
630
+ const name = callable.fn.name !== '' ? callable.fn.name : '<anonymous>';
631
+ throw new RuntimeError('RILL-R001', `Spread not supported for host function '${name}': parameter metadata required`, callLocation);
632
+ }
633
+ const params = callable.params;
634
+ const bound = new Map();
635
+ // Positional index: next unbound parameter position
636
+ let positionalIndex = 0;
637
+ // Save pipe value so evaluating args does not mutate it permanently
638
+ const savedPipeValue = this.ctx.pipeValue;
639
+ try {
640
+ for (const argNode of argNodes) {
641
+ if (argNode.type !== 'SpreadArg') {
642
+ // Positional argument
643
+ const param = params[positionalIndex];
644
+ if (param === undefined) {
645
+ // Extra positional arg beyond param count — EC-9 reports after spread
646
+ // but for pure positional excess, error here with the positional count
647
+ throw new RuntimeError('RILL-R001', `Extra positional argument at position ${positionalIndex} (function has ${params.length} parameters)`, callLocation);
648
+ }
649
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
650
+ const value = await this.evaluateExpression(argNode);
651
+ bound.set(param.name, value);
652
+ positionalIndex++;
653
+ }
654
+ else {
655
+ // SpreadArg: evaluate the expression
656
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
657
+ const spreadValue = await this.evaluateExpression(argNode.expression);
658
+ // EC-3: bare ... with no pipe value evaluates to null
659
+ if (spreadValue === null) {
660
+ throw new RuntimeError('RILL-R001', 'Spread requires an active pipe value ($)', callLocation);
661
+ }
662
+ // Dispatch by type: isOrdered BEFORE isDict per spec (IC-3 algorithm step 2)
663
+ if (isTuple(spreadValue)) {
664
+ // Tuple: fill remaining params positionally LTR (EC-9)
665
+ const tupleEntries = spreadValue.entries;
666
+ const remaining = params.length - positionalIndex;
667
+ if (tupleEntries.length > remaining) {
668
+ throw new RuntimeError('RILL-R001', `Spread tuple has ${tupleEntries.length} values but only ${remaining} parameter(s) remain`, callLocation);
669
+ }
670
+ for (let i = 0; i < tupleEntries.length; i++) {
671
+ const param = params[positionalIndex + i];
672
+ // EC-7: duplicate binding
673
+ if (bound.has(param.name)) {
674
+ throw new RuntimeError('RILL-R001', `Duplicate binding for parameter '${param.name}': already bound positionally`, callLocation);
675
+ }
676
+ bound.set(param.name, tupleEntries[i]);
677
+ }
678
+ positionalIndex += tupleEntries.length;
679
+ }
680
+ else if (isOrdered(spreadValue)) {
681
+ // Ordered: match key by name AND position
682
+ // Key at position N within ordered value must match param at (spreadStart + N)
683
+ const orderedEntries = spreadValue.entries;
684
+ for (let i = 0; i < orderedEntries.length; i++) {
685
+ const [key, value] = orderedEntries[i];
686
+ const expectedParam = params[positionalIndex + i];
687
+ // EC-6: key-order mismatch
688
+ if (expectedParam === undefined || expectedParam.name !== key) {
689
+ const expectedName = expectedParam?.name ?? '<none>';
690
+ throw new RuntimeError('RILL-R001', `Ordered spread key '${key}' at position ${i} does not match expected parameter '${expectedName}' at position ${positionalIndex + i}`, callLocation);
691
+ }
692
+ // EC-7: duplicate binding
693
+ if (bound.has(key)) {
694
+ throw new RuntimeError('RILL-R001', `Duplicate binding for parameter '${key}': already bound positionally`, callLocation);
695
+ }
696
+ bound.set(key, value);
697
+ }
698
+ positionalIndex += orderedEntries.length;
699
+ }
700
+ else if (isDict(spreadValue)) {
701
+ // Dict: match each key to param by name (order irrelevant)
702
+ const dictValue = spreadValue;
703
+ const paramNames = new Set(params.map((p) => p.name));
704
+ for (const [key, value] of Object.entries(dictValue)) {
705
+ // EC-5: key matches no parameter
706
+ if (!paramNames.has(key)) {
707
+ const validParams = params.map((p) => p.name).join(', ');
708
+ throw new RuntimeError('RILL-R001', `Dict spread key '${key}' does not match any parameter. Valid parameters: ${validParams}`, callLocation);
709
+ }
710
+ // EC-7: duplicate binding
711
+ if (bound.has(key)) {
712
+ throw new RuntimeError('RILL-R001', `Duplicate binding for parameter '${key}': already bound positionally`, callLocation);
713
+ }
714
+ bound.set(key, value);
715
+ }
716
+ }
717
+ else {
718
+ // EC-4: spread value is not tuple/dict/ordered
719
+ const actualType = inferType(spreadValue);
720
+ throw new RuntimeError('RILL-R001', `Spread requires a tuple, dict, or ordered value, got ${actualType}`, callLocation);
721
+ }
722
+ }
723
+ }
724
+ }
725
+ finally {
726
+ this.ctx.pipeValue = savedPipeValue;
727
+ }
728
+ // EC-8: check for missing required parameters
729
+ for (const param of params) {
730
+ if (!bound.has(param.name)) {
731
+ if (param.defaultValue !== null) {
732
+ bound.set(param.name, param.defaultValue);
733
+ }
734
+ else {
735
+ throw new RuntimeError('RILL-R001', `Missing required parameter '${param.name}'`, callLocation);
736
+ }
737
+ }
738
+ }
739
+ return { params: bound };
740
+ }
560
741
  /**
561
742
  * Evaluate .params property access on closures.
562
743
  * Builds dict from closure parameter metadata.