@agentshouse/mdruntime 0.1.0-c806ecaf4afed → 0.1.0-c83bc1fac9b35
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 +15 -24
- 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 +8 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +138 -68
- package/dist/adapter.d.ts +86 -14
- 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 +0 -5
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/change.d.ts +4 -0
- 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 +0 -2
- package/dist/client.d.ts +14 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -46
- package/dist/collection.d.ts +5 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +16 -8
- 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 +2 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +17 -5
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +21 -16
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +23 -7
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +18 -6
- 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 +20 -7
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +238 -174
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +36 -9
- 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 +5 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +5 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +23 -12
- 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 +2 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- 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 +6 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +50 -16
- package/dist/house-query.d.ts +21 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +41 -0
- package/dist/index.d.ts +14 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/install.d.ts +10 -4
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +45 -46
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +50 -32
- 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 +5 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +71 -30
- package/dist/loaded.d.ts +5 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +40 -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 +18 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +102 -24
- package/dist/memory.d.ts +5 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +58 -14
- package/dist/messages.d.ts +12 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +24 -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 +4 -2
- 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/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/opening.d.ts.map +1 -1
- package/dist/opening.js +20 -10
- package/dist/outcome.d.ts +13 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +32 -2
- package/dist/overlay.d.ts +4 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +11 -9
- package/dist/parts.d.ts +4 -9
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +30 -15
- package/dist/preparation.d.ts +32 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +189 -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 +2 -2
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +81 -64
- package/dist/questions.d.ts +1 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +1 -7
- 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 +14 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +142 -30
- 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 +16 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +10 -10
- package/dist/reads.d.ts +4 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +7 -3
- package/dist/recovery.d.ts +4 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +31 -8
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +1 -3
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +2 -2
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +30 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +253 -30
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +5 -2
- 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 +2 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +6 -6
- 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 +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +105 -124
- package/dist/saves.d.ts +2 -0
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +42 -18
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- 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 +12 -4
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +34 -8
- 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 +4 -3
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +4 -9
- package/dist/source.d.ts +5 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +13 -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 +20 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +60 -22
- 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 +17 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +18 -6
- package/dist/stored.d.ts +25 -13
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +80 -27
- package/dist/surface.d.ts +12 -6
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +58 -26
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +75 -39
- package/dist/tables.d.ts +16 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +86 -324
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +1 -2
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +3 -9
- package/dist/wire.d.ts +33 -10
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +15 -8
- package/package.json +3 -3
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
package/dist/client.js
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
+
import { handedCopy, handedLink } from './download.js';
|
|
1
2
|
import { shownBy } from './media.js';
|
|
2
3
|
import { pageMetadataBlock } from './page-metadata.js';
|
|
3
|
-
import { observed } from './observation.js';
|
|
4
|
+
import { appRooms, observed } from './observation.js';
|
|
4
5
|
import { runtimeError } from './failure.js';
|
|
6
|
+
import { blobOf, } from './outcome.js';
|
|
5
7
|
import { AUTHORIZATION_ENDED, PORT_CLOSED, wireAnswer, } from './wire.js';
|
|
6
8
|
// React renders an arrived value in a later task and opens what that render observes as it commits, so this many frames opening nothing mean the page drew what it observes.
|
|
7
9
|
const SETTLED_FRAMES = 2;
|
|
8
|
-
// A browser reads a download's address only after the click that hands it returns, so a copy's address is released a minute later.
|
|
9
|
-
const HANDED_COPY_MS = 60_000;
|
|
10
|
-
const PAGE = /\.html?$/iu;
|
|
11
|
-
const STARTED = { kind: 'started' };
|
|
12
|
-
const BLOCKED = {
|
|
13
|
-
kind: 'blocked',
|
|
14
|
-
code: 'popup-blocked',
|
|
15
|
-
fields: {},
|
|
16
|
-
retryable: true,
|
|
17
|
-
};
|
|
18
|
-
function handed(url, name) {
|
|
19
|
-
const anchor = document.createElement('a');
|
|
20
|
-
anchor.href = url;
|
|
21
|
-
anchor.download = name;
|
|
22
|
-
anchor.click();
|
|
23
|
-
}
|
|
24
10
|
function refused(refusal) {
|
|
25
11
|
return runtimeError(refusal.code);
|
|
26
12
|
}
|
|
@@ -42,7 +28,7 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
42
28
|
observations.delete(id);
|
|
43
29
|
if (refusal === null)
|
|
44
30
|
send({ kind: 'stop', id });
|
|
45
|
-
}, topic
|
|
31
|
+
}, topic);
|
|
46
32
|
observations.set(id, { topic, input, handle });
|
|
47
33
|
return handle.observation;
|
|
48
34
|
}
|
|
@@ -90,7 +76,7 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
90
76
|
}
|
|
91
77
|
if (message.kind === 'ended') {
|
|
92
78
|
for (const { topic, handle } of observations.values()) {
|
|
93
|
-
if (topic === 'member')
|
|
79
|
+
if (topic === 'member' || topic === 'time-zone')
|
|
94
80
|
handle.receive(null);
|
|
95
81
|
}
|
|
96
82
|
end(runtimeError('authorization-ended', AUTHORIZATION_ENDED));
|
|
@@ -176,32 +162,13 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
176
162
|
return { kind: 'binary', stream, byteLength, mediaType };
|
|
177
163
|
}
|
|
178
164
|
async function download(room, path, revision) {
|
|
179
|
-
const
|
|
180
|
-
const linked = await ask('binaryFile.link', [room, path, revision]);
|
|
181
|
-
if (linked.kind === 'link' && PAGE.test(linked.name)) {
|
|
182
|
-
const away = tab ?? globalThis.open('', '_blank');
|
|
183
|
-
if (away === null)
|
|
184
|
-
return BLOCKED;
|
|
185
|
-
away.location.replace(linked.url);
|
|
186
|
-
return STARTED;
|
|
187
|
-
}
|
|
188
|
-
tab?.close();
|
|
189
|
-
if (linked.kind === 'link') {
|
|
190
|
-
handed(linked.url, linked.name);
|
|
191
|
-
return STARTED;
|
|
192
|
-
}
|
|
165
|
+
const linked = await handedLink(path, () => ask('binaryFile.link', [room, path, revision]));
|
|
193
166
|
if (linked.kind !== 'absent')
|
|
194
167
|
return linked;
|
|
195
168
|
const read = streamed(await ask('binaryFile.read', [room, path, revision]));
|
|
196
169
|
if (read.kind !== 'binary')
|
|
197
170
|
return read;
|
|
198
|
-
|
|
199
|
-
headers: { 'content-type': read.mediaType },
|
|
200
|
-
}).blob();
|
|
201
|
-
const url = URL.createObjectURL(copy);
|
|
202
|
-
handed(url, path.slice(path.lastIndexOf('/') + 1));
|
|
203
|
-
setTimeout(() => URL.revokeObjectURL(url), HANDED_COPY_MS);
|
|
204
|
-
return STARTED;
|
|
171
|
+
return handedCopy(await blobOf(read), path.slice(path.lastIndexOf('/') + 1));
|
|
205
172
|
}
|
|
206
173
|
function settled() {
|
|
207
174
|
if (settling !== null)
|
|
@@ -235,9 +202,10 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
235
202
|
const show = (room, path, revision) => ask('binaryFile.show', [room, path, revision]).then((shown) => streamed(shown));
|
|
236
203
|
return shownBy(show, {
|
|
237
204
|
buildFile,
|
|
238
|
-
rooms: () => ask('rooms', []),
|
|
205
|
+
rooms: () => ask('rooms', []).then(appRooms),
|
|
239
206
|
query: ((query) => ask('query', [query])),
|
|
240
207
|
search: (request) => ask('search', [request]),
|
|
208
|
+
queryHouse: (query) => ask('queryHouse', [query]),
|
|
241
209
|
types: (locator) => ask('types', [locator]),
|
|
242
210
|
roomDraft: {
|
|
243
211
|
list: () => ask('roomDraft.list', []),
|
|
@@ -266,10 +234,11 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
266
234
|
rename: (conversation, name, operation) => ask('conversation.rename', [conversation, name, operation]),
|
|
267
235
|
option: (conversation, option, value, operation) => ask('conversation.option', [conversation, option, value, operation]),
|
|
268
236
|
retry: (conversation, message, operation) => ask('conversation.retry', [conversation, message, operation]),
|
|
269
|
-
pins: () => ask('conversation.pins', []),
|
|
270
237
|
pin: (figures) => ask('conversation.pin', [figures]),
|
|
271
|
-
openedTurns: () => ask('conversation.openedTurns', []),
|
|
272
238
|
openTurn: (conversation, turn) => ask('conversation.openTurn', [conversation, turn]),
|
|
239
|
+
dismissSuggestion: (conversation, suggestion) => ask('conversation.dismissSuggestion', [conversation, suggestion]),
|
|
240
|
+
attach: (file) => ask('conversation.attach', [file]),
|
|
241
|
+
attachment: (link) => ask('conversation.attachment', [link]),
|
|
273
242
|
pageMetadata: async (app, address) => pageMetadataBlock(app, address, [...observations]
|
|
274
243
|
.sort(([left], [right]) => left - right)
|
|
275
244
|
.flatMap(([, { topic, input }]) => (topic === 'query' ? [input[0]] : []))),
|
|
@@ -277,6 +246,7 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
277
246
|
chatDraft: {
|
|
278
247
|
write: (conversation, draft, revision) => ask('chatDraft.write', [conversation, draft, revision]),
|
|
279
248
|
prepend: (conversation, draft) => ask('chatDraft.prepend', [conversation, draft]),
|
|
249
|
+
append: (conversation, draft) => ask('chatDraft.append', [conversation, draft]),
|
|
280
250
|
discard: (conversation) => ask('chatDraft.discard', [conversation]),
|
|
281
251
|
},
|
|
282
252
|
history: (locator, path, query) => ask('history', [locator, path, query]),
|
|
@@ -287,12 +257,13 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
287
257
|
download,
|
|
288
258
|
},
|
|
289
259
|
call: (name, input) => ask('call', [name, input]),
|
|
260
|
+
answered: (operation) => ask('answered', [operation]),
|
|
290
261
|
reached: (locator, roomVersion, path) => ask('reached', [locator, roomVersion, path]),
|
|
291
|
-
log: () => ask('log', []),
|
|
292
262
|
persistence: () => ask('persistence', []),
|
|
293
263
|
retry: () => ask('retry', []),
|
|
294
264
|
cleanUp: () => ask('cleanUp', []),
|
|
295
265
|
unsent: () => ask('unsent', []),
|
|
266
|
+
sent: () => ask('sent', []),
|
|
296
267
|
reset: () => ask('reset', []),
|
|
297
268
|
readAgain: () => ask('readAgain', []),
|
|
298
269
|
observe: ((topic, ...input) => watch(topic, input)),
|
|
@@ -308,5 +279,6 @@ export function inTurn(client, work) {
|
|
|
308
279
|
}
|
|
309
280
|
export { chainedWindows } from './chain.js';
|
|
310
281
|
export { roomDraftRevision } from './identity.js';
|
|
311
|
-
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
312
|
-
export {
|
|
282
|
+
export { defineRoomMedia, ROOM_MEDIA, viewFile } from './media.js';
|
|
283
|
+
export { shownModal } from './modal.js';
|
|
284
|
+
export { unanswered, undelivered } from './wire.js';
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DefinitionOf, type Document, type TypedPath } from '@agentshouse/mdmodel';
|
|
1
|
+
import { type DefinitionOf, type Document, type ParseResult, type TypedPath, type VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { ModelState, TypesResult } from './model.js';
|
|
3
3
|
import type { AppTypedSelection } from './listing.js';
|
|
4
4
|
import type { MdModelIdentity } from './adapter.js';
|
|
@@ -20,6 +20,7 @@ export type Composed = {
|
|
|
20
20
|
readonly composition: Composition;
|
|
21
21
|
readonly fingerprint: string;
|
|
22
22
|
};
|
|
23
|
+
export declare function typesPrint(types: VerifiedModel['types']): string;
|
|
23
24
|
export declare function composedOf(composition: Composition): Composed;
|
|
24
25
|
type Selecting<M> = {
|
|
25
26
|
readonly model: M;
|
|
@@ -42,6 +43,9 @@ export declare function definitionsIn(room: {
|
|
|
42
43
|
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
43
44
|
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
44
45
|
export declare function validRoot(root: unknown): root is string;
|
|
46
|
+
export declare const UNTYPED = "any";
|
|
47
|
+
export declare function textType(read: ParseResult): string | undefined;
|
|
48
|
+
export declare function typedText(read: ParseResult): boolean;
|
|
45
49
|
export declare function available(composition: Composition): boolean;
|
|
46
50
|
export {};
|
|
47
51
|
//# sourceMappingURL=collection.d.ts.map
|
package/dist/collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,eAAO,MAAM,QAAQ,EAAE,eAAwE,CAAC;AAEhG,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC9C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AW,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,EACxF,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,YAAY,CAQd;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACtC,WAAW,EAAE,WAAW,GACvB,UAAU,CAcZ;AAED,wBAAiB,WAAW,CAC1B,UAAU,EAAE,UAAU,GACrB,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,CAQhE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAEvD;AAED,eAAO,MAAM,OAAO,QAAQ,CAAC;AAE7B,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAE9D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAEpD;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE3D"}
|
package/dist/collection.js
CHANGED
|
@@ -4,23 +4,24 @@ import { hashed } from './observation.js';
|
|
|
4
4
|
import { sortedKeys } from './shared.js';
|
|
5
5
|
export const MD_MODEL = { identity: '@agentshouse/mdmodel', version: VERSION };
|
|
6
6
|
const typesPrinted = new WeakMap();
|
|
7
|
-
function typesPrint(
|
|
8
|
-
|
|
9
|
-
return '';
|
|
10
|
-
let print = typesPrinted.get(model.types);
|
|
7
|
+
export function typesPrint(types) {
|
|
8
|
+
let print = typesPrinted.get(types);
|
|
11
9
|
if (print === undefined) {
|
|
12
|
-
print = hashed(JSON.stringify(
|
|
13
|
-
typesPrinted.set(
|
|
10
|
+
print = hashed(JSON.stringify(types)).toString(36);
|
|
11
|
+
typesPrinted.set(types, print);
|
|
14
12
|
}
|
|
15
13
|
return print;
|
|
16
14
|
}
|
|
15
|
+
function modelPrint(model) {
|
|
16
|
+
return model.status === 'unavailable' ? '' : typesPrint(model.types);
|
|
17
|
+
}
|
|
17
18
|
export function composedOf(composition) {
|
|
18
19
|
const { model, selection } = composition;
|
|
19
20
|
return {
|
|
20
21
|
composition,
|
|
21
22
|
fingerprint: JSON.stringify([
|
|
22
|
-
|
|
23
|
-
selection === null ? null : [selection.roots,
|
|
23
|
+
modelPrint(model),
|
|
24
|
+
selection === null ? null : [selection.roots, modelPrint(selection.model)],
|
|
24
25
|
]),
|
|
25
26
|
};
|
|
26
27
|
}
|
|
@@ -73,6 +74,13 @@ export function* documentsOf(collection) {
|
|
|
73
74
|
export function validRoot(root) {
|
|
74
75
|
return typeof root === 'string' && normalize(root) === root;
|
|
75
76
|
}
|
|
77
|
+
export const UNTYPED = 'any';
|
|
78
|
+
export function textType(read) {
|
|
79
|
+
return read.ok ? (read.document.type ?? UNTYPED) : undefined;
|
|
80
|
+
}
|
|
81
|
+
export function typedText(read) {
|
|
82
|
+
return (textType(read) ?? UNTYPED) !== UNTYPED;
|
|
83
|
+
}
|
|
76
84
|
export function available(composition) {
|
|
77
85
|
return composition.model.status !== 'unavailable';
|
|
78
86
|
}
|
package/dist/column.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Row, Value } from './tables.js';
|
|
2
|
+
export declare function text(value: Value | undefined): string;
|
|
3
|
+
export declare function texts(rows: readonly Row[], column: string): string[];
|
|
4
|
+
export declare function count(value: Value | undefined): number;
|
|
5
|
+
//# sourceMappingURL=column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../src/column.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAErD;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpE;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAEtD"}
|
package/dist/column.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function text(value) {
|
|
2
|
+
return typeof value === 'string' ? value : String(value);
|
|
3
|
+
}
|
|
4
|
+
export function texts(rows, column) {
|
|
5
|
+
return rows.map((row) => text(row[column]));
|
|
6
|
+
}
|
|
7
|
+
export function count(value) {
|
|
8
|
+
return typeof value === 'bigint' ? Number(value) : typeof value === 'number' ? value : 0;
|
|
9
|
+
}
|
package/dist/compile.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { sql } from '@agentshouse/mdmodel';
|
|
2
|
+
import { type Composition } from './collection.js';
|
|
2
3
|
import type { Plan, QueryRows } from './query.js';
|
|
3
4
|
import type { Connection } from './tables.js';
|
|
4
5
|
export type QueryRoom = {
|
|
5
6
|
readonly locator: string;
|
|
6
7
|
readonly key: number;
|
|
8
|
+
readonly composition?: Composition;
|
|
7
9
|
};
|
|
8
10
|
type Fragment = sql.Fragment;
|
|
9
11
|
export declare const VISIBLE: (alias: string) => string;
|
package/dist/compile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,GAAG,
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,GAAG,EAQJ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,IAAI,EAAuC,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAG1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CACpC,CAAC;AAEF,KAAK,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAI7B,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,MAAyD,CAAC;AAalG,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAM5D;AA2dD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA4ZjE,wBAAgB,WAAW,CACzB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,MAAM,GAAE,MAAM,GAAG,IAAW,GAC3B,WAAW,CAUb"}
|
package/dist/compile.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ARRAY_INDEX, bodied, byCodePoint, compared, cursorOf, heldKind, parse, pointerSegments, sql, } from '@agentshouse/mdmodel';
|
|
2
2
|
import { binaryRecord } from './binary.js';
|
|
3
|
+
import { definitionsAt, UNTYPED } from './collection.js';
|
|
3
4
|
import { documentKey, pathOfKey, roomOfKey } from './rows.js';
|
|
4
5
|
import { FROM_START, MAXIMUM_WINDOW } from './windows.js';
|
|
5
6
|
const { all, any, exists, fragment, grouped, joined, listed } = sql;
|
|
6
|
-
export const VISIBLE = (alias) => `${alias}.visible = 1 AND ${alias}.present = 1
|
|
7
|
+
export const VISIBLE = (alias) => `${alias}.visible = 1 AND ${alias}.present = 1`;
|
|
7
8
|
function located(alias) {
|
|
8
9
|
return fragment(`(SELECT k.locator FROM replica_keys k WHERE k.key = ${alias}.key)`);
|
|
9
10
|
}
|
|
@@ -310,7 +311,16 @@ function sectionsOf(sections, names) {
|
|
|
310
311
|
return sections;
|
|
311
312
|
return Object.fromEntries(names.flatMap((name) => (Object.hasOwn(sections, name) ? [[name, sections[name]]] : [])));
|
|
312
313
|
}
|
|
313
|
-
function
|
|
314
|
+
function freeParts(room, path, type, content) {
|
|
315
|
+
const definitions = room.composition === undefined ? undefined : definitionsAt(room.composition, path);
|
|
316
|
+
const definition = definitions?.(type === UNTYPED ? undefined : type);
|
|
317
|
+
if (definition === undefined && type !== UNTYPED)
|
|
318
|
+
return null;
|
|
319
|
+
const read = parse(content, path, definition);
|
|
320
|
+
return read.ok ? read.document : null;
|
|
321
|
+
}
|
|
322
|
+
function documentOf(shape, queried, row, linked) {
|
|
323
|
+
const room = queried.locator;
|
|
314
324
|
const path = row.path;
|
|
315
325
|
const type = row.type;
|
|
316
326
|
const fileId = row.file_id;
|
|
@@ -333,8 +343,9 @@ function documentOf(shape, room, row, linked) {
|
|
|
333
343
|
...heldFacts(shape, row),
|
|
334
344
|
};
|
|
335
345
|
}
|
|
336
|
-
const
|
|
337
|
-
|
|
346
|
+
const body = shape.sections !== null || shape.preamble
|
|
347
|
+
? freeParts(queried, path, type, row.content)
|
|
348
|
+
: null;
|
|
338
349
|
const fields = JSON.parse(row.fields ?? '{}');
|
|
339
350
|
return {
|
|
340
351
|
room,
|
|
@@ -428,8 +439,9 @@ function documents(connection, bound, plan, shape, budget) {
|
|
|
428
439
|
const kept = bodied(shape) ? withContent(connection, windowed, budget) : windowed;
|
|
429
440
|
const cut = kept.length;
|
|
430
441
|
const roomOf = new Map(bound.rooms.map(({ key, locator }) => [key, locator]));
|
|
442
|
+
const queried = new Map(bound.rooms.map((one) => [one.key, one]));
|
|
431
443
|
const linked = shape.backlinks ? backlinksOf(connection, bound, kept) : new Map();
|
|
432
|
-
const found = kept.map((row) => documentOf(shape,
|
|
444
|
+
const found = kept.map((row) => documentOf(shape, queried.get(Number(row.key)), row, linked));
|
|
433
445
|
const last = kept.at(-1);
|
|
434
446
|
const cursorAt = (row) => cursorOf([
|
|
435
447
|
...shape.orderBy.map(({ key }, index) => decodedKey(key, row, index)),
|
package/dist/connection.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export type MdRuntimeOptions = {
|
|
|
10
10
|
authorization?: Authorization;
|
|
11
11
|
signal?: AbortSignal;
|
|
12
12
|
recovery?: Recovery;
|
|
13
|
-
usableWhenHeld?: readonly string[];
|
|
14
13
|
build?: string;
|
|
14
|
+
storeOnNeed?: boolean;
|
|
15
15
|
};
|
|
16
16
|
export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
|
|
17
17
|
//# sourceMappingURL=connection.d.ts.map
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAI/E,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAUrE,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAK9D,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAGrE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAIF,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAsGzE"}
|
package/dist/connection.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { notReadyWaitMs } from '@agentshouse/mdmodel';
|
|
1
2
|
import { submitLater } from './acceptance.js';
|
|
2
3
|
import { invokeAction, called, readConversationHistory, resendLater } from './actions.js';
|
|
3
|
-
import { builtInModel,
|
|
4
|
+
import { builtInModel, NO_ROOM_TYPES } from './attached-model.js';
|
|
4
5
|
import { createLiveConversations } from './conversation-live.js';
|
|
5
6
|
import { writeRule } from './declaration.js';
|
|
6
7
|
import { refusedForSpace } from './durability.js';
|
|
@@ -8,27 +9,29 @@ import { uncaught } from './failure.js';
|
|
|
8
9
|
import { createFigures } from './figures.js';
|
|
9
10
|
import { scheduleCurrency, spaceFreed, start } from './lifecycle.js';
|
|
10
11
|
import { createLiveQueries } from './live.js';
|
|
11
|
-
import { createLog } from './log.js';
|
|
12
12
|
import { open } from './opening.js';
|
|
13
13
|
import { deliverOwedReadiness, filled, prepare } from './preparation.js';
|
|
14
14
|
import { createPresence } from './presence.js';
|
|
15
15
|
import { answeredPlan, figuresCover, roomTallies } from './queries.js';
|
|
16
16
|
import { readAnswers } from './reads.js';
|
|
17
17
|
import { createRecovery } from './recovery.js';
|
|
18
|
+
import { createRetries } from './retried.js';
|
|
18
19
|
import { publishChangeSet, show } from './shown.js';
|
|
19
20
|
import { createSocket } from './socket.js';
|
|
20
21
|
import { createStore } from './store.js';
|
|
21
22
|
import { composedRuntime } from './surface.js';
|
|
23
|
+
import { adopt, discover } from './sync.js';
|
|
22
24
|
const ROOM_ATTEMPTS = 16;
|
|
23
25
|
export function composeRuntime(options) {
|
|
24
26
|
const { adapter, shell } = options;
|
|
25
|
-
const roomTypes =
|
|
27
|
+
const roomTypes = adapter.roomTypes ?? NO_ROOM_TYPES;
|
|
26
28
|
const builtIn = builtInModel(roomTypes);
|
|
27
29
|
const typedPaths = adapter.typedPaths ?? [];
|
|
28
|
-
const
|
|
29
|
-
const socket = createSocket(adapter,
|
|
30
|
-
const presence = createPresence();
|
|
30
|
+
const retries = createRetries(shell);
|
|
31
|
+
const socket = createSocket(adapter, retries, options.authorization);
|
|
32
|
+
const presence = createPresence(notReadyWaitMs);
|
|
31
33
|
const store = createStore({
|
|
34
|
+
retries,
|
|
32
35
|
database: {
|
|
33
36
|
async ask(request) {
|
|
34
37
|
try {
|
|
@@ -46,11 +49,9 @@ export function composeRuntime(options) {
|
|
|
46
49
|
typedPaths,
|
|
47
50
|
persistence: shell.persistence,
|
|
48
51
|
lost: presence.lost,
|
|
52
|
+
losing: presence.losing,
|
|
49
53
|
opening: (local) => open(runtime, local),
|
|
50
|
-
unpublished
|
|
51
|
-
journal.record(`publication failed ${error instanceof Error ? error.name : 'unknown'}`);
|
|
52
|
-
uncaught(error);
|
|
53
|
-
},
|
|
54
|
+
unpublished: uncaught,
|
|
54
55
|
changed(set) {
|
|
55
56
|
if (set.unindexed.length > 0)
|
|
56
57
|
prepare(runtime, set.unindexed);
|
|
@@ -58,7 +59,7 @@ export function composeRuntime(options) {
|
|
|
58
59
|
submitLater(runtime, locator);
|
|
59
60
|
return publishChangeSet(runtime, set);
|
|
60
61
|
},
|
|
61
|
-
deliverReadiness: (owed) => deliverOwedReadiness(runtime, owed),
|
|
62
|
+
deliverReadiness: (owed, rooms) => deliverOwedReadiness(runtime, owed, rooms),
|
|
62
63
|
spaceFreed: () => spaceFreed(runtime),
|
|
63
64
|
});
|
|
64
65
|
const recovery = (options.recovery ?? createRecovery()).scope(ROOM_ATTEMPTS);
|
|
@@ -66,18 +67,17 @@ export function composeRuntime(options) {
|
|
|
66
67
|
store,
|
|
67
68
|
socket,
|
|
68
69
|
presence,
|
|
69
|
-
journal,
|
|
70
70
|
recovery,
|
|
71
|
+
retries,
|
|
71
72
|
shell,
|
|
72
73
|
localSaves: adapter.localSaves === true,
|
|
73
74
|
roomTypes,
|
|
74
75
|
builtIn,
|
|
75
76
|
typedPaths,
|
|
76
77
|
writeRule: (declaration) => writeRule(declaration, adapter.pathRule ?? (() => true), adapter.localSaves === true),
|
|
77
|
-
usableWhenHeld: options.usableWhenHeld ?? [],
|
|
78
78
|
build: options.build ?? '',
|
|
79
79
|
conversations: createLiveConversations({
|
|
80
|
-
call: (name, input) => invokeAction(runtime, name, input),
|
|
80
|
+
call: (name, input, attempt) => invokeAction(runtime, name, input, { attempt }),
|
|
81
81
|
history: (request) => readConversationHistory(runtime, request),
|
|
82
82
|
durably: store.durably,
|
|
83
83
|
local: store.open,
|
|
@@ -93,7 +93,9 @@ export function composeRuntime(options) {
|
|
|
93
93
|
full: store.space.full,
|
|
94
94
|
closed: socket.closed,
|
|
95
95
|
unanswered: () => resendLater(runtime),
|
|
96
|
+
heard: (operation, lost) => socket.lanes.settle(operation, lost),
|
|
96
97
|
recovery: recovery.scope(),
|
|
98
|
+
retries,
|
|
97
99
|
}),
|
|
98
100
|
liveQueries: createLiveQueries((plan, cover) => answeredPlan(runtime, plan, cover), store.covering),
|
|
99
101
|
figures: createFigures({
|
|
@@ -107,14 +109,17 @@ export function composeRuntime(options) {
|
|
|
107
109
|
unkept: adapter.unkeptReads ?? [],
|
|
108
110
|
leading: adapter.leadingReads ?? [],
|
|
109
111
|
recovery: recovery.scope(),
|
|
110
|
-
|
|
112
|
+
retries,
|
|
113
|
+
call: (name, input, attempt) => called(runtime, name, input, attempt),
|
|
111
114
|
online: socket.reached,
|
|
112
115
|
streaming: socket.isOpen,
|
|
113
116
|
closed: socket.closed,
|
|
114
117
|
full: store.space.full,
|
|
115
118
|
filled: () => filled(runtime),
|
|
116
119
|
}),
|
|
120
|
+
discover: () => discover(runtime),
|
|
121
|
+
adopt: (unstored) => adopt(runtime, unstored),
|
|
117
122
|
};
|
|
118
|
-
start(runtime, options.signal);
|
|
123
|
+
start(runtime, options.signal, options.storeOnNeed === true);
|
|
119
124
|
return composedRuntime(runtime);
|
|
120
125
|
}
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKpD"}
|
package/dist/context.js
CHANGED
|
@@ -5,9 +5,10 @@ import type { ChangeSet } from './change-set.js';
|
|
|
5
5
|
import type { Asked, ConversationAgent, ConversationEntry, ConversationView, RunningTurn } from './conversation.js';
|
|
6
6
|
import type { CallResult } from './outcome.js';
|
|
7
7
|
import type { Recovery } from './recovery.js';
|
|
8
|
+
import type { Attempt, Retries } from './retried.js';
|
|
8
9
|
import type { ChatDraftRecord, RuntimeStore } from './store.js';
|
|
9
10
|
export type ConversationDependencies = {
|
|
10
|
-
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
11
|
+
call(name: ConversationAction, input: unknown, attempt?: Attempt): Promise<CallResult>;
|
|
11
12
|
history(request: ConversationHistoryRequest): Promise<CallResult>;
|
|
12
13
|
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
13
14
|
local(): Promise<RuntimeStore>;
|
|
@@ -19,7 +20,9 @@ export type ConversationDependencies = {
|
|
|
19
20
|
full(): boolean;
|
|
20
21
|
closed(): boolean;
|
|
21
22
|
unanswered(): void;
|
|
23
|
+
heard(operation: string, lost: boolean): void;
|
|
22
24
|
readonly recovery: Recovery;
|
|
25
|
+
readonly retries: Retries;
|
|
23
26
|
};
|
|
24
27
|
export type Live = {
|
|
25
28
|
turn: RunningTurn | null;
|
|
@@ -43,10 +46,14 @@ export declare const FACTS: readonly Fact[];
|
|
|
43
46
|
type Watcher = {
|
|
44
47
|
readonly notify: (view: ConversationView) => void;
|
|
45
48
|
};
|
|
46
|
-
type
|
|
47
|
-
readonly window: readonly AcceptedMessage[] | null;
|
|
49
|
+
export type Kept = {
|
|
48
50
|
readonly draft: ChatDraftRecord | null;
|
|
49
51
|
readonly ended: string | null;
|
|
52
|
+
readonly dismissed: string | null;
|
|
53
|
+
readonly pins: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
type HeldWindow = Kept & {
|
|
56
|
+
readonly window: readonly AcceptedMessage[] | null;
|
|
50
57
|
readonly more: boolean;
|
|
51
58
|
readonly total: number | null;
|
|
52
59
|
};
|
|
@@ -72,23 +79,30 @@ export type Audience<T> = {
|
|
|
72
79
|
};
|
|
73
80
|
type HeldFacts = {
|
|
74
81
|
readonly listKnown: boolean;
|
|
82
|
+
readonly listHeld: boolean;
|
|
83
|
+
readonly openingRead: boolean;
|
|
84
|
+
readonly openingListed: boolean;
|
|
75
85
|
readonly listOwed: boolean;
|
|
76
86
|
readonly listTelling: boolean;
|
|
77
87
|
readonly agentsShown: string | null;
|
|
78
|
-
readonly
|
|
79
|
-
readonly agentsReading: boolean;
|
|
88
|
+
readonly listedShown: string | null;
|
|
80
89
|
readonly replicated: ReadonlySet<string>;
|
|
81
90
|
readonly handedReplicated: string | undefined;
|
|
82
91
|
};
|
|
83
92
|
export type Dispatch = Cell<{
|
|
84
93
|
readonly answered: boolean;
|
|
85
94
|
}>;
|
|
95
|
+
export type Relisted = {
|
|
96
|
+
readonly conversations: ReadonlyMap<string, ListedConversation>;
|
|
97
|
+
readonly agents: ReadonlyMap<string, ListedAgent>;
|
|
98
|
+
};
|
|
86
99
|
export type LiveConversations = {
|
|
87
100
|
readonly deps: ConversationDependencies;
|
|
88
101
|
readonly held: Cell<HeldFacts>;
|
|
89
102
|
readonly closing: AbortSignal;
|
|
90
103
|
readonly listeners: Audience<readonly ConversationEntry[]>;
|
|
91
104
|
readonly agentListeners: Audience<readonly ConversationAgent[]>;
|
|
105
|
+
readonly listedListeners: Audience<readonly ListedAgent[]>;
|
|
92
106
|
views(): Iterable<SharedView>;
|
|
93
107
|
viewJoined(key: string, conversation: string, asked: Asked, notify: (view: ConversationView) => void): {
|
|
94
108
|
readonly view: SharedView;
|
|
@@ -116,9 +130,9 @@ export type LiveConversations = {
|
|
|
116
130
|
isCreating(conversation: string): boolean;
|
|
117
131
|
relisting(): boolean;
|
|
118
132
|
relistBegun(): void;
|
|
119
|
-
relistHeard(entries: readonly ListedConversation[]): void;
|
|
133
|
+
relistHeard(entries: readonly ListedConversation[], agents: readonly ListedAgent[]): void;
|
|
120
134
|
relistDropped(conversation: string): void;
|
|
121
|
-
relistTaken():
|
|
135
|
+
relistTaken(): Relisted | null;
|
|
122
136
|
sendingBegan(operation: string): Dispatch;
|
|
123
137
|
sendingEnded(operation: string, dispatch: Dispatch): void;
|
|
124
138
|
sending(operation: string): boolean;
|
|
@@ -127,6 +141,8 @@ export type LiveConversations = {
|
|
|
127
141
|
forget(conversation: string): void;
|
|
128
142
|
current(): boolean;
|
|
129
143
|
known(): boolean;
|
|
144
|
+
listHeld(): boolean;
|
|
145
|
+
listed(): boolean;
|
|
130
146
|
reopened(): void;
|
|
131
147
|
lost(): void;
|
|
132
148
|
close(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-live.d.ts","sourceRoot":"","sources":["../src/conversation-live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,KAAK,EACL,iBAAiB,EACjB,iBAAiB,E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