@rcrsr/rill 0.17.0 → 0.18.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 (83) hide show
  1. package/dist/ast-nodes.d.ts +14 -4
  2. package/dist/ast-unions.d.ts +1 -1
  3. package/dist/constants.d.ts +1 -1
  4. package/dist/constants.js +1 -0
  5. package/dist/error-registry.js +228 -0
  6. package/dist/ext/crypto/index.js +5 -5
  7. package/dist/ext/exec/index.js +3 -3
  8. package/dist/ext/fetch/index.js +4 -4
  9. package/dist/ext/fetch/request.js +1 -1
  10. package/dist/ext/fs/index.js +101 -114
  11. package/dist/ext/fs/sandbox.d.ts +18 -0
  12. package/dist/ext/fs/sandbox.js +33 -0
  13. package/dist/ext/kv/index.js +12 -12
  14. package/dist/ext/kv/store.d.ts +1 -1
  15. package/dist/ext/kv/store.js +1 -1
  16. package/dist/generated/version-data.d.ts +1 -1
  17. package/dist/generated/version-data.js +2 -2
  18. package/dist/highlight-map.js +1 -0
  19. package/dist/index.d.ts +1 -15
  20. package/dist/index.js +1 -14
  21. package/dist/lexer/operators.js +1 -0
  22. package/dist/parser/helpers.js +1 -0
  23. package/dist/parser/parser-expr.js +44 -5
  24. package/dist/parser/parser-literals.js +111 -4
  25. package/dist/parser/parser-shape.js +2 -2
  26. package/dist/parser/parser-use.js +19 -2
  27. package/dist/parser/parser.d.ts +2 -0
  28. package/dist/parser/parser.js +2 -0
  29. package/dist/runtime/core/callable.d.ts +5 -6
  30. package/dist/runtime/core/callable.js +10 -17
  31. package/dist/runtime/core/context.d.ts +2 -2
  32. package/dist/runtime/core/context.js +8 -8
  33. package/dist/runtime/core/eval/base.d.ts +2 -2
  34. package/dist/runtime/core/eval/base.js +2 -0
  35. package/dist/runtime/core/eval/evaluator.d.ts +1 -1
  36. package/dist/runtime/core/eval/index.d.ts +2 -2
  37. package/dist/runtime/core/eval/mixins/closures.js +367 -27
  38. package/dist/runtime/core/eval/mixins/collections.js +81 -6
  39. package/dist/runtime/core/eval/mixins/control-flow.js +1 -1
  40. package/dist/runtime/core/eval/mixins/conversion.js +17 -12
  41. package/dist/runtime/core/eval/mixins/core.js +15 -2
  42. package/dist/runtime/core/eval/mixins/expressions.js +3 -2
  43. package/dist/runtime/core/eval/mixins/extraction.js +2 -3
  44. package/dist/runtime/core/eval/mixins/list-dispatch.js +1 -1
  45. package/dist/runtime/core/eval/mixins/literals.js +14 -3
  46. package/dist/runtime/core/eval/mixins/types.js +30 -1
  47. package/dist/runtime/core/eval/mixins/variables.js +3 -1
  48. package/dist/runtime/core/execute.d.ts +1 -1
  49. package/dist/runtime/core/field-descriptor.d.ts +1 -1
  50. package/dist/runtime/core/introspection.d.ts +2 -2
  51. package/dist/runtime/core/introspection.js +2 -1
  52. package/dist/runtime/core/resolvers.d.ts +1 -1
  53. package/dist/runtime/core/signals.d.ts +6 -1
  54. package/dist/runtime/core/signals.js +9 -0
  55. package/dist/runtime/core/types/constructors.d.ts +54 -0
  56. package/dist/runtime/core/types/constructors.js +201 -0
  57. package/dist/runtime/core/types/guards.d.ts +42 -0
  58. package/dist/runtime/core/types/guards.js +88 -0
  59. package/dist/runtime/core/types/index.d.ts +18 -0
  60. package/dist/runtime/core/types/index.js +19 -0
  61. package/dist/runtime/core/types/operations.d.ts +98 -0
  62. package/dist/runtime/core/types/operations.js +804 -0
  63. package/dist/runtime/core/{type-registrations.d.ts → types/registrations.d.ts} +12 -22
  64. package/dist/runtime/core/{type-registrations.js → types/registrations.js} +94 -92
  65. package/dist/runtime/core/{types.d.ts → types/runtime.d.ts} +8 -8
  66. package/dist/runtime/core/{type-structures.d.ts → types/structures.d.ts} +21 -3
  67. package/dist/runtime/core/values.d.ts +13 -102
  68. package/dist/runtime/core/values.js +26 -722
  69. package/dist/runtime/ext/builtins.js +9 -8
  70. package/dist/runtime/ext/extensions.d.ts +2 -2
  71. package/dist/runtime/ext/extensions.js +2 -1
  72. package/dist/runtime/ext/test-context.d.ts +2 -2
  73. package/dist/runtime/ext/test-context.js +3 -2
  74. package/dist/runtime/index.d.ts +8 -22
  75. package/dist/runtime/index.js +10 -16
  76. package/dist/signature-parser.d.ts +1 -1
  77. package/dist/token-types.d.ts +1 -0
  78. package/dist/token-types.js +1 -0
  79. package/package.json +1 -1
  80. /package/dist/runtime/core/{markers.d.ts → types/markers.d.ts} +0 -0
  81. /package/dist/runtime/core/{markers.js → types/markers.js} +0 -0
  82. /package/dist/runtime/core/{types.js → types/runtime.js} +0 -0
  83. /package/dist/runtime/core/{type-structures.js → types/structures.js} +0 -0
