@agentshouse/mdruntime 0.1.0-cff8ba8fa2542 → 0.1.0-cffcba9cd9c2f
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 +24 -11
- package/dist/acceptance.d.ts +3 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +309 -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 +195 -88
- 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 -28
- package/dist/attempt.d.ts +16 -0
- package/dist/attempt.d.ts.map +1 -0
- package/dist/attempt.js +70 -0
- package/dist/binary.d.ts +18 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +8 -0
- package/dist/bootstrap.d.ts +37 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +324 -51
- 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 +13 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +17 -56
- package/dist/change.d.ts +46 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +36 -0
- 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 +56 -18
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +164 -23
- package/dist/collection.d.ts +31 -14
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +61 -55
- 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 -103
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +103 -2076
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- 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 +67 -44
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +1010 -549
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- 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 +177 -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 +20 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +161 -0
- package/dist/expectation.d.ts +23 -0
- package/dist/expectation.d.ts.map +1 -0
- package/dist/expectation.js +92 -0
- package/dist/failure.d.ts +14 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/failure.js +22 -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 +28 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +149 -26
- package/dist/identity.d.ts +3 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +13 -1
- package/dist/index.d.ts +39 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/install.d.ts +55 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +543 -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 +271 -0
- package/dist/listing.d.ts +52 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +168 -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 +25 -8
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +296 -93
- 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 +16 -9
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +9 -15
- package/dist/models.d.ts +10 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +170 -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/open.d.ts +2 -0
- package/dist/open.d.ts.map +1 -0
- package/dist/open.js +1 -0
- 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 +59 -0
- package/dist/outcome.d.ts +75 -5
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +84 -1
- package/dist/overlay.d.ts +17 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +168 -190
- 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 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +26 -16
- 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 +51 -181
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -431
- package/dist/questions.d.ts +34 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +122 -0
- package/dist/queue.d.ts +32 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +402 -0
- package/dist/reach.d.ts +21 -5
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +306 -96
- package/dist/react.d.ts +43 -19
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +22 -21
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -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 +20 -7
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +155 -59
- 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 +53 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +361 -164
- package/dist/room-draft.d.ts +59 -12
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +299 -90
- 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 +32 -34
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +67 -87
- package/dist/runtime.d.ts +32 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +74 -5
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +914 -188
- package/dist/saves.d.ts +32 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +679 -0
- package/dist/search.d.ts +15 -54
- 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 +32 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +299 -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 +41 -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 +69 -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 +7 -4
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -15
- 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 -92
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +142 -385
- 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 +530 -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 +189 -37
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +77 -33
- package/package.json +27 -15
- package/AGENTS.md +0 -231
- package/dist/attachment.d.ts +0 -3
- package/dist/attachment.d.ts.map +0 -1
- package/dist/attachment.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 -377
package/dist/reach.js
CHANGED
|
@@ -1,30 +1,39 @@
|
|
|
1
|
+
import { selected } from './collection.js';
|
|
1
2
|
import { unheldView } from './conversation.js';
|
|
2
3
|
import { modelTypes, NO_MODEL } from './model.js';
|
|
3
|
-
import {
|
|
4
|
+
import { changeOf, digestApplied, digestOf, observing, } from './observation.js';
|
|
5
|
+
import { runtimeError, uncaught } from './failure.js';
|
|
6
|
+
import { failure, lockedRoom, ROOM_LOCKED, undeclared, UNREADABLE, } from './outcome.js';
|
|
4
7
|
import { beneath } from './paths.js';
|
|
5
|
-
import {
|
|
6
|
-
import { moveTarget, readParts } from './room-draft.js';
|
|
8
|
+
import { moveTarget, readParts, staleWrite, } from './room-draft.js';
|
|
7
9
|
import { documentKey } from './rows.js';
|
|
8
10
|
const UNHELD_TYPES = { collection: modelTypes(NO_MODEL), typedSelection: null };
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return Promise.resolve(UNDECLARED);
|
|
11
|
+
function unconversed(name) {
|
|
12
|
+
return () => Promise.resolve(undeclared(name));
|
|
12
13
|
}
|
|
13
14
|
const NO_CONVERSATION = {
|
|
14
15
|
list: () => Promise.resolve([]),
|
|
15
16
|
read: (conversation) => Promise.resolve(unheldView(conversation)),
|
|
16
|
-
create:
|
|
17
|
-
send:
|
|
18
|
-
answer:
|
|
19
|
-
interrupt:
|
|
20
|
-
kill:
|
|
21
|
-
|
|
22
|
-
delete: undeclared,
|
|
17
|
+
create: unconversed('conversations/create'),
|
|
18
|
+
send: unconversed('conversations/send'),
|
|
19
|
+
answer: unconversed('conversations/interaction/answer'),
|
|
20
|
+
interrupt: unconversed('conversations/interrupt'),
|
|
21
|
+
kill: unconversed('conversations/kill'),
|
|
22
|
+
delete: unconversed('conversations/delete'),
|
|
23
23
|
};
|
|
24
24
|
const NO_CHAT_DRAFT = {
|
|
25
25
|
write: () => Promise.resolve(),
|
|
26
|
+
prepend: () => Promise.resolve(),
|
|
26
27
|
discard: () => Promise.resolve(),
|
|
27
28
|
};
|
|
29
|
+
function areasOf(reach) {
|
|
30
|
+
return reach.areas ?? [];
|
|
31
|
+
}
|
|
32
|
+
function fenced(reach, room, path) {
|
|
33
|
+
return areasOf(reach).some((area) => area.room === room &&
|
|
34
|
+
beneath(area.path, path) &&
|
|
35
|
+
!area.open.some((open) => beneath(open, path)));
|
|
36
|
+
}
|
|
28
37
|
export function holds(reach, room) {
|
|
29
38
|
return (reach === null ||
|
|
30
39
|
reach.rooms.includes(room) ||
|
|
@@ -37,16 +46,17 @@ export function governs(reach, room) {
|
|
|
37
46
|
if (wholly(reach, room.locator)) {
|
|
38
47
|
return { collection: true, selection: room.typedSelection !== null };
|
|
39
48
|
}
|
|
40
|
-
const
|
|
49
|
+
const within = (path) => selected({ selection: room.typedSelection }, path);
|
|
41
50
|
const paths = reach.documents
|
|
42
51
|
.filter((document) => document.room === room.locator)
|
|
43
52
|
.map(({ path }) => path);
|
|
44
|
-
return { collection: paths.some((path) => !
|
|
53
|
+
return { collection: paths.some((path) => !within(path)), selection: paths.some(within) };
|
|
45
54
|
}
|
|
46
55
|
function covers(reach, room, path) {
|
|
47
56
|
return (reach === null ||
|
|
48
|
-
reach
|
|
49
|
-
|
|
57
|
+
(!fenced(reach, room, path) &&
|
|
58
|
+
(reach.rooms.includes(room) ||
|
|
59
|
+
reach.documents.some((document) => document.room === room && document.path === path))));
|
|
50
60
|
}
|
|
51
61
|
function conversing(reach) {
|
|
52
62
|
return reach === null || reach.conversations;
|
|
@@ -59,25 +69,13 @@ export function planReach(reach) {
|
|
|
59
69
|
documents: [
|
|
60
70
|
...new Set(reach.documents.map(({ room, path }) => documentKey(room, path))),
|
|
61
71
|
].sort(),
|
|
72
|
+
areas: areasOf(reach)
|
|
73
|
+
.map(({ room, path, open }) => ({ room, path, open: [...new Set(open)].sort() }))
|
|
74
|
+
.sort((left, right) => documentKey(left.room, left.path) < documentKey(right.room, right.path) ? -1 : 1),
|
|
62
75
|
};
|
|
63
76
|
}
|
|
64
77
|
function roomsWithin(reach, rooms) {
|
|
65
|
-
|
|
66
|
-
return rooms;
|
|
67
|
-
return rooms
|
|
68
|
-
.filter((room) => holds(reach, room.locator))
|
|
69
|
-
.map((room) => {
|
|
70
|
-
if (wholly(reach, room.locator))
|
|
71
|
-
return room;
|
|
72
|
-
const governed = governs(reach, room);
|
|
73
|
-
return {
|
|
74
|
-
...room,
|
|
75
|
-
model: governed.collection ? room.model : modelTypes(NO_MODEL),
|
|
76
|
-
typedSelection: governed.selection ? room.typedSelection : null,
|
|
77
|
-
roomVersion: null,
|
|
78
|
-
attachments: [],
|
|
79
|
-
};
|
|
80
|
-
});
|
|
78
|
+
return rooms.filter((room) => wholly(reach, room.locator));
|
|
81
79
|
}
|
|
82
80
|
function typesWithin(reach, room, types) {
|
|
83
81
|
if (room === undefined)
|
|
@@ -89,7 +87,7 @@ function typesWithin(reach, room, types) {
|
|
|
89
87
|
};
|
|
90
88
|
}
|
|
91
89
|
function moves(reach, room, move) {
|
|
92
|
-
return move === undefined || covers(reach, room, moveTarget(move));
|
|
90
|
+
return move === undefined || covers(reach, move.room ?? room, moveTarget(move));
|
|
93
91
|
}
|
|
94
92
|
function draftWithin(reach, draft) {
|
|
95
93
|
return covers(reach, draft.room, draft.path) && moves(reach, draft.room, draft.parts.move);
|
|
@@ -103,7 +101,7 @@ function shownDraft(reach, draft) {
|
|
|
103
101
|
function writeWithin(reach, write) {
|
|
104
102
|
return write.outcome === 'written'
|
|
105
103
|
? { outcome: 'written', roomDraft: shownDraft(reach, write.roomDraft) }
|
|
106
|
-
:
|
|
104
|
+
: staleWrite(shownDraft(reach, write.current));
|
|
107
105
|
}
|
|
108
106
|
function savedWithin(reach, room, result) {
|
|
109
107
|
if (reach === null || result.outcome === 'saved')
|
|
@@ -123,136 +121,348 @@ function statusWithin(reach, status) {
|
|
|
123
121
|
return {
|
|
124
122
|
...status,
|
|
125
123
|
attentionRequired: status.attentionRequired.filter((entry) => covers(reach, entry.room, entry.path)),
|
|
124
|
+
unsent: status.unsent.filter((change) => covers(reach, change.room, change.path)),
|
|
126
125
|
};
|
|
127
126
|
}
|
|
128
127
|
function queueWithin(reach, room, entries) {
|
|
129
|
-
return entries
|
|
130
|
-
(
|
|
128
|
+
return entries
|
|
129
|
+
.filter(({ batch }) => batch.changes.every((change) => covers(reach, room, change.path) &&
|
|
130
|
+
(change.kind !== 'move' || covers(reach, room, change.to))))
|
|
131
|
+
.map((entry) => {
|
|
132
|
+
const { between, ...batch } = entry.batch;
|
|
133
|
+
if (between === undefined)
|
|
134
|
+
return entry;
|
|
135
|
+
return wholly(reach, between.source.room) && wholly(reach, between.destination.room)
|
|
136
|
+
? entry
|
|
137
|
+
: { ...entry, batch };
|
|
138
|
+
});
|
|
131
139
|
}
|
|
132
140
|
function unreached(room) {
|
|
133
|
-
return
|
|
141
|
+
return runtimeError('unknown-room', `Unknown Room ${room}`);
|
|
142
|
+
}
|
|
143
|
+
function lockedError(room) {
|
|
144
|
+
return runtimeError(ROOM_LOCKED, `${room} is locked until House confirms its access`, true);
|
|
145
|
+
}
|
|
146
|
+
function deviceUnreached() {
|
|
147
|
+
return runtimeError('device-unreached', 'Only the panel reaches this device');
|
|
134
148
|
}
|
|
135
|
-
|
|
149
|
+
const ATTACH_REQUIRED = 'attach-required';
|
|
150
|
+
function attachRequired() {
|
|
151
|
+
return runtimeError(ATTACH_REQUIRED, 'App code takes a file in with binaryFile.attach');
|
|
152
|
+
}
|
|
153
|
+
function carriesFile(parts) {
|
|
154
|
+
return parts !== null && typeof parts === 'object' && Object.hasOwn(parts, 'file');
|
|
155
|
+
}
|
|
156
|
+
export function narrowed(runtime, given, port) {
|
|
136
157
|
const { md, watch } = runtime;
|
|
137
158
|
let reach = given;
|
|
138
159
|
const open = new Set();
|
|
139
|
-
function following(begin) {
|
|
160
|
+
function following(begin, locking = false) {
|
|
140
161
|
let stop = begin();
|
|
141
162
|
const restart = () => {
|
|
142
163
|
stop();
|
|
143
164
|
stop = begin();
|
|
144
165
|
};
|
|
145
166
|
open.add(restart);
|
|
167
|
+
const unwatch = locking ? runtime.watchLocks(restart) : () => { };
|
|
146
168
|
return () => {
|
|
147
169
|
open.delete(restart);
|
|
170
|
+
unwatch();
|
|
171
|
+
stop();
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
const unlocking = (rooms, locked) => {
|
|
175
|
+
const held = (rooms ?? []).filter((room) => locked.includes(room));
|
|
176
|
+
return held.length === 0 ? null : { pending: held.map((room) => ({ room, awaits: 'unlock' })) };
|
|
177
|
+
};
|
|
178
|
+
const unlocked = (entries, locked) => entries.filter((entry) => !locked.includes(entry.room));
|
|
179
|
+
const intoLocked = async (held) => {
|
|
180
|
+
for (const move of held) {
|
|
181
|
+
if (move?.room !== undefined && (await runtime.locked(move.room)))
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
};
|
|
186
|
+
function ordered(deliver) {
|
|
187
|
+
let open = true;
|
|
188
|
+
let shown = Promise.resolve();
|
|
189
|
+
return {
|
|
190
|
+
push(making) {
|
|
191
|
+
shown = shown.then(() => making.then((value) => {
|
|
192
|
+
if (open)
|
|
193
|
+
deliver(value);
|
|
194
|
+
}, uncaught), uncaught);
|
|
195
|
+
},
|
|
196
|
+
stop() {
|
|
197
|
+
open = false;
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function unlockedWatch(topic, input, deliver, fail, within) {
|
|
202
|
+
const shown = ordered(deliver);
|
|
203
|
+
const stop = watch(topic, input, (message) => {
|
|
204
|
+
shown.push(runtime.lockedRooms().then((locked) => within(message, locked)));
|
|
205
|
+
}, fail);
|
|
206
|
+
return () => {
|
|
207
|
+
shown.stop();
|
|
148
208
|
stop();
|
|
149
209
|
};
|
|
150
210
|
}
|
|
151
|
-
|
|
211
|
+
function lockedFirst(room, start, shut) {
|
|
212
|
+
let open = true;
|
|
213
|
+
let stop = () => { };
|
|
214
|
+
void (async () => {
|
|
215
|
+
const closed = !holds(reach, room) || (await runtime.locked(room));
|
|
216
|
+
if (!open)
|
|
217
|
+
return;
|
|
218
|
+
if (closed)
|
|
219
|
+
shut();
|
|
220
|
+
else
|
|
221
|
+
stop = start();
|
|
222
|
+
})();
|
|
223
|
+
return () => {
|
|
224
|
+
open = false;
|
|
225
|
+
stop();
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
const within = (topic, input, deliver, fail) => {
|
|
229
|
+
if (topic === 'read' && reach !== null) {
|
|
230
|
+
fail(deviceUnreached());
|
|
231
|
+
return () => { };
|
|
232
|
+
}
|
|
152
233
|
if (topic === 'rooms') {
|
|
153
|
-
return following(() => watch(topic, input, (rooms) => deliver(roomsWithin(reach, rooms))));
|
|
234
|
+
return following(() => watch(topic, input, (rooms) => deliver(roomsWithin(reach, rooms)), fail));
|
|
235
|
+
}
|
|
236
|
+
if (topic === 'readiness') {
|
|
237
|
+
return following(() => runtime.watchReadiness(port, reach, deliver));
|
|
154
238
|
}
|
|
155
239
|
if (topic === 'sync-status') {
|
|
156
|
-
return following(() =>
|
|
240
|
+
return following(() => unlockedWatch(topic, input, deliver, fail, (status, locked) => {
|
|
241
|
+
const shown = statusWithin(reach, status);
|
|
242
|
+
return { ...shown, attentionRequired: unlocked(shown.attentionRequired, locked) };
|
|
243
|
+
}), true);
|
|
157
244
|
}
|
|
158
245
|
if (topic === 'room-drafts') {
|
|
159
|
-
return following(() =>
|
|
246
|
+
return following(() => unlockedWatch(topic, input, deliver, fail, (drafts, locked) => unlocked(draftsWithin(reach, drafts), locked)), true);
|
|
160
247
|
}
|
|
161
248
|
if (topic === 'queue') {
|
|
162
249
|
const room = input[0];
|
|
163
|
-
return following(() =>
|
|
164
|
-
if (!holds(reach, room)) {
|
|
165
|
-
deliver([]);
|
|
166
|
-
return () => { };
|
|
167
|
-
}
|
|
168
|
-
return watch(topic, input, (entries) => deliver(queueWithin(reach, room, entries)));
|
|
169
|
-
});
|
|
250
|
+
return following(() => lockedFirst(room, () => watch(topic, input, (entries) => deliver(queueWithin(reach, room, entries)), fail), () => deliver([])), true);
|
|
170
251
|
}
|
|
171
252
|
if (topic === 'query') {
|
|
172
|
-
const
|
|
253
|
+
const planning = runtime.plan(input[0], reach);
|
|
173
254
|
let held = null;
|
|
174
255
|
return following(() => {
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
256
|
+
let open = true;
|
|
257
|
+
let stop = () => { };
|
|
258
|
+
void (async () => {
|
|
259
|
+
const plan = await planning;
|
|
260
|
+
const locked = await runtime.lockedRooms();
|
|
261
|
+
if (!open)
|
|
180
262
|
return;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
held
|
|
185
|
-
|
|
263
|
+
const pending = unlocking(plan.rooms, locked);
|
|
264
|
+
if (pending !== null) {
|
|
265
|
+
const answer = { result: pending, keys: [] };
|
|
266
|
+
if (held === null || changeOf(held, answer) !== null)
|
|
267
|
+
deliver(answer);
|
|
268
|
+
held = digestOf(answer);
|
|
186
269
|
return;
|
|
187
270
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
271
|
+
let first = true;
|
|
272
|
+
const heard = (message) => {
|
|
273
|
+
if (!first) {
|
|
274
|
+
held = digestApplied(held, message);
|
|
275
|
+
deliver(message);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
first = false;
|
|
279
|
+
const change = held === null ? message : changeOf(held, message);
|
|
280
|
+
held = digestOf(message);
|
|
281
|
+
if (change !== null)
|
|
282
|
+
deliver(change);
|
|
283
|
+
};
|
|
284
|
+
const current = { ...plan, reach: planReach(reach), locked };
|
|
285
|
+
stop = runtime.watchPlan(current, (message) => {
|
|
286
|
+
if (open)
|
|
287
|
+
heard(message);
|
|
288
|
+
}, (error) => {
|
|
289
|
+
if (open)
|
|
290
|
+
fail(error);
|
|
291
|
+
});
|
|
292
|
+
})().catch((error) => {
|
|
293
|
+
if (open)
|
|
294
|
+
fail(error);
|
|
193
295
|
});
|
|
194
|
-
|
|
296
|
+
return () => {
|
|
297
|
+
open = false;
|
|
298
|
+
stop();
|
|
299
|
+
};
|
|
300
|
+
}, true);
|
|
195
301
|
}
|
|
196
302
|
if (topic === 'conversation') {
|
|
197
303
|
return following(() => {
|
|
198
304
|
if (conversing(reach))
|
|
199
|
-
return watch(topic, input, deliver);
|
|
305
|
+
return watch(topic, input, deliver, fail);
|
|
200
306
|
deliver(unheldView(input[0]));
|
|
201
307
|
return () => { };
|
|
202
308
|
});
|
|
203
309
|
}
|
|
204
|
-
if (topic === 'conversations') {
|
|
310
|
+
if (topic === 'conversations' || topic === 'agents') {
|
|
205
311
|
return following(() => {
|
|
206
312
|
if (conversing(reach))
|
|
207
|
-
return watch(topic, input, deliver);
|
|
313
|
+
return watch(topic, input, deliver, fail);
|
|
208
314
|
deliver([]);
|
|
209
315
|
return () => { };
|
|
210
316
|
});
|
|
211
317
|
}
|
|
212
|
-
|
|
318
|
+
if (topic === 'figures' || topic === 'holdings') {
|
|
319
|
+
if (reach === null)
|
|
320
|
+
return watch(topic, input, deliver, fail);
|
|
321
|
+
fail(deviceUnreached());
|
|
322
|
+
return () => { };
|
|
323
|
+
}
|
|
324
|
+
return watch(topic, input, deliver, fail);
|
|
213
325
|
};
|
|
326
|
+
const files = new Map();
|
|
327
|
+
let handed = 0;
|
|
328
|
+
async function hand(reading) {
|
|
329
|
+
const answer = await reading;
|
|
330
|
+
if (answer.kind !== 'binary')
|
|
331
|
+
return answer;
|
|
332
|
+
handed += 1;
|
|
333
|
+
const file = String(handed);
|
|
334
|
+
files.set(file, answer.file);
|
|
335
|
+
return { ...answer, file };
|
|
336
|
+
}
|
|
214
337
|
const conversation = () => (conversing(reach) ? md.conversation : NO_CONVERSATION);
|
|
215
338
|
const chatDraft = () => (conversing(reach) ? md.chatDraft : NO_CHAT_DRAFT);
|
|
216
339
|
const view = {
|
|
217
340
|
...md,
|
|
218
|
-
rooms: () => roomsWithin(reach,
|
|
219
|
-
query: ((input) =>
|
|
341
|
+
rooms: () => md.rooms().then((rooms) => roomsWithin(reach, rooms)),
|
|
342
|
+
query: (async (input) => {
|
|
343
|
+
const plan = await runtime.plan(input, reach);
|
|
344
|
+
const locked = await runtime.lockedRooms();
|
|
345
|
+
return unlocking(plan.rooms, locked) ?? runtime.query({ ...plan, locked });
|
|
346
|
+
}),
|
|
220
347
|
search: (input) => runtime.search(input, reach),
|
|
221
|
-
types(room) {
|
|
348
|
+
async types(room) {
|
|
349
|
+
if (holds(reach, room) && (await runtime.locked(room)))
|
|
350
|
+
throw lockedError(room);
|
|
222
351
|
if (wholly(reach, room))
|
|
223
352
|
return md.types(room);
|
|
224
353
|
if (!holds(reach, room))
|
|
225
354
|
return structuredClone(UNHELD_TYPES);
|
|
226
|
-
|
|
227
|
-
return typesWithin(reach, listed, md.types(room));
|
|
355
|
+
return typesWithin(reach, await runtime.room(room), await md.types(room));
|
|
228
356
|
},
|
|
229
357
|
async save(room, roomDrafts, writtenBy) {
|
|
230
358
|
if (!holds(reach, room))
|
|
231
359
|
throw unreached(room);
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
360
|
+
if (await runtime.locked(room)) {
|
|
361
|
+
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
362
|
+
}
|
|
363
|
+
const held = (await Promise.all(roomDrafts.map(({ path }) => md.roomDraft.read(room, path)))).map((draft) => draft?.parts.move);
|
|
364
|
+
const outside = roomDrafts.find(({ path }, at) => !covers(reach, room, path) || !moves(reach, room, held[at]));
|
|
365
|
+
if (outside !== undefined) {
|
|
366
|
+
return { outcome: 'refused', code: 'stale', retryable: false, file: outside.path };
|
|
367
|
+
}
|
|
368
|
+
if (await intoLocked(held))
|
|
369
|
+
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
236
370
|
return savedWithin(reach, room, await md.save(room, roomDrafts, writtenBy));
|
|
237
371
|
},
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
372
|
+
async saveParts(room, parts, writtenBy) {
|
|
373
|
+
if (!holds(reach, room))
|
|
374
|
+
throw unreached(room);
|
|
375
|
+
const filed = reach === null ? undefined : parts.find(({ parts: one }) => carriesFile(one));
|
|
376
|
+
if (filed !== undefined) {
|
|
377
|
+
return { outcome: 'refused', code: ATTACH_REQUIRED, retryable: false, file: filed.path };
|
|
378
|
+
}
|
|
379
|
+
if (await runtime.locked(room)) {
|
|
380
|
+
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
381
|
+
}
|
|
382
|
+
const held = parts.map(({ path, parts: one }) => readParts(one, path).move);
|
|
383
|
+
if (parts.some(({ path }, at) => !covers(reach, room, path) || !moves(reach, room, held[at]))) {
|
|
384
|
+
throw unreached(room);
|
|
385
|
+
}
|
|
386
|
+
if (await intoLocked(held))
|
|
387
|
+
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
388
|
+
return savedWithin(reach, room, await md.saveParts(room, parts, writtenBy));
|
|
389
|
+
},
|
|
390
|
+
async resolve(room, path, destination) {
|
|
391
|
+
const at = await runtime.located(room, path, destination);
|
|
392
|
+
return at !== null && !covers(reach, at.room, at.path)
|
|
393
|
+
? UNREADABLE
|
|
394
|
+
: md.resolve(room, path, destination);
|
|
395
|
+
},
|
|
396
|
+
history: async (room, path, query) => !covers(reach, room, path)
|
|
397
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
398
|
+
: (await runtime.locked(room))
|
|
399
|
+
? lockedRoom(room)
|
|
400
|
+
: md.history(room, path, query),
|
|
401
|
+
binaryFile: {
|
|
402
|
+
read: async (room, path, revision) => !covers(reach, room, path)
|
|
403
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
404
|
+
: (await runtime.locked(room))
|
|
405
|
+
? lockedRoom(room)
|
|
406
|
+
: hand(md.binaryFile.read(room, path, revision)),
|
|
407
|
+
link: async (room, path, revision) => !covers(reach, room, path)
|
|
408
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
409
|
+
: (await runtime.locked(room))
|
|
410
|
+
? lockedRoom(room)
|
|
411
|
+
: md.binaryFile.link(room, path, revision),
|
|
412
|
+
show: async (room, path, revision) => !covers(reach, room, path)
|
|
413
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
414
|
+
: (await runtime.locked(room))
|
|
415
|
+
? lockedRoom(room)
|
|
416
|
+
: hand(md.binaryFile.show(room, path, revision)),
|
|
417
|
+
attach: async (room, file) => !wholly(reach, room)
|
|
418
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
419
|
+
: (await runtime.locked(room))
|
|
420
|
+
? lockedRoom(room)
|
|
421
|
+
: md.binaryFile.attach(room, file),
|
|
422
|
+
async part(file, part) {
|
|
423
|
+
const key = files.get(file);
|
|
424
|
+
if (key === undefined)
|
|
425
|
+
return null;
|
|
426
|
+
const bytes = await md.binaryFile.part(key, part);
|
|
427
|
+
if (bytes === null)
|
|
428
|
+
files.delete(file);
|
|
429
|
+
return bytes;
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
reached: async (room, roomVersion, path) => (path === undefined ? wholly(reach, room) : covers(reach, room, path)) &&
|
|
433
|
+
!(await runtime.locked(room)) &&
|
|
434
|
+
(await md.reached(room, roomVersion, path)),
|
|
243
435
|
log: () => (reach === null ? md.log() : ''),
|
|
436
|
+
cleanUp: () => (reach === null ? md.cleanUp() : Promise.reject(deviceUnreached())),
|
|
437
|
+
unsent: () => (reach === null ? md.unsent() : Promise.reject(deviceUnreached())),
|
|
438
|
+
reset: () => (reach === null ? md.reset() : Promise.reject(deviceUnreached())),
|
|
439
|
+
readAgain: () => (reach === null ? md.readAgain() : Promise.reject(deviceUnreached())),
|
|
244
440
|
roomDraft: {
|
|
245
|
-
list: () => md.roomDraft.list()
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
441
|
+
list: async () => unlocked(draftsWithin(reach, await md.roomDraft.list()), await runtime.lockedRooms()),
|
|
442
|
+
async read(room, path) {
|
|
443
|
+
if (!covers(reach, room, path))
|
|
444
|
+
return null;
|
|
445
|
+
if (await runtime.locked(room))
|
|
446
|
+
throw lockedError(room);
|
|
447
|
+
return shownDraft(reach, await md.roomDraft.read(room, path));
|
|
448
|
+
},
|
|
449
|
+
async write(room, path, revision, parts, next) {
|
|
450
|
+
if (reach !== null && carriesFile(parts))
|
|
451
|
+
throw attachRequired();
|
|
452
|
+
const move = readParts(parts, path).move;
|
|
453
|
+
if (!covers(reach, room, path) || !moves(reach, room, move))
|
|
249
454
|
throw unreached(room);
|
|
250
|
-
|
|
251
|
-
|
|
455
|
+
if (await runtime.locked(room))
|
|
456
|
+
throw lockedError(room);
|
|
457
|
+
if (await intoLocked([move]))
|
|
458
|
+
throw lockedError(move.room);
|
|
459
|
+
return writeWithin(reach, await md.roomDraft.write(room, path, revision, parts, next));
|
|
252
460
|
},
|
|
253
461
|
async discard(room, path, revision) {
|
|
254
462
|
if (!covers(reach, room, path))
|
|
255
|
-
return
|
|
463
|
+
return staleWrite(null);
|
|
464
|
+
if (await runtime.locked(room))
|
|
465
|
+
throw lockedError(room);
|
|
256
466
|
return writeWithin(reach, await md.roomDraft.discard(room, path, revision));
|
|
257
467
|
},
|
|
258
468
|
},
|
|
@@ -260,15 +470,15 @@ export function narrowed(runtime, given) {
|
|
|
260
470
|
list: () => conversation().list(),
|
|
261
471
|
read: (id, options) => conversation().read(id, options),
|
|
262
472
|
create: (input) => conversation().create(input),
|
|
263
|
-
send: (id) => conversation().send(id),
|
|
473
|
+
send: (id, operation, draft) => conversation().send(id, operation, draft),
|
|
264
474
|
answer: (id, answer) => conversation().answer(id, answer),
|
|
265
475
|
interrupt: (id) => conversation().interrupt(id),
|
|
266
476
|
kill: (id) => conversation().kill(id),
|
|
267
|
-
cancel: (id, turn) => conversation().cancel(id, turn),
|
|
268
477
|
delete: (id) => conversation().delete(id),
|
|
269
478
|
},
|
|
270
479
|
chatDraft: {
|
|
271
|
-
write: (id, draft) => chatDraft().write(id, draft),
|
|
480
|
+
write: (id, draft, revision) => chatDraft().write(id, draft, revision),
|
|
481
|
+
prepend: (id, draft) => chatDraft().prepend(id, draft),
|
|
272
482
|
discard: (id) => chatDraft().discard(id),
|
|
273
483
|
},
|
|
274
484
|
observe: observing(within),
|
package/dist/react.d.ts
CHANGED
|
@@ -1,30 +1,54 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
1
2
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import type { AppRoom
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { AppRoom } from './listing.js';
|
|
4
|
+
import type { ConnectionRefusal } from './socket.js';
|
|
5
|
+
import type { SavedRoomDraft, SaveResult } from './saves.js';
|
|
6
|
+
import type { Member, ServiceMode } from './adapter.js';
|
|
7
|
+
import type { ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
8
|
+
import { type RuntimeError } from './failure.js';
|
|
9
|
+
import type { FiguresResult } from './figures.js';
|
|
10
|
+
import type { Holdings } from './holdings.js';
|
|
11
|
+
import type { Expecting } from './expectation.js';
|
|
5
12
|
import type { QueueEntry } from './outcome.js';
|
|
6
|
-
import type {
|
|
13
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
14
|
+
import type { Readiness } from './readiness.js';
|
|
7
15
|
import type { RoomDraft, RoomDraftParts } from './room-draft.js';
|
|
8
16
|
import type { SyncStatus } from './status.js';
|
|
9
17
|
type Client = MdRuntimeClient | null;
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export declare function useObserve(client: Client, topic: '
|
|
17
|
-
export declare function useObserve(client: Client, topic: '
|
|
18
|
-
export declare function useObserve(client: Client, topic: '
|
|
19
|
-
export declare function useObserve(client: Client, topic: '
|
|
20
|
-
export declare function useObserve(client: Client, topic: '
|
|
21
|
-
export declare function useObserve(client: Client, topic: '
|
|
22
|
-
export declare function useObserve(client: Client, topic: '
|
|
18
|
+
export type Observed<T> = {
|
|
19
|
+
readonly state: 'loading';
|
|
20
|
+
} | {
|
|
21
|
+
readonly state: 'ready';
|
|
22
|
+
readonly value: T;
|
|
23
|
+
};
|
|
24
|
+
export declare function useObserve(client: Client, topic: 'deployment-facts'): Observed<unknown>;
|
|
25
|
+
export declare function useObserve(client: Client, topic: 'rooms'): Observed<readonly AppRoom[]>;
|
|
26
|
+
export declare function useObserve(client: Client, topic: 'readiness'): Observed<Readiness>;
|
|
27
|
+
export declare function useObserve(client: Client, topic: 'connection-refusal'): Observed<ConnectionRefusal | null>;
|
|
28
|
+
export declare function useObserve(client: Client, topic: 'storage-loss'): Observed<string | null>;
|
|
29
|
+
export declare function useObserve(client: Client, topic: 'sync-status'): Observed<SyncStatus>;
|
|
30
|
+
export declare function useObserve(client: Client, topic: 'service-mode'): Observed<ServiceMode>;
|
|
31
|
+
export declare function useObserve(client: Client, topic: 'member'): Observed<Member | null>;
|
|
32
|
+
export declare function useObserve(client: Client, topic: 'authority-changes'): Observed<number>;
|
|
33
|
+
export declare function useObserve(client: Client, topic: 'query', query: DocumentQuery): Observed<DocumentResult | PendingResult>;
|
|
34
|
+
export declare function useObserve(client: Client, topic: 'query', query: GroupQuery): Observed<GroupResult | PendingResult>;
|
|
35
|
+
export declare function useObserve(client: Client, topic: 'queue', locator: string): Observed<readonly QueueEntry[]>;
|
|
36
|
+
export declare function useObserve(client: Client, topic: 'room-drafts'): Observed<readonly RoomDraft[]>;
|
|
37
|
+
export declare function useObserve(client: Client, topic: 'presentation'): Observed<unknown>;
|
|
38
|
+
export declare function useObserve(client: Client, topic: 'conversation', conversation: string, options: ConversationOptions): Observed<ConversationView>;
|
|
39
|
+
export declare function useObserve(client: Client, topic: 'conversations'): Observed<readonly ConversationEntry[]>;
|
|
40
|
+
export declare function useObserve(client: Client, topic: 'agents'): Observed<readonly ConversationAgent[]>;
|
|
41
|
+
export declare function useObserve(client: Client, topic: 'figures'): Observed<FiguresResult>;
|
|
42
|
+
export declare function useObserve(client: Client, topic: 'holdings'): Observed<Holdings>;
|
|
43
|
+
export declare function useReading<E extends {
|
|
44
|
+
readonly key: string;
|
|
45
|
+
}>(store: Pick<Expecting<E>, 'reads' | 'heard' | 'left'>, asks: (one: E) => boolean, shown: ((one: E) => boolean) | null): void;
|
|
23
46
|
export type Saving = {
|
|
24
47
|
readonly busy: boolean;
|
|
25
48
|
readonly outcome: SaveResult | null;
|
|
26
|
-
readonly failure:
|
|
27
|
-
save(room: string,
|
|
49
|
+
readonly failure: RuntimeError | null;
|
|
50
|
+
save(room: string, parts: ReadonlyMap<string, RoomDraftParts>): Promise<SaveResult>;
|
|
51
|
+
saveWritten(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
|
|
28
52
|
};
|
|
29
53
|
export declare function useSave(client: MdRuntimeClient): Saving;
|
|
30
54
|
export {};
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,O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