@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
@@ -19,4 +19,3 @@ export declare const BUILTIN_METHODS: {
19
19
  bool: Record<string, RillFunction>;
20
20
  vector: Record<string, RillFunction>;
21
21
  };
22
- //# sourceMappingURL=builtins.d.ts.map
@@ -9,8 +9,9 @@
9
9
  import { callable, isCallable, isDict } from '../core/callable.js';
10
10
  import { RuntimeError } from '../../types.js';
11
11
  import { parseSignatureRegistration } from '../../signature-parser.js';
12
- import { anyTypeValue, deepEquals, formatValue, inferType, isEmpty, isRillIterator, isVector, rillTypeToTypeValue, valueToJSON, } from '../core/values.js';
12
+ import { anyTypeValue, deepEquals, formatValue, inferType, isEmpty, isRillIterator, isVector, rillTypeToTypeValue, serializeValue, } from '../core/values.js';
13
13
  import { invokeCallable } from '../core/eval/index.js';
14
+ import { populateBuiltinMethods } from '../core/type-registrations.js';
14
15
  // ============================================================
15
16
  // ITERATOR HELPERS
16
17
  // ============================================================
@@ -70,26 +71,28 @@ export const BUILTIN_FUNCTIONS = {
70
71
  params: [
71
72
  {
72
73
  name: 'value',
73
- type: { type: 'any' },
74
+ type: { kind: 'any' },
74
75
  defaultValue: undefined,
75
76
  annotations: {},
76
77
  },
77
78
  ],
78
79
  returnType: anyTypeValue,
79
- fn: (args) => args[0] ?? null,
80
+ fn: (args) => args['value'] ?? null,
80
81
  },
81
82
  /** Log a value and return it unchanged (passthrough) */
