@agentshouse/mdruntime 0.1.0-cedb03eaa48b6 → 0.1.0-cee9c8aa4cd86
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/AGENTS.md +86 -71
- package/README.md +9 -8
- package/dist/adapter.d.ts +44 -18
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +4 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +13 -3
- package/dist/bootstrap.d.ts +13 -6
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +90 -61
- package/dist/chain.d.ts +11 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +9 -16
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -89
- package/dist/change.d.ts +31 -1
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +10 -1
- package/dist/chat/house.d.ts +25 -0
- package/dist/chat/house.d.ts.map +1 -0
- package/dist/chat/house.js +38 -0
- package/dist/chat/input.d.ts +3 -1
- package/dist/chat/input.d.ts.map +1 -1
- package/dist/chat/input.js +11 -18
- package/dist/chat/list.d.ts +2 -1
- package/dist/chat/list.d.ts.map +1 -1
- package/dist/chat/list.js +7 -3
- package/dist/chat/markdown.d.ts +1 -0
- package/dist/chat/markdown.d.ts.map +1 -1
- package/dist/chat/markdown.js +78 -20
- package/dist/chat/message.d.ts +1 -0
- package/dist/chat/message.d.ts.map +1 -1
- package/dist/chat/message.js +73 -11
- package/dist/chat/messages.d.ts +14 -1
- package/dist/chat/messages.d.ts.map +1 -1
- package/dist/chat/messages.js +79 -24
- package/dist/chat/name.d.ts +1 -0
- package/dist/chat/name.d.ts.map +1 -1
- package/dist/chat/name.js +1 -1
- package/dist/chat/opened.d.ts +1 -0
- package/dist/chat/opened.d.ts.map +1 -1
- package/dist/chat/opened.js +2 -0
- package/dist/chat/overlay.d.ts +1 -0
- package/dist/chat/overlay.d.ts.map +1 -1
- package/dist/chat/overlay.js +11 -5
- package/dist/chat/parts.d.ts +1 -0
- package/dist/chat/parts.d.ts.map +1 -1
- package/dist/chat/parts.js +3 -2
- package/dist/chat/pieces.d.ts +62 -0
- package/dist/chat/pieces.d.ts.map +1 -0
- package/dist/chat/pieces.js +1110 -0
- package/dist/chat/provider.d.ts +8 -1
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +88 -81
- package/dist/chat/ready.d.ts +5 -2
- package/dist/chat/ready.d.ts.map +1 -1
- package/dist/chat/ready.js +7 -5
- package/dist/chat/room-file.d.ts +8 -0
- package/dist/chat/room-file.d.ts.map +1 -0
- package/dist/chat/room-file.js +72 -0
- package/dist/chat/steady.d.ts +3 -0
- package/dist/chat/steady.d.ts.map +1 -0
- package/dist/chat/steady.js +26 -0
- package/dist/chat/style.d.ts.map +1 -1
- package/dist/chat/style.js +5 -0
- package/dist/chat.d.ts +3 -2
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/client.d.ts +6 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +29 -2
- package/dist/collection.d.ts +6 -19
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +30 -317
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +718 -0
- package/dist/connection.d.ts +11 -5
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1931 -706
- package/dist/conversation.d.ts +9 -3
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +85 -61
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +2 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +3 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +18 -24
- package/dist/file.d.ts +2 -10
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -120
- package/dist/fulltext.d.ts +27 -0
- package/dist/fulltext.d.ts.map +1 -0
- package/dist/fulltext.js +368 -0
- package/dist/host.d.ts +0 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +10 -3
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/live.d.ts +22 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +123 -0
- package/dist/memory.d.ts +1 -0
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +22 -6
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +90 -0
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +12 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +84 -0
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +29 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +25 -0
- package/dist/overlay.d.ts +2 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +86 -171
- package/dist/query.d.ts +2 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +1 -0
- package/dist/reach.d.ts +5 -1
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +158 -52
- package/dist/readiness.d.ts +3 -3
- package/dist/readiness.d.ts.map +1 -1
- package/dist/reads.js +1 -1
- package/dist/recovery.d.ts +2 -2
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +8 -7
- package/dist/refresh.d.ts +10 -13
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +74 -51
- package/dist/replica.d.ts +54 -36
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +277 -184
- package/dist/room-draft.d.ts +3 -1
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +29 -22
- package/dist/rows.d.ts +29 -31
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +113 -69
- package/dist/save.d.ts +50 -14
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +502 -178
- package/dist/search.d.ts +11 -43
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +0 -213
- package/dist/shared.d.ts +8 -3
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +129 -66
- package/dist/store.d.ts +79 -93
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +318 -687
- package/dist/stored.d.ts +138 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +544 -0
- package/dist/tables.d.ts +332 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +570 -0
- package/dist/turn.d.ts +4 -2
- package/dist/turn.d.ts.map +1 -1
- package/dist/turn.js +46 -22
- package/dist/validation.d.ts +30 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +162 -0
- package/dist/windows.d.ts +2 -6
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +30 -34
- package/dist/wire.d.ts +16 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +4 -0
- package/dist/words.d.ts +19 -0
- package/dist/words.d.ts.map +1 -0
- package/dist/words.js +150 -0
- package/package.json +10 -4
- package/dist/read-side.d.ts +0 -27
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -824
package/dist/conversation.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
|
|
2
2
|
import { type ChangeSet } from './change-set.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ChosenFile } from './file.js';
|
|
4
4
|
import type { Open } from './open.js';
|
|
5
5
|
import { type CallResult, type Offline } from './outcome.js';
|
|
6
6
|
import type { DocumentResult, PendingResult } from './query.js';
|
|
@@ -17,6 +17,7 @@ export type ConversationEntry = {
|
|
|
17
17
|
created: string;
|
|
18
18
|
finished: string | null;
|
|
19
19
|
outcome: string | null;
|
|
20
|
+
waiting: boolean;
|
|
20
21
|
state: ConversationState;
|
|
21
22
|
started: string | null;
|
|
22
23
|
};
|
|
@@ -32,7 +33,6 @@ export type RunningTurn = {
|
|
|
32
33
|
};
|
|
33
34
|
export type ChatDraft = {
|
|
34
35
|
text: string;
|
|
35
|
-
files: readonly ChatDraftFile[];
|
|
36
36
|
};
|
|
37
37
|
export type ConversationOptions = {
|
|
38
38
|
limit?: number;
|
|
@@ -51,6 +51,11 @@ export type ConversationView = {
|
|
|
51
51
|
} | null;
|
|
52
52
|
commands: readonly ProcessCommand[];
|
|
53
53
|
options: readonly SessionOption[];
|
|
54
|
+
starting: string | null;
|
|
55
|
+
link: {
|
|
56
|
+
connected: boolean;
|
|
57
|
+
} | null;
|
|
58
|
+
deliveryUnknown: readonly string[];
|
|
54
59
|
chatDraft: (ChatDraft & {
|
|
55
60
|
readonly revision: string;
|
|
56
61
|
}) | null;
|
|
@@ -60,6 +65,7 @@ export type ConversationSurface = {
|
|
|
60
65
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
61
66
|
create(input: unknown): Promise<CallResult>;
|
|
62
67
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
68
|
+
attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
|
|
63
69
|
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
64
70
|
interrupt(conversation: string): Promise<CallResult>;
|
|
65
71
|
kill(conversation: string): Promise<CallResult>;
|
|
@@ -73,7 +79,7 @@ export type ChatDraftSurface = {
|
|
|
73
79
|
};
|
|
74
80
|
export type ConversationDependencies = {
|
|
75
81
|
agents(): ConversationAgents | undefined;
|
|
76
|
-
documents(agents: ConversationAgents): Promise<DocumentResult | PendingResult>;
|
|
82
|
+
documents(agents: ConversationAgents, after: string | undefined): Promise<DocumentResult | PendingResult>;
|
|
77
83
|
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
78
84
|
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
79
85
|
stream(): ConversationStream | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAEjB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACd,aAAa,EACb,WAAW,EAEZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAyB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAEjB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACd,aAAa,EACb,WAAW,EAEZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAW,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAkB,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGlG,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAC;A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,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AA6PD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,GAAG,iBAAiB,CAk3BzF"}
|
package/dist/conversation.js
CHANGED
|
@@ -10,8 +10,19 @@ const QUIET = {
|
|
|
10
10
|
process: null,
|
|
11
11
|
commands: [],
|
|
12
12
|
options: [],
|
|
13
|
+
starting: null,
|
|
14
|
+
link: null,
|
|
15
|
+
deliveryUnknown: [],
|
|
13
16
|
};
|
|
14
|
-
const FACTS = [
|
|
17
|
+
const FACTS = [
|
|
18
|
+
'questions',
|
|
19
|
+
'process',
|
|
20
|
+
'commands',
|
|
21
|
+
'options',
|
|
22
|
+
'starting',
|
|
23
|
+
'link',
|
|
24
|
+
'deliveryUnknown',
|
|
25
|
+
];
|
|
15
26
|
export function unheldView(conversation) {
|
|
16
27
|
return {
|
|
17
28
|
conversation,
|
|
@@ -21,6 +32,9 @@ export function unheldView(conversation) {
|
|
|
21
32
|
process: null,
|
|
22
33
|
commands: [],
|
|
23
34
|
options: [],
|
|
35
|
+
starting: null,
|
|
36
|
+
link: null,
|
|
37
|
+
deliveryUnknown: [],
|
|
24
38
|
chatDraft: null,
|
|
25
39
|
};
|
|
26
40
|
}
|
|
@@ -32,8 +46,10 @@ export function newChat(agent) {
|
|
|
32
46
|
function creationOf(input) {
|
|
33
47
|
if (typeof input !== 'object' || input === null)
|
|
34
48
|
return null;
|
|
35
|
-
const { agent_id: agent, operation_id: operation } = input;
|
|
36
|
-
return typeof agent === 'string' && typeof operation === 'string'
|
|
49
|
+
const { agent_id: agent, operation_id: operation, replaces, } = input;
|
|
50
|
+
return typeof agent === 'string' && typeof operation === 'string' && replaces === undefined
|
|
51
|
+
? { agent, operation }
|
|
52
|
+
: null;
|
|
37
53
|
}
|
|
38
54
|
function startedTurn(turn, operation) {
|
|
39
55
|
if (operation.op === 'begin')
|
|
@@ -194,7 +210,7 @@ function askedOf(options) {
|
|
|
194
210
|
}
|
|
195
211
|
const EXPIRED = { kind: 'rejected', code: 'expired', fields: {}, retryable: false };
|
|
196
212
|
function unwritten(draft) {
|
|
197
|
-
return draft.text === ''
|
|
213
|
+
return draft.text === '';
|
|
198
214
|
}
|
|
199
215
|
function pending(draft) {
|
|
200
216
|
return {
|
|
@@ -210,10 +226,7 @@ function withSubmitted(draft, submitted) {
|
|
|
210
226
|
return submitted.length === 0 ? unsent : { ...unsent, submitted };
|
|
211
227
|
}
|
|
212
228
|
function prepended(draft, said) {
|
|
213
|
-
return {
|
|
214
|
-
text: [said.text, draft.text].filter((one) => one !== '').join('\n'),
|
|
215
|
-
files: [...said.files, ...draft.files],
|
|
216
|
-
};
|
|
229
|
+
return { text: [said.text, draft.text].filter((one) => one !== '').join('\n') };
|
|
217
230
|
}
|
|
218
231
|
function returned(draft, submission, others) {
|
|
219
232
|
return withSubmitted({
|
|
@@ -264,9 +277,12 @@ export function createConversationStore(deps) {
|
|
|
264
277
|
process: facts.process === null ? null : { ...facts.process },
|
|
265
278
|
commands: structuredClone(facts.commands),
|
|
266
279
|
options: structuredClone(facts.options),
|
|
280
|
+
starting: facts.starting,
|
|
281
|
+
link: facts.link === null ? null : { ...facts.link },
|
|
282
|
+
deliveryUnknown: [...facts.deliveryUnknown],
|
|
267
283
|
chatDraft: draft === undefined || unwritten(draft)
|
|
268
284
|
? null
|
|
269
|
-
: { text: draft.text,
|
|
285
|
+
: { text: draft.text, revision: draft.revision },
|
|
270
286
|
};
|
|
271
287
|
}
|
|
272
288
|
function emit(conversation) {
|
|
@@ -308,9 +324,6 @@ export function createConversationStore(deps) {
|
|
|
308
324
|
}
|
|
309
325
|
}
|
|
310
326
|
}
|
|
311
|
-
function changesOf(conversation, arriving) {
|
|
312
|
-
return arriving.map(({ identity, text }) => ({ conversation, identity, text }));
|
|
313
|
-
}
|
|
314
327
|
function stateOf(conversation) {
|
|
315
328
|
const facts = liveOf(conversation);
|
|
316
329
|
if (facts.questions.length > 0)
|
|
@@ -325,6 +338,7 @@ export function createConversationStore(deps) {
|
|
|
325
338
|
created: entry.created,
|
|
326
339
|
finished: entry.finished,
|
|
327
340
|
outcome: entry.outcome,
|
|
341
|
+
waiting: entry.waiting,
|
|
328
342
|
state: stateOf(entry.conversation),
|
|
329
343
|
started: lives.get(entry.conversation)?.turn?.started ?? null,
|
|
330
344
|
}));
|
|
@@ -367,23 +381,30 @@ export function createConversationStore(deps) {
|
|
|
367
381
|
const declaration = deps.agents();
|
|
368
382
|
if (declaration === undefined)
|
|
369
383
|
return;
|
|
370
|
-
const held = await deps.documents(declaration);
|
|
371
|
-
if ('pending' in held)
|
|
372
|
-
return;
|
|
373
|
-
const { documents } = held;
|
|
374
384
|
const names = new Map();
|
|
375
385
|
const retired = new Set();
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
386
|
+
let covered = null;
|
|
387
|
+
for (let after;;) {
|
|
388
|
+
const read = await deps.documents(declaration, after);
|
|
389
|
+
if ('pending' in read)
|
|
390
|
+
return;
|
|
391
|
+
const coverage = JSON.stringify(read.coverage);
|
|
392
|
+
if (covered !== null && coverage !== covered)
|
|
393
|
+
return readAgents();
|
|
394
|
+
covered = coverage;
|
|
395
|
+
for (const document of read.documents) {
|
|
396
|
+
const identity = document.fields?.[declaration.identity];
|
|
397
|
+
const name = document.fields?.[declaration.name];
|
|
398
|
+
if (typeof identity !== 'string' || typeof name !== 'string')
|
|
399
|
+
continue;
|
|
400
|
+
names.set(identity, name);
|
|
401
|
+
const ended = declaration.retired === undefined ? null : document.fields?.[declaration.retired];
|
|
402
|
+
if (ended !== undefined && ended !== null)
|
|
403
|
+
retired.add(identity);
|
|
404
|
+
}
|
|
405
|
+
if (read.next === undefined)
|
|
406
|
+
break;
|
|
407
|
+
after = read.next;
|
|
387
408
|
}
|
|
388
409
|
const named = JSON.stringify([...names]) !== JSON.stringify([...agentNames]);
|
|
389
410
|
if (!named && JSON.stringify([...retired]) === JSON.stringify([...retiredAgents]))
|
|
@@ -426,6 +447,11 @@ export function createConversationStore(deps) {
|
|
|
426
447
|
process: facts.has('process') ? QUIET.process : held.process,
|
|
427
448
|
commands: facts.has('commands') ? QUIET.commands : held.commands,
|
|
428
449
|
options: facts.has('options') ? QUIET.options : held.options,
|
|
450
|
+
starting: facts.has('starting') ? QUIET.starting : held.starting,
|
|
451
|
+
link: facts.has('link') ? QUIET.link : held.link,
|
|
452
|
+
deliveryUnknown: facts.has('deliveryUnknown')
|
|
453
|
+
? QUIET.deliveryUnknown
|
|
454
|
+
: held.deliveryUnknown,
|
|
429
455
|
});
|
|
430
456
|
emit(conversation);
|
|
431
457
|
}
|
|
@@ -456,12 +482,6 @@ export function createConversationStore(deps) {
|
|
|
456
482
|
}
|
|
457
483
|
async function remove(leaving) {
|
|
458
484
|
await deps.durably(async (local) => {
|
|
459
|
-
const removed = [];
|
|
460
|
-
for (const conversation of leaving) {
|
|
461
|
-
for (const identity of await local.messageIdentities(conversation)) {
|
|
462
|
-
removed.push({ conversation, identity, text: null });
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
485
|
await local.dropConversations(leaving);
|
|
466
486
|
const changed = [];
|
|
467
487
|
for (const conversation of leaving) {
|
|
@@ -478,7 +498,7 @@ export function createConversationStore(deps) {
|
|
|
478
498
|
await slide(local, conversation, null);
|
|
479
499
|
}
|
|
480
500
|
if (changed.length > 0)
|
|
481
|
-
deps.publish(conversationChangeSet(
|
|
501
|
+
deps.publish(conversationChangeSet(changed));
|
|
482
502
|
});
|
|
483
503
|
}
|
|
484
504
|
function gap(conversation) {
|
|
@@ -504,7 +524,7 @@ export function createConversationStore(deps) {
|
|
|
504
524
|
reads.set(conversation, message.position);
|
|
505
525
|
sealTurns(conversation, new Set([message.turn]));
|
|
506
526
|
await slide(local, conversation, [message]);
|
|
507
|
-
deps.publish(conversationChangeSet(
|
|
527
|
+
deps.publish(conversationChangeSet([conversation]));
|
|
508
528
|
});
|
|
509
529
|
}
|
|
510
530
|
async function readHistories(conversations, ended) {
|
|
@@ -580,7 +600,7 @@ export function createConversationStore(deps) {
|
|
|
580
600
|
behind.delete(conversation);
|
|
581
601
|
await slide(local, conversation, arriving);
|
|
582
602
|
if (arriving.length > 0 || sealing || whole) {
|
|
583
|
-
deps.publish(conversationChangeSet(
|
|
603
|
+
deps.publish(conversationChangeSet([conversation]));
|
|
584
604
|
}
|
|
585
605
|
});
|
|
586
606
|
}
|
|
@@ -613,6 +633,18 @@ export function createConversationStore(deps) {
|
|
|
613
633
|
live(conversation, { options: structuredClone(event.options) });
|
|
614
634
|
return;
|
|
615
635
|
}
|
|
636
|
+
if (event.kind === 'starting') {
|
|
637
|
+
live(conversation, { starting: event.step });
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
if (event.kind === 'link') {
|
|
641
|
+
live(conversation, { link: { connected: event.connected } });
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
if (event.kind === 'deliveries') {
|
|
645
|
+
live(conversation, { deliveryUnknown: [...event.unknown] });
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
616
648
|
const arriving = acceptedMessage(event.message);
|
|
617
649
|
if (arriving === null)
|
|
618
650
|
return;
|
|
@@ -652,7 +684,6 @@ export function createConversationStore(deps) {
|
|
|
652
684
|
const blank = {
|
|
653
685
|
conversation: from,
|
|
654
686
|
text: '',
|
|
655
|
-
files: [],
|
|
656
687
|
revision: chatDraftRevision(),
|
|
657
688
|
};
|
|
658
689
|
const { moves: _answered, ...unsent } = held ?? blank;
|
|
@@ -662,7 +693,7 @@ export function createConversationStore(deps) {
|
|
|
662
693
|
drafts.set(from, left);
|
|
663
694
|
for (const one of taken)
|
|
664
695
|
drafts.set(to, one);
|
|
665
|
-
deps.publish(conversationChangeSet([
|
|
696
|
+
deps.publish(conversationChangeSet([from, to]));
|
|
666
697
|
});
|
|
667
698
|
}
|
|
668
699
|
function withDraft(conversation, next) {
|
|
@@ -671,7 +702,7 @@ export function createConversationStore(deps) {
|
|
|
671
702
|
if (following === undefined)
|
|
672
703
|
return;
|
|
673
704
|
await kept(local, conversation, following);
|
|
674
|
-
deps.publish(conversationChangeSet([
|
|
705
|
+
deps.publish(conversationChangeSet([conversation]));
|
|
675
706
|
});
|
|
676
707
|
}
|
|
677
708
|
async function submitted(conversation, operation, draft) {
|
|
@@ -683,17 +714,12 @@ export function createConversationStore(deps) {
|
|
|
683
714
|
if (submission !== undefined)
|
|
684
715
|
return undefined;
|
|
685
716
|
const said = draft ?? current;
|
|
686
|
-
submission = {
|
|
687
|
-
operation,
|
|
688
|
-
text: said?.text ?? '',
|
|
689
|
-
files: [...(said?.files ?? [])],
|
|
690
|
-
turn: null,
|
|
691
|
-
};
|
|
717
|
+
submission = { operation, text: said?.text ?? '', turn: null };
|
|
692
718
|
return {
|
|
693
719
|
conversation,
|
|
694
720
|
...(draft === undefined || current === undefined
|
|
695
|
-
? { text: '',
|
|
696
|
-
: { text: current.text,
|
|
721
|
+
? { text: '', revision: chatDraftRevision() }
|
|
722
|
+
: { text: current.text, revision: current.revision }),
|
|
697
723
|
submitted: [...(current?.submitted ?? []), submission],
|
|
698
724
|
};
|
|
699
725
|
});
|
|
@@ -711,10 +737,8 @@ export function createConversationStore(deps) {
|
|
|
711
737
|
const dispatch = {};
|
|
712
738
|
sending.set(submission.operation, dispatch);
|
|
713
739
|
try {
|
|
714
|
-
const files = await Promise.all(submission.files.map(async (file) => ({ ...(await declaredFile(file)), blob: file.blob })));
|
|
715
740
|
const result = await invoke('conversation.send', conversation, {
|
|
716
741
|
text: submission.text,
|
|
717
|
-
files,
|
|
718
742
|
operation_id: submission.operation,
|
|
719
743
|
});
|
|
720
744
|
if (result.kind === 'revoked-authorization')
|
|
@@ -782,10 +806,19 @@ export function createConversationStore(deps) {
|
|
|
782
806
|
if (draft !== undefined) {
|
|
783
807
|
await withDraft(conversation, (current) => current?.submitted?.some((one) => one.operation === operation) === true
|
|
784
808
|
? undefined
|
|
785
|
-
: returned(current ?? { conversation, text: '',
|
|
809
|
+
: returned(current ?? { conversation, text: '', revision: '' }, { operation, ...draft, turn: null }, current?.submitted ?? []));
|
|
786
810
|
}
|
|
787
811
|
return OFFLINE;
|
|
788
812
|
},
|
|
813
|
+
async attach(room, file) {
|
|
814
|
+
if (!deps.online())
|
|
815
|
+
return OFFLINE;
|
|
816
|
+
return deps.call('conversation.attach', {
|
|
817
|
+
room,
|
|
818
|
+
...(await declaredFile(file)),
|
|
819
|
+
blob: file.blob,
|
|
820
|
+
});
|
|
821
|
+
},
|
|
789
822
|
answer(conversation, answer) {
|
|
790
823
|
return invoke('conversation.answer', conversation, { answer });
|
|
791
824
|
},
|
|
@@ -816,7 +849,6 @@ export function createConversationStore(deps) {
|
|
|
816
849
|
return withDraft(conversation, (current) => ({
|
|
817
850
|
conversation,
|
|
818
851
|
text: draft.text,
|
|
819
|
-
files: [...draft.files],
|
|
820
852
|
revision,
|
|
821
853
|
...(current === undefined ? {} : pending(current)),
|
|
822
854
|
}));
|
|
@@ -824,9 +856,7 @@ export function createConversationStore(deps) {
|
|
|
824
856
|
prepend(conversation, draft) {
|
|
825
857
|
return withDraft(conversation, (current) => ({
|
|
826
858
|
conversation,
|
|
827
|
-
...(current === undefined
|
|
828
|
-
? { text: draft.text, files: [...draft.files] }
|
|
829
|
-
: prepended(current, draft)),
|
|
859
|
+
...(current === undefined ? { text: draft.text } : prepended(current, draft)),
|
|
830
860
|
revision: chatDraftRevision(),
|
|
831
861
|
...(current === undefined ? {} : pending(current)),
|
|
832
862
|
}));
|
|
@@ -834,13 +864,7 @@ export function createConversationStore(deps) {
|
|
|
834
864
|
discard(conversation) {
|
|
835
865
|
return withDraft(conversation, (current) => current === undefined
|
|
836
866
|
? undefined
|
|
837
|
-
: {
|
|
838
|
-
conversation,
|
|
839
|
-
text: '',
|
|
840
|
-
files: [],
|
|
841
|
-
revision: chatDraftRevision(),
|
|
842
|
-
...pending(current),
|
|
843
|
-
});
|
|
867
|
+
: { conversation, text: '', revision: chatDraftRevision(), ...pending(current) });
|
|
844
868
|
},
|
|
845
869
|
};
|
|
846
870
|
return {
|
package/dist/digest.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../src/digest.ts"],"names":[],"mappings":"AA0EA,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IAChC,GAAG,IAAI,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,MAAM,IAAI,MAAM,CAoC/B;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAMxD"}
|
package/dist/digest.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { FILE_PART_BYTES } from './tables.js';
|
|
2
|
+
const ROUNDS = new Uint32Array([
|
|
3
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
4
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
5
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
6
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
7
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
8
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
9
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
10
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
11
|
+
]);
|
|
12
|
+
const INITIAL = [
|
|
13
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
14
|
+
];
|
|
15
|
+
const BLOCK = 64;
|
|
16
|
+
function rotated(value, by) {
|
|
17
|
+
return (value >>> by) | (value << (32 - by));
|
|
18
|
+
}
|
|
19
|
+
function compressed(state, words, bytes, at) {
|
|
20
|
+
for (let index = 0; index < 16; index += 1) {
|
|
21
|
+
const from = at + index * 4;
|
|
22
|
+
words[index] =
|
|
23
|
+
(bytes[from] << 24) | (bytes[from + 1] << 16) | (bytes[from + 2] << 8) | bytes[from + 3];
|
|
24
|
+
}
|
|
25
|
+
for (let index = 16; index < 64; index += 1) {
|
|
26
|
+
const early = words[index - 15];
|
|
27
|
+
const late = words[index - 2];
|
|
28
|
+
const lower = rotated(early, 7) ^ rotated(early, 18) ^ (early >>> 3);
|
|
29
|
+
const upper = rotated(late, 17) ^ rotated(late, 19) ^ (late >>> 10);
|
|
30
|
+
words[index] = (words[index - 16] + lower + words[index - 7] + upper) | 0;
|
|
31
|
+
}
|
|
32
|
+
let a = state[0];
|
|
33
|
+
let b = state[1];
|
|
34
|
+
let c = state[2];
|
|
35
|
+
let d = state[3];
|
|
36
|
+
let e = state[4];
|
|
37
|
+
let f = state[5];
|
|
38
|
+
let g = state[6];
|
|
39
|
+
let h = state[7];
|
|
40
|
+
for (let index = 0; index < 64; index += 1) {
|
|
41
|
+
const chosen = (e & f) ^ (~e & g);
|
|
42
|
+
const first = (h +
|
|
43
|
+
(rotated(e, 6) ^ rotated(e, 11) ^ rotated(e, 25)) +
|
|
44
|
+
chosen +
|
|
45
|
+
ROUNDS[index] +
|
|
46
|
+
words[index]) |
|
|
47
|
+
0;
|
|
48
|
+
const second = ((rotated(a, 2) ^ rotated(a, 13) ^ rotated(a, 22)) + ((a & b) ^ (a & c) ^ (b & c))) | 0;
|
|
49
|
+
h = g;
|
|
50
|
+
g = f;
|
|
51
|
+
f = e;
|
|
52
|
+
e = (d + first) | 0;
|
|
53
|
+
d = c;
|
|
54
|
+
c = b;
|
|
55
|
+
b = a;
|
|
56
|
+
a = (first + second) | 0;
|
|
57
|
+
}
|
|
58
|
+
state[0] += a;
|
|
59
|
+
state[1] += b;
|
|
60
|
+
state[2] += c;
|
|
61
|
+
state[3] += d;
|
|
62
|
+
state[4] += e;
|
|
63
|
+
state[5] += f;
|
|
64
|
+
state[6] += g;
|
|
65
|
+
state[7] += h;
|
|
66
|
+
}
|
|
67
|
+
export function digest() {
|
|
68
|
+
const state = new Uint32Array(INITIAL);
|
|
69
|
+
const words = new Uint32Array(64);
|
|
70
|
+
const pending = new Uint8Array(BLOCK);
|
|
71
|
+
let held = 0;
|
|
72
|
+
let size = 0;
|
|
73
|
+
return {
|
|
74
|
+
update(bytes) {
|
|
75
|
+
size += bytes.length;
|
|
76
|
+
let from = 0;
|
|
77
|
+
if (held > 0) {
|
|
78
|
+
const taken = Math.min(BLOCK - held, bytes.length);
|
|
79
|
+
pending.set(bytes.subarray(0, taken), held);
|
|
80
|
+
held += taken;
|
|
81
|
+
from = taken;
|
|
82
|
+
if (held < BLOCK)
|
|
83
|
+
return;
|
|
84
|
+
compressed(state, words, pending, 0);
|
|
85
|
+
held = 0;
|
|
86
|
+
}
|
|
87
|
+
for (; from + BLOCK <= bytes.length; from += BLOCK)
|
|
88
|
+
compressed(state, words, bytes, from);
|
|
89
|
+
pending.set(bytes.subarray(from), 0);
|
|
90
|
+
held = bytes.length - from;
|
|
91
|
+
},
|
|
92
|
+
hex() {
|
|
93
|
+
const bits = size * 8;
|
|
94
|
+
const tail = new Uint8Array(held < 56 ? BLOCK : BLOCK * 2);
|
|
95
|
+
tail.set(pending.subarray(0, held));
|
|
96
|
+
tail[held] = 0x80;
|
|
97
|
+
const length = new DataView(tail.buffer, tail.length - 8);
|
|
98
|
+
length.setUint32(0, Math.floor(bits / 0x1_0000_0000));
|
|
99
|
+
length.setUint32(4, bits >>> 0);
|
|
100
|
+
const final = new Uint32Array(state);
|
|
101
|
+
for (let from = 0; from < tail.length; from += BLOCK)
|
|
102
|
+
compressed(final, words, tail, from);
|
|
103
|
+
return [...final].map((word) => word.toString(16).padStart(8, '0')).join('');
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export async function sha256(blob) {
|
|
108
|
+
const hashed = digest();
|
|
109
|
+
for (let at = 0; at < blob.size; at += FILE_PART_BYTES) {
|
|
110
|
+
hashed.update(new Uint8Array(await blob.slice(at, at + FILE_PART_BYTES).arrayBuffer()));
|
|
111
|
+
}
|
|
112
|
+
return hashed.hex();
|
|
113
|
+
}
|
package/dist/durability.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
2
|
export type StorageEstimate = {
|
|
3
3
|
readonly usage: number;
|
|
4
|
-
readonly
|
|
4
|
+
readonly total: number;
|
|
5
5
|
};
|
|
6
6
|
export type RuntimeShell = {
|
|
7
7
|
persistence: Persistence;
|
|
@@ -9,6 +9,7 @@ export type RuntimeShell = {
|
|
|
9
9
|
keepGeneration(value: string): void | Promise<void>;
|
|
10
10
|
dropGeneration(): void | Promise<void>;
|
|
11
11
|
estimate?(): Promise<StorageEstimate | null>;
|
|
12
|
+
cleanUp?(): Promise<number>;
|
|
12
13
|
};
|
|
13
14
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
14
15
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
package/dist/durability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durability.d.ts","sourceR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,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG/F;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGrF"}
|
package/dist/entry.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { VerifiedModel } from '@agentshouse/mdmodel';
|
|
1
2
|
import { type QueryRows } from './query.js';
|
|
3
|
+
import type { Connection } from './tables.js';
|
|
2
4
|
export { QueryError } from './query.js';
|
|
3
5
|
export type EntryRoom = {
|
|
4
6
|
locator: string;
|
|
@@ -13,5 +15,5 @@ export declare function entryRefusal(template: unknown): string | null;
|
|
|
13
15
|
export type EntryScope = {
|
|
14
16
|
results(queries: Readonly<Record<string, unknown>>): Promise<Record<string, QueryRows>>;
|
|
15
17
|
};
|
|
16
|
-
export declare function entryScope(rooms: readonly EntryRoom[]): EntryScope;
|
|
18
|
+
export declare function entryScope(rooms: readonly EntryRoom[], roomTypes: VerifiedModel, connection: Connection): EntryScope;
|
|
17
19
|
//# sourceMappingURL=entry.d.ts.map
|
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D,OAAO,EAML,KAAK,SAAS,EAEf,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AA0D7E,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAE3E;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAMpE;AAkCD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ7D;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACzF,CAAC;AAEF,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,UAAU,GACrB,UAAU,CAmDZ"}
|
package/dist/entry.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { attachedModel } from './attached-model.js';
|
|
2
|
-
import {
|
|
2
|
+
import { answerQuery } from './compile.js';
|
|
3
3
|
import { NO_MODEL } from './model.js';
|
|
4
4
|
import { invalid, planOf, plain, QueryError, } from './query.js';
|
|
5
|
-
import {
|
|
6
|
-
import { rowsOf } from './rows.js';
|
|
5
|
+
import { entered, REPLICA_TABLES } from './stored.js';
|
|
7
6
|
export { QueryError } from './query.js';
|
|
8
7
|
const PARAMETER = '$param';
|
|
9
8
|
const KIND = 'as';
|
|
@@ -110,46 +109,41 @@ export function entryRefusal(template) {
|
|
|
110
109
|
throw error;
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
|
-
export function entryScope(rooms) {
|
|
114
|
-
const
|
|
112
|
+
export function entryScope(rooms, roomTypes, connection) {
|
|
113
|
+
for (const table of REPLICA_TABLES)
|
|
114
|
+
connection.run(table);
|
|
115
115
|
const held = [];
|
|
116
|
-
const
|
|
116
|
+
const keys = rooms.map((room) => {
|
|
117
117
|
const model = attachedModel({
|
|
118
118
|
kind: 'model',
|
|
119
119
|
snapshot: { identity: room.locator, version: '', schema: room.schema, revision: null },
|
|
120
|
-
}, NO_MODEL).state;
|
|
120
|
+
}, NO_MODEL, roomTypes).state;
|
|
121
121
|
held.push({
|
|
122
122
|
locator: room.locator,
|
|
123
123
|
available: model.status !== 'unavailable',
|
|
124
124
|
types: model.status === 'unavailable' ? [] : Object.values(model.types),
|
|
125
125
|
});
|
|
126
126
|
const composition = { model, selection: null };
|
|
127
|
-
const
|
|
128
|
-
return Object.keys(room.documents)
|
|
127
|
+
const key = entered(connection, room.locator, composition, Object.keys(room.documents)
|
|
129
128
|
.sort()
|
|
130
129
|
.map((path) => ({
|
|
131
|
-
locator: room.locator,
|
|
132
130
|
path,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
queues: [],
|
|
142
|
-
presentations: [],
|
|
143
|
-
messages: [],
|
|
144
|
-
conversations: [],
|
|
131
|
+
content: room.documents[path],
|
|
132
|
+
binary: null,
|
|
133
|
+
revision: null,
|
|
134
|
+
fileId: null,
|
|
135
|
+
change: null,
|
|
136
|
+
written: null,
|
|
137
|
+
})));
|
|
138
|
+
return { locator: room.locator, key };
|
|
145
139
|
});
|
|
146
140
|
const planned = { listed: true, rooms: held };
|
|
147
141
|
return {
|
|
148
142
|
async results(queries) {
|
|
149
|
-
await seeded;
|
|
150
143
|
const results = {};
|
|
151
144
|
for (const [name, query] of Object.entries(queries)) {
|
|
152
|
-
|
|
145
|
+
const plan = planOf(query, planned);
|
|
146
|
+
results[name] = answerQuery(connection, plan, keys.filter(({ locator }) => plan.rooms === null || plan.rooms.includes(locator)));
|
|
153
147
|
}
|
|
154
148
|
return results;
|
|
155
149
|
},
|
package/dist/file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ChosenFile = {
|
|
2
2
|
name: string;
|
|
3
3
|
blob: Blob;
|
|
4
4
|
};
|
|
@@ -7,14 +7,6 @@ export type FileDeclaration = {
|
|
|
7
7
|
mediaType: string;
|
|
8
8
|
byteLength: number;
|
|
9
9
|
contentHash: string;
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
10
|
};
|
|
13
|
-
export
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
};
|
|
17
|
-
export declare function extentOf(bytes: Uint8Array): Extent | null;
|
|
18
|
-
export declare function hexDigest(digest: ArrayBuffer): string;
|
|
19
|
-
export declare function declaredFile(file: ChatDraftFile): Promise<FileDeclaration>;
|
|
11
|
+
export declare function declaredFile(file: ChosenFile): Promise<FileDeclaration>;
|
|
20
12
|
//# sourceMappingURL=file.d.ts.map
|