@agentshouse/mdruntime 0.1.0-cede5a74284be → 0.1.0-cef5833f6c689
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 +19 -16
- package/dist/adapter.d.ts +153 -56
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +5 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +38 -4
- package/dist/attempt.d.ts.map +1 -1
- package/dist/attempt.js +14 -1
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +27 -11
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +185 -81
- package/dist/chain.d.ts +12 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +9 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -63
- package/dist/change.d.ts +31 -1
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +10 -1
- package/dist/client.d.ts +29 -16
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +98 -12
- package/dist/collection.d.ts +11 -7
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +38 -79
- package/dist/compile.d.ts +11 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +589 -0
- package/dist/connection.d.ts +44 -16
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +3759 -991
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/{chat/context.js → context.js} +1 -4
- package/dist/conversation.d.ts +39 -17
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +691 -259
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +4 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +20 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +160 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/file.d.ts +2 -19
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +7 -122
- package/dist/host.d.ts +11 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +122 -19
- package/dist/index.d.ts +19 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +28 -0
- package/dist/live.d.ts +23 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +127 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +17 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +214 -94
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +89 -0
- package/dist/model.d.ts +10 -4
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +8 -5
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +22 -4
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +120 -14
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +49 -7
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +40 -0
- package/dist/overlay.d.ts +3 -4
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +100 -182
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +41 -183
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -464
- package/dist/reach.d.ts +18 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +221 -80
- package/dist/react.d.ts +10 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/readiness.d.ts +50 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +27 -0
- package/dist/recovery.d.ts +26 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +224 -0
- package/dist/refresh.d.ts +17 -14
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +155 -51
- package/dist/replica.d.ts +56 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +301 -154
- package/dist/room-draft.d.ts +37 -6
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +161 -74
- package/dist/rows.d.ts +21 -37
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +63 -122
- package/dist/save.d.ts +52 -9
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +539 -171
- package/dist/search.d.ts +15 -55
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -121
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +421 -0
- package/dist/status.d.ts +5 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +110 -76
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +341 -442
- package/dist/stored.d.ts +162 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +543 -0
- package/dist/tables.d.ts +352 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +586 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +75 -0
- package/dist/validation.d.ts +29 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +104 -0
- package/dist/windows.d.ts +11 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +16 -0
- package/dist/wire.d.ts +165 -32
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +56 -31
- package/package.json +22 -19
- package/AGENTS.md +0 -318
- package/dist/chat/acts.d.ts +0 -34
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/input.d.ts +0 -9
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -99
- package/dist/chat/kit.d.ts +0 -60
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -20
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -59
- package/dist/chat/markdown.d.ts +0 -19
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -187
- package/dist/chat/message.d.ts +0 -6
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -192
- package/dist/chat/messages.d.ts +0 -21
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -151
- package/dist/chat/name.d.ts +0 -6
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -11
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -17
- package/dist/chat/overlay.d.ts +0 -31
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -97
- package/dist/chat/parts.d.ts +0 -57
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -119
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -63
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -645
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -80
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -33
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -91
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -302
- package/dist/chat.d.ts +0 -14
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/read-side.d.ts +0 -18
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -440
package/dist/replica.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replica.d.ts","sourceRoot":"","sources":["../src/replica.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replica.d.ts","sourceRoot":"","sources":["../src/replica.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,EACV,kBAAkB,EAElB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAmC,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAiD,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,W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CACrC,CAAC;AAEF,wBAAgB,aAAa,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAiBrF;AAED,wBAAiB,SAAS,CACxB,SAAS,EAAE,KAAK,EAChB,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,GAChB,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CA+EnC"}
|
package/dist/replica.js
CHANGED
|
@@ -1,174 +1,198 @@
|
|
|
1
1
|
import { equalValue, parse } from '@agentshouse/mdmodel';
|
|
2
2
|
import { immutable, landing } from './change.js';
|
|
3
|
-
import { collectionOf
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { collectionOf } from './collection.js';
|
|
4
|
+
import { storedModel } from './model.js';
|
|
5
|
+
import { acceptedBinaries, overlaying } from './overlay.js';
|
|
6
|
+
import { effectiveIn, rewriting } from './save.js';
|
|
7
|
+
import { ROW_WEIGHT } from './turn.js';
|
|
8
|
+
export function compositionOf(record, builtIn, typedPaths) {
|
|
7
9
|
return {
|
|
8
10
|
model: record.model,
|
|
9
11
|
selection: record.typedSelection === null
|
|
10
12
|
? null
|
|
11
|
-
: { roots: record.typedSelection.roots, model:
|
|
13
|
+
: { roots: record.typedSelection.roots, model: builtIn },
|
|
14
|
+
typedPaths,
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
|
-
export function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
collection: collectionOf(record.documents, compositionOf(record), previous?.collection),
|
|
18
|
-
};
|
|
17
|
+
export function storedRecord(record) {
|
|
18
|
+
const { key: _key, ...stored } = record;
|
|
19
|
+
return JSON.stringify({ ...stored, model: storedModel(stored.model) });
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
record.selectionModel !== previous?.record.selectionModel)) {
|
|
31
|
-
const verdict = validateCollection(record.documents, Object.keys(record.binaries), compositionOf(record));
|
|
32
|
-
if (verdict.verdict === 'refuse' && verdict.rule !== 'model-unavailable') {
|
|
33
|
-
return { kind: 'refused', refusal: verdict };
|
|
34
|
-
}
|
|
35
|
-
if (verdict.verdict === 'refuse') {
|
|
36
|
-
const refused = unreadable(record.documents, previous?.record.documents);
|
|
37
|
-
if (refused !== null)
|
|
38
|
-
return refused;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else if (textChanged) {
|
|
42
|
-
const refused = unreadable(record.documents, previous?.record.documents);
|
|
43
|
-
if (refused !== null)
|
|
44
|
-
return refused;
|
|
21
|
+
const PROBES = new Set([
|
|
22
|
+
'then',
|
|
23
|
+
'toJSON',
|
|
24
|
+
'constructor',
|
|
25
|
+
'valueOf',
|
|
26
|
+
'toString',
|
|
27
|
+
]);
|
|
28
|
+
class UnreadPath extends Error {
|
|
29
|
+
constructor(path) {
|
|
30
|
+
super(`the replica slice holds no row for ${path}`);
|
|
45
31
|
}
|
|
46
|
-
return { kind: 'staged', confirmed: confirmedOf(record, previous) };
|
|
47
32
|
}
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
33
|
+
function strict(values, held) {
|
|
34
|
+
const guard = (property) => {
|
|
35
|
+
if (typeof property === 'string' && !held.has(property) && !PROBES.has(property)) {
|
|
36
|
+
throw new UnreadPath(property);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return new Proxy(values, {
|
|
40
|
+
get(target, property, receiver) {
|
|
41
|
+
guard(property);
|
|
42
|
+
return Reflect.get(target, property, receiver);
|
|
43
|
+
},
|
|
44
|
+
has(target, property) {
|
|
45
|
+
guard(property);
|
|
46
|
+
return Reflect.has(target, property);
|
|
47
|
+
},
|
|
48
|
+
getOwnPropertyDescriptor(target, property) {
|
|
49
|
+
guard(property);
|
|
50
|
+
return Reflect.getOwnPropertyDescriptor(target, property);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
55
53
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
for (const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
export function* slicing(entries, paths) {
|
|
55
|
+
const held = new Set(paths);
|
|
56
|
+
for (const entry of entries)
|
|
57
|
+
held.add(entry.path);
|
|
58
|
+
const documents = {};
|
|
59
|
+
const binaries = {};
|
|
60
|
+
const revisions = {};
|
|
61
|
+
const fileIds = {};
|
|
62
|
+
const changes = {};
|
|
63
|
+
const written = {};
|
|
64
|
+
for (const entry of entries) {
|
|
65
|
+
if (entry.binary !== null)
|
|
66
|
+
binaries[entry.path] = entry.binary;
|
|
67
|
+
else if (entry.content !== null)
|
|
68
|
+
documents[entry.path] = entry.content;
|
|
69
|
+
if (entry.revision !== null)
|
|
70
|
+
revisions[entry.path] = entry.revision;
|
|
71
|
+
if (entry.fileId !== null)
|
|
72
|
+
fileIds[entry.path] = entry.fileId;
|
|
73
|
+
if (entry.change !== null)
|
|
74
|
+
changes[entry.path] = entry.change;
|
|
75
|
+
if (entry.written !== null)
|
|
76
|
+
written[entry.path] = entry.written;
|
|
77
|
+
yield ROW_WEIGHT;
|
|
66
78
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
return {
|
|
80
|
+
documents: strict(documents, held),
|
|
81
|
+
binaries: strict(binaries, held),
|
|
82
|
+
revisions: strict(revisions, held),
|
|
83
|
+
fileIds: strict(fileIds, held),
|
|
84
|
+
changes: strict(changes, held),
|
|
85
|
+
written: strict(written, held),
|
|
86
|
+
held,
|
|
87
|
+
};
|
|
71
88
|
}
|
|
72
|
-
export function
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
export function entryAt(layer, path) {
|
|
90
|
+
const content = layer.documents[path];
|
|
91
|
+
const binary = layer.binaries[path];
|
|
92
|
+
if (content === undefined && binary === undefined)
|
|
93
|
+
return null;
|
|
94
|
+
return {
|
|
95
|
+
path,
|
|
96
|
+
content: content ?? null,
|
|
97
|
+
outline: null,
|
|
98
|
+
binary: binary ?? null,
|
|
99
|
+
revision: layer.revisions[path] ?? null,
|
|
100
|
+
fileId: layer.fileIds[path] ?? null,
|
|
101
|
+
change: layer.changes[path] ?? null,
|
|
102
|
+
written: layer.written?.[path] ?? null,
|
|
80
103
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
104
|
+
}
|
|
105
|
+
export function* slicingWith(slice, set, removed) {
|
|
106
|
+
const entries = new Map();
|
|
107
|
+
for (const path of slice.held) {
|
|
108
|
+
const entry = entryAt(slice, path);
|
|
109
|
+
if (entry !== null)
|
|
110
|
+
entries.set(path, { ...entry, type: null });
|
|
111
|
+
yield ROW_WEIGHT;
|
|
84
112
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
113
|
+
for (const path of removed)
|
|
114
|
+
entries.delete(path);
|
|
115
|
+
for (const entry of set)
|
|
116
|
+
entries.set(entry.path, { ...entry, type: null });
|
|
117
|
+
return yield* slicing([...entries.values()], [...slice.held, ...set.map(({ path }) => path), ...removed]);
|
|
118
|
+
}
|
|
119
|
+
function changePaths(change) {
|
|
120
|
+
return change.kind === 'move' ? [change.path, change.to] : [change.path];
|
|
121
|
+
}
|
|
122
|
+
export function touchedBy(queue) {
|
|
123
|
+
const paths = new Set();
|
|
124
|
+
for (const batch of queue) {
|
|
125
|
+
for (const change of batch.changes)
|
|
126
|
+
for (const path of changePaths(change))
|
|
127
|
+
paths.add(path);
|
|
128
|
+
for (const precondition of batch.preconditions)
|
|
129
|
+
paths.add(precondition.path);
|
|
130
|
+
for (const move of batch.between?.moves ?? [])
|
|
131
|
+
paths.add(move.path);
|
|
91
132
|
}
|
|
92
|
-
return
|
|
93
|
-
...confirmed.record,
|
|
94
|
-
roomVersion,
|
|
95
|
-
documents: nextDocuments,
|
|
96
|
-
revisions: nextRevisions,
|
|
97
|
-
changes: nextChanges,
|
|
98
|
-
written: nextWritten,
|
|
99
|
-
binaries: returnedBinaries(confirmed.record.binaries, submitted, accepted),
|
|
100
|
-
}, confirmed);
|
|
133
|
+
return paths;
|
|
101
134
|
}
|
|
102
|
-
function
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
old.collection.composition.selection?.model === composition.selection?.model &&
|
|
115
|
-
JSON.stringify(old.collection.composition.selection?.roots) ===
|
|
116
|
-
JSON.stringify(composition.selection?.roots);
|
|
117
|
-
const collection = hasMove
|
|
118
|
-
? reuseRewrite
|
|
119
|
-
? old.collection
|
|
120
|
-
: collectionOf(before.documents, composition, old?.collection ?? confirmed.collection)
|
|
121
|
-
: undefined;
|
|
122
|
-
const effective = collection === undefined
|
|
123
|
-
? batch
|
|
124
|
-
: reuseRewrite
|
|
125
|
-
? old.effective
|
|
126
|
-
: providerRewritten(batch, { ...before, collection });
|
|
127
|
-
layer =
|
|
128
|
-
old === undefined
|
|
129
|
-
? overlay(before, [effective])
|
|
130
|
-
: overlayChanged(before, [effective], old.before, [old.effective], old.after);
|
|
131
|
-
replay.push({
|
|
132
|
-
id: batch.id,
|
|
133
|
-
before,
|
|
134
|
-
after: layer,
|
|
135
|
-
effective,
|
|
136
|
-
...(collection === undefined ? {} : { collection }),
|
|
137
|
-
});
|
|
135
|
+
export function movedBy(queue, locator) {
|
|
136
|
+
const paths = new Set();
|
|
137
|
+
for (const batch of queue) {
|
|
138
|
+
if (!rewriting(batch, locator))
|
|
139
|
+
continue;
|
|
140
|
+
for (const change of batch.changes)
|
|
141
|
+
if (change.kind === 'move')
|
|
142
|
+
paths.add(change.path);
|
|
143
|
+
if (batch.between?.source.room === locator) {
|
|
144
|
+
for (const move of batch.between.moves)
|
|
145
|
+
paths.add(move.path);
|
|
146
|
+
}
|
|
138
147
|
}
|
|
139
|
-
return
|
|
148
|
+
return paths;
|
|
140
149
|
}
|
|
141
|
-
export function
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
export function* replaying(confirmed, queue, locator, composition) {
|
|
151
|
+
let layer = confirmed;
|
|
152
|
+
const touched = new Set();
|
|
153
|
+
for (const batch of queue) {
|
|
154
|
+
const effective = rewriting(batch, locator)
|
|
155
|
+
? yield* effectiveIn(batch, locator, {
|
|
156
|
+
...layer,
|
|
157
|
+
collection: collectionOf(layer.documents, composition),
|
|
158
|
+
})
|
|
159
|
+
: batch;
|
|
160
|
+
for (const change of effective.changes)
|
|
161
|
+
for (const path of changePaths(change))
|
|
162
|
+
touched.add(path);
|
|
163
|
+
layer = yield* overlaying(layer, [effective]);
|
|
164
|
+
yield ROW_WEIGHT;
|
|
156
165
|
}
|
|
157
|
-
const { layer, replay } = predicted(confirmed, batches, previous);
|
|
158
166
|
return {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
replay,
|
|
162
|
-
visible: {
|
|
163
|
-
...layer,
|
|
164
|
-
collection: collectionOf(layer.documents, compositionOf(confirmed.record), previous?.visible.collection ?? confirmed.collection),
|
|
165
|
-
},
|
|
167
|
+
visible: { ...layer, collection: collectionOf(layer.documents, composition) },
|
|
168
|
+
touched,
|
|
166
169
|
};
|
|
167
170
|
}
|
|
171
|
+
export function* overlayOf(visible, touched) {
|
|
172
|
+
const rows = [];
|
|
173
|
+
for (const path of touched) {
|
|
174
|
+
yield ROW_WEIGHT;
|
|
175
|
+
const entry = entryAt(visible, path);
|
|
176
|
+
rows.push(entry === null
|
|
177
|
+
? {
|
|
178
|
+
path,
|
|
179
|
+
present: false,
|
|
180
|
+
content: null,
|
|
181
|
+
outline: null,
|
|
182
|
+
binary: null,
|
|
183
|
+
revision: null,
|
|
184
|
+
fileId: null,
|
|
185
|
+
change: null,
|
|
186
|
+
written: null,
|
|
187
|
+
}
|
|
188
|
+
: { ...entry, written: null, present: true });
|
|
189
|
+
}
|
|
190
|
+
return rows;
|
|
191
|
+
}
|
|
168
192
|
function present(layer, path) {
|
|
169
193
|
return layer.documents[path] !== undefined || layer.binaries[path] !== undefined;
|
|
170
194
|
}
|
|
171
|
-
function holds(layer, preconditions) {
|
|
195
|
+
export function holds(layer, preconditions) {
|
|
172
196
|
const parsed = new Map();
|
|
173
197
|
const documentAt = (path) => {
|
|
174
198
|
if (!parsed.has(path)) {
|
|
@@ -233,12 +257,19 @@ function effects(change) {
|
|
|
233
257
|
{ kind: 'present', path: change.to },
|
|
234
258
|
];
|
|
235
259
|
}
|
|
236
|
-
if (change.kind === 'binary')
|
|
260
|
+
if (change.kind === 'binary' || change.kind === 'arrival')
|
|
237
261
|
return [{ kind: 'present', path }];
|
|
238
262
|
return [{ kind: 'absent', path }];
|
|
239
263
|
}
|
|
240
264
|
export function landed(batch, confirmed, current = {}) {
|
|
241
|
-
const
|
|
265
|
+
const documents = new Proxy(confirmed.documents, {
|
|
266
|
+
get(target, property, receiver) {
|
|
267
|
+
if (typeof property === 'string' && Object.hasOwn(current, property))
|
|
268
|
+
return current[property];
|
|
269
|
+
return Reflect.get(target, property, receiver);
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
const layer = { ...confirmed, documents };
|
|
242
273
|
return batch.changes.every((change, index) => {
|
|
243
274
|
if (change.kind === 'replace' || (change.kind === 'create' && 'content' in change)) {
|
|
244
275
|
const at = landing(batch.changes, index, change.path);
|
|
@@ -256,32 +287,148 @@ export function landed(batch, confirmed, current = {}) {
|
|
|
256
287
|
});
|
|
257
288
|
});
|
|
258
289
|
}
|
|
259
|
-
|
|
290
|
+
function founded(batch, layer) {
|
|
291
|
+
let changed = false;
|
|
292
|
+
const preconditions = batch.preconditions.map((precondition) => {
|
|
293
|
+
if (precondition.kind !== 'content')
|
|
294
|
+
return precondition;
|
|
295
|
+
const revision = layer.revisions[precondition.path];
|
|
296
|
+
if (revision === undefined || layer.documents[precondition.path] !== precondition.content) {
|
|
297
|
+
return precondition;
|
|
298
|
+
}
|
|
299
|
+
changed = true;
|
|
300
|
+
return { kind: 'revision', path: precondition.path, revision };
|
|
301
|
+
});
|
|
302
|
+
return changed ? immutable({ ...batch, preconditions }) : batch;
|
|
303
|
+
}
|
|
304
|
+
export function* standing(confirmed, queue, withdrawable, local, locator, composition) {
|
|
260
305
|
if (!queue.some(withdrawable))
|
|
261
|
-
return [];
|
|
262
|
-
|
|
263
|
-
let layer = confirmed.record;
|
|
306
|
+
return { withdrawn: [], kept: queue };
|
|
307
|
+
let layer = confirmed;
|
|
264
308
|
const withdrawn = [];
|
|
309
|
+
const kept = [];
|
|
265
310
|
for (const batch of queue) {
|
|
266
311
|
if (withdrawable(batch) && !holds(layer, batch.preconditions)) {
|
|
267
312
|
withdrawn.push(batch);
|
|
268
313
|
continue;
|
|
269
314
|
}
|
|
270
|
-
const effective = batch
|
|
271
|
-
?
|
|
315
|
+
const effective = rewriting(batch, locator)
|
|
316
|
+
? yield* effectiveIn(batch, locator, {
|
|
272
317
|
...layer,
|
|
273
318
|
collection: collectionOf(layer.documents, composition),
|
|
274
319
|
})
|
|
275
320
|
: batch;
|
|
276
321
|
let unapplied = false;
|
|
277
|
-
const next =
|
|
322
|
+
const next = yield* overlaying(layer, [effective], () => {
|
|
278
323
|
unapplied = true;
|
|
279
324
|
});
|
|
280
325
|
if (local && unapplied) {
|
|
281
326
|
withdrawn.push(batch);
|
|
282
327
|
continue;
|
|
283
328
|
}
|
|
329
|
+
kept.push(local || !withdrawable(batch) ? batch : founded(batch, layer));
|
|
284
330
|
layer = next;
|
|
285
331
|
}
|
|
286
|
-
return withdrawn;
|
|
332
|
+
return { withdrawn, kept };
|
|
333
|
+
}
|
|
334
|
+
export function returnedPaths(submitted, accepted) {
|
|
335
|
+
const paths = new Set([
|
|
336
|
+
...Object.keys(accepted.documents),
|
|
337
|
+
...Object.keys(accepted.revisions),
|
|
338
|
+
...Object.keys(accepted.fileIds ?? {}),
|
|
339
|
+
...Object.keys(accepted.changes),
|
|
340
|
+
...Object.keys(accepted.binaryFiles ?? {}),
|
|
341
|
+
...accepted.removals,
|
|
342
|
+
]);
|
|
343
|
+
for (const change of submitted.changes) {
|
|
344
|
+
if (change.kind === 'move') {
|
|
345
|
+
paths.add(change.path);
|
|
346
|
+
paths.add(change.to);
|
|
347
|
+
}
|
|
348
|
+
if (change.kind === 'arrival')
|
|
349
|
+
paths.add(change.path);
|
|
350
|
+
}
|
|
351
|
+
return paths;
|
|
352
|
+
}
|
|
353
|
+
export function* returning(confirmed, submitted, accepted, writtenAt) {
|
|
354
|
+
const documents = new Map();
|
|
355
|
+
const binaries = new Map();
|
|
356
|
+
const revisions = new Map();
|
|
357
|
+
const fileIds = new Map();
|
|
358
|
+
const changes = new Map();
|
|
359
|
+
const written = new Map();
|
|
360
|
+
const read = (changed, held, path) => (changed.has(path) ? changed.get(path) : held[path]);
|
|
361
|
+
for (const [path, content] of Object.entries(accepted.documents)) {
|
|
362
|
+
yield ROW_WEIGHT;
|
|
363
|
+
documents.set(path, content);
|
|
364
|
+
fileIds.set(path, undefined);
|
|
365
|
+
written.set(path, writtenAt);
|
|
366
|
+
}
|
|
367
|
+
for (const [path, revision] of Object.entries(accepted.revisions)) {
|
|
368
|
+
yield ROW_WEIGHT;
|
|
369
|
+
revisions.set(path, revision);
|
|
370
|
+
fileIds.set(path, undefined);
|
|
371
|
+
if (confirmed.revisions[path] !== revision)
|
|
372
|
+
changes.set(path, undefined);
|
|
373
|
+
}
|
|
374
|
+
for (const [path, fileId] of Object.entries(accepted.fileIds ?? {}))
|
|
375
|
+
fileIds.set(path, fileId);
|
|
376
|
+
for (const [path, change] of Object.entries(accepted.changes))
|
|
377
|
+
changes.set(path, change);
|
|
378
|
+
for (const path of accepted.removals) {
|
|
379
|
+
documents.set(path, undefined);
|
|
380
|
+
revisions.set(path, undefined);
|
|
381
|
+
fileIds.set(path, undefined);
|
|
382
|
+
changes.set(path, undefined);
|
|
383
|
+
written.set(path, undefined);
|
|
384
|
+
}
|
|
385
|
+
for (const change of submitted.changes) {
|
|
386
|
+
if (change.kind === 'arrival' && 'binary' in change) {
|
|
387
|
+
if (accepted.revisions[change.path] !== undefined) {
|
|
388
|
+
binaries.set(change.path, { state: 'accepted', ...change.binary });
|
|
389
|
+
}
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (change.kind !== 'move')
|
|
393
|
+
continue;
|
|
394
|
+
const moved = read(binaries, confirmed.binaries, change.path);
|
|
395
|
+
if (moved === undefined || accepted.revisions[change.to] === undefined)
|
|
396
|
+
continue;
|
|
397
|
+
binaries.set(change.to, moved);
|
|
398
|
+
binaries.set(change.path, undefined);
|
|
399
|
+
}
|
|
400
|
+
for (const [path, binary] of acceptedBinaries(accepted.binaryFiles ?? {}))
|
|
401
|
+
binaries.set(path, binary);
|
|
402
|
+
for (const path of accepted.removals)
|
|
403
|
+
binaries.set(path, undefined);
|
|
404
|
+
const paths = new Set([
|
|
405
|
+
...documents.keys(),
|
|
406
|
+
...binaries.keys(),
|
|
407
|
+
...revisions.keys(),
|
|
408
|
+
...fileIds.keys(),
|
|
409
|
+
...changes.keys(),
|
|
410
|
+
...written.keys(),
|
|
411
|
+
]);
|
|
412
|
+
const set = [];
|
|
413
|
+
const removed = [];
|
|
414
|
+
for (const path of paths) {
|
|
415
|
+
yield ROW_WEIGHT;
|
|
416
|
+
const content = read(documents, confirmed.documents, path);
|
|
417
|
+
const binary = read(binaries, confirmed.binaries, path);
|
|
418
|
+
if (content === undefined && binary === undefined) {
|
|
419
|
+
removed.push(path);
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
set.push({
|
|
423
|
+
path,
|
|
424
|
+
content: binary === undefined ? (content ?? null) : null,
|
|
425
|
+
outline: null,
|
|
426
|
+
binary: binary ?? null,
|
|
427
|
+
revision: read(revisions, confirmed.revisions, path) ?? null,
|
|
428
|
+
fileId: read(fileIds, confirmed.fileIds, path) ?? null,
|
|
429
|
+
change: read(changes, confirmed.changes, path) ?? null,
|
|
430
|
+
written: read(written, confirmed.written, path) ?? null,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
return { set, removed };
|
|
287
434
|
}
|
package/dist/room-draft.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export type RoomDraftParts = {
|
|
|
32
32
|
readonly creation?: RoomDraftCreation;
|
|
33
33
|
readonly move?: {
|
|
34
34
|
readonly to: string;
|
|
35
|
+
readonly room?: string;
|
|
35
36
|
readonly base?: string | null;
|
|
36
37
|
};
|
|
37
38
|
readonly removal?: {
|
|
@@ -39,11 +40,12 @@ export type RoomDraftParts = {
|
|
|
39
40
|
};
|
|
40
41
|
readonly file?: {
|
|
41
42
|
readonly blob: Blob;
|
|
43
|
+
readonly base?: string | null;
|
|
42
44
|
};
|
|
43
45
|
};
|
|
44
46
|
export type HeldFile = {
|
|
45
|
-
readonly blob: Blob;
|
|
46
47
|
readonly localId: string;
|
|
48
|
+
readonly name?: string;
|
|
47
49
|
readonly byteLength: number;
|
|
48
50
|
readonly mediaType: string;
|
|
49
51
|
readonly sha256: string;
|
|
@@ -69,6 +71,7 @@ type HeldParts = {
|
|
|
69
71
|
readonly creation?: RoomDraftCreation;
|
|
70
72
|
readonly move?: {
|
|
71
73
|
readonly to: string;
|
|
74
|
+
readonly room?: string;
|
|
72
75
|
readonly base: string | null;
|
|
73
76
|
};
|
|
74
77
|
readonly removal?: {
|
|
@@ -87,9 +90,9 @@ type ChangedUnderneath = {
|
|
|
87
90
|
readonly file?: string | null;
|
|
88
91
|
};
|
|
89
92
|
export type ReturnReason = ProviderRefusal & {
|
|
90
|
-
readonly kind: 'conflicted' | 'rejected' | '
|
|
93
|
+
readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
|
|
91
94
|
};
|
|
92
|
-
export declare function returnedBy(kind: '
|
|
95
|
+
export declare function returnedBy(kind: 'withdrawn'): ReturnReason;
|
|
93
96
|
export type RoomDraft = {
|
|
94
97
|
readonly room: string;
|
|
95
98
|
readonly path: string;
|
|
@@ -110,7 +113,7 @@ export type RoomDraftWrite = {
|
|
|
110
113
|
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
111
114
|
export type ChangedPart = {
|
|
112
115
|
readonly path: string;
|
|
113
|
-
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | '
|
|
116
|
+
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'move' | 'removal' | 'file'>;
|
|
114
117
|
readonly name?: string;
|
|
115
118
|
};
|
|
116
119
|
export type RoomDraftRecord = {
|
|
@@ -124,16 +127,44 @@ export type SavedDraft = {
|
|
|
124
127
|
readonly path: string;
|
|
125
128
|
readonly parts: HeldParts;
|
|
126
129
|
};
|
|
127
|
-
export declare function readParts(value: unknown): RoomDraftParts;
|
|
130
|
+
export declare function readParts(value: unknown, path: string): RoomDraftParts;
|
|
131
|
+
export declare function gatheredParts(earlier: unknown, later: unknown): unknown;
|
|
128
132
|
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
|
|
129
133
|
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
130
134
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
131
135
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
132
|
-
export declare function changedParts(path: string,
|
|
136
|
+
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
137
|
+
export declare function lineEnded(text: string): string;
|
|
138
|
+
export type TextParts = {
|
|
139
|
+
readonly fields?: Readonly<Record<string, {
|
|
140
|
+
readonly value: unknown;
|
|
141
|
+
}>>;
|
|
142
|
+
readonly sections?: Readonly<Record<string, {
|
|
143
|
+
readonly value: string;
|
|
144
|
+
}>>;
|
|
145
|
+
readonly preamble?: {
|
|
146
|
+
readonly value: string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
133
150
|
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
134
151
|
export declare function moveTarget(move: {
|
|
135
152
|
readonly to: string;
|
|
136
153
|
}): string;
|
|
154
|
+
export declare function readSavedParts(named: readonly {
|
|
155
|
+
readonly path: string;
|
|
156
|
+
readonly parts: unknown;
|
|
157
|
+
}[]): readonly {
|
|
158
|
+
readonly path: string;
|
|
159
|
+
readonly parts: RoomDraftParts;
|
|
160
|
+
}[];
|
|
161
|
+
export declare function partsChanges(named: readonly {
|
|
162
|
+
readonly path: string;
|
|
163
|
+
readonly parts: unknown;
|
|
164
|
+
}[]): {
|
|
165
|
+
readonly changes: readonly Change[];
|
|
166
|
+
readonly preconditions: readonly Precondition[];
|
|
167
|
+
};
|
|
137
168
|
export declare function changesOf(path: string, parts: HeldParts): {
|
|
138
169
|
changes: readonly Change[];
|
|
139
170
|
bases: readonly Precondition[];
|