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