@@ -129,6 +129,15 @@ export interface BreakNode extends BaseNode {
129
129
  export interface ReturnNode extends BaseNode {
130
130
  readonly type: 'Return';
131
131
  }
132
+ /**
133
+ * Yield: emit value from a stream closure.
134
+ * Used as chain terminator: $x -> yield
135
+ * Or bare: yield (implicit $ -> yield)
136
+ * Only valid inside a closure with :stream(T):R return type annotation.
137
+ */
138
+ export interface YieldNode extends BaseNode {
139
+ readonly type: 'Yield';
140
+ }
132
141
  /**
133
142
  * Pass: pass through pipe value unchanged.
134
143
  * Used as chain terminator: $x -> pass
@@ -157,8 +166,8 @@ export interface ErrorNode extends BaseNode {
157
166
  readonly message: StringLiteralNode | null;
158
167
  }
159
168
  export type ExpressionNode = PipeChainNode;
160
- /** Chain terminator: capture, break, or return */
161
- export type ChainTerminator = CaptureNode | BreakNode | ReturnNode;
169
+ /** Chain terminator: capture, break, return, or yield */
170
+ export type ChainTerminator = CaptureNode | BreakNode | ReturnNode | YieldNode;
162
171
  export interface PipeChainNode extends BaseNode {
163
172
  readonly type: 'PipeChain';
164
173
  readonly head: ArithHead;
@@ -244,7 +253,7 @@ export interface DictEntryNode extends BaseNode {
244
253
  */
245
254
  export interface TypeConstructorNode extends BaseNode {
246
255
  readonly type: 'TypeConstructor';
247
- readonly constructorName: 'list' | 'dict' | 'tuple' | 'ordered';
256
+ readonly constructorName: 'list' | 'dict' | 'tuple' | 'ordered' | 'stream';
248
257
  readonly args: FieldArg[];
249
258
  }
250
259
  /**
@@ -797,8 +806,9 @@ export interface UseExprNode extends BaseNode {
797
806
  readonly closureAnnotation: ReadonlyArray<{
798
807
  readonly name: string;
799
808
  readonly typeRef: TypeRef;
809
+ readonly defaultValue?: LiteralNode;
800
810
  }> | null;
801
811
  }
802
812
  export type SimplePrimaryNode = LiteralNode | VariableNode | HostCallNode | MethodCallNode | BlockNode | BinaryExprNode | UnaryExprNode | GroupedExprNode | PostfixExprNode | TypeAssertionNode | TypeCheckNode;
803
- export type ASTNode = ScriptNode | FrontmatterNode | ClosureNode | ClosureParamNode | StatementNode | CaptureNode | BreakNode | ReturnNode | PassNode | AssertNode | PipeChainNode | PostfixExprNode | MethodCallNode | InvokeNode | AnnotationAccessNode | HostCallNode | HostRefNode | ClosureCallNode | PipeInvokeNode | VariableNode | ConditionalNode | WhileLoopNode | DoWhileLoopNode | BlockNode | StringLiteralNode | InterpolationNode | NumberLiteralNode | BoolLiteralNode | ListSpreadNode | DictNode | DictEntryNode | BinaryExprNode | UnaryExprNode | GroupedExprNode | DestructureNode | DestructPatternNode | SliceNode | TypeAssertionNode | TypeCheckNode | TypeConstructorNode | ClosureSigLiteralNode | AnnotatedStatementNode | AnnotatedExprNode | NamedArgNode | SpreadArgNode | EachExprNode | MapExprNode | FoldExprNode | FilterExprNode | RecoveryErrorNode | ErrorNode | TypeNameExprNode | ListLiteralNode | DictLiteralNode | TupleLiteralNode | OrderedLiteralNode | DestructNode | ConvertNode | UseExprNode;
813
+ export type ASTNode = ScriptNode | FrontmatterNode | ClosureNode | ClosureParamNode | StatementNode | CaptureNode | BreakNode | ReturnNode | YieldNode | PassNode | AssertNode | PipeChainNode | PostfixExprNode | MethodCallNode | InvokeNode | AnnotationAccessNode | HostCallNode | HostRefNode | ClosureCallNode | PipeInvokeNode | VariableNode | ConditionalNode | WhileLoopNode | DoWhileLoopNode | BlockNode | StringLiteralNode | InterpolationNode | NumberLiteralNode | BoolLiteralNode | ListSpreadNode | DictNode | DictEntryNode | BinaryExprNode | UnaryExprNode | GroupedExprNode | DestructureNode | DestructPatternNode | SliceNode | TypeAssertionNode | TypeCheckNode | TypeConstructorNode | ClosureSigLiteralNode | AnnotatedStatementNode | AnnotatedExprNode | NamedArgNode | SpreadArgNode | EachExprNode | MapExprNode | FoldExprNode | FilterExprNode | RecoveryErrorNode | ErrorNode | TypeNameExprNode | ListLiteralNode | DictLiteralNode | TupleLiteralNode | OrderedLiteralNode | DestructNode | ConvertNode | UseExprNode;
804
814
  export {};
@@ -2,4 +2,4 @@
2
2
  * AST Type Unions
3
3
  * String union of all AST node type literals.
4
4
  */
5
- export type NodeType = 'Script' | 'Frontmatter' | 'Closure' | 'ClosureParam' | 'Statement' | 'PipeChain' | 'PostfixExpr' | 'MethodCall' | 'Invoke' | 'AnnotationAccess' | 'HostCall' | 'HostRef' | 'ClosureCall' | 'PipeInvoke' | 'Variable' | 'Capture' | 'Conditional' | 'WhileLoop' | 'DoWhileLoop' | 'Block' | 'StringLiteral' | 'Interpolation' | 'NumberLiteral' | 'BoolLiteral' | 'ListSpread' | 'Dict' | 'DictEntry' | 'Break' | 'Return' | 'Pass' | 'Assert' | 'BinaryExpr' | 'UnaryExpr' | 'GroupedExpr' | 'Destructure' | 'DestructPattern' | 'Slice' | 'TypeAssertion' | 'TypeCheck' | 'AnnotatedStatement' | 'AnnotatedExpr' | 'NamedArg' | 'SpreadArg' | 'EachExpr' | 'MapExpr' | 'FoldExpr' | 'FilterExpr' | 'RecoveryError' | 'Error' | 'TypeNameExpr' | 'TypeConstructor' | 'ClosureSigLiteral' | 'ListLiteral' | 'DictLiteral' | 'TupleLiteral' | 'OrderedLiteral' | 'Destruct' | 'Convert' | 'UseExpr';
5
+ export type NodeType = 'Script' | 'Frontmatter' | 'Closure' | 'ClosureParam' | 'Statement' | 'PipeChain' | 'PostfixExpr' | 'MethodCall' | 'Invoke' | 'AnnotationAccess' | 'HostCall' | 'HostRef' | 'ClosureCall' | 'PipeInvoke' | 'Variable' | 'Capture' | 'Conditional' | 'WhileLoop' | 'DoWhileLoop' | 'Block' | 'StringLiteral' | 'Interpolation' | 'NumberLiteral' | 'BoolLiteral' | 'ListSpread' | 'Dict' | 'DictEntry' | 'Break' | 'Return' | 'Yield' | 'Pass' | 'Assert' | 'BinaryExpr' | 'UnaryExpr' | 'GroupedExpr' | 'Destructure' | 'DestructPattern' | 'Slice' | 'TypeAssertion' | 'TypeCheck' | 'AnnotatedStatement' | 'AnnotatedExpr' | 'NamedArg' | 'SpreadArg' | 'EachExpr' | 'MapExpr' | 'FoldExpr' | 'FilterExpr' | 'RecoveryError' | 'Error' | 'TypeNameExpr' | 'TypeConstructor' | 'ClosureSigLiteral' | 'ListLiteral' | 'DictLiteral' | 'TupleLiteral' | 'OrderedLiteral' | 'Destruct' | 'Convert' | 'UseExpr';
@@ -10,4 +10,4 @@
10
10
  * - Parser: array iteration for token validation
11
11
  * - Runtime: Set-based O(1) membership lookup
12
12
  */
13
- export declare const VALID_TYPE_NAMES: readonly ["string", "number", "bool", "closure", "list", "dict", "tuple", "ordered", "vector", "any", "type", "iterator"];
13
+ export declare const VALID_TYPE_NAMES: readonly ["string", "number", "bool", "closure", "list", "dict", "tuple", "ordered", "vector", "any", "type", "iterator", "stream"];
package/dist/constants.js CHANGED
@@ -26,4 +26,5 @@ export const VALID_TYPE_NAMES = [
26
26
  'any',
27
27
  'type',
28
28
  'iterator',
29
+ 'stream',
29
30
  ];
@@ -228,6 +228,24 @@ const ERROR_DEFINITIONS = [
228
228
  },
229
229
  ],
230
230
  },
231
+ {
232
+ errorId: 'RILL-P006',
233
+ category: 'parse',
234
+ description: 'Invalid syntax in context',
235
+ messageTemplate: '{message}',
236
+ cause: 'A syntactic construct was used in a context where it is not allowed.',
237
+ resolution: 'Check that the construct is used in the correct context.',
238
+ examples: [
239
+ {
240
+ description: 'Spread in unsupported position',
241
+ code: '$x.method(...$args) # spread not supported in method calls',
242
+ },
243
+ {
244
+ description: 'yield outside stream closure',
245
+ code: '|x| yield # yield requires :stream() return type',
246
+ },
247
+ ],
248
+ },
231
249
  {
232
250
  errorId: 'RILL-P007',
233
251
  category: 'parse',
@@ -1330,6 +1348,216 @@ const ERROR_DEFINITIONS = [
1330
1348
  },
1331
1349
  ],
1332
1350
  },
