@rcrsr/rill 0.9.0 → 0.11.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.
- package/dist/ast-nodes.d.ts +43 -10
- package/dist/ast-nodes.d.ts.map +1 -1
- package/dist/ast-unions.d.ts +1 -1
- package/dist/ast-unions.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/error-registry.d.ts.map +1 -1
- package/dist/error-registry.js +273 -6
- package/dist/error-registry.js.map +1 -1
- package/dist/ext/crypto/index.d.ts.map +1 -1
- package/dist/ext/crypto/index.js +23 -12
- package/dist/ext/crypto/index.js.map +1 -1
- package/dist/ext/exec/index.d.ts.map +1 -1
- package/dist/ext/exec/index.js +10 -11
- package/dist/ext/exec/index.js.map +1 -1
- package/dist/ext/fetch/index.d.ts.map +1 -1
- package/dist/ext/fetch/index.js +15 -15
- package/dist/ext/fetch/index.js.map +1 -1
- package/dist/ext/fs/index.d.ts.map +1 -1
- package/dist/ext/fs/index.js +139 -47
- package/dist/ext/fs/index.js.map +1 -1
- package/dist/ext/kv/index.d.ts.map +1 -1
- package/dist/ext/kv/index.js +130 -31
- package/dist/ext/kv/index.js.map +1 -1
- package/dist/generated/introspection-data.d.ts +1 -1
- package/dist/generated/introspection-data.d.ts.map +1 -1
- package/dist/generated/introspection-data.js +109 -8
- package/dist/generated/introspection-data.js.map +1 -1
- package/dist/generated/version-data.d.ts +1 -1
- package/dist/generated/version-data.d.ts.map +1 -1
- package/dist/generated/version-data.js +2 -2
- package/dist/generated/version-data.js.map +1 -1
- package/dist/highlight-map.d.ts.map +1 -1
- package/dist/highlight-map.js +1 -0
- package/dist/highlight-map.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexer/readers.d.ts.map +1 -1
- package/dist/lexer/readers.js +1 -0
- package/dist/lexer/readers.js.map +1 -1
- package/dist/parser/index.d.ts +3 -1
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +4 -1
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/parser-control.d.ts +1 -1
- package/dist/parser/parser-control.d.ts.map +1 -1
- package/dist/parser/parser-control.js +2 -2
- package/dist/parser/parser-control.js.map +1 -1
- package/dist/parser/parser-expr.d.ts +2 -1
- package/dist/parser/parser-expr.d.ts.map +1 -1
- package/dist/parser/parser-expr.js +15 -2
- package/dist/parser/parser-expr.js.map +1 -1
- package/dist/parser/parser-extract.d.ts.map +1 -1
- package/dist/parser/parser-extract.js +10 -9
- package/dist/parser/parser-extract.js.map +1 -1
- package/dist/parser/parser-functions.js +11 -6
- package/dist/parser/parser-functions.js.map +1 -1
- package/dist/parser/parser-literals.d.ts +1 -1
- package/dist/parser/parser-literals.d.ts.map +1 -1
- package/dist/parser/parser-literals.js +61 -7
- package/dist/parser/parser-literals.js.map +1 -1
- package/dist/parser/parser-types.d.ts +22 -6
- package/dist/parser/parser-types.d.ts.map +1 -1
- package/dist/parser/parser-types.js +126 -9
- package/dist/parser/parser-types.js.map +1 -1
- package/dist/parser/parser-use.d.ts +11 -0
- package/dist/parser/parser-use.d.ts.map +1 -0
- package/dist/parser/parser-use.js +68 -0
- package/dist/parser/parser-use.js.map +1 -0
- package/dist/parser/parser-variables.d.ts.map +1 -1
- package/dist/parser/parser-variables.js +5 -4
- package/dist/parser/parser-variables.js.map +1 -1
- package/dist/runtime/core/callable.d.ts +59 -70
- package/dist/runtime/core/callable.d.ts.map +1 -1
- package/dist/runtime/core/callable.js +37 -93
- package/dist/runtime/core/callable.js.map +1 -1
- package/dist/runtime/core/context.d.ts.map +1 -1
- package/dist/runtime/core/context.js +104 -33
- package/dist/runtime/core/context.js.map +1 -1
- package/dist/runtime/core/equals.d.ts.map +1 -1
- package/dist/runtime/core/equals.js +59 -17
- package/dist/runtime/core/equals.js.map +1 -1
- package/dist/runtime/core/eval/evaluator.d.ts.map +1 -1
- package/dist/runtime/core/eval/evaluator.js +2 -1
- package/dist/runtime/core/eval/evaluator.js.map +1 -1
- package/dist/runtime/core/eval/index.d.ts +2 -2
- package/dist/runtime/core/eval/index.d.ts.map +1 -1
- package/dist/runtime/core/eval/index.js +5 -0
- package/dist/runtime/core/eval/index.js.map +1 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts +3 -5
- package/dist/runtime/core/eval/mixins/closures.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/closures.js +76 -40
- package/dist/runtime/core/eval/mixins/closures.js.map +1 -1
- package/dist/runtime/core/eval/mixins/collections.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/collections.js +4 -2
- package/dist/runtime/core/eval/mixins/collections.js.map +1 -1
- package/dist/runtime/core/eval/mixins/conversion.d.ts +9 -9
- package/dist/runtime/core/eval/mixins/conversion.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/conversion.js +51 -21
- package/dist/runtime/core/eval/mixins/conversion.js.map +1 -1
- package/dist/runtime/core/eval/mixins/core.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/core.js +8 -2
- package/dist/runtime/core/eval/mixins/core.js.map +1 -1
- package/dist/runtime/core/eval/mixins/extraction.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/extraction.js +20 -8
- package/dist/runtime/core/eval/mixins/extraction.js.map +1 -1
- package/dist/runtime/core/eval/mixins/literals.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/literals.js +32 -15
- package/dist/runtime/core/eval/mixins/literals.js.map +1 -1
- package/dist/runtime/core/eval/mixins/types.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/types.js +166 -21
- package/dist/runtime/core/eval/mixins/types.js.map +1 -1
- package/dist/runtime/core/eval/mixins/use.d.ts +25 -0
- package/dist/runtime/core/eval/mixins/use.d.ts.map +1 -0
- package/dist/runtime/core/eval/mixins/use.js +152 -0
- package/dist/runtime/core/eval/mixins/use.js.map +1 -0
- package/dist/runtime/core/eval/mixins/variables.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/variables.js +67 -32
- package/dist/runtime/core/eval/mixins/variables.js.map +1 -1
- package/dist/runtime/core/execute.d.ts.map +1 -1
- package/dist/runtime/core/execute.js +11 -1
- package/dist/runtime/core/execute.js.map +1 -1
- package/dist/runtime/core/field-descriptor.d.ts +6 -6
- package/dist/runtime/core/field-descriptor.d.ts.map +1 -1
- package/dist/runtime/core/field-descriptor.js +2 -2
- package/dist/runtime/core/field-descriptor.js.map +1 -1
- package/dist/runtime/core/introspection.d.ts +16 -0
- package/dist/runtime/core/introspection.d.ts.map +1 -1
- package/dist/runtime/core/introspection.js +102 -7
- package/dist/runtime/core/introspection.js.map +1 -1
- package/dist/runtime/core/resolvers.d.ts +39 -0
- package/dist/runtime/core/resolvers.d.ts.map +1 -0
- package/dist/runtime/core/resolvers.js +89 -0
- package/dist/runtime/core/resolvers.js.map +1 -0
- package/dist/runtime/core/types.d.ts +54 -5
- package/dist/runtime/core/types.d.ts.map +1 -1
- package/dist/runtime/core/types.js.map +1 -1
- package/dist/runtime/core/values.d.ts +43 -29
- package/dist/runtime/core/values.d.ts.map +1 -1
- package/dist/runtime/core/values.js +153 -68
- package/dist/runtime/core/values.js.map +1 -1
- package/dist/runtime/ext/builtins.d.ts +3 -4
- package/dist/runtime/ext/builtins.d.ts.map +1 -1
- package/dist/runtime/ext/builtins.js +621 -444
- package/dist/runtime/ext/builtins.js.map +1 -1
- package/dist/runtime/ext/extensions.d.ts +43 -43
- package/dist/runtime/ext/extensions.d.ts.map +1 -1
- package/dist/runtime/ext/extensions.js.map +1 -1
- package/dist/runtime/index.d.ts +8 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +6 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/signature-parser.d.ts +43 -0
- package/dist/signature-parser.d.ts.map +1 -0
- package/dist/signature-parser.js +289 -0
- package/dist/signature-parser.js.map +1 -0
- package/dist/token-types.d.ts +1 -0
- package/dist/token-types.d.ts.map +1 -1
- package/dist/token-types.js +1 -0
- package/dist/token-types.js.map +1 -1
- package/dist/value-types.d.ts +20 -6
- package/dist/value-types.d.ts.map +1 -1
- package/dist/value-types.js +1 -1
- package/dist/value-types.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Scheme Resolvers
|
|
3
|
+
*
|
|
4
|
+
* moduleResolver — reads Rill source files from the filesystem.
|
|
5
|
+
* extResolver — returns extension values from a host-provided config map.
|
|
6
|
+
*/
|
|
7
|
+
import { RuntimeError } from '../../error-classes.js';
|
|
8
|
+
// ============================================================
|
|
9
|
+
// MODULE RESOLVER
|
|
10
|
+
// ============================================================
|
|
11
|
+
/**
|
|
12
|
+
* Resolves a module ID to Rill source text by reading a file.
|
|
13
|
+
*
|
|
14
|
+
* Config shape: `{ basePath?: string; [moduleId: string]: string }`
|
|
15
|
+
* - `basePath` is optional; file paths resolve relative to it when provided,
|
|
16
|
+
* otherwise relative to `process.cwd()`.
|
|
17
|
+
* - Each other key is a module ID mapping to a file path string.
|
|
18
|
+
*
|
|
19
|
+
* Error codes:
|
|
20
|
+
* - RILL-R059 when config is not a plain object
|
|
21
|
+
* - RILL-R050 when the module ID is absent from the config map
|
|
22
|
+
* - RILL-R051 when the file cannot be read
|
|
23
|
+
*/
|
|
24
|
+
export const moduleResolver = async (resource, config) => {
|
|
25
|
+
if (typeof config !== 'object' || config === null || Array.isArray(config)) {
|
|
26
|
+
throw new RuntimeError('RILL-R059', 'moduleResolver config must be a plain object');
|
|
27
|
+
}
|
|
28
|
+
const cfg = config;
|
|
29
|
+
const basePath = typeof cfg['basePath'] === 'string' ? cfg['basePath'] : undefined;
|
|
30
|
+
const filePath = cfg[resource];
|
|
31
|
+
if (typeof filePath !== 'string') {
|
|
32
|
+
throw new RuntimeError('RILL-R050', `Module '${resource}' not found in resolver config`, undefined, { resource });
|
|
33
|
+
}
|
|
34
|
+
const { readFile } = await import('node:fs/promises');
|
|
35
|
+
const { resolve } = await import('node:path');
|
|
36
|
+
const absolutePath = basePath
|
|
37
|
+
? resolve(basePath, filePath)
|
|
38
|
+
: resolve(process.cwd(), filePath);
|
|
39
|
+
let text;
|
|
40
|
+
try {
|
|
41
|
+
text = await readFile(absolutePath, { encoding: 'utf8' });
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
45
|
+
throw new RuntimeError('RILL-R051', `Failed to read module '${resource}': ${reason}`, undefined, { resource, reason });
|
|
46
|
+
}
|
|
47
|
+
return { kind: 'source', text };
|
|
48
|
+
};
|
|
49
|
+
// ============================================================
|
|
50
|
+
// EXTENSION RESOLVER
|
|
51
|
+
// ============================================================
|
|
52
|
+
/**
|
|
53
|
+
* Resolves an extension name (or dot-path member) to a RillValue.
|
|
54
|
+
*
|
|
55
|
+
* Config shape: `Record<string, RillValue>` mapping extension name to value.
|
|
56
|
+
*
|
|
57
|
+
* Resource formats:
|
|
58
|
+
* - `"qdrant"` — returns the full extension value from config.
|
|
59
|
+
* - `"qdrant.search"` — returns the `search` member of the qdrant value.
|
|
60
|
+
*
|
|
61
|
+
* Dot-path: split by `.`, first segment is the extension name,
|
|
62
|
+
* remaining segments traverse the dict structure of the extension value.
|
|
63
|
+
*
|
|
64
|
+
* Error codes:
|
|
65
|
+
* - RILL-R052 when the extension name is absent from config
|
|
66
|
+
* - RILL-R053 when a member path segment is not found in the extension value
|
|
67
|
+
*/
|
|
68
|
+
export const extResolver = (resource, config) => {
|
|
69
|
+
const cfg = (config ?? {});
|
|
70
|
+
const segments = resource.split('.');
|
|
71
|
+
const name = segments[0] ?? resource;
|
|
72
|
+
if (!(name in cfg)) {
|
|
73
|
+
throw new RuntimeError('RILL-R052', `Extension '${name}' not found in resolver config`, undefined, { name });
|
|
74
|
+
}
|
|
75
|
+
let value = cfg[name];
|
|
76
|
+
for (let i = 1; i < segments.length; i++) {
|
|
77
|
+
const segment = segments[i];
|
|
78
|
+
if (typeof value !== 'object' ||
|
|
79
|
+
value === null ||
|
|
80
|
+
Array.isArray(value) ||
|
|
81
|
+
!(segment in value)) {
|
|
82
|
+
const path = segments.slice(1, i + 1).join('.');
|
|
83
|
+
throw new RuntimeError('RILL-R053', `Member '${path}' not found in extension '${name}'`, undefined, { path, name });
|
|
84
|
+
}
|
|
85
|
+
value = value[segment];
|
|
86
|
+
}
|
|
87
|
+
return { kind: 'value', value };
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=resolvers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvers.js","sourceRoot":"","sources":["../../../src/runtime/core/resolvers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAItD,+DAA+D;AAC/D,kBAAkB;AAClB,+DAA+D;AAE/D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAmB,KAAK,EACjD,QAAgB,EAChB,MAAgB,EACS,EAAE;IAC3B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,YAAY,CACpB,WAAW,EACX,8CAA8C,CAC/C,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,MAAgC,CAAC;IAC7C,MAAM,QAAQ,GACZ,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpE,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,YAAY,CACpB,WAA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G,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC;IAErC,IAAI,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,YAAY,CACpB,WAAW,EACX,cAAc,IAAI,gCAAgC,EAClD,SAAS,EACT,EAAE,IAAI,EAAE,CACT,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,GAAc,GAAG,CAAC,IAAI,CAAc,CAAC;IAE9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAW,CAAC;QACtC,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,KAAK,KAAK,IAAI;YACd,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACpB,CAAC,CAAC,OAAO,IAAK,KAAmC,CAAC,EAClD,CAAC;YACD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChD,MAAM,IAAI,YAAY,CACpB,WAAW,EACX,WAAW,IAAI,6BAA6B,IAAI,GAAG,EACnD,SAAS,EACT,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;QACJ,CAAC;QACD,KAAK,GAAI,KAAmC,CAAC,OAAO,CAAc,CAAC;IACrE,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC,CAAC"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* These types are the primary interface for host applications.
|
|
6
6
|
*/
|
|
7
7
|
import type { RillTypeName } from '../../types.js';
|
|
8
|
-
import type { CallableFn,
|
|
9
|
-
import type { RillValue } from './values.js';
|
|
8
|
+
import type { CallableFn, RillFunction, RillFunctionSignature } from './callable.js';
|
|
9
|
+
import type { RillType, RillValue } from './values.js';
|
|
10
10
|
export type { NativeArray, NativePlainObject, NativeValue } from './values.js';
|
|
11
11
|
/**
|
|
12
12
|
* Method signature for built-in methods.
|
|
@@ -97,6 +97,26 @@ export interface ErrorEvent {
|
|
|
97
97
|
/** Statement index where error occurred (if available) */
|
|
98
98
|
index?: number;
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Result returned by a SchemeResolver.
|
|
102
|
+
* `kind: "value"` — runtime binds `value` directly without evaluation.
|
|
103
|
+
* `kind: "source"` — runtime parses and executes `text` in an isolated child scope.
|
|
104
|
+
*/
|
|
105
|
+
export type ResolverResult = {
|
|
106
|
+
kind: 'value';
|
|
107
|
+
value: RillValue;
|
|
108
|
+
} | {
|
|
109
|
+
kind: 'source';
|
|
110
|
+
text: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Resolves a scheme-qualified resource to a value or source text.
|
|
114
|
+
* `resource` is the dot-joined path after the scheme separator (e.g. `"greetings"`, `"qdrant.search"`).
|
|
115
|
+
* `config` is the value from `RuntimeOptions.configurations.resolvers[scheme]`.
|
|
116
|
+
* Async resolvers are supported; synchronous resolvers may return ResolverResult directly.
|
|
117
|
+
* Resolvers must not call back into the rill runtime.
|
|
118
|
+
*/
|
|
119
|
+
export type SchemeResolver = (resource: string, config?: unknown) => ResolverResult | Promise<ResolverResult>;
|
|
100
120
|
/** Runtime context with variables, functions, and callbacks */
|
|
101
121
|
export interface RuntimeContext {
|
|
102
122
|
/** Parent scope for lexical variable lookup (undefined = root scope) */
|
|
@@ -104,11 +124,15 @@ export interface RuntimeContext {
|
|
|
104
124
|
/** Named variables ($varname) - local to this scope */
|
|
105
125
|
readonly variables: Map<string, RillValue>;
|
|
106
126
|
/** Variable types - locked after first assignment (local to this scope) */
|
|
107
|
-
readonly variableTypes: Map<string, RillTypeName>;
|
|
127
|
+
readonly variableTypes: Map<string, RillTypeName | RillType>;
|
|
108
128
|
/** Built-in and user-defined functions (CallableFn for untyped, ApplicationCallable for typed) */
|
|
109
129
|
readonly functions: Map<string, CallableFn | import('./callable.js').ApplicationCallable>;
|
|
110
130
|
/** Built-in and user-defined methods */
|
|
111
131
|
readonly methods: Map<string, RillMethod>;
|
|
132
|
+
/** Receiver type constraints for methods (empty array = unconstrained) */
|
|
133
|
+
readonly methodReceiverTypes: Map<string, readonly string[]>;
|
|
134
|
+
/** Parsed parameter declarations for built-in methods (AC-15 arg validation) */
|
|
135
|
+
readonly methodParams: Map<string, readonly import('./callable.js').RillParam[]>;
|
|
112
136
|
/** I/O callbacks */
|
|
113
137
|
readonly callbacks: RuntimeCallbacks;
|
|
114
138
|
/** Observability callbacks */
|
|
@@ -142,13 +166,25 @@ export interface RuntimeContext {
|
|
|
142
166
|
readonly callStack: import('../../types.js').CallFrame[];
|
|
143
167
|
/** Arbitrary string metadata passed from the host (e.g. request IDs, user IDs) */
|
|
144
168
|
readonly metadata?: Record<string, string> | undefined;
|
|
169
|
+
/** Scheme-to-resolver map, populated from RuntimeOptions.resolvers (empty Map when absent) */
|
|
170
|
+
readonly resolvers: ReadonlyMap<string, SchemeResolver>;
|
|
171
|
+
/** Per-scheme config data, populated from RuntimeOptions.configurations.resolvers (empty Map when absent) */
|
|
172
|
+
readonly resolverConfigs: ReadonlyMap<string, unknown>;
|
|
173
|
+
/** In-flight resolution keys for cycle detection; shared across child scopes */
|
|
174
|
+
readonly resolvingSchemes: Set<string>;
|
|
175
|
+
/**
|
|
176
|
+
* Parser function for executing resolver source results.
|
|
177
|
+
* Must be provided when `kind: 'source'` resolver results are expected.
|
|
178
|
+
* Omit if only `kind: 'value'` resolvers are used.
|
|
179
|
+
*/
|
|
180
|
+
readonly parseSource?: ((text: string) => import('../../types.js').ScriptNode) | undefined;
|
|
145
181
|
}
|
|
146
182
|
/** Options for creating a runtime context */
|
|
147
183
|
export interface RuntimeOptions {
|
|
148
184
|
/** Initial variables */
|
|
149
185
|
variables?: Record<string, RillValue>;
|
|
150
|
-
/** Host functions:
|
|
151
|
-
functions?: Record<string,
|
|
186
|
+
/** Host functions: structured definitions or signature strings */
|
|
187
|
+
functions?: Record<string, RillFunction | RillFunctionSignature>;
|
|
152
188
|
/** I/O callbacks */
|
|
153
189
|
callbacks?: Partial<RuntimeCallbacks>;
|
|
154
190
|
/** Observability callbacks for monitoring execution */
|
|
@@ -165,6 +201,19 @@ export interface RuntimeOptions {
|
|
|
165
201
|
maxCallStackDepth?: number;
|
|
166
202
|
/** Arbitrary string metadata passed through to the runtime context */
|
|
167
203
|
metadata?: Record<string, string>;
|
|
204
|
+
/** Scheme-to-resolver map; keys are scheme names (e.g. `"env"`, `"qdrant"`) */
|
|
205
|
+
resolvers?: Record<string, SchemeResolver>;
|
|
206
|
+
/** Per-scheme configuration data passed as the second argument to each resolver */
|
|
207
|
+
configurations?: {
|
|
208
|
+
resolvers?: Record<string, unknown>;
|
|
209
|
+
};
|
|
210
|
+
/** Type checker mode; default `'permissive'` */
|
|
211
|
+
checkerMode?: 'strict' | 'permissive';
|
|
212
|
+
/**
|
|
213
|
+
* Parser function for executing resolver source results.
|
|
214
|
+
* Required when resolvers may return `kind: 'source'` results.
|
|
215
|
+
*/
|
|
216
|
+
parseSource?: (text: string) => import('../../types.js').ScriptNode;
|
|
168
217
|
}
|
|
169
218
|
/** Result of script execution */
|
|
170
219
|
export interface ExecutionResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,qBAAqB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S,CAAC;CAC3D;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,iCAAiC;IACjC,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5B,oDAAoD;IACpD,SAAS,IAAI,eAAe,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CA+C7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/core/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/core/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuRH;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAgB;IAChD,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,QAAQ,IAAI,KAAK;QACjB,aAAa,IAAI,KAAK,EACtB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,KAAkC,CAAC;IAChD,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAE9B,sDAAsD;IACtD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,IACE,OAAO,CAAC,KAAK,QAAQ;YACrB,CAAC,KAAK,IAAI;YACV,QAAQ,IAAI,CAAC;YACb,CAAC,CAAC,MAAM,KAAK,UAAU;YACvB,CAAC,CAAC,WAAW,IAAI,CAAC,IAAK,CAA6B,CAAC,WAAW,CAAC,CAAC,EAClE,CAAC;YACD,iBAAiB,GAAG,IAAI,CAAC;YACzB,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,CAAC,iBAAiB;QAAE,OAAO,KAAK,CAAC;IAErC,yCAAyC;IACzC,MAAM,MAAM,GAA8B,EAAE,CAAC;IAC7C,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,IACE,OAAO,CAAC,KAAK,QAAQ;YACrB,CAAC,KAAK,IAAI;YACV,QAAQ,IAAI,CAAC;YACb,CAAC,CAAC,MAAM,KAAK,UAAU;YACvB,CAAC,CAAC,WAAW,IAAI,CAAC,IAAK,CAA6B,CAAC,WAAW,CAAC,CAAC,EAClE,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,EAAe,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -44,28 +44,42 @@ export interface RillVector {
|
|
|
44
44
|
* Structural type descriptor - describes the shape of a value in the type system.
|
|
45
45
|
* Used by RillTypeValue to carry type structure information at runtime.
|
|
46
46
|
*/
|
|
47
|
-
export type
|
|
48
|
-
|
|
49
|
-
name: RillTypeName;
|
|
47
|
+
export type RillType = {
|
|
48
|
+
type: 'number';
|
|
50
49
|
} | {
|
|
51
|
-
|
|
52
|
-
element: RillStructuralType;
|
|
50
|
+
type: 'string';
|
|
53
51
|
} | {
|
|
54
|
-
|
|
55
|
-
fields: Record<string, RillStructuralType>;
|
|
52
|
+
type: 'bool';
|
|
56
53
|
} | {
|
|
57
|
-
|
|
58
|
-
elements: RillStructuralType[];
|
|
54
|
+
type: 'vector';
|
|
59
55
|
} | {
|
|
60
|
-
|
|
61
|
-
fields: [string, RillStructuralType][];
|
|
56
|
+
type: 'type';
|
|
62
57
|
} | {
|
|
63
|
-
|
|
64
|
-
params: [string, RillStructuralType][];
|
|
65
|
-
ret: RillStructuralType;
|
|
58
|
+
type: 'any';
|
|
66
59
|
} | {
|
|
67
|
-
|
|
60
|
+
type: 'dict';
|
|
61
|
+
fields?: Record<string, RillType>;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'list';
|
|
64
|
+
element?: RillType;
|
|
65
|
+
} | {
|
|
66
|
+
type: 'closure';
|
|
67
|
+
params?: [string, RillType][];
|
|
68
|
+
ret?: RillType;
|
|
69
|
+
} | {
|
|
70
|
+
type: 'tuple';
|
|
71
|
+
elements?: RillType[];
|
|
72
|
+
} | {
|
|
73
|
+
type: 'ordered';
|
|
74
|
+
fields?: [string, RillType][];
|
|
75
|
+
} | {
|
|
76
|
+
type: 'union';
|
|
77
|
+
members: RillType[];
|
|
68
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated Use RillType instead. Will be removed in the next major version.
|
|
81
|
+
*/
|
|
82
|
+
export type RillStructuralType = RillType;
|
|
69
83
|
/**
|
|
70
84
|
* Type value - represents a first-class type name at runtime.
|
|
71
85
|
* Created when a type name expression (e.g. `string`, `number`) is evaluated.
|
|
@@ -73,7 +87,7 @@ export type RillStructuralType = {
|
|
|
73
87
|
export interface RillTypeValue {
|
|
74
88
|
readonly __rill_type: true;
|
|
75
89
|
readonly typeName: RillTypeName;
|
|
76
|
-
readonly structure:
|
|
90
|
+
readonly structure: RillType;
|
|
77
91
|
}
|
|
78
92
|
/** Any value that can flow through Rill */
|
|
79
93
|
export type RillValue = string | number | boolean | null | RillValue[] | {
|
|
@@ -100,21 +114,21 @@ export declare function createVector(data: Float32Array, model: string): RillVec
|
|
|
100
114
|
export declare function inferType(value: RillValue): RillTypeName;
|
|
101
115
|
/**
|
|
102
116
|
* Infer the element type for a homogeneous list.
|
|
103
|
-
* Empty arrays return {
|
|
117
|
+
* Empty arrays return { type: 'any' }.
|
|
104
118
|
* Mixed types throw RILL-R002.
|
|
105
119
|
*/
|
|
106
|
-
export declare function inferElementType(elements: RillValue[]):
|
|
120
|
+
export declare function inferElementType(elements: RillValue[]): RillType;
|
|
107
121
|
/** Compare two structural types for equality. */
|
|
108
|
-
export declare function structuralTypeEquals(a:
|
|
122
|
+
export declare function structuralTypeEquals(a: RillType, b: RillType): boolean;
|
|
109
123
|
/** Infer the structural type descriptor for any Rill value. */
|
|
110
|
-
export declare function inferStructuralType(value: RillValue):
|
|
124
|
+
export declare function inferStructuralType(value: RillValue): RillType;
|
|
111
125
|
/**
|
|
112
126
|
* Check if a value matches a structural type descriptor.
|
|
113
127
|
* Used for runtime type checking (`:?` operator).
|
|
114
128
|
*/
|
|
115
|
-
export declare function structuralTypeMatches(value: RillValue, type:
|
|
129
|
+
export declare function structuralTypeMatches(value: RillValue, type: RillType): boolean;
|
|
116
130
|
/** Format a structural type descriptor as a human-readable string. */
|
|
117
|
-
export declare function formatStructuralType(type:
|
|
131
|
+
export declare function formatStructuralType(type: RillType): string;
|
|
118
132
|
/**
|
|
119
133
|
* Check if a value is of the expected type.
|
|
120
134
|
* Returns true if the value matches the expected type, false otherwise.
|
|
@@ -139,12 +153,12 @@ export type NativePlainObject = {
|
|
|
139
153
|
};
|
|
140
154
|
/** Structured result from toNative conversion */
|
|
141
155
|
export interface NativeResult {
|
|
142
|
-
/** Rill type
|
|
143
|
-
|
|
144
|
-
/** Human-readable type signature, e.g. "string", "list
|
|
145
|
-
|
|
146
|
-
/** Native JS representation
|
|
147
|
-
|
|
156
|
+
/** Rill type name — matches RillTypeName, or 'iterator' for lazy sequences */
|
|
157
|
+
rillTypeName: string;
|
|
158
|
+
/** Human-readable type signature, e.g. "string", "list(number)", "|x: number| :string" */
|
|
159
|
+
rillTypeSignature: string;
|
|
160
|
+
/** Native JS representation. Non-native types produce descriptor objects. */
|
|
161
|
+
value: NativeValue;
|
|
148
162
|
}
|
|
149
163
|
/**
|
|
150
164
|
* Convert a RillValue to a JSON-serializable value.
|
|
@@ -153,7 +167,7 @@ export interface NativeResult {
|
|
|
153
167
|
export declare function valueToJSON(value: RillValue): unknown;
|
|
154
168
|
/**
|
|
155
169
|
* Convert a RillValue to a NativeResult for host consumption.
|
|
156
|
-
* Non-representable types (closures, vectors, type values, iterators)
|
|
170
|
+
* Non-representable types (closures, vectors, type values, iterators) produce descriptor objects.
|
|
157
171
|
* Tuples convert to native arrays. Ordered values convert to plain objects.
|
|
158
172
|
*/
|
|
159
173
|
export declare function toNative(value: RillValue): NativeResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/values.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAWnD,UAAU,cAAc;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAGD,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,uBAAuB,EAAE,IAAI,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;CACzC;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM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