@agentshouse/mdruntime 0.1.0-c806ecaf4afed → 0.1.0-c83bc1fac9b35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -19
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +15 -24
- package/dist/act-lanes.d.ts +11 -14
- package/dist/act-lanes.d.ts.map +1 -1
- package/dist/act-lanes.js +53 -5
- package/dist/actions.d.ts +8 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +138 -68
- package/dist/adapter.d.ts +86 -14
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +0 -5
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/change.d.ts +4 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +3 -0
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +0 -2
- package/dist/client.d.ts +14 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -46
- package/dist/collection.d.ts +5 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +16 -8
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts +2 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +17 -5
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +21 -16
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +23 -7
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +18 -6
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +20 -7
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +238 -174
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +36 -9
- package/dist/download.d.ts +6 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +42 -0
- package/dist/durability.d.ts +5 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +5 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +23 -12
- package/dist/expectation.d.ts +25 -14
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +51 -20
- package/dist/failure.d.ts +2 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +6 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +50 -16
- package/dist/house-query.d.ts +21 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +41 -0
- package/dist/index.d.ts +14 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/install.d.ts +10 -4
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +45 -46
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +50 -32
- package/dist/listing.d.ts +24 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +50 -21
- package/dist/live.d.ts +5 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +71 -30
- package/dist/loaded.d.ts +5 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +40 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +4 -3
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +2 -3
- package/dist/media.d.ts +18 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +102 -24
- package/dist/memory.d.ts +5 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +58 -14
- package/dist/messages.d.ts +12 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +24 -10
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +5 -8
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +206 -69
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +20 -10
- package/dist/outcome.d.ts +13 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +32 -2
- package/dist/overlay.d.ts +4 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +11 -9
- package/dist/parts.d.ts +4 -9
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +30 -15
- package/dist/preparation.d.ts +32 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +189 -87
- package/dist/presence.d.ts +8 -2
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +24 -13
- package/dist/queries.d.ts +2 -2
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +81 -64
- package/dist/questions.d.ts +1 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +1 -7
- package/dist/queue.d.ts +2 -2
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +73 -48
- package/dist/reach.d.ts +14 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +142 -30
- package/dist/react.d.ts +10 -11
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +22 -4
- package/dist/readiness.d.ts +16 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +10 -10
- package/dist/reads.d.ts +4 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +7 -3
- package/dist/recovery.d.ts +4 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +31 -8
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +1 -3
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +2 -2
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +30 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +253 -30
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +5 -2
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +45 -0
- package/dist/rows.d.ts +2 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +6 -6
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runtime.d.ts +5 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +105 -124
- package/dist/saves.d.ts +2 -0
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +42 -18
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/shown.d.ts +5 -2
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +79 -43
- package/dist/socket/lanes.d.ts +12 -4
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +34 -8
- package/dist/socket/session.d.ts +4 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +3 -0
- package/dist/socket.d.ts +4 -3
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +4 -9
- package/dist/source.d.ts +5 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +13 -2
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +20 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +60 -22
- package/dist/store/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store.d.ts +17 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +18 -6
- package/dist/stored.d.ts +25 -13
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +80 -27
- package/dist/surface.d.ts +12 -6
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +58 -26
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +75 -39
- package/dist/tables.d.ts +16 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +86 -324
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +1 -2
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +3 -9
- package/dist/wire.d.ts +33 -10
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +15 -8
- package/package.json +3 -3
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
package/dist/save.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { apply, ARRAY_INDEX, ATTACHMENT, create, links, parse, pointerSegments, references, relative, relativize, retarget, roomReferences, serialize, target, } from '@agentshouse/mdmodel';
|
|
2
|
-
import { immutable, leaving, queuedFile, departure, } from './change.js';
|
|
3
|
-
import { collectionOf, definitionsAt, documentsOf, governing, } from './collection.js';
|
|
2
|
+
import { immutable, isPart, leaving, queuedFile, departure, } from './change.js';
|
|
3
|
+
import { collectionOf, definitionsAt, documentsOf, governing, textType, typedText, } from './collection.js';
|
|
4
4
|
import { changeBatchIdentity, roomDraftRevision } from './identity.js';
|
|
5
|
-
import { overlaying } from './overlay.js';
|
|
5
|
+
import { composed, overlaying } from './overlay.js';
|
|
6
6
|
import { ancestors } from './paths.js';
|
|
7
7
|
import { entriesIn, sorting } from './shared.js';
|
|
8
|
-
import { changedParts, changesOf, moveTarget, withdrawnDrafts, } from './room-draft.js';
|
|
8
|
+
import { applyParts, changedParts, changesOf, moveTarget, partsBetween, withdrawnDrafts, } from './room-draft.js';
|
|
9
9
|
import { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
10
10
|
import { validatedCollection } from './validation.js';
|
|
11
|
-
function refuse(code, file, location) {
|
|
11
|
+
function refuse(code, file, location, line) {
|
|
12
12
|
return {
|
|
13
13
|
kind: 'refused',
|
|
14
14
|
refusal: {
|
|
@@ -16,9 +16,13 @@ function refuse(code, file, location) {
|
|
|
16
16
|
retryable: false,
|
|
17
17
|
...(file === undefined ? {} : { file }),
|
|
18
18
|
...(location === undefined ? {} : { location }),
|
|
19
|
+
...(line === undefined ? {} : { line }),
|
|
19
20
|
},
|
|
20
21
|
};
|
|
21
22
|
}
|
|
23
|
+
function refusedBy(refusal, file) {
|
|
24
|
+
return refuse(refusal.rule, file, refusal.location, refusal.line);
|
|
25
|
+
}
|
|
22
26
|
function repointed(document, definition, from, to, moves, settled) {
|
|
23
27
|
const changes = [];
|
|
24
28
|
const names = new Set();
|
|
@@ -48,36 +52,6 @@ function repointed(document, definition, from, to, moves, settled) {
|
|
|
48
52
|
const next = applied.document;
|
|
49
53
|
return [...names].map((name) => ({ kind: 'field', path: from, name, value: next.fields[name] }));
|
|
50
54
|
}
|
|
51
|
-
function edited(document, changes, definition) {
|
|
52
|
-
const parts = new Map();
|
|
53
|
-
for (const change of changes) {
|
|
54
|
-
if (change.kind === 'preamble')
|
|
55
|
-
parts.set('preamble', { kind: 'preamble', value: change.value, prior: document.preamble });
|
|
56
|
-
if (change.kind === 'section')
|
|
57
|
-
parts.set(`section ${change.name}`, {
|
|
58
|
-
kind: 'section',
|
|
59
|
-
name: change.name,
|
|
60
|
-
value: change.value,
|
|
61
|
-
prior: document.sections[change.name] ?? '',
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
if (parts.size === 0)
|
|
65
|
-
return document;
|
|
66
|
-
const applied = apply(document, [...parts.values()], definition);
|
|
67
|
-
return applied.outcome === 'applied' ? applied.document : document;
|
|
68
|
-
}
|
|
69
|
-
function bodies(path, before, after) {
|
|
70
|
-
const changes = [];
|
|
71
|
-
if (after.preamble !== before.preamble) {
|
|
72
|
-
changes.push({ kind: 'preamble', path, value: after.preamble });
|
|
73
|
-
}
|
|
74
|
-
for (const [name, value] of Object.entries(after.sections)) {
|
|
75
|
-
if (before.sections[name] === value)
|
|
76
|
-
continue;
|
|
77
|
-
changes.push({ kind: 'section', path, name, value });
|
|
78
|
-
}
|
|
79
|
-
return changes;
|
|
80
|
-
}
|
|
81
55
|
function relinks(path, moved, before, moves, definition) {
|
|
82
56
|
const changes = [];
|
|
83
57
|
for (const link of links(before, path)) {
|
|
@@ -92,27 +66,20 @@ function relinks(path, moved, before, moves, definition) {
|
|
|
92
66
|
if (changes.length === 0)
|
|
93
67
|
return { kind: 'changes', changes: [] };
|
|
94
68
|
const applied = apply(before, changes, definition);
|
|
95
|
-
if (applied.outcome === 'refuse')
|
|
96
|
-
return
|
|
97
|
-
kind: 'refused',
|
|
98
|
-
refusal: {
|
|
99
|
-
code: applied.refusal.rule,
|
|
100
|
-
retryable: false,
|
|
101
|
-
file: path,
|
|
102
|
-
...(applied.refusal.location === undefined ? {} : { location: applied.refusal.location }),
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
}
|
|
69
|
+
if (applied.outcome === 'refuse')
|
|
70
|
+
return refusedBy(applied.refusal, path);
|
|
106
71
|
const after = applied.document;
|
|
107
72
|
if (after === before)
|
|
108
73
|
return { kind: 'changes', changes: [] };
|
|
109
74
|
if (before.type === undefined) {
|
|
110
75
|
return { kind: 'changes', changes: [{ kind: 'replace', path, content: serialize(after) }] };
|
|
111
76
|
}
|
|
112
|
-
return { kind: 'changes', changes:
|
|
77
|
+
return { kind: 'changes', changes: partsBetween(path, before, after) };
|
|
113
78
|
}
|
|
114
79
|
function partKey(change) {
|
|
115
|
-
return change.kind === 'section'
|
|
80
|
+
return change.kind === 'section' || change.kind === 'field'
|
|
81
|
+
? `${change.kind} ${change.name}`
|
|
82
|
+
: change.kind;
|
|
116
83
|
}
|
|
117
84
|
const NAMES_A_SKIP_TESTS = 64;
|
|
118
85
|
const ENCODED = /[%&\\]/u;
|
|
@@ -159,9 +126,10 @@ function* rewrites(changes, visible) {
|
|
|
159
126
|
const repointing = repointed(document, definition, path, moved, moves, settled);
|
|
160
127
|
added.push(...repointing);
|
|
161
128
|
const own = parts.get(path) ?? [];
|
|
129
|
+
const edited = applyParts(document, own.map((index) => merged[index]), definition);
|
|
162
130
|
const relinked = moved === path && own.length === 0 && cannotLink(document.content, names)
|
|
163
131
|
? { kind: 'changes', changes: [] }
|
|
164
|
-
: relinks(path, moved, edited
|
|
132
|
+
: relinks(path, moved, edited.outcome === 'applied' ? edited.document : document, moves, definition);
|
|
165
133
|
if (relinked.kind === 'refused')
|
|
166
134
|
return relinked;
|
|
167
135
|
const keyed = new Map();
|
|
@@ -174,7 +142,7 @@ function* rewrites(changes, visible) {
|
|
|
174
142
|
if (change.kind === 'replace') {
|
|
175
143
|
for (const index of own) {
|
|
176
144
|
const kind = merged[index]?.kind;
|
|
177
|
-
if (kind === 'section' || kind === 'preamble')
|
|
145
|
+
if (kind === 'field' || kind === 'section' || kind === 'preamble')
|
|
178
146
|
merged[index] = null;
|
|
179
147
|
}
|
|
180
148
|
added.push(change);
|
|
@@ -239,11 +207,7 @@ function rewritten(path, document, changes, definition) {
|
|
|
239
207
|
const after = applied.document;
|
|
240
208
|
if (document.type === undefined)
|
|
241
209
|
return [{ kind: 'replace', path, content: serialize(after) }];
|
|
242
|
-
|
|
243
|
-
return [
|
|
244
|
-
...[...names].map((name) => ({ kind: 'field', path, name, value: after.fields[name] })),
|
|
245
|
-
...bodies(path, document, after),
|
|
246
|
-
];
|
|
210
|
+
return partsBetween(path, document, after);
|
|
247
211
|
}
|
|
248
212
|
function roomPathOf(handle, path) {
|
|
249
213
|
return `/rooms/${handle}/${path}`;
|
|
@@ -453,7 +417,7 @@ function* preconditionsOf(changes, visible, bases) {
|
|
|
453
417
|
};
|
|
454
418
|
for (const change of changes) {
|
|
455
419
|
yield ROW_WEIGHT;
|
|
456
|
-
if (change
|
|
420
|
+
if (isPart(change)) {
|
|
457
421
|
const based = bases.find((base) => sameTarget(base, change));
|
|
458
422
|
if (based !== undefined) {
|
|
459
423
|
add(based);
|
|
@@ -560,71 +524,81 @@ function relativeField(path, name, value, handle, definition) {
|
|
|
560
524
|
return result.outcome === 'applied' ? result.document.fields[name] : value;
|
|
561
525
|
}
|
|
562
526
|
function relativeChanges(input) {
|
|
527
|
+
const changes = [];
|
|
528
|
+
for (const change of input.changes) {
|
|
529
|
+
const next = relativeChange(change, input);
|
|
530
|
+
if ('refusal' in next)
|
|
531
|
+
return next;
|
|
532
|
+
changes.push(next.change);
|
|
533
|
+
}
|
|
534
|
+
return { kind: 'changes', changes };
|
|
535
|
+
}
|
|
536
|
+
function relativeChange(change, input) {
|
|
563
537
|
const { handle, composition, visible } = input;
|
|
564
|
-
const typed = (path) => definitionsAt(composition, path);
|
|
565
538
|
const body = (path, text) => shellRelative(text, path, handle, () => undefined)?.content ?? text;
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
539
|
+
const definition = definitionsAt(composition, change.path);
|
|
540
|
+
if (change.kind === 'field') {
|
|
541
|
+
const type = visible.collection.document(change.path)?.type;
|
|
542
|
+
const value = relativeField(change.path, change.name, change.value, handle, definition(type));
|
|
543
|
+
return { change: value === change.value ? change : { ...change, value } };
|
|
544
|
+
}
|
|
545
|
+
if (change.kind === 'section' || change.kind === 'preamble') {
|
|
546
|
+
const value = body(change.path, change.value);
|
|
547
|
+
return { change: value === change.value ? change : { ...change, value } };
|
|
548
|
+
}
|
|
549
|
+
if (change.kind === 'replace' || (change.kind === 'create' && 'content' in change)) {
|
|
550
|
+
const content = shellRelative(change.content, change.path, handle, definition)?.content ?? change.content;
|
|
551
|
+
return { change: content === change.content ? change : { ...change, content } };
|
|
552
|
+
}
|
|
553
|
+
if (change.kind !== 'create')
|
|
554
|
+
return { change };
|
|
555
|
+
const type = typeof change.fields.type === 'string' ? change.fields.type : undefined;
|
|
556
|
+
const fields = Object.fromEntries(Object.entries(change.fields).map(([name, value]) => [
|
|
557
|
+
name,
|
|
558
|
+
relativeField(change.path, name, value, handle, definition(type)),
|
|
559
|
+
]));
|
|
560
|
+
const sections = Object.fromEntries(Object.entries(change.sections).map(([name, value]) => [name, body(change.path, value)]));
|
|
561
|
+
const written = composed(change.path, fields, sections, composition);
|
|
562
|
+
if (written.outcome === 'refuse')
|
|
563
|
+
return refusedBy(written.refusal, change.path);
|
|
564
|
+
if (written.outcome === 'stale')
|
|
565
|
+
throw new Error(`the creation of ${change.path} is stale`);
|
|
566
|
+
if (Object.keys(sections).length === 0)
|
|
567
|
+
return { change: { ...change, fields, sections } };
|
|
568
|
+
return {
|
|
569
|
+
change: { kind: 'create', path: change.path, content: serialize(written.document) },
|
|
570
|
+
};
|
|
591
571
|
}
|
|
592
572
|
function unqueueable(file) {
|
|
593
573
|
return refuse('unknown-revision', file);
|
|
594
574
|
}
|
|
595
|
-
function isPart(change) {
|
|
596
|
-
return change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble';
|
|
597
|
-
}
|
|
598
575
|
function touched(change) {
|
|
599
576
|
return change.kind === 'move' ? [change.path, change.to] : [change.path];
|
|
600
577
|
}
|
|
601
578
|
function partsApplied(content, path, changes, composition) {
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
const parts = new Map();
|
|
579
|
+
const applied = partsResult(content, path, changes, composition);
|
|
580
|
+
return applied?.outcome === 'applied' ? serialize(applied.document) : null;
|
|
581
|
+
}
|
|
582
|
+
function unapplied(changes, visible, composition) {
|
|
583
|
+
const parted = new Map();
|
|
608
584
|
for (const change of changes) {
|
|
609
|
-
if (change
|
|
610
|
-
|
|
611
|
-
kind: 'field',
|
|
612
|
-
name: change.name,
|
|
613
|
-
value: change.value,
|
|
614
|
-
prior: document.fields[change.name],
|
|
615
|
-
});
|
|
616
|
-
else if (change.kind === 'section')
|
|
617
|
-
parts.set(`section ${change.name}`, {
|
|
618
|
-
kind: 'section',
|
|
619
|
-
name: change.name,
|
|
620
|
-
value: change.value,
|
|
621
|
-
prior: document.sections[change.name] ?? '',
|
|
622
|
-
});
|
|
623
|
-
else
|
|
624
|
-
parts.set('preamble', { kind: 'preamble', value: change.value, prior: document.preamble });
|
|
585
|
+
if (isPart(change))
|
|
586
|
+
parted.set(change.path, [...(parted.get(change.path) ?? []), change]);
|
|
625
587
|
}
|
|
626
|
-
const
|
|
627
|
-
|
|
588
|
+
for (const [path, parts] of parted) {
|
|
589
|
+
const content = visible.documents[path];
|
|
590
|
+
if (content === undefined)
|
|
591
|
+
continue;
|
|
592
|
+
const applied = partsResult(content, path, parts, composition);
|
|
593
|
+
if (applied?.outcome === 'refuse')
|
|
594
|
+
return refusedBy(applied.refusal, path);
|
|
595
|
+
}
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
function partsResult(content, path, changes, composition) {
|
|
599
|
+
const definitions = definitionsAt(composition, path);
|
|
600
|
+
const parsed = parse(content, path, definitions);
|
|
601
|
+
return parsed.ok ? applyParts(parsed.document, changes, definitions(parsed.document.type)) : null;
|
|
628
602
|
}
|
|
629
603
|
function settledParts(changes, deferred, composition) {
|
|
630
604
|
for (const [held, parts] of deferred) {
|
|
@@ -843,11 +817,8 @@ function* limiting(queue, batch, limits, state) {
|
|
|
843
817
|
const limited = yield* exceeding(limits, batch.changes, rewritten.changes, yield* state(queue.slice(0, at + 1)));
|
|
844
818
|
return limited?.refusal ?? null;
|
|
845
819
|
}
|
|
846
|
-
function
|
|
847
|
-
|
|
848
|
-
return false;
|
|
849
|
-
const parsed = parse(content);
|
|
850
|
-
return parsed.ok && parsed.document.type !== undefined && parsed.document.type !== 'any';
|
|
820
|
+
function typedContent(content) {
|
|
821
|
+
return content !== undefined && typedText(parse(content));
|
|
851
822
|
}
|
|
852
823
|
function touchedLibrary(resulting, touched, composition) {
|
|
853
824
|
const entries = touched
|
|
@@ -867,9 +838,9 @@ function touchedLibrary(resulting, touched, composition) {
|
|
|
867
838
|
if (binaries.has(path))
|
|
868
839
|
known.set(path, { type: undefined, binary: true });
|
|
869
840
|
else if (content !== undefined && content !== null) {
|
|
870
|
-
const
|
|
871
|
-
if (
|
|
872
|
-
known.set(path, { type
|
|
841
|
+
const type = textType(parse(content, path, definitionsAt(composition, path)));
|
|
842
|
+
if (type !== undefined)
|
|
843
|
+
known.set(path, { type, binary: false });
|
|
873
844
|
await pace(content.length + ROW_WEIGHT);
|
|
874
845
|
}
|
|
875
846
|
}
|
|
@@ -887,7 +858,7 @@ async function judging(visible, resulting, composition, validate, removed, touch
|
|
|
887
858
|
for (const path of touched) {
|
|
888
859
|
const before = visible.documents[path];
|
|
889
860
|
const after = resulting.documents[path];
|
|
890
|
-
if (
|
|
861
|
+
if (typedContent(before) || typedContent(after))
|
|
891
862
|
typedPaths.push(path);
|
|
892
863
|
await pace((before?.length ?? 0) + (after?.length ?? 0) + ROW_WEIGHT);
|
|
893
864
|
}
|
|
@@ -905,6 +876,7 @@ async function judging(visible, resulting, composition, validate, removed, touch
|
|
|
905
876
|
retryable: false,
|
|
906
877
|
file: verdict.file,
|
|
907
878
|
...(verdict.location === undefined ? {} : { location: verdict.location }),
|
|
879
|
+
...(verdict.line === undefined ? {} : { line: verdict.line }),
|
|
908
880
|
...(verdict.referrers === undefined ? {} : { referrers: verdict.referrers }),
|
|
909
881
|
},
|
|
910
882
|
};
|
|
@@ -920,8 +892,6 @@ function placed(reference) {
|
|
|
920
892
|
const key = roomPathOf(reference.handle, reference.path);
|
|
921
893
|
if (reference.kind === 'link')
|
|
922
894
|
return `link ${key}`;
|
|
923
|
-
if (reference.kind === 'item')
|
|
924
|
-
return `section ${reference.section} ${key}`;
|
|
925
895
|
const pointer = reference.pointer
|
|
926
896
|
.split('/')
|
|
927
897
|
.map((segment) => (ARRAY_INDEX.test(segment) ? '-' : segment))
|
|
@@ -953,7 +923,7 @@ function* admittedRooms(changes, visible, resulting, composition) {
|
|
|
953
923
|
continue;
|
|
954
924
|
if (held.has(placed(reference)))
|
|
955
925
|
continue;
|
|
956
|
-
return refuse('unresolved-reference', path, reference.
|
|
926
|
+
return refuse('unresolved-reference', path, reference.pointer);
|
|
957
927
|
}
|
|
958
928
|
yield ROW_WEIGHT + now.length;
|
|
959
929
|
}
|
|
@@ -971,7 +941,10 @@ function validationOf(validated) {
|
|
|
971
941
|
};
|
|
972
942
|
}
|
|
973
943
|
async function batching(input) {
|
|
974
|
-
const
|
|
944
|
+
const relative = relativeChanges(input);
|
|
945
|
+
if (relative.kind === 'refused')
|
|
946
|
+
return relative;
|
|
947
|
+
const { changes } = relative;
|
|
975
948
|
const structural = changes.find((change) => change.kind === 'move' || change.kind === 'remove');
|
|
976
949
|
if (structural !== undefined && input.unmodeled) {
|
|
977
950
|
return refuse('model-unavailable', structural.path);
|
|
@@ -981,7 +954,7 @@ async function batching(input) {
|
|
|
981
954
|
const rewritten = await stepped(rewrites(changes, input.visible));
|
|
982
955
|
if (rewritten.kind === 'refused')
|
|
983
956
|
return rewritten;
|
|
984
|
-
const refusal = guard(changes, input, WRITE);
|
|
957
|
+
const refusal = guard(changes, input, WRITE) ?? unapplied(changes, input.visible, input.composition);
|
|
985
958
|
if (refusal !== null)
|
|
986
959
|
return refusal;
|
|
987
960
|
const preconditions = await stepped(preconditionsOf(changes, input.visible, input.bases));
|
|
@@ -1120,6 +1093,14 @@ async function moving(input) {
|
|
|
1120
1093
|
return limited;
|
|
1121
1094
|
return { kind: 'moved', leaving: immutable(leavingBatch), arriving: immutable(arrivingBatch) };
|
|
1122
1095
|
}
|
|
1096
|
+
function unreadable(saved, visible, composition) {
|
|
1097
|
+
const path = saved.find(({ path: at, parts }) => (parts.fields !== undefined ||
|
|
1098
|
+
parts.sections !== undefined ||
|
|
1099
|
+
parts.preamble !== undefined) &&
|
|
1100
|
+
typedContent(visible.documents[at]) &&
|
|
1101
|
+
governing(composition, at).status === 'unavailable')?.path;
|
|
1102
|
+
return path === undefined ? null : refuse('model-unavailable', path);
|
|
1103
|
+
}
|
|
1123
1104
|
function changedUnderneath(saved, visible) {
|
|
1124
1105
|
const parts = saved.flatMap(({ path, parts: held }) => changedParts(path, held, visible));
|
|
1125
1106
|
return parts.length === 0
|
|
@@ -1201,7 +1182,7 @@ async function plannedMove(ask, source, into) {
|
|
|
1201
1182
|
async function plannedWithin(ask, room) {
|
|
1202
1183
|
const { record } = room;
|
|
1203
1184
|
const visible = await stepped(room.replay(room.queue));
|
|
1204
|
-
const changed = changedUnderneath(ask.saved, visible);
|
|
1185
|
+
const changed = unreadable(ask.saved, visible, room.composition) ?? changedUnderneath(ask.saved, visible);
|
|
1205
1186
|
if (changed !== null)
|
|
1206
1187
|
return changed;
|
|
1207
1188
|
const parts = ask.saved.map(({ path, parts: held }) => changesOf(path, held));
|
package/dist/saves.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
2
|
+
import type { ConversationFiles } from './conversation.js';
|
|
2
3
|
import { type AttachAnswer, type BinaryLinkAnswer, type HeldBinaryAnswer, type HeldShownAnswer } from './outcome.js';
|
|
3
4
|
import { type RoomDraftParts } from './room-draft.js';
|
|
4
5
|
import type { Runtime } from './runtime.js';
|
|
@@ -28,5 +29,6 @@ export type BinaryFileSurface = {
|
|
|
28
29
|
export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
29
30
|
export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
30
31
|
export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
|
|
32
|
+
export declare function conversationFiles(runtime: Runtime): ConversationFiles;
|
|
31
33
|
export declare function binaryFileSurface(runtime: Runtime): BinaryFileSurface;
|
|
32
34
|
//# sourceMappingURL=saves.d.ts.map
|
package/dist/saves.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saves.d.ts","sourceRoot":"","sources":["../src/saves.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"saves.d.ts","sourceRoot":"","sources":["../src/saves.ts"],"names":[],"mappings":"AAUA,OAAO,EAA2B,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAI3D,OAAO,EASL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAGrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAatB,OAAO,EAQL,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAGL,KAAK,WAAW,EAGjB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAsB,KAAK,EAAoB,MAAM,Y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OAAO,CAAC,UAAU,CAAC,CAsCrB;AAuBD,wBAAgB,SAAS,CACvB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,SAAS,GAAG,SAAS,GAC/B,OAAO,CAAC,UAAU,CAAC,CAyBrB;AAgOD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAK9F;AA+PD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAKrE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAQrE"}
|
package/dist/saves.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isImageType, parse } from '@agentshouse/mdmodel';
|
|
2
2
|
import { binaryRecord } from './binary.js';
|
|
3
|
+
import { changeSet } from './change-set.js';
|
|
3
4
|
import { queuedFile } from './change.js';
|
|
4
|
-
import { available } from './collection.js';
|
|
5
|
+
import { available, textType } from './collection.js';
|
|
5
6
|
import { runtimeError } from './failure.js';
|
|
6
7
|
import { attachedFile } from './file.js';
|
|
8
|
+
import { roomDraftRevision } from './identity.js';
|
|
7
9
|
import { compositionFor } from './listing.js';
|
|
8
10
|
import { scoped } from './models.js';
|
|
9
|
-
import { absentBinary, attachAnswer, binaryAnswer, binaryLinkAnswer, failure, OFFLINE, UNCERTAIN, } from './outcome.js';
|
|
11
|
+
import { absentBinary, attachAnswer, binaryAnswer, binaryLinkAnswer, failure, linkedAnswer, OFFLINE, UNCERTAIN, } from './outcome.js';
|
|
10
12
|
import { sameBinary } from './overlay.js';
|
|
11
13
|
import { ancestors } from './paths.js';
|
|
12
14
|
import { connectionNow } from './preparation.js';
|
|
13
15
|
import { append, sliceAt, withdrawable } from './queue.js';
|
|
14
16
|
import { entryAt, replaying, slicing, } from './replica.js';
|
|
15
|
-
import { binaryBase, changesOf, held, heldFile, moveTarget, readSavedParts, } from './room-draft.js';
|
|
17
|
+
import { binaryBase, changesOf, held, heldFile, joinedOver, moveTarget, readSavedParts, } from './room-draft.js';
|
|
16
18
|
import { refuse } from './refusal.js';
|
|
17
19
|
import { visibleOf } from './room-drafts.js';
|
|
18
20
|
import { destination, planSave, } from './save.js';
|
|
@@ -43,9 +45,24 @@ export function saveRoomDrafts(runtime, locator, named, writtenBy) {
|
|
|
43
45
|
if (!saved.some((draft) => draft.path === path))
|
|
44
46
|
saved.push({ path, parts: record.parts });
|
|
45
47
|
}
|
|
46
|
-
|
|
48
|
+
const result = await loaded(runtime, locator, replica, saved, new Set(saved.map(({ path }) => path)), [], writtenBy);
|
|
49
|
+
if (result.outcome !== 'refused' || result.code !== 'changed-underneath')
|
|
50
|
+
return result;
|
|
51
|
+
return joinedUnderneath(runtime, locator, saved.map(({ path }) => drafts.get(path)), result);
|
|
47
52
|
});
|
|
48
53
|
}
|
|
54
|
+
async function joinedUnderneath({ store }, locator, records, refused) {
|
|
55
|
+
const visible = (await visibleOf(store, locator, records.map(({ path }) => path)));
|
|
56
|
+
const joined = records.flatMap((record) => {
|
|
57
|
+
const join = joinedOver(record.parts, record.marks, record.path, visible);
|
|
58
|
+
return join === null ? [] : [{ ...record, ...join, revision: roomDraftRevision() }];
|
|
59
|
+
});
|
|
60
|
+
if (joined.length === 0)
|
|
61
|
+
return refused;
|
|
62
|
+
await (await store.open()).commit({ rooms: [], writes: [{ locator, roomDrafts: joined }] });
|
|
63
|
+
await store.changed(changeSet(locator, { drafts: joined.map(({ path }) => path) }));
|
|
64
|
+
return refused;
|
|
65
|
+
}
|
|
49
66
|
export function saveParts(runtime, locator, named, writtenBy) {
|
|
50
67
|
const { store } = runtime;
|
|
51
68
|
return store.exclusive(async () => {
|
|
@@ -162,8 +179,7 @@ function lookupOf(local, key, view) {
|
|
|
162
179
|
function declaredOf(entry) {
|
|
163
180
|
if (entry.binary !== null)
|
|
164
181
|
return { type: undefined, binary: true };
|
|
165
|
-
|
|
166
|
-
return { type: read.ok ? (read.frontmatter.type ?? 'any') : undefined, binary: false };
|
|
182
|
+
return { type: textType(parse(entry.content ?? '')), binary: false };
|
|
167
183
|
}
|
|
168
184
|
function overriddenLookup(lookup, overrides) {
|
|
169
185
|
return async (paths) => {
|
|
@@ -230,7 +246,7 @@ export function batchFile(store, batch) {
|
|
|
230
246
|
};
|
|
231
247
|
}
|
|
232
248
|
async function transferBinary(runtime, request, transfer, answer) {
|
|
233
|
-
const { store, socket, presence
|
|
249
|
+
const { store, socket, presence } = runtime;
|
|
234
250
|
const { session } = socket;
|
|
235
251
|
if (socket.closed() || session.now().refusal !== null)
|
|
236
252
|
return UNCERTAIN;
|
|
@@ -247,12 +263,10 @@ async function transferBinary(runtime, request, transfer, answer) {
|
|
|
247
263
|
if (closed || authorization === undefined || refusal !== null)
|
|
248
264
|
return UNCERTAIN;
|
|
249
265
|
const since = presence.losses();
|
|
250
|
-
journal.record(`transfer binary ${request.locator} ${request.path}`);
|
|
251
266
|
try {
|
|
252
267
|
const result = await transfer(authorization);
|
|
253
268
|
const settled = result;
|
|
254
|
-
|
|
255
|
-
if (presence.lostSince(request.locator, since))
|
|
269
|
+
if (request.locator !== null && presence.lostSince(request.locator, since))
|
|
256
270
|
return failure({ kind: 'room-not-readable', locator: request.locator });
|
|
257
271
|
if (settled.kind === 'scoped-refusal') {
|
|
258
272
|
const room = await store.record(settled.locator);
|
|
@@ -264,7 +278,6 @@ async function transferBinary(runtime, request, transfer, answer) {
|
|
|
264
278
|
return answer(result);
|
|
265
279
|
}
|
|
266
280
|
catch {
|
|
267
|
-
journal.record('outcome binary transport-uncertainty');
|
|
268
281
|
return UNCERTAIN;
|
|
269
282
|
}
|
|
270
283
|
}
|
|
@@ -377,11 +390,11 @@ async function showBinaryPath(runtime, locator, path, revision) {
|
|
|
377
390
|
if (kept !== null)
|
|
378
391
|
return kept;
|
|
379
392
|
const mediaType = await heldMediaType(store, locator, path);
|
|
380
|
-
if (mediaType
|
|
393
|
+
if (mediaType !== undefined && isImageType(mediaType))
|
|
381
394
|
return fetchBinary(runtime, asked, name);
|
|
382
395
|
return linkOf(runtime, asked, revision === undefined ? mediaType : undefined);
|
|
383
396
|
}
|
|
384
|
-
async function
|
|
397
|
+
async function attachFile(runtime, locator, file, answer) {
|
|
385
398
|
const { store, socket } = runtime;
|
|
386
399
|
await socket.ready;
|
|
387
400
|
await socket.firstDiscovery;
|
|
@@ -391,16 +404,27 @@ async function attachBinary(runtime, locator, file) {
|
|
|
391
404
|
socket.session.now().refusal !== null)
|
|
392
405
|
return OFFLINE;
|
|
393
406
|
const request = await attachedFile(locator, file);
|
|
394
|
-
return transferBinary(runtime, { locator
|
|
407
|
+
return transferBinary(runtime, { locator }, async (held) => {
|
|
395
408
|
const result = await socket.attach(held, request);
|
|
396
|
-
if (result.kind === 'attached') {
|
|
409
|
+
if (result.kind === 'attached' && locator !== null) {
|
|
397
410
|
store.attached.hold(locator, result.path, {
|
|
398
411
|
revision: result.revision,
|
|
399
412
|
mediaType: request.mediaType,
|
|
400
413
|
});
|
|
401
414
|
}
|
|
402
415
|
return result;
|
|
403
|
-
},
|
|
416
|
+
}, answer);
|
|
417
|
+
}
|
|
418
|
+
async function keyedAttachment(runtime, link) {
|
|
419
|
+
await runtime.socket.ready;
|
|
420
|
+
const asked = { kind: 'key', link };
|
|
421
|
+
return transferBinary(runtime, { locator: null }, (authorization) => runtime.socket.link(authorization, asked), (result) => binaryLinkAnswer(result));
|
|
422
|
+
}
|
|
423
|
+
export function conversationFiles(runtime) {
|
|
424
|
+
return {
|
|
425
|
+
attach: (file) => attachFile(runtime, null, file, linkedAnswer),
|
|
426
|
+
attachment: (link) => keyedAttachment(runtime, link),
|
|
427
|
+
};
|
|
404
428
|
}
|
|
405
429
|
export function binaryFileSurface(runtime) {
|
|
406
430
|
return {
|
|
@@ -408,6 +432,6 @@ export function binaryFileSurface(runtime) {
|
|
|
408
432
|
read: (room, path, revision) => readBinaryPath(runtime, room, path, revision),
|
|
409
433
|
link: (room, path, revision) => linkBinaryPath(runtime, room, path, revision),
|
|
410
434
|
show: (room, path, revision) => showBinaryPath(runtime, room, path, revision),
|
|
411
|
-
attach: (room, file) =>
|
|
435
|
+
attach: (room, file) => attachFile(runtime, room, file, attachAnswer),
|
|
412
436
|
};
|
|
413
437
|
}
|
package/dist/seed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../src/seed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../src/seed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAwB,KAAK,WAAW,EAAqB,MAAM,kBAAkB,CAAC;AAC7F,OAAO,KAAK,EAAE,IAAI,EAA4C,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;CACpF,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAEjG,KAAK,WAAW,GAAG,CACjB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,KAAK,KAAK,EACjD,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAChC,MAAM,IAAI,CAAC;AA0ChB,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAe5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAmBtD;AA+BD,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAOxF;AAYD,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAMlE;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,WAAW,GACjB,MAAM,IAAI,CA4BZ"}
|
package/dist/seed.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { queryKey } from '@agentshouse/mdmodel';
|
|
2
|
-
import { whole } from './observation.js';
|
|
2
|
+
import { pendingChange, whole } from './observation.js';
|
|
3
3
|
import { documentKey } from './rows.js';
|
|
4
4
|
const seedTopic = (key) => `seed\u0000${key}`;
|
|
5
5
|
function plain(value) {
|
|
@@ -130,7 +130,7 @@ export function watchSeeded(runtime, plan, deliver, watch) {
|
|
|
130
130
|
const watcher = store.watch(seedTopic(plan.key), shown);
|
|
131
131
|
const stop = watch((cover, held) => seedBehind(runtime, plan, cover, held), (message) => {
|
|
132
132
|
const answered = message;
|
|
133
|
-
pending = whole(answered)
|
|
133
|
+
pending = whole(answered) ? 'pending' in answered.result : pendingChange(answered);
|
|
134
134
|
if (pending && store.seeds.of(plan.key) !== undefined) {
|
|
135
135
|
shown();
|
|
136
136
|
return;
|
package/dist/shown.d.ts
CHANGED
|
@@ -10,15 +10,18 @@ export declare const REFUSAL_TOPIC = "connection-refusal";
|
|
|
10
10
|
export declare const STORAGE_LOSS_TOPIC = "storage-loss";
|
|
11
11
|
export declare const SERVICE_MODE_TOPIC = "service-mode";
|
|
12
12
|
export declare const MEMBER_TOPIC = "member";
|
|
13
|
+
export declare const TIME_ZONE_TOPIC = "time-zone";
|
|
13
14
|
export declare const AUTHORITY_TOPIC = "authority-changes";
|
|
14
15
|
export declare const LOCKS_TOPIC = "locks";
|
|
15
16
|
export declare const queueTopic: (locator: string) => string;
|
|
16
|
-
export declare function recoverReads({ liveQueries, figures }: Runtime): void;
|
|
17
|
+
export declare function recoverReads({ liveQueries, figures }: Runtime, locators?: readonly string[]): void;
|
|
17
18
|
export declare function emitRooms(runtime: Runtime, changed?: readonly string[]): Promise<void>;
|
|
18
19
|
export declare function emitKnownRooms(runtime: Runtime): void;
|
|
19
20
|
export declare function emitRefusal(runtime: Runtime): void;
|
|
20
|
-
export declare function
|
|
21
|
+
export declare function storageLossNow({ store }: Runtime): string | null;
|
|
22
|
+
export declare function emitStorageLoss(runtime: Runtime): void;
|
|
21
23
|
export declare function emitMember({ store }: Runtime, member: Member | null): void;
|
|
24
|
+
export declare function emitTimeZone({ store }: Runtime, zone: string | null): void;
|
|
22
25
|
export declare function show(runtime: Runtime): Promise<void>;
|
|
23
26
|
export declare function moveTo(runtime: Runtime, next: Moving): Promise<void>;
|
|
24
27
|
export declare function statusShown(runtime: Runtime): Promise<void>;
|
package/dist/shown.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shown.d.ts","sourceRoot":"","sources":["../src/shown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE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