@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/fs/sandbox.d.ts
CHANGED
|
@@ -75,3 +75,21 @@ 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
|
+
/**
|
|
79
|
+
* Parses a mount-prefixed path into mount name and relative path.
|
|
80
|
+
*
|
|
81
|
+
* Uses longest-first prefix matching to support mount names containing slashes.
|
|
82
|
+
* Strips a leading `/` before matching.
|
|
83
|
+
* Example: "/workspace/my/file.txt" → { mountName: "workspace", relativePath: "my/file.txt" }
|
|
84
|
+
* Example: "/the/mount/file.txt" → { mountName: "the/mount", relativePath: "file.txt" }
|
|
85
|
+
* Example: "/workspace" → { mountName: "workspace", relativePath: "" }
|
|
86
|
+
*
|
|
87
|
+
* @param fullPath - Path with leading `/` and mount prefix
|
|
88
|
+
* @param mounts - Mount configuration map
|
|
89
|
+
* @returns Parsed mount name and relative path
|
|
90
|
+
* @throws RuntimeError - If no mount matches the path prefix
|
|
91
|
+
*/
|
|
92
|
+
export declare function parseMountPath(fullPath: string, mounts: Record<string, MountConfig>): {
|
|
93
|
+
mountName: string;
|
|
94
|
+
relativePath: string;
|
|
95
|
+
};
|
package/dist/ext/fs/sandbox.js
CHANGED
|
@@ -205,3 +205,36 @@ export async function initializeMount(mount) {
|
|
|
205
205
|
throw error;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
+
// ============================================================
|
|
209
|
+
// MOUNT PATH PARSING
|
|
210
|
+
// ============================================================
|
|
211
|
+
/**
|
|
212
|
+
* Parses a mount-prefixed path into mount name and relative path.
|
|
213
|
+
*
|
|
214
|
+
* Uses longest-first prefix matching to support mount names containing slashes.
|
|
215
|
+
* Strips a leading `/` before matching.
|
|
216
|
+
* Example: "/workspace/my/file.txt" → { mountName: "workspace", relativePath: "my/file.txt" }
|
|
217
|
+
* Example: "/the/mount/file.txt" → { mountName: "the/mount", relativePath: "file.txt" }
|
|
218
|
+
* Example: "/workspace" → { mountName: "workspace", relativePath: "" }
|
|
219
|
+
*
|
|
220
|
+
* @param fullPath - Path with leading `/` and mount prefix
|
|
221
|
+
* @param mounts - Mount configuration map
|
|
222
|
+
* @returns Parsed mount name and relative path
|
|
223
|
+
* @throws RuntimeError - If no mount matches the path prefix
|
|
224
|
+
*/
|
|
225
|
+
export function parseMountPath(fullPath, mounts) {
|
|
226
|
+
const normalized = fullPath.startsWith('/') ? fullPath.slice(1) : fullPath;
|
|
227
|
+
const sortedNames = Object.keys(mounts).sort((a, b) => b.length - a.length);
|
|
228
|
+
for (const mountName of sortedNames) {
|
|
229
|
+
if (normalized === mountName) {
|
|
230
|
+
return { mountName, relativePath: '' };
|
|
231
|
+
}
|
|
232
|
+
if (normalized.startsWith(mountName + '/')) {
|
|
233
|
+
return {
|
|
234
|
+
mountName,
|
|
235
|
+
relativePath: normalized.slice(mountName.length + 1),
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
throw new RuntimeError('RILL-R017', `no mount matches path "${fullPath}"`, undefined, { path: fullPath });
|
|
240
|
+
}
|
package/dist/ext/kv/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides key-value store operations with JSON persistence and schema validation.
|
|
5
5
|
* Supports both open mode (any key/value) and declared mode (schema-defined keys only).
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { ExtensionFactoryResult, ExtensionConfigSchema, ExtensionManifest } from '../../runtime/ext/extensions.js';
|
|
8
8
|
import { type SchemaEntry } from './store.js';
|
|
9
9
|
/** Configuration for a single KV mount */
|
|
10
10
|
export interface KvMountConfig {
|
|
@@ -51,7 +51,7 @@ export declare const configSchema: ExtensionConfigSchema;
|
|
|
51
51
|
* Returns 11 functions: get, get_or, set, merge, delete, keys, has, clear, getAll, schema, mounts.
|
|
52
52
|
*
|
|
53
53
|
* @param config - Store configuration (mount-based or single-store)
|
|
54
|
-
* @returns
|
|
54
|
+
* @returns ExtensionFactoryResult with 11 KV functions and dispose handler
|
|
55
55
|
* @throws RuntimeError if store file is corrupt (EC-25)
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
@@ -78,5 +78,5 @@ export declare const configSchema: ExtensionConfigSchema;
|
|
|
78
78
|
* });
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
export declare function createKvExtension(config: KvConfig):
|
|
81
|
+
export declare function createKvExtension(config: KvConfig): ExtensionFactoryResult;
|
|
82
82
|
export declare const extensionManifest: ExtensionManifest;
|
package/dist/ext/kv/index.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* Supports both open mode (any key/value) and declared mode (schema-defined keys only).
|
|
6
6
|
*/
|
|
7
7
|
import { RuntimeError } from '../../error-classes.js';
|
|
8
|
+
import { toCallable } from '../../runtime/core/callable.js';
|
|
8
9
|
import { isDict } from '../../runtime/core/callable.js';
|
|
9
10
|
import { createStore } from './store.js';
|
|
10
|
-
import {
|
|
11
|
+
import { structureToTypeValue } from '../../runtime/core/values.js';
|
|
11
12
|
export const configSchema = {
|
|
12
13
|
store: { type: 'string' },
|
|
13
14
|
mounts: { type: 'string' },
|
|
@@ -22,7 +23,7 @@ export const configSchema = {
|
|
|
22
23
|
* Returns 11 functions: get, get_or, set, merge, delete, keys, has, clear, getAll, schema, mounts.
|
|
23
24
|
*
|
|
24
25
|
* @param config - Store configuration (mount-based or single-store)
|
|
25
|
-
* @returns
|
|
26
|
+
* @returns ExtensionFactoryResult with 11 KV functions and dispose handler
|
|
26
27
|
* @throws RuntimeError if store file is corrupt (EC-25)
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
@@ -279,204 +280,205 @@ export function createKvExtension(config) {
|
|
|
279
280
|
// ============================================================
|
|
280
281
|
// EXTENSION RESULT
|
|
281
282
|
// ============================================================
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
283
|
+
return {
|
|
284
|
+
value: {
|
|
285
|
+
get: toCallable({
|
|
286
|
+
params: [
|
|
287
|
+
{
|
|
288
|
+
name: 'mount',
|
|
289
|
+
type: { kind: 'string' },
|
|
290
|
+
defaultValue: undefined,
|
|
291
|
+
annotations: { description: 'Mount name' },
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'key',
|
|
295
|
+
type: { kind: 'string' },
|
|
296
|
+
defaultValue: undefined,
|
|
297
|
+
annotations: { description: 'Key to retrieve' },
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
fn: get,
|
|
301
|
+
annotations: { description: 'Get value or schema default' },
|
|
302
|
+
returnType: structureToTypeValue({ kind: 'any' }),
|
|
303
|
+
}),
|
|
304
|
+
get_or: toCallable({
|
|
305
|
+
params: [
|
|
306
|
+
{
|
|
307
|
+
name: 'mount',
|
|
308
|
+
type: { kind: 'string' },
|
|
309
|
+
defaultValue: undefined,
|
|
310
|
+
annotations: { description: 'Mount name' },
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: 'key',
|
|
314
|
+
type: { kind: 'string' },
|
|
315
|
+
defaultValue: undefined,
|
|
316
|
+
annotations: { description: 'Key to retrieve' },
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: 'fallback',
|
|
320
|
+
type: { kind: 'any' },
|
|
321
|
+
defaultValue: undefined,
|
|
322
|
+
annotations: { description: 'Fallback value if key missing' },
|
|
323
|
+
},
|
|
324
|
+
],
|
|
325
|
+
fn: get_or,
|
|
326
|
+
annotations: {
|
|
327
|
+
description: 'Get value or return fallback if key missing',
|
|
290
328
|
},
|
|
291
|
-
{
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
329
|
+
returnType: structureToTypeValue({ kind: 'any' }),
|
|
330
|
+
}),
|
|
331
|
+
set: toCallable({
|
|
332
|
+
params: [
|
|
333
|
+
{
|
|
334
|
+
name: 'mount',
|
|
335
|
+
type: { kind: 'string' },
|
|
336
|
+
defaultValue: undefined,
|
|
337
|
+
annotations: { description: 'Mount name' },
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: 'key',
|
|
341
|
+
type: { kind: 'string' },
|
|
342
|
+
defaultValue: undefined,
|
|
343
|
+
annotations: { description: 'Key to set' },
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: 'value',
|
|
347
|
+
type: { kind: 'any' },
|
|
348
|
+
defaultValue: undefined,
|
|
349
|
+
annotations: { description: 'Value to store' },
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
fn: set,
|
|
353
|
+
annotations: { description: 'Set value with validation' },
|
|
354
|
+
returnType: structureToTypeValue({ kind: 'bool' }),
|
|
355
|
+
}),
|
|
356
|
+
merge: toCallable({
|
|
357
|
+
params: [
|
|
358
|
+
{
|
|
359
|
+
name: 'mount',
|
|
360
|
+
type: { kind: 'string' },
|
|
361
|
+
defaultValue: undefined,
|
|
362
|
+
annotations: { description: 'Mount name' },
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: 'key',
|
|
366
|
+
type: { kind: 'string' },
|
|
367
|
+
defaultValue: undefined,
|
|
368
|
+
annotations: { description: 'Key to merge into' },
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
name: 'partial',
|
|
372
|
+
type: { kind: 'dict' },
|
|
373
|
+
defaultValue: undefined,
|
|
374
|
+
annotations: { description: 'Partial dict to merge' },
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
fn: merge,
|
|
378
|
+
annotations: {
|
|
379
|
+
description: 'Merge partial dict into existing dict value',
|
|
296
380
|
},
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
],
|
|
396
|
-
fn: deleteKey,
|
|
397
|
-
annotations: { description: 'Delete key' },
|
|
398
|
-
returnType: rillTypeToTypeValue({ type: 'bool' }),
|
|
399
|
-
},
|
|
400
|
-
keys: {
|
|
401
|
-
params: [
|
|
402
|
-
{
|
|
403
|
-
name: 'mount',
|
|
404
|
-
type: { type: 'string' },
|
|
405
|
-
defaultValue: undefined,
|
|
406
|
-
annotations: { description: 'Mount name' },
|
|
407
|
-
},
|
|
408
|
-
],
|
|
409
|
-
fn: keys,
|
|
410
|
-
annotations: { description: 'Get all keys in mount' },
|
|
411
|
-
returnType: rillTypeToTypeValue({ type: 'list' }),
|
|
412
|
-
},
|
|
413
|
-
has: {
|
|
414
|
-
params: [
|
|
415
|
-
{
|
|
416
|
-
name: 'mount',
|
|
417
|
-
type: { type: 'string' },
|
|
418
|
-
defaultValue: undefined,
|
|
419
|
-
annotations: { description: 'Mount name' },
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
name: 'key',
|
|
423
|
-
type: { type: 'string' },
|
|
424
|
-
defaultValue: undefined,
|
|
425
|
-
annotations: { description: 'Key to check' },
|
|
426
|
-
},
|
|
427
|
-
],
|
|
428
|
-
fn: has,
|
|
429
|
-
annotations: { description: 'Check key existence' },
|
|
430
|
-
returnType: rillTypeToTypeValue({ type: 'bool' }),
|
|
431
|
-
},
|
|
432
|
-
clear: {
|
|
433
|
-
params: [
|
|
434
|
-
{
|
|
435
|
-
name: 'mount',
|
|
436
|
-
type: { type: 'string' },
|
|
437
|
-
defaultValue: undefined,
|
|
438
|
-
annotations: { description: 'Mount name' },
|
|
439
|
-
},
|
|
440
|
-
],
|
|
441
|
-
fn: clear,
|
|
442
|
-
annotations: { description: 'Clear all keys in mount' },
|
|
443
|
-
returnType: rillTypeToTypeValue({ type: 'bool' }),
|
|
444
|
-
},
|
|
445
|
-
getAll: {
|
|
446
|
-
params: [
|
|
447
|
-
{
|
|
448
|
-
name: 'mount',
|
|
449
|
-
type: { type: 'string' },
|
|
450
|
-
defaultValue: undefined,
|
|
451
|
-
annotations: { description: 'Mount name' },
|
|
452
|
-
},
|
|
453
|
-
],
|
|
454
|
-
fn: getAll,
|
|
455
|
-
annotations: { description: 'Get all entries as dict' },
|
|
456
|
-
returnType: rillTypeToTypeValue({ type: 'dict' }),
|
|
457
|
-
},
|
|
458
|
-
schema: {
|
|
459
|
-
params: [
|
|
460
|
-
{
|
|
461
|
-
name: 'mount',
|
|
462
|
-
type: { type: 'string' },
|
|
463
|
-
defaultValue: undefined,
|
|
464
|
-
annotations: { description: 'Mount name' },
|
|
465
|
-
},
|
|
466
|
-
],
|
|
467
|
-
fn: schema,
|
|
468
|
-
annotations: { description: 'Get schema information' },
|
|
469
|
-
returnType: rillTypeToTypeValue({ type: 'list' }),
|
|
470
|
-
},
|
|
471
|
-
mounts: {
|
|
472
|
-
params: [],
|
|
473
|
-
fn: mountsList,
|
|
474
|
-
annotations: { description: 'Get list of mount metadata' },
|
|
475
|
-
returnType: rillTypeToTypeValue({ type: 'list' }),
|
|
381
|
+
returnType: structureToTypeValue({ kind: 'bool' }),
|
|
382
|
+
}),
|
|
383
|
+
delete: toCallable({
|
|
384
|
+
params: [
|
|
385
|
+
{
|
|
386
|
+
name: 'mount',
|
|
387
|
+
type: { kind: 'string' },
|
|
388
|
+
defaultValue: undefined,
|
|
389
|
+
annotations: { description: 'Mount name' },
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: 'key',
|
|
393
|
+
type: { kind: 'string' },
|
|
394
|
+
defaultValue: undefined,
|
|
395
|
+
annotations: { description: 'Key to delete' },
|
|
396
|
+
},
|
|
397
|
+
],
|
|
398
|
+
fn: deleteKey,
|
|
399
|
+
annotations: { description: 'Delete key' },
|
|
400
|
+
returnType: structureToTypeValue({ kind: 'bool' }),
|
|
401
|
+
}),
|
|
402
|
+
keys: toCallable({
|
|
403
|
+
params: [
|
|
404
|
+
{
|
|
405
|
+
name: 'mount',
|
|
406
|
+
type: { kind: 'string' },
|
|
407
|
+
defaultValue: undefined,
|
|
408
|
+
annotations: { description: 'Mount name' },
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
fn: keys,
|
|
412
|
+
annotations: { description: 'Get all keys in mount' },
|
|
413
|
+
returnType: structureToTypeValue({ kind: 'list' }),
|
|
414
|
+
}),
|
|
415
|
+
has: toCallable({
|
|
416
|
+
params: [
|
|
417
|
+
{
|
|
418
|
+
name: 'mount',
|
|
419
|
+
type: { kind: 'string' },
|
|
420
|
+
defaultValue: undefined,
|
|
421
|
+
annotations: { description: 'Mount name' },
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: 'key',
|
|
425
|
+
type: { kind: 'string' },
|
|
426
|
+
defaultValue: undefined,
|
|
427
|
+
annotations: { description: 'Key to check' },
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
fn: has,
|
|
431
|
+
annotations: { description: 'Check key existence' },
|
|
432
|
+
returnType: structureToTypeValue({ kind: 'bool' }),
|
|
433
|
+
}),
|
|
434
|
+
clear: toCallable({
|
|
435
|
+
params: [
|
|
436
|
+
{
|
|
437
|
+
name: 'mount',
|
|
438
|
+
type: { kind: 'string' },
|
|
439
|
+
defaultValue: undefined,
|
|
440
|
+
annotations: { description: 'Mount name' },
|
|
441
|
+
},
|
|
442
|
+
],
|
|
443
|
+
fn: clear,
|
|
444
|
+
annotations: { description: 'Clear all keys in mount' },
|
|
445
|
+
returnType: structureToTypeValue({ kind: 'bool' }),
|
|
446
|
+
}),
|
|
447
|
+
getAll: toCallable({
|
|
448
|
+
params: [
|
|
449
|
+
{
|
|
450
|
+
name: 'mount',
|
|
451
|
+
type: { kind: 'string' },
|
|
452
|
+
defaultValue: undefined,
|
|
453
|
+
annotations: { description: 'Mount name' },
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
fn: getAll,
|
|
457
|
+
annotations: { description: 'Get all entries as dict' },
|
|
458
|
+
returnType: structureToTypeValue({ kind: 'dict' }),
|
|
459
|
+
}),
|
|
460
|
+
schema: toCallable({
|
|
461
|
+
params: [
|
|
462
|
+
{
|
|
463
|
+
name: 'mount',
|
|
464
|
+
type: { kind: 'string' },
|
|
465
|
+
defaultValue: undefined,
|
|
466
|
+
annotations: { description: 'Mount name' },
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
fn: schema,
|
|
470
|
+
annotations: { description: 'Get schema information' },
|
|
471
|
+
returnType: structureToTypeValue({ kind: 'list' }),
|
|
472
|
+
}),
|
|
473
|
+
mounts: toCallable({
|
|
474
|
+
params: [],
|
|
475
|
+
fn: mountsList,
|
|
476
|
+
annotations: { description: 'Get list of mount metadata' },
|
|
477
|
+
returnType: structureToTypeValue({ kind: 'list' }),
|
|
478
|
+
}),
|
|
476
479
|
},
|
|
480
|
+
dispose,
|
|
477
481
|
};
|
|
478
|
-
result.dispose = dispose;
|
|
479
|
-
return result;
|
|
480
482
|
}
|
|
481
483
|
// ============================================================
|
|
482
484
|
// MANIFEST
|
package/dist/ext/kv/store.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides JSON-based key-value persistence with schema validation.
|
|
5
5
|
* Lifecycle: Load (read store file) -> Execute (in-memory operations) -> Flush (atomic write on dispose)
|
|
6
6
|
*/
|
|
7
|
-
import type { RillValue } from '../../runtime/core/
|
|
7
|
+
import type { RillValue } from '../../runtime/core/types/structures.js';
|
|
8
8
|
/** Schema entry defining type and default for a key */
|
|
9
9
|
export interface SchemaEntry {
|
|
10
10
|
type: 'string' | 'number' | 'bool' | 'list' | 'dict';
|
package/dist/ext/kv/store.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 { deserializeValue } from '../../runtime/core/types/registrations.js';
|
|
10
11
|
// ============================================================
|
|
11
12
|
// STORE IMPLEMENTATION
|
|
12
13
|
// ============================================================
|
|
@@ -52,7 +53,7 @@ export async function createStore(config) {
|
|
|
52
53
|
// Load declared keys with defaults, validate existing values
|
|
53
54
|
for (const [key, schemaEntry] of Object.entries(schema)) {
|
|
54
55
|
if (key in parsed) {
|
|
55
|
-
const value = parsed[key];
|
|
56
|
+
const value = deserializeValue(parsed[key], schemaEntry.type);
|
|
56
57
|
validateType(key, value, schemaEntry.type, storePath);
|
|
57
58
|
data.set(key, value);
|
|
58
59
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge for runtime/ext modules that need parse().
|
|
3
|
+
*
|
|
4
|
+
* Import boundary note (§NOD.2.1):
|
|
5
|
+
* - This file lives at src/ level (not in runtime/), so it may import
|
|
6
|
+
* from the parser barrel.
|
|
7
|
+
* - runtime/ext/test-context.ts imports from this file
|
|
8
|
+
* (../../ext-parse-bridge.js), which is NOT in parser/* — boundary preserved.
|
|
9
|
+
*/
|
|
10
|
+
export { parse as parseSource } from './parser/index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge for runtime/ext modules that need parse().
|
|
3
|
+
*
|
|
4
|
+
* Import boundary note (§NOD.2.1):
|
|
5
|
+
* - This file lives at src/ level (not in runtime/), so it may import
|
|
6
|
+
* from the parser barrel.
|
|
7
|
+
* - runtime/ext/test-context.ts imports from this file
|
|
8
|
+
* (../../ext-parse-bridge.js), which is NOT in parser/* — boundary preserved.
|
|
9
|
+
*/
|
|
10
|
+
export { parse as parseSource } from './parser/index.js';
|