@agentshouse/mdruntime 0.1.0-c26d7e158e11b → 0.1.0-c27d511fb284d
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 +136 -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 +21 -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 +20 -9
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +18 -8
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +30 -12
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +256 -180
- 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 +78 -32
- 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 +21 -13
- 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 +40 -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 +17 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +29 -10
- 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 +20 -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 +164 -39
- package/dist/react.d.ts +10 -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 +4 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +31 -8
- 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 +45 -0
- package/dist/rows.d.ts +11 -2
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +24 -10
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -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 +3 -3
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +3 -9
- package/dist/source.d.ts +7 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +15 -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 +14 -8
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +59 -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 +28 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +95 -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 +39 -16
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +21 -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,11 @@ 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 { attachmentSurface, conversationFiles, saveParts, saveRoomDrafts, } from './saves.js';
|
|
18
|
+
import { queriedHouse, } from './house-query.js';
|
|
16
19
|
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
|
|
20
|
+
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';
|
|
21
|
+
import { OPENING_LANE } from './sync.js';
|
|
19
22
|
function told(store, topic, deliver, current) {
|
|
20
23
|
const watcher = store.watch(topic, deliver);
|
|
21
24
|
deliver(current);
|
|
@@ -28,17 +31,17 @@ function watchRooms(runtime, deliver) {
|
|
|
28
31
|
return () => {
|
|
29
32
|
watcher.stop();
|
|
30
33
|
if (store.watching(ROOMS_TOPIC, 'ready').length === 0)
|
|
31
|
-
store.
|
|
34
|
+
store.roomsShown.show(null);
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
|
-
function
|
|
35
|
-
const watcher = store.watch(
|
|
37
|
+
function watchFact({ store }, topic, fact, deliver) {
|
|
38
|
+
const watcher = store.watch(topic, deliver);
|
|
36
39
|
void store
|
|
37
40
|
.open()
|
|
38
41
|
.then((local) => local.facts())
|
|
39
|
-
.then((
|
|
42
|
+
.then((facts) => {
|
|
40
43
|
if (watcher.held())
|
|
41
|
-
deliver(
|
|
44
|
+
deliver(facts[fact]);
|
|
42
45
|
}, uncaught);
|
|
43
46
|
return watcher.stop;
|
|
44
47
|
}
|
|
@@ -67,6 +70,10 @@ function watching(runtime) {
|
|
|
67
70
|
return watchConversationList(conversations, deliver);
|
|
68
71
|
if (topic === 'agents')
|
|
69
72
|
return watchConversationAgents(conversations, deliver);
|
|
73
|
+
if (topic === 'listed-agents')
|
|
74
|
+
return watchListedAgents(conversations, deliver);
|
|
75
|
+
if (topic === 'room-list')
|
|
76
|
+
return watchRoomList(runtime, deliver);
|
|
70
77
|
if (topic === 'figures')
|
|
71
78
|
return figures.watch(deliver, fail);
|
|
72
79
|
if (topic === 'holdings')
|
|
@@ -76,7 +83,7 @@ function watching(runtime) {
|
|
|
76
83
|
if (topic === 'presentation')
|
|
77
84
|
return watchPresentation(runtime, input[0], deliver);
|
|
78
85
|
if (topic === 'readiness') {
|
|
79
|
-
return watchReadiness(runtime, { target: '', code: 'stored' }, null, deliver);
|
|
86
|
+
return watchReadiness(runtime, { target: '', code: 'stored', first: null, inboxed: null }, null, deliver);
|
|
80
87
|
}
|
|
81
88
|
if (topic === 'rooms')
|
|
82
89
|
return watchRooms(runtime, deliver);
|
|
@@ -84,7 +91,7 @@ function watching(runtime) {
|
|
|
84
91
|
return told(store, REFUSAL_TOPIC, deliver, session.refusal);
|
|
85
92
|
}
|
|
86
93
|
if (topic === 'storage-loss') {
|
|
87
|
-
return told(store, STORAGE_LOSS_TOPIC, deliver,
|
|
94
|
+
return told(store, STORAGE_LOSS_TOPIC, deliver, storageLossNow(runtime));
|
|
88
95
|
}
|
|
89
96
|
if (topic === 'sync-status') {
|
|
90
97
|
return told(store, STATUS_TOPIC, deliver, store.device.now().status);
|
|
@@ -93,7 +100,9 @@ function watching(runtime) {
|
|
|
93
100
|
return told(store, SERVICE_MODE_TOPIC, deliver, session.serviceMode);
|
|
94
101
|
}
|
|
95
102
|
if (topic === 'member')
|
|
96
|
-
return
|
|
103
|
+
return watchFact(runtime, MEMBER_TOPIC, 'member', deliver);
|
|
104
|
+
if (topic === 'time-zone')
|
|
105
|
+
return watchFact(runtime, TIME_ZONE_TOPIC, 'timeZone', deliver);
|
|
97
106
|
if (topic === 'authority-changes') {
|
|
98
107
|
return told(store, AUTHORITY_TOPIC, deliver, session.authorityChanges);
|
|
99
108
|
}
|
|
@@ -105,7 +114,7 @@ function watching(runtime) {
|
|
|
105
114
|
function roomsOnce(runtime) {
|
|
106
115
|
const { store, socket } = runtime;
|
|
107
116
|
if (socket.closed())
|
|
108
|
-
return Promise.resolve([]);
|
|
117
|
+
return Promise.resolve({ rooms: [], models: {} });
|
|
109
118
|
return new Promise((settle) => {
|
|
110
119
|
const watcher = store.watch(ROOMS_TOPIC, (value) => {
|
|
111
120
|
watcher.stop();
|
|
@@ -123,44 +132,66 @@ async function typesOf(runtime, locator) {
|
|
|
123
132
|
typedSelection: (room?.typedSelection ?? null) === null ? null : modelTypes(builtIn),
|
|
124
133
|
};
|
|
125
134
|
}
|
|
135
|
+
async function sentAll(runtime) {
|
|
136
|
+
const { store } = runtime;
|
|
137
|
+
for (;;) {
|
|
138
|
+
let moved;
|
|
139
|
+
const status = new Promise((resolve) => {
|
|
140
|
+
moved = resolve;
|
|
141
|
+
});
|
|
142
|
+
const watcher = store.watch(STATUS_TOPIC, () => moved());
|
|
143
|
+
try {
|
|
144
|
+
if (!leftToSend(await store.ask({ kind: 'authored.unsent' })))
|
|
145
|
+
return;
|
|
146
|
+
const calls = await (await store.open()).calls();
|
|
147
|
+
await Promise.race([
|
|
148
|
+
status,
|
|
149
|
+
...calls.map(({ operation }) => answeredCall(runtime, operation)),
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
watcher.stop();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
126
157
|
async function reauthorized(runtime) {
|
|
127
|
-
const { store, socket
|
|
158
|
+
const { store, socket } = runtime;
|
|
128
159
|
const { refusal } = socket.session.now();
|
|
129
160
|
if (refusal === null || !refusal.reauthorizationOffered)
|
|
130
161
|
return;
|
|
131
|
-
journal.record('connection reauthorize');
|
|
132
162
|
await socket.lanes.current();
|
|
133
163
|
await store.written();
|
|
134
164
|
socket.session.set({ authorization: undefined, paused: false });
|
|
135
165
|
if (!socket.streamed)
|
|
136
|
-
await
|
|
166
|
+
await runtime.discover();
|
|
137
167
|
else
|
|
138
168
|
await socket.lanes.task(OPENING_LANE, () => socket.authorize());
|
|
139
169
|
}
|
|
140
170
|
function mdRuntime(runtime, watch) {
|
|
141
|
-
const { store, socket,
|
|
171
|
+
const { store, socket, shell, conversations, lastAnswers } = runtime;
|
|
142
172
|
return {
|
|
143
173
|
loaded: () => store.open().then(() => undefined),
|
|
144
174
|
rooms: () => roomsOnce(runtime),
|
|
145
175
|
query: ((input) => planned(runtime, input, null).then((plan) => rowsQuery(runtime, plan))),
|
|
146
176
|
search: (input) => searched(runtime, input, null),
|
|
177
|
+
queryHouse: (input, options) => queriedHouse(runtime, input, null, options),
|
|
147
178
|
types: (locator) => typesOf(runtime, locator),
|
|
148
179
|
roomDraft: roomDraftSurface(runtime),
|
|
149
|
-
conversation: conversationSurface(conversations),
|
|
180
|
+
conversation: conversationSurface(conversations, conversationFiles(runtime)),
|
|
150
181
|
chatDraft: chatDraftSurface(conversations),
|
|
151
182
|
presentation: presentationSurface(runtime),
|
|
152
183
|
save: (room, named, writtenBy) => saveRoomDrafts(runtime, room, named, writtenBy),
|
|
153
184
|
saveParts: (room, parts, writtenBy) => saveParts(runtime, room, parts, writtenBy),
|
|
154
185
|
history: (locator, path, query) => readHistory(runtime, locator, path, query),
|
|
155
186
|
resolve: (room, path, destination) => resolveReference(runtime, room, path, destination),
|
|
156
|
-
|
|
187
|
+
attachment: attachmentSurface(runtime),
|
|
157
188
|
call: (name, input) => called(runtime, name, input),
|
|
189
|
+
answered: (operation) => answeredCall(runtime, operation),
|
|
158
190
|
async reached(locator, roomVersion, path) {
|
|
159
191
|
return path === undefined
|
|
160
192
|
? reachedBy(runtime, locator, roomVersion)
|
|
161
193
|
: writtenAfter(runtime, locator, roomVersion, path);
|
|
162
194
|
},
|
|
163
|
-
log: () => journal.export(),
|
|
164
195
|
async cleanUp() {
|
|
165
196
|
const freed = await store.ask({ kind: 'opened.clean' });
|
|
166
197
|
const tidied = (await shell.cleanUp?.()) ?? 0;
|
|
@@ -168,13 +199,13 @@ function mdRuntime(runtime, watch) {
|
|
|
168
199
|
return freed + tidied;
|
|
169
200
|
},
|
|
170
201
|
unsent: () => store.ask({ kind: 'authored.unsent' }),
|
|
202
|
+
sent: () => sentAll(runtime),
|
|
171
203
|
reset: () => shell.reset(),
|
|
172
204
|
async readAgain() {
|
|
173
205
|
lastAnswers.again();
|
|
174
206
|
},
|
|
175
207
|
persistence: () => store.device.now().persistence === 'granted',
|
|
176
208
|
async retry() {
|
|
177
|
-
journal.record('retry');
|
|
178
209
|
store.prepareAgain();
|
|
179
210
|
store.readiness.queue();
|
|
180
211
|
if (store.space.full())
|
|
@@ -185,7 +216,7 @@ function mdRuntime(runtime, watch) {
|
|
|
185
216
|
};
|
|
186
217
|
}
|
|
187
218
|
export function composedRuntime(runtime) {
|
|
188
|
-
const { store
|
|
219
|
+
const { store } = runtime;
|
|
189
220
|
const watch = watching(runtime);
|
|
190
221
|
const md = mdRuntime(runtime, watch);
|
|
191
222
|
const reachable = {
|
|
@@ -195,12 +226,14 @@ export function composedRuntime(runtime) {
|
|
|
195
226
|
query: (plan) => rowsQuery(runtime, plan),
|
|
196
227
|
watchPlan: (plan, deliver, fail) => watchPlan(runtime, plan, deliver, fail),
|
|
197
228
|
search: (input, reach) => searched(runtime, input, reach),
|
|
229
|
+
queryHouse: (input, reach, options) => queriedHouse(runtime, input, reach, options),
|
|
230
|
+
queried: () => runtime.socket.session.now().queriesOnly,
|
|
198
231
|
watchReadiness: (port, reach, deliver) => watchReadiness(runtime, port, reach, deliver),
|
|
199
232
|
locked: (locator) => locked(runtime, locator),
|
|
200
233
|
lockedRooms: () => lockedRooms(runtime),
|
|
201
234
|
watchLocks: (notify) => watchLocks(runtime, notify),
|
|
202
235
|
located: (room, path, destination) => located(runtime, room, path, destination),
|
|
203
|
-
room: async (locator) => shownRooms(runtime, await listingNow(runtime)).find((one) => one.locator === locator),
|
|
236
|
+
room: async (locator) => shownRooms(runtime, await listingNow(runtime)).rooms.find((one) => one.locator === locator),
|
|
204
237
|
};
|
|
205
238
|
return {
|
|
206
239
|
md,
|
|
@@ -211,8 +244,7 @@ export function composedRuntime(runtime) {
|
|
|
211
244
|
if (answer === store.device.now().persistence)
|
|
212
245
|
return;
|
|
213
246
|
store.device.set({ persistence: answer });
|
|
214
|
-
|
|
215
|
-
store.readiness.queue();
|
|
247
|
+
emitStorageLoss(runtime);
|
|
216
248
|
},
|
|
217
249
|
within(reach, port) {
|
|
218
250
|
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,17 @@
|
|
|
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';
|
|
6
7
|
import { type ReadAt } from './reads.js';
|
|
7
8
|
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';
|
|
9
|
+
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';
|
|
10
|
+
export type { Committed, CoverLog, Covering, HeldEntry, HeldLocators, HeldRoomRow, HeldRoomWork, Holder, OverlayEntry, ReplicaOpened, Referrer, Resumed, RoomCommit, Sought, StoredEntry, TypedEntry, View, } from './stored.js';
|
|
11
|
+
export { kindedRevision } from './reference-forms.js';
|
|
12
|
+
export { authoredEmptied, authoredTable, FILE_PART_BYTES, formatted, heldTables, type AuthoredFact, type AuthoredRows, type KeptRecord, type StoredFile, } from './authored.js';
|
|
10
13
|
export type { QueryAnswer, QueryRoom } from './compile.js';
|
|
11
|
-
export type { ConversationWrite, HeldConversation, HeldRow, MessageWindow } from './messages.js';
|
|
14
|
+
export type { ConversationFact, ConversationWrite, HeldConversation, HeldFact, HeldRow, MessageWindow, } from './messages.js';
|
|
12
15
|
export type { ConversationTally, RoomTally } from './tallies.js';
|
|
13
16
|
export type Value = string | number | bigint | Uint8Array | null;
|
|
14
17
|
export type Row = Readonly<Record<string, Value>>;
|
|
@@ -50,53 +53,13 @@ export interface SqliteDatabase {
|
|
|
50
53
|
prepare(sql: string): SqliteStatement;
|
|
51
54
|
}
|
|
52
55
|
export declare function sqliteConnection(engine: SqliteEngine, database: SqliteDatabase): Connection;
|
|
53
|
-
export declare const FILE_PART_BYTES = 1048576;
|
|
54
56
|
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
57
|
export interface FileSpool {
|
|
61
58
|
held(): Iterable<string>;
|
|
62
59
|
spool(key: string, type: string, parts: Iterable<Uint8Array>): Promise<Blob>;
|
|
63
60
|
drop(key: string): Promise<void>;
|
|
64
61
|
probe(bytes: number): Promise<void>;
|
|
65
62
|
}
|
|
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
63
|
export type HeldStatus = {
|
|
101
64
|
readonly queued: readonly string[];
|
|
102
65
|
readonly lastCompleted: string | null;
|
|
@@ -130,11 +93,6 @@ type Nothing = Readonly<Record<never, never>>;
|
|
|
130
93
|
export type CommittedWrite = Committed & {
|
|
131
94
|
readonly fenced: string | null;
|
|
132
95
|
};
|
|
133
|
-
export type AuthoredWrite = {
|
|
134
|
-
readonly writes: readonly AuthoredRows[];
|
|
135
|
-
readonly files: readonly StoredFile[];
|
|
136
|
-
readonly whole: boolean;
|
|
137
|
-
};
|
|
138
96
|
export interface RuntimeRequests {
|
|
139
97
|
readonly 'authored.status': Asked<Nothing, HeldStatus>;
|
|
140
98
|
readonly 'authored.moving': Asked<Nothing, HeldQueues>;
|
|
@@ -211,21 +169,31 @@ export interface RuntimeRequests {
|
|
|
211
169
|
readonly 'replica.room': Asked<{
|
|
212
170
|
readonly locator: string;
|
|
213
171
|
}, HeldRoomWork>;
|
|
214
|
-
readonly 'replica.covering': Asked<
|
|
172
|
+
readonly 'replica.covering': Asked<{
|
|
173
|
+
readonly since: CoverLog | null;
|
|
174
|
+
}, Covering>;
|
|
215
175
|
readonly 'replica.offline': Asked<{
|
|
216
176
|
readonly locator: string;
|
|
217
177
|
}, string | null>;
|
|
218
178
|
readonly 'replica.held': Asked<Nothing, HeldLocators>;
|
|
219
179
|
readonly 'replica.demote': Asked<Nothing, null>;
|
|
220
|
-
readonly 'replica.facts': Asked<
|
|
180
|
+
readonly 'replica.facts': Asked<{
|
|
181
|
+
readonly names: readonly string[] | null;
|
|
182
|
+
}, Readonly<Record<string, string>>>;
|
|
221
183
|
readonly 'replica.presentation': Asked<{
|
|
222
184
|
readonly app: string;
|
|
223
185
|
}, string | null>;
|
|
224
186
|
readonly 'replica.query': Asked<{
|
|
225
187
|
readonly plan: Plan;
|
|
226
188
|
readonly rooms: readonly QueryRoom[];
|
|
189
|
+
readonly follows: readonly QueryRoom[];
|
|
227
190
|
readonly budget: number | null;
|
|
228
191
|
}, QueryAnswer>;
|
|
192
|
+
readonly 'replica.named': Asked<{
|
|
193
|
+
readonly plan: Plan;
|
|
194
|
+
readonly rooms: readonly QueryRoom[];
|
|
195
|
+
readonly handles: readonly string[];
|
|
196
|
+
}, readonly string[]>;
|
|
229
197
|
readonly 'replica.tallies': Asked<{
|
|
230
198
|
readonly totals: Plan;
|
|
231
199
|
readonly rooms: readonly QueryRoom[];
|
|
@@ -246,6 +214,11 @@ export interface RuntimeRequests {
|
|
|
246
214
|
readonly view: View;
|
|
247
215
|
readonly targets: readonly string[];
|
|
248
216
|
}, readonly Referrer[]>;
|
|
217
|
+
readonly 'replica.holders': Asked<{
|
|
218
|
+
readonly key: number;
|
|
219
|
+
readonly view: View;
|
|
220
|
+
readonly sought: readonly Sought[];
|
|
221
|
+
}, readonly Holder[]>;
|
|
249
222
|
readonly 'replica.folders': Asked<{
|
|
250
223
|
readonly key: number;
|
|
251
224
|
readonly paths: readonly string[];
|
|
@@ -380,9 +353,12 @@ export interface RuntimeRequests {
|
|
|
380
353
|
readonly conversations: readonly string[] | null;
|
|
381
354
|
readonly since: string;
|
|
382
355
|
}, readonly ConversationTally[]>;
|
|
356
|
+
readonly 'conversation.facts': Asked<Nothing, readonly HeldFact[]>;
|
|
357
|
+
readonly 'conversation.fact': Asked<HeldFact, null>;
|
|
358
|
+
readonly 'conversation.stored': Asked<Nothing, readonly string[]>;
|
|
383
359
|
readonly 'conversation.drop': Asked<{
|
|
384
360
|
readonly conversations: readonly string[];
|
|
385
|
-
},
|
|
361
|
+
}, readonly string[]>;
|
|
386
362
|
readonly 'space.probe': Asked<Nothing, null>;
|
|
387
363
|
readonly 'read.stored': Asked<ReadAt, string | null>;
|
|
388
364
|
readonly 'read.keep': Asked<ReadAt & {
|