@agentshouse/mdruntime 0.1.0-cd71aba4d0215 → 0.1.0-cd8d184c6fbe0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -19
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +32 -22
- package/dist/act-lanes.d.ts +11 -14
- package/dist/act-lanes.d.ts.map +1 -1
- package/dist/act-lanes.js +53 -5
- package/dist/actions.d.ts +1 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +135 -55
- package/dist/adapter.d.ts +168 -29
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +2 -7
- package/dist/{binary.d.ts → attachment.d.ts} +8 -4
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +15 -0
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +347 -0
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- package/dist/change.d.ts +6 -2
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +3 -0
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +2 -4
- package/dist/client.d.ts +27 -15
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +29 -57
- package/dist/collection.d.ts +6 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +23 -9
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts +4 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +88 -44
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +15 -14
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +21 -9
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +19 -8
- package/dist/conversation-row.d.ts +20 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +30 -7
- package/dist/conversation.d.ts +30 -12
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +273 -193
- package/dist/declaration.js +3 -3
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +30 -8
- package/dist/download.d.ts +6 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +42 -0
- package/dist/durability.d.ts +2 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +25 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +111 -34
- package/dist/expectation.d.ts +25 -14
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +51 -20
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -1
- package/dist/figures.d.ts +1 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +6 -4
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +7 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +77 -31
- package/dist/house-query.d.ts +24 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +102 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -7
- package/dist/install.d.ts +9 -3
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +44 -46
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +42 -29
- package/dist/listing.d.ts +24 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +50 -21
- package/dist/live.d.ts +19 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +94 -36
- package/dist/loaded.d.ts +7 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +46 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +4 -3
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +2 -3
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +181 -34
- package/dist/memory.d.ts +7 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +66 -22
- package/dist/messages.d.ts +21 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +43 -13
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +10 -7
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +5 -8
- package/dist/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +206 -69
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opened.d.ts +5 -5
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +2 -2
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +22 -10
- package/dist/outcome.d.ts +30 -13
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +21 -6
- package/dist/overlay.d.ts +21 -7
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +112 -39
- package/dist/parts.d.ts +4 -9
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +30 -15
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +1 -1
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +198 -87
- package/dist/presence.d.ts +8 -2
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +24 -13
- package/dist/queries.d.ts +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +133 -73
- package/dist/query.d.ts +2 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +1 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -8
- package/dist/queue.d.ts +2 -2
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +73 -48
- package/dist/reach.d.ts +15 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +180 -39
- package/dist/react.d.ts +16 -11
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +22 -4
- package/dist/readiness.d.ts +23 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +18 -10
- package/dist/reads.d.ts +1 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +17 -6
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +2 -1
- package/dist/reference-forms.d.ts +4 -0
- package/dist/reference-forms.d.ts.map +1 -0
- package/dist/reference-forms.js +74 -0
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +4 -4
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +1 -3
- package/dist/replica.d.ts +3 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +5 -5
- package/dist/room-draft.d.ts +31 -6
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +262 -36
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +12 -7
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +47 -0
- package/dist/rows.d.ts +11 -2
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +24 -10
- package/dist/run-tables.d.ts +25 -0
- package/dist/run-tables.d.ts.map +1 -0
- package/dist/run-tables.js +98 -0
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runs.d.ts +27 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +92 -0
- package/dist/runtime.d.ts +5 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +105 -124
- package/dist/saves.d.ts +7 -5
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +107 -57
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/selector.d.ts +3 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +22 -0
- package/dist/shown.d.ts +5 -2
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +79 -43
- package/dist/socket/lanes.d.ts +10 -3
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +29 -6
- package/dist/socket/session.d.ts +4 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +3 -0
- package/dist/socket.d.ts +6 -4
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +10 -9
- package/dist/source.d.ts +18 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +36 -2
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +30 -8
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +70 -26
- package/dist/store/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store.d.ts +15 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +12 -5
- package/dist/stored.d.ts +41 -16
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +215 -57
- package/dist/surface.d.ts +20 -8
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +62 -27
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +52 -35
- package/dist/tables.d.ts +41 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +110 -326
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +3 -4
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +50 -10
- package/dist/wire.d.ts +40 -16
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +22 -14
- package/package.json +4 -4
- package/dist/binary.d.ts.map +0 -1
- package/dist/binary.js +0 -8
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
package/dist/surface.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { called, located, readHistory, resolveReference } from './actions.js';
|
|
2
|
-
import { chatDraftSurface, conversationSurface, watchConversation, watchConversationAgents, watchConversationList, } from './conversation.js';
|
|
1
|
+
import { answeredCall, called, located, readHistory, resolveReference, } from './actions.js';
|
|
2
|
+
import { chatDraftSurface, conversationSurface, watchConversation, watchConversationAgents, watchListedAgents, watchConversationList, } from './conversation.js';
|
|
3
|
+
import { leftToSend } from './durability.js';
|
|
3
4
|
import { uncaught } from './failure.js';
|
|
5
|
+
import { watchRoomList } from './room-list.js';
|
|
4
6
|
import { CLEANED_TOPIC, watchHoldings } from './holdings.js';
|
|
5
7
|
import { reachedBy, writtenAfter } from './install.js';
|
|
6
|
-
import { declarationOf, listingNow, modelIn, shownRooms } from './listing.js';
|
|
8
|
+
import { declarationOf, listingNow, modelIn, shownRooms, } from './listing.js';
|
|
7
9
|
import { stop } from './lifecycle.js';
|
|
8
10
|
import { locked, lockedRooms, watchLocks } from './locks.js';
|
|
9
11
|
import { modelTypes } from './model.js';
|
|
@@ -12,10 +14,12 @@ import { watchReadiness } from './preparation.js';
|
|
|
12
14
|
import { planned, rowsQuery, searched, watchPlan, watchPlanned } from './queries.js';
|
|
13
15
|
import { narrowed, } from './reach.js';
|
|
14
16
|
import { presentationSurface, roomDraftSurface, watchPresentation, watchRoomDrafts, } from './room-drafts.js';
|
|
15
|
-
import {
|
|
17
|
+
import { watchRuns } from './runs.js';
|
|
18
|
+
import { attachmentSurface, conversationFiles, saveParts, saveRoomDrafts, } from './saves.js';
|
|
19
|
+
import { queriedHouse, } from './house-query.js';
|
|
16
20
|
import { keepEntrySeed } from './seed.js';
|
|
17
|
-
import { AUTHORITY_TOPIC, emitKnownRooms, entriesOf, MEMBER_TOPIC, queueTopic, REFUSAL_TOPIC, ROOMS_TOPIC, SERVICE_MODE_TOPIC, STATUS_TOPIC, STORAGE_LOSS_TOPIC, } from './shown.js';
|
|
18
|
-
import { OPENING_LANE
|
|
21
|
+
import { AUTHORITY_TOPIC, emitKnownRooms, emitStorageLoss, entriesOf, MEMBER_TOPIC, queueTopic, REFUSAL_TOPIC, ROOMS_TOPIC, SERVICE_MODE_TOPIC, STATUS_TOPIC, STORAGE_LOSS_TOPIC, storageLossNow, TIME_ZONE_TOPIC, } from './shown.js';
|
|
22
|
+
import { OPENING_LANE } from './sync.js';
|
|
19
23
|
function told(store, topic, deliver, current) {
|
|
20
24
|
const watcher = store.watch(topic, deliver);
|
|
21
25
|
deliver(current);
|
|
@@ -28,17 +32,17 @@ function watchRooms(runtime, deliver) {
|
|
|
28
32
|
return () => {
|
|
29
33
|
watcher.stop();
|
|
30
34
|
if (store.watching(ROOMS_TOPIC, 'ready').length === 0)
|
|
31
|
-
store.
|
|
35
|
+
store.roomsShown.show(null);
|
|
32
36
|
};
|
|
33
37
|
}
|
|
34
|
-
function
|
|
35
|
-
const watcher = store.watch(
|
|
38
|
+
function watchFact({ store }, topic, fact, deliver) {
|
|
39
|
+
const watcher = store.watch(topic, deliver);
|
|
36
40
|
void store
|
|
37
41
|
.open()
|
|
38
42
|
.then((local) => local.facts())
|
|
39
|
-
.then((
|
|
43
|
+
.then((facts) => {
|
|
40
44
|
if (watcher.held())
|
|
41
|
-
deliver(
|
|
45
|
+
deliver(facts[fact]);
|
|
42
46
|
}, uncaught);
|
|
43
47
|
return watcher.stop;
|
|
44
48
|
}
|
|
@@ -67,16 +71,22 @@ function watching(runtime) {
|
|
|
67
71
|
return watchConversationList(conversations, deliver);
|
|
68
72
|
if (topic === 'agents')
|
|
69
73
|
return watchConversationAgents(conversations, deliver);
|
|
74
|
+
if (topic === 'listed-agents')
|
|
75
|
+
return watchListedAgents(conversations, deliver);
|
|
76
|
+
if (topic === 'room-list')
|
|
77
|
+
return watchRoomList(runtime, deliver);
|
|
70
78
|
if (topic === 'figures')
|
|
71
79
|
return figures.watch(deliver, fail);
|
|
72
80
|
if (topic === 'holdings')
|
|
73
81
|
return watchHoldings(runtime, deliver, fail);
|
|
74
82
|
if (topic === 'read')
|
|
75
83
|
return lastAnswers.watch(input[0], input[1], deliver);
|
|
84
|
+
if (topic === 'runs')
|
|
85
|
+
return watchRuns(runtime, input[0], deliver);
|
|
76
86
|
if (topic === 'presentation')
|
|
77
87
|
return watchPresentation(runtime, input[0], deliver);
|
|
78
88
|
if (topic === 'readiness') {
|
|
79
|
-
return watchReadiness(runtime, { target: '', code: 'stored' }, null, deliver);
|
|
89
|
+
return watchReadiness(runtime, { target: '', code: 'stored', first: null, inboxed: null }, null, deliver);
|
|
80
90
|
}
|
|
81
91
|
if (topic === 'rooms')
|
|
82
92
|
return watchRooms(runtime, deliver);
|
|
@@ -84,7 +94,7 @@ function watching(runtime) {
|
|
|
84
94
|
return told(store, REFUSAL_TOPIC, deliver, session.refusal);
|
|
85
95
|
}
|
|
86
96
|
if (topic === 'storage-loss') {
|
|
87
|
-
return told(store, STORAGE_LOSS_TOPIC, deliver,
|
|
97
|
+
return told(store, STORAGE_LOSS_TOPIC, deliver, storageLossNow(runtime));
|
|
88
98
|
}
|
|
89
99
|
if (topic === 'sync-status') {
|
|
90
100
|
return told(store, STATUS_TOPIC, deliver, store.device.now().status);
|
|
@@ -93,7 +103,9 @@ function watching(runtime) {
|
|
|
93
103
|
return told(store, SERVICE_MODE_TOPIC, deliver, session.serviceMode);
|
|
94
104
|
}
|
|
95
105
|
if (topic === 'member')
|
|
96
|
-
return
|
|
106
|
+
return watchFact(runtime, MEMBER_TOPIC, 'member', deliver);
|
|
107
|
+
if (topic === 'time-zone')
|
|
108
|
+
return watchFact(runtime, TIME_ZONE_TOPIC, 'timeZone', deliver);
|
|
97
109
|
if (topic === 'authority-changes') {
|
|
98
110
|
return told(store, AUTHORITY_TOPIC, deliver, session.authorityChanges);
|
|
99
111
|
}
|
|
@@ -105,7 +117,7 @@ function watching(runtime) {
|
|
|
105
117
|
function roomsOnce(runtime) {
|
|
106
118
|
const { store, socket } = runtime;
|
|
107
119
|
if (socket.closed())
|
|
108
|
-
return Promise.resolve([]);
|
|
120
|
+
return Promise.resolve({ rooms: [], models: {} });
|
|
109
121
|
return new Promise((settle) => {
|
|
110
122
|
const watcher = store.watch(ROOMS_TOPIC, (value) => {
|
|
111
123
|
watcher.stop();
|
|
@@ -123,44 +135,66 @@ async function typesOf(runtime, locator) {
|
|
|
123
135
|
typedSelection: (room?.typedSelection ?? null) === null ? null : modelTypes(builtIn),
|
|
124
136
|
};
|
|
125
137
|
}
|
|
138
|
+
async function sentAll(runtime) {
|
|
139
|
+
const { store } = runtime;
|
|
140
|
+
for (;;) {
|
|
141
|
+
let moved;
|
|
142
|
+
const status = new Promise((resolve) => {
|
|
143
|
+
moved = resolve;
|
|
144
|
+
});
|
|
145
|
+
const watcher = store.watch(STATUS_TOPIC, () => moved());
|
|
146
|
+
try {
|
|
147
|
+
if (!leftToSend(await store.ask({ kind: 'authored.unsent' })))
|
|
148
|
+
return;
|
|
149
|
+
const calls = await (await store.open()).calls();
|
|
150
|
+
await Promise.race([
|
|
151
|
+
status,
|
|
152
|
+
...calls.map(({ operation }) => answeredCall(runtime, operation)),
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
watcher.stop();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
126
160
|
async function reauthorized(runtime) {
|
|
127
|
-
const { store, socket
|
|
161
|
+
const { store, socket } = runtime;
|
|
128
162
|
const { refusal } = socket.session.now();
|
|
129
163
|
if (refusal === null || !refusal.reauthorizationOffered)
|
|
130
164
|
return;
|
|
131
|
-
journal.record('connection reauthorize');
|
|
132
165
|
await socket.lanes.current();
|
|
133
166
|
await store.written();
|
|
134
167
|
socket.session.set({ authorization: undefined, paused: false });
|
|
135
168
|
if (!socket.streamed)
|
|
136
|
-
await
|
|
169
|
+
await runtime.discover();
|
|
137
170
|
else
|
|
138
171
|
await socket.lanes.task(OPENING_LANE, () => socket.authorize());
|
|
139
172
|
}
|
|
140
173
|
function mdRuntime(runtime, watch) {
|
|
141
|
-
const { store, socket,
|
|
174
|
+
const { store, socket, shell, conversations, lastAnswers } = runtime;
|
|
142
175
|
return {
|
|
143
176
|
loaded: () => store.open().then(() => undefined),
|
|
144
177
|
rooms: () => roomsOnce(runtime),
|
|
145
178
|
query: ((input) => planned(runtime, input, null).then((plan) => rowsQuery(runtime, plan))),
|
|
146
179
|
search: (input) => searched(runtime, input, null),
|
|
180
|
+
queryHouse: (input, options) => queriedHouse(runtime, input, null, options),
|
|
147
181
|
types: (locator) => typesOf(runtime, locator),
|
|
148
182
|
roomDraft: roomDraftSurface(runtime),
|
|
149
|
-
conversation: conversationSurface(conversations),
|
|
183
|
+
conversation: conversationSurface(conversations, conversationFiles(runtime)),
|
|
150
184
|
chatDraft: chatDraftSurface(conversations),
|
|
151
185
|
presentation: presentationSurface(runtime),
|
|
152
186
|
save: (room, named, writtenBy) => saveRoomDrafts(runtime, room, named, writtenBy),
|
|
153
187
|
saveParts: (room, parts, writtenBy) => saveParts(runtime, room, parts, writtenBy),
|
|
154
188
|
history: (locator, path, query) => readHistory(runtime, locator, path, query),
|
|
155
189
|
resolve: (room, path, destination) => resolveReference(runtime, room, path, destination),
|
|
156
|
-
|
|
190
|
+
attachment: attachmentSurface(runtime),
|
|
157
191
|
call: (name, input) => called(runtime, name, input),
|
|
192
|
+
answered: (operation) => answeredCall(runtime, operation),
|
|
158
193
|
async reached(locator, roomVersion, path) {
|
|
159
194
|
return path === undefined
|
|
160
195
|
? reachedBy(runtime, locator, roomVersion)
|
|
161
196
|
: writtenAfter(runtime, locator, roomVersion, path);
|
|
162
197
|
},
|
|
163
|
-
log: () => journal.export(),
|
|
164
198
|
async cleanUp() {
|
|
165
199
|
const freed = await store.ask({ kind: 'opened.clean' });
|
|
166
200
|
const tidied = (await shell.cleanUp?.()) ?? 0;
|
|
@@ -168,13 +202,13 @@ function mdRuntime(runtime, watch) {
|
|
|
168
202
|
return freed + tidied;
|
|
169
203
|
},
|
|
170
204
|
unsent: () => store.ask({ kind: 'authored.unsent' }),
|
|
205
|
+
sent: () => sentAll(runtime),
|
|
171
206
|
reset: () => shell.reset(),
|
|
172
207
|
async readAgain() {
|
|
173
208
|
lastAnswers.again();
|
|
174
209
|
},
|
|
175
210
|
persistence: () => store.device.now().persistence === 'granted',
|
|
176
211
|
async retry() {
|
|
177
|
-
journal.record('retry');
|
|
178
212
|
store.prepareAgain();
|
|
179
213
|
store.readiness.queue();
|
|
180
214
|
if (store.space.full())
|
|
@@ -185,7 +219,7 @@ function mdRuntime(runtime, watch) {
|
|
|
185
219
|
};
|
|
186
220
|
}
|
|
187
221
|
export function composedRuntime(runtime) {
|
|
188
|
-
const { store
|
|
222
|
+
const { store } = runtime;
|
|
189
223
|
const watch = watching(runtime);
|
|
190
224
|
const md = mdRuntime(runtime, watch);
|
|
191
225
|
const reachable = {
|
|
@@ -195,12 +229,14 @@ export function composedRuntime(runtime) {
|
|
|
195
229
|
query: (plan) => rowsQuery(runtime, plan),
|
|
196
230
|
watchPlan: (plan, deliver, fail) => watchPlan(runtime, plan, deliver, fail),
|
|
197
231
|
search: (input, reach) => searched(runtime, input, reach),
|
|
232
|
+
queryHouse: (input, reach, options) => queriedHouse(runtime, input, reach, options),
|
|
233
|
+
queried: () => runtime.socket.session.now().queriesOnly,
|
|
198
234
|
watchReadiness: (port, reach, deliver) => watchReadiness(runtime, port, reach, deliver),
|
|
199
235
|
locked: (locator) => locked(runtime, locator),
|
|
200
236
|
lockedRooms: () => lockedRooms(runtime),
|
|
201
237
|
watchLocks: (notify) => watchLocks(runtime, notify),
|
|
202
238
|
located: (room, path, destination) => located(runtime, room, path, destination),
|
|
203
|
-
room: async (locator) => shownRooms(runtime, await listingNow(runtime)).find((one) => one.locator === locator),
|
|
239
|
+
room: async (locator) => shownRooms(runtime, await listingNow(runtime)).rooms.find((one) => one.locator === locator),
|
|
204
240
|
};
|
|
205
241
|
return {
|
|
206
242
|
md,
|
|
@@ -211,8 +247,7 @@ export function composedRuntime(runtime) {
|
|
|
211
247
|
if (answer === store.device.now().persistence)
|
|
212
248
|
return;
|
|
213
249
|
store.device.set({ persistence: answer });
|
|
214
|
-
|
|
215
|
-
store.readiness.queue();
|
|
250
|
+
emitStorageLoss(runtime);
|
|
216
251
|
},
|
|
217
252
|
within(reach, port) {
|
|
218
253
|
if (store.space.full())
|
package/dist/sync.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ export declare function withhold(runtime: Runtime, withheld: Withheld, room: Dis
|
|
|
11
11
|
export declare function loadRoom(runtime: Runtime, room: DiscoveredRoom, local: RuntimeStore, progress: CycleProgress, live: Live, unheld?: Unheld): Promise<void>;
|
|
12
12
|
export declare function reload(runtime: Runtime, room: DiscoveredRoom, local: RuntimeStore, progress: CycleProgress, live: Live): Promise<void>;
|
|
13
13
|
export declare function finishOpening(runtime: Runtime, progress: CycleProgress, live: Live): Promise<void>;
|
|
14
|
-
export declare function sync(runtime: Runtime, attempt: Attempt, found: Discovery | null): Promise<
|
|
14
|
+
export declare function sync(runtime: Runtime, attempt: Attempt, found: Discovery | null, current?: () => boolean): Promise<boolean>;
|
|
15
|
+
export declare function discover(runtime: Runtime): Promise<void>;
|
|
16
|
+
export declare function adopt(runtime: Runtime, unstored: Discovery): Promise<void>;
|
|
15
17
|
export declare function resynchronize(runtime: Runtime): Promise<void>;
|
|
16
|
-
export declare function countAuthorityChange({ store, socket, lastAnswers }: Runtime): void;
|
|
18
|
+
export declare function countAuthorityChange({ store, socket, lastAnswers }: Runtime, listed?: Promise<unknown>): void;
|
|
17
19
|
export declare function changeAuthority(runtime: Runtime, change: AuthorityChange): Promise<void>;
|
|
18
20
|
export declare function applyRoom(runtime: Runtime, change: RoomChange): Promise<void>;
|
|
19
21
|
//# sourceMappingURL=sync.d.ts.map
|
package/dist/sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACX,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACX,MAAM,cAAc,CAAC;AAMtB,OAAO,EASL,KAAK,MAAM,EACX,KAAK,QAAQ,EACd,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAU5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,YAAY,CAAC;AAG5D,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAE7D,eAAO,MAAM,YAAY,YAAY,CAAC;AA2FtC,wBAAgB,QAAQ,CACtB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,aAAa,GACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAI1B;AAED,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC,CA+Bf;AA+GD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,IAAI,EACV,MAAM,CAAC,EAAE,MAAM,iBAmBhB;AAED,wBAAsB,MAAM,CAC1B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,IAAI,iBA0BX;AAsDD,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,iBAiCxF;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,GAAG,IAAI,EACvB,OAAO,GAAE,MAAM,OAAoB,GAClC,OAAO,CAAC,OAAO,CAAC,CA0ClB;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAW9D;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAK1E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAe7D;AAED,wBAAgB,oBAAoB,CAClC,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EACvC,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,QAM1B;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BxF;AAyDD,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA4D7E"}
|
package/dist/sync.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { resendCalls, resendLater } from './actions.js';
|
|
2
|
-
import { catchUpConversations,
|
|
2
|
+
import { catchUpConversations, reconcileOpening, resendConversations } from './conversation.js';
|
|
3
3
|
import { declared, sameDeclaration } from './declaration.js';
|
|
4
|
-
import { applyDiscovery, discoverRooms, malformed, signIn } from './discovery.js';
|
|
4
|
+
import { applyDiscovery, discoverRooms, DISCOVERY, malformed, signIn, zoned } from './discovery.js';
|
|
5
5
|
import { behind, caughtUpTo, publish, pullBootstrap, pullRefresh, reachedBy, replaced, standingAt, } from './install.js';
|
|
6
6
|
import { heldRooms, name } from './listing.js';
|
|
7
7
|
import { retainModel, revoked, scoped } from './models.js';
|
|
8
8
|
import { refusalError } from './failure.js';
|
|
9
9
|
import { refuse } from './refusal.js';
|
|
10
|
+
import { roomListChanged } from './room-list.js';
|
|
10
11
|
import { emitRooms, moveTo, rest, roomUnreadable, submissionDue, transferring, AUTHORITY_TOPIC, } from './shown.js';
|
|
11
12
|
import { unconfirmed } from './transfer.js';
|
|
12
13
|
export const OPENING_LANE = 'opening';
|
|
@@ -56,7 +57,7 @@ async function refreshedRoom(runtime, room, local, authorized, held, live, hold,
|
|
|
56
57
|
presence.stood(room.locator, false);
|
|
57
58
|
runtime.retries.succeeded('download', room.locator);
|
|
58
59
|
if (presence.readable(room.locator))
|
|
59
|
-
emitRooms(runtime);
|
|
60
|
+
emitRooms(runtime, [room.locator]);
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
63
|
if (refreshed.kind === 'advanced') {
|
|
@@ -79,7 +80,7 @@ export function advanced(runtime, room, local, authorized) {
|
|
|
79
80
|
return runtime.socket.lanes.inRoom(room.locator, (live) => advance(runtime, room, local, authorized, live));
|
|
80
81
|
}
|
|
81
82
|
export async function withhold(runtime, withheld, room, local, progress) {
|
|
82
|
-
const { presence
|
|
83
|
+
const { presence } = runtime;
|
|
83
84
|
if (withheld.kind === 'unconfirmed' || presence.lost(room.locator))
|
|
84
85
|
return;
|
|
85
86
|
if (withheld.kind === 'not-ready') {
|
|
@@ -106,9 +107,6 @@ export async function withhold(runtime, withheld, room, local, progress) {
|
|
|
106
107
|
else if (withheld.kind === 'transport-uncertainty') {
|
|
107
108
|
progress.reachable = false;
|
|
108
109
|
}
|
|
109
|
-
else if (withheld.kind === 'retryable-refusal') {
|
|
110
|
-
journal.record(`refusal ${withheld.kind} ${withheld.code}`);
|
|
111
|
-
}
|
|
112
110
|
else if (withheld.kind === 'room-not-readable') {
|
|
113
111
|
roomUnreadable(runtime, room.locator);
|
|
114
112
|
}
|
|
@@ -133,15 +131,14 @@ function askAgain(runtime, locator) {
|
|
|
133
131
|
});
|
|
134
132
|
}
|
|
135
133
|
async function prepareRoom(runtime, room, progress, prior) {
|
|
136
|
-
const { socket
|
|
134
|
+
const { socket } = runtime;
|
|
137
135
|
const { session } = socket;
|
|
138
136
|
if (socket.closed() || session.now().authorization === undefined) {
|
|
139
137
|
progress.complete = false;
|
|
140
138
|
return false;
|
|
141
139
|
}
|
|
142
140
|
if (prior !== undefined && prior.declaration.replica.selection !== room.replica.selection) {
|
|
143
|
-
emitRooms(runtime);
|
|
144
|
-
journal.record(`selection changed ${room.locator}`);
|
|
141
|
+
emitRooms(runtime, [room.locator]);
|
|
145
142
|
progress.complete = false;
|
|
146
143
|
return false;
|
|
147
144
|
}
|
|
@@ -154,8 +151,14 @@ async function prepareRoom(runtime, room, progress, prior) {
|
|
|
154
151
|
return false;
|
|
155
152
|
return room.replica.admission === 'admitted';
|
|
156
153
|
}
|
|
157
|
-
async function synchronize(runtime, listed,
|
|
154
|
+
async function synchronize(runtime, listed, progress, attempt, live) {
|
|
158
155
|
const { store, socket } = runtime;
|
|
156
|
+
if (listed.length === 0) {
|
|
157
|
+
if (attempt === 'opened')
|
|
158
|
+
socket.hand([]);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const local = await store.open();
|
|
159
162
|
const heldNow = await store.rooms(listed.map(({ locator }) => locator));
|
|
160
163
|
const prepared = await Promise.allSettled(listed.map((room) => prepareRoom(runtime, room, progress, heldNow.get(room.locator)?.record)));
|
|
161
164
|
if (!live())
|
|
@@ -291,21 +294,23 @@ async function repairPass(runtime, locator, signal) {
|
|
|
291
294
|
return repairable.reset === undefined ? 'again' : { at: Date.parse(repairable.reset) };
|
|
292
295
|
}
|
|
293
296
|
export async function finishOpening(runtime, progress, live) {
|
|
294
|
-
const { socket, presence, conversations, recovery } = runtime;
|
|
297
|
+
const { store, socket, presence, conversations, recovery } = runtime;
|
|
295
298
|
try {
|
|
296
299
|
if (!live()) {
|
|
297
300
|
progress.complete = false;
|
|
298
301
|
return;
|
|
299
302
|
}
|
|
303
|
+
const kept = store.needed();
|
|
300
304
|
await submissionDue(runtime);
|
|
301
305
|
for (const locator of presence.repairsOwed())
|
|
302
306
|
repairLater(runtime, locator, {});
|
|
303
|
-
await
|
|
307
|
+
await reconcileOpening(conversations);
|
|
304
308
|
const reading = { complete: true, reachable: true };
|
|
305
309
|
await catchUpConversations(conversations, reading);
|
|
306
|
-
if (progress.reachable && reading.reachable)
|
|
310
|
+
if (kept && progress.reachable && reading.reachable) {
|
|
307
311
|
await resendConversations(conversations, reading);
|
|
308
|
-
|
|
312
|
+
}
|
|
313
|
+
if (kept && progress.reachable) {
|
|
309
314
|
void recovery.attempt('calls', (signal) => resendCalls(runtime, signal));
|
|
310
315
|
}
|
|
311
316
|
if (!reading.reachable) {
|
|
@@ -325,14 +330,17 @@ export async function finishOpening(runtime, progress, live) {
|
|
|
325
330
|
}
|
|
326
331
|
}
|
|
327
332
|
}
|
|
328
|
-
export function sync(runtime, attempt, found) {
|
|
329
|
-
const {
|
|
333
|
+
export async function sync(runtime, attempt, found, current = () => true) {
|
|
334
|
+
const { socket } = runtime;
|
|
330
335
|
const { session } = socket;
|
|
331
|
-
|
|
336
|
+
let answered = true;
|
|
337
|
+
await socket.lanes.task(OPENING_LANE, async (live) => {
|
|
332
338
|
if (!live()) {
|
|
333
339
|
socket.readyFromStore();
|
|
334
340
|
return;
|
|
335
341
|
}
|
|
342
|
+
if (!current())
|
|
343
|
+
return;
|
|
336
344
|
const progress = { complete: true, reachable: true };
|
|
337
345
|
session.set({
|
|
338
346
|
underway: attempt === 'opened' ? progress : null,
|
|
@@ -342,15 +350,13 @@ export function sync(runtime, attempt, found) {
|
|
|
342
350
|
});
|
|
343
351
|
moveTo(runtime, transferring(runtime));
|
|
344
352
|
try {
|
|
345
|
-
const local = await store.open();
|
|
346
|
-
if (!live())
|
|
347
|
-
return;
|
|
348
353
|
await socket.authorize();
|
|
349
354
|
if (!live())
|
|
350
355
|
return;
|
|
351
|
-
const listed = await discoverRooms(runtime,
|
|
356
|
+
const listed = await discoverRooms(runtime, progress, live, found);
|
|
357
|
+
answered = progress.reachable;
|
|
352
358
|
if (listed !== null)
|
|
353
|
-
await synchronize(runtime, listed,
|
|
359
|
+
await synchronize(runtime, listed, progress, attempt, live);
|
|
354
360
|
runtime.retries.succeeded('connection', OPENING_LANE);
|
|
355
361
|
}
|
|
356
362
|
catch (error) {
|
|
@@ -373,19 +379,29 @@ export function sync(runtime, attempt, found) {
|
|
|
373
379
|
session.set({ underway: null });
|
|
374
380
|
await rest(runtime, progress, live);
|
|
375
381
|
});
|
|
382
|
+
return answered;
|
|
383
|
+
}
|
|
384
|
+
export async function discover(runtime) {
|
|
385
|
+
const { recovery } = runtime;
|
|
386
|
+
if (await sync(runtime, 'unstreamed', null)) {
|
|
387
|
+
recovery.cancel(DISCOVERY);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
void recovery.attempt(DISCOVERY, async () => ((await sync(runtime, 'unstreamed', null)) ? 'done' : 'again'), { again: true, attempts: Infinity });
|
|
391
|
+
}
|
|
392
|
+
export function adopt(runtime, unstored) {
|
|
393
|
+
const { session } = runtime.socket;
|
|
394
|
+
return sync(runtime, 'unstreamed', unstored, () => session.now().unstored === unstored).then(() => undefined);
|
|
376
395
|
}
|
|
377
396
|
export function resynchronize(runtime) {
|
|
378
|
-
const {
|
|
397
|
+
const { socket, presence } = runtime;
|
|
379
398
|
return socket.lanes.task(OPENING_LANE, async (live) => {
|
|
380
399
|
if (!live() || !socket.isAnnounced())
|
|
381
400
|
return;
|
|
382
401
|
const progress = { complete: true, reachable: true };
|
|
383
402
|
moveTo(runtime, transferring(runtime));
|
|
384
403
|
try {
|
|
385
|
-
|
|
386
|
-
if (!live())
|
|
387
|
-
return;
|
|
388
|
-
await synchronize(runtime, presence.rooms(), local, progress, 'unstreamed', live);
|
|
404
|
+
await synchronize(runtime, presence.rooms(), progress, 'unstreamed', live);
|
|
389
405
|
runtime.retries.succeeded('download', OPENING_LANE);
|
|
390
406
|
}
|
|
391
407
|
catch (error) {
|
|
@@ -396,19 +412,19 @@ export function resynchronize(runtime) {
|
|
|
396
412
|
await finishOpening(runtime, progress, live);
|
|
397
413
|
});
|
|
398
414
|
}
|
|
399
|
-
export function countAuthorityChange({ store, socket, lastAnswers }) {
|
|
415
|
+
export function countAuthorityChange({ store, socket, lastAnswers }, listed) {
|
|
400
416
|
const authorityChanges = socket.session.now().authorityChanges + 1;
|
|
401
417
|
socket.session.set({ authorityChanges });
|
|
402
418
|
store.tell(AUTHORITY_TOPIC, authorityChanges);
|
|
403
|
-
lastAnswers.again();
|
|
419
|
+
lastAnswers.again(listed);
|
|
404
420
|
}
|
|
405
421
|
export function changeAuthority(runtime, change) {
|
|
406
|
-
const { store, socket
|
|
422
|
+
const { store, socket } = runtime;
|
|
407
423
|
const { session } = socket;
|
|
408
424
|
return socket.lanes.task(OPENING_LANE, async (live) => {
|
|
409
425
|
if (!live() || !socket.isAnnounced())
|
|
410
426
|
return;
|
|
411
|
-
countAuthorityChange(runtime);
|
|
427
|
+
countAuthorityChange(runtime, roomListChanged(runtime, change.roomList));
|
|
412
428
|
const progress = { complete: true, reachable: true };
|
|
413
429
|
moveTo(runtime, transferring(runtime));
|
|
414
430
|
try {
|
|
@@ -417,16 +433,17 @@ export function changeAuthority(runtime, change) {
|
|
|
417
433
|
return;
|
|
418
434
|
const invalid = malformed(change.rooms);
|
|
419
435
|
if (invalid !== null) {
|
|
420
|
-
journal.record(invalid);
|
|
421
436
|
await refuse(runtime, 'missing-required-guarantee');
|
|
422
437
|
return;
|
|
423
438
|
}
|
|
424
439
|
if (change.member !== undefined)
|
|
425
440
|
await signIn(runtime, local, change.member);
|
|
441
|
+
if (change.timeZone !== undefined)
|
|
442
|
+
await zoned(runtime, local, change.timeZone);
|
|
426
443
|
const discoveries = session.now().discoveries + 1;
|
|
427
444
|
session.set({ discoveries });
|
|
428
445
|
const listed = await applyDiscovery(runtime, change.rooms, discoveries, change.left);
|
|
429
|
-
await synchronize(runtime, listed,
|
|
446
|
+
await synchronize(runtime, listed, progress, 'authorized', live);
|
|
430
447
|
runtime.retries.succeeded('connection', OPENING_LANE);
|
|
431
448
|
}
|
|
432
449
|
catch (error) {
|
|
@@ -461,7 +478,7 @@ async function installCarried(runtime, room, local, change, live, progress) {
|
|
|
461
478
|
...(page.fileIds === undefined ? {} : { fileIds: page.fileIds }),
|
|
462
479
|
...(page.created === undefined ? {} : { created: page.created }),
|
|
463
480
|
changes: page.changes,
|
|
464
|
-
|
|
481
|
+
attachments: page.attachments,
|
|
465
482
|
...(page.folders === undefined ? {} : { folders: page.folders }),
|
|
466
483
|
}),
|
|
467
484
|
reached: socket.reads.reached,
|
package/dist/tables.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { type QueryAnswer, type QueryRoom } from './compile.js';
|
|
2
2
|
import type { Composed } from './collection.js';
|
|
3
|
+
import { type AuthoredFact, type AuthoredWrite, type HeldQueues, type KeptRecord, type StoredFile } from './authored.js';
|
|
3
4
|
import type { UnsentWork } from './durability.js';
|
|
4
|
-
import { type ConversationWrite, type HeldConversation, type HeldRow, type MessageWindow } from './messages.js';
|
|
5
|
+
import { type ConversationWrite, type HeldConversation, type HeldFact, type HeldRow, type MessageWindow } from './messages.js';
|
|
5
6
|
import type { GroupTotal, Plan } from './query.js';
|
|
7
|
+
import type { RunEvent, RunMarks } from './adapter.js';
|
|
8
|
+
import { type HeldRun, type RunsAsked, type RunSight } from './run-tables.js';
|
|
6
9
|
import { type ReadAt } from './reads.js';
|
|
7
10
|
import { type ConversationTally, type RoomTally } from './tallies.js';
|
|
8
|
-
import { type Committed, type Covering, type HeldEntry, type HeldLocators, type HeldRoomRow, type HeldRoomWork, type ReplicaOpened, type Referrer, type Resumed, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
|
|
9
|
-
export type { Committed, Covering, HeldEntry, HeldLocators, HeldRoomRow, HeldRoomWork, OverlayEntry, ReplicaOpened, Referrer, Resumed, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
|
|
11
|
+
import { type Committed, type CoverLog, type Covering, type HeldEntry, type HeldLocators, type HeldRoomRow, type HeldRoomWork, type Holder, type ReplicaOpened, type Referrer, type Resumed, type RoomCommit, type Sought, type StoredEntry, type TypedEntry, type View } from './stored.js';
|
|
12
|
+
export type { Committed, CoverLog, Covering, HeldEntry, HeldLocators, HeldRoomRow, HeldRoomWork, Holder, OverlayEntry, ReplicaOpened, Referrer, Resumed, RoomCommit, Sought, StoredEntry, TypedEntry, View, } from './stored.js';
|
|
13
|
+
export { kindedRevision } from './reference-forms.js';
|
|
14
|
+
export { authoredEmptied, authoredTable, FILE_PART_BYTES, formatted, heldTables, type AuthoredFact, type AuthoredRows, type KeptRecord, type StoredFile, } from './authored.js';
|
|
10
15
|
export type { QueryAnswer, QueryRoom } from './compile.js';
|
|
11
|
-
export type { ConversationWrite, HeldConversation, HeldRow, MessageWindow } from './messages.js';
|
|
16
|
+
export type { ConversationFact, ConversationWrite, HeldConversation, HeldFact, HeldRow, MessageWindow, } from './messages.js';
|
|
12
17
|
export type { ConversationTally, RoomTally } from './tallies.js';
|
|
13
18
|
export type Value = string | number | bigint | Uint8Array | null;
|
|
14
19
|
export type Row = Readonly<Record<string, Value>>;
|
|
@@ -50,53 +55,13 @@ export interface SqliteDatabase {
|
|
|
50
55
|
prepare(sql: string): SqliteStatement;
|
|
51
56
|
}
|
|
52
57
|
export declare function sqliteConnection(engine: SqliteEngine, database: SqliteDatabase): Connection;
|
|
53
|
-
export declare const FILE_PART_BYTES = 1048576;
|
|
54
58
|
export declare const RUNTIME_TABLES: readonly string[];
|
|
55
|
-
export type AuthoredFact = 'holder' | 'generation';
|
|
56
|
-
export type StoredFile = {
|
|
57
|
-
readonly key: string;
|
|
58
|
-
readonly blob: Blob;
|
|
59
|
-
};
|
|
60
59
|
export interface FileSpool {
|
|
61
60
|
held(): Iterable<string>;
|
|
62
61
|
spool(key: string, type: string, parts: Iterable<Uint8Array>): Promise<Blob>;
|
|
63
62
|
drop(key: string): Promise<void>;
|
|
64
63
|
probe(bytes: number): Promise<void>;
|
|
65
64
|
}
|
|
66
|
-
export type KeptPending = {
|
|
67
|
-
readonly id: string;
|
|
68
|
-
readonly batch: string;
|
|
69
|
-
readonly state: string;
|
|
70
|
-
readonly files: readonly string[];
|
|
71
|
-
readonly paths: readonly string[];
|
|
72
|
-
readonly moving: boolean;
|
|
73
|
-
};
|
|
74
|
-
export type KeptRecord = {
|
|
75
|
-
readonly record: string;
|
|
76
|
-
readonly files: readonly string[];
|
|
77
|
-
};
|
|
78
|
-
export type AuthoredRows = {
|
|
79
|
-
readonly locator: string;
|
|
80
|
-
readonly order?: readonly string[];
|
|
81
|
-
readonly added?: readonly KeptPending[];
|
|
82
|
-
readonly founded?: readonly Omit<KeptPending, 'state'>[];
|
|
83
|
-
readonly roomDrafts?: readonly (KeptRecord & {
|
|
84
|
-
readonly path: string;
|
|
85
|
-
})[];
|
|
86
|
-
readonly consumedRoomDrafts?: readonly string[];
|
|
87
|
-
};
|
|
88
|
-
export type HeldQueues = {
|
|
89
|
-
readonly queues: readonly {
|
|
90
|
-
readonly locator: string;
|
|
91
|
-
readonly ids: readonly string[];
|
|
92
|
-
}[];
|
|
93
|
-
readonly pending: readonly {
|
|
94
|
-
readonly locator: string;
|
|
95
|
-
readonly id: string;
|
|
96
|
-
readonly batch: string;
|
|
97
|
-
readonly state: string;
|
|
98
|
-
}[];
|
|
99
|
-
};
|
|
100
65
|
export type HeldStatus = {
|
|
101
66
|
readonly queued: readonly string[];
|
|
102
67
|
readonly lastCompleted: string | null;
|
|
@@ -130,11 +95,6 @@ type Nothing = Readonly<Record<never, never>>;
|
|
|
130
95
|
export type CommittedWrite = Committed & {
|
|
131
96
|
readonly fenced: string | null;
|
|
132
97
|
};
|
|
133
|
-
export type AuthoredWrite = {
|
|
134
|
-
readonly writes: readonly AuthoredRows[];
|
|
135
|
-
readonly files: readonly StoredFile[];
|
|
136
|
-
readonly whole: boolean;
|
|
137
|
-
};
|
|
138
98
|
export interface RuntimeRequests {
|
|
139
99
|
readonly 'authored.status': Asked<Nothing, HeldStatus>;
|
|
140
100
|
readonly 'authored.moving': Asked<Nothing, HeldQueues>;
|
|
@@ -211,21 +171,31 @@ export interface RuntimeRequests {
|
|
|
211
171
|
readonly 'replica.room': Asked<{
|
|
212
172
|
readonly locator: string;
|
|
213
173
|
}, HeldRoomWork>;
|
|
214
|
-
readonly 'replica.covering': Asked<
|
|
174
|
+
readonly 'replica.covering': Asked<{
|
|
175
|
+
readonly since: CoverLog | null;
|
|
176
|
+
}, Covering>;
|
|
215
177
|
readonly 'replica.offline': Asked<{
|
|
216
178
|
readonly locator: string;
|
|
217
179
|
}, string | null>;
|
|
218
180
|
readonly 'replica.held': Asked<Nothing, HeldLocators>;
|
|
219
181
|
readonly 'replica.demote': Asked<Nothing, null>;
|
|
220
|
-
readonly 'replica.facts': Asked<
|
|
182
|
+
readonly 'replica.facts': Asked<{
|
|
183
|
+
readonly names: readonly string[] | null;
|
|
184
|
+
}, Readonly<Record<string, string>>>;
|
|
221
185
|
readonly 'replica.presentation': Asked<{
|
|
222
186
|
readonly app: string;
|
|
223
187
|
}, string | null>;
|
|
224
188
|
readonly 'replica.query': Asked<{
|
|
225
189
|
readonly plan: Plan;
|
|
226
190
|
readonly rooms: readonly QueryRoom[];
|
|
191
|
+
readonly follows: readonly QueryRoom[];
|
|
227
192
|
readonly budget: number | null;
|
|
228
193
|
}, QueryAnswer>;
|
|
194
|
+
readonly 'replica.named': Asked<{
|
|
195
|
+
readonly plan: Plan;
|
|
196
|
+
readonly rooms: readonly QueryRoom[];
|
|
197
|
+
readonly handles: readonly string[];
|
|
198
|
+
}, readonly string[]>;
|
|
229
199
|
readonly 'replica.tallies': Asked<{
|
|
230
200
|
readonly totals: Plan;
|
|
231
201
|
readonly rooms: readonly QueryRoom[];
|
|
@@ -246,6 +216,11 @@ export interface RuntimeRequests {
|
|
|
246
216
|
readonly view: View;
|
|
247
217
|
readonly targets: readonly string[];
|
|
248
218
|
}, readonly Referrer[]>;
|
|
219
|
+
readonly 'replica.holders': Asked<{
|
|
220
|
+
readonly key: number;
|
|
221
|
+
readonly view: View;
|
|
222
|
+
readonly sought: readonly Sought[];
|
|
223
|
+
}, readonly Holder[]>;
|
|
249
224
|
readonly 'replica.folders': Asked<{
|
|
250
225
|
readonly key: number;
|
|
251
226
|
readonly paths: readonly string[];
|
|
@@ -380,9 +355,12 @@ export interface RuntimeRequests {
|
|
|
380
355
|
readonly conversations: readonly string[] | null;
|
|
381
356
|
readonly since: string;
|
|
382
357
|
}, readonly ConversationTally[]>;
|
|
358
|
+
readonly 'conversation.facts': Asked<Nothing, readonly HeldFact[]>;
|
|
359
|
+
readonly 'conversation.fact': Asked<HeldFact, null>;
|
|
360
|
+
readonly 'conversation.stored': Asked<Nothing, readonly string[]>;
|
|
383
361
|
readonly 'conversation.drop': Asked<{
|
|
384
362
|
readonly conversations: readonly string[];
|
|
385
|
-
},
|
|
363
|
+
}, readonly string[]>;
|
|
386
364
|
readonly 'space.probe': Asked<Nothing, null>;
|
|
387
365
|
readonly 'read.stored': Asked<ReadAt, string | null>;
|
|
388
366
|
readonly 'read.keep': Asked<ReadAt & {
|
|
@@ -391,6 +369,17 @@ export interface RuntimeRequests {
|
|
|
391
369
|
readonly 'read.builds': Asked<{
|
|
392
370
|
readonly build: string;
|
|
393
371
|
}, null>;
|
|
372
|
+
readonly 'run.marks': Asked<Nothing, RunMarks>;
|
|
373
|
+
readonly 'run.held': Asked<{
|
|
374
|
+
readonly asked: RunsAsked;
|
|
375
|
+
readonly sight: RunSight;
|
|
376
|
+
}, readonly HeldRun[] | null>;
|
|
377
|
+
readonly 'run.keep': Asked<{
|
|
378
|
+
readonly event: RunEvent;
|
|
379
|
+
}, RunMarks | null>;
|
|
380
|
+
readonly 'run.left': Asked<{
|
|
381
|
+
readonly sight: RunSight;
|
|
382
|
+
}, RunMarks>;
|
|
394
383
|
}
|
|
395
384
|
export type RuntimeKind = keyof RuntimeRequests;
|
|
396
385
|
export type RuntimeRequest<K extends RuntimeKind = RuntimeKind> = {
|