@agentshouse/mdruntime 0.1.0-cf6041a06849c → 0.1.0-cf6d5f0a5c9c8
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 +45 -23
- package/README.md +9 -9
- package/dist/adapter.d.ts +8 -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 +89 -35
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +13 -7
- 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 +5 -2
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +165 -51
- 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 +16 -6
- package/dist/model.d.ts +7 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -0
- package/dist/paths.d.ts +0 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -16
- package/dist/query.d.ts +1 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +49 -19
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +1 -16
- package/dist/react.d.ts +22 -14
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -6
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +102 -46
- 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 +4 -4
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +31 -25
- package/dist/room-draft.js +1 -1
- package/dist/rows.d.ts +4 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +84 -38
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +106 -53
- package/dist/store.d.ts +25 -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';
|
|
@@ -44,6 +45,7 @@ export function composeRuntime(options) {
|
|
|
44
45
|
let limits = [];
|
|
45
46
|
let capabilities = [];
|
|
46
47
|
const rooms = new Map();
|
|
48
|
+
const counted = new Map();
|
|
47
49
|
const unreadable = new Set();
|
|
48
50
|
const models = new Map();
|
|
49
51
|
const liveModels = new Map();
|
|
@@ -82,6 +84,7 @@ export function composeRuntime(options) {
|
|
|
82
84
|
let withdrawStream;
|
|
83
85
|
const announced = new Map();
|
|
84
86
|
let underway = null;
|
|
87
|
+
let handed = false;
|
|
85
88
|
const submitting = new Map();
|
|
86
89
|
const answering = new Map();
|
|
87
90
|
let complete = false;
|
|
@@ -104,9 +107,14 @@ export function composeRuntime(options) {
|
|
|
104
107
|
let haltedRefusal = false;
|
|
105
108
|
let openSignals = 0;
|
|
106
109
|
const serviceModeListeners = new Set();
|
|
110
|
+
let member = null;
|
|
111
|
+
const memberListeners = new Set();
|
|
112
|
+
const materialized = new Set();
|
|
113
|
+
let everyRoom = false;
|
|
114
|
+
const transfers = new Map();
|
|
107
115
|
const conversations = createConversationStore({
|
|
108
116
|
agents: declaredAgents,
|
|
109
|
-
documents: (locator) =>
|
|
117
|
+
documents: (locator) => rowsQuery(planOf({ rooms: [locator], select: 'all' }, roomFacts())),
|
|
110
118
|
call: (name, input) => invokeAction(name, input),
|
|
111
119
|
durably,
|
|
112
120
|
stream: () => options.adapter.conversations,
|
|
@@ -211,8 +219,24 @@ export function composeRuntime(options) {
|
|
|
211
219
|
}
|
|
212
220
|
return { attentionRequired, reset };
|
|
213
221
|
}
|
|
222
|
+
function documentsIn(locator) {
|
|
223
|
+
const replica = replicas.get(locator);
|
|
224
|
+
if (replica === undefined)
|
|
225
|
+
return 0;
|
|
226
|
+
const roots = replica.confirmed.record.typedSelection?.roots ?? [];
|
|
227
|
+
let count = 0;
|
|
228
|
+
for (const path of Object.keys(replica.visible.documents)) {
|
|
229
|
+
if (markdownPath(path) && !roots.some((root) => beneath(root, path)))
|
|
230
|
+
count += 1;
|
|
231
|
+
}
|
|
232
|
+
return count;
|
|
233
|
+
}
|
|
214
234
|
function listed() {
|
|
215
|
-
return structuredClone([...rooms.values()])
|
|
235
|
+
return structuredClone([...rooms.values()].map((room) => {
|
|
236
|
+
const documents = documentsIn(room.locator);
|
|
237
|
+
counted.set(room.locator, documents);
|
|
238
|
+
return { ...room, documents };
|
|
239
|
+
}));
|
|
216
240
|
}
|
|
217
241
|
function roomFacts(reach = null) {
|
|
218
242
|
const held = [...rooms.values()]
|
|
@@ -244,6 +268,10 @@ export function composeRuntime(options) {
|
|
|
244
268
|
for (const listener of storageLossListeners)
|
|
245
269
|
listener(storageLoss);
|
|
246
270
|
}
|
|
271
|
+
function emitMember() {
|
|
272
|
+
for (const listener of memberListeners)
|
|
273
|
+
listener(member);
|
|
274
|
+
}
|
|
247
275
|
function moveTo(next) {
|
|
248
276
|
if (closed)
|
|
249
277
|
return;
|
|
@@ -283,12 +311,47 @@ export function composeRuntime(options) {
|
|
|
283
311
|
}
|
|
284
312
|
}
|
|
285
313
|
function applyChangeSet(set) {
|
|
314
|
+
const held = everyRoom
|
|
315
|
+
? set
|
|
316
|
+
: { ...set, documents: set.documents.filter(({ locator }) => materialized.has(locator)) };
|
|
317
|
+
readSide.apply(held);
|
|
318
|
+
searchIndex.changed(held);
|
|
319
|
+
}
|
|
320
|
+
function materialize(locators) {
|
|
321
|
+
if (everyRoom)
|
|
322
|
+
return;
|
|
323
|
+
if (locators === null)
|
|
324
|
+
everyRoom = true;
|
|
325
|
+
const sets = [];
|
|
326
|
+
for (const locator of locators ?? [...replicas.keys()]) {
|
|
327
|
+
if (materialized.has(locator))
|
|
328
|
+
continue;
|
|
329
|
+
materialized.add(locator);
|
|
330
|
+
const replica = replicas.get(locator);
|
|
331
|
+
if (replica !== undefined)
|
|
332
|
+
sets.push(changeSet(locator, null, replica));
|
|
333
|
+
}
|
|
334
|
+
if (sets.length === 0)
|
|
335
|
+
return;
|
|
336
|
+
const set = mergeChangeSets(sets);
|
|
286
337
|
readSide.apply(set);
|
|
287
338
|
searchIndex.changed(set);
|
|
288
339
|
}
|
|
340
|
+
function reachedRooms(plan) {
|
|
341
|
+
if (plan.rooms !== null)
|
|
342
|
+
return plan.rooms;
|
|
343
|
+
if (plan.reach === null)
|
|
344
|
+
return null;
|
|
345
|
+
return [...plan.reach.rooms, ...plan.reach.documents.map(roomOfKey)];
|
|
346
|
+
}
|
|
347
|
+
function rowsQuery(plan) {
|
|
348
|
+
materialize(reachedRooms(plan));
|
|
349
|
+
return readSide.query(plan);
|
|
350
|
+
}
|
|
289
351
|
function publishChangeSet(set) {
|
|
290
352
|
applyChangeSet(set);
|
|
291
|
-
if (set.rooms.length > 0
|
|
353
|
+
if (set.rooms.length > 0 ||
|
|
354
|
+
[...new Set(set.documents.map(({ locator }) => locator))].some((locator) => rooms.has(locator) && counted.get(locator) !== documentsIn(locator)))
|
|
292
355
|
emitRooms();
|
|
293
356
|
for (const locator of set.queues)
|
|
294
357
|
emitQueue(locator);
|
|
@@ -362,10 +425,7 @@ export function composeRuntime(options) {
|
|
|
362
425
|
model: revoked,
|
|
363
426
|
selectionModel: revoked,
|
|
364
427
|
};
|
|
365
|
-
|
|
366
|
-
replicas.set(locator, read.kind === 'staged'
|
|
367
|
-
? replicaOf(read.confirmed, before.queue, before)
|
|
368
|
-
: { ...before, confirmed: { ...before.confirmed, record } });
|
|
428
|
+
replicas.set(locator, replicaOf(confirmedOf(record, before.confirmed), before.queue, before));
|
|
369
429
|
}
|
|
370
430
|
rooms.set(locator, {
|
|
371
431
|
...room,
|
|
@@ -395,6 +455,7 @@ export function composeRuntime(options) {
|
|
|
395
455
|
rooms.set(room.locator, {
|
|
396
456
|
name: room.name,
|
|
397
457
|
locator: room.locator,
|
|
458
|
+
handle: room.handle,
|
|
398
459
|
operations: room.operations,
|
|
399
460
|
replica: room.replica,
|
|
400
461
|
model: modelTypes(modelOf(room.locator)),
|
|
@@ -431,7 +492,7 @@ export function composeRuntime(options) {
|
|
|
431
492
|
emitRooms();
|
|
432
493
|
}
|
|
433
494
|
function unlistedHeld(listed) {
|
|
434
|
-
return [...new Set([...rooms.keys(), ...roomDrafts.keys()])].filter((locator) => !listed.has(locator));
|
|
495
|
+
return [...new Set([...rooms.keys(), ...roomDrafts.keys(), ...transfers.keys()])].filter((locator) => !listed.has(locator));
|
|
435
496
|
}
|
|
436
497
|
async function dropUnlisted(listed, local) {
|
|
437
498
|
if (unlistedHeld(listed).length === 0)
|
|
@@ -450,6 +511,7 @@ export function composeRuntime(options) {
|
|
|
450
511
|
replicas.delete(locator);
|
|
451
512
|
rooms.delete(locator);
|
|
452
513
|
roomDrafts.delete(locator);
|
|
514
|
+
transfers.delete(locator);
|
|
453
515
|
unreadable.delete(locator);
|
|
454
516
|
stale.delete(locator);
|
|
455
517
|
scopedRefusals.delete(locator);
|
|
@@ -486,7 +548,7 @@ export function composeRuntime(options) {
|
|
|
486
548
|
return model;
|
|
487
549
|
}
|
|
488
550
|
async function hydrate(opened) {
|
|
489
|
-
const [records, queues, kept, presented, held, chatDrafts, lastCompleted, declared, named] = await Promise.all([
|
|
551
|
+
const [records, queues, kept, presented, held, chatDrafts, lastCompleted, declared, named, known, staged,] = await Promise.all([
|
|
490
552
|
opened.all(),
|
|
491
553
|
opened.queues(),
|
|
492
554
|
opened.roomDrafts(),
|
|
@@ -496,9 +558,15 @@ export function composeRuntime(options) {
|
|
|
496
558
|
opened.lastCompleted(),
|
|
497
559
|
opened.providerLimits(),
|
|
498
560
|
opened.capabilities(),
|
|
561
|
+
opened.member(),
|
|
562
|
+
opened.transfers(),
|
|
499
563
|
]);
|
|
564
|
+
transfers.clear();
|
|
565
|
+
for (const record of staged)
|
|
566
|
+
transfers.set(record.locator, record);
|
|
500
567
|
limits = declared;
|
|
501
568
|
capabilities = named;
|
|
569
|
+
member = known;
|
|
502
570
|
roomDrafts.clear();
|
|
503
571
|
for (const record of kept)
|
|
504
572
|
rememberRoomDraft(record);
|
|
@@ -518,14 +586,7 @@ export function composeRuntime(options) {
|
|
|
518
586
|
const model = restored(modelKey(record.locator, 'collection'), record.model);
|
|
519
587
|
const selectionModel = restored(modelKey(record.locator, 'typed-selection'), record.selectionModel);
|
|
520
588
|
const prior = previousReplicas.get(record.locator);
|
|
521
|
-
const
|
|
522
|
-
const read = readConfirmed(retyped, prior?.confirmed);
|
|
523
|
-
const confirmed = read.kind === 'staged'
|
|
524
|
-
? read.confirmed
|
|
525
|
-
: {
|
|
526
|
-
record: retyped,
|
|
527
|
-
collection: parseCollection(retyped.documents, compositionOf(retyped)),
|
|
528
|
-
};
|
|
589
|
+
const confirmed = confirmedOf({ ...record, model, selectionModel }, prior?.confirmed);
|
|
529
590
|
replicas.set(record.locator, replicaOf(confirmed, queuedBatches.get(record.locator) ?? [], prior));
|
|
530
591
|
const existing = rooms.get(record.locator);
|
|
531
592
|
if (existing === undefined)
|
|
@@ -546,10 +607,6 @@ export function composeRuntime(options) {
|
|
|
546
607
|
},
|
|
547
608
|
});
|
|
548
609
|
}
|
|
549
|
-
if (read.kind === 'refused') {
|
|
550
|
-
refusedSource(record, read);
|
|
551
|
-
declarationRefusals.add(record.locator);
|
|
552
|
-
}
|
|
553
610
|
}
|
|
554
611
|
return {
|
|
555
612
|
lastCompleted,
|
|
@@ -562,6 +619,8 @@ export function composeRuntime(options) {
|
|
|
562
619
|
applyChangeSet(read);
|
|
563
620
|
if (replicas.size > 0)
|
|
564
621
|
emitRooms();
|
|
622
|
+
if (member !== null)
|
|
623
|
+
emitMember();
|
|
565
624
|
for (const locator of locators)
|
|
566
625
|
emitQueue(locator);
|
|
567
626
|
publishRoomDrafts(false);
|
|
@@ -611,8 +670,12 @@ export function composeRuntime(options) {
|
|
|
611
670
|
async function settle(local, locator, before, confirmed, queue, settling = {}) {
|
|
612
671
|
const withdrawn = withdrawals(confirmed, queue, withdrawable);
|
|
613
672
|
const kept = queue.filter((batch) => !withdrawn.includes(batch));
|
|
673
|
+
const unqueued = withdrawn.map((batch) => ({
|
|
674
|
+
batch,
|
|
675
|
+
returned: landed(batch, confirmed) ? null : { kind: 'withdrawn' },
|
|
676
|
+
}));
|
|
614
677
|
const returning = [
|
|
615
|
-
...
|
|
678
|
+
...[...unqueued].reverse(),
|
|
616
679
|
...(settling.leaving === undefined ? [] : [settling.leaving]),
|
|
617
680
|
];
|
|
618
681
|
const written = new Map();
|
|
@@ -633,6 +696,7 @@ export function composeRuntime(options) {
|
|
|
633
696
|
await local.write({
|
|
634
697
|
next: confirmed.record,
|
|
635
698
|
previous: before?.confirmed.record ?? null,
|
|
699
|
+
...(settling.stored === undefined ? {} : { stored: settling.stored }),
|
|
636
700
|
queue: kept,
|
|
637
701
|
previousQueue: before?.queue ?? [],
|
|
638
702
|
roomDrafts: [...written.values()],
|
|
@@ -643,8 +707,9 @@ export function composeRuntime(options) {
|
|
|
643
707
|
}
|
|
644
708
|
for (const record of written.values())
|
|
645
709
|
rememberRoomDraft(record);
|
|
646
|
-
for (const batch of
|
|
647
|
-
journal.record(`outcome ${locator} ${batch.id} withdrawn`);
|
|
710
|
+
for (const { batch, returned } of unqueued) {
|
|
711
|
+
journal.record(`outcome ${locator} ${batch.id} ${returned === null ? 'landed' : 'withdrawn'}`);
|
|
712
|
+
}
|
|
648
713
|
replicas.set(locator, replicaOf(confirmed, kept, before));
|
|
649
714
|
return changeSet(locator, before ?? null, replicas.get(locator) ?? null, {
|
|
650
715
|
room: settling.room,
|
|
@@ -683,7 +748,8 @@ export function composeRuntime(options) {
|
|
|
683
748
|
selection: taken(answers?.selection, held.selection, 'typed-selection'),
|
|
684
749
|
};
|
|
685
750
|
}
|
|
686
|
-
function publish(local, room, confirmed,
|
|
751
|
+
function publish(local, room, confirmed, landing = {}) {
|
|
752
|
+
const { base, stored } = landing;
|
|
687
753
|
return exclusive(async () => {
|
|
688
754
|
if (!continuing())
|
|
689
755
|
return true;
|
|
@@ -700,7 +766,9 @@ export function composeRuntime(options) {
|
|
|
700
766
|
const accepted = pendings.get(batch.id)?.accepted;
|
|
701
767
|
return (accepted !== undefined && options.adapter.reached(room.locator, roomVersion, accepted));
|
|
702
768
|
});
|
|
703
|
-
const set = await settle(local, room.locator, prior, confirmed, queue.filter((batch) => !accepted.includes(batch)), { room: true });
|
|
769
|
+
const set = await settle(local, room.locator, prior, confirmed, queue.filter((batch) => !accepted.includes(batch)), { room: true, ...(stored === undefined ? {} : { stored }) });
|
|
770
|
+
if (stored !== undefined)
|
|
771
|
+
transfers.delete(room.locator);
|
|
704
772
|
for (const batch of accepted)
|
|
705
773
|
pendings.delete(batch.id);
|
|
706
774
|
stale.delete(room.locator);
|
|
@@ -740,6 +808,7 @@ export function composeRuntime(options) {
|
|
|
740
808
|
operations: room.operations,
|
|
741
809
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
742
810
|
providerLimits: limits,
|
|
811
|
+
handle: room.handle,
|
|
743
812
|
visible: replica.visible,
|
|
744
813
|
changes: parts.flatMap(({ changes }) => changes),
|
|
745
814
|
bases: parts.flatMap(({ bases }) => bases),
|
|
@@ -916,14 +985,33 @@ export function composeRuntime(options) {
|
|
|
916
985
|
throw error;
|
|
917
986
|
}
|
|
918
987
|
}
|
|
919
|
-
|
|
988
|
+
function staging(local) {
|
|
989
|
+
return {
|
|
990
|
+
held: (locator) => transfers.get(locator) ?? null,
|
|
991
|
+
staged: (record) => local.staged(record),
|
|
992
|
+
stage: (record, page) => exclusive(async () => {
|
|
993
|
+
if (!continuing())
|
|
994
|
+
return false;
|
|
995
|
+
await local.stage(record, page);
|
|
996
|
+
transfers.set(record.locator, record);
|
|
997
|
+
return true;
|
|
998
|
+
}),
|
|
999
|
+
abandon: (locator) => exclusive(async () => {
|
|
1000
|
+
if (!continuing())
|
|
1001
|
+
return;
|
|
1002
|
+
await local.abandon(locator);
|
|
1003
|
+
transfers.delete(locator);
|
|
1004
|
+
}),
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
async function pullBootstrap(authorized, room, local) {
|
|
920
1008
|
if (!continuing())
|
|
921
1009
|
return unconfirmed;
|
|
922
1010
|
try {
|
|
923
1011
|
const result = await bootstrapRoom(options.adapter, authorized, room, {
|
|
924
1012
|
collection: modelOf(room.locator),
|
|
925
1013
|
selection: modelOf(room.locator, 'typed-selection'),
|
|
926
|
-
}, (models, held) => remodel(room.locator, models, held), continuing);
|
|
1014
|
+
}, (models, held) => remodel(room.locator, models, held), continuing, staging(local));
|
|
927
1015
|
const detail = result.kind === 'staged' ? result.confirmed.record.roomVersion : result.kind;
|
|
928
1016
|
journal.record(`transfer bootstrap ${room.locator} ${detail}`);
|
|
929
1017
|
return result;
|
|
@@ -951,7 +1039,7 @@ export function composeRuntime(options) {
|
|
|
951
1039
|
return null;
|
|
952
1040
|
}
|
|
953
1041
|
if (refreshed.kind === 'advanced') {
|
|
954
|
-
if (!(await publish(local, room, refreshed.confirmed, held.confirmed))) {
|
|
1042
|
+
if (!(await publish(local, room, refreshed.confirmed, { base: held.confirmed }))) {
|
|
955
1043
|
const now = replicas.get(room.locator)?.confirmed.record.roomVersion;
|
|
956
1044
|
const reached = now !== undefined &&
|
|
957
1045
|
options.adapter.reached(room.locator, now, refreshed.confirmed.record.roomVersion);
|
|
@@ -963,12 +1051,12 @@ export function composeRuntime(options) {
|
|
|
963
1051
|
if (refreshed.kind !== 'beyond-horizon')
|
|
964
1052
|
return refreshed;
|
|
965
1053
|
}
|
|
966
|
-
const bootstrapped = await pullBootstrap(authorized, room);
|
|
1054
|
+
const bootstrapped = await pullBootstrap(authorized, room, local);
|
|
967
1055
|
if (!continuing())
|
|
968
1056
|
return unconfirmed;
|
|
969
1057
|
if (bootstrapped.kind !== 'staged')
|
|
970
1058
|
return bootstrapped;
|
|
971
|
-
await publish(local, room, bootstrapped.confirmed);
|
|
1059
|
+
await publish(local, room, bootstrapped.confirmed, { stored: bootstrapped.stored });
|
|
972
1060
|
return null;
|
|
973
1061
|
}
|
|
974
1062
|
async function withhold(withheld, room, local, progress) {
|
|
@@ -1033,7 +1121,7 @@ export function composeRuntime(options) {
|
|
|
1033
1121
|
logAccepted(room.locator, submitted, accepted);
|
|
1034
1122
|
const applied = options.adapter.reached(room.locator, held, accepted.roomVersion)
|
|
1035
1123
|
? { kind: 'staged', confirmed: current.confirmed }
|
|
1036
|
-
: applyReturned(current.confirmed, accepted.documents, accepted.revisions, accepted.removals, accepted.attachments, options.adapter.follows(room.locator, held, accepted.roomVersion)
|
|
1124
|
+
: applyReturned(current.confirmed, accepted.documents, accepted.revisions, accepted.changes, accepted.removals, accepted.attachments, options.adapter.follows(room.locator, held, accepted.roomVersion)
|
|
1037
1125
|
? accepted.roomVersion
|
|
1038
1126
|
: held, accepted.roomVersion);
|
|
1039
1127
|
if (applied.kind !== 'staged') {
|
|
@@ -1179,7 +1267,8 @@ export function composeRuntime(options) {
|
|
|
1179
1267
|
return;
|
|
1180
1268
|
}
|
|
1181
1269
|
const set = await settle(local, room.locator, current, current.confirmed, current.queue.filter((batch) => batch.id !== head.id), {
|
|
1182
|
-
leaving: result.kind === 'expired' && landed(head, current.confirmed)
|
|
1270
|
+
leaving: (result.kind === 'expired' && landed(head, current.confirmed)) ||
|
|
1271
|
+
(result.kind === 'conflicted' && landed(head, current.confirmed, result.affected))
|
|
1183
1272
|
? { ...left, returned: null }
|
|
1184
1273
|
: left,
|
|
1185
1274
|
});
|
|
@@ -1240,7 +1329,7 @@ export function composeRuntime(options) {
|
|
|
1240
1329
|
...(attached === 'collection' ? { model: next } : { selectionModel: next }),
|
|
1241
1330
|
};
|
|
1242
1331
|
const reclassified = sameMembership(declared, held.confirmed.record)
|
|
1243
|
-
?
|
|
1332
|
+
? { kind: 'staged', confirmed: confirmedOf(declared, held.confirmed) }
|
|
1244
1333
|
: readReclassified(declared, held.confirmed);
|
|
1245
1334
|
const record = reclassified.kind === 'staged'
|
|
1246
1335
|
? declared
|
|
@@ -1248,7 +1337,9 @@ export function composeRuntime(options) {
|
|
|
1248
1337
|
...declared,
|
|
1249
1338
|
typedSelection: held.confirmed.record.typedSelection,
|
|
1250
1339
|
};
|
|
1251
|
-
const read = reclassified.kind === 'deferred'
|
|
1340
|
+
const read = reclassified.kind === 'deferred'
|
|
1341
|
+
? { kind: 'staged', confirmed: confirmedOf(record, held.confirmed) }
|
|
1342
|
+
: reclassified;
|
|
1252
1343
|
await local.write({
|
|
1253
1344
|
next: record,
|
|
1254
1345
|
previous: held.confirmed.record,
|
|
@@ -1328,8 +1419,10 @@ export function composeRuntime(options) {
|
|
|
1328
1419
|
const outcome = prepared[index];
|
|
1329
1420
|
return outcome?.status === 'fulfilled' && outcome.value;
|
|
1330
1421
|
});
|
|
1331
|
-
if (attempt === 'opened')
|
|
1422
|
+
if (attempt === 'opened') {
|
|
1332
1423
|
options.adapter.roomStream?.hold(heldRooms(ready));
|
|
1424
|
+
handed = true;
|
|
1425
|
+
}
|
|
1333
1426
|
const loaded = await Promise.allSettled(ready
|
|
1334
1427
|
.filter((room) => attempt === 'unstreamed' || !replicas.has(room.locator))
|
|
1335
1428
|
.map((room) => loadRoom(room, local, progress)));
|
|
@@ -1395,14 +1488,14 @@ export function composeRuntime(options) {
|
|
|
1395
1488
|
async function reload(room, local, progress) {
|
|
1396
1489
|
if (discoveryPaused || authorization === undefined)
|
|
1397
1490
|
return;
|
|
1398
|
-
const bootstrapped = await pullBootstrap(authorization, room);
|
|
1491
|
+
const bootstrapped = await pullBootstrap(authorization, room, local);
|
|
1399
1492
|
if (!continuing())
|
|
1400
1493
|
return;
|
|
1401
1494
|
if (bootstrapped.kind !== 'staged') {
|
|
1402
1495
|
await withhold(bootstrapped, room, local, progress);
|
|
1403
1496
|
return;
|
|
1404
1497
|
}
|
|
1405
|
-
await publish(local, room, bootstrapped.confirmed);
|
|
1498
|
+
await publish(local, room, bootstrapped.confirmed, { stored: bootstrapped.stored });
|
|
1406
1499
|
await caughtUp(room, local, progress);
|
|
1407
1500
|
}
|
|
1408
1501
|
async function discoverRooms(local, progress, attempt) {
|
|
@@ -1432,9 +1525,6 @@ export function composeRuntime(options) {
|
|
|
1432
1525
|
}
|
|
1433
1526
|
progress.reachable = false;
|
|
1434
1527
|
progress.complete = false;
|
|
1435
|
-
if (attempt === 'opened') {
|
|
1436
|
-
options.adapter.roomStream?.hold(heldRooms([...discovered.values()]));
|
|
1437
|
-
}
|
|
1438
1528
|
notifyReady();
|
|
1439
1529
|
return;
|
|
1440
1530
|
}
|
|
@@ -1481,6 +1571,12 @@ export function composeRuntime(options) {
|
|
|
1481
1571
|
limits = result.providerLimits;
|
|
1482
1572
|
await local.declare(limits, capabilities);
|
|
1483
1573
|
}
|
|
1574
|
+
const signedIn = result.member ?? null;
|
|
1575
|
+
if (JSON.stringify(signedIn) !== JSON.stringify(member)) {
|
|
1576
|
+
await local.keepMember(signedIn);
|
|
1577
|
+
member = signedIn;
|
|
1578
|
+
emitMember();
|
|
1579
|
+
}
|
|
1484
1580
|
await applyDiscovery(result.rooms, local);
|
|
1485
1581
|
await synchronize(result.rooms, local, progress, attempt);
|
|
1486
1582
|
}
|
|
@@ -1513,6 +1609,7 @@ export function composeRuntime(options) {
|
|
|
1513
1609
|
complete = false;
|
|
1514
1610
|
recorded = false;
|
|
1515
1611
|
moveTo(transferring(status));
|
|
1612
|
+
handed = false;
|
|
1516
1613
|
try {
|
|
1517
1614
|
const local = await openLocal();
|
|
1518
1615
|
if (closed)
|
|
@@ -1524,16 +1621,22 @@ export function composeRuntime(options) {
|
|
|
1524
1621
|
}
|
|
1525
1622
|
catch {
|
|
1526
1623
|
progress.complete = false;
|
|
1527
|
-
if (attempt === 'opened')
|
|
1528
|
-
|
|
1529
|
-
}
|
|
1624
|
+
if (attempt === 'opened' && !handed)
|
|
1625
|
+
progress.reachable = false;
|
|
1530
1626
|
}
|
|
1531
1627
|
finally {
|
|
1532
1628
|
notifyReady();
|
|
1533
1629
|
}
|
|
1534
|
-
if (attempt
|
|
1630
|
+
if (attempt !== 'opened') {
|
|
1631
|
+
await finishOpening(progress);
|
|
1535
1632
|
return;
|
|
1536
|
-
|
|
1633
|
+
}
|
|
1634
|
+
if (handed || closed || progress.reachable)
|
|
1635
|
+
return;
|
|
1636
|
+
underway = null;
|
|
1637
|
+
journal.record('connection reopen');
|
|
1638
|
+
await rest(progress);
|
|
1639
|
+
options.adapter.roomStream?.reopen();
|
|
1537
1640
|
});
|
|
1538
1641
|
}
|
|
1539
1642
|
function closedSocket(revoked) {
|
|
@@ -1823,6 +1926,7 @@ export function composeRuntime(options) {
|
|
|
1823
1926
|
storageLossListeners.clear();
|
|
1824
1927
|
statusListeners.clear();
|
|
1825
1928
|
serviceModeListeners.clear();
|
|
1929
|
+
memberListeners.clear();
|
|
1826
1930
|
readSide.close();
|
|
1827
1931
|
queueSubscriptions.clear();
|
|
1828
1932
|
roomDraftListeners.clear();
|
|
@@ -1854,13 +1958,16 @@ export function composeRuntime(options) {
|
|
|
1854
1958
|
return planOf(input, roomFacts(reach), planReach(reach));
|
|
1855
1959
|
}
|
|
1856
1960
|
function watchPlan(plan, deliver) {
|
|
1961
|
+
materialize(reachedRooms(plan));
|
|
1857
1962
|
return readSide.watch(plan, identityOf(plan), deliver);
|
|
1858
1963
|
}
|
|
1859
1964
|
async function searched(input, reach) {
|
|
1860
1965
|
const plan = searchPlanOf(input);
|
|
1861
1966
|
const selected = plan.documents === undefined && reach === null
|
|
1862
1967
|
? null
|
|
1863
|
-
: (await
|
|
1968
|
+
: (await rowsQuery(filterOf(plan.documents ?? {}, roomFacts(reach), planReach(reach)))).documents;
|
|
1969
|
+
if (selected === null)
|
|
1970
|
+
materialize(null);
|
|
1864
1971
|
return searchIndex.search(reach === null || reach.conversations ? plan : { ...plan, conversations: [] }, selected);
|
|
1865
1972
|
}
|
|
1866
1973
|
const watch = (topic, input, deliver) => {
|
|
@@ -1940,6 +2047,13 @@ export function composeRuntime(options) {
|
|
|
1940
2047
|
serviceModeListeners.delete(deliver);
|
|
1941
2048
|
};
|
|
1942
2049
|
}
|
|
2050
|
+
if (topic === 'member') {
|
|
2051
|
+
memberListeners.add(deliver);
|
|
2052
|
+
deliver(member);
|
|
2053
|
+
return () => {
|
|
2054
|
+
memberListeners.delete(deliver);
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
1943
2057
|
if (topic === 'queue') {
|
|
1944
2058
|
const queue = { locator: input[0], notify: deliver };
|
|
1945
2059
|
queueSubscriptions.add(queue);
|
|
@@ -1957,7 +2071,7 @@ export function composeRuntime(options) {
|
|
|
1957
2071
|
rooms() {
|
|
1958
2072
|
return listed();
|
|
1959
2073
|
},
|
|
1960
|
-
query: ((input) =>
|
|
2074
|
+
query: ((input) => rowsQuery(planned(input, null))),
|
|
1961
2075
|
search: (input) => searched(input, null),
|
|
1962
2076
|
types(locator) {
|
|
1963
2077
|
return {
|
|
@@ -2084,7 +2198,7 @@ export function composeRuntime(options) {
|
|
|
2084
2198
|
md,
|
|
2085
2199
|
watch,
|
|
2086
2200
|
plan: planned,
|
|
2087
|
-
query: (plan) =>
|
|
2201
|
+
query: (plan) => rowsQuery(plan),
|
|
2088
2202
|
watchPlan,
|
|
2089
2203
|
search: searched,
|
|
2090
2204
|
};
|
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,EAA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AG,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,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AAc,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 & {
|
package/dist/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAItB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAItB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,kBAAkB,EACvB,KAAK,MAAM,EAGX,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,cAAc,EAGnB,KA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