@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/locator.js
ADDED
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { isPhase, isPrimitive, isRequirementId } from '@inventarch/language';
|
|
3
|
+
import { canonicalRoot } from '@inventarch/graph';
|
|
4
|
+
import { DbError, sourceTree } from '@inventarch/db';
|
|
5
|
+
import { RUNTIME_CODES, RuntimeError } from './errors.js';
|
|
6
|
+
import { bodyOf, statedText } from './render.js';
|
|
7
|
+
import { freeze } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Locators and the body reader: position-and-projection §5's `ia read` and design row 23.
|
|
10
|
+
*
|
|
11
|
+
* A locator names one admitted record, or one part of it, in one of four forms:
|
|
12
|
+
* - `<identity>`: the record, by its canonical `system/kind/facet/name` identity;
|
|
13
|
+
* - `<identity>#<phase>/<Primitive>`: the text of the record's cells at that address, a playbook's step;
|
|
14
|
+
* - `<identity>#<REQ-ID>`: the text of one of the record's requirements;
|
|
15
|
+
* - `<path>:<line>`: the innermost admitted record whose source span holds that line of a workspace source.
|
|
16
|
+
*
|
|
17
|
+
* The body behind a record is the document its source locator names, when its word carries one (SOURCE_LOCATORS) and the
|
|
18
|
+
* record states it; otherwise the record's own body (`bodyOf`). A fragment reads the record, never its document: the
|
|
19
|
+
* text of its cells or of its requirement at the fragment. A body is text and the SHA-256 of its UTF-8 bytes, never a
|
|
20
|
+
* certification: the reader neither admits the document nor judges what it says (IM-43). Structure (sections, fields,
|
|
21
|
+
* relationships) is the inspector's and never a body.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The field whose text names each word's document body, as its schema declares it: `work.source` on every work word
|
|
25
|
+
* that states one, @spec, @plan, @milestone, @task and @decision (position-and-projection rows 2d and 23, widened by
|
|
26
|
+
* decision work-source-locator: all five schemas declare the one field, and a plan's records name their sections of
|
|
27
|
+
* its document with it), `reference.document` on @authoring-guide (row 2h) and `template.resource`, a @template's
|
|
28
|
+
* input. A record that states none reads its own body.
|
|
29
|
+
*/
|
|
30
|
+
export const SOURCE_LOCATORS = Object.freeze({
|
|
31
|
+
'authoring-guide': 'reference.document',
|
|
32
|
+
decision: 'work.source',
|
|
33
|
+
milestone: 'work.source',
|
|
34
|
+
plan: 'work.source',
|
|
35
|
+
spec: 'work.source',
|
|
36
|
+
task: 'work.source',
|
|
37
|
+
template: 'template.resource',
|
|
38
|
+
});
|
|
39
|
+
/** The refusal codes a read can return; each is registered in RUNTIME_CODES. */
|
|
40
|
+
export const READ_CODES = Object.freeze(RUNTIME_CODES.filter((code) => code.startsWith('IA-RUNTIME-READ-')));
|
|
41
|
+
const IDENTITY = /^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/;
|
|
42
|
+
const LINE = /^(.+):([1-9][0-9]*)$/;
|
|
43
|
+
/** The locator `text` spells, or undefined when it spells none of the four forms. */
|
|
44
|
+
export function parseLocator(text) {
|
|
45
|
+
const line = LINE.exec(text);
|
|
46
|
+
if (line !== null) {
|
|
47
|
+
const number = Number(line[2]);
|
|
48
|
+
return Number.isSafeInteger(number) ? freeze({ form: 'line', path: line[1], line: number }) : undefined;
|
|
49
|
+
}
|
|
50
|
+
const at = text.indexOf('#'), identity = at < 0 ? text : text.slice(0, at);
|
|
51
|
+
if (!IDENTITY.test(identity))
|
|
52
|
+
return undefined;
|
|
53
|
+
if (at < 0)
|
|
54
|
+
return freeze({ form: 'identity', identity });
|
|
55
|
+
const fragment = text.slice(at + 1), [phase, primitive, ...rest] = fragment.split('/');
|
|
56
|
+
if (phase !== undefined && primitive !== undefined && rest.length === 0 && isPhase(phase) && isPrimitive(primitive))
|
|
57
|
+
return freeze({ form: 'cell', identity, fragment });
|
|
58
|
+
return isRequirementId(fragment) ? freeze({ form: 'requirement', identity, fragment }) : undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The text at `fragment` of `node`: its cells at a `phase/Primitive` address in source order, else its requirement with
|
|
62
|
+
* that id. Undefined when the record has neither, which is also what a request mention's fragment is checked against.
|
|
63
|
+
*/
|
|
64
|
+
export function fragmentText(node, fragment) {
|
|
65
|
+
const parts = [
|
|
66
|
+
...node.cells.filter((cell) => `${cell.phase}/${cell.primitive}` === fragment).map((cell) => cell.text),
|
|
67
|
+
...node.requirements.filter((requirement) => requirement.id === fragment).map((requirement) => requirement.text),
|
|
68
|
+
];
|
|
69
|
+
return parts.length === 0 ? undefined : parts.join('\n');
|
|
70
|
+
}
|
|
71
|
+
/** A line terminator a regular expression's `.` does not match, which no heading text holds. */
|
|
72
|
+
const TERMINATOR = /[\n\r\u2028\u2029]/;
|
|
73
|
+
const blank = (character) => character === ' ' || character === '\t';
|
|
74
|
+
/**
|
|
75
|
+
* The ATX heading `line` opens, read in time linear in the line: up to three spaces, one to six `#` followed by a space,
|
|
76
|
+
* a tab or the end, then the text with its surrounding spaces and tabs and a closing `#` run that a space or tab
|
|
77
|
+
* precedes removed. Undefined for any other line.
|
|
78
|
+
*/
|
|
79
|
+
function atxHeading(line) {
|
|
80
|
+
let at = 0;
|
|
81
|
+
while (at < 3 && line[at] === ' ')
|
|
82
|
+
at++;
|
|
83
|
+
const open = at;
|
|
84
|
+
while (line[at] === '#')
|
|
85
|
+
at++;
|
|
86
|
+
const depth = at - open;
|
|
87
|
+
if (depth === 0 || depth > 6 || (at < line.length && !blank(line[at])))
|
|
88
|
+
return undefined;
|
|
89
|
+
const rest = line.slice(at);
|
|
90
|
+
if (TERMINATOR.test(rest))
|
|
91
|
+
return undefined;
|
|
92
|
+
let start = 0, end = rest.length;
|
|
93
|
+
while (start < end && blank(rest[start]))
|
|
94
|
+
start++;
|
|
95
|
+
while (end > start && blank(rest[end - 1]))
|
|
96
|
+
end--;
|
|
97
|
+
let run = end;
|
|
98
|
+
while (run > start && rest[run - 1] === '#')
|
|
99
|
+
run--;
|
|
100
|
+
if (run < end && run > start && blank(rest[run - 1])) {
|
|
101
|
+
end = run;
|
|
102
|
+
while (end > start && blank(rest[end - 1]))
|
|
103
|
+
end--;
|
|
104
|
+
}
|
|
105
|
+
return { depth, text: rest.slice(start, end) };
|
|
106
|
+
}
|
|
107
|
+
const SETEXT = /^ {0,3}(?:=+|-+) *$/;
|
|
108
|
+
/** Structural tabs use four-column stops; the original line, heading text and returned bytes are never expanded. */
|
|
109
|
+
function blockLine(line) {
|
|
110
|
+
let added = 0;
|
|
111
|
+
return line.replace(/\t/g, (_, offset) => {
|
|
112
|
+
const width = 4 - ((offset + added) % 4);
|
|
113
|
+
added += width - 1;
|
|
114
|
+
return ' '.repeat(width);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function scan(text) {
|
|
118
|
+
let last = -1, terminator = -1, rule = text.length, third = -1, kind, count = 0, uniform = true;
|
|
119
|
+
for (let at = text.length - 1; at >= 0; at--) {
|
|
120
|
+
const character = text[at];
|
|
121
|
+
if (last < 0 && character !== ' ')
|
|
122
|
+
last = at;
|
|
123
|
+
if (terminator < 0 && TERMINATOR.test(character))
|
|
124
|
+
terminator = at;
|
|
125
|
+
if (!uniform)
|
|
126
|
+
continue;
|
|
127
|
+
if (character === ' ')
|
|
128
|
+
rule = at;
|
|
129
|
+
else if (character === kind ||
|
|
130
|
+
(kind === undefined && (character === '*' || character === '-' || character === '_'))) {
|
|
131
|
+
kind = character;
|
|
132
|
+
rule = at;
|
|
133
|
+
if (++count === 3)
|
|
134
|
+
third = at;
|
|
135
|
+
}
|
|
136
|
+
else
|
|
137
|
+
uniform = false;
|
|
138
|
+
}
|
|
139
|
+
return { text, last, terminator, rule, third };
|
|
140
|
+
}
|
|
141
|
+
/** The index past up to three spaces at `at`. */
|
|
142
|
+
function indented(text, at) {
|
|
143
|
+
let end = at;
|
|
144
|
+
while (end < at + 3 && text[end] === ' ')
|
|
145
|
+
end++;
|
|
146
|
+
return end;
|
|
147
|
+
}
|
|
148
|
+
/** A thematic break from `at`: up to three spaces, then three or more of one of `*`, `-` or `_`, with spaces only. */
|
|
149
|
+
function breakAt(line, at) {
|
|
150
|
+
if (at < line.rule || line.third < 0)
|
|
151
|
+
return false;
|
|
152
|
+
const first = indented(line.text, at);
|
|
153
|
+
return first < line.text.length && line.text[first] !== ' ' && first <= line.third;
|
|
154
|
+
}
|
|
155
|
+
/** The width of the block quote marker at `at` (up to three spaces, `>` and one optional space), or -1. */
|
|
156
|
+
function quoteAt(text, at) {
|
|
157
|
+
const start = indented(text, at);
|
|
158
|
+
return text[start] !== '>' ? -1 : start + 1 - at + (text[start + 1] === ' ' ? 1 : 0);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The code fence at `at`: up to three spaces, then three or more backticks or tildes, the marker, and the rest of the
|
|
162
|
+
* line, which holds no terminator; undefined for any other text.
|
|
163
|
+
*/
|
|
164
|
+
function fenceAt(line, at) {
|
|
165
|
+
const { text } = line, start = indented(text, at), character = text[start];
|
|
166
|
+
if (character !== '`' && character !== '~')
|
|
167
|
+
return undefined;
|
|
168
|
+
let end = start;
|
|
169
|
+
while (text[end] === character)
|
|
170
|
+
end++;
|
|
171
|
+
return end - start < 3 || line.terminator >= end ? undefined : { marker: text.slice(start, end), rest: end };
|
|
172
|
+
}
|
|
173
|
+
/** The opening code fence at `at`; a backtick fence's rest holds no backtick. */
|
|
174
|
+
function openingFence(line, at) {
|
|
175
|
+
const fence = fenceAt(line, at);
|
|
176
|
+
return fence === undefined || (fence.marker[0] === '`' && line.text.indexOf('`', fence.rest) >= 0)
|
|
177
|
+
? undefined
|
|
178
|
+
: fence.marker;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The list item at `at`, read in time linear in its marker and padding: up to three spaces, then `*`, `+` or `-`, or
|
|
182
|
+
* one to nine digits and `.` or `)`, then a space or the end, and no thematic break. Its content indentation includes
|
|
183
|
+
* its marker and one to four padding spaces (one for empty/code items). While a paragraph is open, an empty item or an
|
|
184
|
+
* ordered item that does not start at 1 cannot interrupt it.
|
|
185
|
+
*/
|
|
186
|
+
function listItem(line, at, paragraph) {
|
|
187
|
+
const { text } = line, start = indented(text, at), first = text[start];
|
|
188
|
+
let end = start;
|
|
189
|
+
if (first === '*' || first === '+' || first === '-')
|
|
190
|
+
end++;
|
|
191
|
+
else {
|
|
192
|
+
while (end < start + 10 && text[end] >= '0' && text[end] <= '9')
|
|
193
|
+
end++;
|
|
194
|
+
if (end === start || end - start > 9 || (text[end] !== '.' && text[end] !== ')'))
|
|
195
|
+
return undefined;
|
|
196
|
+
end++;
|
|
197
|
+
}
|
|
198
|
+
if ((end < text.length && text[end] !== ' ') || breakAt(line, at))
|
|
199
|
+
return undefined;
|
|
200
|
+
let content = end;
|
|
201
|
+
while (text[content] === ' ')
|
|
202
|
+
content++;
|
|
203
|
+
const empty = content >= text.length || TERMINATOR.test(text[content]), marker = text.slice(start, end);
|
|
204
|
+
if (paragraph && (empty || (marker.length > 1 && Number(marker.slice(0, -1)) !== 1)))
|
|
205
|
+
return undefined;
|
|
206
|
+
const padding = content - end;
|
|
207
|
+
return { indent: end - at + (empty || padding > 4 ? 1 : padding), empty };
|
|
208
|
+
}
|
|
209
|
+
/** A missing container prefix can continue only a paragraph, not a heading, fence, quote or new list. */
|
|
210
|
+
function startsBlock(line, at) {
|
|
211
|
+
return (atxHeading(line.text.slice(at)) !== undefined ||
|
|
212
|
+
openingFence(line, at) !== undefined ||
|
|
213
|
+
quoteAt(line.text, at) >= 0 ||
|
|
214
|
+
breakAt(line, at) ||
|
|
215
|
+
listItem(line, at, false) !== undefined);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The first index of `character` in `text` at or after a position, asked for positions that never decrease, as one
|
|
219
|
+
* scan: a position past the last found is searched from there, and every other answer is the one already found.
|
|
220
|
+
*/
|
|
221
|
+
function scanner(text, character) {
|
|
222
|
+
let searched = 0, found = text.indexOf(character);
|
|
223
|
+
return (from) => {
|
|
224
|
+
if (from < searched || (found >= 0 && found < from))
|
|
225
|
+
found = text.indexOf(character, (searched = from));
|
|
226
|
+
return found;
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* `heading` with each inline link or image, `[text](destination)` or ``, replaced by its text:
|
|
231
|
+
* the text runs to the first `]`, which `(` must follow, and the destination to the first `)` after it. Each `]` and
|
|
232
|
+
* `)` is found once, by scanners that only move forward, so the time is linear however many brackets stay unclosed.
|
|
233
|
+
*/
|
|
234
|
+
function linkText(heading) {
|
|
235
|
+
const close = scanner(heading, ']'), paren = scanner(heading, ')'), parts = [];
|
|
236
|
+
let kept = 0, open = heading.indexOf('[');
|
|
237
|
+
while (open >= 0) {
|
|
238
|
+
const shut = close(open + 1), end = shut < 0 || heading[shut + 1] !== '(' ? -1 : paren(shut + 2);
|
|
239
|
+
if (end < 0)
|
|
240
|
+
open = heading.indexOf('[', open + 1);
|
|
241
|
+
else {
|
|
242
|
+
// An image's `!` belongs to the link when it follows the previous link.
|
|
243
|
+
parts.push(heading.slice(kept, open > kept && heading[open - 1] === '!' ? open - 1 : open));
|
|
244
|
+
parts.push(heading.slice(open + 1, shut));
|
|
245
|
+
kept = end + 1;
|
|
246
|
+
open = heading.indexOf('[', kept);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
parts.push(heading.slice(kept));
|
|
250
|
+
return parts.join('');
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The anchor of one plain-text ATX heading, as GitHub's slugger gives it: an inline link keeps its text, letters are
|
|
254
|
+
* lowercased, every character other than a letter, mark, decimal or letter number, connector punctuation, `-` or space
|
|
255
|
+
* is dropped, and each space becomes `-`. Code spans and `*` emphasis come out as GitHub's, because their delimiters
|
|
256
|
+
* are dropped. The heading is not rendered first, so underscore emphasis, entity and character references, inline HTML
|
|
257
|
+
* and reference links keep their markup here, and such a heading may have another anchor on GitHub.
|
|
258
|
+
*/
|
|
259
|
+
export function headingAnchor(heading) {
|
|
260
|
+
return linkText(heading)
|
|
261
|
+
.toLowerCase()
|
|
262
|
+
.replace(/[^\p{L}\p{M}\p{Nd}\p{Nl}\p{Pc} -]/gu, '')
|
|
263
|
+
.replaceAll(' ', '-');
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The section of markdown `text` under the ATX heading whose `headingAnchor` is `anchor`: from that heading to the next
|
|
267
|
+
* heading of the same or a higher level, headings in fenced code ignored. A repeated anchor takes GitHub's `-1`, `-2`,
|
|
268
|
+
* ... in document order. A leading byte order mark is not part of the first line's heading, as GitHub skips it, and
|
|
269
|
+
* stays in the section. Setext headings and headings inside list items or block quotes are not read. Undefined when no
|
|
270
|
+
* heading has the anchor.
|
|
271
|
+
*
|
|
272
|
+
* A document may be 4 MiB and is read on the long-lived MCP door, so the read takes time linear in the document, up to
|
|
273
|
+
* a logarithmic factor in how deeply its containers nest, whatever it holds before the anchor: each line is scanned
|
|
274
|
+
* once from its end, each list or quote marker it opens or continues is read in time linear in its own width, and a
|
|
275
|
+
* line left blank after its container prefixes continues every open list item up to the first quote or empty item
|
|
276
|
+
* (the only containers a blank line ends), found by a binary search over the open quotes, never by walking the items.
|
|
277
|
+
*/
|
|
278
|
+
export function markdownSection(text, anchor) {
|
|
279
|
+
const lines = text.split(/(?<=\n)/), occurrences = new Map(), containers = [],
|
|
280
|
+
// The indices in `containers` of its block quotes, ascending. An empty list item is always the innermost container:
|
|
281
|
+
// no line opens a container inside one, since a line that continues it is blank or makes it nonempty.
|
|
282
|
+
quotes = [];
|
|
283
|
+
const unique = (base) => {
|
|
284
|
+
let result = base;
|
|
285
|
+
while (occurrences.has(result)) {
|
|
286
|
+
const count = occurrences.get(base) + 1;
|
|
287
|
+
occurrences.set(base, count);
|
|
288
|
+
result = `${base}-${count}`;
|
|
289
|
+
}
|
|
290
|
+
occurrences.set(result, 0);
|
|
291
|
+
return result;
|
|
292
|
+
};
|
|
293
|
+
/** The first container from `from` on that a blank line ends, a block quote or an empty item, else their count. */
|
|
294
|
+
const blankStop = (from) => {
|
|
295
|
+
let low = 0, high = quotes.length;
|
|
296
|
+
while (low < high) {
|
|
297
|
+
const middle = (low + high) >> 1;
|
|
298
|
+
if (quotes[middle] < from)
|
|
299
|
+
low = middle + 1;
|
|
300
|
+
else
|
|
301
|
+
high = middle;
|
|
302
|
+
}
|
|
303
|
+
const top = containers.length - 1, innermost = containers[top], stop = low < quotes.length ? quotes[low] : containers.length;
|
|
304
|
+
return top >= from && top < stop && innermost !== undefined && innermost !== 'quote' && innermost.empty
|
|
305
|
+
? top
|
|
306
|
+
: stop;
|
|
307
|
+
};
|
|
308
|
+
const truncate = (count) => {
|
|
309
|
+
containers.length = count;
|
|
310
|
+
while (quotes.length > 0 && quotes[quotes.length - 1] >= count)
|
|
311
|
+
quotes.pop();
|
|
312
|
+
};
|
|
313
|
+
let fence, start, level = 0, paragraph = false;
|
|
314
|
+
for (const [index, raw] of lines.entries()) {
|
|
315
|
+
const line = (index === 0 ? raw.replace(/^\uFEFF/, '') : raw).replace(/\r?\n$/, ''), scanned = scan(blockLine(line)), content = scanned.text;
|
|
316
|
+
let at = 0, matched = 0;
|
|
317
|
+
// Match existing containers before their leaf block. A fence ends when its containing list or quote ends.
|
|
318
|
+
while (matched < containers.length) {
|
|
319
|
+
if (at > scanned.last) {
|
|
320
|
+
// Blank from here: a quote ends, an empty item's own blank content was the one blank line it may start with,
|
|
321
|
+
// and every other item continues without consuming anything.
|
|
322
|
+
matched = blankStop(matched);
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
const container = containers[matched];
|
|
326
|
+
if (container === 'quote') {
|
|
327
|
+
const width = quoteAt(content, at);
|
|
328
|
+
if (width < 0)
|
|
329
|
+
break;
|
|
330
|
+
at += width;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
let spaces = 0;
|
|
334
|
+
while (spaces < container.indent && content[at + spaces] === ' ')
|
|
335
|
+
spaces++;
|
|
336
|
+
if (spaces < container.indent)
|
|
337
|
+
break;
|
|
338
|
+
at += container.indent;
|
|
339
|
+
container.empty = false;
|
|
340
|
+
}
|
|
341
|
+
matched++;
|
|
342
|
+
}
|
|
343
|
+
if (matched < containers.length) {
|
|
344
|
+
// The open paragraph belongs to an unmatched container. A new block at the matched level can start any list;
|
|
345
|
+
// the ordered-1/nonempty interruption rule applies only while that paragraph's containers remain matched.
|
|
346
|
+
if (paragraph && at <= scanned.last && !startsBlock(scanned, at))
|
|
347
|
+
continue;
|
|
348
|
+
truncate(matched);
|
|
349
|
+
fence = undefined;
|
|
350
|
+
paragraph = false;
|
|
351
|
+
}
|
|
352
|
+
if (fence !== undefined) {
|
|
353
|
+
const closing = fenceAt(scanned, at);
|
|
354
|
+
if (closing !== undefined &&
|
|
355
|
+
closing.marker[0] === fence[0] &&
|
|
356
|
+
closing.marker.length >= fence.length &&
|
|
357
|
+
scanned.last < closing.rest)
|
|
358
|
+
fence = undefined;
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
// New containers may nest on one line, but cannot arise inside fenced or indented code.
|
|
362
|
+
for (;;) {
|
|
363
|
+
const quote = quoteAt(content, at);
|
|
364
|
+
if (quote >= 0) {
|
|
365
|
+
quotes.push(containers.length);
|
|
366
|
+
containers.push('quote');
|
|
367
|
+
at += quote;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
const item = listItem(scanned, at, paragraph);
|
|
371
|
+
if (item === undefined)
|
|
372
|
+
break;
|
|
373
|
+
containers.push(item);
|
|
374
|
+
at += item.indent;
|
|
375
|
+
}
|
|
376
|
+
paragraph = false;
|
|
377
|
+
}
|
|
378
|
+
fence = openingFence(scanned, at);
|
|
379
|
+
if (fence !== undefined) {
|
|
380
|
+
paragraph = false;
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
const heading = atxHeading(content.slice(at));
|
|
384
|
+
if (heading === undefined) {
|
|
385
|
+
paragraph =
|
|
386
|
+
at <= scanned.last &&
|
|
387
|
+
!breakAt(scanned, at) &&
|
|
388
|
+
!(paragraph && SETEXT.test(content.slice(at))) &&
|
|
389
|
+
(paragraph || !content.startsWith(' ', at));
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
paragraph = false;
|
|
393
|
+
if (containers.length > 0)
|
|
394
|
+
continue;
|
|
395
|
+
const depth = heading.depth;
|
|
396
|
+
if (start !== undefined) {
|
|
397
|
+
if (depth <= level)
|
|
398
|
+
return lines.slice(start, index).join('');
|
|
399
|
+
}
|
|
400
|
+
else if (unique(headingAnchor(atxHeading(line).text)) === anchor) {
|
|
401
|
+
start = index;
|
|
402
|
+
level = depth;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return start === undefined ? undefined : lines.slice(start).join('');
|
|
406
|
+
}
|
|
407
|
+
/** The record's source locator: the field its word names in SOURCE_LOCATORS, when the record states it unconditionally. */
|
|
408
|
+
function sourceOf(node) {
|
|
409
|
+
if (!Object.hasOwn(SOURCE_LOCATORS, node.discriminator))
|
|
410
|
+
return undefined;
|
|
411
|
+
const field = SOURCE_LOCATORS[node.discriminator];
|
|
412
|
+
if (field === undefined)
|
|
413
|
+
return undefined;
|
|
414
|
+
const value = statedText(node, field);
|
|
415
|
+
return value === undefined ? undefined : { field, value };
|
|
416
|
+
}
|
|
417
|
+
const sha256 = (text) => createHash('sha256').update(text, 'utf8').digest('hex');
|
|
418
|
+
const refuse = (code, message, where) => freeze({ ok: false, code, message, ...where });
|
|
419
|
+
/** A scoped read's one refusal for a locator no admitted record in the scope answers, whatever lies outside it. */
|
|
420
|
+
const SCOPED_MISS = refuse('IA-RUNTIME-READ-UNADMITTED', 'The locator is not in this scope', {});
|
|
421
|
+
/** The record `identity` names in the scope `within`, or undefined for one outside it; a token failure keeps its code. */
|
|
422
|
+
function scopedGet(handle, identity, within) {
|
|
423
|
+
try {
|
|
424
|
+
return handle.get(identity, { within });
|
|
425
|
+
}
|
|
426
|
+
catch (error) {
|
|
427
|
+
if (error instanceof DbError && error.code === 'IA-DB-OUT-OF-SCOPE')
|
|
428
|
+
return undefined;
|
|
429
|
+
throw error;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* The body behind `locator` in the root view of `handle`, or in the scope `within` names, or one refusal:
|
|
434
|
+
* IA-RUNTIME-READ-UNADMITTED when no admitted record answers it (in a scope narrower than the whole workspace, the
|
|
435
|
+
* plain `SCOPED_MISS`; in the root view or a whole-workspace scope, what the workspace's sources hold there),
|
|
436
|
+
* IA-RUNTIME-READ-PLACEMENT for a record at runtime placement unless `includeRuntime` is set,
|
|
437
|
+
* IA-RUNTIME-READ-FRAGMENT when the record has no cell or requirement at the fragment, and IA-RUNTIME-READ-UNREACHABLE
|
|
438
|
+
* when its source locator names a file outside the workspace (or the record's tree), a record of an adopted mount
|
|
439
|
+
* `mounts` binds to no directory, a file the host's reader does not return, bytes that are not UTF-8, or an anchor that
|
|
440
|
+
* no markdown heading of the file has. A locator that spells none of the four forms is IA-RUNTIME-REQUEST-INVALID.
|
|
441
|
+
* A document path is read relative to the record's tree (db `sourceTree`): the workspace root for its own `.ia/src`,
|
|
442
|
+
* a package or installed store directory as it is, and for an adopted mount the directory `mounts` binds its label to.
|
|
443
|
+
*/
|
|
444
|
+
export function readBody(handle, locator, options) {
|
|
445
|
+
const parsed = parseLocator(locator);
|
|
446
|
+
if (parsed === undefined)
|
|
447
|
+
throw new RuntimeError('IA-RUNTIME-REQUEST-INVALID', `Locator '${locator}' is not <identity>, <identity>#<phase>/<Primitive>, <identity>#<REQ-ID> or <path>:<line>`);
|
|
448
|
+
const { within } = options,
|
|
449
|
+
// One disclosure rule for the version 2 Door operations (R12): a whole-workspace token (db PT5) reads what the root
|
|
450
|
+
// view reads, so its misses are the root view's, a record admission refused named with its reason; any narrower
|
|
451
|
+
// scope answers every miss with the one plain refusal, which names nothing beyond it.
|
|
452
|
+
narrowed = within !== undefined && !handle.isCompleteScope(within);
|
|
453
|
+
let node;
|
|
454
|
+
if (parsed.form === 'line') {
|
|
455
|
+
let path;
|
|
456
|
+
try {
|
|
457
|
+
path = canonicalRoot(parsed.path);
|
|
458
|
+
}
|
|
459
|
+
catch {
|
|
460
|
+
path = undefined;
|
|
461
|
+
}
|
|
462
|
+
node = handle
|
|
463
|
+
.records(within === undefined ? undefined : { within })
|
|
464
|
+
.filter((r) => r.source.path === path && r.source.line <= parsed.line && parsed.line <= r.source.endLine)
|
|
465
|
+
.sort((a, b) => a.source.endLine - a.source.line - (b.source.endLine - b.source.line))[0];
|
|
466
|
+
if (node === undefined && narrowed)
|
|
467
|
+
return SCOPED_MISS;
|
|
468
|
+
if (node === undefined) {
|
|
469
|
+
const at = path ?? parsed.path, file = handle.refused.some((r) => r.path === path)
|
|
470
|
+
? 'refused'
|
|
471
|
+
: handle.records().some((r) => r.source.path === path)
|
|
472
|
+
? 'admitted'
|
|
473
|
+
: undefined;
|
|
474
|
+
return refuse('IA-RUNTIME-READ-UNADMITTED', `No admitted record spans ${parsed.path}:${parsed.line}; ${file === 'refused'
|
|
475
|
+
? `admission refused records of ${at}`
|
|
476
|
+
: file === 'admitted'
|
|
477
|
+
? `the admitted records of ${at} span other lines`
|
|
478
|
+
: path === undefined
|
|
479
|
+
? `${parsed.path} is not a path relative to the workspace root`
|
|
480
|
+
: path === ''
|
|
481
|
+
? `${parsed.path} is the workspace root, a directory and no source`
|
|
482
|
+
: `no record of this workspace's sources is in ${at}`}`, { path: at, line: parsed.line, ...(file === undefined ? {} : { file }) });
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
node = within === undefined ? handle.get(parsed.identity) : scopedGet(handle, parsed.identity, within);
|
|
487
|
+
if (node === undefined && narrowed)
|
|
488
|
+
return SCOPED_MISS;
|
|
489
|
+
// A source holding the identity whose record admission refused is in the workspace's sources; only an identity no
|
|
490
|
+
// source holds is not.
|
|
491
|
+
const refused = node === undefined ? handle.refused.find((r) => r.identity === parsed.identity) : undefined;
|
|
492
|
+
if (refused !== undefined)
|
|
493
|
+
return refuse('IA-RUNTIME-READ-UNADMITTED', `${parsed.identity} is in this workspace's sources, but admission refused it`, { identity: parsed.identity, path: refused.path, line: refused.line, file: 'refused', reason: refused.reason });
|
|
494
|
+
if (node === undefined)
|
|
495
|
+
return refuse('IA-RUNTIME-READ-UNADMITTED', `${parsed.identity} is not in this workspace's sources`, {
|
|
496
|
+
identity: parsed.identity,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
const { identity } = node;
|
|
500
|
+
if (node.placement.kind === 'runtime' && options.includeRuntime !== true)
|
|
501
|
+
return refuse('IA-RUNTIME-READ-PLACEMENT', `${identity} is at runtime placement (band 0), which a read includes only when asked to`, { identity, path: node.source.path, line: node.source.line });
|
|
502
|
+
const found = (kind, body, path) => freeze({
|
|
503
|
+
ok: true,
|
|
504
|
+
body: {
|
|
505
|
+
locator,
|
|
506
|
+
identity,
|
|
507
|
+
kind,
|
|
508
|
+
...(path === undefined ? {} : { path }),
|
|
509
|
+
digest: sha256(body),
|
|
510
|
+
body,
|
|
511
|
+
certified: false,
|
|
512
|
+
},
|
|
513
|
+
});
|
|
514
|
+
if (parsed.form === 'cell' || parsed.form === 'requirement') {
|
|
515
|
+
const body = fragmentText(node, parsed.fragment);
|
|
516
|
+
return body === undefined
|
|
517
|
+
? refuse('IA-RUNTIME-READ-FRAGMENT', `${identity} has no ${parsed.form} ${parsed.fragment}`, {
|
|
518
|
+
identity,
|
|
519
|
+
path: node.source.path,
|
|
520
|
+
line: node.source.line,
|
|
521
|
+
})
|
|
522
|
+
: found('record', body);
|
|
523
|
+
}
|
|
524
|
+
const source = sourceOf(node);
|
|
525
|
+
if (source === undefined)
|
|
526
|
+
return found('record', bodyOf(node));
|
|
527
|
+
const { field, value } = source, at = value.indexOf('#'), file = at < 0 ? value : value.slice(0, at), anchor = at < 0 ? undefined : value.slice(at + 1);
|
|
528
|
+
const unreachable = (reason, path) => refuse('IA-RUNTIME-READ-UNREACHABLE', `The ${field} of ${identity}, ${value}, ${reason}`, {
|
|
529
|
+
identity,
|
|
530
|
+
...(path === undefined ? {} : { path }),
|
|
531
|
+
});
|
|
532
|
+
// A scheme names a resource a read never fetches; it is no workspace path, so it is not canonicalized into one.
|
|
533
|
+
if (/^[A-Za-z][A-Za-z0-9+.-]+:/.test(file))
|
|
534
|
+
return unreachable('is a URL, and a read fetches nothing');
|
|
535
|
+
let relative;
|
|
536
|
+
try {
|
|
537
|
+
relative = canonicalRoot(file);
|
|
538
|
+
}
|
|
539
|
+
catch {
|
|
540
|
+
return unreachable('is outside the workspace');
|
|
541
|
+
}
|
|
542
|
+
if (relative === '')
|
|
543
|
+
return unreachable('names no file');
|
|
544
|
+
// An adopted mount's sources carry the label of its tree, so its documents are read from the directory bound to it;
|
|
545
|
+
// they are outside the mount's revision pin, which covers its `.ia/src` sources only.
|
|
546
|
+
const tree = sourceTree(node.source.path), directory = tree.startsWith('.ia/adopted/') ? options.mounts?.get(tree) : tree;
|
|
547
|
+
if (directory === undefined)
|
|
548
|
+
return unreachable(`is in adopted mount ${tree}, which the read binds to no directory`);
|
|
549
|
+
const path = directory === '' ? relative : `${directory}/${relative}`;
|
|
550
|
+
let bytes, content;
|
|
551
|
+
try {
|
|
552
|
+
bytes = options.read(path);
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
return unreachable(`cannot be read: ${error instanceof Error ? error.message : String(error)}`, path);
|
|
556
|
+
}
|
|
557
|
+
try {
|
|
558
|
+
content = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
559
|
+
}
|
|
560
|
+
catch {
|
|
561
|
+
return unreachable('is not UTF-8 text', path);
|
|
562
|
+
}
|
|
563
|
+
if (anchor === undefined)
|
|
564
|
+
return found('document', content, path);
|
|
565
|
+
if (!/\.(?:md|markdown)$/i.test(relative))
|
|
566
|
+
return unreachable('has an anchor, but only a markdown file has headings to select', path);
|
|
567
|
+
const section = markdownSection(content, anchor);
|
|
568
|
+
return section === undefined
|
|
569
|
+
? unreachable(`selects heading #${anchor}, which ${path} does not have`, path)
|
|
570
|
+
: found('document', section, path);
|
|
571
|
+
}
|
|
572
|
+
//# sourceMappingURL=locator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locator.js","sourceRoot":"","sources":["../src/locator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAqC,MAAM,CAAC,MAAM,CAAC;IAC7E,iBAAiB,EAAE,oBAAoB;IACvC,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,aAAa;IACxB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,mBAAmB;CAC9B,CAAC,CAAC;AAQH,gFAAgF;AAChF,MAAM,CAAC,MAAM,UAA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CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC;IACtE,IAAI,KAAiB,EAAE,OAAe,CAAC;IACvC,IAAI,CAAC;QACH,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,WAAW,CAAC,mBAAmB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACxG,CAAC;IACD,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,WAAW,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;IACD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAClE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvC,OAAO,WAAW,CAAC,gEAAgE,EAAE,IAAI,CAAC,CAAC;IAC7F,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,WAAW,CAAC,oBAAoB,MAAM,WAAW,IAAI,gBAAgB,EAAE,IAAI,CAAC;QAC9E,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -15,6 +15,11 @@ export interface ProtocolOperation {
|
|
|
15
15
|
readonly example: Readonly<Record<string, unknown>>;
|
|
16
16
|
/** The MCP tool that serves it, or null where `differences` says why it is CLI-only. */
|
|
17
17
|
readonly mcp: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* The protocol version that added the operation, absent on the version 1 operations, whose rows are unchanged. The
|
|
20
|
+
* CLI's machine routes are the version 1 operations; a later one is served by the Door and the MCP door.
|
|
21
|
+
*/
|
|
22
|
+
readonly since?: number;
|
|
18
23
|
}
|
|
19
24
|
export interface ProtocolDifference {
|
|
20
25
|
readonly topic: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine-protocol.d.ts","sourceRoot":"","sources":["../src/machine-protocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"machine-protocol.d.ts","sourceRoot":"","sources":["../src/machine-protocol.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3D,MAAM,WAAW,eAAe;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AACD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,wFAAwF;IACxF,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,K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