@inventarch/runtime 1.1.1 → 2.0.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/LANGUAGE.md +2 -2
- package/README.md +17 -1
- package/SPEC.md +28 -4
- package/dist/context.d.ts +10 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +14 -5
- package/dist/context.js.map +1 -1
- package/dist/coordinate.d.ts +9 -2
- package/dist/coordinate.d.ts.map +1 -1
- package/dist/coordinate.js +14 -0
- package/dist/coordinate.js.map +1 -1
- package/dist/door.d.ts +17 -0
- package/dist/door.d.ts.map +1 -1
- package/dist/door.js +111 -6
- package/dist/door.js.map +1 -1
- package/dist/editor/workspace.d.ts.map +1 -1
- package/dist/editor/workspace.js +6 -5
- package/dist/editor/workspace.js.map +1 -1
- package/dist/errors.d.ts +4 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +13 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/locator.d.ts +149 -0
- package/dist/locator.d.ts.map +1 -0
- package/dist/locator.js +572 -0
- package/dist/locator.js.map +1 -0
- package/dist/machine-protocol.d.ts +5 -0
- package/dist/machine-protocol.d.ts.map +1 -1
- package/dist/machine-protocol.js +141 -5
- package/dist/machine-protocol.js.map +1 -1
- package/dist/mandate-modes.d.ts +60 -0
- package/dist/mandate-modes.d.ts.map +1 -0
- package/dist/mandate-modes.js +112 -0
- package/dist/mandate-modes.js.map +1 -0
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +2 -3
- package/dist/mentions.js.map +1 -1
- package/dist/next.d.ts +151 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +724 -0
- package/dist/next.js.map +1 -0
- package/dist/packet-host.d.ts +88 -0
- package/dist/packet-host.d.ts.map +1 -0
- package/dist/packet-host.js +239 -0
- package/dist/packet-host.js.map +1 -0
- package/dist/packet.d.ts +157 -0
- package/dist/packet.d.ts.map +1 -0
- package/dist/packet.js +207 -0
- package/dist/packet.js.map +1 -0
- package/dist/position.d.ts +275 -0
- package/dist/position.d.ts.map +1 -0
- package/dist/position.js +530 -0
- package/dist/position.js.map +1 -0
- package/dist/render.d.ts +12 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +25 -0
- package/dist/render.js.map +1 -1
- package/dist/scope-key.d.ts +101 -0
- package/dist/scope-key.d.ts.map +1 -0
- package/dist/scope-key.js +175 -0
- package/dist/scope-key.js.map +1 -0
- package/package.json +32 -4
package/dist/render.js
CHANGED
|
@@ -27,6 +27,18 @@ function childrenText(children) {
|
|
|
27
27
|
})
|
|
28
28
|
.join('\n');
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The text the record states unconditionally at `field`, a `section.key` path: a text, string or scalar value. Undefined
|
|
32
|
+
* when the record does not state it, states it only under a condition, or states a value that is not text.
|
|
33
|
+
*/
|
|
34
|
+
export function statedText(node, field) {
|
|
35
|
+
const [section, key] = field.split('.');
|
|
36
|
+
const stated = node.sections
|
|
37
|
+
.filter((s) => s.name === section)
|
|
38
|
+
.flatMap((s) => s.fields)
|
|
39
|
+
.find((f) => 'key' in f && f.key === key && f.when === undefined && 'text' in f.value);
|
|
40
|
+
return stated === undefined || !('text' in stated.value) ? undefined : stated.value.text;
|
|
41
|
+
}
|
|
30
42
|
/** The record's `says` and `answers`, rendered as recordText renders its meaning, or undefined when it has neither. */
|
|
31
43
|
export function purposeOf(node) {
|
|
32
44
|
const fields = node.sections
|
|
@@ -35,6 +47,19 @@ export function purposeOf(node) {
|
|
|
35
47
|
.filter((f) => 'key' in f && (f.key === 'says' || f.key === 'answers'));
|
|
36
48
|
return fields.length === 0 ? undefined : childrenText(fields);
|
|
37
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* The record's own body (`ia read`, position-and-projection row 23): the part of what recordText renders that the record
|
|
52
|
+
* states rather than structures, its `meaning.says`. A `@system`, which has no meaning section, states its head
|
|
53
|
+
* `describes`; a record that states neither (a `@schema`) has an empty body.
|
|
54
|
+
*/
|
|
55
|
+
export function bodyOf(node) {
|
|
56
|
+
const says = node.sections
|
|
57
|
+
.filter((s) => s.name === 'meaning')
|
|
58
|
+
.flatMap((s) => s.fields)
|
|
59
|
+
.filter((f) => 'key' in f && f.key === 'says');
|
|
60
|
+
const stated = says.length > 0 ? says : node.head.filter((f) => f.key === 'describes');
|
|
61
|
+
return stated.map((f) => valueText(f.value)).join('\n');
|
|
62
|
+
}
|
|
38
63
|
export function clausesOf(node, selected) {
|
|
39
64
|
return [...selected.values()].map((variant) => {
|
|
40
65
|
const field = node.sections
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,MAAM,UAAU,SAAS,CAAC,KAAoB;IAC5C,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,IAAI,CAAC;QACpB,KAAK,KAAK;YACR,OAAO,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC5G,KAAK,MAAM;YACT,OAAO,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QAC3D,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,EA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,EAAE;QAC5C,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;QACvB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;QAChH,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5C,GAAG,IAAI,CAAC,YAAY;aACjB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;aACvE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;KACpC;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Phase } from '@inventarch/language';
|
|
2
|
+
import type { ReadHandle, SeatResolution } from '@inventarch/db';
|
|
3
|
+
import type { Shape } from './classify.js';
|
|
4
|
+
import type { PreparedCoordinate } from './coordinate.js';
|
|
5
|
+
/**
|
|
6
|
+
* The scope key K = (S, H, P, d, n, w) (position-and-projection §1, design item 10; decision scope-key-caps).
|
|
7
|
+
*
|
|
8
|
+
* A key names where a reader sits (the seat), what it intends (the shape), the phase it works in, how many rows a body
|
|
9
|
+
* may hop (depth) and how many entries it may load (budget), optionally restricted to one word. This module holds the
|
|
10
|
+
* caps, the defaults and K0, completes a partial key, validates a key against a scoped read, resolves its seat and
|
|
11
|
+
* derives its coordinate. `positionBody` (src/position.ts, R15) assembles the body a resolved key gives, and `position`
|
|
12
|
+
* (R16) adds its digest and host note, which the Door's `position` operation (MACHINE_PROTOCOL version 2) serves; no
|
|
13
|
+
* version 1 Door route reads a key. Each key refusal names the one command to run as its `next` (design row 27).
|
|
14
|
+
*/
|
|
15
|
+
/** Decision scope-key-caps: depth in 0..2 hops, budget in 0..64 entries. */
|
|
16
|
+
export declare const SCOPE_KEY_CAPS: Readonly<{
|
|
17
|
+
readonly depth: 2;
|
|
18
|
+
readonly budget: 64;
|
|
19
|
+
}>;
|
|
20
|
+
export interface ScopeKey {
|
|
21
|
+
/**
|
|
22
|
+
* S, the key's seat: what the caller names (R14). Absent, the repository's `@workspace` (K0's seat): the seat the
|
|
23
|
+
* database resolves for the repository root `''`. A string, the identity of an admitted record in the read's scope.
|
|
24
|
+
* `{path}`, a location: a workspace-relative path, or an absolute path inside the workspace root, which reads as the
|
|
25
|
+
* root-relative path it names.
|
|
26
|
+
*/
|
|
27
|
+
readonly seat?: string | {
|
|
28
|
+
readonly path: string;
|
|
29
|
+
};
|
|
30
|
+
/** H: one of the five intent shapes. */
|
|
31
|
+
readonly shape: Shape;
|
|
32
|
+
/** P: one of the four phases. */
|
|
33
|
+
readonly phase: Phase;
|
|
34
|
+
/** d: rows a body may hop along the shape's predicate focus, 0..2. */
|
|
35
|
+
readonly depth: number;
|
|
36
|
+
/** n: entries a body may load beyond the seat, 0..64; blockers are reserved outside it, and 0 loads none. */
|
|
37
|
+
readonly budget: number;
|
|
38
|
+
/** w: a word registered in the closure, restricting seeds and tallies inside the body; absent for none. */
|
|
39
|
+
readonly word?: string;
|
|
40
|
+
}
|
|
41
|
+
/** K0 = (the repository's `@workspace`, context, orient, 0, 0, no word): a pointers-only first position. */
|
|
42
|
+
export declare const K0: ScopeKey;
|
|
43
|
+
/**
|
|
44
|
+
* The resolved seat (R14): what the key's seat names once read through the scope. It is distinct from the database's
|
|
45
|
+
* `SeatResolution.seat`, the record a path is declared at: a workspace seat's identity is that record for `''`, while a
|
|
46
|
+
* location keeps it in `ResolvedScopeKey.resolution`, never as its own identity.
|
|
47
|
+
*/
|
|
48
|
+
export interface ResolvedSeat {
|
|
49
|
+
/** `workspace` when the key names no seat, `record` when it names an identity, `location` when it names a path. */
|
|
50
|
+
readonly kind: 'workspace' | 'record' | 'location';
|
|
51
|
+
/** The record seated at: the repository's `@workspace`, or the named record. A location is not a record. */
|
|
52
|
+
readonly identity?: string;
|
|
53
|
+
/** A location's canonical workspace-relative path. */
|
|
54
|
+
readonly path?: string;
|
|
55
|
+
/**
|
|
56
|
+
* `undeclared` exactly when no admitted record in the scope is declared at a workspace or location seat (the
|
|
57
|
+
* database resolution's `unknown`); a workspace seat then has no identity.
|
|
58
|
+
*/
|
|
59
|
+
readonly unknown?: 'undeclared';
|
|
60
|
+
}
|
|
61
|
+
export interface ResolvedScopeKey {
|
|
62
|
+
/** A frozen copy of the validated key, its parts in K order and a location as its canonical path. */
|
|
63
|
+
readonly key: ScopeKey;
|
|
64
|
+
readonly seat: ResolvedSeat;
|
|
65
|
+
/**
|
|
66
|
+
* For a workspace or location seat, the database's resolution of the repository root `''` or of the path (db D02b):
|
|
67
|
+
* the record declared at it (`seat`), the rule `by` that declares it and the path's claimants.
|
|
68
|
+
*/
|
|
69
|
+
readonly resolution?: SeatResolution;
|
|
70
|
+
/** The key's coordinate: shape and phase declared, category and primitive derived from SHAPE_ROWS[shape]. */
|
|
71
|
+
readonly coordinate: PreparedCoordinate;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* R14: complete a partial key with the defaults of design §1, so every host applies the same ones. A partial naming
|
|
75
|
+
* no part is K0. Otherwise `shape` defaults to context, `phase` to the anchor phase of the shape's primitive
|
|
76
|
+
* (PRIMITIVE_ANCHORS[SHAPE_ROWS[shape].primitive]), `depth` to 1 and `budget` to 16, and a seat or word stays absent
|
|
77
|
+
* unless named; a part whose value is `undefined` is not named. The result is checked as resolveScopeKey checks a
|
|
78
|
+
* key's form, so its refusals are the same IA-RUNTIME-REQUEST-INVALID ones; nothing is read, so the word and the seat
|
|
79
|
+
* are checked only when the key is resolved.
|
|
80
|
+
*/
|
|
81
|
+
export declare function normalizeScopeKey(partial?: Partial<ScopeKey>): ScopeKey;
|
|
82
|
+
/**
|
|
83
|
+
* R14: the one absolute-path rule, which a location seat and `ia read`'s `<path>:<line>` locator share. An absolute
|
|
84
|
+
* `path` reads as the path Node's `path.relative` gives from `root` (on Windows without case, with either separator),
|
|
85
|
+
* `/`-separated, and the root itself, however it is spelled, as `''`. It names no path inside the root, so the result
|
|
86
|
+
* is undefined, when that path's first segment is `..` (the check is segment by segment, so an in-root name that only
|
|
87
|
+
* begins with `..`, such as `..cache`, is inside) or when it is on another drive, which has no path from the root. A
|
|
88
|
+
* relative `path` is returned as given: the database canonicalises it segment by segment and names one that escapes the
|
|
89
|
+
* root `outside` (db D02b).
|
|
90
|
+
*/
|
|
91
|
+
export declare function rootRelative(root: string, path: string): string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* R14: validate `key` against the read `within` names and resolve its seat. Every key-validation refusal is
|
|
94
|
+
* IA-RUNTIME-REQUEST-INVALID naming the bound it breaks, and its `next` the one command to run. The parts, closed sets,
|
|
95
|
+
* caps and seat form are checked before any read, so a key malformed in them is refused whatever the token; the word
|
|
96
|
+
* and the seat are then read through the token, and database token failures keep their codes. A path outside the
|
|
97
|
+
* workspace root or escaping it is refused, but a seat inside it that no record declares is not: the seat names the
|
|
98
|
+
* unknown, so K0 stays computable in a repository whose own `@workspace` is undecided.
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveScopeKey(handle: ReadHandle, within: string, key: ScopeKey): ResolvedScopeKey;
|
|
101
|
+
//# sourceMappingURL=scope-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-key.d.ts","sourceRoot":"","sources":["../src/scope-key.ts"],"names":[],"mappings":"AAEA,OAAO,KAA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AAC,IAAI,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IACrC,6GAA6G;IAC7G,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;CACzC;AAyED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,OAAO,CAAC,QAAQ,CAAM,GAAG,QAAQ,CAY3E;AACD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK3E;AACD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,gBAAgB,CA4CnG"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { isAbsolute, relative, sep } from 'node:path';
|
|
2
|
+
import { PHASES, PRIMITIVE_ANCHORS, SHAPE_ROWS, SHAPES, isPhase } from '@inventarch/language';
|
|
3
|
+
import { scopeCoordinate } from './coordinate.js';
|
|
4
|
+
import { RuntimeError } from './errors.js';
|
|
5
|
+
import { freeze } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* The scope key K = (S, H, P, d, n, w) (position-and-projection §1, design item 10; decision scope-key-caps).
|
|
8
|
+
*
|
|
9
|
+
* A key names where a reader sits (the seat), what it intends (the shape), the phase it works in, how many rows a body
|
|
10
|
+
* may hop (depth) and how many entries it may load (budget), optionally restricted to one word. This module holds the
|
|
11
|
+
* caps, the defaults and K0, completes a partial key, validates a key against a scoped read, resolves its seat and
|
|
12
|
+
* derives its coordinate. `positionBody` (src/position.ts, R15) assembles the body a resolved key gives, and `position`
|
|
13
|
+
* (R16) adds its digest and host note, which the Door's `position` operation (MACHINE_PROTOCOL version 2) serves; no
|
|
14
|
+
* version 1 Door route reads a key. Each key refusal names the one command to run as its `next` (design row 27).
|
|
15
|
+
*/
|
|
16
|
+
/** Decision scope-key-caps: depth in 0..2 hops, budget in 0..64 entries. */
|
|
17
|
+
export const SCOPE_KEY_CAPS = Object.freeze({ depth: 2, budget: 64 });
|
|
18
|
+
/** Design §1 and open decision 6: the depth and budget of a key that names any part; K0 alone takes 0 and 0. */
|
|
19
|
+
const DEFAULTS = { depth: 1, budget: 16 };
|
|
20
|
+
/** K0 = (the repository's `@workspace`, context, orient, 0, 0, no word): a pointers-only first position. */
|
|
21
|
+
export const K0 = Object.freeze({ shape: 'context', phase: 'orient', depth: 0, budget: 0 });
|
|
22
|
+
const PARTS = ['seat', 'shape', 'phase', 'depth', 'budget', 'word'];
|
|
23
|
+
/**
|
|
24
|
+
* Design row 27 and §11: the one command each key refusal names, its closed set printed or its cap given. A key that is
|
|
25
|
+
* no key and a seat the scope does not hold name the position without one, K0, which every scope can compute, and a
|
|
26
|
+
* word the closure does not register names the vocabulary.
|
|
27
|
+
*/
|
|
28
|
+
const NEXT = {
|
|
29
|
+
key: 'ia position',
|
|
30
|
+
seat: 'ia position',
|
|
31
|
+
shape: `ia position --shape <${SHAPES.join('|')}>`,
|
|
32
|
+
phase: `ia position --phase <${PHASES.join('|')}>`,
|
|
33
|
+
depth: `ia position --depth ${SCOPE_KEY_CAPS.depth}`,
|
|
34
|
+
budget: `ia position --budget ${SCOPE_KEY_CAPS.budget}`,
|
|
35
|
+
word: 'ia vocabulary',
|
|
36
|
+
};
|
|
37
|
+
function invalid(message, next) {
|
|
38
|
+
throw new RuntimeError('IA-RUNTIME-REQUEST-INVALID', message, next);
|
|
39
|
+
}
|
|
40
|
+
function capped(value, part) {
|
|
41
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > SCOPE_KEY_CAPS[part])
|
|
42
|
+
invalid(`Scope key ${part} must be an integer in 0..${SCOPE_KEY_CAPS[part]}`, NEXT[part]);
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
function shapeOf(value) {
|
|
46
|
+
if (!SHAPES.includes(value))
|
|
47
|
+
invalid(`Scope key shape must be one of ${SHAPES.join(', ')}`, NEXT.shape);
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
/** An object whose own parts are all key parts. */
|
|
51
|
+
function parted(key) {
|
|
52
|
+
if (key === null || typeof key !== 'object' || Array.isArray(key))
|
|
53
|
+
invalid('A scope key must be an object', NEXT.key);
|
|
54
|
+
for (const part of Object.keys(key))
|
|
55
|
+
if (!PARTS.includes(part))
|
|
56
|
+
invalid(`Unknown scope key part '${part}'; admitted: ${PARTS.join(', ')}`, NEXT.key);
|
|
57
|
+
return key;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* R14: the key's form, checked without a read: its parts, the closed shape and phase sets, both caps, the seat's form
|
|
61
|
+
* and the word's type. Returns a frozen copy, its parts in K order.
|
|
62
|
+
*/
|
|
63
|
+
function formed(supplied) {
|
|
64
|
+
const key = parted(supplied), { seat, phase, word } = key, shape = shapeOf(key.shape);
|
|
65
|
+
if (typeof phase !== 'string' || !isPhase(phase))
|
|
66
|
+
invalid(`Scope key phase must be one of ${PHASES.join(', ')}`, NEXT.phase);
|
|
67
|
+
const depth = capped(key.depth, 'depth'), budget = capped(key.budget, 'budget');
|
|
68
|
+
if (word !== undefined && typeof word !== 'string')
|
|
69
|
+
invalid('Scope key word must be a string', NEXT.word);
|
|
70
|
+
if (seat !== undefined &&
|
|
71
|
+
typeof seat !== 'string' &&
|
|
72
|
+
(seat === null ||
|
|
73
|
+
typeof seat !== 'object' ||
|
|
74
|
+
Array.isArray(seat) ||
|
|
75
|
+
Object.keys(seat).join() !== 'path' ||
|
|
76
|
+
typeof seat.path !== 'string'))
|
|
77
|
+
invalid('Scope key seat must be a record identity or {path}', NEXT.seat);
|
|
78
|
+
return freeze({
|
|
79
|
+
...(seat === undefined
|
|
80
|
+
? {}
|
|
81
|
+
: { seat: typeof seat === 'string' ? seat : { path: seat.path } }),
|
|
82
|
+
shape,
|
|
83
|
+
phase,
|
|
84
|
+
depth,
|
|
85
|
+
budget,
|
|
86
|
+
...(word === undefined ? {} : { word: word }),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* R14: complete a partial key with the defaults of design §1, so every host applies the same ones. A partial naming
|
|
91
|
+
* no part is K0. Otherwise `shape` defaults to context, `phase` to the anchor phase of the shape's primitive
|
|
92
|
+
* (PRIMITIVE_ANCHORS[SHAPE_ROWS[shape].primitive]), `depth` to 1 and `budget` to 16, and a seat or word stays absent
|
|
93
|
+
* unless named; a part whose value is `undefined` is not named. The result is checked as resolveScopeKey checks a
|
|
94
|
+
* key's form, so its refusals are the same IA-RUNTIME-REQUEST-INVALID ones; nothing is read, so the word and the seat
|
|
95
|
+
* are checked only when the key is resolved.
|
|
96
|
+
*/
|
|
97
|
+
export function normalizeScopeKey(partial = {}) {
|
|
98
|
+
const key = parted(partial), named = (part) => key[part] !== undefined;
|
|
99
|
+
if (!PARTS.some(named))
|
|
100
|
+
return K0;
|
|
101
|
+
const shape = named('shape') ? shapeOf(key.shape) : 'context';
|
|
102
|
+
return formed({
|
|
103
|
+
...key,
|
|
104
|
+
shape,
|
|
105
|
+
phase: named('phase') ? key.phase : PRIMITIVE_ANCHORS[SHAPE_ROWS[shape].primitive],
|
|
106
|
+
depth: named('depth') ? key.depth : DEFAULTS.depth,
|
|
107
|
+
budget: named('budget') ? key.budget : DEFAULTS.budget,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* R14: the one absolute-path rule, which a location seat and `ia read`'s `<path>:<line>` locator share. An absolute
|
|
112
|
+
* `path` reads as the path Node's `path.relative` gives from `root` (on Windows without case, with either separator),
|
|
113
|
+
* `/`-separated, and the root itself, however it is spelled, as `''`. It names no path inside the root, so the result
|
|
114
|
+
* is undefined, when that path's first segment is `..` (the check is segment by segment, so an in-root name that only
|
|
115
|
+
* begins with `..`, such as `..cache`, is inside) or when it is on another drive, which has no path from the root. A
|
|
116
|
+
* relative `path` is returned as given: the database canonicalises it segment by segment and names one that escapes the
|
|
117
|
+
* root `outside` (db D02b).
|
|
118
|
+
*/
|
|
119
|
+
export function rootRelative(root, path) {
|
|
120
|
+
if (!isAbsolute(path))
|
|
121
|
+
return path;
|
|
122
|
+
const local = relative(root, path);
|
|
123
|
+
if (isAbsolute(local) || local.split(sep)[0] === '..')
|
|
124
|
+
return undefined;
|
|
125
|
+
return local.split(sep).join('/');
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* R14: validate `key` against the read `within` names and resolve its seat. Every key-validation refusal is
|
|
129
|
+
* IA-RUNTIME-REQUEST-INVALID naming the bound it breaks, and its `next` the one command to run. The parts, closed sets,
|
|
130
|
+
* caps and seat form are checked before any read, so a key malformed in them is refused whatever the token; the word
|
|
131
|
+
* and the seat are then read through the token, and database token failures keep their codes. A path outside the
|
|
132
|
+
* workspace root or escaping it is refused, but a seat inside it that no record declares is not: the seat names the
|
|
133
|
+
* unknown, so K0 stays computable in a repository whose own `@workspace` is undecided.
|
|
134
|
+
*/
|
|
135
|
+
export function resolveScopeKey(handle, within, key) {
|
|
136
|
+
if (typeof within !== 'string' || within.length === 0)
|
|
137
|
+
invalid('Runtime reads require an explicit scope token');
|
|
138
|
+
const valid = formed(key), { seat, word } = valid, coordinate = scopeCoordinate(valid.shape, valid.phase);
|
|
139
|
+
// The reads, each through the token: the word against the view's registry, then the seat.
|
|
140
|
+
if (word !== undefined) {
|
|
141
|
+
const words = handle.words({ within });
|
|
142
|
+
if (!words.includes(word))
|
|
143
|
+
invalid(`Scope key word '${word}' is not registered in this closure; registered: ${words.join(', ')}`, NEXT.word);
|
|
144
|
+
}
|
|
145
|
+
const unknown = (resolution) => resolution.unknown === undefined ? {} : { unknown: resolution.unknown };
|
|
146
|
+
if (typeof seat === 'string') {
|
|
147
|
+
if (!handle.resolve({ kind: 'identity', identity: seat }, { within }).ok)
|
|
148
|
+
invalid(`Scope key seat '${seat}' is not an admitted record in this scope`, NEXT.seat);
|
|
149
|
+
return freeze({ key: valid, seat: { kind: 'record', identity: seat }, coordinate });
|
|
150
|
+
}
|
|
151
|
+
if (seat === undefined) {
|
|
152
|
+
const resolution = handle.resolveSeat('', { within });
|
|
153
|
+
return freeze({
|
|
154
|
+
key: valid,
|
|
155
|
+
seat: {
|
|
156
|
+
kind: 'workspace',
|
|
157
|
+
...(resolution.seat === undefined ? {} : { identity: resolution.seat }),
|
|
158
|
+
...unknown(resolution),
|
|
159
|
+
},
|
|
160
|
+
resolution,
|
|
161
|
+
coordinate,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// A path outside the root goes as given, and the database names it `outside`, as it does a relative one escaping it.
|
|
165
|
+
const resolution = handle.resolveSeat(rootRelative(handle.root, seat.path) ?? seat.path, { within });
|
|
166
|
+
if (resolution.unknown === 'outside')
|
|
167
|
+
invalid(`Scope key seat path '${seat.path}' must be inside the workspace: workspace-relative, or absolute under its root`, NEXT.seat);
|
|
168
|
+
return freeze({
|
|
169
|
+
key: { ...valid, seat: { path: resolution.path } },
|
|
170
|
+
seat: { kind: 'location', path: resolution.path, ...unknown(resolution) },
|
|
171
|
+
resolution,
|
|
172
|
+
coordinate,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=scope-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-key.js","sourceRoot":"","sources":["../src/scope-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI9F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;GASG;AA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./dist/index.d.ts",
|
|
@@ -97,14 +97,38 @@
|
|
|
97
97
|
"types": "./dist/index.d.ts",
|
|
98
98
|
"default": "./dist/index.js"
|
|
99
99
|
},
|
|
100
|
+
"./internal/locator": {
|
|
101
|
+
"types": "./dist/locator.d.ts",
|
|
102
|
+
"default": "./dist/locator.js"
|
|
103
|
+
},
|
|
100
104
|
"./internal/machine-protocol": {
|
|
101
105
|
"types": "./dist/machine-protocol.d.ts",
|
|
102
106
|
"default": "./dist/machine-protocol.js"
|
|
103
107
|
},
|
|
108
|
+
"./internal/mandate-modes": {
|
|
109
|
+
"types": "./dist/mandate-modes.d.ts",
|
|
110
|
+
"default": "./dist/mandate-modes.js"
|
|
111
|
+
},
|
|
104
112
|
"./internal/mentions": {
|
|
105
113
|
"types": "./dist/mentions.d.ts",
|
|
106
114
|
"default": "./dist/mentions.js"
|
|
107
115
|
},
|
|
116
|
+
"./internal/next": {
|
|
117
|
+
"types": "./dist/next.d.ts",
|
|
118
|
+
"default": "./dist/next.js"
|
|
119
|
+
},
|
|
120
|
+
"./internal/packet": {
|
|
121
|
+
"types": "./dist/packet.d.ts",
|
|
122
|
+
"default": "./dist/packet.js"
|
|
123
|
+
},
|
|
124
|
+
"./internal/packet-host": {
|
|
125
|
+
"types": "./dist/packet-host.d.ts",
|
|
126
|
+
"default": "./dist/packet-host.js"
|
|
127
|
+
},
|
|
128
|
+
"./internal/position": {
|
|
129
|
+
"types": "./dist/position.d.ts",
|
|
130
|
+
"default": "./dist/position.js"
|
|
131
|
+
},
|
|
108
132
|
"./internal/publication": {
|
|
109
133
|
"types": "./dist/publication.d.ts",
|
|
110
134
|
"default": "./dist/publication.js"
|
|
@@ -113,6 +137,10 @@
|
|
|
113
137
|
"types": "./dist/render.d.ts",
|
|
114
138
|
"default": "./dist/render.js"
|
|
115
139
|
},
|
|
140
|
+
"./internal/scope-key": {
|
|
141
|
+
"types": "./dist/scope-key.d.ts",
|
|
142
|
+
"default": "./dist/scope-key.js"
|
|
143
|
+
},
|
|
116
144
|
"./internal/select": {
|
|
117
145
|
"types": "./dist/select.d.ts",
|
|
118
146
|
"default": "./dist/select.js"
|
|
@@ -135,9 +163,9 @@
|
|
|
135
163
|
"LANGUAGE.md"
|
|
136
164
|
],
|
|
137
165
|
"dependencies": {
|
|
138
|
-
"@inventarch/language": "
|
|
139
|
-
"@inventarch/graph": "
|
|
140
|
-
"@inventarch/db": "
|
|
166
|
+
"@inventarch/language": "2.0.0",
|
|
167
|
+
"@inventarch/graph": "2.0.0",
|
|
168
|
+
"@inventarch/db": "2.0.0"
|
|
141
169
|
},
|
|
142
170
|
"devDependencies": {
|
|
143
171
|
"@types/node": "^22.19.0",
|