@rcrsr/rill 0.16.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/README.md +37 -21
- 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.d.ts +3 -3
- package/dist/ext/crypto/index.js +62 -59
- package/dist/ext/exec/index.d.ts +3 -3
- package/dist/ext/exec/index.js +15 -9
- package/dist/ext/fetch/index.d.ts +3 -3
- package/dist/ext/fetch/index.js +17 -12
- package/dist/ext/fetch/request.js +1 -1
- package/dist/ext/fs/index.d.ts +3 -3
- package/dist/ext/fs/index.js +256 -266
- package/dist/ext/fs/sandbox.d.ts +18 -0
- package/dist/ext/fs/sandbox.js +33 -0
- package/dist/ext/kv/index.d.ts +3 -3
- package/dist/ext/kv/index.js +198 -196
- package/dist/ext/kv/store.d.ts +1 -1
- package/dist/ext/kv/store.js +2 -1
- package/dist/ext-parse-bridge.d.ts +10 -0
- package/dist/ext-parse-bridge.js +10 -0
- package/dist/generated/introspection-data.d.ts +1 -1
- package/dist/generated/introspection-data.js +385 -296
- 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 -4
- package/dist/index.js +1 -5
- 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-types.js +12 -0
- package/dist/parser/parser-use.js +26 -3
- package/dist/parser/parser.d.ts +2 -0
- package/dist/parser/parser.js +2 -0
- package/dist/runtime/core/callable.d.ts +24 -13
- package/dist/runtime/core/callable.js +71 -38
- package/dist/runtime/core/context.d.ts +2 -13
- package/dist/runtime/core/context.js +80 -79
- 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 +3 -3
- package/dist/runtime/core/eval/index.js +11 -0
- package/dist/runtime/core/eval/mixins/closures.js +381 -41
- 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 +61 -115
- package/dist/runtime/core/eval/mixins/core.js +17 -4
- package/dist/runtime/core/eval/mixins/expressions.js +36 -27
- 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 +17 -6
- package/dist/runtime/core/eval/mixins/types.js +73 -54
- package/dist/runtime/core/eval/mixins/variables.js +12 -8
- package/dist/runtime/core/execute.d.ts +1 -1
- package/dist/runtime/core/field-descriptor.d.ts +3 -3
- package/dist/runtime/core/field-descriptor.js +2 -1
- package/dist/runtime/core/introspection.d.ts +2 -2
- package/dist/runtime/core/introspection.js +7 -6
- 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/markers.d.ts +12 -0
- package/dist/runtime/core/types/markers.js +7 -0
- package/dist/runtime/core/types/operations.d.ts +98 -0
- package/dist/runtime/core/types/operations.js +804 -0
- package/dist/runtime/core/types/registrations.d.ts +126 -0
- package/dist/runtime/core/types/registrations.js +751 -0
- package/dist/runtime/core/{types.d.ts → types/runtime.d.ts} +22 -10
- package/dist/runtime/core/types/structures.d.ts +146 -0
- package/dist/runtime/core/types/structures.js +12 -0
- package/dist/runtime/core/values.d.ts +29 -209
- package/dist/runtime/core/values.js +56 -968
- package/dist/runtime/ext/builtins.js +88 -68
- package/dist/runtime/ext/extensions.d.ts +31 -125
- package/dist/runtime/ext/extensions.js +2 -94
- package/dist/runtime/ext/test-context.d.ts +28 -0
- package/dist/runtime/ext/test-context.js +155 -0
- package/dist/runtime/index.d.ts +12 -12
- package/dist/runtime/index.js +13 -5
- package/dist/signature-parser.d.ts +2 -2
- package/dist/signature-parser.js +14 -14
- package/dist/token-types.d.ts +1 -0
- package/dist/token-types.js +1 -0
- package/package.json +1 -1
- /package/dist/runtime/core/{types.js → types/runtime.js} +0 -0
package/dist/ext/exec/index.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Provides sandboxed command execution via allowlist/blocklist security controls.
|
|
5
5
|
* Each declared command becomes a function with argument validation and process isolation.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { toCallable } from '../../runtime/core/callable.js';
|
|
8
|
+
import { structureToTypeValue } from '../../runtime/core/values.js';
|
|
8
9
|
import { runCommand, } from './runner.js';
|
|
9
10
|
// ============================================================
|
|
10
11
|
// TYPES
|
|
@@ -23,7 +24,7 @@ export const configSchema = {
|
|
|
23
24
|
* Returns dispose() function to abort in-flight processes.
|
|
24
25
|
*
|
|
25
26
|
* @param config - Command definitions and defaults
|
|
26
|
-
* @returns
|
|
27
|
+
* @returns ExtensionFactoryResult with command functions and dispose
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
29
30
|
* ```typescript
|
|
@@ -118,13 +119,13 @@ export function createExecExtension(config) {
|
|
|
118
119
|
params: [
|
|
119
120
|
{
|
|
120
121
|
name: 'args',
|
|
121
|
-
type: {
|
|
122
|
+
type: { kind: 'list' },
|
|
122
123
|
defaultValue: [],
|
|
123
124
|
annotations: { description: 'Command arguments' },
|
|
124
125
|
},
|
|
125
126
|
{
|
|
126
127
|
name: 'stdin',
|
|
127
|
-
type: {
|
|
128
|
+
type: { kind: 'string' },
|
|
128
129
|
defaultValue: '',
|
|
129
130
|
annotations: { description: 'Standard input data' },
|
|
130
131
|
},
|
|
@@ -133,7 +134,7 @@ export function createExecExtension(config) {
|
|
|
133
134
|
annotations: {
|
|
134
135
|
description: commandConfig.description ?? `Execute ${commandName} command`,
|
|
135
136
|
},
|
|
136
|
-
returnType:
|
|
137
|
+
returnType: structureToTypeValue({ kind: 'dict' }),
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
140
|
// ============================================================
|
|
@@ -153,7 +154,7 @@ export function createExecExtension(config) {
|
|
|
153
154
|
params: [],
|
|
154
155
|
fn: commands,
|
|
155
156
|
annotations: { description: 'List all configured commands' },
|
|
156
|
-
returnType:
|
|
157
|
+
returnType: structureToTypeValue({ kind: 'list' }),
|
|
157
158
|
};
|
|
158
159
|
// ============================================================
|
|
159
160
|
// DISPOSE FUNCTION
|
|
@@ -169,9 +170,14 @@ export function createExecExtension(config) {
|
|
|
169
170
|
// ============================================================
|
|
170
171
|
// EXTENSION RESULT
|
|
171
172
|
// ============================================================
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
const callableDict = {};
|
|
174
|
+
for (const [name, def] of Object.entries(functions)) {
|
|
175
|
+
callableDict[name] = toCallable(def);
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
value: callableDict,
|
|
179
|
+
dispose,
|
|
180
|
+
};
|
|
175
181
|
}
|
|
176
182
|
// ============================================================
|
|
177
183
|
// MANIFEST
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Scripts call endpoints with positional args or single dict argument.
|
|
6
6
|
* All URLs are constructed from config - scripts cannot specify arbitrary URLs.
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ExtensionFactoryResult, ExtensionConfigSchema, ExtensionManifest } from '../../runtime/ext/extensions.js';
|
|
9
9
|
export declare const configSchema: ExtensionConfigSchema;
|
|
10
10
|
/** Parameter definition for endpoint */
|
|
11
11
|
export interface EndpointParam {
|
|
@@ -46,7 +46,7 @@ export interface FetchConfig {
|
|
|
46
46
|
* All URLs constructed from config - scripts cannot create arbitrary URLs.
|
|
47
47
|
*
|
|
48
48
|
* @param config - Fetch configuration with endpoints
|
|
49
|
-
* @returns
|
|
49
|
+
* @returns ExtensionFactoryResult with endpoint functions and introspection
|
|
50
50
|
* @throws Error on invalid configuration
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
@@ -65,5 +65,5 @@ export interface FetchConfig {
|
|
|
65
65
|
* });
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
|
-
export declare function createFetchExtension(config: FetchConfig):
|
|
68
|
+
export declare function createFetchExtension(config: FetchConfig): ExtensionFactoryResult;
|
|
69
69
|
export declare const extensionManifest: ExtensionManifest;
|
package/dist/ext/fetch/index.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* All URLs are constructed from config - scripts cannot specify arbitrary URLs.
|
|
7
7
|
*/
|
|
8
8
|
import { RuntimeError } from '../../error-classes.js';
|
|
9
|
-
import {} from '../../runtime/core/callable.js';
|
|
10
|
-
import {
|
|
9
|
+
import { toCallable } from '../../runtime/core/callable.js';
|
|
10
|
+
import { structureToTypeValue } from '../../runtime/core/values.js';
|
|
11
11
|
import { buildRequest, executeRequest, createSemaphore, } from './request.js';
|
|
12
12
|
// ============================================================
|
|
13
13
|
// TYPE DEFINITIONS
|
|
@@ -96,7 +96,7 @@ function processArguments(args, params, functionName) {
|
|
|
96
96
|
* All URLs constructed from config - scripts cannot create arbitrary URLs.
|
|
97
97
|
*
|
|
98
98
|
* @param config - Fetch configuration with endpoints
|
|
99
|
-
* @returns
|
|
99
|
+
* @returns ExtensionFactoryResult with endpoint functions and introspection
|
|
100
100
|
* @throws Error on invalid configuration
|
|
101
101
|
*
|
|
102
102
|
* @example
|
|
@@ -164,10 +164,10 @@ export function createFetchExtension(config) {
|
|
|
164
164
|
};
|
|
165
165
|
// Build parameter definitions for RillFunction
|
|
166
166
|
const rillParams = params.map((param) => {
|
|
167
|
-
// Map EndpointParam type string to
|
|
167
|
+
// Map EndpointParam type string to TypeStructure object
|
|
168
168
|
const rillType = param.type !== 'dict'
|
|
169
|
-
? {
|
|
170
|
-
: {
|
|
169
|
+
? { kind: param.type }
|
|
170
|
+
: { kind: 'dict' };
|
|
171
171
|
return {
|
|
172
172
|
name: param.name,
|
|
173
173
|
type: rillType,
|
|
@@ -176,8 +176,8 @@ export function createFetchExtension(config) {
|
|
|
176
176
|
};
|
|
177
177
|
});
|
|
178
178
|
const returnTypeValue = (endpointConfig.responseShape ?? defaultResponseShape) === 'full'
|
|
179
|
-
?
|
|
180
|
-
:
|
|
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:
|
|
214
|
+
returnType: structureToTypeValue({ kind: 'list' }),
|
|
215
215
|
};
|
|
216
216
|
// ============================================================
|
|
217
217
|
// DISPOSAL
|
|
@@ -229,9 +229,14 @@ export function createFetchExtension(config) {
|
|
|
229
229
|
// ============================================================
|
|
230
230
|
// EXTENSION RESULT
|
|
231
231
|
// ============================================================
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
const callableDict = {};
|
|
233
|
+
for (const [name, def] of Object.entries(functions)) {
|
|
234
|
+
callableDict[name] = toCallable(def);
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
value: callableDict,
|
|
238
|
+
dispose,
|
|
239
|
+
};
|
|
235
240
|
}
|
|
236
241
|
// ============================================================
|
|
237
242
|
// MANIFEST
|
|
@@ -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
|
package/dist/ext/fs/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides sandboxed filesystem operations via mount-based access control.
|
|
5
5
|
* All 12 functions implement path validation, permission checks, and glob filtering.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { ExtensionFactoryResult, ExtensionConfigSchema, ExtensionManifest } from '../../runtime/ext/extensions.js';
|
|
8
8
|
import { type MountConfig } from './sandbox.js';
|
|
9
9
|
/** Filesystem extension configuration */
|
|
10
10
|
export interface FsConfig {
|
|
@@ -24,7 +24,7 @@ export declare const configSchema: ExtensionConfigSchema;
|
|
|
24
24
|
* Returns 12 functions: read, write, append, list, find, exists, remove, stat, mkdir, copy, move, mounts.
|
|
25
25
|
*
|
|
26
26
|
* @param config - Mount configuration and defaults
|
|
27
|
-
* @returns
|
|
27
|
+
* @returns ExtensionFactoryResult with 12 filesystem functions
|
|
28
28
|
* @throws RuntimeError if mount initialization fails
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
@@ -36,5 +36,5 @@ export declare const configSchema: ExtensionConfigSchema;
|
|
|
36
36
|
* });
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export declare function createFsExtension(config: FsConfig):
|
|
39
|
+
export declare function createFsExtension(config: FsConfig): ExtensionFactoryResult;
|
|
40
40
|
export declare const extensionManifest: ExtensionManifest;
|