@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.
- package/dist/ast-nodes.d.ts +14 -4
- package/dist/ast-unions.d.ts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -0
- package/dist/error-registry.js +228 -0
- package/dist/ext/crypto/index.js +5 -5
- package/dist/ext/exec/index.js +3 -3
- package/dist/ext/fetch/index.js +4 -4
- package/dist/ext/fetch/request.js +1 -1
- package/dist/ext/fs/index.js +101 -114
- package/dist/ext/fs/sandbox.d.ts +18 -0
- package/dist/ext/fs/sandbox.js +33 -0
- package/dist/ext/kv/index.js +12 -12
- package/dist/ext/kv/store.d.ts +1 -1
- package/dist/ext/kv/store.js +1 -1
- package/dist/generated/version-data.d.ts +1 -1
- package/dist/generated/version-data.js +2 -2
- package/dist/highlight-map.js +1 -0
- package/dist/index.d.ts +1 -15
- package/dist/index.js +1 -14
- package/dist/lexer/operators.js +1 -0
- package/dist/parser/helpers.js +1 -0
- package/dist/parser/parser-expr.js +44 -5
- package/dist/parser/parser-literals.js +111 -4
- package/dist/parser/parser-shape.js +2 -2
- package/dist/parser/parser-use.js +19 -2
- package/dist/parser/parser.d.ts +2 -0
- package/dist/parser/parser.js +2 -0
- package/dist/runtime/core/callable.d.ts +5 -6
- package/dist/runtime/core/callable.js +10 -17
- package/dist/runtime/core/context.d.ts +2 -2
- package/dist/runtime/core/context.js +8 -8
- package/dist/runtime/core/eval/base.d.ts +2 -2
- package/dist/runtime/core/eval/base.js +2 -0
- package/dist/runtime/core/eval/evaluator.d.ts +1 -1
- package/dist/runtime/core/eval/index.d.ts +2 -2
- package/dist/runtime/core/eval/mixins/closures.js +367 -27
- package/dist/runtime/core/eval/mixins/collections.js +81 -6
- package/dist/runtime/core/eval/mixins/control-flow.js +1 -1
- package/dist/runtime/core/eval/mixins/conversion.js +17 -12
- package/dist/runtime/core/eval/mixins/core.js +15 -2
- package/dist/runtime/core/eval/mixins/expressions.js +3 -2
- package/dist/runtime/core/eval/mixins/extraction.js +2 -3
- package/dist/runtime/core/eval/mixins/list-dispatch.js +1 -1
- package/dist/runtime/core/eval/mixins/literals.js +14 -3
- package/dist/runtime/core/eval/mixins/types.js +30 -1
- package/dist/runtime/core/eval/mixins/variables.js +3 -1
- package/dist/runtime/core/execute.d.ts +1 -1
- package/dist/runtime/core/field-descriptor.d.ts +1 -1
- package/dist/runtime/core/introspection.d.ts +2 -2
- package/dist/runtime/core/introspection.js +2 -1
- package/dist/runtime/core/resolvers.d.ts +1 -1
- package/dist/runtime/core/signals.d.ts +6 -1
- package/dist/runtime/core/signals.js +9 -0
- package/dist/runtime/core/types/constructors.d.ts +54 -0
- package/dist/runtime/core/types/constructors.js +201 -0
- package/dist/runtime/core/types/guards.d.ts +42 -0
- package/dist/runtime/core/types/guards.js +88 -0
- package/dist/runtime/core/types/index.d.ts +18 -0
- package/dist/runtime/core/types/index.js +19 -0
- package/dist/runtime/core/types/operations.d.ts +98 -0
- package/dist/runtime/core/types/operations.js +804 -0
- package/dist/runtime/core/{type-registrations.d.ts → types/registrations.d.ts} +12 -22
- package/dist/runtime/core/{type-registrations.js → types/registrations.js} +94 -92
- package/dist/runtime/core/{types.d.ts → types/runtime.d.ts} +8 -8
- package/dist/runtime/core/{type-structures.d.ts → types/structures.d.ts} +21 -3
- package/dist/runtime/core/values.d.ts +13 -102
- package/dist/runtime/core/values.js +26 -722
- package/dist/runtime/ext/builtins.js +9 -8
- package/dist/runtime/ext/extensions.d.ts +2 -2
- package/dist/runtime/ext/extensions.js +2 -1
- package/dist/runtime/ext/test-context.d.ts +2 -2
- package/dist/runtime/ext/test-context.js +3 -2
- package/dist/runtime/index.d.ts +8 -22
- package/dist/runtime/index.js +10 -16
- package/dist/signature-parser.d.ts +1 -1
- package/dist/token-types.d.ts +1 -0
- package/dist/token-types.js +1 -0
- package/package.json +1 -1
- /package/dist/runtime/core/{markers.d.ts → types/markers.d.ts} +0 -0
- /package/dist/runtime/core/{markers.js → types/markers.js} +0 -0
- /package/dist/runtime/core/{types.js → types/runtime.js} +0 -0
- /package/dist/runtime/core/{type-structures.js → types/structures.js} +0 -0
|
@@ -9,9 +9,11 @@
|
|
|
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 {
|
|
12
|
+
import { deepEquals, formatValue, inferType, serializeValue, } from '../core/types/registrations.js';
|
|
13
|
+
import { isIterator, isVector } from '../core/types/guards.js';
|
|
14
|
+
import { anyTypeValue, isEmpty, structureToTypeValue } from '../core/values.js';
|
|
13
15
|
import { invokeCallable } from '../core/eval/index.js';
|
|
14
|
-
import { populateBuiltinMethods } from '../core/
|
|
16
|
+
import { populateBuiltinMethods } from '../core/types/registrations.js';
|
|
15
17
|
// ============================================================
|
|
16
18
|
// ITERATOR HELPERS
|
|
17
19
|
// ============================================================
|
|
@@ -109,7 +111,7 @@ export const BUILTIN_FUNCTIONS = {
|
|
|
109
111
|
annotations: {},
|
|
110
112
|
},
|
|
111
113
|
],
|
|
112
|
-
returnType:
|
|
114
|
+
returnType: structureToTypeValue({ kind: 'string' }),
|
|
113
115
|
fn: (args, _ctx, location) => {
|
|
114
116
|
const value = args['value'] ?? null;
|
|
115
117
|
try {
|
|
@@ -117,8 +119,7 @@ export const BUILTIN_FUNCTIONS = {
|
|
|
117
119
|
return JSON.stringify(jsonValue);
|
|
118
120
|
}
|
|
119
121
|
catch (err) {
|
|
120
|
-
|
|
121
|
-
throw err;
|
|
122
|
+
// Wrap serialization errors (RILL-R067 from protocol) as RILL-R004
|
|
122
123
|
if (err instanceof Error) {
|
|
123
124
|
throw new RuntimeError('RILL-R004', err.message, location);
|
|
124
125
|
}
|
|
@@ -143,7 +144,7 @@ export const BUILTIN_FUNCTIONS = {
|
|
|
143
144
|
annotations: {},
|
|
144
145
|
},
|
|
145
146
|
],
|
|
146
|
-
returnType:
|
|
147
|
+
returnType: structureToTypeValue({ kind: 'list' }),
|
|
147
148
|
fn: (args) => {
|
|
148
149
|
const input = args['items'] ?? null;
|
|
149
150
|
if (Array.isArray(input)) {
|
|
@@ -350,7 +351,7 @@ function buildMethodEntry(name, signature, method, skipReceiverValidation) {
|
|
|
350
351
|
? { description: parsed.description }
|
|
351
352
|
: {},
|
|
352
353
|
returnType: parsed.returnType !== undefined
|
|
353
|
-
?
|
|
354
|
+
? structureToTypeValue(parsed.returnType)
|
|
354
355
|
: anyTypeValue,
|
|
355
356
|
...(skipReceiverValidation ? { skipReceiverValidation: true } : {}),
|
|
356
357
|
};
|
|
@@ -415,7 +416,7 @@ const mTail = (receiver, _args, _ctx, location) => {
|
|
|
415
416
|
};
|
|
416
417
|
/** Get iterator at first position for any collection */
|
|
417
418
|
const mFirst = (receiver, _args, _ctx, location) => {
|
|
418
|
-
if (
|
|
419
|
+
if (isIterator(receiver))
|
|
419
420
|
return receiver;
|
|
420
421
|
if (Array.isArray(receiver))
|
|
421
422
|
return makeListIterator(receiver, 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApplicationCallable } from '../core/callable.js';
|
|
2
|
-
import type { ExtensionEvent, RuntimeCallbacks } from '../core/types.js';
|
|
3
|
-
import type { RillValue } from '../core/
|
|
2
|
+
import type { ExtensionEvent, RuntimeCallbacks } from '../core/types/runtime.js';
|
|
3
|
+
import type { RillValue } from '../core/types/structures.js';
|
|
4
4
|
/**
|
|
5
5
|
* Minimal interface for extension event emission.
|
|
6
6
|
* Allows emitExtensionEvent to accept any context with callbacks.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RuntimeError } from '../../types.js';
|
|
1
2
|
/**
|
|
2
3
|
* Emit an extension event with auto-generated timestamp.
|
|
3
4
|
* Adds ISO timestamp if event.timestamp is undefined, then calls onLogEvent callback.
|
|
@@ -26,7 +27,7 @@ export function emitExtensionEvent(ctx, event) {
|
|
|
26
27
|
if (!event['event'] ||
|
|
27
28
|
typeof event['event'] !== 'string' ||
|
|
28
29
|
event['event'].trim() === '') {
|
|
29
|
-
throw new
|
|
30
|
+
throw new RuntimeError('RILL-R075', 'Event must include non-empty event field');
|
|
30
31
|
}
|
|
31
32
|
// IC-2: Guard for callbacks property (graceful degradation)
|
|
32
33
|
if ('callbacks' in ctx && ctx.callbacks) {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Creates a pre-wired RuntimeContext from extension value maps.
|
|
5
5
|
* Designed for testing and lightweight embedding without rill-config.
|
|
6
6
|
*/
|
|
7
|
-
import type { RuntimeContext } from '../core/types.js';
|
|
8
|
-
import {
|
|
7
|
+
import type { RuntimeContext } from '../core/types/runtime.js';
|
|
8
|
+
import type { RillValue } from '../core/types/structures.js';
|
|
9
9
|
/**
|
|
10
10
|
* Error thrown when extension binding generation fails.
|
|
11
11
|
* Mirrors the ExtensionBindingError in rill-config for core-only usage.
|
|
@@ -8,7 +8,8 @@ import { parseSource } from '../../ext-parse-bridge.js';
|
|
|
8
8
|
import { createRuntimeContext } from '../core/context.js';
|
|
9
9
|
import { extResolver } from '../core/resolvers.js';
|
|
10
10
|
import { isCallable } from '../core/callable.js';
|
|
11
|
-
import { formatStructure } from '../core/
|
|
11
|
+
import { formatStructure } from '../core/types/operations.js';
|
|
12
|
+
import { RuntimeError } from '../../types.js';
|
|
12
13
|
// ============================================================
|
|
13
14
|
// ERROR CLASS
|
|
14
15
|
// ============================================================
|
|
@@ -109,7 +110,7 @@ function createExtModuleResolver(bindingSource) {
|
|
|
109
110
|
if (resource === 'ext') {
|
|
110
111
|
return { kind: 'source', text: bindingSource, sourceId: 'module:ext' };
|
|
111
112
|
}
|
|
112
|
-
throw new
|
|
113
|
+
throw new RuntimeError('RILL-R076', `Unknown module '${resource}'`);
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
116
|
// ============================================================
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -16,29 +16,14 @@
|
|
|
16
16
|
* - ext/: Self-contained extensions
|
|
17
17
|
* - builtins.ts: Built-in functions and methods
|
|
18
18
|
*/
|
|
19
|
-
export type { CaptureEvent, ErrorEvent, ExecutionResult, ExecutionStepper,
|
|
20
|
-
export type { ApplicationCallable, CallableFn, RillCallable, RillFunction, RillParam, RuntimeCallable, ScriptCallable, } from './core/callable.js';
|
|
21
|
-
export { callable, isApplicationCallable, isCallable, isDict, isRuntimeCallable, isScriptCallable, toCallable, } from './core/callable.js';
|
|
22
|
-
export type {
|
|
23
|
-
|
|
24
|
-
export
|
|
25
|
-
export type { TypeDefinition, TypeProtocol, } from './core/type-registrations.js';
|
|
26
|
-
export { anyTypeValue, commonType, createTuple, createVector, formatStructure, inferElementType, inferStructure, inferType, isIterator, isTuple, isTypeValue, isVector, isReservedMethod, paramToFieldDef, structureToTypeValue, RESERVED_DICT_METHODS, structureEquals, structureMatches, toNative, } from './core/values.js';
|
|
27
|
-
/** @deprecated Use formatStructure instead. */
|
|
28
|
-
export { formatStructuralType } from './core/values.js';
|
|
29
|
-
/** @deprecated Use inferStructure instead. */
|
|
30
|
-
export { inferStructuralType } from './core/values.js';
|
|
31
|
-
/** @deprecated Use isIterator instead. */
|
|
32
|
-
export { isRillIterator } from './core/values.js';
|
|
33
|
-
/** @deprecated Use structureToTypeValue instead. */
|
|
34
|
-
export { rillTypeToTypeValue } from './core/values.js';
|
|
35
|
-
/** @deprecated Use structureEquals instead. */
|
|
36
|
-
export { structuralTypeEquals } from './core/values.js';
|
|
37
|
-
/** @deprecated Use structureMatches instead. */
|
|
38
|
-
export { structuralTypeMatches } from './core/values.js';
|
|
19
|
+
export type { CaptureEvent, ErrorEvent, ExecutionResult, ExecutionStepper, ExtensionEvent, FieldComparisonCallbacks, FunctionReturnEvent, HostCallEvent, NativeArray, NativePlainObject, NativeValue, ObservabilityCallbacks, ResolverResult, RillFieldDef, RillIterator, RillStream, RillTuple, RillTypeValue, RillValue, RillVector, RuntimeCallbacks, RuntimeContext, RuntimeOptions, SchemeResolver, StepEndEvent, StepResult, StepStartEvent, TypeDefinition, TypeProtocol, TypeStructure, } from './core/types/index.js';
|
|
20
|
+
export type { ApplicationCallable, CallableFn, MarshalOptions, RillCallable, RillFunction, RillParam, RuntimeCallable, ScriptCallable, } from './core/callable.js';
|
|
21
|
+
export { callable, hydrateFieldDefaults, isApplicationCallable, isCallable, isDict, isRuntimeCallable, isScriptCallable, marshalArgs, toCallable, } from './core/callable.js';
|
|
22
|
+
export type { NativeResult } from './core/values.js';
|
|
23
|
+
export { BUILT_IN_TYPES, commonType, compareStructuredFields, copyValue, createOrdered, createRillStream, createTuple, createVector, deepEquals, deserializeValue, formatRillLiteral, formatStructure, formatValue, inferElementType, inferStructure, inferType, isIterator, isRillStream, isStream, isTuple, isTypeValue, isVector, paramToFieldDef, serializeValue, structureEquals, structureMatches, } from './core/types/index.js';
|
|
24
|
+
export { anyTypeValue, isEmpty, isReservedMethod, isTruthy, RESERVED_DICT_METHODS, structureToTypeValue, toNative, } from './core/values.js';
|
|
39
25
|
export { buildFieldDescriptor } from './core/field-descriptor.js';
|
|
40
|
-
export { BreakSignal, ReturnSignal } from './core/signals.js';
|
|
41
|
-
export type { ExtensionEvent } from './core/types.js';
|
|
26
|
+
export { BreakSignal, ReturnSignal, YieldSignal } from './core/signals.js';
|
|
42
27
|
export type { ConfigFieldDescriptor, ExtensionConfigSchema, ExtensionFactory, ExtensionFactoryResult, ExtensionManifest, FsExtensionContract, KvExtensionContract, } from './ext/extensions.js';
|
|
43
28
|
export type { SchemaEntry } from '../ext/kv/index.js';
|
|
44
29
|
export { emitExtensionEvent } from './ext/extensions.js';
|
|
@@ -49,6 +34,7 @@ export type { CallFrame } from '../types.js';
|
|
|
49
34
|
export { getCallStack, pushCallFrame, popCallFrame } from './core/context.js';
|
|
50
35
|
export { createStepper, execute } from './core/execute.js';
|
|
51
36
|
export { invokeCallable } from './core/eval/index.js';
|
|
37
|
+
export { BUILTIN_METHODS } from './ext/builtins.js';
|
|
52
38
|
export type { DocumentationCoverageResult, FunctionMetadata, ParamMetadata, } from './core/introspection.js';
|
|
53
39
|
export { generateManifest, getDocumentationCoverage, getFunctions, getLanguageReference, } from './core/introspection.js';
|
|
54
40
|
export type { VersionInfo } from '../generated/version-data.js';
|
package/dist/runtime/index.js
CHANGED
|
@@ -16,26 +16,16 @@
|
|
|
16
16
|
* - ext/: Self-contained extensions
|
|
17
17
|
* - builtins.ts: Built-in functions and methods
|
|
18
18
|
*/
|
|
19
|
-
export { callable, isApplicationCallable, isCallable, isDict, isRuntimeCallable, isScriptCallable, toCallable, } from './core/callable.js';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
/** @deprecated Use inferStructure instead. */
|
|
25
|
-
export { inferStructuralType } from './core/values.js';
|
|
26
|
-
/** @deprecated Use isIterator instead. */
|
|
27
|
-
export { isRillIterator } from './core/values.js';
|
|
28
|
-
/** @deprecated Use structureToTypeValue instead. */
|
|
29
|
-
export { rillTypeToTypeValue } from './core/values.js';
|
|
30
|
-
/** @deprecated Use structureEquals instead. */
|
|
31
|
-
export { structuralTypeEquals } from './core/values.js';
|
|
32
|
-
/** @deprecated Use structureMatches instead. */
|
|
33
|
-
export { structuralTypeMatches } from './core/values.js';
|
|
19
|
+
export { callable, hydrateFieldDefaults, isApplicationCallable, isCallable, isDict, isRuntimeCallable, isScriptCallable, marshalArgs, toCallable, } from './core/callable.js';
|
|
20
|
+
// Extracted to types/ sub-modules (via barrel)
|
|
21
|
+
export { BUILT_IN_TYPES, commonType, compareStructuredFields, copyValue, createOrdered, createRillStream, createTuple, createVector, deepEquals, deserializeValue, formatRillLiteral, formatStructure, formatValue, inferElementType, inferStructure, inferType, isIterator, isRillStream, isStream, isTuple, isTypeValue, isVector, paramToFieldDef, serializeValue, structureEquals, structureMatches, } from './core/types/index.js';
|
|
22
|
+
// Remain in values.ts
|
|
23
|
+
export { anyTypeValue, isEmpty, isReservedMethod, isTruthy, RESERVED_DICT_METHODS, structureToTypeValue, toNative, } from './core/values.js';
|
|
34
24
|
export { buildFieldDescriptor } from './core/field-descriptor.js';
|
|
35
25
|
// ============================================================
|
|
36
26
|
// CONTROL FLOW SIGNALS
|
|
37
27
|
// ============================================================
|
|
38
|
-
export { BreakSignal, ReturnSignal } from './core/signals.js';
|
|
28
|
+
export { BreakSignal, ReturnSignal, YieldSignal } from './core/signals.js';
|
|
39
29
|
export { emitExtensionEvent } from './ext/extensions.js';
|
|
40
30
|
// ============================================================
|
|
41
31
|
// BUILT-IN RESOLVERS
|
|
@@ -55,5 +45,9 @@ export { createStepper, execute } from './core/execute.js';
|
|
|
55
45
|
// CALLABLE INVOCATION
|
|
56
46
|
// ============================================================
|
|
57
47
|
export { invokeCallable } from './core/eval/index.js';
|
|
48
|
+
// ============================================================
|
|
49
|
+
// BUILT-IN METHODS
|
|
50
|
+
// ============================================================
|
|
51
|
+
export { BUILTIN_METHODS } from './ext/builtins.js';
|
|
58
52
|
export { generateManifest, getDocumentationCoverage, getFunctions, getLanguageReference, } from './core/introspection.js';
|
|
59
53
|
export { VERSION, VERSION_INFO } from '../generated/version-data.js';
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* which is NOT in parser/* or lexer/* — boundary preserved.
|
|
13
13
|
*/
|
|
14
14
|
import type { RillParam } from './runtime/core/callable.js';
|
|
15
|
-
import type { TypeStructure } from './runtime/core/
|
|
15
|
+
import type { TypeStructure } from './runtime/core/types/structures.js';
|
|
16
16
|
/**
|
|
17
17
|
* Result of parsing a signature string at registration time.
|
|
18
18
|
*/
|
package/dist/token-types.d.ts
CHANGED
package/dist/token-types.js
CHANGED
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|