@agentshouse/mdruntime 0.1.0-c6e4c19c13638 → 0.1.0-c7a479c99b4a4
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 +26 -7
- package/README.md +9 -9
- package/dist/adapter.d.ts +7 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +15 -2
- package/dist/bootstrap.d.ts +17 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +88 -35
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +13 -7
- package/dist/change.d.ts +4 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +35 -0
- package/dist/collection.d.ts +6 -11
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +56 -19
- package/dist/connection.d.ts +4 -2
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +175 -55
- package/dist/host.d.ts +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1 -0
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +7 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/memory.d.ts +2 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +15 -6
- package/dist/model.d.ts +7 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -0
- package/dist/outcome.d.ts +2 -0
- package/dist/outcome.d.ts.map +1 -1
- package/dist/overlay.d.ts +1 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +19 -15
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +2 -31
- package/dist/react.d.ts +22 -14
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -6
- package/dist/refresh.d.ts +10 -0
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +33 -24
- package/dist/replica.d.ts +5 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +44 -29
- package/dist/room-draft.d.ts +0 -1
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +2 -18
- package/dist/rows.d.ts +2 -0
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +7 -1
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +25 -16
- package/dist/store.d.ts +24 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +206 -90
- package/dist/wire.d.ts +1 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +1 -0
- package/package.json +2 -2
package/dist/connection.js
CHANGED
|
@@ -3,15 +3,16 @@ import { cached, modelTypes, NO_MODEL, sameModel, } from './model.js';
|
|
|
3
3
|
import { observing } from './observation.js';
|
|
4
4
|
import { filterOf, identityOf, planOf, } from './query.js';
|
|
5
5
|
import { createReadSide } from './read-side.js';
|
|
6
|
+
import { markdownPath, roomOfKey } from './rows.js';
|
|
6
7
|
import { createSearchIndex, searchPlanOf, } from './search.js';
|
|
7
8
|
import { bootstrapRoom } from './bootstrap.js';
|
|
8
9
|
import { changeSet, mergeChangeSets } from './change-set.js';
|
|
9
10
|
import { createConversationStore, } from './conversation.js';
|
|
10
|
-
import {
|
|
11
|
+
import { validRoot } from './collection.js';
|
|
11
12
|
import { createLog } from './log.js';
|
|
12
13
|
import { refreshRoom } from './refresh.js';
|
|
13
14
|
import { buildBatch } from './save.js';
|
|
14
|
-
import { applyReturned, compositionOf,
|
|
15
|
+
import { applyReturned, compositionOf, confirmedOf, landed, readReclassified, replicaOf, sameMembership, withdrawals, } from './replica.js';
|
|
15
16
|
import { changedParts, changesOf, held, readParts, returnedInto, underneath, } from './room-draft.js';
|
|
16
17
|
import { settled, same, saving, STARTING, transferring, } from './status.js';
|
|
17
18
|
import { detectStorageLoss, nextGeneration } from './durability.js';
|
|
@@ -34,6 +35,7 @@ function declaredSelection(room) {
|
|
|
34
35
|
selection.roots.every((other, at) => at === index || !within(other, root)));
|
|
35
36
|
}
|
|
36
37
|
export function composeRuntime(options) {
|
|
38
|
+
const localSaves = options.adapter.localSaves === true;
|
|
37
39
|
let authorization = options.authorization;
|
|
38
40
|
let opening;
|
|
39
41
|
let store;
|
|
@@ -44,6 +46,7 @@ export function composeRuntime(options) {
|
|
|
44
46
|
let limits = [];
|
|
45
47
|
let capabilities = [];
|
|
46
48
|
const rooms = new Map();
|
|
49
|
+
const counted = new Map();
|
|
47
50
|
const unreadable = new Set();
|
|
48
51
|
const models = new Map();
|
|
49
52
|
const liveModels = new Map();
|
|
@@ -82,6 +85,7 @@ export function composeRuntime(options) {
|
|
|
82
85
|
let withdrawStream;
|
|
83
86
|
const announced = new Map();
|
|
84
87
|
let underway = null;
|
|
88
|
+
let handed = false;
|
|
85
89
|
const submitting = new Map();
|
|
86
90
|
const answering = new Map();
|
|
87
91
|
let complete = false;
|
|
@@ -104,9 +108,14 @@ export function composeRuntime(options) {
|
|
|
104
108
|
let haltedRefusal = false;
|
|
105
109
|
let openSignals = 0;
|
|
106
110
|
const serviceModeListeners = new Set();
|
|
111
|
+
let member = null;
|
|
112
|
+
const memberListeners = new Set();
|
|
113
|
+
const materialized = new Set();
|
|
114
|
+
let everyRoom = false;
|
|
115
|
+
const transfers = new Map();
|
|
107
116
|
const conversations = createConversationStore({
|
|
108
117
|
agents: declaredAgents,
|
|
109
|
-
documents: (locator) =>
|
|
118
|
+
documents: (locator) => rowsQuery(planOf({ rooms: [locator], select: 'all' }, roomFacts())),
|
|
110
119
|
call: (name, input) => invokeAction(name, input),
|
|
111
120
|
durably,
|
|
112
121
|
stream: () => options.adapter.conversations,
|
|
@@ -182,7 +191,7 @@ export function composeRuntime(options) {
|
|
|
182
191
|
}
|
|
183
192
|
}
|
|
184
193
|
function pending() {
|
|
185
|
-
return [...replicas.values()].some((replica) => replica.queue.length > 0);
|
|
194
|
+
return !localSaves && [...replicas.values()].some((replica) => replica.queue.length > 0);
|
|
186
195
|
}
|
|
187
196
|
function attention() {
|
|
188
197
|
const attentionRequired = [];
|
|
@@ -211,8 +220,24 @@ export function composeRuntime(options) {
|
|
|
211
220
|
}
|
|
212
221
|
return { attentionRequired, reset };
|
|
213
222
|
}
|
|
223
|
+
function documentsIn(locator) {
|
|
224
|
+
const replica = replicas.get(locator);
|
|
225
|
+
if (replica === undefined)
|
|
226
|
+
return 0;
|
|
227
|
+
const roots = replica.confirmed.record.typedSelection?.roots ?? [];
|
|
228
|
+
let count = 0;
|
|
229
|
+
for (const path of Object.keys(replica.visible.documents)) {
|
|
230
|
+
if (markdownPath(path) && !roots.some((root) => beneath(root, path)))
|
|
231
|
+
count += 1;
|
|
232
|
+
}
|
|
233
|
+
return count;
|
|
234
|
+
}
|
|
214
235
|
function listed() {
|
|
215
|
-
return structuredClone([...rooms.values()])
|
|
236
|
+
return structuredClone([...rooms.values()].map((room) => {
|
|
237
|
+
const documents = documentsIn(room.locator);
|
|
238
|
+
counted.set(room.locator, documents);
|
|
239
|
+
return { ...room, documents };
|
|
240
|
+
}));
|
|
216
241
|
}
|
|
217
242
|
function roomFacts(reach = null) {
|
|
218
243
|
const held = [...rooms.values()]
|
|
@@ -244,6 +269,10 @@ export function composeRuntime(options) {
|
|
|
244
269
|
for (const listener of storageLossListeners)
|
|
245
270
|
listener(storageLoss);
|
|
246
271
|
}
|
|
272
|
+
function emitMember() {
|
|
273
|
+
for (const listener of memberListeners)
|
|
274
|
+
listener(member);
|
|
275
|
+
}
|
|
247
276
|
function moveTo(next) {
|
|
248
277
|
if (closed)
|
|
249
278
|
return;
|
|
@@ -263,6 +292,8 @@ export function composeRuntime(options) {
|
|
|
263
292
|
listener(shown);
|
|
264
293
|
}
|
|
265
294
|
function entryOf(batch) {
|
|
295
|
+
if (localSaves)
|
|
296
|
+
return Object.freeze({ batch, state: 'local' });
|
|
266
297
|
const state = pendings.get(batch.id);
|
|
267
298
|
if (state?.accepted !== undefined) {
|
|
268
299
|
return Object.freeze({ batch, state: 'accepted', roomVersion: state.accepted });
|
|
@@ -283,12 +314,47 @@ export function composeRuntime(options) {
|
|
|
283
314
|
}
|
|
284
315
|
}
|
|
285
316
|
function applyChangeSet(set) {
|
|
317
|
+
const held = everyRoom
|
|
318
|
+
? set
|
|
319
|
+
: { ...set, documents: set.documents.filter(({ locator }) => materialized.has(locator)) };
|
|
320
|
+
readSide.apply(held);
|
|
321
|
+
searchIndex.changed(held);
|
|
322
|
+
}
|
|
323
|
+
function materialize(locators) {
|
|
324
|
+
if (everyRoom)
|
|
325
|
+
return;
|
|
326
|
+
if (locators === null)
|
|
327
|
+
everyRoom = true;
|
|
328
|
+
const sets = [];
|
|
329
|
+
for (const locator of locators ?? [...replicas.keys()]) {
|
|
330
|
+
if (materialized.has(locator))
|
|
331
|
+
continue;
|
|
332
|
+
materialized.add(locator);
|
|
333
|
+
const replica = replicas.get(locator);
|
|
334
|
+
if (replica !== undefined)
|
|
335
|
+
sets.push(changeSet(locator, null, replica));
|
|
336
|
+
}
|
|
337
|
+
if (sets.length === 0)
|
|
338
|
+
return;
|
|
339
|
+
const set = mergeChangeSets(sets);
|
|
286
340
|
readSide.apply(set);
|
|
287
341
|
searchIndex.changed(set);
|
|
288
342
|
}
|
|
343
|
+
function reachedRooms(plan) {
|
|
344
|
+
if (plan.rooms !== null)
|
|
345
|
+
return plan.rooms;
|
|
346
|
+
if (plan.reach === null)
|
|
347
|
+
return null;
|
|
348
|
+
return [...plan.reach.rooms, ...plan.reach.documents.map(roomOfKey)];
|
|
349
|
+
}
|
|
350
|
+
function rowsQuery(plan) {
|
|
351
|
+
materialize(reachedRooms(plan));
|
|
352
|
+
return readSide.query(plan);
|
|
353
|
+
}
|
|
289
354
|
function publishChangeSet(set) {
|
|
290
355
|
applyChangeSet(set);
|
|
291
|
-
if (set.rooms.length > 0
|
|
356
|
+
if (set.rooms.length > 0 ||
|
|
357
|
+
[...new Set(set.documents.map(({ locator }) => locator))].some((locator) => rooms.has(locator) && counted.get(locator) !== documentsIn(locator)))
|
|
292
358
|
emitRooms();
|
|
293
359
|
for (const locator of set.queues)
|
|
294
360
|
emitQueue(locator);
|
|
@@ -362,10 +428,7 @@ export function composeRuntime(options) {
|
|
|
362
428
|
model: revoked,
|
|
363
429
|
selectionModel: revoked,
|
|
364
430
|
};
|
|
365
|
-
|
|
366
|
-
replicas.set(locator, read.kind === 'staged'
|
|
367
|
-
? replicaOf(read.confirmed, before.queue, before)
|
|
368
|
-
: { ...before, confirmed: { ...before.confirmed, record } });
|
|
431
|
+
replicas.set(locator, replicaOf(confirmedOf(record, before.confirmed), before.queue, before));
|
|
369
432
|
}
|
|
370
433
|
rooms.set(locator, {
|
|
371
434
|
...room,
|
|
@@ -432,7 +495,7 @@ export function composeRuntime(options) {
|
|
|
432
495
|
emitRooms();
|
|
433
496
|
}
|
|
434
497
|
function unlistedHeld(listed) {
|
|
435
|
-
return [...new Set([...rooms.keys(), ...roomDrafts.keys()])].filter((locator) => !listed.has(locator));
|
|
498
|
+
return [...new Set([...rooms.keys(), ...roomDrafts.keys(), ...transfers.keys()])].filter((locator) => !listed.has(locator));
|
|
436
499
|
}
|
|
437
500
|
async function dropUnlisted(listed, local) {
|
|
438
501
|
if (unlistedHeld(listed).length === 0)
|
|
@@ -451,6 +514,7 @@ export function composeRuntime(options) {
|
|
|
451
514
|
replicas.delete(locator);
|
|
452
515
|
rooms.delete(locator);
|
|
453
516
|
roomDrafts.delete(locator);
|
|
517
|
+
transfers.delete(locator);
|
|
454
518
|
unreadable.delete(locator);
|
|
455
519
|
stale.delete(locator);
|
|
456
520
|
scopedRefusals.delete(locator);
|
|
@@ -487,7 +551,7 @@ export function composeRuntime(options) {
|
|
|
487
551
|
return model;
|
|
488
552
|
}
|
|
489
553
|
async function hydrate(opened) {
|
|
490
|
-
const [records, queues, kept, presented, held, chatDrafts, lastCompleted, declared, named] = await Promise.all([
|
|
554
|
+
const [records, queues, kept, presented, held, chatDrafts, lastCompleted, declared, named, known, staged,] = await Promise.all([
|
|
491
555
|
opened.all(),
|
|
492
556
|
opened.queues(),
|
|
493
557
|
opened.roomDrafts(),
|
|
@@ -497,9 +561,15 @@ export function composeRuntime(options) {
|
|
|
497
561
|
opened.lastCompleted(),
|
|
498
562
|
opened.providerLimits(),
|
|
499
563
|
opened.capabilities(),
|
|
564
|
+
opened.member(),
|
|
565
|
+
opened.transfers(),
|
|
500
566
|
]);
|
|
567
|
+
transfers.clear();
|
|
568
|
+
for (const record of staged)
|
|
569
|
+
transfers.set(record.locator, record);
|
|
501
570
|
limits = declared;
|
|
502
571
|
capabilities = named;
|
|
572
|
+
member = known;
|
|
503
573
|
roomDrafts.clear();
|
|
504
574
|
for (const record of kept)
|
|
505
575
|
rememberRoomDraft(record);
|
|
@@ -519,14 +589,7 @@ export function composeRuntime(options) {
|
|
|
519
589
|
const model = restored(modelKey(record.locator, 'collection'), record.model);
|
|
520
590
|
const selectionModel = restored(modelKey(record.locator, 'typed-selection'), record.selectionModel);
|
|
521
591
|
const prior = previousReplicas.get(record.locator);
|
|
522
|
-
const
|
|
523
|
-
const read = readConfirmed(retyped, prior?.confirmed);
|
|
524
|
-
const confirmed = read.kind === 'staged'
|
|
525
|
-
? read.confirmed
|
|
526
|
-
: {
|
|
527
|
-
record: retyped,
|
|
528
|
-
collection: parseCollection(retyped.documents, compositionOf(retyped)),
|
|
529
|
-
};
|
|
592
|
+
const confirmed = confirmedOf({ ...record, model, selectionModel }, prior?.confirmed);
|
|
530
593
|
replicas.set(record.locator, replicaOf(confirmed, queuedBatches.get(record.locator) ?? [], prior));
|
|
531
594
|
const existing = rooms.get(record.locator);
|
|
532
595
|
if (existing === undefined)
|
|
@@ -547,10 +610,6 @@ export function composeRuntime(options) {
|
|
|
547
610
|
},
|
|
548
611
|
});
|
|
549
612
|
}
|
|
550
|
-
if (read.kind === 'refused') {
|
|
551
|
-
refusedSource(record, read);
|
|
552
|
-
declarationRefusals.add(record.locator);
|
|
553
|
-
}
|
|
554
613
|
}
|
|
555
614
|
return {
|
|
556
615
|
lastCompleted,
|
|
@@ -563,6 +622,8 @@ export function composeRuntime(options) {
|
|
|
563
622
|
applyChangeSet(read);
|
|
564
623
|
if (replicas.size > 0)
|
|
565
624
|
emitRooms();
|
|
625
|
+
if (member !== null)
|
|
626
|
+
emitMember();
|
|
566
627
|
for (const locator of locators)
|
|
567
628
|
emitQueue(locator);
|
|
568
629
|
publishRoomDrafts(false);
|
|
@@ -610,10 +671,14 @@ export function composeRuntime(options) {
|
|
|
610
671
|
return state !== undefined && state.submission.state !== 'submitted' && !state.lost;
|
|
611
672
|
}
|
|
612
673
|
async function settle(local, locator, before, confirmed, queue, settling = {}) {
|
|
613
|
-
const withdrawn = withdrawals(confirmed, queue, withdrawable);
|
|
674
|
+
const withdrawn = withdrawals(confirmed, queue, withdrawable, localSaves);
|
|
614
675
|
const kept = queue.filter((batch) => !withdrawn.includes(batch));
|
|
676
|
+
const unqueued = withdrawn.map((batch) => ({
|
|
677
|
+
batch,
|
|
678
|
+
returned: localSaves || landed(batch, confirmed) ? null : { kind: 'withdrawn' },
|
|
679
|
+
}));
|
|
615
680
|
const returning = [
|
|
616
|
-
...
|
|
681
|
+
...[...unqueued].reverse(),
|
|
617
682
|
...(settling.leaving === undefined ? [] : [settling.leaving]),
|
|
618
683
|
];
|
|
619
684
|
const written = new Map();
|
|
@@ -634,6 +699,7 @@ export function composeRuntime(options) {
|
|
|
634
699
|
await local.write({
|
|
635
700
|
next: confirmed.record,
|
|
636
701
|
previous: before?.confirmed.record ?? null,
|
|
702
|
+
...(settling.stored === undefined ? {} : { stored: settling.stored }),
|
|
637
703
|
queue: kept,
|
|
638
704
|
previousQueue: before?.queue ?? [],
|
|
639
705
|
roomDrafts: [...written.values()],
|
|
@@ -644,8 +710,10 @@ export function composeRuntime(options) {
|
|
|
644
710
|
}
|
|
645
711
|
for (const record of written.values())
|
|
646
712
|
rememberRoomDraft(record);
|
|
647
|
-
for (const batch of
|
|
648
|
-
|
|
713
|
+
for (const { batch, returned } of unqueued) {
|
|
714
|
+
const outcome = localSaves ? 'dropped' : returned === null ? 'landed' : 'withdrawn';
|
|
715
|
+
journal.record(`outcome ${locator} ${batch.id} ${outcome}`);
|
|
716
|
+
}
|
|
649
717
|
replicas.set(locator, replicaOf(confirmed, kept, before));
|
|
650
718
|
return changeSet(locator, before ?? null, replicas.get(locator) ?? null, {
|
|
651
719
|
room: settling.room,
|
|
@@ -684,7 +752,8 @@ export function composeRuntime(options) {
|
|
|
684
752
|
selection: taken(answers?.selection, held.selection, 'typed-selection'),
|
|
685
753
|
};
|
|
686
754
|
}
|
|
687
|
-
function publish(local, room, confirmed,
|
|
755
|
+
function publish(local, room, confirmed, landing = {}) {
|
|
756
|
+
const { base, stored } = landing;
|
|
688
757
|
return exclusive(async () => {
|
|
689
758
|
if (!continuing())
|
|
690
759
|
return true;
|
|
@@ -701,7 +770,9 @@ export function composeRuntime(options) {
|
|
|
701
770
|
const accepted = pendings.get(batch.id)?.accepted;
|
|
702
771
|
return (accepted !== undefined && options.adapter.reached(room.locator, roomVersion, accepted));
|
|
703
772
|
});
|
|
704
|
-
const set = await settle(local, room.locator, prior, confirmed, queue.filter((batch) => !accepted.includes(batch)), { room: true });
|
|
773
|
+
const set = await settle(local, room.locator, prior, confirmed, queue.filter((batch) => !accepted.includes(batch)), { room: true, ...(stored === undefined ? {} : { stored }) });
|
|
774
|
+
if (stored !== undefined)
|
|
775
|
+
transfers.delete(room.locator);
|
|
705
776
|
for (const batch of accepted)
|
|
706
777
|
pendings.delete(batch.id);
|
|
707
778
|
stale.delete(room.locator);
|
|
@@ -736,6 +807,7 @@ export function composeRuntime(options) {
|
|
|
736
807
|
return { outcome: 'refused', rule: 'changed-underneath', parts: changed };
|
|
737
808
|
const parts = saved.map(({ path, parts }) => changesOf(path, parts));
|
|
738
809
|
const built = buildBatch({
|
|
810
|
+
local: localSaves,
|
|
739
811
|
baseRoomVersion: replica.confirmed.record.roomVersion,
|
|
740
812
|
composition: compositionFor(replica.confirmed.record),
|
|
741
813
|
operations: room.operations,
|
|
@@ -765,7 +837,8 @@ export function composeRuntime(options) {
|
|
|
765
837
|
return { outcome: 'refused', rule: 'durable-write' };
|
|
766
838
|
}
|
|
767
839
|
pendings.set(built.batch.id, { drafts: saved, submission: { state: 'waiting' }, lost: false });
|
|
768
|
-
|
|
840
|
+
if (!localSaves)
|
|
841
|
+
recorded = false;
|
|
769
842
|
for (const path of consumed)
|
|
770
843
|
forgetRoomDraft(locator, path);
|
|
771
844
|
replicas.set(locator, replicaOf(replica.confirmed, batches, replica));
|
|
@@ -773,7 +846,7 @@ export function composeRuntime(options) {
|
|
|
773
846
|
queue: true,
|
|
774
847
|
drafts: consumed,
|
|
775
848
|
}));
|
|
776
|
-
moveTo({ ...saving(status), ...attention() });
|
|
849
|
+
moveTo({ ...(localSaves ? status : saving(status)), ...attention() });
|
|
777
850
|
submitLater(locator);
|
|
778
851
|
return { outcome: 'saved', identifier: built.batch.id };
|
|
779
852
|
}
|
|
@@ -918,14 +991,33 @@ export function composeRuntime(options) {
|
|
|
918
991
|
throw error;
|
|
919
992
|
}
|
|
920
993
|
}
|
|
921
|
-
|
|
994
|
+
function staging(local) {
|
|
995
|
+
return {
|
|
996
|
+
held: (locator) => transfers.get(locator) ?? null,
|
|
997
|
+
staged: (record) => local.staged(record),
|
|
998
|
+
stage: (record, page) => exclusive(async () => {
|
|
999
|
+
if (!continuing())
|
|
1000
|
+
return false;
|
|
1001
|
+
await local.stage(record, page);
|
|
1002
|
+
transfers.set(record.locator, record);
|
|
1003
|
+
return true;
|
|
1004
|
+
}),
|
|
1005
|
+
abandon: (locator) => exclusive(async () => {
|
|
1006
|
+
if (!continuing())
|
|
1007
|
+
return;
|
|
1008
|
+
await local.abandon(locator);
|
|
1009
|
+
transfers.delete(locator);
|
|
1010
|
+
}),
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
async function pullBootstrap(authorized, room, local) {
|
|
922
1014
|
if (!continuing())
|
|
923
1015
|
return unconfirmed;
|
|
924
1016
|
try {
|
|
925
1017
|
const result = await bootstrapRoom(options.adapter, authorized, room, {
|
|
926
1018
|
collection: modelOf(room.locator),
|
|
927
1019
|
selection: modelOf(room.locator, 'typed-selection'),
|
|
928
|
-
}, (models, held) => remodel(room.locator, models, held), continuing);
|
|
1020
|
+
}, (models, held) => remodel(room.locator, models, held), continuing, staging(local));
|
|
929
1021
|
const detail = result.kind === 'staged' ? result.confirmed.record.roomVersion : result.kind;
|
|
930
1022
|
journal.record(`transfer bootstrap ${room.locator} ${detail}`);
|
|
931
1023
|
return result;
|
|
@@ -953,7 +1045,7 @@ export function composeRuntime(options) {
|
|
|
953
1045
|
return null;
|
|
954
1046
|
}
|
|
955
1047
|
if (refreshed.kind === 'advanced') {
|
|
956
|
-
if (!(await publish(local, room, refreshed.confirmed, held.confirmed))) {
|
|
1048
|
+
if (!(await publish(local, room, refreshed.confirmed, { base: held.confirmed }))) {
|
|
957
1049
|
const now = replicas.get(room.locator)?.confirmed.record.roomVersion;
|
|
958
1050
|
const reached = now !== undefined &&
|
|
959
1051
|
options.adapter.reached(room.locator, now, refreshed.confirmed.record.roomVersion);
|
|
@@ -965,12 +1057,12 @@ export function composeRuntime(options) {
|
|
|
965
1057
|
if (refreshed.kind !== 'beyond-horizon')
|
|
966
1058
|
return refreshed;
|
|
967
1059
|
}
|
|
968
|
-
const bootstrapped = await pullBootstrap(authorized, room);
|
|
1060
|
+
const bootstrapped = await pullBootstrap(authorized, room, local);
|
|
969
1061
|
if (!continuing())
|
|
970
1062
|
return unconfirmed;
|
|
971
1063
|
if (bootstrapped.kind !== 'staged')
|
|
972
1064
|
return bootstrapped;
|
|
973
|
-
await publish(local, room, bootstrapped.confirmed);
|
|
1065
|
+
await publish(local, room, bootstrapped.confirmed, { stored: bootstrapped.stored });
|
|
974
1066
|
return null;
|
|
975
1067
|
}
|
|
976
1068
|
async function withhold(withheld, room, local, progress) {
|
|
@@ -1035,7 +1127,7 @@ export function composeRuntime(options) {
|
|
|
1035
1127
|
logAccepted(room.locator, submitted, accepted);
|
|
1036
1128
|
const applied = options.adapter.reached(room.locator, held, accepted.roomVersion)
|
|
1037
1129
|
? { kind: 'staged', confirmed: current.confirmed }
|
|
1038
|
-
: applyReturned(current.confirmed, accepted.documents, accepted.revisions, accepted.removals, accepted.attachments, options.adapter.follows(room.locator, held, accepted.roomVersion)
|
|
1130
|
+
: applyReturned(current.confirmed, accepted.documents, accepted.revisions, accepted.changes, accepted.removals, accepted.attachments, options.adapter.follows(room.locator, held, accepted.roomVersion)
|
|
1039
1131
|
? accepted.roomVersion
|
|
1040
1132
|
: held, accepted.roomVersion);
|
|
1041
1133
|
if (applied.kind !== 'staged') {
|
|
@@ -1181,7 +1273,8 @@ export function composeRuntime(options) {
|
|
|
1181
1273
|
return;
|
|
1182
1274
|
}
|
|
1183
1275
|
const set = await settle(local, room.locator, current, current.confirmed, current.queue.filter((batch) => batch.id !== head.id), {
|
|
1184
|
-
leaving: result.kind === 'expired' && landed(head, current.confirmed)
|
|
1276
|
+
leaving: (result.kind === 'expired' && landed(head, current.confirmed)) ||
|
|
1277
|
+
(result.kind === 'conflicted' && landed(head, current.confirmed, result.affected))
|
|
1185
1278
|
? { ...left, returned: null }
|
|
1186
1279
|
: left,
|
|
1187
1280
|
});
|
|
@@ -1242,7 +1335,7 @@ export function composeRuntime(options) {
|
|
|
1242
1335
|
...(attached === 'collection' ? { model: next } : { selectionModel: next }),
|
|
1243
1336
|
};
|
|
1244
1337
|
const reclassified = sameMembership(declared, held.confirmed.record)
|
|
1245
|
-
?
|
|
1338
|
+
? { kind: 'staged', confirmed: confirmedOf(declared, held.confirmed) }
|
|
1246
1339
|
: readReclassified(declared, held.confirmed);
|
|
1247
1340
|
const record = reclassified.kind === 'staged'
|
|
1248
1341
|
? declared
|
|
@@ -1250,7 +1343,9 @@ export function composeRuntime(options) {
|
|
|
1250
1343
|
...declared,
|
|
1251
1344
|
typedSelection: held.confirmed.record.typedSelection,
|
|
1252
1345
|
};
|
|
1253
|
-
const read = reclassified.kind === 'deferred'
|
|
1346
|
+
const read = reclassified.kind === 'deferred'
|
|
1347
|
+
? { kind: 'staged', confirmed: confirmedOf(record, held.confirmed) }
|
|
1348
|
+
: reclassified;
|
|
1254
1349
|
await local.write({
|
|
1255
1350
|
next: record,
|
|
1256
1351
|
previous: held.confirmed.record,
|
|
@@ -1330,8 +1425,10 @@ export function composeRuntime(options) {
|
|
|
1330
1425
|
const outcome = prepared[index];
|
|
1331
1426
|
return outcome?.status === 'fulfilled' && outcome.value;
|
|
1332
1427
|
});
|
|
1333
|
-
if (attempt === 'opened')
|
|
1428
|
+
if (attempt === 'opened') {
|
|
1334
1429
|
options.adapter.roomStream?.hold(heldRooms(ready));
|
|
1430
|
+
handed = true;
|
|
1431
|
+
}
|
|
1335
1432
|
const loaded = await Promise.allSettled(ready
|
|
1336
1433
|
.filter((room) => attempt === 'unstreamed' || !replicas.has(room.locator))
|
|
1337
1434
|
.map((room) => loadRoom(room, local, progress)));
|
|
@@ -1397,14 +1494,14 @@ export function composeRuntime(options) {
|
|
|
1397
1494
|
async function reload(room, local, progress) {
|
|
1398
1495
|
if (discoveryPaused || authorization === undefined)
|
|
1399
1496
|
return;
|
|
1400
|
-
const bootstrapped = await pullBootstrap(authorization, room);
|
|
1497
|
+
const bootstrapped = await pullBootstrap(authorization, room, local);
|
|
1401
1498
|
if (!continuing())
|
|
1402
1499
|
return;
|
|
1403
1500
|
if (bootstrapped.kind !== 'staged') {
|
|
1404
1501
|
await withhold(bootstrapped, room, local, progress);
|
|
1405
1502
|
return;
|
|
1406
1503
|
}
|
|
1407
|
-
await publish(local, room, bootstrapped.confirmed);
|
|
1504
|
+
await publish(local, room, bootstrapped.confirmed, { stored: bootstrapped.stored });
|
|
1408
1505
|
await caughtUp(room, local, progress);
|
|
1409
1506
|
}
|
|
1410
1507
|
async function discoverRooms(local, progress, attempt) {
|
|
@@ -1434,9 +1531,6 @@ export function composeRuntime(options) {
|
|
|
1434
1531
|
}
|
|
1435
1532
|
progress.reachable = false;
|
|
1436
1533
|
progress.complete = false;
|
|
1437
|
-
if (attempt === 'opened') {
|
|
1438
|
-
options.adapter.roomStream?.hold(heldRooms([...discovered.values()]));
|
|
1439
|
-
}
|
|
1440
1534
|
notifyReady();
|
|
1441
1535
|
return;
|
|
1442
1536
|
}
|
|
@@ -1483,6 +1577,12 @@ export function composeRuntime(options) {
|
|
|
1483
1577
|
limits = result.providerLimits;
|
|
1484
1578
|
await local.declare(limits, capabilities);
|
|
1485
1579
|
}
|
|
1580
|
+
const signedIn = result.member ?? null;
|
|
1581
|
+
if (JSON.stringify(signedIn) !== JSON.stringify(member)) {
|
|
1582
|
+
await local.keepMember(signedIn);
|
|
1583
|
+
member = signedIn;
|
|
1584
|
+
emitMember();
|
|
1585
|
+
}
|
|
1486
1586
|
await applyDiscovery(result.rooms, local);
|
|
1487
1587
|
await synchronize(result.rooms, local, progress, attempt);
|
|
1488
1588
|
}
|
|
@@ -1515,6 +1615,7 @@ export function composeRuntime(options) {
|
|
|
1515
1615
|
complete = false;
|
|
1516
1616
|
recorded = false;
|
|
1517
1617
|
moveTo(transferring(status));
|
|
1618
|
+
handed = false;
|
|
1518
1619
|
try {
|
|
1519
1620
|
const local = await openLocal();
|
|
1520
1621
|
if (closed)
|
|
@@ -1526,16 +1627,22 @@ export function composeRuntime(options) {
|
|
|
1526
1627
|
}
|
|
1527
1628
|
catch {
|
|
1528
1629
|
progress.complete = false;
|
|
1529
|
-
if (attempt === 'opened')
|
|
1530
|
-
|
|
1531
|
-
}
|
|
1630
|
+
if (attempt === 'opened' && !handed)
|
|
1631
|
+
progress.reachable = false;
|
|
1532
1632
|
}
|
|
1533
1633
|
finally {
|
|
1534
1634
|
notifyReady();
|
|
1535
1635
|
}
|
|
1536
|
-
if (attempt
|
|
1636
|
+
if (attempt !== 'opened') {
|
|
1637
|
+
await finishOpening(progress);
|
|
1537
1638
|
return;
|
|
1538
|
-
|
|
1639
|
+
}
|
|
1640
|
+
if (handed || closed || progress.reachable)
|
|
1641
|
+
return;
|
|
1642
|
+
underway = null;
|
|
1643
|
+
journal.record('connection reopen');
|
|
1644
|
+
await rest(progress);
|
|
1645
|
+
options.adapter.roomStream?.reopen();
|
|
1539
1646
|
});
|
|
1540
1647
|
}
|
|
1541
1648
|
function closedSocket(revoked) {
|
|
@@ -1602,6 +1709,8 @@ export function composeRuntime(options) {
|
|
|
1602
1709
|
}
|
|
1603
1710
|
}
|
|
1604
1711
|
function submitLater(locator) {
|
|
1712
|
+
if (localSaves)
|
|
1713
|
+
return;
|
|
1605
1714
|
const running = submitting.get(locator);
|
|
1606
1715
|
if (running !== undefined) {
|
|
1607
1716
|
running.again = true;
|
|
@@ -1825,6 +1934,7 @@ export function composeRuntime(options) {
|
|
|
1825
1934
|
storageLossListeners.clear();
|
|
1826
1935
|
statusListeners.clear();
|
|
1827
1936
|
serviceModeListeners.clear();
|
|
1937
|
+
memberListeners.clear();
|
|
1828
1938
|
readSide.close();
|
|
1829
1939
|
queueSubscriptions.clear();
|
|
1830
1940
|
roomDraftListeners.clear();
|
|
@@ -1856,13 +1966,16 @@ export function composeRuntime(options) {
|
|
|
1856
1966
|
return planOf(input, roomFacts(reach), planReach(reach));
|
|
1857
1967
|
}
|
|
1858
1968
|
function watchPlan(plan, deliver) {
|
|
1969
|
+
materialize(reachedRooms(plan));
|
|
1859
1970
|
return readSide.watch(plan, identityOf(plan), deliver);
|
|
1860
1971
|
}
|
|
1861
1972
|
async function searched(input, reach) {
|
|
1862
1973
|
const plan = searchPlanOf(input);
|
|
1863
1974
|
const selected = plan.documents === undefined && reach === null
|
|
1864
1975
|
? null
|
|
1865
|
-
: (await
|
|
1976
|
+
: (await rowsQuery(filterOf(plan.documents ?? {}, roomFacts(reach), planReach(reach)))).documents;
|
|
1977
|
+
if (selected === null)
|
|
1978
|
+
materialize(null);
|
|
1866
1979
|
return searchIndex.search(reach === null || reach.conversations ? plan : { ...plan, conversations: [] }, selected);
|
|
1867
1980
|
}
|
|
1868
1981
|
const watch = (topic, input, deliver) => {
|
|
@@ -1942,6 +2055,13 @@ export function composeRuntime(options) {
|
|
|
1942
2055
|
serviceModeListeners.delete(deliver);
|
|
1943
2056
|
};
|
|
1944
2057
|
}
|
|
2058
|
+
if (topic === 'member') {
|
|
2059
|
+
memberListeners.add(deliver);
|
|
2060
|
+
deliver(member);
|
|
2061
|
+
return () => {
|
|
2062
|
+
memberListeners.delete(deliver);
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
1945
2065
|
if (topic === 'queue') {
|
|
1946
2066
|
const queue = { locator: input[0], notify: deliver };
|
|
1947
2067
|
queueSubscriptions.add(queue);
|
|
@@ -1959,7 +2079,7 @@ export function composeRuntime(options) {
|
|
|
1959
2079
|
rooms() {
|
|
1960
2080
|
return listed();
|
|
1961
2081
|
},
|
|
1962
|
-
query: ((input) =>
|
|
2082
|
+
query: ((input) => rowsQuery(planned(input, null))),
|
|
1963
2083
|
search: (input) => searched(input, null),
|
|
1964
2084
|
types(locator) {
|
|
1965
2085
|
return {
|
|
@@ -2086,7 +2206,7 @@ export function composeRuntime(options) {
|
|
|
2086
2206
|
md,
|
|
2087
2207
|
watch,
|
|
2088
2208
|
plan: planned,
|
|
2089
|
-
query: (plan) =>
|
|
2209
|
+
query: (plan) => rowsQuery(plan),
|
|
2090
2210
|
watchPlan,
|
|
2091
2211
|
search: searched,
|
|
2092
2212
|
};
|
package/dist/host.d.ts
CHANGED
|
@@ -15,5 +15,6 @@ export type MdRuntimeHost = {
|
|
|
15
15
|
};
|
|
16
16
|
export declare function serveMdRuntime(options: MdRuntimeHostOptions): MdRuntimeHost;
|
|
17
17
|
export type { PortReach, ReachedDocument } from './reach.js';
|
|
18
|
+
export { STORE_SCHEMA } from './store.js';
|
|
18
19
|
export type { RuntimePort } from './wire.js';
|
|
19
20
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAGL,KAAK,WAAW,EAOjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IAC1F,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB,CAAC;AA0EF,wBAAgB,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAwH3E;AAED,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAGL,KAAK,WAAW,EAOjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IAC1F,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB,CAAC;AA0EF,wBAAgB,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAwH3E;AAED,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/host.js
CHANGED
package/dist/identity.d.ts
CHANGED
package/dist/identity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
package/dist/identity.js
CHANGED
|
@@ -10,8 +10,14 @@ export function changeBatchIdentity(at = Date.now()) {
|
|
|
10
10
|
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
11
11
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
function randomIdentity() {
|
|
14
14
|
const bytes = new Uint8Array(16);
|
|
15
15
|
crypto.getRandomValues(bytes);
|
|
16
16
|
return [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
17
17
|
}
|
|
18
|
+
export function roomDraftRevision() {
|
|
19
|
+
return randomIdentity();
|
|
20
|
+
}
|
|
21
|
+
export function transferIdentity() {
|
|
22
|
+
return randomIdentity();
|
|
23
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldRoom, ListedConversation, MdModelIdentity, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomAttachment, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
|
|
1
|
+
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldRoom, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomAttachment, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
3
3
|
export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
4
4
|
export type { ChatDraftFile, FileDeclaration } from './file.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,YAAY,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,YAAY,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelResult } from './model.js';
|
|
2
|
-
import { type AcceptedMessage, type ActionResult, type Adapter, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type ProviderLimit, type Retention, type RoomAttachment, type ServiceMode } from './adapter.js';
|
|
2
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type RoomAttachment, type ServiceMode } from './adapter.js';
|
|
3
3
|
export type MemoryRoom = DiscoveredRoom & {
|
|
4
4
|
model?: ModelResult;
|
|
5
5
|
selectionModel?: ModelResult;
|
|
@@ -23,6 +23,7 @@ export type MemoryAdapterOptions = {
|
|
|
23
23
|
capabilities?: readonly Capability[];
|
|
24
24
|
providerLimits?: readonly ProviderLimit[];
|
|
25
25
|
retention?: Retention;
|
|
26
|
+
member?: Member;
|
|
26
27
|
unopened?: boolean;
|
|
27
28
|
};
|
|
28
29
|
export type MemoryAdapter = Adapter & {
|