@agentshouse/mdruntime 0.1.0-cd26b960b7262 → 0.1.0-cd30853a1b15e
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 +0 -3
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +72 -158
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +8 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +118 -67
- package/dist/adapter.d.ts +81 -56
- 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/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +6 -19
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -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 +10 -19
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +30 -18
- package/dist/collection.d.ts +25 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +19 -2
- 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.map +1 -1
- package/dist/connection.js +31 -24
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +26 -12
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +23 -12
- 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 +32 -10
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +317 -232
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +19 -44
- package/dist/durability.d.ts +4 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +4 -0
- package/dist/entry.js +1 -1
- 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 +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -0
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +2 -1
- package/dist/host.d.ts +18 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +55 -15
- package/dist/index.d.ts +15 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -7
- package/dist/install.d.ts +10 -6
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +92 -109
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +54 -40
- package/dist/listing.d.ts +11 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +48 -72
- package/dist/live.d.ts +5 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +74 -31
- 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 +2 -4
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +10 -39
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +11 -23
- package/dist/media.d.ts +5 -0
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +65 -14
- package/dist/memory.d.ts +7 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +56 -26
- package/dist/messages.d.ts +12 -6
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +25 -27
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -5
- package/dist/models.d.ts +4 -8
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +97 -139
- package/dist/observation.d.ts +27 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +173 -69
- package/dist/opened.d.ts +1 -1
- 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 +5 -9
- package/dist/outcome.d.ts +7 -0
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +23 -2
- package/dist/overlay.d.ts +6 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +37 -24
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +3 -59
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +10 -123
- package/dist/preparation.d.ts +27 -6
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +154 -66
- package/dist/presence.d.ts +58 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +231 -0
- package/dist/queries.d.ts +2 -2
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +66 -30
- 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 +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +480 -0
- package/dist/reach.d.ts +2 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +83 -25
- package/dist/react.d.ts +8 -5
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +28 -5
- package/dist/readiness.d.ts +9 -3
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +3 -5
- package/dist/reads.d.ts +4 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +11 -4
- package/dist/recovery.d.ts +3 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +29 -7
- package/dist/refresh.js +2 -2
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +5 -5
- package/dist/replica.d.ts +5 -11
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +14 -16
- 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 +270 -63
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +8 -5
- 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 +9 -10
- package/dist/runtime.d.ts +9 -18
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +42 -90
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +314 -223
- package/dist/saves.d.ts +2 -40
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +124 -703
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +4 -4
- package/dist/shown.d.ts +7 -5
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +75 -58
- 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.d.ts +3 -6
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +3 -14
- 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 +17 -6
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +56 -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 +23 -14
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +46 -17
- package/dist/stored.d.ts +24 -13
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +80 -29
- package/dist/surface.d.ts +5 -3
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +23 -21
- package/dist/sync.d.ts +1 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +89 -85
- package/dist/tables.d.ts +16 -56
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +86 -327
- 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 +4 -10
- package/dist/wire.d.ts +45 -7
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +15 -4
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/job.d.ts +0 -33
- package/dist/job.d.ts.map +0 -1
- package/dist/job.js +0 -54
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/socket/rooms.d.ts +0 -44
- package/dist/socket/rooms.d.ts.map +0 -1
- package/dist/socket/rooms.js +0 -90
- package/dist/store/fences.d.ts +0 -16
- package/dist/store/fences.d.ts.map +0 -1
- package/dist/store/fences.js +0 -26
package/dist/client.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { shownBy } from './media.js';
|
|
2
|
+
import { pageMetadataBlock } from './page-metadata.js';
|
|
2
3
|
import { observed } from './observation.js';
|
|
3
4
|
import { runtimeError } from './failure.js';
|
|
4
|
-
import {
|
|
5
|
+
import { blobOf, } from './outcome.js';
|
|
6
|
+
import { AUTHORIZATION_ENDED, PORT_CLOSED, wireAnswer, } from './wire.js';
|
|
5
7
|
// 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.
|
|
6
8
|
const SETTLED_FRAMES = 2;
|
|
7
9
|
// 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.
|
|
@@ -36,13 +38,13 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
36
38
|
const send = (message) => {
|
|
37
39
|
port.postMessage(message);
|
|
38
40
|
};
|
|
39
|
-
function begin(id, topic, first) {
|
|
41
|
+
function begin(id, topic, input, first) {
|
|
40
42
|
const handle = observed(first, () => {
|
|
41
43
|
observations.delete(id);
|
|
42
44
|
if (refusal === null)
|
|
43
45
|
send({ kind: 'stop', id });
|
|
44
|
-
}, topic
|
|
45
|
-
observations.set(id, { topic, handle });
|
|
46
|
+
}, topic);
|
|
47
|
+
observations.set(id, { topic, input, handle });
|
|
46
48
|
return handle.observation;
|
|
47
49
|
}
|
|
48
50
|
function refuse(reported) {
|
|
@@ -54,7 +56,7 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
54
56
|
const failure = refused(reported);
|
|
55
57
|
for (const [id, waiting] of opening) {
|
|
56
58
|
if (waiting.topic === 'connection-refusal')
|
|
57
|
-
waiting.settle(begin(id, waiting.topic, reported));
|
|
59
|
+
waiting.settle(begin(id, waiting.topic, waiting.input, reported));
|
|
58
60
|
else
|
|
59
61
|
waiting.fail(failure);
|
|
60
62
|
}
|
|
@@ -80,7 +82,7 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
80
82
|
drawing?.();
|
|
81
83
|
}
|
|
82
84
|
port.addEventListener('message', (event) => {
|
|
83
|
-
const message =
|
|
85
|
+
const message = wireAnswer(event.data);
|
|
84
86
|
if (message === null)
|
|
85
87
|
return;
|
|
86
88
|
if (message.kind === 'refusal') {
|
|
@@ -106,7 +108,7 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
106
108
|
waiting.fail(runtimeError(message.code, message.message, message.retryable));
|
|
107
109
|
}
|
|
108
110
|
else
|
|
109
|
-
waiting.settle(begin(message.id, waiting.topic, message.value));
|
|
111
|
+
waiting.settle(begin(message.id, waiting.topic, waiting.input, message.value));
|
|
110
112
|
drawing?.();
|
|
111
113
|
return;
|
|
112
114
|
}
|
|
@@ -142,11 +144,11 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
142
144
|
const id = (sequence += 1);
|
|
143
145
|
if (refusal !== null) {
|
|
144
146
|
return topic === 'connection-refusal'
|
|
145
|
-
? Promise.resolve(begin(id, topic, refusal))
|
|
147
|
+
? Promise.resolve(begin(id, topic, input, refusal))
|
|
146
148
|
: Promise.reject(refused(refusal));
|
|
147
149
|
}
|
|
148
150
|
return new Promise((settle, fail) => {
|
|
149
|
-
opening.set(id, { topic, settle, fail });
|
|
151
|
+
opening.set(id, { topic, input, settle, fail });
|
|
150
152
|
send({ kind: 'observe', id, topic, input });
|
|
151
153
|
drawing?.();
|
|
152
154
|
});
|
|
@@ -194,9 +196,7 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
194
196
|
const read = streamed(await ask('binaryFile.read', [room, path, revision]));
|
|
195
197
|
if (read.kind !== 'binary')
|
|
196
198
|
return read;
|
|
197
|
-
const copy = await
|
|
198
|
-
headers: { 'content-type': read.mediaType },
|
|
199
|
-
}).blob();
|
|
199
|
+
const copy = await blobOf(read);
|
|
200
200
|
const url = URL.createObjectURL(copy);
|
|
201
201
|
handed(url, path.slice(path.lastIndexOf('/') + 1));
|
|
202
202
|
setTimeout(() => URL.revokeObjectURL(url), HANDED_COPY_MS);
|
|
@@ -256,14 +256,26 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
256
256
|
read: (conversation, options) => ask('conversation.read', [conversation, options]),
|
|
257
257
|
create: (input) => ask('conversation.create', [input]),
|
|
258
258
|
send: (conversation, operation, draft) => ask('conversation.send', [conversation, operation, draft]),
|
|
259
|
-
answer: (conversation, answer) => ask('conversation.answer', [conversation, answer]),
|
|
260
|
-
interrupt: (conversation) => ask('conversation.interrupt', [conversation]),
|
|
261
|
-
kill: (conversation) => ask('conversation.kill', [conversation]),
|
|
262
|
-
delete: (conversation) => ask('conversation.delete', [conversation]),
|
|
259
|
+
answer: (conversation, answer, operation) => ask('conversation.answer', [conversation, answer, operation]),
|
|
260
|
+
interrupt: (conversation, operation) => ask('conversation.interrupt', [conversation, operation]),
|
|
261
|
+
kill: (conversation, operation) => ask('conversation.kill', [conversation, operation]),
|
|
262
|
+
delete: (conversation, operation) => ask('conversation.delete', [conversation, operation]),
|
|
263
|
+
takeOut: (conversation, message, operation) => ask('conversation.takeOut', [conversation, message, operation]),
|
|
264
|
+
decide: (request, decision, operation) => ask('conversation.decide', [request, decision, operation]),
|
|
265
|
+
rename: (conversation, name, operation) => ask('conversation.rename', [conversation, name, operation]),
|
|
266
|
+
option: (conversation, option, value, operation) => ask('conversation.option', [conversation, option, value, operation]),
|
|
267
|
+
retry: (conversation, message, operation) => ask('conversation.retry', [conversation, message, operation]),
|
|
268
|
+
pin: (figures) => ask('conversation.pin', [figures]),
|
|
269
|
+
openTurn: (conversation, turn) => ask('conversation.openTurn', [conversation, turn]),
|
|
270
|
+
dismissSuggestion: (conversation, suggestion) => ask('conversation.dismissSuggestion', [conversation, suggestion]),
|
|
271
|
+
pageMetadata: async (app, address) => pageMetadataBlock(app, address, [...observations]
|
|
272
|
+
.sort(([left], [right]) => left - right)
|
|
273
|
+
.flatMap(([, { topic, input }]) => (topic === 'query' ? [input[0]] : []))),
|
|
263
274
|
},
|
|
264
275
|
chatDraft: {
|
|
265
276
|
write: (conversation, draft, revision) => ask('chatDraft.write', [conversation, draft, revision]),
|
|
266
277
|
prepend: (conversation, draft) => ask('chatDraft.prepend', [conversation, draft]),
|
|
278
|
+
append: (conversation, draft) => ask('chatDraft.append', [conversation, draft]),
|
|
267
279
|
discard: (conversation) => ask('chatDraft.discard', [conversation]),
|
|
268
280
|
},
|
|
269
281
|
history: (locator, path, query) => ask('history', [locator, path, query]),
|
|
@@ -274,8 +286,8 @@ export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
|
274
286
|
download,
|
|
275
287
|
},
|
|
276
288
|
call: (name, input) => ask('call', [name, input]),
|
|
289
|
+
answered: (operation) => ask('answered', [operation]),
|
|
277
290
|
reached: (locator, roomVersion, path) => ask('reached', [locator, roomVersion, path]),
|
|
278
|
-
log: () => ask('log', []),
|
|
279
291
|
persistence: () => ask('persistence', []),
|
|
280
292
|
retry: () => ask('retry', []),
|
|
281
293
|
cleanUp: () => ask('cleanUp', []),
|
|
@@ -295,5 +307,5 @@ export function inTurn(client, work) {
|
|
|
295
307
|
}
|
|
296
308
|
export { chainedWindows } from './chain.js';
|
|
297
309
|
export { roomDraftRevision } from './identity.js';
|
|
298
|
-
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
310
|
+
export { defineRoomMedia, ROOM_MEDIA, viewFile } from './media.js';
|
|
299
311
|
export { unanswered } from './wire.js';
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Document, type TypedPath } from '@agentshouse/mdmodel';
|
|
2
|
-
import type { ModelState } from './model.js';
|
|
1
|
+
import { type DefinitionOf, type Document, type ParseResult, type TypedPath } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { ModelState, TypesResult } from './model.js';
|
|
3
|
+
import type { AppTypedSelection } from './listing.js';
|
|
3
4
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
5
|
export declare const MD_MODEL: MdModelIdentity;
|
|
5
6
|
export type Collection = {
|
|
@@ -20,10 +21,30 @@ export type Composed = {
|
|
|
20
21
|
readonly fingerprint: string;
|
|
21
22
|
};
|
|
22
23
|
export declare function composedOf(composition: Composition): Composed;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
type Selecting<M> = {
|
|
25
|
+
readonly model: M;
|
|
26
|
+
readonly selection: {
|
|
27
|
+
readonly roots: readonly string[];
|
|
28
|
+
readonly model: M;
|
|
29
|
+
} | null;
|
|
30
|
+
};
|
|
31
|
+
export declare function selected(composition: {
|
|
32
|
+
readonly selection: {
|
|
33
|
+
readonly roots: readonly string[];
|
|
34
|
+
} | null;
|
|
35
|
+
}, path: string): boolean;
|
|
36
|
+
export declare function governing<M>(composition: Selecting<M>, path: string): M;
|
|
37
|
+
export declare function definitionsAt(composition: Composition, path: string): DefinitionOf;
|
|
38
|
+
export declare function definitionsIn(room: {
|
|
39
|
+
readonly model: TypesResult;
|
|
40
|
+
readonly typedSelection: AppTypedSelection | null;
|
|
41
|
+
}, path: string, typedPaths: readonly TypedPath[]): DefinitionOf;
|
|
25
42
|
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
26
43
|
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
27
44
|
export declare function validRoot(root: unknown): root is string;
|
|
45
|
+
export declare const UNTYPED = "any";
|
|
46
|
+
export declare function textType(read: ParseResult): string | undefined;
|
|
47
|
+
export declare function typedText(read: ParseResult): boolean;
|
|
28
48
|
export declare function available(composition: Composition): boolean;
|
|
49
|
+
export {};
|
|
29
50
|
//# 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,
|
|
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,EAEf,MAAM,sBA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
import { definitionAt, parse, VERSION, } from '@agentshouse/mdmodel';
|
|
2
2
|
import { beneath, normalize } from './paths.js';
|
|
3
3
|
import { hashed } from './observation.js';
|
|
4
4
|
import { sortedKeys } from './shared.js';
|
|
@@ -33,6 +33,16 @@ export function governing(composition, path) {
|
|
|
33
33
|
? composition.selection.model
|
|
34
34
|
: composition.model;
|
|
35
35
|
}
|
|
36
|
+
function definitionsUnder(composition, path, typedPaths, typesOf) {
|
|
37
|
+
const types = typesOf(governing(composition, path));
|
|
38
|
+
return types === null ? () => undefined : definitionAt({ types }, path, typedPaths);
|
|
39
|
+
}
|
|
40
|
+
export function definitionsAt(composition, path) {
|
|
41
|
+
return definitionsUnder(composition, path, composition.typedPaths, (model) => model.status === 'unavailable' ? null : model.types);
|
|
42
|
+
}
|
|
43
|
+
export function definitionsIn(room, path, typedPaths) {
|
|
44
|
+
return definitionsUnder({ model: room.model, selection: room.typedSelection }, path, typedPaths, ({ types }) => types === null ? null : Object.fromEntries(types.map((type) => [type.name, type])));
|
|
45
|
+
}
|
|
36
46
|
export function collectionOf(text, composition) {
|
|
37
47
|
const parsed = new Map();
|
|
38
48
|
return {
|
|
@@ -44,7 +54,7 @@ export function collectionOf(text, composition) {
|
|
|
44
54
|
const content = text[path];
|
|
45
55
|
if (content === undefined)
|
|
46
56
|
return undefined;
|
|
47
|
-
const read = parse(content, path);
|
|
57
|
+
const read = parse(content, path, definitionsAt(composition, path));
|
|
48
58
|
parsed.set(path, read.ok ? read.document : null);
|
|
49
59
|
return read.ok ? read.document : undefined;
|
|
50
60
|
},
|
|
@@ -63,6 +73,13 @@ export function* documentsOf(collection) {
|
|
|
63
73
|
export function validRoot(root) {
|
|
64
74
|
return typeof root === 'string' && normalize(root) === root;
|
|
65
75
|
}
|
|
76
|
+
export const UNTYPED = 'any';
|
|
77
|
+
export function textType(read) {
|
|
78
|
+
return read.ok ? (read.document.type ?? UNTYPED) : undefined;
|
|
79
|
+
}
|
|
80
|
+
export function typedText(read) {
|
|
81
|
+
return (textType(read) ?? UNTYPED) !== UNTYPED;
|
|
82
|
+
}
|
|
66
83
|
export function available(composition) {
|
|
67
84
|
return composition.model.status !== 'unavailable';
|
|
68
85
|
}
|
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.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;AAErE,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,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAIF,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAqGzE"}
|
package/dist/connection.js
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { notReadyWaitMs } from '@agentshouse/mdmodel';
|
|
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';
|
|
6
|
+
import { writeRule } from './declaration.js';
|
|
5
7
|
import { refusedForSpace } from './durability.js';
|
|
8
|
+
import { uncaught } from './failure.js';
|
|
6
9
|
import { createFigures } from './figures.js';
|
|
7
10
|
import { scheduleCurrency, spaceFreed, start } from './lifecycle.js';
|
|
8
11
|
import { createLiveQueries } from './live.js';
|
|
9
|
-
import { createLog } from './log.js';
|
|
10
|
-
import { scoped } from './models.js';
|
|
11
12
|
import { open } from './opening.js';
|
|
12
|
-
import { deliverOwedReadiness, filled } from './preparation.js';
|
|
13
|
+
import { deliverOwedReadiness, filled, prepare } from './preparation.js';
|
|
14
|
+
import { createPresence } from './presence.js';
|
|
13
15
|
import { answeredPlan, figuresCover, roomTallies } from './queries.js';
|
|
14
16
|
import { readAnswers } from './reads.js';
|
|
15
17
|
import { createRecovery } from './recovery.js';
|
|
16
|
-
import {
|
|
18
|
+
import { createRetries } from './retried.js';
|
|
17
19
|
import { publishChangeSet, show } from './shown.js';
|
|
18
20
|
import { createSocket } from './socket.js';
|
|
19
21
|
import { createStore } from './store.js';
|
|
20
22
|
import { composedRuntime } from './surface.js';
|
|
21
|
-
import { advanced, withhold } from './sync.js';
|
|
22
23
|
const ROOM_ATTEMPTS = 16;
|
|
23
24
|
export function composeRuntime(options) {
|
|
24
25
|
const { adapter, shell } = options;
|
|
25
|
-
const roomTypes =
|
|
26
|
+
const roomTypes = adapter.roomTypes ?? NO_ROOM_TYPES;
|
|
26
27
|
const builtIn = builtInModel(roomTypes);
|
|
27
28
|
const typedPaths = adapter.typedPaths ?? [];
|
|
28
|
-
const
|
|
29
|
-
const socket = createSocket(adapter,
|
|
29
|
+
const retries = createRetries(shell);
|
|
30
|
+
const socket = createSocket(adapter, retries, options.authorization);
|
|
31
|
+
const presence = createPresence(notReadyWaitMs);
|
|
30
32
|
const store = createStore({
|
|
33
|
+
retries,
|
|
31
34
|
database: {
|
|
32
35
|
async ask(request) {
|
|
33
36
|
try {
|
|
@@ -44,30 +47,37 @@ export function composeRuntime(options) {
|
|
|
44
47
|
builtIn,
|
|
45
48
|
typedPaths,
|
|
46
49
|
persistence: shell.persistence,
|
|
50
|
+
lost: presence.lost,
|
|
51
|
+
losing: presence.losing,
|
|
47
52
|
opening: (local) => open(runtime, local),
|
|
48
|
-
unpublished
|
|
49
|
-
|
|
53
|
+
unpublished: uncaught,
|
|
54
|
+
changed(set) {
|
|
55
|
+
if (set.unindexed.length > 0)
|
|
56
|
+
prepare(runtime, set.unindexed);
|
|
57
|
+
for (const locator of set.due)
|
|
58
|
+
submitLater(runtime, locator);
|
|
59
|
+
return publishChangeSet(runtime, set);
|
|
50
60
|
},
|
|
51
|
-
|
|
52
|
-
deliverReadiness: (owed) => deliverOwedReadiness(runtime, owed),
|
|
61
|
+
deliverReadiness: (owed, rooms) => deliverOwedReadiness(runtime, owed, rooms),
|
|
53
62
|
spaceFreed: () => spaceFreed(runtime),
|
|
54
63
|
});
|
|
55
64
|
const recovery = (options.recovery ?? createRecovery()).scope(ROOM_ATTEMPTS);
|
|
56
65
|
const runtime = {
|
|
57
66
|
store,
|
|
58
67
|
socket,
|
|
59
|
-
|
|
68
|
+
presence,
|
|
60
69
|
recovery,
|
|
70
|
+
retries,
|
|
61
71
|
shell,
|
|
62
72
|
localSaves: adapter.localSaves === true,
|
|
63
73
|
roomTypes,
|
|
64
74
|
builtIn,
|
|
65
75
|
typedPaths,
|
|
66
|
-
|
|
76
|
+
writeRule: (declaration) => writeRule(declaration, adapter.pathRule ?? (() => true), adapter.localSaves === true),
|
|
67
77
|
usableWhenHeld: options.usableWhenHeld ?? [],
|
|
68
78
|
build: options.build ?? '',
|
|
69
79
|
conversations: createLiveConversations({
|
|
70
|
-
call: (name, input) => invokeAction(runtime, name, input),
|
|
80
|
+
call: (name, input, attempt) => invokeAction(runtime, name, input, { attempt }),
|
|
71
81
|
history: (request) => readConversationHistory(runtime, request),
|
|
72
82
|
durably: store.durably,
|
|
73
83
|
local: store.open,
|
|
@@ -83,7 +93,9 @@ export function composeRuntime(options) {
|
|
|
83
93
|
full: store.space.full,
|
|
84
94
|
closed: socket.closed,
|
|
85
95
|
unanswered: () => resendLater(runtime),
|
|
96
|
+
heard: (operation, lost) => socket.lanes.settle(operation, lost),
|
|
86
97
|
recovery: recovery.scope(),
|
|
98
|
+
retries,
|
|
87
99
|
}),
|
|
88
100
|
liveQueries: createLiveQueries((plan, cover) => answeredPlan(runtime, plan, cover), store.covering),
|
|
89
101
|
figures: createFigures({
|
|
@@ -97,19 +109,14 @@ export function composeRuntime(options) {
|
|
|
97
109
|
unkept: adapter.unkeptReads ?? [],
|
|
98
110
|
leading: adapter.leadingReads ?? [],
|
|
99
111
|
recovery: recovery.scope(),
|
|
100
|
-
|
|
112
|
+
retries,
|
|
113
|
+
call: (name, input, attempt) => called(runtime, name, input, attempt),
|
|
101
114
|
online: socket.reached,
|
|
102
115
|
streaming: socket.isOpen,
|
|
103
116
|
closed: socket.closed,
|
|
104
117
|
full: store.space.full,
|
|
105
118
|
filled: () => filled(runtime),
|
|
106
119
|
}),
|
|
107
|
-
settle: (...held) => settle(runtime, ...held),
|
|
108
|
-
scoped: (...held) => scoped(runtime, ...held),
|
|
109
|
-
submitLater: (locator) => submitLater(runtime, locator),
|
|
110
|
-
unpair: (local) => unpair(runtime, local),
|
|
111
|
-
advanced: (...held) => advanced(runtime, ...held),
|
|
112
|
-
withhold: (...held) => withhold(runtime, ...held),
|
|
113
120
|
};
|
|
114
121
|
start(runtime, options.signal);
|
|
115
122
|
return composedRuntime(runtime);
|
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
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SessionState } from '@agentshouse/session-content';
|
|
2
|
+
import type { AcceptedMessage, ConversationAction, ConversationHistoryRequest, ConversationStream, ListedAgent, ListedConversation, ProcessCommand, SessionOption } from './adapter.js';
|
|
2
3
|
import { type Cell } from './cell.js';
|
|
3
4
|
import type { ChangeSet } from './change-set.js';
|
|
4
5
|
import type { Asked, ConversationAgent, ConversationEntry, ConversationView, RunningTurn } from './conversation.js';
|
|
5
|
-
import type { JobMarker } from './job.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;
|
|
@@ -30,10 +33,11 @@ export type Live = {
|
|
|
30
33
|
commands: readonly ProcessCommand[];
|
|
31
34
|
options: readonly SessionOption[];
|
|
32
35
|
starting: string | null;
|
|
33
|
-
|
|
36
|
+
state: SessionState | null;
|
|
34
37
|
link: {
|
|
35
38
|
connected: boolean;
|
|
36
39
|
} | null;
|
|
40
|
+
deliveryWaiting: readonly string[];
|
|
37
41
|
deliveryUnknown: readonly string[];
|
|
38
42
|
};
|
|
39
43
|
export declare const QUIET: Live;
|
|
@@ -42,11 +46,14 @@ export declare const FACTS: readonly Fact[];
|
|
|
42
46
|
type Watcher = {
|
|
43
47
|
readonly notify: (view: ConversationView) => void;
|
|
44
48
|
};
|
|
45
|
-
type
|
|
46
|
-
readonly window: readonly AcceptedMessage[] | null;
|
|
49
|
+
export type Kept = {
|
|
47
50
|
readonly draft: ChatDraftRecord | null;
|
|
48
51
|
readonly ended: string | null;
|
|
49
|
-
readonly
|
|
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,29 @@ export type Audience<T> = {
|
|
|
72
79
|
};
|
|
73
80
|
type HeldFacts = {
|
|
74
81
|
readonly listKnown: boolean;
|
|
82
|
+
readonly openingRead: boolean;
|
|
83
|
+
readonly openingListed: boolean;
|
|
75
84
|
readonly listOwed: boolean;
|
|
76
85
|
readonly listTelling: boolean;
|
|
77
86
|
readonly agentsShown: string | null;
|
|
78
|
-
readonly
|
|
79
|
-
readonly agentsReading: boolean;
|
|
87
|
+
readonly listedShown: string | null;
|
|
80
88
|
readonly replicated: ReadonlySet<string>;
|
|
81
89
|
readonly handedReplicated: string | undefined;
|
|
82
90
|
};
|
|
83
91
|
export type Dispatch = Cell<{
|
|
84
92
|
readonly answered: boolean;
|
|
85
93
|
}>;
|
|
94
|
+
export type Relisted = {
|
|
95
|
+
readonly conversations: ReadonlyMap<string, ListedConversation>;
|
|
96
|
+
readonly agents: ReadonlyMap<string, ListedAgent>;
|
|
97
|
+
};
|
|
86
98
|
export type LiveConversations = {
|
|
87
99
|
readonly deps: ConversationDependencies;
|
|
88
100
|
readonly held: Cell<HeldFacts>;
|
|
89
101
|
readonly closing: AbortSignal;
|
|
90
102
|
readonly listeners: Audience<readonly ConversationEntry[]>;
|
|
91
103
|
readonly agentListeners: Audience<readonly ConversationAgent[]>;
|
|
104
|
+
readonly listedListeners: Audience<readonly ListedAgent[]>;
|
|
92
105
|
views(): Iterable<SharedView>;
|
|
93
106
|
viewJoined(key: string, conversation: string, asked: Asked, notify: (view: ConversationView) => void): {
|
|
94
107
|
readonly view: SharedView;
|
|
@@ -107,7 +120,7 @@ export type LiveConversations = {
|
|
|
107
120
|
caughtUpTo(conversation: string): void;
|
|
108
121
|
gapOpened(conversation: string): void;
|
|
109
122
|
generation(conversation: string): number;
|
|
110
|
-
heardAt(conversation: string,
|
|
123
|
+
heardAt(conversation: string, change: string): void;
|
|
111
124
|
newestHeard(conversation: string): string | undefined;
|
|
112
125
|
catching(conversation: string): Promise<void> | undefined;
|
|
113
126
|
catchingUntil(conversation: string, ended: Promise<void>): void;
|
|
@@ -116,9 +129,9 @@ export type LiveConversations = {
|
|
|
116
129
|
isCreating(conversation: string): boolean;
|
|
117
130
|
relisting(): boolean;
|
|
118
131
|
relistBegun(): void;
|
|
119
|
-
relistHeard(entries: readonly ListedConversation[]): void;
|
|
132
|
+
relistHeard(entries: readonly ListedConversation[], agents: readonly ListedAgent[]): void;
|
|
120
133
|
relistDropped(conversation: string): void;
|
|
121
|
-
relistTaken():
|
|
134
|
+
relistTaken(): Relisted | null;
|
|
122
135
|
sendingBegan(operation: string): Dispatch;
|
|
123
136
|
sendingEnded(operation: string, dispatch: Dispatch): void;
|
|
124
137
|
sending(operation: string): boolean;
|
|
@@ -127,6 +140,7 @@ export type LiveConversations = {
|
|
|
127
140
|
forget(conversation: string): void;
|
|
128
141
|
current(): boolean;
|
|
129
142
|
known(): boolean;
|
|
143
|
+
listed(): boolean;
|
|
130
144
|
reopened(): void;
|
|
131
145
|
lost(): void;
|
|
132
146
|
close(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-live.d.ts","sourceRoot":"","sources":["../src/conversation-live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,
|
|
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,CAA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