82
83
  log: {
83
84
  params: [
84
85
  {
85
86
  name: 'message',
86
- type: { type: 'any' },
87
+ type: { kind: 'any' },
87
88
  defaultValue: undefined,
88
89
  annotations: {},
89
90
  },
90
91
  ],
91
92
  returnType: anyTypeValue,
92
93
  fn: (args, ctx) => {
94
+ // log is in UNTYPED_BUILTINS (allows excess args), receives positional array cast as Record.
95
+ // Use index 0 for the message value.
93
96
  const value = args[0] ?? null;
94
97
  const message = formatValue(value);
95
98
  ctx.callbacks.onLog(message);
@@ -101,16 +104,16 @@ export const BUILTIN_FUNCTIONS = {
101
104
  params: [
102
105
  {
103
106
  name: 'value',
104
- type: { type: 'any' },
107
+ type: { kind: 'any' },
105
108
  defaultValue: undefined,
106
109
  annotations: {},
107
110
  },
108
111
  ],
109
- returnType: rillTypeToTypeValue({ type: 'string' }),
112
+ returnType: rillTypeToTypeValue({ kind: 'string' }),
110
113
  fn: (args, _ctx, location) => {
111
- const value = args[0] ?? null;
114
+ const value = args['value'] ?? null;
112
115
  try {
113
- const jsonValue = valueToJSON(value);
116
+ const jsonValue = serializeValue(value);
114
117
  return JSON.stringify(jsonValue);
115
118
  }
116
119
  catch (err) {
@@ -133,16 +136,16 @@ export const BUILTIN_FUNCTIONS = {
133
136
  {
134
137
  name: 'items',
135
138
  type: {
136
- type: 'union',
137
- members: [{ type: 'list' }, { type: 'dict' }, { type: 'string' }],
139
+ kind: 'union',
140
+ members: [{ kind: 'list' }, { kind: 'dict' }, { kind: 'string' }],
138
141
  },
139
142
  defaultValue: undefined,
140
143
  annotations: {},
141
144
  },
142
145
  ],
143
- returnType: rillTypeToTypeValue({ type: 'list' }),
146
+ returnType: rillTypeToTypeValue({ kind: 'list' }),
144
147
  fn: (args) => {
145
- const input = args[0] ?? null;
148
+ const input = args['items'] ?? null;
146
149
  if (Array.isArray(input)) {
147
150
  return input.map((value, index) => ({ index, value }));
148
151
  }
@@ -165,28 +168,28 @@ export const BUILTIN_FUNCTIONS = {
165
168
  params: [
166
169
  {
167
170
  name: 'start',
168
- type: { type: 'number' },
171
+ type: { kind: 'number' },
169
172
  defaultValue: undefined,
170
173
  annotations: {},
171
174
  },
172
175
  {
173
176
  name: 'stop',
174
- type: { type: 'number' },
177
+ type: { kind: 'number' },
175
178
  defaultValue: undefined,
176
179
  annotations: {},
177
180
  },
178
181
  {
179
182
  name: 'step',
180
- type: { type: 'number' },
183
+ type: { kind: 'number' },
181
184
  defaultValue: 1,
182
185
  annotations: {},
183
186
  },
184
187
  ],
185
188
  returnType: anyTypeValue,
186
189
  fn: (args, _ctx, location) => {
187
- const start = typeof args[0] === 'number' ? args[0] : 0;
188
- const end = typeof args[1] === 'number' ? args[1] : 0;
189
- const step = typeof args[2] === 'number' ? args[2] : 1;
190
+ const start = typeof args['start'] === 'number' ? args['start'] : 0;
191
+ const end = typeof args['stop'] === 'number' ? args['stop'] : 0;
192
+ const step = typeof args['step'] === 'number' ? args['step'] : 1;
190
193
  if (step === 0) {
191
194
  throw new RuntimeError('RILL-R001', 'range step cannot be zero', location);
192
195
  }
@@ -215,21 +218,21 @@ export const BUILTIN_FUNCTIONS = {
215
218
  params: [
216
219
  {
217
220
  name: 'value',
218
- type: { type: 'any' },
221
+ type: { kind: 'any' },
219
222
  defaultValue: undefined,
220
223
  annotations: {},
221
224
  },
222
225
  {
223
226
  name: 'count',
224
- type: { type: 'number' },
227
+ type: { kind: 'number' },
225
228
  defaultValue: undefined,
226
229
  annotations: {},
227
230
  },
228
231
  ],
229
232
  returnType: anyTypeValue,
230
233
  fn: (args, _ctx, location) => {
231
- const value = args[0] ?? '';
232
- const count = typeof args[1] === 'number' ? Math.floor(args[1]) : 0;
234
+ const value = args['value'] ?? '';
235
+ const count = typeof args['count'] === 'number' ? Math.floor(args['count']) : 0;
233
236
  if (count < 0) {
234
237
  throw new RuntimeError('RILL-R001', 'repeat count cannot be negative', location);
235
238
  }
@@ -260,30 +263,32 @@ export const BUILTIN_FUNCTIONS = {
260
263
  params: [
261
264
  {
262
265
  name: 'value',
263
- type: { type: 'any' },
266
+ type: { kind: 'any' },
264
267
  defaultValue: undefined,
265
268
  annotations: {},
266
269
  },
267
270
  {
268
271
  name: 'transform',
269
- type: { type: 'any' },
272
+ type: { kind: 'any' },
270
273
  defaultValue: undefined,
271
274
  annotations: {},
272
275
  },
273
276
  ],
274
277
  returnType: anyTypeValue,
275
278
  fn: async (args, ctx, location) => {
279
+ // chain is in UNTYPED_BUILTINS, receives positional array cast as Record.
276
280
  // Pipe position: 5 -> chain($closure) sends args=[$closure] with pipeValue=5.
277
281
  // Detect this by checking if there is exactly one arg and a pipe value is set.
282
+ const positional = args;
278
283
  let value;
279
284
  let arg;
280
- if (args.length === 1 && ctx.pipeValue !== null) {
285
+ if (positional.length === 1 && ctx.pipeValue !== null) {
281
286
  value = ctx.pipeValue;
282
- arg = args[0] ?? null;
287
+ arg = positional[0] ?? null;
283
288
  }
284
289
  else {
285
- value = args[0] ?? null;
286
- arg = args[1] ?? null;
290
+ value = positional[0] ?? null;
291
+ arg = positional[1] ?? null;
287
292
  }
288
293
  if (Array.isArray(arg)) {
289
294
  // List of closures: fold left-to-right
@@ -307,33 +312,47 @@ export const BUILTIN_FUNCTIONS = {
307
312
  // ============================================================
308
313
  // BUILT-IN METHODS
309
314
  // ============================================================
310
- /** Factory for comparison methods (lt, gt, le, ge) */
311
- function createComparisonMethod(compare) {
312
- return (receiver, args) => {
313
- const arg = args[0];
314
- if (typeof receiver === 'number' && typeof arg === 'number') {
315
- return compare(receiver, arg);
316
- }
317
- return compare(formatValue(receiver), formatValue(arg ?? ''));
318
- };
319
- }
315
+ /** Receiver param prepended to every method's param list */
316
+ const RECEIVER_PARAM = {
317
+ name: 'receiver',
318
+ type: { kind: 'any' },
319
+ defaultValue: undefined,
320
+ annotations: {},
321
+ };
320
322
  /**
321
323
  * Build a RillFunction entry from a method body and its signature string.
322
324
  * Wraps `method(receiver, args, ctx, location)` as `fn(args, ctx, location)`
323
- * where `args[0]` is the receiver. Parses the signature to extract params and
324
- * returnType so that task 1.4 can use them directly without re-parsing.
325
+ * where receiver is the first param by declaration order (named 'receiver').
326
+ * Parses the signature to extract params and returnType so that task 1.4
327
+ * can use them directly without re-parsing.
328
+ *
329
+ * EC-4: Receiver missing from record raises RILL-R044.
325
330
  */
326
- function buildMethodEntry(name, signature, method) {
331
+ function buildMethodEntry(name, signature, method, skipReceiverValidation) {
327
332
  const parsed = parseSignatureRegistration(signature, name);
333
+ const methodParams = parsed.params;
328
334
  return {
329
- params: parsed.params,
330
- fn: (args, ctx, location) => method(args[0] ?? null, args.slice(1), ctx, location),
335
+ params: [RECEIVER_PARAM, ...methodParams],
336
+ fn: (args, ctx, location) => {
337
+ if (!('receiver' in args)) {
338
+ throw new RuntimeError('RILL-R044', "Missing required parameter 'receiver'", location);
339
+ }
340
+ const receiver = args['receiver'] ?? null;
341
+ // Reconstruct positional args array for RillMethod from named params in order.
342
+ // UNVALIDATED_METHOD_PARAMS methods pass __positionalArgs to preserve actual
343
+ // arg count so method body arity checks (args.length !== 1) fire correctly.
344
+ const positionalArgs = '__positionalArgs' in args
345
+ ? args['__positionalArgs']
346
+ : methodParams.map((p) => args[p.name] ?? null);
347
+ return method(receiver, positionalArgs, ctx, location);
348
+ },
331
349
  annotations: parsed.description !== undefined
332
350
  ? { description: parsed.description }
333
351
  : {},
334
352
  returnType: parsed.returnType !== undefined
335
353
  ? rillTypeToTypeValue(parsed.returnType)
336
354
  : anyTypeValue,
355
+ ...(skipReceiverValidation ? { skipReceiverValidation: true } : {}),
337
356
  };
338
357
  }
339
358
  export const BUILTIN_METHODS = {
@@ -525,10 +544,34 @@ const mPadEnd = (receiver, args) => {
525
544
  const mEq = (receiver, args) => deepEquals(receiver, args[0] ?? null);
526
545
  /** Inequality check (deep structural comparison) */
527
546
  const mNe = (receiver, args) => !deepEquals(receiver, args[0] ?? null);
528
- const mLt = createComparisonMethod((a, b) => a < b);
529
- const mGt = createComparisonMethod((a, b) => a > b);
530
- const mLe = createComparisonMethod((a, b) => a <= b);
531
- const mGe = createComparisonMethod((a, b) => a >= b);
547
+ /** Less-than comparison (number or string) */
548
+ const mLt = (receiver, args) => {
549
+ const arg = args[0];
550
+ if (typeof receiver === 'number' && typeof arg === 'number')
551
+ return receiver < arg;
552
+ return formatValue(receiver) < formatValue(arg ?? '');
553
+ };
554
+ /** Greater-than comparison (number or string) */
555
+ const mGt = (receiver, args) => {
556
+ const arg = args[0];
557
+ if (typeof receiver === 'number' && typeof arg === 'number')
558
+ return receiver > arg;
559
+ return formatValue(receiver) > formatValue(arg ?? '');
560
+ };
561
+ /** Less-than-or-equal comparison (number or string) */
562
+ const mLe = (receiver, args) => {
563
+ const arg = args[0];
564
+ if (typeof receiver === 'number' && typeof arg === 'number')
565
+ return receiver <= arg;
566
+ return formatValue(receiver) <= formatValue(arg ?? '');
567
+ };
568
+ /** Greater-than-or-equal comparison (number or string) */
569
+ const mGe = (receiver, args) => {
570
+ const arg = args[0];
571
+ if (typeof receiver === 'number' && typeof arg === 'number')
572
+ return receiver >= arg;
573
+ return formatValue(receiver) >= formatValue(arg ?? '');
574
+ };
532
575
  /** Get all keys of a dict as a list */
533
576
  const mKeys = (receiver) => isDict(receiver) ? Object.keys(receiver) : [];
534
577
  /** Get all values of a dict as a list */
@@ -730,10 +773,10 @@ const SIG_CMP = '|other: any|:bool';
730
773
  BUILTIN_METHODS.string = Object.freeze({
731
774
  len: buildMethodEntry('len', SIG_LEN, mLen),
732
775
  trim: buildMethodEntry('trim', '||:string', mTrim),
733
- head: buildMethodEntry('head', SIG_HEAD, mHead),
734
- tail: buildMethodEntry('tail', SIG_TAIL, mTail),
735
- first: buildMethodEntry('first', SIG_FIRST, mFirst),
736
- at: buildMethodEntry('at', SIG_AT, mAt),
776
+ head: buildMethodEntry('head', SIG_HEAD, mHead, true),
777
+ tail: buildMethodEntry('tail', SIG_TAIL, mTail, true),
778
+ first: buildMethodEntry('first', SIG_FIRST, mFirst, true),
779
+ at: buildMethodEntry('at', SIG_AT, mAt, true),
737
780
  split: buildMethodEntry('split', '|separator: string = "\\n"|:list', mSplit),
738
781
  lines: buildMethodEntry('lines', '||:list', mLines),
739
782
  empty: buildMethodEntry('empty', SIG_EMPTY, mEmpty),
@@ -750,8 +793,8 @@ BUILTIN_METHODS.string = Object.freeze({
750
793
  repeat: buildMethodEntry('repeat', '|count: number|:string', mRepeat),
751
794
  pad_start: buildMethodEntry('pad_start', '|length: number, fill: string = " "|:string', mPadStart),
752
795
  pad_end: buildMethodEntry('pad_end', '|length: number, fill: string = " "|:string', mPadEnd),
753
- eq: buildMethodEntry('eq', SIG_EQ, mEq),
754
- ne: buildMethodEntry('ne', SIG_NE, mNe),
796
+ eq: buildMethodEntry('eq', SIG_EQ, mEq, true),
797
+ ne: buildMethodEntry('ne', SIG_NE, mNe, true),
755
798
  lt: buildMethodEntry('lt', SIG_CMP, mLt),
756
799
  gt: buildMethodEntry('gt', SIG_CMP, mGt),
757
800
  le: buildMethodEntry('le', SIG_CMP, mLe),
@@ -759,32 +802,32 @@ BUILTIN_METHODS.string = Object.freeze({
759
802
  });
760
803
  BUILTIN_METHODS.list = Object.freeze({
761
804
  len: buildMethodEntry('len', SIG_LEN, mLen),
762
- head: buildMethodEntry('head', SIG_HEAD, mHead),
763
- tail: buildMethodEntry('tail', SIG_TAIL, mTail),
764
- first: buildMethodEntry('first', SIG_FIRST, mFirst),
765
- at: buildMethodEntry('at', SIG_AT, mAt),
805
+ head: buildMethodEntry('head', SIG_HEAD, mHead, true),
806
+ tail: buildMethodEntry('tail', SIG_TAIL, mTail, true),
807
+ first: buildMethodEntry('first', SIG_FIRST, mFirst, true),
808
+ at: buildMethodEntry('at', SIG_AT, mAt, true),
766
809
  join: buildMethodEntry('join', '|separator: string = ","|:string', mJoin),
767
810
  empty: buildMethodEntry('empty', SIG_EMPTY, mEmpty),
768
- eq: buildMethodEntry('eq', SIG_EQ, mEq),
769
- ne: buildMethodEntry('ne', SIG_NE, mNe),
770
- has: buildMethodEntry('has', '|value: any|:bool', mHas),
771
- has_any: buildMethodEntry('has_any', '|candidates: list|:bool', mHasAny),
772
- has_all: buildMethodEntry('has_all', '|candidates: list|:bool', mHasAll),
811
+ eq: buildMethodEntry('eq', SIG_EQ, mEq, true),
812
+ ne: buildMethodEntry('ne', SIG_NE, mNe, true),
813
+ has: buildMethodEntry('has', '|value: any|:bool', mHas, true),
814
+ has_any: buildMethodEntry('has_any', '|candidates: list|:bool', mHasAny, true),
815
+ has_all: buildMethodEntry('has_all', '|candidates: list|:bool', mHasAll, true),
773
816
  });
774
817
  BUILTIN_METHODS.dict = Object.freeze({
775
818
  len: buildMethodEntry('len', SIG_LEN, mLen),
776
- first: buildMethodEntry('first', SIG_FIRST, mFirst),
819
+ first: buildMethodEntry('first', SIG_FIRST, mFirst, true),
777
820
  empty: buildMethodEntry('empty', SIG_EMPTY, mEmpty),
778
- eq: buildMethodEntry('eq', SIG_EQ, mEq),
779
- ne: buildMethodEntry('ne', SIG_NE, mNe),
780
- keys: buildMethodEntry('keys', '||:list', mKeys),
781
- values: buildMethodEntry('values', '||:list', mValues),
782
- entries: buildMethodEntry('entries', '||:list', mEntries),
821
+ eq: buildMethodEntry('eq', SIG_EQ, mEq, true),
822
+ ne: buildMethodEntry('ne', SIG_NE, mNe, true),
823
+ keys: buildMethodEntry('keys', '||:list', mKeys, true),
824
+ values: buildMethodEntry('values', '||:list', mValues, true),
825
+ entries: buildMethodEntry('entries', '||:list', mEntries, true),
783
826
  });
784
827
  BUILTIN_METHODS.number = Object.freeze({
785
828
  empty: buildMethodEntry('empty', SIG_EMPTY, mEmpty),
786
- eq: buildMethodEntry('eq', SIG_EQ, mEq),
787
- ne: buildMethodEntry('ne', SIG_NE, mNe),
829
+ eq: buildMethodEntry('eq', SIG_EQ, mEq, true),
830
+ ne: buildMethodEntry('ne', SIG_NE, mNe, true),
788
831
  lt: buildMethodEntry('lt', SIG_CMP, mLt),
789
832
  gt: buildMethodEntry('gt', SIG_CMP, mGt),
790
833
  le: buildMethodEntry('le', SIG_CMP, mLe),
@@ -792,19 +835,21 @@ BUILTIN_METHODS.number = Object.freeze({
792
835
  });
793
836
  BUILTIN_METHODS.bool = Object.freeze({
794
837
  empty: buildMethodEntry('empty', SIG_EMPTY, mEmpty),
795
- eq: buildMethodEntry('eq', SIG_EQ, mEq),
796
- ne: buildMethodEntry('ne', SIG_NE, mNe),
838
+ eq: buildMethodEntry('eq', SIG_EQ, mEq, true),
839
+ ne: buildMethodEntry('ne', SIG_NE, mNe, true),
797
840
  });
798
841
  // [ASSUMPTION] vector is a 6th group beyond the 5 specified basic types.
799
842
  // The 7 vector methods do not belong to string/list/dict/number/bool.
800
843
  // Adding this group ensures all 42 methods are accessible (AC-36).
801
844
  BUILTIN_METHODS.vector = Object.freeze({
802
- dimensions: buildMethodEntry('dimensions', '||:number', mDimensions),
803
- model: buildMethodEntry('model', '||:string', mModel),
804
- similarity: buildMethodEntry('similarity', '|other: any|:number', mSimilarity),
805
- dot: buildMethodEntry('dot', '|other: any|:number', mDot),
806
- distance: buildMethodEntry('distance', '|other: any|:number', mDistance),
807
- norm: buildMethodEntry('norm', '||:number', mNorm),
808
- normalize: buildMethodEntry('normalize', '||:any', mNormalize),
845
+ dimensions: buildMethodEntry('dimensions', '||:number', mDimensions, true),
846
+ model: buildMethodEntry('model', '||:string', mModel, true),
847
+ similarity: buildMethodEntry('similarity', '|other: any|:number', mSimilarity, true),
848
+ dot: buildMethodEntry('dot', '|other: any|:number', mDot, true),
849
+ distance: buildMethodEntry('distance', '|other: any|:number', mDistance, true),
850
+ norm: buildMethodEntry('norm', '||:number', mNorm, true),
851
+ normalize: buildMethodEntry('normalize', '||:any', mNormalize, true),
809
852
  });
810
- //# sourceMappingURL=builtins.js.map
853
+ // Populate registration methods from BUILTIN_METHODS at module load time.
854
+ // No circular dependency: type-registrations.ts does not import builtins.ts.
855
+ populateBuiltinMethods(BUILTIN_METHODS);
@@ -1,5 +1,6 @@
1
- import type { RillFunction } from '../core/callable.js';
1
+ import type { ApplicationCallable } from '../core/callable.js';
2
2
  import type { ExtensionEvent, RuntimeCallbacks } from '../core/types.js';
3
+ import type { RillValue } from '../core/values.js';
3
4
  /**
4
5
  * Minimal interface for extension event emission.
5
6
  * Allows emitExtensionEvent to accept any context with callbacks.
@@ -9,27 +10,20 @@ interface RuntimeContextLike {
9
10
  }
10
11
  /**
11
12
  * Result object returned by extension factories.
12
- * Contains host function definitions with optional cleanup and session lifecycle hooks.
13
+ * Contains the mounted RillValue with optional lifecycle hooks.
14
+ * Lifecycle hooks live on the factory result, not on the value dict (DD-1).
13
15
  */
14
- export interface ExtensionResult {
15
- [name: string]: RillFunction | ((...args: never[]) => unknown) | undefined;
16
+ export interface ExtensionFactoryResult {
17
+ readonly value: RillValue;
16
18
  dispose?: () => void | Promise<void>;
17
19
  suspend?: () => unknown;
18
20
  restore?: (state: unknown) => void;
19
21
  }
20
- /**
21
- * Result object returned by hoistExtension.
22
- * Separates functions from dispose for safe createRuntimeContext usage.
23
- */
24
- export interface HoistedExtension {
25
- functions: Record<string, RillFunction>;
26
- dispose?: () => void | Promise<void>;
27
- }
28
22
  /**
29
23
  * Factory function contract for creating extensions.
30
24
  * Accepts typed configuration and returns isolated instance.
31
25
  */
32
- export type ExtensionFactory<TConfig> = (config: TConfig) => ExtensionResult | Promise<ExtensionResult>;
26
+ export type ExtensionFactory<TConfig> = (config: TConfig) => ExtensionFactoryResult | Promise<ExtensionFactoryResult>;
33
27
  /**
34
28
  * Descriptor for a single configuration field in an extension schema.
35
29
  * The secret flag is advisory: harness tooling uses it to mask or omit values.
@@ -72,18 +66,17 @@ export interface ExtensionManifest {
72
66
  * - mounts(): List all configured mounts
73
67
  */
74
68
  export type KvExtensionContract = {
75
- readonly get: RillFunction;
76
- readonly get_or: RillFunction;
77
- readonly set: RillFunction;
78
- readonly merge: RillFunction;
79
- readonly delete: RillFunction;
80
- readonly keys: RillFunction;
81
- readonly has: RillFunction;
82
- readonly clear: RillFunction;
83
- readonly getAll: RillFunction;
84
- readonly schema: RillFunction;
85
- readonly mounts: RillFunction;
86
- readonly dispose?: (() => void | Promise<void>) | undefined;
69
+ readonly get: ApplicationCallable;
70
+ readonly get_or: ApplicationCallable;
71
+ readonly set: ApplicationCallable;
72
+ readonly merge: ApplicationCallable;
73
+ readonly delete: ApplicationCallable;
74
+ readonly keys: ApplicationCallable;
75
+ readonly has: ApplicationCallable;
76
+ readonly clear: ApplicationCallable;
77
+ readonly getAll: ApplicationCallable;
78
+ readonly schema: ApplicationCallable;
79
+ readonly mounts: ApplicationCallable;
87
80
  };
88
81
  /**
89
82
  * Contract type for fs extension implementations.
@@ -104,106 +97,19 @@ export type KvExtensionContract = {
104
97
  * - mounts(): List all configured mounts
105
98
  */
106
99
  export type FsExtensionContract = {
107
- readonly read: RillFunction;
108
- readonly write: RillFunction;
109
- readonly append: RillFunction;
110
- readonly list: RillFunction;
111
- readonly find: RillFunction;
112
- readonly exists: RillFunction;
113
- readonly remove: RillFunction;
114
- readonly stat: RillFunction;
115
- readonly mkdir: RillFunction;
116
- readonly copy: RillFunction;
117
- readonly move: RillFunction;
118
- readonly mounts: RillFunction;
119
- readonly dispose?: (() => void | Promise<void>) | undefined;
120
- };
121
- /**
122
- * Contract type for llm extension implementations.
123
- * Enforces exact function structure for compile-time verification.
124
- *
125
- * Backend implementations must provide all 6 functions:
126
- * - message(text, options): Send single message
127
- * - messages(messages, options): Multi-turn conversation
128
- * - embed(text): Generate embedding vector
129
- * - embed_batch(texts): Batch embeddings
130
- * - tool_loop(prompt, options): Tool use orchestration
131
- * - generate(prompt, options): Structured output extraction
132
- */
133
- export type LlmExtensionContract = {
134
- readonly message: RillFunction;
135
- readonly messages: RillFunction;
136
- readonly embed: RillFunction;
137
- readonly embed_batch: RillFunction;
138
- readonly tool_loop: RillFunction;
139
- readonly generate: RillFunction;
140
- readonly dispose?: (() => void | Promise<void>) | undefined;
141
- };
142
- /**
143
- * Contract type for vector extension implementations.
144
- * Enforces exact function structure for compile-time verification.
145
- *
146
- * Backend implementations must provide all 11 functions:
147
- * - upsert(id, vector, metadata): Insert or update vector
148
- * - upsert_batch(items): Batch insert/update
149
- * - search(vector, options): Search k nearest neighbors
150
- * - get(id): Fetch vector by ID
151
- * - delete(id): Delete vector by ID
152
- * - delete_batch(ids): Batch delete
153
- * - count(): Count vectors in collection
154
- * - create_collection(name, options): Create collection
155
- * - delete_collection(name): Delete collection
156
- * - list_collections(): List all collections
157
- * - describe(): Get collection metadata
158
- */
159
- export type VectorExtensionContract = {
160
- readonly upsert: RillFunction;
161
- readonly upsert_batch: RillFunction;
162
- readonly search: RillFunction;
163
- readonly get: RillFunction;
164
- readonly delete: RillFunction;
165
- readonly delete_batch: RillFunction;
166
- readonly count: RillFunction;
167
- readonly create_collection: RillFunction;
168
- readonly delete_collection: RillFunction;
169
- readonly list_collections: RillFunction;
170
- readonly describe: RillFunction;
171
- readonly dispose?: (() => void | Promise<void>) | undefined;
100
+ readonly read: ApplicationCallable;
101
+ readonly write: ApplicationCallable;
102
+ readonly append: ApplicationCallable;
103
+ readonly list: ApplicationCallable;
104
+ readonly find: ApplicationCallable;
105
+ readonly exists: ApplicationCallable;
106
+ readonly remove: ApplicationCallable;
107
+ readonly stat: ApplicationCallable;
108
+ readonly mkdir: ApplicationCallable;
109
+ readonly copy: ApplicationCallable;
110
+ readonly move: ApplicationCallable;
111
+ readonly mounts: ApplicationCallable;
172
112
  };
173
- /**
174
- * Prefix all function names in an extension with a namespace.
175
- *
176
- * @param namespace - Alphanumeric string with underscores/hyphens (e.g., "fs", "claude_code")
177
- * @param functions - Extension result with function definitions
178
- * @returns New ExtensionResult with prefixed function names (namespace::functionName)
179
- * @throws {RuntimeError} RUNTIME_TYPE_ERROR if namespace is invalid
180
- *
181
- * @example
182
- * ```typescript
183
- * const fs = createFsExtension();
184
- * const prefixed = prefixFunctions("fs", fs);
185
- * // { "fs::read": ..., "fs::write": ..., dispose: ... }
186
- * ```
187
- */
188
- export declare function prefixFunctions(namespace: string, functions: ExtensionResult): ExtensionResult;
189
- /**
190
- * Separate dispose from functions for safe createRuntimeContext usage.
191
- * Wraps prefixFunctions and returns separated structure.
192
- *
193
- * @param namespace - String matching /^[a-zA-Z0-9_-]+$/
194
- * @param extension - Output from extension factory
195
- * @returns Separated functions and dispose handler
196
- * @throws {Error} If namespace is empty
197
- * @throws {Error} If namespace has invalid format
198
- * @throws {TypeError} If extension is null or undefined
199
- *
200
- * @example
201
- * ```typescript
202
- * const { functions, dispose } = hoistExtension('db', dbExtension);
203
- * const ctx = createRuntimeContext({ functions });
204
- * ```
205
- */
206
- export declare function hoistExtension(namespace: string, extension: ExtensionResult): HoistedExtension;
207
113
  /**
208
114
  * Emit an extension event with auto-generated timestamp.
209
115
  * Adds ISO timestamp if event.timestamp is undefined, then calls onLogEvent callback.
@@ -227,4 +133,3 @@ export declare function emitExtensionEvent(ctx: RuntimeContextLike, event: Omit<
227
133
  timestamp?: string | undefined;
228
134
  }): void;
229
135
  export {};
230
- //# sourceMappingURL=extensions.d.ts.map