1351
+ // Type conversion: string to number (RILL-R064)
1352
+ {
1353
+ errorId: 'RILL-R064',
1354
+ category: 'runtime',
1355
+ description: 'Cannot convert string to number',
1356
+ messageTemplate: 'Cannot convert string "{value}" to number',
1357
+ cause: 'The string value is not a valid numeric representation or is empty/whitespace.',
1358
+ resolution: 'Ensure the string contains a valid number before converting. Use as(number) only on numeric strings.',
1359
+ examples: [
1360
+ {
1361
+ description: 'Non-numeric string conversion',
1362
+ code: '"hello" -> as(number) # Error: not a valid number',
1363
+ },
1364
+ ],
1365
+ },
1366
+ // Type conversion: string to bool (RILL-R065)
1367
+ {
1368
+ errorId: 'RILL-R065',
1369
+ category: 'runtime',
1370
+ description: 'Cannot convert string to bool',
1371
+ messageTemplate: 'Cannot convert string "{value}" to bool',
1372
+ cause: 'Only the strings "true" and "false" can convert to bool.',
1373
+ resolution: 'Use the exact strings "true" or "false" for bool conversion.',
1374
+ examples: [
1375
+ {
1376
+ description: 'Invalid bool string',
1377
+ code: '"yes" -> as(bool) # Error: only "true"/"false" allowed',
1378
+ },
1379
+ ],
1380
+ },
1381
+ // Type conversion: number to bool (RILL-R066)
1382
+ {
1383
+ errorId: 'RILL-R066',
1384
+ category: 'runtime',
1385
+ description: 'Cannot convert number to bool',
1386
+ messageTemplate: 'Cannot convert number {value} to bool',
1387
+ cause: 'Only the numbers 0 and 1 can convert to bool. Other numeric values have no bool equivalent.',
1388
+ resolution: 'Use 0 (false) or 1 (true) for number-to-bool conversion.',
1389
+ examples: [
1390
+ {
1391
+ description: 'Non-binary number conversion',
1392
+ code: '42 -> as(bool) # Error: only 0 and 1 allowed',
1393
+ },
1394
+ ],
1395
+ },
1396
+ // JSON serialization: value not serializable (RILL-R067)
1397
+ {
1398
+ errorId: 'RILL-R067',
1399
+ category: 'runtime',
1400
+ description: 'Value is not JSON-serializable',
1401
+ messageTemplate: '{typeName} are not JSON-serializable',
1402
+ cause: 'The value type cannot be represented in JSON. Only strings, numbers, bools, lists, and dicts serialize.',
1403
+ resolution: 'Convert the value to a serializable type before JSON operations. Extract data from closures or iterators first.',
1404
+ examples: [
1405
+ {
1406
+ description: 'Closure in JSON context',
1407
+ code: '|x| $x + 1 -> as(string) # Error: closures not serializable',
1408
+ },
1409
+ ],
1410
+ },
1411
+ // Method registration: frozen type registration (RILL-R068)
1412
+ {
1413
+ errorId: 'RILL-R068',
1414
+ category: 'runtime',
1415
+ description: 'Type registration is frozen',
1416
+ messageTemplate: "Cannot populate methods on type '{typeName}': registration is frozen",
1417
+ cause: 'The type registration object was deep-frozen, preventing method assignment.',
1418
+ resolution: 'Ensure type registrations are not deep-frozen before calling populateBuiltinMethods.',
1419
+ examples: [
1420
+ {
1421
+ description: 'Frozen registration object',
1422
+ code: '# Object.freeze(registration) prevents method population',
1423
+ },
1424
+ ],
1425
+ },
1426
+ // Context validation: function missing description (RILL-R069)
1427
+ {
1428
+ errorId: 'RILL-R069',
1429
+ category: 'runtime',
1430
+ description: 'Function missing required description',
1431
+ messageTemplate: "Function '{name}' requires description (requireDescriptions enabled)",
1432
+ cause: 'The requireDescriptions option is enabled but the function has no description.',
1433
+ resolution: 'Add a description field to the function definition, or disable requireDescriptions.',
1434
+ examples: [
1435
+ {
1436
+ description: 'Missing function description',
1437
+ code: '# registerFunction("greet", { fn: ... }) with requireDescriptions: true',
1438
+ },
1439
+ ],
1440
+ },
1441
+ // Context validation: parameter missing description (RILL-R070)
1442
+ {
1443
+ errorId: 'RILL-R070',
1444
+ category: 'runtime',
1445
+ description: 'Parameter missing required description',
1446
+ messageTemplate: "Parameter '{paramName}' of function '{functionName}' requires description (requireDescriptions enabled)",
1447
+ cause: 'The requireDescriptions option is enabled but a parameter has no description annotation.',
1448
+ resolution: 'Add a description annotation to each parameter, or disable requireDescriptions.',
1449
+ examples: [
1450
+ {
1451
+ description: 'Missing parameter description',
1452
+ code: '# param { name: "x", annotations: {} } with requireDescriptions: true',
1453
+ },
1454
+ ],
1455
+ },
1456
+ // Context validation: duplicate type registration (RILL-R071)
1457
+ {
1458
+ errorId: 'RILL-R071',
1459
+ category: 'runtime',
1460
+ description: 'Duplicate type registration',
1461
+ messageTemplate: "Duplicate type registration '{typeName}'",
1462
+ cause: 'Two type registrations share the same name. Each type name must be unique.',
1463
+ resolution: 'Remove or rename the duplicate type registration.',
1464
+ examples: [
1465
+ {
1466
+ description: 'Duplicate type name',
1467
+ code: '# Two registrations both named "string"',
1468
+ },
1469
+ ],
1470
+ },
1471
+ // Context validation: missing format protocol (RILL-R072)
1472
+ {
1473
+ errorId: 'RILL-R072',
1474
+ category: 'runtime',
1475
+ description: 'Type missing format protocol',
1476
+ messageTemplate: "Type '{typeName}' missing required format protocol",
1477
+ cause: 'Every type registration must include a format function in its protocol.',
1478
+ resolution: 'Add a format function to the type registration protocol.',
1479
+ examples: [
1480
+ {
1481
+ description: 'Missing format in protocol',
1482
+ code: '# TypeRegistration { name: "custom", protocol: {} } missing format',
1483
+ },
1484
+ ],
1485
+ },
1486
+ // Context validation: duplicate method on type (RILL-R073)
1487
+ {
1488
+ errorId: 'RILL-R073',
1489
+ category: 'runtime',
1490
+ description: 'Duplicate method on type',
1491
+ messageTemplate: "Duplicate method '{methodName}' on type '{typeName}'",
1492
+ cause: 'A method with the same name is registered twice on the same type.',
1493
+ resolution: 'Remove the duplicate method registration or rename one of them.',
1494
+ examples: [
1495
+ {
1496
+ description: 'Method registered twice',
1497
+ code: '# Type "string" has two methods both named "split"',
1498
+ },
1499
+ ],
1500
+ },
1501
+ // Value validation: empty vector (RILL-R074)
1502
+ {
1503
+ errorId: 'RILL-R074',
1504
+ category: 'runtime',
1505
+ description: 'Vector requires at least one dimension',
1506
+ messageTemplate: 'Vector data must have at least one dimension',
1507
+ cause: 'An empty Float32Array was passed to createVector. Vectors must have at least one element.',
1508
+ resolution: 'Provide a non-empty Float32Array when creating vectors.',
1509
+ examples: [
1510
+ {
1511
+ description: 'Zero-dimension vector',
1512
+ code: '# createVector(new Float32Array([]), "model") fails',
1513
+ },
1514
+ ],
1515
+ },
1516
+ // Extension validation: missing event field (RILL-R075)
1517
+ {
1518
+ errorId: 'RILL-R075',
1519
+ category: 'runtime',
1520
+ description: 'Event missing event field',
1521
+ messageTemplate: 'Event must include non-empty event field',
1522
+ cause: 'The event object passed to emitExtensionEvent has no event field or the field is empty.',
1523
+ resolution: 'Include a non-empty string event field in the event object.',
1524
+ examples: [
1525
+ {
1526
+ description: 'Empty event field',
1527
+ code: '# emitExtensionEvent(ctx, { event: "" }) fails',
1528
+ },
1529
+ ],
1530
+ },
1531
+ // Module resolution: unknown module (RILL-R076)
1532
+ {
1533
+ errorId: 'RILL-R076',
1534
+ category: 'runtime',
1535
+ description: 'Unknown module resource',
1536
+ messageTemplate: "Unknown module '{resource}'",
1537
+ cause: 'The module resolver received a resource identifier it does not recognize.',
1538
+ resolution: 'Use a valid module resource. The ext module resolver only handles the "ext" resource.',
1539
+ examples: [
1540
+ {
1541
+ description: 'Invalid module resource',
1542
+ code: 'use<module:unknown> # Error: unknown module',
1543
+ },
1544
+ ],
1545
+ },
1546
+ // Callable validation: invalid default value (RILL-R077)
1547
+ {
1548
+ errorId: 'RILL-R077',
1549
+ category: 'runtime',
1550
+ description: 'Invalid parameter default value',
1551
+ messageTemplate: "Invalid defaultValue for parameter '{paramName}': expected {expectedType}, got {actualType}",
1552
+ cause: 'The default value type does not match the declared parameter type.',
1553
+ resolution: 'Ensure the defaultValue matches the parameter type in the function definition.',
1554
+ examples: [
1555
+ {
1556
+ description: 'Type mismatch in default',
1557
+ code: '# param { name: "x", type: "number", defaultValue: "hello" }',
1558
+ },
1559
+ ],
1560
+ },
1333
1561
  // Check Errors (RILL-C0xx)
