@agentshouse/mdruntime 0.1.0-c698c0ebd65bd → 0.1.0-c6b1e70f2da66
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/acceptance.d.ts +6 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +387 -0
- package/dist/actions.d.ts +20 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +251 -0
- package/dist/adapter.d.ts +155 -86
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +7 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +40 -41
- 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 +31 -11
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +324 -93
- package/dist/cell.d.ts +6 -0
- package/dist/cell.d.ts.map +1 -0
- package/dist/cell.js +9 -0
- 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 +32 -1
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +14 -3
- package/dist/chat-types.d.ts +5 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +13 -0
- package/dist/client.d.ts +45 -16
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +104 -13
- package/dist/collection.d.ts +31 -9
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +49 -80
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +711 -0
- package/dist/connection.d.ts +8 -117
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +106 -2486
- 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-live.d.ts +135 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +247 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +53 -0
- package/dist/conversation.d.ts +55 -42
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +985 -649
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/discovery.d.ts +10 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +175 -0
- package/dist/durability.d.ts +19 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +7 -4
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +33 -28
- package/dist/expectation.d.ts +4 -2
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +33 -11
- package/dist/failure.d.ts +1 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -0
- package/dist/figures.d.ts +49 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/file.d.ts +2 -19
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +7 -122
- package/dist/holdings.d.ts +29 -0
- package/dist/holdings.d.ts.map +1 -0
- package/dist/holdings.js +95 -0
- package/dist/host.d.ts +11 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +127 -20
- package/dist/index.d.ts +35 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/install.d.ts +56 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +556 -0
- package/dist/job.d.ts +5 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +7 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +270 -0
- package/dist/listing.d.ts +53 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +176 -0
- package/dist/live.d.ts +23 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +165 -0
- package/dist/locks.d.ts +9 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +62 -0
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +61 -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 +19 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +251 -97
- package/dist/messages.d.ts +49 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +148 -0
- package/dist/model.d.ts +11 -12
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -15
- package/dist/models.d.ts +14 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +197 -0
- 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 +127 -26
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +60 -0
- package/dist/outcome.d.ts +49 -8
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +42 -0
- package/dist/overlay.d.ts +5 -4
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +132 -192
- package/dist/parts.d.ts +11 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +21 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +26 -0
- package/dist/preparation.d.ts +20 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +233 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +272 -0
- package/dist/query.d.ts +49 -183
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -464
- package/dist/{chat/questions.d.ts → questions.d.ts} +5 -2
- package/dist/questions.d.ts.map +1 -0
- package/dist/{chat/questions.js → questions.js} +13 -2
- package/dist/reach.d.ts +21 -7
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +292 -91
- package/dist/react.d.ts +20 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +17 -18
- package/dist/{chat/read.d.ts → read.d.ts} +2 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/{chat/read.js → read.js} +4 -0
- package/dist/readiness.d.ts +49 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +27 -0
- package/dist/reads.d.ts +37 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +174 -0
- package/dist/recovery.d.ts +26 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +232 -0
- package/dist/refresh.d.ts +17 -14
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +143 -51
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +57 -0
- package/dist/replica.d.ts +56 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +338 -159
- package/dist/room-draft.d.ts +39 -9
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +186 -86
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +217 -0
- package/dist/rows.d.ts +30 -37
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +60 -128
- package/dist/runtime.d.ts +43 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +58 -10
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +569 -189
- package/dist/saves.d.ts +70 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +1008 -0
- 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 +25 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +145 -0
- package/dist/shared.d.ts +10 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +339 -0
- package/dist/shown.d.ts +31 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +290 -0
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/lanes.d.ts +20 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +77 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket/rooms.d.ts +44 -0
- package/dist/socket/rooms.d.ts.map +1 -0
- package/dist/socket/rooms.js +90 -0
- package/dist/socket/session.d.ts +38 -0
- package/dist/socket/session.d.ts.map +1 -0
- package/dist/socket/session.js +23 -0
- package/dist/socket.d.ts +70 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +175 -0
- package/dist/source.d.ts +61 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +82 -0
- package/dist/status.d.ts +5 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- package/dist/store/fences.d.ts +16 -0
- package/dist/store/fences.d.ts.map +1 -0
- package/dist/store/fences.js +26 -0
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/readiness.d.ts +10 -0
- package/dist/store/readiness.d.ts.map +1 -0
- package/dist/store/readiness.js +52 -0
- package/dist/store/records.d.ts +210 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +428 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/space.d.ts +11 -0
- package/dist/store/space.d.ts.map +1 -0
- package/dist/store/space.js +41 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +56 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +106 -127
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +136 -575
- package/dist/stored.d.ts +156 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +649 -0
- package/dist/surface.d.ts +88 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +224 -0
- package/dist/sync.d.ts +19 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +532 -0
- package/dist/tables.d.ts +412 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +737 -0
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -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 +181 -33
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +62 -31
- package/package.json +19 -19
- package/AGENTS.md +0 -299
- package/dist/chat/acts.d.ts +0 -33
- 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 -26
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -62
- package/dist/chat/markdown.d.ts +0 -20
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -188
- 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 -620
- 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.map +0 -1
- package/dist/chat/read.d.ts.map +0 -1
- 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/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- 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/change-set.js
CHANGED
|
@@ -1,79 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { sameBinary, sameChange } from './overlay.js';
|
|
4
|
-
import { beneath } from './paths.js';
|
|
5
|
-
import { compositionOf, sameMembership } from './replica.js';
|
|
6
|
-
import { markdownPath, rowsOf } from './rows.js';
|
|
7
|
-
function rowsAt(locator, replica, path) {
|
|
8
|
-
if (replica === null)
|
|
9
|
-
return [];
|
|
10
|
-
const visible = replica.visible;
|
|
11
|
-
const document = markdownPath(path) ? passingDocument(visible.collection, path) : null;
|
|
12
|
-
const held = visible.documents[path] !== undefined && document !== undefined;
|
|
13
|
-
const binary = visible.binaries[path];
|
|
14
|
-
if (!held && binary === undefined)
|
|
15
|
-
return [];
|
|
16
|
-
return rowsOf(locator, path, document ?? null, compositionOf(replica.confirmed.record), visible.changes[path] ?? null, binary === undefined ? null : binaryRecord(path, binary, visible.revisions[path]));
|
|
17
|
-
}
|
|
18
|
-
function modelShape(model) {
|
|
19
|
-
return model.status === 'unavailable' ? 'unavailable' : JSON.stringify(model.types);
|
|
20
|
-
}
|
|
21
|
-
export function changeSet(locator, before, after, changed = {}) {
|
|
22
|
-
const paths = new Set([
|
|
23
|
-
...Object.keys(before?.visible.documents ?? {}),
|
|
24
|
-
...Object.keys(after?.visible.documents ?? {}),
|
|
25
|
-
...Object.keys(before?.visible.binaries ?? {}),
|
|
26
|
-
...Object.keys(after?.visible.binaries ?? {}),
|
|
27
|
-
]);
|
|
28
|
-
const documents = [];
|
|
29
|
-
const oldRoom = before?.confirmed.record;
|
|
30
|
-
const newRoom = after?.confirmed.record;
|
|
31
|
-
const collectionChanged = oldRoom !== undefined &&
|
|
32
|
-
newRoom !== undefined &&
|
|
33
|
-
modelShape(oldRoom.model) !== modelShape(newRoom.model);
|
|
34
|
-
const selectionChanged = oldRoom !== undefined &&
|
|
35
|
-
newRoom !== undefined &&
|
|
36
|
-
modelShape(oldRoom.selectionModel) !== modelShape(newRoom.selectionModel);
|
|
37
|
-
const reclassified = oldRoom !== undefined && newRoom !== undefined && !sameMembership(oldRoom, newRoom);
|
|
38
|
-
for (const path of paths) {
|
|
39
|
-
const selected = newRoom?.typedSelection?.roots.some((root) => beneath(root, path)) ?? false;
|
|
40
|
-
const retyped = selected ? selectionChanged : collectionChanged;
|
|
41
|
-
if (before?.visible.documents[path] === after?.visible.documents[path] &&
|
|
42
|
-
sameBinary(before?.visible.binaries[path], after?.visible.binaries[path]) &&
|
|
43
|
-
before?.visible.revisions[path] === after?.visible.revisions[path] &&
|
|
44
|
-
sameChange(before?.visible.changes[path], after?.visible.changes[path]) &&
|
|
45
|
-
!retyped &&
|
|
46
|
-
!reclassified)
|
|
47
|
-
continue;
|
|
48
|
-
documents.push({
|
|
49
|
-
locator,
|
|
50
|
-
path,
|
|
51
|
-
get before() {
|
|
52
|
-
return rowsAt(locator, before, path);
|
|
53
|
-
},
|
|
54
|
-
get after() {
|
|
55
|
-
return rowsAt(locator, after, path);
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}
|
|
1
|
+
export function changeSet(locator, changed = {}) {
|
|
2
|
+
const documents = changed.documents;
|
|
59
3
|
return {
|
|
60
|
-
documents
|
|
4
|
+
documents: documents === undefined
|
|
5
|
+
? []
|
|
6
|
+
: documents === null
|
|
7
|
+
? [{ locator, path: null }]
|
|
8
|
+
: documents.map((path) => ({ locator, path })),
|
|
61
9
|
drafts: (changed.drafts ?? []).map((path) => ({ locator, path })),
|
|
62
10
|
rooms: changed.room ? [locator] : [],
|
|
63
11
|
queues: changed.queue ? [locator] : [],
|
|
64
12
|
presentations: changed.presentation === undefined ? [] : [changed.presentation],
|
|
65
|
-
messages: [],
|
|
66
13
|
conversations: [],
|
|
67
14
|
};
|
|
68
15
|
}
|
|
69
|
-
export function conversationChangeSet(
|
|
16
|
+
export function conversationChangeSet(conversations) {
|
|
70
17
|
return {
|
|
71
18
|
documents: [],
|
|
72
19
|
drafts: [],
|
|
73
20
|
rooms: [],
|
|
74
21
|
queues: [],
|
|
75
22
|
presentations: [],
|
|
76
|
-
messages,
|
|
77
23
|
conversations: [...new Set(conversations)],
|
|
78
24
|
};
|
|
79
25
|
}
|
|
@@ -84,7 +30,9 @@ export function mergeChangeSets(sets) {
|
|
|
84
30
|
rooms: [...new Set(sets.flatMap((set) => set.rooms))],
|
|
85
31
|
queues: [...new Set(sets.flatMap((set) => set.queues))],
|
|
86
32
|
presentations: [...new Set(sets.flatMap((set) => set.presentations))],
|
|
87
|
-
messages: sets.flatMap((set) => set.messages),
|
|
88
33
|
conversations: [...new Set(sets.flatMap((set) => set.conversations))],
|
|
89
34
|
};
|
|
90
35
|
}
|
|
36
|
+
export function touches(set, locator, path) {
|
|
37
|
+
return set.documents.some((change) => change.locator === locator && (change.path === null || change.path === path));
|
|
38
|
+
}
|
package/dist/change.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
1
2
|
export type Change = {
|
|
2
3
|
readonly kind: 'field';
|
|
3
4
|
readonly path: string;
|
|
@@ -29,7 +30,6 @@ export type Change = {
|
|
|
29
30
|
readonly kind: 'binary';
|
|
30
31
|
readonly path: string;
|
|
31
32
|
readonly localId: string;
|
|
32
|
-
readonly blob: Blob;
|
|
33
33
|
readonly byteLength: number;
|
|
34
34
|
readonly mediaType: string;
|
|
35
35
|
readonly sha256: string;
|
|
@@ -40,6 +40,33 @@ export type Change = {
|
|
|
40
40
|
} | {
|
|
41
41
|
readonly kind: 'remove';
|
|
42
42
|
readonly path: string;
|
|
43
|
+
} | (Arriving & {
|
|
44
|
+
readonly content: string;
|
|
45
|
+
}) | (Arriving & {
|
|
46
|
+
readonly binary: BinaryFile;
|
|
47
|
+
});
|
|
48
|
+
type Arriving = {
|
|
49
|
+
readonly kind: 'arrival';
|
|
50
|
+
readonly path: string;
|
|
51
|
+
readonly revision?: string;
|
|
52
|
+
readonly fileId?: string;
|
|
53
|
+
readonly created?: string;
|
|
54
|
+
readonly change?: HeadChange;
|
|
55
|
+
};
|
|
56
|
+
export type RoomMove = {
|
|
57
|
+
readonly source: {
|
|
58
|
+
readonly room: string;
|
|
59
|
+
readonly baseRoomVersion: string;
|
|
60
|
+
};
|
|
61
|
+
readonly destination: {
|
|
62
|
+
readonly room: string;
|
|
63
|
+
readonly baseRoomVersion: string;
|
|
64
|
+
readonly handle: string;
|
|
65
|
+
};
|
|
66
|
+
readonly moves: readonly {
|
|
67
|
+
readonly path: string;
|
|
68
|
+
readonly to: string;
|
|
69
|
+
}[];
|
|
43
70
|
};
|
|
44
71
|
export type Precondition = {
|
|
45
72
|
readonly kind: 'field';
|
|
@@ -81,9 +108,13 @@ export type ChangeBatch = {
|
|
|
81
108
|
readonly changes: readonly Change[];
|
|
82
109
|
readonly preconditions: readonly Precondition[];
|
|
83
110
|
readonly writtenBy?: WrittenBy;
|
|
111
|
+
readonly between?: RoomMove;
|
|
84
112
|
};
|
|
85
113
|
export declare function immutable(batch: ChangeBatch): ChangeBatch;
|
|
114
|
+
export declare function partnerOf(batch: ChangeBatch, locator: string): string | null;
|
|
115
|
+
export declare function leaving(batch: ChangeBatch, locator: string): boolean;
|
|
86
116
|
export declare function landing(changes: readonly Change[], index: number, path: string): string | null;
|
|
87
117
|
export declare function departure(changes: readonly Change[], index: number): string;
|
|
88
118
|
export declare function queuedFile(batch: ChangeBatch, path: string, localId: string): number;
|
|
119
|
+
export {};
|
|
89
120
|
//# sourceMappingURL=change.d.ts.map
|
package/dist/change.d.ts.map
CHANGED
|
@@ -1 +1 @@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E,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOpF"}
|
package/dist/change.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function frozen(value) {
|
|
2
2
|
if (Array.isArray(value))
|
|
3
3
|
return Object.freeze(value.map((item) => frozen(item)));
|
|
4
|
-
if (value === null || typeof value !== 'object'
|
|
4
|
+
if (value === null || typeof value !== 'object')
|
|
5
5
|
return value;
|
|
6
6
|
const copy = {};
|
|
7
7
|
for (const [name, item] of Object.entries(value))
|
|
@@ -11,9 +11,19 @@ function frozen(value) {
|
|
|
11
11
|
export function immutable(batch) {
|
|
12
12
|
return frozen(batch);
|
|
13
13
|
}
|
|
14
|
+
export function partnerOf(batch, locator) {
|
|
15
|
+
const between = batch.between;
|
|
16
|
+
if (between === undefined)
|
|
17
|
+
return null;
|
|
18
|
+
return between.source.room === locator ? between.destination.room : between.source.room;
|
|
19
|
+
}
|
|
20
|
+
export function leaving(batch, locator) {
|
|
21
|
+
return batch.between?.source.room === locator;
|
|
22
|
+
}
|
|
14
23
|
export function landing(changes, index, path) {
|
|
15
24
|
let at = path;
|
|
16
|
-
for (
|
|
25
|
+
for (let next = index + 1; next < changes.length; next += 1) {
|
|
26
|
+
const change = changes[next];
|
|
17
27
|
if (change.path !== at)
|
|
18
28
|
continue;
|
|
19
29
|
if (change.kind === 'remove')
|
|
@@ -25,7 +35,8 @@ export function landing(changes, index, path) {
|
|
|
25
35
|
}
|
|
26
36
|
export function departure(changes, index) {
|
|
27
37
|
let at = changes[index].path;
|
|
28
|
-
for (
|
|
38
|
+
for (let earlier = index - 1; earlier >= 0; earlier -= 1) {
|
|
39
|
+
const change = changes[earlier];
|
|
29
40
|
if (change.kind === 'move' && change.to === at)
|
|
30
41
|
at = change.path;
|
|
31
42
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-types.d.ts","sourceRoot":"","sources":["../src/chat-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAMhD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKhD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const CHAT_TYPE = 'chat';
|
|
2
|
+
export const CHAT_MESSAGE_TYPE = 'chat-message';
|
|
3
|
+
const KEPT_LINE = /^\[([^\]\n]+)\]\(\1\)$/u;
|
|
4
|
+
const TOO_BIG_LINE = /^\[too big to keep: [^\n]*\]$/u;
|
|
5
|
+
export function keptFile(line) {
|
|
6
|
+
return KEPT_LINE.exec(line)?.[1] ?? null;
|
|
7
|
+
}
|
|
8
|
+
export function keptLines(body) {
|
|
9
|
+
const trimmed = body.replace(/\n+$/u, '');
|
|
10
|
+
const at = trimmed.lastIndexOf('\n\n');
|
|
11
|
+
const lines = (at === -1 ? trimmed : trimmed.slice(at + 2)).split('\n');
|
|
12
|
+
return lines.every((line) => keptFile(line) !== null || TOO_BIG_LINE.test(line)) ? lines : [];
|
|
13
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,79 +1,108 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { HistoryQuery } from './actions.js';
|
|
3
|
+
import type { AppRoom } from './listing.js';
|
|
4
|
+
import type { ConnectionRefusal } from './socket.js';
|
|
5
|
+
import type { RoomSchemas } from './surface.js';
|
|
6
|
+
import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
|
|
2
7
|
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
-
import type {
|
|
8
|
+
import type { UnsentWork } from './durability.js';
|
|
9
|
+
import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
|
|
4
10
|
import { type Observation } from './observation.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
11
|
+
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
12
|
+
import type { FiguresResult } from './figures.js';
|
|
13
|
+
import type { Holdings } from './holdings.js';
|
|
14
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
8
15
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
9
16
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
17
|
+
import type { Readiness } from './readiness.js';
|
|
18
|
+
import type { ObservedRead } from './reads.js';
|
|
10
19
|
import type { SyncStatus } from './status.js';
|
|
11
20
|
import { type RuntimePort } from './wire.js';
|
|
21
|
+
export type BuildFile = (name: string) => Promise<Blob | null>;
|
|
12
22
|
export type MdRuntimeClient = {
|
|
23
|
+
buildFile(name: string): Promise<Blob | null>;
|
|
13
24
|
rooms(): Promise<readonly AppRoom[]>;
|
|
14
25
|
query: {
|
|
15
|
-
(query: DocumentQuery): Promise<DocumentResult>;
|
|
16
|
-
(query: GroupQuery): Promise<GroupResult>;
|
|
26
|
+
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
27
|
+
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
17
28
|
};
|
|
18
29
|
search(request: SearchRequest): Promise<SearchResult>;
|
|
19
30
|
types(locator: string): Promise<RoomSchemas>;
|
|
20
31
|
roomDraft: {
|
|
21
32
|
list(): Promise<readonly RoomDraft[]>;
|
|
22
33
|
read(room: string, path: string): Promise<RoomDraft | null>;
|
|
23
|
-
write(room: string, path: string, revision: string | null, parts: RoomDraftParts): Promise<RoomDraftWrite>;
|
|
34
|
+
write(room: string, path: string, revision: string | null, parts: RoomDraftParts, next?: string): Promise<RoomDraftWrite>;
|
|
24
35
|
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
25
36
|
};
|
|
26
37
|
save(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
|
|
38
|
+
saveParts(room: string, parts: readonly SavedParts[]): Promise<SaveResult>;
|
|
27
39
|
presentation: {
|
|
28
40
|
read(): Promise<unknown>;
|
|
29
41
|
write(value: unknown): Promise<void>;
|
|
42
|
+
edit(members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
30
43
|
};
|
|
31
44
|
conversation: {
|
|
32
45
|
list(): Promise<readonly ConversationEntry[]>;
|
|
33
|
-
read(conversation: string, options?:
|
|
46
|
+
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
34
47
|
create(input: unknown): Promise<CallResult>;
|
|
35
48
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
36
|
-
answer(conversation: string, answer:
|
|
49
|
+
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
37
50
|
interrupt(conversation: string): Promise<CallResult>;
|
|
38
51
|
kill(conversation: string): Promise<CallResult>;
|
|
39
|
-
cancel(conversation: string, turn: string): Promise<CallResult>;
|
|
40
52
|
delete(conversation: string): Promise<CallResult>;
|
|
41
53
|
};
|
|
42
54
|
chatDraft: {
|
|
43
55
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
56
|
+
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
44
57
|
discard(conversation: string): Promise<void>;
|
|
45
58
|
};
|
|
46
59
|
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
60
|
+
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
47
61
|
binaryFile: {
|
|
48
62
|
read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
|
|
49
|
-
|
|
63
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
64
|
+
download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
|
|
50
65
|
};
|
|
51
66
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
52
67
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
53
68
|
log(): Promise<string>;
|
|
54
69
|
persistence(): Promise<boolean>;
|
|
70
|
+
retry(): Promise<void>;
|
|
71
|
+
cleanUp(): Promise<number>;
|
|
72
|
+
unsent(): Promise<readonly UnsentWork[]>;
|
|
73
|
+
reset(): Promise<void>;
|
|
74
|
+
readAgain(): Promise<void>;
|
|
55
75
|
observe: {
|
|
56
76
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
57
77
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
78
|
+
(topic: 'readiness'): Promise<Observation<Readiness>>;
|
|
58
79
|
(topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
|
|
59
80
|
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
60
81
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
61
82
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
62
83
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
63
|
-
(topic: '
|
|
64
|
-
(topic: 'query', query:
|
|
84
|
+
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
85
|
+
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
86
|
+
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
65
87
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
66
88
|
(topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
|
|
67
89
|
(topic: 'presentation'): Promise<Observation<unknown>>;
|
|
68
90
|
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
69
91
|
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
70
92
|
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
93
|
+
(topic: 'figures'): Promise<Observation<FiguresResult>>;
|
|
94
|
+
(topic: 'holdings'): Promise<Observation<Holdings>>;
|
|
95
|
+
(topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
|
|
71
96
|
};
|
|
72
97
|
reauthorize(): Promise<void>;
|
|
73
98
|
settled(): Promise<void>;
|
|
74
99
|
};
|
|
75
|
-
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
100
|
+
export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
|
|
76
101
|
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
102
|
+
export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
|
|
103
|
+
export { roomDraftRevision } from './identity.js';
|
|
104
|
+
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
77
105
|
export type { Observation } from './observation.js';
|
|
78
|
-
export type {
|
|
106
|
+
export type { Open } from './open.js';
|
|
107
|
+
export { unanswered, type RuntimePort, type WireMember } from './wire.js';
|
|
79
108
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,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iB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
+
import { shownBy } from './media.js';
|
|
1
2
|
import { observed } from './observation.js';
|
|
2
3
|
import { runtimeError } from './failure.js';
|
|
3
4
|
import { answer, AUTHORIZATION_ENDED, PORT_CLOSED, } from './wire.js';
|
|
5
|
+
// React renders an arrived value in a later task and opens what that render observes as it commits, so this many frames opening nothing mean the page drew what it observes.
|
|
6
|
+
const SETTLED_FRAMES = 2;
|
|
7
|
+
// A browser reads a download's address only after the click that hands it returns, so a copy's address is released a minute later.
|
|
8
|
+
const HANDED_COPY_MS = 60_000;
|
|
9
|
+
const PAGE = /\.html?$/iu;
|
|
10
|
+
const STARTED = { kind: 'started' };
|
|
11
|
+
const BLOCKED = {
|
|
12
|
+
kind: 'blocked',
|
|
13
|
+
code: 'popup-blocked',
|
|
14
|
+
fields: {},
|
|
15
|
+
retryable: true,
|
|
16
|
+
};
|
|
17
|
+
function handed(url, name) {
|
|
18
|
+
const anchor = document.createElement('a');
|
|
19
|
+
anchor.href = url;
|
|
20
|
+
anchor.download = name;
|
|
21
|
+
anchor.click();
|
|
22
|
+
}
|
|
4
23
|
function refused(refusal) {
|
|
5
|
-
return runtimeError(refusal.code
|
|
24
|
+
return runtimeError(refusal.code);
|
|
6
25
|
}
|
|
7
|
-
|
|
26
|
+
const UNBUILT = () => Promise.resolve(null);
|
|
27
|
+
export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
8
28
|
let sequence = 0;
|
|
9
29
|
let refusal = null;
|
|
10
30
|
let ended = null;
|
|
@@ -131,6 +151,57 @@ export function connectMdRuntime(port) {
|
|
|
131
151
|
drawing?.();
|
|
132
152
|
});
|
|
133
153
|
}
|
|
154
|
+
function streamed(answer) {
|
|
155
|
+
if (answer.kind !== 'binary')
|
|
156
|
+
return answer;
|
|
157
|
+
const { file, byteLength, mediaType } = answer;
|
|
158
|
+
let part = 0;
|
|
159
|
+
let received = 0;
|
|
160
|
+
const stream = new ReadableStream({
|
|
161
|
+
async pull(controller) {
|
|
162
|
+
const bytes = await ask('binaryFile.part', [file, part]);
|
|
163
|
+
if (bytes === null) {
|
|
164
|
+
if (received === byteLength)
|
|
165
|
+
controller.close();
|
|
166
|
+
else
|
|
167
|
+
controller.error(runtimeError('binary-file-absent', 'The file ended early'));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
part += 1;
|
|
171
|
+
received += bytes.byteLength;
|
|
172
|
+
controller.enqueue(bytes);
|
|
173
|
+
},
|
|
174
|
+
}, { highWaterMark: 0 });
|
|
175
|
+
return { kind: 'binary', stream, byteLength, mediaType };
|
|
176
|
+
}
|
|
177
|
+
async function download(room, path, revision) {
|
|
178
|
+
const tab = PAGE.test(path) ? globalThis.open('', '_blank') : null;
|
|
179
|
+
const linked = await ask('binaryFile.link', [room, path, revision]);
|
|
180
|
+
if (linked.kind === 'link' && PAGE.test(linked.name)) {
|
|
181
|
+
const away = tab ?? globalThis.open('', '_blank');
|
|
182
|
+
if (away === null)
|
|
183
|
+
return BLOCKED;
|
|
184
|
+
away.location.replace(linked.url);
|
|
185
|
+
return STARTED;
|
|
186
|
+
}
|
|
187
|
+
tab?.close();
|
|
188
|
+
if (linked.kind === 'link') {
|
|
189
|
+
handed(linked.url, linked.name);
|
|
190
|
+
return STARTED;
|
|
191
|
+
}
|
|
192
|
+
if (linked.kind !== 'absent')
|
|
193
|
+
return linked;
|
|
194
|
+
const read = streamed(await ask('binaryFile.read', [room, path, revision]));
|
|
195
|
+
if (read.kind !== 'binary')
|
|
196
|
+
return read;
|
|
197
|
+
const copy = await new Response(read.stream, {
|
|
198
|
+
headers: { 'content-type': read.mediaType },
|
|
199
|
+
}).blob();
|
|
200
|
+
const url = URL.createObjectURL(copy);
|
|
201
|
+
handed(url, path.slice(path.lastIndexOf('/') + 1));
|
|
202
|
+
setTimeout(() => URL.revokeObjectURL(url), HANDED_COPY_MS);
|
|
203
|
+
return STARTED;
|
|
204
|
+
}
|
|
134
205
|
function settled() {
|
|
135
206
|
if (settling !== null)
|
|
136
207
|
return settling;
|
|
@@ -141,21 +212,28 @@ export function connectMdRuntime(port) {
|
|
|
141
212
|
if (opening.size > 0)
|
|
142
213
|
return;
|
|
143
214
|
const at = moved;
|
|
144
|
-
|
|
215
|
+
const waited = (frames) => {
|
|
145
216
|
requestAnimationFrame(() => {
|
|
217
|
+
if (frames < SETTLED_FRAMES) {
|
|
218
|
+
waited(frames + 1);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
146
221
|
if (moved !== at || opening.size > 0)
|
|
147
222
|
return;
|
|
148
223
|
drawing = null;
|
|
149
224
|
resolve();
|
|
150
225
|
});
|
|
151
|
-
}
|
|
226
|
+
};
|
|
227
|
+
waited(1);
|
|
152
228
|
};
|
|
153
229
|
drawing = check;
|
|
154
230
|
check();
|
|
155
231
|
});
|
|
156
232
|
return settling;
|
|
157
233
|
}
|
|
158
|
-
|
|
234
|
+
const show = (room, path, revision) => ask('binaryFile.show', [room, path, revision]).then((shown) => streamed(shown));
|
|
235
|
+
return shownBy(show, {
|
|
236
|
+
buildFile,
|
|
159
237
|
rooms: () => ask('rooms', []),
|
|
160
238
|
query: ((query) => ask('query', [query])),
|
|
161
239
|
search: (request) => ask('search', [request]),
|
|
@@ -163,13 +241,15 @@ export function connectMdRuntime(port) {
|
|
|
163
241
|
roomDraft: {
|
|
164
242
|
list: () => ask('roomDraft.list', []),
|
|
165
243
|
read: (room, path) => ask('roomDraft.read', [room, path]),
|
|
166
|
-
write: (room, path, revision, parts) => ask('roomDraft.write', [room, path, revision, parts]),
|
|
244
|
+
write: (room, path, revision, parts, next) => ask('roomDraft.write', next === undefined ? [room, path, revision, parts] : [room, path, revision, parts, next]),
|
|
167
245
|
discard: (room, path, revision) => ask('roomDraft.discard', [room, path, revision]),
|
|
168
246
|
},
|
|
169
247
|
save: (room, roomDrafts) => ask('save', [room, roomDrafts]),
|
|
248
|
+
saveParts: (room, parts) => ask('saveParts', [room, parts]),
|
|
170
249
|
presentation: {
|
|
171
250
|
read: () => ask('presentation.read', []),
|
|
172
251
|
write: (value) => ask('presentation.write', [value]),
|
|
252
|
+
edit: (members) => ask('presentation.edit', [members]),
|
|
173
253
|
},
|
|
174
254
|
conversation: {
|
|
175
255
|
list: () => ask('conversation.list', []),
|
|
@@ -179,30 +259,41 @@ export function connectMdRuntime(port) {
|
|
|
179
259
|
answer: (conversation, answer) => ask('conversation.answer', [conversation, answer]),
|
|
180
260
|
interrupt: (conversation) => ask('conversation.interrupt', [conversation]),
|
|
181
261
|
kill: (conversation) => ask('conversation.kill', [conversation]),
|
|
182
|
-
cancel: (conversation, turn) => ask('conversation.cancel', [conversation, turn]),
|
|
183
262
|
delete: (conversation) => ask('conversation.delete', [conversation]),
|
|
184
263
|
},
|
|
185
264
|
chatDraft: {
|
|
186
265
|
write: (conversation, draft, revision) => ask('chatDraft.write', [conversation, draft, revision]),
|
|
266
|
+
prepend: (conversation, draft) => ask('chatDraft.prepend', [conversation, draft]),
|
|
187
267
|
discard: (conversation) => ask('chatDraft.discard', [conversation]),
|
|
188
268
|
},
|
|
189
269
|
history: (locator, path, query) => ask('history', [locator, path, query]),
|
|
270
|
+
resolve: (room, path, destination) => ask('resolve', [room, path, destination]),
|
|
190
271
|
binaryFile: {
|
|
191
|
-
read: (room, path, revision) => ask('binaryFile.read', [room, path, revision]),
|
|
192
|
-
|
|
272
|
+
read: (room, path, revision) => ask('binaryFile.read', [room, path, revision]).then((read) => streamed(read)),
|
|
273
|
+
attach: (room, file) => ask('binaryFile.attach', [room, file]),
|
|
274
|
+
download,
|
|
193
275
|
},
|
|
194
276
|
call: (name, input) => ask('call', [name, input]),
|
|
195
277
|
reached: (locator, roomVersion, path) => ask('reached', [locator, roomVersion, path]),
|
|
196
278
|
log: () => ask('log', []),
|
|
197
279
|
persistence: () => ask('persistence', []),
|
|
280
|
+
retry: () => ask('retry', []),
|
|
281
|
+
cleanUp: () => ask('cleanUp', []),
|
|
282
|
+
unsent: () => ask('unsent', []),
|
|
283
|
+
reset: () => ask('reset', []),
|
|
284
|
+
readAgain: () => ask('readAgain', []),
|
|
198
285
|
observe: ((topic, ...input) => watch(topic, input)),
|
|
199
286
|
reauthorize: () => ask('reauthorize', []),
|
|
200
287
|
settled,
|
|
201
|
-
};
|
|
288
|
+
});
|
|
202
289
|
}
|
|
203
290
|
const turns = new WeakMap();
|
|
204
291
|
export function inTurn(client, work) {
|
|
205
|
-
const
|
|
206
|
-
turns.set(client,
|
|
207
|
-
return
|
|
292
|
+
const turn = (turns.get(client) ?? Promise.resolve()).then(work);
|
|
293
|
+
turns.set(client, turn.then(() => undefined, () => undefined));
|
|
294
|
+
return turn;
|
|
208
295
|
}
|
|
296
|
+
export { chainedWindows } from './chain.js';
|
|
297
|
+
export { roomDraftRevision } from './identity.js';
|
|
298
|
+
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
299
|
+
export { unanswered } from './wire.js';
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type Document, type
|
|
2
|
-
import type { ModelState } from './model.js';
|
|
1
|
+
import { type DefinitionOf, type Document, type TypedPath } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { ModelState, TypesResult } from './model.js';
|
|
3
|
+
import type { AppTypedSelection } from './listing.js';
|
|
3
4
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
|
-
import type { Refused } from './transfer.js';
|
|
5
5
|
export declare const MD_MODEL: MdModelIdentity;
|
|
6
6
|
export type Collection = {
|
|
7
7
|
text: Readonly<Record<string, string>>;
|
|
@@ -14,12 +14,34 @@ export type Composition = {
|
|
|
14
14
|
roots: readonly string[];
|
|
15
15
|
model: ModelState;
|
|
16
16
|
} | null;
|
|
17
|
+
typedPaths: readonly TypedPath[];
|
|
17
18
|
};
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare function
|
|
19
|
+
export type Composed = {
|
|
20
|
+
readonly composition: Composition;
|
|
21
|
+
readonly fingerprint: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function composedOf(composition: Composition): Composed;
|
|
24
|
+
type Selecting<M> = {
|
|
25
|
+
readonly model: M;
|
|
26
|
+
readonly selection: {
|
|
27
|
+
readonly roots: readonly string[];
|
|
28
|
+
readonly model: M;
|
|
29
|
+
} | null;
|
|
30
|
+
};
|
|
31
|
+
export declare function selected(composition: {
|
|
32
|
+
readonly selection: {
|
|
33
|
+
readonly roots: readonly string[];
|
|
34
|
+
} | null;
|
|
35
|
+
}, path: string): boolean;
|
|
36
|
+
export declare function governing<M>(composition: Selecting<M>, path: string): M;
|
|
37
|
+
export declare function definitionsAt(composition: Composition, path: string): DefinitionOf;
|
|
38
|
+
export declare function definitionsIn(room: {
|
|
39
|
+
readonly model: TypesResult;
|
|
40
|
+
readonly typedSelection: AppTypedSelection | null;
|
|
41
|
+
}, path: string, typedPaths: readonly TypedPath[]): DefinitionOf;
|
|
42
|
+
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
43
|
+
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
23
44
|
export declare function validRoot(root: unknown): root is string;
|
|
24
|
-
export declare function
|
|
45
|
+
export declare function available(composition: Composition): boolean;
|
|
46
|
+
export {};
|
|
25
47
|
//# sourceMappingURL=collection.d.ts.map
|