@agentshouse/mdruntime 0.1.0-c3903a68dcbbf → 0.1.0-c8c4b020a3ec7
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 -16
- package/README.md +7 -7
- package/dist/adapter.d.ts +0 -8
- package/dist/adapter.d.ts.map +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +0 -1
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +2 -6
- package/dist/client.d.ts +2 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +0 -6
- package/dist/collection.d.ts +0 -2
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +2 -12
- package/dist/connection.d.ts +1 -16
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +28 -138
- package/dist/host.d.ts +0 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +4 -27
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +0 -1
- package/dist/outcome.d.ts +5 -21
- package/dist/outcome.d.ts.map +1 -1
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +2 -6
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +2 -3
- package/dist/store.d.ts +5 -15
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +10 -32
- package/dist/wire.d.ts +1 -1
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +0 -6
- package/package.json +1 -1
package/dist/connection.js
CHANGED
|
@@ -49,21 +49,6 @@ function declaredSelection(room) {
|
|
|
49
49
|
root !== '' &&
|
|
50
50
|
selection.roots.every((other, at) => at === index || !within(other, root)));
|
|
51
51
|
}
|
|
52
|
-
function declaredUntypedFolders(room) {
|
|
53
|
-
const roots = room.untypedFolders;
|
|
54
|
-
if (roots === undefined)
|
|
55
|
-
return true;
|
|
56
|
-
if (!Array.isArray(roots) || roots.length === 0)
|
|
57
|
-
return false;
|
|
58
|
-
const selected = room.typedSelection?.roots ?? [];
|
|
59
|
-
return roots.every((root, index) => validRoot(root) &&
|
|
60
|
-
root !== '' &&
|
|
61
|
-
roots.every((other, at) => at === index || !within(other, root)) &&
|
|
62
|
-
selected.every((other) => !within(other, root) && !within(root, other)));
|
|
63
|
-
}
|
|
64
|
-
export function createMdRuntime(options) {
|
|
65
|
-
return composeRuntime(options).md;
|
|
66
|
-
}
|
|
67
52
|
export function composeRuntime(options) {
|
|
68
53
|
const period = options.discoveryIntervalMs ?? DEFAULT_DISCOVERY_INTERVAL_MS;
|
|
69
54
|
let authorization = options.authorization;
|
|
@@ -73,11 +58,8 @@ export function composeRuntime(options) {
|
|
|
73
58
|
const pendings = new Map();
|
|
74
59
|
const roomDrafts = new Map();
|
|
75
60
|
const presentations = new Map();
|
|
76
|
-
const outcomes = new Map();
|
|
77
|
-
const outcomeRooms = new Map();
|
|
78
61
|
const wanted = new Map();
|
|
79
62
|
let limits = [];
|
|
80
|
-
let slots = [];
|
|
81
63
|
let capabilities = [];
|
|
82
64
|
function rewriting() {
|
|
83
65
|
return capabilities.some((capability) => capability.name === 'move-reference-rewrites')
|
|
@@ -252,15 +234,6 @@ export function composeRuntime(options) {
|
|
|
252
234
|
function listed() {
|
|
253
235
|
return structuredClone([...rooms.values()]);
|
|
254
236
|
}
|
|
255
|
-
function slotted() {
|
|
256
|
-
return structuredClone(slots.map(({ slot, entries }) => ({
|
|
257
|
-
slot,
|
|
258
|
-
entries: entries.flatMap(({ locator, segment }) => {
|
|
259
|
-
const room = rooms.get(locator);
|
|
260
|
-
return room === undefined ? [] : [{ room, segment }];
|
|
261
|
-
}),
|
|
262
|
-
})));
|
|
263
|
-
}
|
|
264
237
|
function roomFacts() {
|
|
265
238
|
const held = [...rooms.values()].map((room) => {
|
|
266
239
|
const attached = [
|
|
@@ -306,14 +279,18 @@ export function composeRuntime(options) {
|
|
|
306
279
|
for (const listener of statusListeners)
|
|
307
280
|
listener(shown);
|
|
308
281
|
}
|
|
309
|
-
function
|
|
310
|
-
|
|
282
|
+
function entryOf(batch) {
|
|
283
|
+
const state = pendings.get(batch.id);
|
|
284
|
+
if (state?.accepted !== undefined) {
|
|
285
|
+
return Object.freeze({ batch, state: 'accepted', roomVersion: state.accepted });
|
|
286
|
+
}
|
|
287
|
+
return Object.freeze({ batch, ...(state?.submission ?? { state: 'waiting' }) });
|
|
311
288
|
}
|
|
312
289
|
function entriesOf(locator) {
|
|
313
290
|
const replica = replicas.get(locator);
|
|
314
291
|
if (replica === undefined)
|
|
315
292
|
return [];
|
|
316
|
-
return replica.queue.map(
|
|
293
|
+
return replica.queue.map(entryOf);
|
|
317
294
|
}
|
|
318
295
|
function emitQueue(locator) {
|
|
319
296
|
const entries = entriesOf(locator);
|
|
@@ -438,7 +415,6 @@ export function composeRuntime(options) {
|
|
|
438
415
|
attachedModel: selection.attachedModel,
|
|
439
416
|
model: modelTypes(modelOf(room.locator, 'typed-selection')),
|
|
440
417
|
},
|
|
441
|
-
untypedFolders: room.untypedFolders ?? [],
|
|
442
418
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
443
419
|
roomVersion: replicas.get(room.locator)?.confirmed.record.roomVersion ?? null,
|
|
444
420
|
attachments: replicas.get(room.locator)?.confirmed.record.attachments ?? [],
|
|
@@ -477,12 +453,6 @@ export function composeRuntime(options) {
|
|
|
477
453
|
await exclusive(async () => {
|
|
478
454
|
const unlisted = unlistedHeld(listed);
|
|
479
455
|
await local.dropRooms(unlisted);
|
|
480
|
-
for (const [batch, locator] of outcomeRooms) {
|
|
481
|
-
if (listed.has(locator))
|
|
482
|
-
continue;
|
|
483
|
-
outcomeRooms.delete(batch);
|
|
484
|
-
outcomes.delete(batch);
|
|
485
|
-
}
|
|
486
456
|
const removed = unlisted.map((locator) => changeSet(locator, replicas.get(locator) ?? null, null, {
|
|
487
457
|
room: true,
|
|
488
458
|
queue: true,
|
|
@@ -531,10 +501,9 @@ export function composeRuntime(options) {
|
|
|
531
501
|
return model;
|
|
532
502
|
}
|
|
533
503
|
async function hydrate(opened) {
|
|
534
|
-
const [records, queues,
|
|
504
|
+
const [records, queues, kept, presented, held, chatDrafts, lastCompleted, declared, named] = await Promise.all([
|
|
535
505
|
opened.all(),
|
|
536
506
|
opened.queues(),
|
|
537
|
-
opened.outcomes(),
|
|
538
507
|
opened.roomDrafts(),
|
|
539
508
|
opened.presentation(),
|
|
540
509
|
opened.conversations(),
|
|
@@ -542,11 +511,9 @@ export function composeRuntime(options) {
|
|
|
542
511
|
opened.lastCompleted(),
|
|
543
512
|
opened.providerLimits(),
|
|
544
513
|
opened.capabilities(),
|
|
545
|
-
opened.slots(),
|
|
546
514
|
]);
|
|
547
515
|
limits = declared;
|
|
548
516
|
capabilities = named;
|
|
549
|
-
slots = listedSlots;
|
|
550
517
|
roomDrafts.clear();
|
|
551
518
|
for (const record of kept)
|
|
552
519
|
rememberRoomDraft(record);
|
|
@@ -560,12 +527,6 @@ export function composeRuntime(options) {
|
|
|
560
527
|
for (const { batch, state } of queue.pending)
|
|
561
528
|
pendings.set(batch.id, state);
|
|
562
529
|
}
|
|
563
|
-
outcomes.clear();
|
|
564
|
-
outcomeRooms.clear();
|
|
565
|
-
for (const record of recordedOutcomes) {
|
|
566
|
-
outcomes.set(record.id, record.outcome);
|
|
567
|
-
outcomeRooms.set(record.id, record.locator);
|
|
568
|
-
}
|
|
569
530
|
const previousReplicas = new Map(replicas);
|
|
570
531
|
replicas.clear();
|
|
571
532
|
for (const record of records) {
|
|
@@ -600,7 +561,6 @@ export function composeRuntime(options) {
|
|
|
600
561
|
attachedModel: record.typedSelection.attachedModel,
|
|
601
562
|
model: modelTypes(selectionModel),
|
|
602
563
|
},
|
|
603
|
-
untypedFolders: record.untypedFolders,
|
|
604
564
|
});
|
|
605
565
|
}
|
|
606
566
|
if (read.kind === 'refused') {
|
|
@@ -687,25 +647,16 @@ export function composeRuntime(options) {
|
|
|
687
647
|
});
|
|
688
648
|
}
|
|
689
649
|
}
|
|
690
|
-
const settledOutcomes = [
|
|
691
|
-
...(settling.accepted === undefined ? [] : [settling.accepted]),
|
|
692
|
-
...(settling.leaving === undefined
|
|
693
|
-
? []
|
|
694
|
-
: [{ id: settling.leaving.batch.id, outcome: settling.leaving.outcome }]),
|
|
695
|
-
...withdrawn.map((batch) => ({ id: batch.id, outcome: { kind: 'withdrawn' } })),
|
|
696
|
-
];
|
|
697
650
|
await local.write({
|
|
698
651
|
next: confirmed.record,
|
|
699
652
|
previous: before?.confirmed.record ?? null,
|
|
700
653
|
queue: kept,
|
|
701
654
|
previousQueue: before?.queue ?? [],
|
|
702
|
-
outcomes: settledOutcomes,
|
|
703
655
|
roomDrafts: [...written.values()],
|
|
704
656
|
});
|
|
705
|
-
for (const
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
pendings.delete(id);
|
|
657
|
+
for (const batch of before?.queue ?? []) {
|
|
658
|
+
if (!kept.includes(batch))
|
|
659
|
+
pendings.delete(batch.id);
|
|
709
660
|
}
|
|
710
661
|
for (const record of written.values())
|
|
711
662
|
rememberRoomDraft(record);
|
|
@@ -733,13 +684,10 @@ export function composeRuntime(options) {
|
|
|
733
684
|
const queue = prior?.queue ?? [];
|
|
734
685
|
const roomVersion = retained.confirmed.record.roomVersion;
|
|
735
686
|
const accepted = queue.filter((batch) => {
|
|
736
|
-
const
|
|
737
|
-
return (
|
|
738
|
-
options.adapter.reached(room.locator, roomVersion, outcome.roomVersion));
|
|
687
|
+
const accepted = pendings.get(batch.id)?.accepted;
|
|
688
|
+
return (accepted !== undefined && options.adapter.reached(room.locator, roomVersion, accepted));
|
|
739
689
|
});
|
|
740
690
|
const set = await settle(local, room.locator, prior, retained.confirmed, queue.filter((batch) => !accepted.includes(batch)), { room: true });
|
|
741
|
-
for (const batch of accepted)
|
|
742
|
-
pendings.delete(batch.id);
|
|
743
691
|
const target = wanted.get(room.locator);
|
|
744
692
|
if (target !== undefined && options.adapter.reached(room.locator, roomVersion, target)) {
|
|
745
693
|
wanted.delete(room.locator);
|
|
@@ -953,8 +901,8 @@ export function composeRuntime(options) {
|
|
|
953
901
|
function reachOf(locator) {
|
|
954
902
|
let target = wanted.get(locator);
|
|
955
903
|
const versions = (replicas.get(locator)?.queue ?? []).flatMap((batch) => {
|
|
956
|
-
const
|
|
957
|
-
return
|
|
904
|
+
const accepted = pendings.get(batch.id)?.accepted;
|
|
905
|
+
return accepted === undefined ? [] : [accepted];
|
|
958
906
|
});
|
|
959
907
|
for (const version of versions) {
|
|
960
908
|
if (target === undefined || options.adapter.reached(locator, version, target)) {
|
|
@@ -1063,35 +1011,9 @@ export function composeRuntime(options) {
|
|
|
1063
1011
|
journal.record(`source refused ${room.locator} ${refusal.rule} ${refusal.file}`);
|
|
1064
1012
|
}
|
|
1065
1013
|
function leaving(batch, result) {
|
|
1066
|
-
if (result.kind === 'expired')
|
|
1067
|
-
return { batch,
|
|
1068
|
-
}
|
|
1069
|
-
const refusal = { code: result.code, fields: result.fields };
|
|
1070
|
-
if (result.kind === 'conflicted') {
|
|
1071
|
-
return {
|
|
1072
|
-
batch,
|
|
1073
|
-
outcome: {
|
|
1074
|
-
kind: 'conflicted',
|
|
1075
|
-
...(result.roomVersion === undefined ? {} : { roomVersion: result.roomVersion }),
|
|
1076
|
-
affected: result.affected,
|
|
1077
|
-
...refusal,
|
|
1078
|
-
},
|
|
1079
|
-
returned: { kind: 'conflicted', ...refusal },
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
return {
|
|
1083
|
-
batch,
|
|
1084
|
-
outcome: { kind: 'rejected', affected: result.affected, ...refusal },
|
|
1085
|
-
returned: { kind: 'rejected', ...refusal },
|
|
1086
|
-
};
|
|
1087
|
-
}
|
|
1088
|
-
function acceptedOf(accepted) {
|
|
1089
|
-
return {
|
|
1090
|
-
kind: 'accepted',
|
|
1091
|
-
roomVersion: accepted.roomVersion,
|
|
1092
|
-
...(accepted.author === undefined ? {} : { author: accepted.author }),
|
|
1093
|
-
...(accepted.time === undefined ? {} : { time: accepted.time }),
|
|
1094
|
-
};
|
|
1014
|
+
if (result.kind === 'expired')
|
|
1015
|
+
return { batch, returned: { kind: 'expired' } };
|
|
1016
|
+
return { batch, returned: { kind: result.kind, code: result.code, fields: result.fields } };
|
|
1095
1017
|
}
|
|
1096
1018
|
function logAccepted(locator, submitted, accepted) {
|
|
1097
1019
|
journal.record(`outcome ${locator} ${submitted.id} accepted ${accepted.roomVersion}` +
|
|
@@ -1106,17 +1028,13 @@ export function composeRuntime(options) {
|
|
|
1106
1028
|
if (current === undefined || !current.queue.some((batch) => batch.id === submitted.id)) {
|
|
1107
1029
|
return;
|
|
1108
1030
|
}
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
previousQueue: current.queue,
|
|
1115
|
-
outcomes: [{ id: submitted.id, outcome }],
|
|
1116
|
-
});
|
|
1117
|
-
outcomes.set(submitted.id, outcome);
|
|
1118
|
-
outcomeRooms.set(submitted.id, room.locator);
|
|
1031
|
+
const state = pendings.get(submitted.id);
|
|
1032
|
+
if (state === undefined)
|
|
1033
|
+
return;
|
|
1034
|
+
await local.accept(room.locator, submitted.id, accepted.roomVersion);
|
|
1035
|
+
pendings.set(submitted.id, { ...state, accepted: accepted.roomVersion });
|
|
1119
1036
|
logAccepted(room.locator, submitted, accepted);
|
|
1037
|
+
emitQueue(room.locator);
|
|
1120
1038
|
});
|
|
1121
1039
|
}
|
|
1122
1040
|
async function commitAccept(room, local, submitted, accepted, base, overlay) {
|
|
@@ -1138,7 +1056,6 @@ export function composeRuntime(options) {
|
|
|
1138
1056
|
if (applied.kind !== 'staged')
|
|
1139
1057
|
return applied;
|
|
1140
1058
|
const set = await settle(local, room.locator, current, applied.confirmed, remaining, {
|
|
1141
|
-
accepted: { id: submitted.id, outcome: acceptedOf(accepted) },
|
|
1142
1059
|
room: true,
|
|
1143
1060
|
});
|
|
1144
1061
|
unreadable.delete(room.locator);
|
|
@@ -1172,7 +1089,7 @@ export function composeRuntime(options) {
|
|
|
1172
1089
|
const head = replica?.queue[0];
|
|
1173
1090
|
if (replica === undefined || head === undefined)
|
|
1174
1091
|
return;
|
|
1175
|
-
if (
|
|
1092
|
+
if (pendings.get(head.id)?.accepted !== undefined) {
|
|
1176
1093
|
progress.complete = false;
|
|
1177
1094
|
return;
|
|
1178
1095
|
}
|
|
@@ -1384,8 +1301,7 @@ export function composeRuntime(options) {
|
|
|
1384
1301
|
JSON.stringify(heldBefore.replica) === JSON.stringify(room.replica) &&
|
|
1385
1302
|
JSON.stringify(heldBefore.attachedModel) === JSON.stringify(room.attachedModel) &&
|
|
1386
1303
|
JSON.stringify(heldBefore.typedSelection) ===
|
|
1387
|
-
JSON.stringify(room.typedSelection ?? null)
|
|
1388
|
-
JSON.stringify(heldBefore.untypedFolders) === JSON.stringify(room.untypedFolders ?? []))))
|
|
1304
|
+
JSON.stringify(room.typedSelection ?? null))))
|
|
1389
1305
|
return;
|
|
1390
1306
|
if (next.status === 'unavailable') {
|
|
1391
1307
|
invalidModels.add(key);
|
|
@@ -1404,7 +1320,6 @@ export function composeRuntime(options) {
|
|
|
1404
1320
|
replica: room.replica,
|
|
1405
1321
|
attachedModel: room.attachedModel,
|
|
1406
1322
|
typedSelection: room.typedSelection ?? null,
|
|
1407
|
-
untypedFolders: room.untypedFolders ?? [],
|
|
1408
1323
|
...(attached === 'collection' ? { model: next } : { selectionModel: next }),
|
|
1409
1324
|
};
|
|
1410
1325
|
const reclassified = sameMembership(declared, held.confirmed.record)
|
|
@@ -1415,7 +1330,6 @@ export function composeRuntime(options) {
|
|
|
1415
1330
|
: {
|
|
1416
1331
|
...declared,
|
|
1417
1332
|
typedSelection: held.confirmed.record.typedSelection,
|
|
1418
|
-
untypedFolders: held.confirmed.record.untypedFolders,
|
|
1419
1333
|
};
|
|
1420
1334
|
const read = reclassified.kind === 'deferred' ? readConfirmed(record, held.confirmed) : reclassified;
|
|
1421
1335
|
await local.write({
|
|
@@ -1670,12 +1584,6 @@ export function composeRuntime(options) {
|
|
|
1670
1584
|
notifyReady();
|
|
1671
1585
|
return;
|
|
1672
1586
|
}
|
|
1673
|
-
if (!declaredUntypedFolders(room)) {
|
|
1674
|
-
journal.record(`invalid untyped folder declaration ${room.locator}`);
|
|
1675
|
-
await refuse('missing-required-guarantee');
|
|
1676
|
-
notifyReady();
|
|
1677
|
-
return;
|
|
1678
|
-
}
|
|
1679
1587
|
}
|
|
1680
1588
|
const declared = new Set(result.capabilities.map((capability) => capability.name));
|
|
1681
1589
|
for (const required of options.requiredGuarantees) {
|
|
@@ -1694,13 +1602,10 @@ export function composeRuntime(options) {
|
|
|
1694
1602
|
notifyReady();
|
|
1695
1603
|
if (declared.has('room-version-notifications'))
|
|
1696
1604
|
observeRoomVersions();
|
|
1697
|
-
const discoveredSlots = result.slots ?? [];
|
|
1698
1605
|
if (JSON.stringify(result.providerLimits) !== JSON.stringify(limits) ||
|
|
1699
|
-
JSON.stringify(result.capabilities) !== JSON.stringify(previousCapabilities)
|
|
1700
|
-
JSON.stringify(discoveredSlots) !== JSON.stringify(slots)) {
|
|
1606
|
+
JSON.stringify(result.capabilities) !== JSON.stringify(previousCapabilities)) {
|
|
1701
1607
|
limits = result.providerLimits;
|
|
1702
|
-
|
|
1703
|
-
await local.declare(limits, capabilities, slots);
|
|
1608
|
+
await local.declare(limits, capabilities);
|
|
1704
1609
|
}
|
|
1705
1610
|
await applyDiscovery(result.rooms, local);
|
|
1706
1611
|
handSelected(result.rooms
|
|
@@ -2067,9 +1972,6 @@ export function composeRuntime(options) {
|
|
|
2067
1972
|
rooms() {
|
|
2068
1973
|
return listed();
|
|
2069
1974
|
},
|
|
2070
|
-
slots() {
|
|
2071
|
-
return slotted();
|
|
2072
|
-
},
|
|
2073
1975
|
query: ((input) => readSide.query(planOf(input, roomFacts()))),
|
|
2074
1976
|
async search(input) {
|
|
2075
1977
|
const plan = searchPlanOf(input);
|
|
@@ -2088,12 +1990,6 @@ export function composeRuntime(options) {
|
|
|
2088
1990
|
: modelTypes(modelOf(locator, 'typed-selection')),
|
|
2089
1991
|
};
|
|
2090
1992
|
},
|
|
2091
|
-
syncStatus() {
|
|
2092
|
-
return shown;
|
|
2093
|
-
},
|
|
2094
|
-
serviceMode() {
|
|
2095
|
-
return serviceMode;
|
|
2096
|
-
},
|
|
2097
1993
|
roomDraft: {
|
|
2098
1994
|
list() {
|
|
2099
1995
|
return exclusive(async () => {
|
|
@@ -2174,9 +2070,6 @@ export function composeRuntime(options) {
|
|
|
2174
2070
|
save(room, named, writtenBy) {
|
|
2175
2071
|
return exclusive(() => saveRoomDrafts(room, named, writtenBy));
|
|
2176
2072
|
},
|
|
2177
|
-
outcome(identifier) {
|
|
2178
|
-
return outcomes.get(identifier) ?? null;
|
|
2179
|
-
},
|
|
2180
2073
|
history(locator, path, query) {
|
|
2181
2074
|
return readHistory(locator, path, query);
|
|
2182
2075
|
},
|
|
@@ -2191,9 +2084,6 @@ export function composeRuntime(options) {
|
|
|
2191
2084
|
log() {
|
|
2192
2085
|
return journal.export();
|
|
2193
2086
|
},
|
|
2194
|
-
storageLoss() {
|
|
2195
|
-
return storageLoss;
|
|
2196
|
-
},
|
|
2197
2087
|
persistence() {
|
|
2198
2088
|
return options.shell.persistentStorage;
|
|
2199
2089
|
},
|
package/dist/host.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export type MdRuntimeHostOptions = MdRuntimeOptions & {
|
|
|
4
4
|
deploymentFacts?: unknown;
|
|
5
5
|
};
|
|
6
6
|
export type MdRuntimeHost = {
|
|
7
|
-
replaceDeploymentFacts(value: unknown): void;
|
|
8
7
|
attach(port: RuntimePort, app: string, release?: string): () => void;
|
|
9
8
|
endAuthorization(): Promise<void>;
|
|
10
9
|
stop(): Promise<void>;
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAML,KAAK,WAAW,EAIjB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,aAAa,GAAG;IAC1B,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAML,KAAK,WAAW,EAIjB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,CAAC;IACrE,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB,CAAC;AA0EF,wBAAgB,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAwG3E;AAED,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/host.js
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import { composeRuntime, } from './connection.js';
|
|
2
2
|
import { removeRuntimeStore } from './store.js';
|
|
3
3
|
import { AUTHORIZATION_ENDED, carried, envelope, PROTOCOL_MISMATCH, request, } from './wire.js';
|
|
4
|
-
function answered(md, app, writtenBy, member, input
|
|
4
|
+
function answered(md, app, writtenBy, member, input) {
|
|
5
5
|
switch (member) {
|
|
6
6
|
case 'rooms':
|
|
7
7
|
return md.rooms();
|
|
8
|
-
case 'slots':
|
|
9
|
-
return md.slots();
|
|
10
8
|
case 'query':
|
|
11
9
|
return md.query(input[0]);
|
|
12
10
|
case 'search':
|
|
13
11
|
return md.search(input[0]);
|
|
14
12
|
case 'types':
|
|
15
13
|
return md.types(input[0]);
|
|
16
|
-
case 'syncStatus':
|
|
17
|
-
return md.syncStatus();
|
|
18
|
-
case 'serviceMode':
|
|
19
|
-
return md.serviceMode();
|
|
20
14
|
case 'save':
|
|
21
15
|
return md.save(input[0], input[1], writtenBy);
|
|
22
|
-
case 'outcome':
|
|
23
|
-
return md.outcome(input[0]);
|
|
24
16
|
case 'history':
|
|
25
17
|
return md.history(input[0], input[1], input[2]);
|
|
26
18
|
case 'call':
|
|
@@ -29,10 +21,6 @@ function answered(md, app, writtenBy, member, input, deploymentFacts) {
|
|
|
29
21
|
return md.reached(input[0], input[1], input[2]);
|
|
30
22
|
case 'log':
|
|
31
23
|
return md.log();
|
|
32
|
-
case 'storageLoss':
|
|
33
|
-
return md.storageLoss();
|
|
34
|
-
case 'deploymentFacts':
|
|
35
|
-
return structuredClone(deploymentFacts);
|
|
36
24
|
case 'persistence':
|
|
37
25
|
return md.persistence();
|
|
38
26
|
case 'reauthorize':
|
|
@@ -74,7 +62,7 @@ function answered(md, app, writtenBy, member, input, deploymentFacts) {
|
|
|
74
62
|
}
|
|
75
63
|
}
|
|
76
64
|
export function serveMdRuntime(options) {
|
|
77
|
-
|
|
65
|
+
const deploymentFacts = structuredClone(options.deploymentFacts);
|
|
78
66
|
const closing = new AbortController();
|
|
79
67
|
const close = () => {
|
|
80
68
|
closing.abort();
|
|
@@ -86,13 +74,9 @@ export function serveMdRuntime(options) {
|
|
|
86
74
|
const { md, watch } = runtime;
|
|
87
75
|
const attachments = new Map();
|
|
88
76
|
let authorized = true;
|
|
89
|
-
const factsObservers = new Set();
|
|
90
77
|
const watchFacts = (deliver) => {
|
|
91
|
-
factsObservers.add(deliver);
|
|
92
78
|
deliver(structuredClone(deploymentFacts));
|
|
93
|
-
return () => {
|
|
94
|
-
factsObservers.delete(deliver);
|
|
95
|
-
};
|
|
79
|
+
return () => { };
|
|
96
80
|
};
|
|
97
81
|
function attach(port, app, release) {
|
|
98
82
|
if (!authorized)
|
|
@@ -137,7 +121,7 @@ export function serveMdRuntime(options) {
|
|
|
137
121
|
: watch(topic, topic === 'presentation' ? [app] : message.input, deliver));
|
|
138
122
|
return;
|
|
139
123
|
}
|
|
140
|
-
const value = await answered(md, app, writtenBy, message.member, message.input
|
|
124
|
+
const value = await answered(md, app, writtenBy, message.member, message.input);
|
|
141
125
|
if (serving)
|
|
142
126
|
send({ kind: 'result', id: message.id, value });
|
|
143
127
|
}
|
|
@@ -174,13 +158,6 @@ export function serveMdRuntime(options) {
|
|
|
174
158
|
}
|
|
175
159
|
return {
|
|
176
160
|
attach,
|
|
177
|
-
replaceDeploymentFacts(value) {
|
|
178
|
-
if (!authorized)
|
|
179
|
-
throw new Error(AUTHORIZATION_ENDED);
|
|
180
|
-
deploymentFacts = structuredClone(value);
|
|
181
|
-
for (const deliver of factsObservers)
|
|
182
|
-
deliver(structuredClone(deploymentFacts));
|
|
183
|
-
},
|
|
184
161
|
async endAuthorization() {
|
|
185
162
|
authorized = false;
|
|
186
163
|
for (const [detach, send] of [...attachments]) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,14 +2,13 @@ export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, A
|
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
3
3
|
export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView, GrowingText, } from './conversation.js';
|
|
4
4
|
export type { ChatDraftFile, FileDeclaration } from './file.js';
|
|
5
|
-
export type { AppRoom,
|
|
5
|
+
export type { AppRoom, AppTypedSelection, ConnectionRefusal, ConnectionRefusalReason, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomTypes, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
6
6
|
export type { Observation } from './observation.js';
|
|
7
|
-
export type {
|
|
7
|
+
export type { CallResult, QueueEntry, Submission } from './outcome.js';
|
|
8
8
|
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
|
|
9
9
|
export type { SaveRefusal } from './save.js';
|
|
10
10
|
export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.js';
|
|
11
11
|
export { changeBatchIdentity } from './identity.js';
|
|
12
|
-
export { createMdRuntime } from './connection.js';
|
|
13
12
|
export type { RuntimeShell } from './durability.js';
|
|
14
13
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
15
14
|
export type { Backlink, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, Predicate, QueryDocument, QueryGroup, QueryResult, Related, Select, Value, Where, } from './query.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YA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AC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,YAAY,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACrC,cAAc,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI,CAAC;IAC7C,gBAAgB,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI,CAAC;IACrE,MAAM,CAAC,SAAS,EAAE,MAAM,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACxD,iBAAiB,CAAC,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC/D,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,aAAa,IAAI,SAAS,MAAM,EAAE,CAAC;IACnC,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC;AA+BF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAiZrF"}
|
package/dist/memory.js
CHANGED
|
@@ -94,7 +94,6 @@ export function createMemoryAdapter(options = {}) {
|
|
|
94
94
|
replica: room.replica,
|
|
95
95
|
attachedModel: room.attachedModel,
|
|
96
96
|
...(room.typedSelection === undefined ? {} : { typedSelection: room.typedSelection }),
|
|
97
|
-
...(room.untypedFolders === undefined ? {} : { untypedFolders: room.untypedFolders }),
|
|
98
97
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
99
98
|
};
|
|
100
99
|
}
|
package/dist/outcome.d.ts
CHANGED
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
import type { ActionResult
|
|
1
|
+
import type { ActionResult } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
|
-
export type AffectedState = Readonly<Record<string, string>>;
|
|
4
3
|
export type CallResult = ActionResult | {
|
|
5
4
|
kind: 'undeclared';
|
|
6
5
|
};
|
|
7
|
-
export type AcceptedOutcome = {
|
|
8
|
-
kind: 'accepted';
|
|
9
|
-
roomVersion: string;
|
|
10
|
-
author?: string;
|
|
11
|
-
time?: string;
|
|
12
|
-
};
|
|
13
|
-
export type SubmissionOutcome = AcceptedOutcome | (ProviderRefusal & {
|
|
14
|
-
kind: 'conflicted';
|
|
15
|
-
roomVersion?: string;
|
|
16
|
-
affected: AffectedState;
|
|
17
|
-
}) | (ProviderRefusal & {
|
|
18
|
-
kind: 'rejected';
|
|
19
|
-
affected: AffectedState;
|
|
20
|
-
}) | {
|
|
21
|
-
kind: 'expired';
|
|
22
|
-
} | {
|
|
23
|
-
kind: 'withdrawn';
|
|
24
|
-
};
|
|
25
6
|
export type Submission = {
|
|
26
7
|
readonly state: 'waiting' | 'submitted';
|
|
27
8
|
} | {
|
|
@@ -30,5 +11,8 @@ export type Submission = {
|
|
|
30
11
|
};
|
|
31
12
|
export type QueueEntry = {
|
|
32
13
|
readonly batch: ChangeBatch;
|
|
33
|
-
} & Submission
|
|
14
|
+
} & (Submission | {
|
|
15
|
+
readonly state: 'accepted';
|
|
16
|
+
readonly roomVersion: string;
|
|
17
|
+
});
|
|
34
18
|
//# sourceMappingURL=outcome.d.ts.map
|
package/dist/outcome.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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,EACzB,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,SAAS,EAAE,SAAS,EACpB,QAAQ,CAAC,EAAE,OAAO,GACjB,OAAO,CA4CT;AAkFD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO,CAa7E;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,YAAY,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,EAC7C,SAAS,EAAE,SAAS,GACnB,SAAS,WAAW,EAAE,CAoBxB"}
|
package/dist/replica.js
CHANGED
|
@@ -10,7 +10,6 @@ export function compositionOf(record) {
|
|
|
10
10
|
selection: record.typedSelection === null
|
|
11
11
|
? null
|
|
12
12
|
: { roots: record.typedSelection.roots, model: record.selectionModel },
|
|
13
|
-
untypedFolders: record.untypedFolders,
|
|
14
13
|
};
|
|
15
14
|
}
|
|
16
15
|
export function readConfirmed(record, previous) {
|
|
@@ -22,9 +21,8 @@ export function readConfirmed(record, previous) {
|
|
|
22
21
|
: read;
|
|
23
22
|
}
|
|
24
23
|
export function sameMembership(record, other) {
|
|
25
|
-
return (JSON.stringify(record.
|
|
26
|
-
JSON.stringify(
|
|
27
|
-
JSON.stringify(other.typedSelection?.roots ?? null));
|
|
24
|
+
return (JSON.stringify(record.typedSelection?.roots ?? null) ===
|
|
25
|
+
JSON.stringify(other.typedSelection?.roots ?? null));
|
|
28
26
|
}
|
|
29
27
|
export function readStaged(record, previous) {
|
|
30
28
|
if ((record.model.status === 'current' || record.selectionModel.status === 'current') &&
|
|
@@ -88,8 +86,6 @@ function predicted(confirmed, batches, previous) {
|
|
|
88
86
|
const hasMove = batch.changes.some((change) => change.kind === 'move');
|
|
89
87
|
const reuseRewrite = old?.collection !== undefined &&
|
|
90
88
|
sameLayerText(before, old.before) &&
|
|
91
|
-
JSON.stringify(old.collection.composition.untypedFolders) ===
|
|
92
|
-
JSON.stringify(composition.untypedFolders) &&
|
|
93
89
|
old.collection.composition.model === composition.model &&
|
|
94
90
|
old.collection.composition.selection?.model === composition.selection?.model &&
|
|
95
91
|
JSON.stringify(old.collection.composition.selection?.roots) ===
|
package/dist/save.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../src/save.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../src/save.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,cAAc,EAAE,eAAe,CAAC;IACnD,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AAwK9C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,GAAG,WAAW,CAOxF;AA2MD,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,CA8FxD"}
|
package/dist/save.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { definitionOf } from './model.js';
|
|
2
2
|
import { apply, links, parse, retarget, serialize, target, } from '@agentshouse/mdmodel';
|
|
3
3
|
import { immutable, } from './change.js';
|
|
4
|
-
import { governing,
|
|
4
|
+
import { governing, parseCollection, validateCollection, } from './collection.js';
|
|
5
5
|
import { changeBatchIdentity } from './identity.js';
|
|
6
6
|
import { overlay } from './overlay.js';
|
|
7
7
|
import { covered, normalize, relative } from './paths.js';
|
|
@@ -403,8 +403,7 @@ export function buildBatch(input) {
|
|
|
403
403
|
const parsed = parse(content);
|
|
404
404
|
return parsed.ok && parsed.document.type !== undefined && parsed.document.type !== 'any';
|
|
405
405
|
};
|
|
406
|
-
const typedPaths = [...new Set(predicted.changes.flatMap(affected))].filter((path) =>
|
|
407
|
-
(typed(input.visible.documents[path]) || typed(resulting.documents[path])));
|
|
406
|
+
const typedPaths = [...new Set(predicted.changes.flatMap(affected))].filter((path) => typed(input.visible.documents[path]) || typed(resulting.documents[path]));
|
|
408
407
|
const needsModel = typedPaths.length > 0;
|
|
409
408
|
const withoutModel = typedPaths.find((path) => governing(input.composition, path).status === 'unavailable');
|
|
410
409
|
if (withoutModel !== undefined)
|