1334
1562
  {
1335
1563
  errorId: 'RILL-C001',
@@ -7,7 +7,7 @@
7
7
  import crypto from 'node:crypto';
8
8
  import { RuntimeError } from '../../error-classes.js';
9
9
  import { toCallable } from '../../runtime/core/callable.js';
10
- import { rillTypeToTypeValue, } from '../../runtime/core/values.js';
10
+ import { structureToTypeValue } from '../../runtime/core/values.js';
11
11
  // ============================================================
12
12
  // TYPES
13
13
  // ============================================================
@@ -119,7 +119,7 @@ export function createCryptoExtension(config = {}) {
119
119
  ],
120
120
  fn: hash,
121
121
  annotations: { description: 'Hash content, returns hex output' },
122
- returnType: rillTypeToTypeValue({ kind: 'string' }),
122
+ returnType: structureToTypeValue({ kind: 'string' }),
123
123
  }),
124
124
  hmac: toCallable({
125
125
  params: [
@@ -140,13 +140,13 @@ export function createCryptoExtension(config = {}) {
140
140
  annotations: {
141
141
  description: 'Generate HMAC signature, returns hex output',
142
142
  },
143
- returnType: rillTypeToTypeValue({ kind: 'string' }),
143
+ returnType: structureToTypeValue({ kind: 'string' }),
144
144
  }),
145
145
  uuid: toCallable({
146
146
  params: [],
147
147
  fn: uuid,
148
148
  annotations: { description: 'Generate random UUID v4' },
149
- returnType: rillTypeToTypeValue({ kind: 'string' }),
149
+ returnType: structureToTypeValue({ kind: 'string' }),
150
150
  }),
151
151
  random: toCallable({
152
152
  params: [
@@ -159,7 +159,7 @@ export function createCryptoExtension(config = {}) {
159
159
  ],
160
160
  fn: random,
161
161
  annotations: { description: 'Generate random bytes as hex string' },
162
- returnType: rillTypeToTypeValue({ kind: 'string' }),
162
+ returnType: structureToTypeValue({ kind: 'string' }),
163
163
  }),
164
164
  },
165
165
  };
@@ -5,7 +5,7 @@
5
5
  * Each declared command becomes a function with argument validation and process isolation.
6
6
  */
7
7
  import { toCallable } from '../../runtime/core/callable.js';
8
- import { rillTypeToTypeValue, } from '../../runtime/core/values.js';
8
+ import { structureToTypeValue } from '../../runtime/core/values.js';
9
9
  import { runCommand, } from './runner.js';
10
10
  // ============================================================
11
11
  // TYPES
@@ -134,7 +134,7 @@ export function createExecExtension(config) {
134
134
  annotations: {
135
135
  description: commandConfig.description ?? `Execute ${commandName} command`,
136
136
  },
137
- returnType: rillTypeToTypeValue({ kind: 'dict' }),
137
+ returnType: structureToTypeValue({ kind: 'dict' }),
138
138
  };
139
139
  }
