@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.
- package/README.md +37 -21
- package/dist/ast-nodes.d.ts +2 -13
- package/dist/ast-nodes.js +0 -1
- package/dist/ast-unions.d.ts +0 -1
- package/dist/ast-unions.js +0 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -1
- package/dist/error-classes.d.ts +0 -1
- package/dist/error-classes.js +0 -1
- package/dist/error-formatter.d.ts +0 -1
- package/dist/error-formatter.js +0 -1
- package/dist/error-registry.d.ts +0 -1
- package/dist/error-registry.js +32 -1
- package/dist/ext/crypto/index.d.ts +3 -4
- package/dist/ext/crypto/index.js +66 -64
- package/dist/ext/exec/index.d.ts +3 -4
- package/dist/ext/exec/index.js +17 -12
- package/dist/ext/exec/runner.d.ts +0 -1
- package/dist/ext/exec/runner.js +0 -1
- package/dist/ext/fetch/index.d.ts +3 -4
- package/dist/ext/fetch/index.js +23 -49
- package/dist/ext/fetch/request.d.ts +0 -1
- package/dist/ext/fetch/request.js +0 -1
- package/dist/ext/fs/index.d.ts +3 -4
- package/dist/ext/fs/index.js +268 -266
- package/dist/ext/fs/sandbox.d.ts +0 -1
- package/dist/ext/fs/sandbox.js +0 -1
- package/dist/ext/kv/index.d.ts +3 -4
- package/dist/ext/kv/index.js +216 -215
- package/dist/ext/kv/store.d.ts +0 -1
- package/dist/ext/kv/store.js +2 -2
- 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 -2
- package/dist/generated/introspection-data.js +385 -297
- package/dist/generated/version-data.d.ts +1 -2
- package/dist/generated/version-data.js +2 -3
- package/dist/highlight-map.d.ts +0 -1
- package/dist/highlight-map.js +0 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.js +14 -6
- package/dist/lexer/errors.d.ts +0 -1
- package/dist/lexer/errors.js +0 -1
- package/dist/lexer/helpers.d.ts +0 -1
- package/dist/lexer/helpers.js +0 -1
- package/dist/lexer/index.d.ts +0 -1
- package/dist/lexer/index.js +0 -1
- package/dist/lexer/operators.d.ts +0 -1
- package/dist/lexer/operators.js +0 -1
- package/dist/lexer/readers.d.ts +0 -1
- package/dist/lexer/readers.js +0 -1
- package/dist/lexer/state.d.ts +0 -1
- package/dist/lexer/state.js +0 -1
- package/dist/lexer/tokenizer.d.ts +0 -1
- package/dist/lexer/tokenizer.js +0 -1
- package/dist/parser/helpers.d.ts +0 -1
- package/dist/parser/helpers.js +0 -1
- package/dist/parser/index.d.ts +0 -1
- package/dist/parser/index.js +0 -1
- package/dist/parser/parser-collect.d.ts +0 -1
- package/dist/parser/parser-collect.js +0 -1
- package/dist/parser/parser-control.d.ts +0 -1
- package/dist/parser/parser-control.js +0 -1
- package/dist/parser/parser-expr.d.ts +0 -1
- package/dist/parser/parser-expr.js +0 -1
- package/dist/parser/parser-extract.d.ts +0 -1
- package/dist/parser/parser-extract.js +0 -1
- package/dist/parser/parser-functions.d.ts +0 -1
- package/dist/parser/parser-functions.js +0 -1
- package/dist/parser/parser-literals.d.ts +0 -1
- package/dist/parser/parser-literals.js +4 -2
- package/dist/parser/parser-script.d.ts +0 -1
- package/dist/parser/parser-script.js +0 -1
- package/dist/parser/parser-shape.d.ts +2 -3
- package/dist/parser/parser-shape.js +8 -52
- package/dist/parser/parser-types.d.ts +28 -2
- package/dist/parser/parser-types.js +76 -13
- package/dist/parser/parser-use.d.ts +0 -1
- package/dist/parser/parser-use.js +7 -2
- package/dist/parser/parser-variables.d.ts +0 -1
- package/dist/parser/parser-variables.js +0 -1
- package/dist/parser/parser.d.ts +0 -1
- package/dist/parser/parser.js +0 -1
- package/dist/parser/state.d.ts +0 -1
- package/dist/parser/state.js +0 -1
- package/dist/runtime/core/callable.d.ts +59 -20
- package/dist/runtime/core/callable.js +188 -39
- package/dist/runtime/core/context.d.ts +0 -12
- package/dist/runtime/core/context.js +77 -77
- package/dist/runtime/core/equals.d.ts +0 -1
- package/dist/runtime/core/equals.js +35 -3
- package/dist/runtime/core/eval/base.d.ts +0 -1
- package/dist/runtime/core/eval/base.js +0 -1
- package/dist/runtime/core/eval/evaluator.d.ts +0 -1
- package/dist/runtime/core/eval/evaluator.js +0 -1
- package/dist/runtime/core/eval/index.d.ts +2 -3
- package/dist/runtime/core/eval/index.js +11 -1
- package/dist/runtime/core/eval/mixins/annotations.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/annotations.js +0 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/closures.js +92 -70
- package/dist/runtime/core/eval/mixins/collections.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/collections.js +9 -4
- package/dist/runtime/core/eval/mixins/control-flow.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.js +0 -1
- package/dist/runtime/core/eval/mixins/conversion.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/conversion.js +196 -188
- package/dist/runtime/core/eval/mixins/core.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/core.js +2 -3
- package/dist/runtime/core/eval/mixins/expressions.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/expressions.js +35 -28
- package/dist/runtime/core/eval/mixins/extraction.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/extraction.js +8 -9
- package/dist/runtime/core/eval/mixins/list-dispatch.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.js +0 -1
- package/dist/runtime/core/eval/mixins/literals.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/literals.js +6 -10
- package/dist/runtime/core/eval/mixins/types.d.ts +2 -1
- package/dist/runtime/core/eval/mixins/types.js +231 -261
- package/dist/runtime/core/eval/mixins/use.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/use.js +0 -1
- package/dist/runtime/core/eval/mixins/variables.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/variables.js +16 -15
- package/dist/runtime/core/eval/types.d.ts +0 -1
- package/dist/runtime/core/eval/types.js +0 -1
- package/dist/runtime/core/execute.d.ts +0 -1
- package/dist/runtime/core/execute.js +0 -1
- package/dist/runtime/core/field-descriptor.d.ts +4 -5
- package/dist/runtime/core/field-descriptor.js +2 -2
- package/dist/runtime/core/introspection.d.ts +0 -1
- package/dist/runtime/core/introspection.js +6 -7
- package/dist/runtime/core/markers.d.ts +12 -0
- package/dist/runtime/core/markers.js +7 -0
- package/dist/runtime/core/resolvers.d.ts +0 -1
- package/dist/runtime/core/resolvers.js +0 -1
- package/dist/runtime/core/signals.d.ts +0 -1
- package/dist/runtime/core/signals.js +0 -1
- package/dist/runtime/core/type-registrations.d.ts +136 -0
- package/dist/runtime/core/type-registrations.js +749 -0
- package/dist/runtime/core/type-structures.d.ts +128 -0
- package/dist/runtime/core/type-structures.js +12 -0
- package/dist/runtime/core/types.d.ts +15 -4
- package/dist/runtime/core/types.js +0 -1
- package/dist/runtime/core/values.d.ts +88 -146
- package/dist/runtime/core/values.js +466 -470
- package/dist/runtime/ext/builtins.d.ts +0 -1
- package/dist/runtime/ext/builtins.js +125 -80
- package/dist/runtime/ext/extensions.d.ts +30 -125
- package/dist/runtime/ext/extensions.js +0 -94
- package/dist/runtime/ext/test-context.d.ts +28 -0
- package/dist/runtime/ext/test-context.js +154 -0
- package/dist/runtime/index.d.ts +22 -9
- package/dist/runtime/index.js +18 -5
- package/dist/signature-parser.d.ts +2 -3
- package/dist/signature-parser.js +19 -17
- package/dist/source-location.d.ts +0 -1
- package/dist/source-location.js +0 -1
- package/dist/token-types.d.ts +0 -1
- package/dist/token-types.js +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -1
- package/dist/value-types.d.ts +15 -12
- package/dist/value-types.js +0 -1
- package/package.json +2 -1
- package/dist/ast-nodes.d.ts.map +0 -1
- package/dist/ast-nodes.js.map +0 -1
- package/dist/ast-unions.d.ts.map +0 -1
- package/dist/ast-unions.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/error-classes.d.ts.map +0 -1
- package/dist/error-classes.js.map +0 -1
- package/dist/error-formatter.d.ts.map +0 -1
- package/dist/error-formatter.js.map +0 -1
- package/dist/error-registry.d.ts.map +0 -1
- package/dist/error-registry.js.map +0 -1
- package/dist/ext/crypto/index.d.ts.map +0 -1
- package/dist/ext/crypto/index.js.map +0 -1
- package/dist/ext/exec/index.d.ts.map +0 -1
- package/dist/ext/exec/index.js.map +0 -1
- package/dist/ext/exec/runner.d.ts.map +0 -1
- package/dist/ext/exec/runner.js.map +0 -1
- package/dist/ext/fetch/index.d.ts.map +0 -1
- package/dist/ext/fetch/index.js.map +0 -1
- package/dist/ext/fetch/request.d.ts.map +0 -1
- package/dist/ext/fetch/request.js.map +0 -1
- package/dist/ext/fs/index.d.ts.map +0 -1
- package/dist/ext/fs/index.js.map +0 -1
- package/dist/ext/fs/sandbox.d.ts.map +0 -1
- package/dist/ext/fs/sandbox.js.map +0 -1
- package/dist/ext/kv/index.d.ts.map +0 -1
- package/dist/ext/kv/index.js.map +0 -1
- package/dist/ext/kv/store.d.ts.map +0 -1
- package/dist/ext/kv/store.js.map +0 -1
- package/dist/generated/introspection-data.d.ts.map +0 -1
- package/dist/generated/introspection-data.js.map +0 -1
- package/dist/generated/version-data.d.ts.map +0 -1
- package/dist/generated/version-data.js.map +0 -1
- package/dist/highlight-map.d.ts.map +0 -1
- package/dist/highlight-map.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lexer/errors.d.ts.map +0 -1
- package/dist/lexer/errors.js.map +0 -1
- package/dist/lexer/helpers.d.ts.map +0 -1
- package/dist/lexer/helpers.js.map +0 -1
- package/dist/lexer/index.d.ts.map +0 -1
- package/dist/lexer/index.js.map +0 -1
- package/dist/lexer/operators.d.ts.map +0 -1
- package/dist/lexer/operators.js.map +0 -1
- package/dist/lexer/readers.d.ts.map +0 -1
- package/dist/lexer/readers.js.map +0 -1
- package/dist/lexer/state.d.ts.map +0 -1
- package/dist/lexer/state.js.map +0 -1
- package/dist/lexer/tokenizer.d.ts.map +0 -1
- package/dist/lexer/tokenizer.js.map +0 -1
- package/dist/parser/helpers.d.ts.map +0 -1
- package/dist/parser/helpers.js.map +0 -1
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/parser-collect.d.ts.map +0 -1
- package/dist/parser/parser-collect.js.map +0 -1
- package/dist/parser/parser-control.d.ts.map +0 -1
- package/dist/parser/parser-control.js.map +0 -1
- package/dist/parser/parser-expr.d.ts.map +0 -1
- package/dist/parser/parser-expr.js.map +0 -1
- package/dist/parser/parser-extract.d.ts.map +0 -1
- package/dist/parser/parser-extract.js.map +0 -1
- package/dist/parser/parser-functions.d.ts.map +0 -1
- package/dist/parser/parser-functions.js.map +0 -1
- package/dist/parser/parser-literals.d.ts.map +0 -1
- package/dist/parser/parser-literals.js.map +0 -1
- package/dist/parser/parser-script.d.ts.map +0 -1
- package/dist/parser/parser-script.js.map +0 -1
- package/dist/parser/parser-shape.d.ts.map +0 -1
- package/dist/parser/parser-shape.js.map +0 -1
- package/dist/parser/parser-types.d.ts.map +0 -1
- package/dist/parser/parser-types.js.map +0 -1
- package/dist/parser/parser-use.d.ts.map +0 -1
- package/dist/parser/parser-use.js.map +0 -1
- package/dist/parser/parser-variables.d.ts.map +0 -1
- package/dist/parser/parser-variables.js.map +0 -1
- package/dist/parser/parser.d.ts.map +0 -1
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/state.d.ts.map +0 -1
- package/dist/parser/state.js.map +0 -1
- package/dist/runtime/core/callable.d.ts.map +0 -1
- package/dist/runtime/core/callable.js.map +0 -1
- package/dist/runtime/core/context.d.ts.map +0 -1
- package/dist/runtime/core/context.js.map +0 -1
- package/dist/runtime/core/equals.d.ts.map +0 -1
- package/dist/runtime/core/equals.js.map +0 -1
- package/dist/runtime/core/eval/base.d.ts.map +0 -1
- package/dist/runtime/core/eval/base.js.map +0 -1
- package/dist/runtime/core/eval/evaluator.d.ts.map +0 -1
- package/dist/runtime/core/eval/evaluator.js.map +0 -1
- package/dist/runtime/core/eval/index.d.ts.map +0 -1
- package/dist/runtime/core/eval/index.js.map +0 -1
- package/dist/runtime/core/eval/mixins/annotations.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/annotations.js.map +0 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/closures.js.map +0 -1
- package/dist/runtime/core/eval/mixins/collections.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/collections.js.map +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.js.map +0 -1
- package/dist/runtime/core/eval/mixins/conversion.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/conversion.js.map +0 -1
- package/dist/runtime/core/eval/mixins/core.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/core.js.map +0 -1
- package/dist/runtime/core/eval/mixins/expressions.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/expressions.js.map +0 -1
- package/dist/runtime/core/eval/mixins/extraction.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/extraction.js.map +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.js.map +0 -1
- package/dist/runtime/core/eval/mixins/literals.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/literals.js.map +0 -1
- package/dist/runtime/core/eval/mixins/types.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/types.js.map +0 -1
- package/dist/runtime/core/eval/mixins/use.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/use.js.map +0 -1
- package/dist/runtime/core/eval/mixins/variables.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/variables.js.map +0 -1
- package/dist/runtime/core/eval/types.d.ts.map +0 -1
- package/dist/runtime/core/eval/types.js.map +0 -1
- package/dist/runtime/core/execute.d.ts.map +0 -1
- package/dist/runtime/core/execute.js.map +0 -1
- package/dist/runtime/core/field-descriptor.d.ts.map +0 -1
- package/dist/runtime/core/field-descriptor.js.map +0 -1
- package/dist/runtime/core/introspection.d.ts.map +0 -1
- package/dist/runtime/core/introspection.js.map +0 -1
- package/dist/runtime/core/resolvers.d.ts.map +0 -1
- package/dist/runtime/core/resolvers.js.map +0 -1
- package/dist/runtime/core/signals.d.ts.map +0 -1
- package/dist/runtime/core/signals.js.map +0 -1
- package/dist/runtime/core/types.d.ts.map +0 -1
- package/dist/runtime/core/types.js.map +0 -1
- package/dist/runtime/core/values.d.ts.map +0 -1
- package/dist/runtime/core/values.js.map +0 -1
- package/dist/runtime/ext/builtins.d.ts.map +0 -1
- package/dist/runtime/ext/builtins.js.map +0 -1
- package/dist/runtime/ext/extensions.d.ts.map +0 -1
- package/dist/runtime/ext/extensions.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/signature-parser.d.ts.map +0 -1
- package/dist/signature-parser.js.map +0 -1
- package/dist/source-location.d.ts.map +0 -1
- package/dist/source-location.js.map +0 -1
- package/dist/token-types.d.ts.map +0 -1
- package/dist/token-types.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/value-types.d.ts.map +0 -1
- package/dist/value-types.js.map +0 -1
package/dist/ext/fs/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import fs from 'node:fs/promises';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { RuntimeError } from '../../error-classes.js';
|
|
10
|
+
import { toCallable } from '../../runtime/core/callable.js';
|
|
10
11
|
import { rillTypeToTypeValue, } from '../../runtime/core/values.js';
|
|
11
12
|
import { resolvePath, matchesGlob, initializeMount, } from './sandbox.js';
|
|
12
13
|
export const configSchema = {
|
|
@@ -22,7 +23,7 @@ export const configSchema = {
|
|
|
22
23
|
* Returns 12 functions: read, write, append, list, find, exists, remove, stat, mkdir, copy, move, mounts.
|
|
23
24
|
*
|
|
24
25
|
* @param config - Mount configuration and defaults
|
|
25
|
-
* @returns
|
|
26
|
+
* @returns ExtensionFactoryResult with 12 filesystem functions
|
|
26
27
|
* @throws RuntimeError if mount initialization fails
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
@@ -75,8 +76,8 @@ export function createFsExtension(config) {
|
|
|
75
76
|
// ctx and location not used but required by CallableFn signature
|
|
76
77
|
) => {
|
|
77
78
|
await ensureInitialized();
|
|
78
|
-
const mountName = args[
|
|
79
|
-
const filePath = args[
|
|
79
|
+
const mountName = args['mount'];
|
|
80
|
+
const filePath = args['path'];
|
|
80
81
|
// EC-5: Catch file not found from resolvePath
|
|
81
82
|
let resolvedPath;
|
|
82
83
|
try {
|
|
@@ -101,9 +102,9 @@ export function createFsExtension(config) {
|
|
|
101
102
|
*/
|
|
102
103
|
const write = async (args) => {
|
|
103
104
|
await ensureInitialized();
|
|
104
|
-
const mountName = args[
|
|
105
|
-
const filePath = args[
|
|
106
|
-
const content = args[
|
|
105
|
+
const mountName = args['mount'];
|
|
106
|
+
const filePath = args['path'];
|
|
107
|
+
const content = args['content'];
|
|
107
108
|
const resolvedPath = await resolvePath(mountName, filePath, mounts, 'write', true // createMode: resolve parent directory
|
|
108
109
|
);
|
|
109
110
|
// Check content size before writing
|
|
@@ -120,9 +121,9 @@ export function createFsExtension(config) {
|
|
|
120
121
|
*/
|
|
121
122
|
const append = async (args) => {
|
|
122
123
|
await ensureInitialized();
|
|
123
|
-
const mountName = args[
|
|
124
|
-
const filePath = args[
|
|
125
|
-
const content = args[
|
|
124
|
+
const mountName = args['mount'];
|
|
125
|
+
const filePath = args['path'];
|
|
126
|
+
const content = args['content'];
|
|
126
127
|
const resolvedPath = await resolvePath(mountName, filePath, mounts, 'write', true // createMode: allow new files
|
|
127
128
|
);
|
|
128
129
|
// Check content size before appending
|
|
@@ -157,8 +158,8 @@ export function createFsExtension(config) {
|
|
|
157
158
|
*/
|
|
158
159
|
const list = async (args) => {
|
|
159
160
|
await ensureInitialized();
|
|
160
|
-
const mountName = args[
|
|
161
|
-
const dirPath = args[
|
|
161
|
+
const mountName = args['mount'];
|
|
162
|
+
const dirPath = args['path'] ?? '';
|
|
162
163
|
const resolvedPath = await resolvePath(mountName, dirPath, mounts, 'read');
|
|
163
164
|
const entries = await fs.readdir(resolvedPath, { withFileTypes: true });
|
|
164
165
|
const result = [];
|
|
@@ -179,8 +180,8 @@ export function createFsExtension(config) {
|
|
|
179
180
|
*/
|
|
180
181
|
const find = async (args) => {
|
|
181
182
|
await ensureInitialized();
|
|
182
|
-
const mountName = args[
|
|
183
|
-
const pattern = args[
|
|
183
|
+
const mountName = args['mount'];
|
|
184
|
+
const pattern = args['pattern'] ?? '*';
|
|
184
185
|
const mount = mounts[mountName];
|
|
185
186
|
if (!mount || !mount.resolvedPath) {
|
|
186
187
|
throw new RuntimeError('RILL-R004', `mount "${mountName}" not configured`, undefined, { mountName });
|
|
@@ -211,8 +212,8 @@ export function createFsExtension(config) {
|
|
|
211
212
|
*/
|
|
212
213
|
const exists = async (args) => {
|
|
213
214
|
await ensureInitialized();
|
|
214
|
-
const mountName = args[
|
|
215
|
-
const filePath = args[
|
|
215
|
+
const mountName = args['mount'];
|
|
216
|
+
const filePath = args['path'];
|
|
216
217
|
try {
|
|
217
218
|
await resolvePath(mountName, filePath, mounts, 'read');
|
|
218
219
|
return true;
|
|
@@ -231,8 +232,8 @@ export function createFsExtension(config) {
|
|
|
231
232
|
*/
|
|
232
233
|
const remove = async (args) => {
|
|
233
234
|
await ensureInitialized();
|
|
234
|
-
const mountName = args[
|
|
235
|
-
const filePath = args[
|
|
235
|
+
const mountName = args['mount'];
|
|
236
|
+
const filePath = args['path'];
|
|
236
237
|
// Catch file not found from resolvePath
|
|
237
238
|
let resolvedPath;
|
|
238
239
|
try {
|
|
@@ -264,8 +265,8 @@ export function createFsExtension(config) {
|
|
|
264
265
|
*/
|
|
265
266
|
const stat = async (args) => {
|
|
266
267
|
await ensureInitialized();
|
|
267
|
-
const mountName = args[
|
|
268
|
-
const filePath = args[
|
|
268
|
+
const mountName = args['mount'];
|
|
269
|
+
const filePath = args['path'];
|
|
269
270
|
// Catch file not found from resolvePath
|
|
270
271
|
let resolvedPath;
|
|
271
272
|
try {
|
|
@@ -294,8 +295,8 @@ export function createFsExtension(config) {
|
|
|
294
295
|
*/
|
|
295
296
|
const mkdir = async (args) => {
|
|
296
297
|
await ensureInitialized();
|
|
297
|
-
const mountName = args[
|
|
298
|
-
const dirPath = args[
|
|
298
|
+
const mountName = args['mount'];
|
|
299
|
+
const dirPath = args['path'];
|
|
299
300
|
const mount = mounts[mountName];
|
|
300
301
|
if (!mount || !mount.resolvedPath) {
|
|
301
302
|
throw new RuntimeError('RILL-R004', `mount "${mountName}" not configured`, undefined, { mountName });
|
|
@@ -344,9 +345,9 @@ export function createFsExtension(config) {
|
|
|
344
345
|
*/
|
|
345
346
|
const copy = async (args) => {
|
|
346
347
|
await ensureInitialized();
|
|
347
|
-
const mountName = args[
|
|
348
|
-
const srcPath = args[
|
|
349
|
-
const destPath = args[
|
|
348
|
+
const mountName = args['mount'];
|
|
349
|
+
const srcPath = args['src'];
|
|
350
|
+
const destPath = args['dest'];
|
|
350
351
|
const resolvedSrc = await resolvePath(mountName, srcPath, mounts, 'read');
|
|
351
352
|
const resolvedDest = await resolvePath(mountName, destPath, mounts, 'write', true // createMode
|
|
352
353
|
);
|
|
@@ -373,9 +374,9 @@ export function createFsExtension(config) {
|
|
|
373
374
|
*/
|
|
374
375
|
const move = async (args) => {
|
|
375
376
|
await ensureInitialized();
|
|
376
|
-
const mountName = args[
|
|
377
|
-
const srcPath = args[
|
|
378
|
-
const destPath = args[
|
|
377
|
+
const mountName = args['mount'];
|
|
378
|
+
const srcPath = args['src'];
|
|
379
|
+
const destPath = args['dest'];
|
|
379
380
|
const resolvedSrc = await resolvePath(mountName, srcPath, mounts, 'read');
|
|
380
381
|
const resolvedDest = await resolvePath(mountName, destPath, mounts, 'write', true // createMode
|
|
381
382
|
);
|
|
@@ -412,244 +413,246 @@ export function createFsExtension(config) {
|
|
|
412
413
|
// EXTENSION RESULT
|
|
413
414
|
// ============================================================
|
|
414
415
|
return {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
416
|
+
value: {
|
|
417
|
+
read: toCallable({
|
|
418
|
+
params: [
|
|
419
|
+
{
|
|
420
|
+
name: 'mount',
|
|
421
|
+
type: { kind: 'string' },
|
|
422
|
+
defaultValue: undefined,
|
|
423
|
+
annotations: { description: 'Mount name' },
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: 'path',
|
|
427
|
+
type: { kind: 'string' },
|
|
428
|
+
defaultValue: undefined,
|
|
429
|
+
annotations: { description: 'File path relative to mount' },
|
|
430
|
+
},
|
|
431
|
+
],
|
|
432
|
+
fn: read,
|
|
433
|
+
annotations: { description: 'Read file contents' },
|
|
434
|
+
returnType: rillTypeToTypeValue({ kind: 'string' }),
|
|
435
|
+
}),
|
|
436
|
+
write: toCallable({
|
|
437
|
+
params: [
|
|
438
|
+
{
|
|
439
|
+
name: 'mount',
|
|
440
|
+
type: { kind: 'string' },
|
|
441
|
+
defaultValue: undefined,
|
|
442
|
+
annotations: { description: 'Mount name' },
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
name: 'path',
|
|
446
|
+
type: { kind: 'string' },
|
|
447
|
+
defaultValue: undefined,
|
|
448
|
+
annotations: { description: 'File path relative to mount' },
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
name: 'content',
|
|
452
|
+
type: { kind: 'string' },
|
|
453
|
+
defaultValue: undefined,
|
|
454
|
+
annotations: { description: 'Content to write' },
|
|
455
|
+
},
|
|
456
|
+
],
|
|
457
|
+
fn: write,
|
|
458
|
+
annotations: { description: 'Write file, replacing if exists' },
|
|
459
|
+
returnType: rillTypeToTypeValue({ kind: 'string' }),
|
|
460
|
+
}),
|
|
461
|
+
append: toCallable({
|
|
462
|
+
params: [
|
|
463
|
+
{
|
|
464
|
+
name: 'mount',
|
|
465
|
+
type: { kind: 'string' },
|
|
466
|
+
defaultValue: undefined,
|
|
467
|
+
annotations: { description: 'Mount name' },
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
name: 'path',
|
|
471
|
+
type: { kind: 'string' },
|
|
472
|
+
defaultValue: undefined,
|
|
473
|
+
annotations: { description: 'File path relative to mount' },
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
name: 'content',
|
|
477
|
+
type: { kind: 'string' },
|
|
478
|
+
defaultValue: undefined,
|
|
479
|
+
annotations: { description: 'Content to append' },
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
fn: append,
|
|
483
|
+
annotations: { description: 'Append content to file' },
|
|
484
|
+
returnType: rillTypeToTypeValue({ kind: 'string' }),
|
|
485
|
+
}),
|
|
486
|
+
list: toCallable({
|
|
487
|
+
params: [
|
|
488
|
+
{
|
|
489
|
+
name: 'mount',
|
|
490
|
+
type: { kind: 'string' },
|
|
491
|
+
defaultValue: undefined,
|
|
492
|
+
annotations: { description: 'Mount name' },
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: 'path',
|
|
496
|
+
type: { kind: 'string' },
|
|
497
|
+
defaultValue: '',
|
|
498
|
+
annotations: { description: 'Directory path relative to mount' },
|
|
499
|
+
},
|
|
500
|
+
],
|
|
501
|
+
fn: list,
|
|
502
|
+
annotations: { description: 'List directory contents' },
|
|
503
|
+
returnType: rillTypeToTypeValue({ kind: 'list' }),
|
|
504
|
+
}),
|
|
505
|
+
find: toCallable({
|
|
506
|
+
params: [
|
|
507
|
+
{
|
|
508
|
+
name: 'mount',
|
|
509
|
+
type: { kind: 'string' },
|
|
510
|
+
defaultValue: undefined,
|
|
511
|
+
annotations: { description: 'Mount name' },
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: 'pattern',
|
|
515
|
+
type: { kind: 'string' },
|
|
516
|
+
defaultValue: '*',
|
|
517
|
+
annotations: { description: 'Glob pattern for filtering' },
|
|
518
|
+
},
|
|
519
|
+
],
|
|
520
|
+
fn: find,
|
|
521
|
+
annotations: { description: 'Recursive file search' },
|
|
522
|
+
returnType: rillTypeToTypeValue({ kind: 'list' }),
|
|
523
|
+
}),
|
|
524
|
+
exists: toCallable({
|
|
525
|
+
params: [
|
|
526
|
+
{
|
|
527
|
+
name: 'mount',
|
|
528
|
+
type: { kind: 'string' },
|
|
529
|
+
defaultValue: undefined,
|
|
530
|
+
annotations: { description: 'Mount name' },
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
name: 'path',
|
|
534
|
+
type: { kind: 'string' },
|
|
535
|
+
defaultValue: undefined,
|
|
536
|
+
annotations: { description: 'File path relative to mount' },
|
|
537
|
+
},
|
|
538
|
+
],
|
|
539
|
+
fn: exists,
|
|
540
|
+
annotations: { description: 'Check file existence' },
|
|
541
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
542
|
+
}),
|
|
543
|
+
remove: toCallable({
|
|
544
|
+
params: [
|
|
545
|
+
{
|
|
546
|
+
name: 'mount',
|
|
547
|
+
type: { kind: 'string' },
|
|
548
|
+
defaultValue: undefined,
|
|
549
|
+
annotations: { description: 'Mount name' },
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: 'path',
|
|
553
|
+
type: { kind: 'string' },
|
|
554
|
+
defaultValue: undefined,
|
|
555
|
+
annotations: { description: 'File path relative to mount' },
|
|
556
|
+
},
|
|
557
|
+
],
|
|
558
|
+
fn: remove,
|
|
559
|
+
annotations: { description: 'Delete file' },
|
|
560
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
561
|
+
}),
|
|
562
|
+
stat: toCallable({
|
|
563
|
+
params: [
|
|
564
|
+
{
|
|
565
|
+
name: 'mount',
|
|
566
|
+
type: { kind: 'string' },
|
|
567
|
+
defaultValue: undefined,
|
|
568
|
+
annotations: { description: 'Mount name' },
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
name: 'path',
|
|
572
|
+
type: { kind: 'string' },
|
|
573
|
+
defaultValue: undefined,
|
|
574
|
+
annotations: { description: 'File path relative to mount' },
|
|
575
|
+
},
|
|
576
|
+
],
|
|
577
|
+
fn: stat,
|
|
578
|
+
annotations: { description: 'Get file metadata' },
|
|
579
|
+
returnType: rillTypeToTypeValue({ kind: 'dict' }),
|
|
580
|
+
}),
|
|
581
|
+
mkdir: toCallable({
|
|
582
|
+
params: [
|
|
583
|
+
{
|
|
584
|
+
name: 'mount',
|
|
585
|
+
type: { kind: 'string' },
|
|
586
|
+
defaultValue: undefined,
|
|
587
|
+
annotations: { description: 'Mount name' },
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
name: 'path',
|
|
591
|
+
type: { kind: 'string' },
|
|
592
|
+
defaultValue: undefined,
|
|
593
|
+
annotations: { description: 'Directory path relative to mount' },
|
|
594
|
+
},
|
|
595
|
+
],
|
|
596
|
+
fn: mkdir,
|
|
597
|
+
annotations: { description: 'Create directory' },
|
|
598
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
599
|
+
}),
|
|
600
|
+
copy: toCallable({
|
|
601
|
+
params: [
|
|
602
|
+
{
|
|
603
|
+
name: 'mount',
|
|
604
|
+
type: { kind: 'string' },
|
|
605
|
+
defaultValue: undefined,
|
|
606
|
+
annotations: { description: 'Mount name' },
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: 'src',
|
|
610
|
+
type: { kind: 'string' },
|
|
611
|
+
defaultValue: undefined,
|
|
612
|
+
annotations: { description: 'Source file path' },
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: 'dest',
|
|
616
|
+
type: { kind: 'string' },
|
|
617
|
+
defaultValue: undefined,
|
|
618
|
+
annotations: { description: 'Destination file path' },
|
|
619
|
+
},
|
|
620
|
+
],
|
|
621
|
+
fn: copy,
|
|
622
|
+
annotations: { description: 'Copy file within mount' },
|
|
623
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
624
|
+
}),
|
|
625
|
+
move: toCallable({
|
|
626
|
+
params: [
|
|
627
|
+
{
|
|
628
|
+
name: 'mount',
|
|
629
|
+
type: { kind: 'string' },
|
|
630
|
+
defaultValue: undefined,
|
|
631
|
+
annotations: { description: 'Mount name' },
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
name: 'src',
|
|
635
|
+
type: { kind: 'string' },
|
|
636
|
+
defaultValue: undefined,
|
|
637
|
+
annotations: { description: 'Source file path' },
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
name: 'dest',
|
|
641
|
+
type: { kind: 'string' },
|
|
642
|
+
defaultValue: undefined,
|
|
643
|
+
annotations: { description: 'Destination file path' },
|
|
644
|
+
},
|
|
645
|
+
],
|
|
646
|
+
fn: move,
|
|
647
|
+
annotations: { description: 'Move file within mount' },
|
|
648
|
+
returnType: rillTypeToTypeValue({ kind: 'bool' }),
|
|
649
|
+
}),
|
|
650
|
+
mounts: toCallable({
|
|
651
|
+
params: [],
|
|
652
|
+
fn: mountsList,
|
|
653
|
+
annotations: { description: 'List configured mounts' },
|
|
654
|
+
returnType: rillTypeToTypeValue({ kind: 'list' }),
|
|
655
|
+
}),
|
|
653
656
|
},
|
|
654
657
|
};
|
|
655
658
|
}
|
|
@@ -660,4 +663,3 @@ export const extensionManifest = {
|
|
|
660
663
|
factory: createFsExtension,
|
|
661
664
|
configSchema,
|
|
662
665
|
};
|
|
663
|
-
//# sourceMappingURL=index.js.map
|
package/dist/ext/fs/sandbox.d.ts
CHANGED
|
@@ -75,4 +75,3 @@ export declare function checkMode(mode: 'read' | 'write' | 'read-write', operati
|
|
|
75
75
|
* @throws RuntimeError - If mount path invalid or inaccessible
|
|
76
76
|
*/
|
|
77
77
|
export declare function initializeMount(mount: MountConfig): Promise<void>;
|
|
78
|
-
//# sourceMappingURL=sandbox.d.ts.map
|
package/dist/ext/fs/sandbox.js
CHANGED