@agentshouse/mdruntime 0.1.0-c2c52158b7381 → 0.1.0-c2e8a6f99866d
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/AGENTS.md +14 -10
- package/dist/adapter.d.ts +14 -5
- package/dist/adapter.d.ts.map +1 -1
- package/dist/bootstrap.d.ts +13 -6
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +86 -88
- package/dist/chain.d.ts +11 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +5 -9
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +10 -86
- package/dist/chat/list.d.ts.map +1 -1
- package/dist/chat/list.js +1 -1
- package/dist/chat/message.d.ts.map +1 -1
- package/dist/chat/message.js +8 -1
- package/dist/chat/messages.d.ts +1 -0
- package/dist/chat/messages.d.ts.map +1 -1
- package/dist/chat/messages.js +9 -1
- package/dist/chat/provider.d.ts +2 -0
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +17 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/collection.d.ts +5 -19
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +22 -360
- package/dist/compile.d.ts +11 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +712 -0
- package/dist/connection.d.ts +2 -2
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1396 -624
- package/dist/conversation.d.ts +1 -1
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +26 -17
- package/dist/entry.d.ts +2 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +17 -23
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/live.d.ts +22 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +123 -0
- package/dist/memory.d.ts +1 -0
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +12 -0
- package/dist/observation.d.ts +12 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +84 -0
- package/dist/overlay.d.ts +0 -3
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +1 -151
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +15 -35
- package/dist/reads.js +1 -1
- package/dist/refresh.d.ts +10 -13
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +74 -70
- package/dist/replica.d.ts +55 -38
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +273 -214
- package/dist/rows.d.ts +29 -31
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +113 -69
- package/dist/save.d.ts +9 -10
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +59 -57
- package/dist/search.d.ts +2 -2
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +60 -28
- package/dist/shared.d.ts +0 -3
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +1 -31
- package/dist/store.d.ts +79 -62
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +164 -330
- package/dist/stored.d.ts +143 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +561 -0
- package/dist/tables.d.ts +246 -168
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +156 -25
- package/dist/turn.d.ts +1 -1
- package/dist/turn.d.ts.map +1 -1
- package/dist/turn.js +28 -20
- package/dist/validation.d.ts +30 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +162 -0
- package/dist/windows.d.ts +2 -1
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +30 -25
- package/package.json +2 -3
- package/dist/read-side.d.ts +0 -27
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -1179
package/dist/collection.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parse, VERSION } from '@agentshouse/mdmodel';
|
|
2
2
|
import { beneath, normalize } from './paths.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { after, finished, inUnits, ROW_WEIGHT } from './turn.js';
|
|
3
|
+
import { keysIn, sortedKeys } from './shared.js';
|
|
4
|
+
import { ROW_WEIGHT } from './turn.js';
|
|
6
5
|
export const MD_MODEL = { identity: '@agentshouse/mdmodel', version: VERSION };
|
|
7
|
-
|
|
8
|
-
const NO_TYPES = { types: {} };
|
|
9
|
-
function selected(composition, path) {
|
|
6
|
+
export function selected(composition, path) {
|
|
10
7
|
return (composition.selection !== null &&
|
|
11
8
|
composition.selection.roots.some((root) => beneath(root, path)));
|
|
12
9
|
}
|
|
@@ -15,82 +12,38 @@ export function governing(composition, path) {
|
|
|
15
12
|
? composition.selection.model
|
|
16
13
|
: composition.model;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (held === undefined)
|
|
22
|
-
return shared({});
|
|
23
|
-
const kept = yield* patching(held.base, held.added);
|
|
24
|
-
held.base = kept;
|
|
25
|
-
held.added = new Map();
|
|
26
|
-
return yield* patching(kept, [], yield* differences(previous.text, text));
|
|
27
|
-
}
|
|
28
|
-
function cachedIn(collection, path) {
|
|
29
|
-
const held = parsedIn.get(collection);
|
|
30
|
-
if (held === undefined)
|
|
31
|
-
return undefined;
|
|
32
|
-
if (held.added.has(path))
|
|
33
|
-
return held.added.get(path);
|
|
34
|
-
return Object.hasOwn(held.base, path) ? held.base[path] : undefined;
|
|
35
|
-
}
|
|
36
|
-
export function collectionOf(text, composition, previous) {
|
|
37
|
-
return finished(collecting(text, composition, previous));
|
|
38
|
-
}
|
|
39
|
-
export function* collecting(text, composition, previous) {
|
|
40
|
-
const parsed = {
|
|
41
|
-
base: previous === undefined ? shared({}) : yield* carried(previous, text),
|
|
42
|
-
added: new Map(),
|
|
43
|
-
};
|
|
44
|
-
const collection = {
|
|
15
|
+
export function collectionOf(text, composition) {
|
|
16
|
+
const parsed = new Map();
|
|
17
|
+
return {
|
|
45
18
|
text,
|
|
46
19
|
composition,
|
|
47
20
|
document(path) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return held ?? undefined;
|
|
21
|
+
if (parsed.has(path))
|
|
22
|
+
return parsed.get(path) ?? undefined;
|
|
51
23
|
const content = text[path];
|
|
52
24
|
if (content === undefined)
|
|
53
25
|
return undefined;
|
|
54
26
|
const read = parse(content, path);
|
|
55
|
-
parsed.
|
|
27
|
+
parsed.set(path, read.ok ? read.document : null);
|
|
56
28
|
return read.ok ? read.document : undefined;
|
|
57
29
|
},
|
|
58
30
|
};
|
|
59
|
-
parsedIn.set(collection, parsed);
|
|
60
|
-
return collection;
|
|
61
|
-
}
|
|
62
|
-
export function passingFrontmatter(collection, path) {
|
|
63
|
-
const held = cachedIn(collection, path);
|
|
64
|
-
if (held !== undefined)
|
|
65
|
-
return held ?? undefined;
|
|
66
|
-
const content = collection.text[path];
|
|
67
|
-
if (content === undefined)
|
|
68
|
-
return undefined;
|
|
69
|
-
const read = parseFrontmatter(content, path);
|
|
70
|
-
return read.ok ? read.frontmatter : undefined;
|
|
71
|
-
}
|
|
72
|
-
function* readIn(collection, paths) {
|
|
73
|
-
for (const path of paths) {
|
|
74
|
-
const held = cachedIn(collection, path);
|
|
75
|
-
if (held === null)
|
|
76
|
-
continue;
|
|
77
|
-
if (held !== undefined) {
|
|
78
|
-
yield [path, held];
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
const read = parse(collection.text[path], path);
|
|
82
|
-
if (read.ok)
|
|
83
|
-
yield [path, read.document];
|
|
84
|
-
}
|
|
85
31
|
}
|
|
86
32
|
export function* documentsOf(collection) {
|
|
87
|
-
|
|
33
|
+
const paths = yield* sortedKeys(collection.text);
|
|
34
|
+
return (function* () {
|
|
35
|
+
for (const path of paths) {
|
|
36
|
+
const document = collection.document(path);
|
|
37
|
+
if (document !== undefined)
|
|
38
|
+
yield [path, document];
|
|
39
|
+
}
|
|
40
|
+
})();
|
|
88
41
|
}
|
|
89
|
-
export function* unreadable(text,
|
|
90
|
-
const
|
|
42
|
+
export function* unreadable(text, paths = null) {
|
|
43
|
+
const named = paths ?? (yield* keysIn(text));
|
|
91
44
|
let least = null;
|
|
92
|
-
for (const path of
|
|
93
|
-
const content = text[path];
|
|
45
|
+
for (const path of named) {
|
|
46
|
+
const content = Object.hasOwn(text, path) ? text[path] : undefined;
|
|
94
47
|
if (content === undefined)
|
|
95
48
|
continue;
|
|
96
49
|
const read = parse(content, path);
|
|
@@ -104,298 +57,7 @@ export function* unreadable(text, previous) {
|
|
|
104
57
|
export function validRoot(root) {
|
|
105
58
|
return typeof root === 'string' && normalize(root) === root;
|
|
106
59
|
}
|
|
107
|
-
function* validateAgainst(documents, binaryTargets, model) {
|
|
108
|
-
if (model.status === 'unavailable') {
|
|
109
|
-
for (const [path, content] of documents) {
|
|
110
|
-
const parsed = parse(content);
|
|
111
|
-
if (parsed.ok && parsed.document.type !== undefined && parsed.document.type !== 'any')
|
|
112
|
-
return { verdict: 'refuse', rule: 'model-unavailable', file: path };
|
|
113
|
-
yield ROW_WEIGHT + content.length;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const steps = validating(documents, { binaryTargets, anyRoom: true }, model.status === 'unavailable' ? NO_TYPES : { types: model.types });
|
|
117
|
-
for (let step = steps.next();; step = steps.next()) {
|
|
118
|
-
if (step.done === true)
|
|
119
|
-
return step.value;
|
|
120
|
-
const { path, resolved } = step.value;
|
|
121
|
-
yield ROW_WEIGHT + documents.get(path).length + REFERENCE_WEIGHT * resolved;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
export function* validateCollection(text, binaryTargets, composition) {
|
|
125
|
-
const collection = new Map();
|
|
126
|
-
const selection = new Map();
|
|
127
|
-
for (const [path, content] of entriesIn(text)) {
|
|
128
|
-
if (selected(composition, path))
|
|
129
|
-
selection.set(path, content);
|
|
130
|
-
else
|
|
131
|
-
collection.set(path, content);
|
|
132
|
-
yield ROW_WEIGHT;
|
|
133
|
-
}
|
|
134
|
-
const verdicts = [
|
|
135
|
-
yield* validateAgainst(collection, binaryTargets.filter((path) => !selected(composition, path)), composition.model),
|
|
136
|
-
];
|
|
137
|
-
if (composition.selection !== null) {
|
|
138
|
-
verdicts.push(yield* validateAgainst(selection, binaryTargets.filter((path) => selected(composition, path)), composition.selection.model));
|
|
139
|
-
}
|
|
140
|
-
const refusals = verdicts.filter((verdict) => verdict.verdict === 'refuse');
|
|
141
|
-
if (refusals.length === 0)
|
|
142
|
-
return verdicts[0];
|
|
143
|
-
return refusals.find((refusal) => refusal.rule !== 'model-unavailable') ?? refusals[0];
|
|
144
|
-
}
|
|
145
|
-
const NO_REFERRERS = shared({});
|
|
146
|
-
const referrersOf = new WeakMap();
|
|
147
|
-
function typing(left, right) {
|
|
148
|
-
return (sameTyping(left.model, right.model) &&
|
|
149
|
-
(left.selection === null || right.selection === null
|
|
150
|
-
? left.selection === right.selection
|
|
151
|
-
: sameTyping(left.selection.model, right.selection.model)) &&
|
|
152
|
-
JSON.stringify(left.selection?.roots ?? null) === JSON.stringify(right.selection?.roots ?? null));
|
|
153
|
-
}
|
|
154
|
-
function declared(content) {
|
|
155
|
-
if (content === undefined)
|
|
156
|
-
return undefined;
|
|
157
|
-
const read = parseFrontmatter(content);
|
|
158
|
-
return read.ok ? (read.frontmatter.type ?? 'any') : undefined;
|
|
159
|
-
}
|
|
160
|
-
function typedIn(content) {
|
|
161
|
-
const type = declared(content);
|
|
162
|
-
return type !== undefined && type !== 'any';
|
|
163
|
-
}
|
|
164
|
-
function modelOf(composition, path) {
|
|
165
|
-
const model = governing(composition, path);
|
|
166
|
-
return model.status === 'unavailable' ? null : { types: model.types };
|
|
167
|
-
}
|
|
168
|
-
function checked(path, content, composition) {
|
|
169
|
-
return checkDocument(path, content, modelOf(composition, path) ?? NO_TYPES, { anyRoom: true });
|
|
170
|
-
}
|
|
171
|
-
function resolvedBy(check) {
|
|
172
|
-
return check.ok ? check.references.length : 0;
|
|
173
|
-
}
|
|
174
|
-
function targetsOf(check) {
|
|
175
|
-
if (!check.ok)
|
|
176
|
-
return [];
|
|
177
|
-
return [...new Set(check.references.flatMap(({ target }) => (target === null ? [] : [target])))];
|
|
178
|
-
}
|
|
179
|
-
function referencedBy(path, content, composition) {
|
|
180
|
-
const model = modelOf(composition, path);
|
|
181
|
-
if (model === null)
|
|
182
|
-
return [];
|
|
183
|
-
const read = parseFrontmatter(content, path);
|
|
184
|
-
const type = read.ok ? read.frontmatter.type : undefined;
|
|
185
|
-
if (!read.ok || type === undefined || !Object.hasOwn(model.types, type))
|
|
186
|
-
return [];
|
|
187
|
-
const definition = model.types[type];
|
|
188
|
-
return [
|
|
189
|
-
...new Set([
|
|
190
|
-
...references(read.frontmatter, definition).flatMap(({ value }) => {
|
|
191
|
-
const found = target(path, value);
|
|
192
|
-
return found === null ? [] : [found];
|
|
193
|
-
}),
|
|
194
|
-
...sectionReferences(path, content, definition).flatMap(({ target }) => target === null ? [] : [target]),
|
|
195
|
-
]),
|
|
196
|
-
];
|
|
197
|
-
}
|
|
198
|
-
function referrersOfTarget(index, target) {
|
|
199
|
-
return Object.hasOwn(index.referrers, target) ? index.referrers[target] : NO_REFERRERS;
|
|
200
|
-
}
|
|
201
|
-
function* reindexed(index, changed) {
|
|
202
|
-
const moved = new Map();
|
|
203
|
-
const movesOf = (target) => {
|
|
204
|
-
const held = moved.get(target) ?? { gained: [], lost: [] };
|
|
205
|
-
moved.set(target, held);
|
|
206
|
-
return held;
|
|
207
|
-
};
|
|
208
|
-
const targeting = [];
|
|
209
|
-
const targetless = [];
|
|
210
|
-
for (const [path, found] of changed) {
|
|
211
|
-
const before = Object.hasOwn(index.targets, path) ? index.targets[path] : [];
|
|
212
|
-
for (const target of before)
|
|
213
|
-
if (!found.includes(target))
|
|
214
|
-
movesOf(target).lost.push(path);
|
|
215
|
-
for (const target of found) {
|
|
216
|
-
if (!before.includes(target))
|
|
217
|
-
movesOf(target).gained.push([path, true]);
|
|
218
|
-
}
|
|
219
|
-
if (found.length > 0)
|
|
220
|
-
targeting.push([path, found]);
|
|
221
|
-
else
|
|
222
|
-
targetless.push(path);
|
|
223
|
-
yield ROW_WEIGHT * (1 + before.length + found.length);
|
|
224
|
-
}
|
|
225
|
-
const referred = [];
|
|
226
|
-
const unreferred = [];
|
|
227
|
-
for (const [target, { gained, lost }] of moved) {
|
|
228
|
-
const files = yield* patching(referrersOfTarget(index, target), gained, lost);
|
|
229
|
-
if (sizeOf(files) > 0)
|
|
230
|
-
referred.push([target, files]);
|
|
231
|
-
else
|
|
232
|
-
unreferred.push(target);
|
|
233
|
-
}
|
|
234
|
-
return {
|
|
235
|
-
composition: index.composition,
|
|
236
|
-
targets: yield* patching(index.targets, targeting, targetless),
|
|
237
|
-
referrers: yield* patching(index.referrers, referred, unreferred),
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
function storedIn(entries) {
|
|
241
|
-
let stored = shared({});
|
|
242
|
-
let unit = [];
|
|
243
|
-
return after(inUnits(entries, (entry) => {
|
|
244
|
-
unit.push(entry);
|
|
245
|
-
return ROW_WEIGHT;
|
|
246
|
-
}, () => {
|
|
247
|
-
stored = patched(stored, unit);
|
|
248
|
-
unit = [];
|
|
249
|
-
}), () => stored);
|
|
250
|
-
}
|
|
251
|
-
function storedReferrers(referrers) {
|
|
252
|
-
const sets = new Map();
|
|
253
|
-
let unit = new Map();
|
|
254
|
-
const pairs = function* () {
|
|
255
|
-
for (const [target, files] of referrers)
|
|
256
|
-
for (const file of files)
|
|
257
|
-
yield [target, file];
|
|
258
|
-
};
|
|
259
|
-
return after(inUnits(pairs(), ([target, file]) => {
|
|
260
|
-
const files = unit.get(target);
|
|
261
|
-
if (files === undefined)
|
|
262
|
-
unit.set(target, [file]);
|
|
263
|
-
else
|
|
264
|
-
files.push(file);
|
|
265
|
-
return ROW_WEIGHT;
|
|
266
|
-
}, () => {
|
|
267
|
-
for (const [target, files] of unit) {
|
|
268
|
-
sets.set(target, patched(sets.get(target) ?? NO_REFERRERS, files.map((file) => [file, true])));
|
|
269
|
-
}
|
|
270
|
-
unit = new Map();
|
|
271
|
-
}), () => storedIn(sets));
|
|
272
|
-
}
|
|
273
|
-
function heldIndex(held, composition) {
|
|
274
|
-
const index = referrersOf.get(held.text);
|
|
275
|
-
return index !== undefined && typing(index.composition, composition) ? index : null;
|
|
276
|
-
}
|
|
277
|
-
const indexing = new WeakMap();
|
|
278
|
-
export function indexReferrers(held, composition) {
|
|
279
|
-
if (heldIndex(held, composition) !== null)
|
|
280
|
-
return;
|
|
281
|
-
const running = indexing.get(held.text);
|
|
282
|
-
if (running !== undefined)
|
|
283
|
-
return running;
|
|
284
|
-
const targets = new Map();
|
|
285
|
-
const referrers = new Map();
|
|
286
|
-
const filled = inUnits(entriesIn(held.text), ([path, content]) => {
|
|
287
|
-
const found = referencedBy(path, content, composition);
|
|
288
|
-
if (found.length > 0)
|
|
289
|
-
targets.set(path, found);
|
|
290
|
-
for (const target of found) {
|
|
291
|
-
const files = referrers.get(target);
|
|
292
|
-
if (files === undefined)
|
|
293
|
-
referrers.set(target, [path]);
|
|
294
|
-
else
|
|
295
|
-
files.push(path);
|
|
296
|
-
}
|
|
297
|
-
return ROW_WEIGHT + content.length + REFERENCE_WEIGHT * found.length;
|
|
298
|
-
});
|
|
299
|
-
const indexed = after(filled, () => after(storedIn(targets), (storedTargets) => after(storedReferrers(referrers), (stored) => {
|
|
300
|
-
referrersOf.set(held.text, { composition, targets: storedTargets, referrers: stored });
|
|
301
|
-
})));
|
|
302
|
-
if (!(indexed instanceof Promise))
|
|
303
|
-
return;
|
|
304
|
-
const building = indexed.finally(() => indexing.delete(held.text));
|
|
305
|
-
indexing.set(held.text, building);
|
|
306
|
-
return building;
|
|
307
|
-
}
|
|
308
|
-
export function referencesIndexed(held, composition) {
|
|
309
|
-
return heldIndex(held, composition) !== null;
|
|
310
|
-
}
|
|
311
|
-
export function* referring(held, composition, targets) {
|
|
312
|
-
const index = heldIndex(held, composition);
|
|
313
|
-
if (index === null)
|
|
314
|
-
return null;
|
|
315
|
-
const found = new Set();
|
|
316
|
-
for (const target of targets) {
|
|
317
|
-
for (const [file] of entriesIn(referrersOfTarget(index, target))) {
|
|
318
|
-
found.add(file);
|
|
319
|
-
yield ROW_WEIGHT;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return found;
|
|
323
|
-
}
|
|
324
60
|
export function available(composition) {
|
|
325
61
|
return (composition.model.status !== 'unavailable' &&
|
|
326
62
|
(composition.selection === null || composition.selection.model.status !== 'unavailable'));
|
|
327
63
|
}
|
|
328
|
-
export function* changedCleanly(next, previous, composition) {
|
|
329
|
-
if (!typing(previous.composition, composition))
|
|
330
|
-
return false;
|
|
331
|
-
const paths = new Set([
|
|
332
|
-
...(yield* differences(previous.text, next.text)),
|
|
333
|
-
...(yield* differences(previous.binaries, next.binaries, () => true)),
|
|
334
|
-
]);
|
|
335
|
-
const binary = (path) => Object.hasOwn(next.binaries, path);
|
|
336
|
-
const within = (file) => (path) => selected(composition, path) === selected(composition, file);
|
|
337
|
-
const reaching = (file, check) => {
|
|
338
|
-
if (!check.ok)
|
|
339
|
-
return false;
|
|
340
|
-
const part = within(file);
|
|
341
|
-
return check.references.every((reference) => resolves(reference, (path) => (part(path) ? declared(next.text[path]) : undefined), (path) => part(path) && binary(path)));
|
|
342
|
-
};
|
|
343
|
-
const changedTargets = new Map();
|
|
344
|
-
const shifted = [];
|
|
345
|
-
const admitted = (path) => {
|
|
346
|
-
const now = next.text[path];
|
|
347
|
-
const was = previous.text[path];
|
|
348
|
-
const modeled = modelOf(composition, path) !== null;
|
|
349
|
-
if ((now === undefined) !== (was === undefined) ||
|
|
350
|
-
declared(now) !== declared(was) ||
|
|
351
|
-
binary(path) !== Object.hasOwn(previous.binaries, path)) {
|
|
352
|
-
shifted.push(path);
|
|
353
|
-
}
|
|
354
|
-
if (!modeled && typedIn(was) && !typedIn(now))
|
|
355
|
-
return null;
|
|
356
|
-
if (now === undefined) {
|
|
357
|
-
if (modeled)
|
|
358
|
-
changedTargets.set(path, []);
|
|
359
|
-
return 0;
|
|
360
|
-
}
|
|
361
|
-
if (binary(path))
|
|
362
|
-
return null;
|
|
363
|
-
if (!modeled) {
|
|
364
|
-
if (declared(now) === undefined)
|
|
365
|
-
return null;
|
|
366
|
-
if (typedIn(now))
|
|
367
|
-
return 0;
|
|
368
|
-
const check = checked(path, now, composition);
|
|
369
|
-
return check.ok ? resolvedBy(check) : null;
|
|
370
|
-
}
|
|
371
|
-
const check = checked(path, now, composition);
|
|
372
|
-
if (!reaching(path, check))
|
|
373
|
-
return null;
|
|
374
|
-
changedTargets.set(path, targetsOf(check));
|
|
375
|
-
return resolvedBy(check);
|
|
376
|
-
};
|
|
377
|
-
for (const path of paths) {
|
|
378
|
-
const resolved = admitted(path);
|
|
379
|
-
if (resolved === null)
|
|
380
|
-
return false;
|
|
381
|
-
yield ROW_WEIGHT + (next.text[path]?.length ?? 0) + REFERENCE_WEIGHT * resolved;
|
|
382
|
-
}
|
|
383
|
-
const index = heldIndex(previous, composition);
|
|
384
|
-
if (index === null && shifted.length > 0)
|
|
385
|
-
return false;
|
|
386
|
-
for (const target of shifted) {
|
|
387
|
-
const files = index === null ? NO_REFERRERS : referrersOfTarget(index, target);
|
|
388
|
-
for (const [file] of entriesIn(files)) {
|
|
389
|
-
if (paths.has(file))
|
|
390
|
-
continue;
|
|
391
|
-
const check = checked(file, next.text[file], composition);
|
|
392
|
-
if (!reaching(file, check))
|
|
393
|
-
return false;
|
|
394
|
-
yield ROW_WEIGHT + next.text[file].length + REFERENCE_WEIGHT * resolvedBy(check);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
if (index !== null) {
|
|
398
|
-
referrersOf.set(next.text, changedTargets.size === 0 ? index : yield* reindexed(index, changedTargets));
|
|
399
|
-
}
|
|
400
|
-
return true;
|
|
401
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plan, QueryRows } from './query.js';
|
|
2
|
+
import type { Connection } from './tables.js';
|
|
3
|
+
export type QueryRoom = {
|
|
4
|
+
readonly locator: string;
|
|
5
|
+
readonly key: number;
|
|
6
|
+
};
|
|
7
|
+
export type QueryAnswer = QueryRows & {
|
|
8
|
+
readonly more?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
|
|
11
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAOV,IAAI,EAGJ,SAAS,EAIV,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAU1D,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AA8pB3E,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAmSjE,wBAAgB,WAAW,CACzB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,MAAM,GAAE,MAAM,GAAG,IAAW,GAC3B,WAAW,CAiBb"}
|