140
140
  // ============================================================
@@ -154,7 +154,7 @@ export function createExecExtension(config) {
154
154
  params: [],
155
155
  fn: commands,
156
156
  annotations: { description: 'List all configured commands' },
157
- returnType: rillTypeToTypeValue({ kind: 'list' }),
157
+ returnType: structureToTypeValue({ kind: 'list' }),
158
158
  };
159
159
  // ============================================================
160
160
  // DISPOSE FUNCTION
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { RuntimeError } from '../../error-classes.js';
9
9
  import { toCallable } from '../../runtime/core/callable.js';
10
- import { rillTypeToTypeValue, } from '../../runtime/core/values.js';
10
+ import { structureToTypeValue } from '../../runtime/core/values.js';
11
11
  import { buildRequest, executeRequest, createSemaphore, } from './request.js';
12
12
  // ============================================================
13
13
  // TYPE DEFINITIONS
@@ -176,8 +176,8 @@ export function createFetchExtension(config) {
176
176
  };
177
177
  });
178
178
  const returnTypeValue = (endpointConfig.responseShape ?? defaultResponseShape) === 'full'
179
- ? rillTypeToTypeValue({ kind: 'dict' })
180
- : rillTypeToTypeValue({ kind: 'any' });
179
+ ? structureToTypeValue({ kind: 'dict' })
180
+ : structureToTypeValue({ kind: 'any' });
181
181
  const hostFunctionDef = {
182
182
  params: rillParams,
183
183
  fn: endpointFn,
@@ -211,7 +211,7 @@ export function createFetchExtension(config) {
211
211
  params: [],
212
212
  fn: endpoints,
213
213
  annotations: { description: 'List configured endpoints' },
214
- returnType: rillTypeToTypeValue({ kind: 'list' }),
214
+ returnType: structureToTypeValue({ kind: 'list' }),
215
215
  };
216
216
  // ============================================================
217
217
  // DISPOSAL
@@ -253,10 +253,10 @@ export async function executeRequest(url, options, config, namespace, responseSh
253
253
  const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
254
254
  try {
255
255
  // Execute fetch request
256
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
257
256
  const response = await fetch(url, {
258
257
  ...options,
259
258
  signal: controller.signal,
259
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
260
  });
261
261
  clearTimeout(timeoutId);
262
262
  // Handle HTTP errors