@agentshouse/mdruntime 0.1.0-cb2e390ee7b89 → 0.1.0-cb9c79aee537a
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 +28 -28
- package/README.md +8 -8
- package/dist/adapter.d.ts +7 -6
- package/dist/adapter.d.ts.map +1 -1
- package/dist/bootstrap.js +1 -1
- 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/pieces.d.ts +51 -0
- package/dist/chat/pieces.d.ts.map +1 -0
- package/dist/chat/pieces.js +797 -0
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +3 -10
- package/dist/chat.d.ts +1 -1
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +1 -1
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/collection.d.ts +4 -3
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +128 -63
- package/dist/connection.d.ts +6 -3
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +124 -121
- package/dist/conversation.d.ts +1 -0
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +49 -29
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +2 -1
- package/dist/host.d.ts +0 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +4 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/memory.d.ts +2 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +7 -9
- package/dist/overlay.d.ts +1 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +7 -3
- package/dist/query.d.ts +5 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +5 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +10 -0
- package/dist/react.d.ts +1 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -14
- package/dist/read-side.d.ts +3 -1
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +87 -24
- package/dist/refresh.js +1 -1
- package/dist/replica.d.ts +5 -4
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +35 -25
- package/dist/rows.d.ts +1 -0
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +5 -0
- package/dist/save.d.ts +2 -1
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +25 -19
- package/dist/shared.d.ts +3 -0
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +58 -32
- package/dist/store.d.ts +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +2 -6
- package/dist/turn.d.ts +5 -3
- package/dist/turn.d.ts.map +1 -1
- package/dist/turn.js +25 -6
- package/dist/windows.d.ts +8 -0
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +13 -0
- package/dist/wire.d.ts +8 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +2 -0
- package/package.json +2 -2
- package/dist/acquisition.d.ts +0 -14
- package/dist/acquisition.d.ts.map +0 -1
- package/dist/acquisition.js +0 -24
package/dist/connection.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createReadSide } from './read-side.js';
|
|
|
6
6
|
import { seededResult } from './seed.js';
|
|
7
7
|
import { markdownPath, roomOfKey } from './rows.js';
|
|
8
8
|
import { createSearchIndex, searchPlanOf, } from './search.js';
|
|
9
|
+
import { capped, MAXIMUM_WINDOW } from './windows.js';
|
|
9
10
|
import { bootstrapRoom } from './bootstrap.js';
|
|
10
11
|
import { changeSet, entering, mergeChangeSets } from './change-set.js';
|
|
11
12
|
import { createConversationStore, } from './conversation.js';
|
|
@@ -20,10 +21,9 @@ import { doorReads } from './reads.js';
|
|
|
20
21
|
import { refreshRoom } from './refresh.js';
|
|
21
22
|
import { buildBatch, joined, limitedIn, queuedDocuments, requeued, } from './save.js';
|
|
22
23
|
import { applyReturned, compositionOf, confirmedOf, landed, readReclassified, replicaOf, sameMembership, standing, } from './replica.js';
|
|
23
|
-
import { binaryBase, changedParts, changesOf, held, heldFile, joinedDraft, readParts, returnedBy, returnedInto, staleWrite, underneath, withdrawnDrafts, } from './room-draft.js';
|
|
24
|
+
import { binaryBase, changedParts, changesOf, held, heldFile, joinedDraft, moveTarget, readParts, returnedBy, returnedInto, staleWrite, underneath, withdrawnDrafts, } from './room-draft.js';
|
|
24
25
|
import { same, saving, STARTING, transferring, } from './status.js';
|
|
25
26
|
import { detectStorageLoss, nextGeneration } from './durability.js';
|
|
26
|
-
import { demanded, narrower, WHOLE_DEMAND, wider } from './acquisition.js';
|
|
27
27
|
import { readinessOf, SETTLED_ROOMS, } from './readiness.js';
|
|
28
28
|
import { FencedMap } from './fence.js';
|
|
29
29
|
import { tally } from './shared.js';
|
|
@@ -164,6 +164,7 @@ export function composeRuntime(options) {
|
|
|
164
164
|
let discovering = null;
|
|
165
165
|
let opened = null;
|
|
166
166
|
const owed = new Set();
|
|
167
|
+
const reloadsDue = new Map();
|
|
167
168
|
const lanes = new Map();
|
|
168
169
|
let roomReads = { generation, free: ROOM_READS, waiting: [] };
|
|
169
170
|
const working = new Set();
|
|
@@ -190,8 +191,6 @@ export function composeRuntime(options) {
|
|
|
190
191
|
const unpreparedDemand = new Set();
|
|
191
192
|
const unindexable = new Set();
|
|
192
193
|
let preparing = false;
|
|
193
|
-
let demand = WHOLE_DEMAND;
|
|
194
|
-
let narrowing = null;
|
|
195
194
|
let targets = {};
|
|
196
195
|
let persistence = options.shell.persistence;
|
|
197
196
|
let capacity = null;
|
|
@@ -208,7 +207,7 @@ export function composeRuntime(options) {
|
|
|
208
207
|
durably,
|
|
209
208
|
stream: () => options.adapter.conversations,
|
|
210
209
|
publish: publishChangeSet,
|
|
211
|
-
online: () =>
|
|
210
|
+
online: () => connectionOf() !== 'unreachable' && refusal === null,
|
|
212
211
|
closed: () => closed,
|
|
213
212
|
unanswered: resendLater,
|
|
214
213
|
expired: (operation) => pastHorizon(operation),
|
|
@@ -394,7 +393,7 @@ export function composeRuntime(options) {
|
|
|
394
393
|
if (closed)
|
|
395
394
|
return;
|
|
396
395
|
queueReadiness();
|
|
397
|
-
const next = status.state === 'synced' &&
|
|
396
|
+
const next = status.state === 'synced' && !conversations.current()
|
|
398
397
|
? { ...status, state: 'syncing' }
|
|
399
398
|
: status;
|
|
400
399
|
if (same(shown, next))
|
|
@@ -427,8 +426,12 @@ export function composeRuntime(options) {
|
|
|
427
426
|
...set,
|
|
428
427
|
documents: set.documents.filter(({ locator }) => prepared.has(locator) || projecting.has(locator)),
|
|
429
428
|
};
|
|
430
|
-
readSide.apply(held);
|
|
431
|
-
|
|
429
|
+
const applied = readSide.apply(held, () => searchIndex.changed(held));
|
|
430
|
+
if (applied instanceof Promise)
|
|
431
|
+
void applied.catch(unpublished);
|
|
432
|
+
}
|
|
433
|
+
function unpublished(error) {
|
|
434
|
+
journal.record(`publication failed ${error instanceof Error ? error.name : 'unknown'}`);
|
|
432
435
|
}
|
|
433
436
|
async function referenced(locator) {
|
|
434
437
|
for (;;) {
|
|
@@ -459,8 +462,8 @@ export function composeRuntime(options) {
|
|
|
459
462
|
if (current === undefined || closed)
|
|
460
463
|
return;
|
|
461
464
|
const set = entering(locator, current, chunk);
|
|
462
|
-
readSide.apply(set);
|
|
463
465
|
entered.push(set);
|
|
466
|
+
return readSide.apply(set);
|
|
464
467
|
});
|
|
465
468
|
if (!replicas.has(locator) || closed)
|
|
466
469
|
return;
|
|
@@ -553,65 +556,6 @@ export function composeRuntime(options) {
|
|
|
553
556
|
if (waiting.length > 0)
|
|
554
557
|
prepare(waiting.map(({ room }) => room));
|
|
555
558
|
}
|
|
556
|
-
function acquires(room) {
|
|
557
|
-
return (demanded(demand, room) ||
|
|
558
|
-
(replicas.get(room.locator)?.queue.length ?? 0) > 0 ||
|
|
559
|
-
queuesWithoutReplica.has(room.locator));
|
|
560
|
-
}
|
|
561
|
-
function acquiredLocators() {
|
|
562
|
-
return [...discovered.values()]
|
|
563
|
-
.filter(acquires)
|
|
564
|
-
.map((room) => room.locator)
|
|
565
|
-
.sort();
|
|
566
|
-
}
|
|
567
|
-
function heldLocators(acquired) {
|
|
568
|
-
return demand.whole ? acquired : [...new Set([...acquired, ...demand.rooms])].sort();
|
|
569
|
-
}
|
|
570
|
-
function heldDemand(acquired) {
|
|
571
|
-
if (demand.whole)
|
|
572
|
-
return null;
|
|
573
|
-
return {
|
|
574
|
-
rooms: heldLocators(acquired.map((room) => room.locator)),
|
|
575
|
-
conversations: demand.conversations,
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
function applyDemand(next) {
|
|
579
|
-
const before = heldLocators(acquiredLocators());
|
|
580
|
-
const { whole, conversations: conversed } = demand;
|
|
581
|
-
demand = next;
|
|
582
|
-
const after = heldLocators(acquiredLocators());
|
|
583
|
-
queueReadiness();
|
|
584
|
-
if (!conversed && next.conversations)
|
|
585
|
-
scheduleCurrency();
|
|
586
|
-
if (JSON.stringify(before) === JSON.stringify(after) &&
|
|
587
|
-
whole === next.whole &&
|
|
588
|
-
conversed === next.conversations)
|
|
589
|
-
return;
|
|
590
|
-
journal.record(`acquisition ${next.whole ? 'whole' : after.length}`);
|
|
591
|
-
if (options.adapter.roomStream === undefined)
|
|
592
|
-
void sync('unstreamed');
|
|
593
|
-
else if (socketOpen)
|
|
594
|
-
options.adapter.roomStream.reopen();
|
|
595
|
-
}
|
|
596
|
-
function acquire(next) {
|
|
597
|
-
if (closed)
|
|
598
|
-
return;
|
|
599
|
-
if (narrowing !== null)
|
|
600
|
-
clearTimeout(narrowing);
|
|
601
|
-
narrowing = null;
|
|
602
|
-
const widening = wider(next, demand);
|
|
603
|
-
if (!widening && !narrower(next, demand))
|
|
604
|
-
return;
|
|
605
|
-
if (widening || !roomsListed) {
|
|
606
|
-
applyDemand(next);
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
// A narrower demand waits five seconds, so a tab that reloads returns before the stream reopens twice.
|
|
610
|
-
narrowing = setTimeout(() => {
|
|
611
|
-
narrowing = null;
|
|
612
|
-
applyDemand(next);
|
|
613
|
-
}, 5_000);
|
|
614
|
-
}
|
|
615
559
|
function requiredRooms(reach) {
|
|
616
560
|
if (reach === null)
|
|
617
561
|
return { listed: roomsListed, rooms: [...rooms.keys()].sort() };
|
|
@@ -809,10 +753,7 @@ export function composeRuntime(options) {
|
|
|
809
753
|
void sync('unstreamed');
|
|
810
754
|
}
|
|
811
755
|
async function reclaimed(local) {
|
|
812
|
-
const unreferenced = [...transfers.keys()].filter((locator) =>
|
|
813
|
-
const room = discovered.get(locator);
|
|
814
|
-
return room === undefined || !acquires(room);
|
|
815
|
-
});
|
|
756
|
+
const unreferenced = [...transfers.keys()].filter((locator) => !discovered.has(locator));
|
|
816
757
|
for (const locator of unreferenced) {
|
|
817
758
|
await local.abandon(locator);
|
|
818
759
|
transfers.delete(locator);
|
|
@@ -1029,7 +970,7 @@ export function composeRuntime(options) {
|
|
|
1029
970
|
refusal: scopedRefusals.get(room.locator) ?? sourceRefusals.get(room.locator) ?? null,
|
|
1030
971
|
});
|
|
1031
972
|
}
|
|
1032
|
-
async function applyDiscovery(found, started) {
|
|
973
|
+
async function applyDiscovery(found, started, covered) {
|
|
1033
974
|
for (const room of found) {
|
|
1034
975
|
const fence = fences.get(room.locator);
|
|
1035
976
|
if (fence !== undefined && fence.erased && fence.at < started)
|
|
@@ -1042,10 +983,14 @@ export function composeRuntime(options) {
|
|
|
1042
983
|
const listedLocators = new Set(listed.map((room) => room.locator));
|
|
1043
984
|
for (const locator of listedLocators)
|
|
1044
985
|
scopedRefusals.delete(locator);
|
|
1045
|
-
|
|
986
|
+
if (covered === undefined)
|
|
987
|
+
discovered.clear();
|
|
988
|
+
else
|
|
989
|
+
for (const locator of covered)
|
|
990
|
+
discovered.delete(locator);
|
|
1046
991
|
for (const room of listed)
|
|
1047
992
|
discovered.set(room.locator, room);
|
|
1048
|
-
const unlisted = unlistedHeld(new Set(found.map((room) => room.locator)));
|
|
993
|
+
const unlisted = unlistedHeld(new Set(found.map((room) => room.locator))).filter((locator) => covered === undefined || covered.includes(locator));
|
|
1049
994
|
if (options.adapter.exhaustiveDiscovery === true)
|
|
1050
995
|
await loseRooms(unlisted);
|
|
1051
996
|
else
|
|
@@ -1460,7 +1405,7 @@ export function composeRuntime(options) {
|
|
|
1460
1405
|
return true;
|
|
1461
1406
|
});
|
|
1462
1407
|
}
|
|
1463
|
-
async function
|
|
1408
|
+
async function savedRoom(locator) {
|
|
1464
1409
|
const local = await openLocal();
|
|
1465
1410
|
await referenced(locator);
|
|
1466
1411
|
const replica = replicas.get(locator);
|
|
@@ -1468,6 +1413,10 @@ export function composeRuntime(options) {
|
|
|
1468
1413
|
if (replica === undefined || room === undefined) {
|
|
1469
1414
|
throw runtimeError('room-not-held', `No Local Replica for ${locator}`);
|
|
1470
1415
|
}
|
|
1416
|
+
return { local, replica, room };
|
|
1417
|
+
}
|
|
1418
|
+
async function saveRoomDrafts(locator, named, writtenBy) {
|
|
1419
|
+
const target = await savedRoom(locator);
|
|
1471
1420
|
const saved = [];
|
|
1472
1421
|
for (const { path, revision } of named) {
|
|
1473
1422
|
const record = roomDrafts.get(locator)?.get(path);
|
|
@@ -1477,6 +1426,38 @@ export function composeRuntime(options) {
|
|
|
1477
1426
|
if (!saved.some((draft) => draft.path === path))
|
|
1478
1427
|
saved.push({ path, parts: record.parts });
|
|
1479
1428
|
}
|
|
1429
|
+
return committed(locator, target, saved, new Set(saved.map(({ path }) => path)), writtenBy);
|
|
1430
|
+
}
|
|
1431
|
+
async function saveParts(locator, named, writtenBy) {
|
|
1432
|
+
const read = named.map(({ path, parts }) => ({ path, parts: readParts(parts) }));
|
|
1433
|
+
if (read.some(({ path }, at) => path === '' ||
|
|
1434
|
+
normalize(path) !== path ||
|
|
1435
|
+
read.findIndex((one) => one.path === path) !== at)) {
|
|
1436
|
+
throw runtimeError('room-draft-malformed');
|
|
1437
|
+
}
|
|
1438
|
+
const target = await savedRoom(locator);
|
|
1439
|
+
const saved = [];
|
|
1440
|
+
for (const { path, parts } of read) {
|
|
1441
|
+
const file = parts.file === undefined
|
|
1442
|
+
? undefined
|
|
1443
|
+
: await heldFile(parts.file.blob, binaryBase(target.replica.visible, path));
|
|
1444
|
+
saved.push({ path, parts: held(undefined, parts, file) });
|
|
1445
|
+
}
|
|
1446
|
+
return committed(locator, target, saved, new Set(), writtenBy);
|
|
1447
|
+
}
|
|
1448
|
+
function carriedDrafts(locator, saved, consumed) {
|
|
1449
|
+
const holding = roomDrafts.get(locator);
|
|
1450
|
+
return new Map(saved.flatMap(({ path, parts }) => {
|
|
1451
|
+
const record = holding?.get(path);
|
|
1452
|
+
if (parts.move === undefined || record === undefined || consumed.has(path))
|
|
1453
|
+
return [];
|
|
1454
|
+
const to = moveTarget(parts.move);
|
|
1455
|
+
if (to === path || holding?.has(to) === true)
|
|
1456
|
+
return [];
|
|
1457
|
+
return [[path, { ...record, path: to, revision: roomDraftRevision() }]];
|
|
1458
|
+
}));
|
|
1459
|
+
}
|
|
1460
|
+
async function committed(locator, { local, replica, room }, saved, consumed, writtenBy) {
|
|
1480
1461
|
const changed = saved.flatMap(({ path, parts }) => changedParts(path, underneath(parts, path, replica.visible)));
|
|
1481
1462
|
if (changed.length > 0)
|
|
1482
1463
|
return { outcome: 'refused', code: 'changed-underneath', retryable: false, parts: changed };
|
|
@@ -1518,7 +1499,7 @@ export function composeRuntime(options) {
|
|
|
1518
1499
|
},
|
|
1519
1500
|
};
|
|
1520
1501
|
const checked = withdrawing
|
|
1521
|
-
? buildBatch({ ...input, queued: new Set([...input.queued, ...requeue.queued]) })
|
|
1502
|
+
? await buildBatch({ ...input, queued: new Set([...input.queued, ...requeue.queued]) })
|
|
1522
1503
|
: null;
|
|
1523
1504
|
if (checked?.kind === 'refused')
|
|
1524
1505
|
return { outcome: 'refused', ...checked.refusal };
|
|
@@ -1535,10 +1516,10 @@ export function composeRuntime(options) {
|
|
|
1535
1516
|
};
|
|
1536
1517
|
}
|
|
1537
1518
|
const built = !withdrawing
|
|
1538
|
-
? buildBatch(input)
|
|
1519
|
+
? await buildBatch(input)
|
|
1539
1520
|
: requeue.changes.length === 0
|
|
1540
1521
|
? null
|
|
1541
|
-
: buildBatch({
|
|
1522
|
+
: await buildBatch({
|
|
1542
1523
|
...input,
|
|
1543
1524
|
visible: replicaOf(replica.confirmed, requeue.queue, replica).visible,
|
|
1544
1525
|
changes: requeue.changes,
|
|
@@ -1577,13 +1558,16 @@ export function composeRuntime(options) {
|
|
|
1577
1558
|
if (limited !== null)
|
|
1578
1559
|
return { outcome: 'refused', ...limited };
|
|
1579
1560
|
}
|
|
1580
|
-
const
|
|
1561
|
+
const carried = carriedDrafts(locator, saved, consumed);
|
|
1562
|
+
const left = [...consumed, ...carried.keys()];
|
|
1563
|
+
const arrived = [...carried.values()];
|
|
1581
1564
|
try {
|
|
1582
1565
|
await local.keepAuthored({
|
|
1583
1566
|
locator,
|
|
1584
1567
|
queue: batches,
|
|
1585
1568
|
saved: drafted,
|
|
1586
|
-
consumedRoomDrafts:
|
|
1569
|
+
consumedRoomDrafts: left,
|
|
1570
|
+
roomDrafts: arrived,
|
|
1587
1571
|
});
|
|
1588
1572
|
}
|
|
1589
1573
|
catch {
|
|
@@ -1598,12 +1582,14 @@ export function composeRuntime(options) {
|
|
|
1598
1582
|
}
|
|
1599
1583
|
if (!localSaves)
|
|
1600
1584
|
recorded = false;
|
|
1601
|
-
for (const path of
|
|
1585
|
+
for (const path of left)
|
|
1602
1586
|
forgetRoomDraft(locator, path);
|
|
1587
|
+
for (const record of arrived)
|
|
1588
|
+
rememberRoomDraft(record);
|
|
1603
1589
|
replicas.set(locator, replicaOf(replica.confirmed, batches, replica));
|
|
1604
1590
|
publishChangeSet(changeSet(locator, replica, replicas.get(locator) ?? null, {
|
|
1605
1591
|
queue: true,
|
|
1606
|
-
drafts:
|
|
1592
|
+
drafts: [...left, ...arrived.map(({ path }) => path)],
|
|
1607
1593
|
}));
|
|
1608
1594
|
moveTo({ ...(localSaves ? status : saving(status)), ...attention() });
|
|
1609
1595
|
submitLater(locator);
|
|
@@ -2050,6 +2036,8 @@ export function composeRuntime(options) {
|
|
|
2050
2036
|
readSide.recover();
|
|
2051
2037
|
return unconfirmed;
|
|
2052
2038
|
}
|
|
2039
|
+
if (reloadsDue.get(room.locator) === generation)
|
|
2040
|
+
return unconfirmed;
|
|
2053
2041
|
}
|
|
2054
2042
|
const bootstrapped = await pullBootstrap(authorized, room, local, live);
|
|
2055
2043
|
if (!live())
|
|
@@ -2141,7 +2129,7 @@ export function composeRuntime(options) {
|
|
|
2141
2129
|
logAccepted(room.locator, submitted, accepted);
|
|
2142
2130
|
const applied = options.adapter.reached(room.locator, held, accepted.roomVersion)
|
|
2143
2131
|
? { kind: 'staged', confirmed: current.confirmed }
|
|
2144
|
-
: applyReturned(current.confirmed, submitted, accepted, options.adapter.follows(room.locator, held, accepted.roomVersion)
|
|
2132
|
+
: await applyReturned(current.confirmed, submitted, accepted, options.adapter.follows(room.locator, held, accepted.roomVersion)
|
|
2145
2133
|
? accepted.roomVersion
|
|
2146
2134
|
: held, accepted.roomVersion);
|
|
2147
2135
|
if (applied.kind !== 'staged') {
|
|
@@ -2413,7 +2401,7 @@ export function composeRuntime(options) {
|
|
|
2413
2401
|
};
|
|
2414
2402
|
const reclassified = sameMembership(declared, held.confirmed.record)
|
|
2415
2403
|
? { kind: 'staged', confirmed: confirmedOf(declared, held.confirmed) }
|
|
2416
|
-
: readReclassified(declared, held.confirmed);
|
|
2404
|
+
: await readReclassified(declared, held.confirmed);
|
|
2417
2405
|
const record = reclassified.kind === 'staged'
|
|
2418
2406
|
? declared
|
|
2419
2407
|
: {
|
|
@@ -2501,16 +2489,15 @@ export function composeRuntime(options) {
|
|
|
2501
2489
|
});
|
|
2502
2490
|
}
|
|
2503
2491
|
async function synchronize(listed, local, progress, attempt, live) {
|
|
2504
|
-
const
|
|
2505
|
-
const prepared = await Promise.allSettled(acquired.map((room) => prepareRoom(room, local, progress)));
|
|
2492
|
+
const prepared = await Promise.allSettled(listed.map((room) => prepareRoom(room, local, progress)));
|
|
2506
2493
|
if (!live())
|
|
2507
2494
|
return;
|
|
2508
|
-
const ready =
|
|
2495
|
+
const ready = listed.filter((_, index) => {
|
|
2509
2496
|
const outcome = prepared[index];
|
|
2510
2497
|
return outcome?.status === 'fulfilled' && outcome.value;
|
|
2511
2498
|
});
|
|
2512
2499
|
if (attempt === 'opened') {
|
|
2513
|
-
options.adapter.roomStream?.hold(heldRooms(ready)
|
|
2500
|
+
options.adapter.roomStream?.hold(heldRooms(ready));
|
|
2514
2501
|
handed = true;
|
|
2515
2502
|
}
|
|
2516
2503
|
discovering?.release();
|
|
@@ -2569,6 +2556,8 @@ export function composeRuntime(options) {
|
|
|
2569
2556
|
}
|
|
2570
2557
|
async function reload(room, local, progress, live) {
|
|
2571
2558
|
try {
|
|
2559
|
+
if (live())
|
|
2560
|
+
reloadsDue.delete(room.locator);
|
|
2572
2561
|
if (!live() || authorization === undefined)
|
|
2573
2562
|
return;
|
|
2574
2563
|
const bootstrapped = await pullBootstrap(authorization, room, local, live);
|
|
@@ -2585,7 +2574,7 @@ export function composeRuntime(options) {
|
|
|
2585
2574
|
caughtUpTo(room.locator);
|
|
2586
2575
|
}
|
|
2587
2576
|
}
|
|
2588
|
-
async function discoverRooms(local, progress, attempt, live) {
|
|
2577
|
+
async function discoverRooms(local, progress, attempt, live, scope) {
|
|
2589
2578
|
if (closed || authorization === undefined) {
|
|
2590
2579
|
notifyReady();
|
|
2591
2580
|
return;
|
|
@@ -2595,7 +2584,7 @@ export function composeRuntime(options) {
|
|
|
2595
2584
|
const started = discoveries;
|
|
2596
2585
|
let result;
|
|
2597
2586
|
try {
|
|
2598
|
-
result = await options.adapter.discover(authorization);
|
|
2587
|
+
result = await options.adapter.discover(authorization, scope);
|
|
2599
2588
|
}
|
|
2600
2589
|
catch {
|
|
2601
2590
|
result = { kind: 'transport-uncertainty' };
|
|
@@ -2672,7 +2661,7 @@ export function composeRuntime(options) {
|
|
|
2672
2661
|
member = signedIn;
|
|
2673
2662
|
emitMember();
|
|
2674
2663
|
}
|
|
2675
|
-
await synchronize(await applyDiscovery(result.rooms, started), local, progress, attempt, live);
|
|
2664
|
+
await synchronize(await applyDiscovery(result.rooms, started, result.covered), local, progress, attempt, live);
|
|
2676
2665
|
}
|
|
2677
2666
|
async function ensureAuthorization() {
|
|
2678
2667
|
if (authorization !== undefined)
|
|
@@ -2769,7 +2758,7 @@ export function composeRuntime(options) {
|
|
|
2769
2758
|
options.adapter.roomStream?.reopen();
|
|
2770
2759
|
});
|
|
2771
2760
|
}
|
|
2772
|
-
function rediscover() {
|
|
2761
|
+
function rediscover(scope) {
|
|
2773
2762
|
return task(OPENING_LANE, async (live) => {
|
|
2774
2763
|
if (!live() || !socketOpen)
|
|
2775
2764
|
return;
|
|
@@ -2783,7 +2772,7 @@ export function composeRuntime(options) {
|
|
|
2783
2772
|
await ensureAuthorization();
|
|
2784
2773
|
if (!live())
|
|
2785
2774
|
return;
|
|
2786
|
-
await discoverRooms(local, progress, 'authorized', live);
|
|
2775
|
+
await discoverRooms(local, progress, 'authorized', live, scope);
|
|
2787
2776
|
}
|
|
2788
2777
|
catch {
|
|
2789
2778
|
progress.complete = false;
|
|
@@ -2822,9 +2811,10 @@ export function composeRuntime(options) {
|
|
|
2822
2811
|
function applyOpening(expired) {
|
|
2823
2812
|
const progress = underway?.generation === generation ? underway.progress : null;
|
|
2824
2813
|
const cycle = progress ?? { complete: true, reachable: true };
|
|
2825
|
-
const replacing = reloadNow((room) => expired.includes(room.locator), cycle);
|
|
2826
2814
|
if (opened === generation)
|
|
2827
2815
|
opened = null;
|
|
2816
|
+
const reloading = progress === null ? [] : owedReloads(expired);
|
|
2817
|
+
const replacing = reloadNow((room) => expired.includes(room.locator) || reloading.includes(room.locator), cycle);
|
|
2828
2818
|
return task(OPENING_LANE, async (live) => {
|
|
2829
2819
|
underway = null;
|
|
2830
2820
|
if (!live())
|
|
@@ -2834,24 +2824,17 @@ export function composeRuntime(options) {
|
|
|
2834
2824
|
await rest(cycle, live);
|
|
2835
2825
|
return;
|
|
2836
2826
|
}
|
|
2837
|
-
await roomsCarried(expired);
|
|
2827
|
+
await roomsCarried([...expired, ...reloading]);
|
|
2838
2828
|
if (!live())
|
|
2839
2829
|
return;
|
|
2840
|
-
const replaced = new Set(owed);
|
|
2841
|
-
owed.clear();
|
|
2842
2830
|
try {
|
|
2843
2831
|
const local = await openLocal();
|
|
2844
|
-
const
|
|
2845
|
-
const reloading = held.filter((room) => !expired.includes(room.locator) &&
|
|
2846
|
-
(replaced.has(room.locator) || revoked(room.locator)));
|
|
2847
|
-
for (const room of reloading)
|
|
2848
|
-
catching.add(room.locator);
|
|
2849
|
-
readSide.recover();
|
|
2850
|
-
const reloads = Promise.allSettled(reloading.map((room) => roomTask(room.locator, (current) => reload(room, local, progress, current))));
|
|
2851
|
-
const reloaded = [...(await reloads), ...(await replacing)];
|
|
2832
|
+
const reloaded = await replacing;
|
|
2852
2833
|
if (progress.reachable) {
|
|
2853
|
-
for (const room of
|
|
2854
|
-
if (
|
|
2834
|
+
for (const room of discovered.values()) {
|
|
2835
|
+
if (replicas.has(room.locator) &&
|
|
2836
|
+
!expired.includes(room.locator) &&
|
|
2837
|
+
!reloading.includes(room.locator)) {
|
|
2855
2838
|
await confirmModels(room, local);
|
|
2856
2839
|
}
|
|
2857
2840
|
}
|
|
@@ -2868,14 +2851,29 @@ export function composeRuntime(options) {
|
|
|
2868
2851
|
await finishOpening(progress, live);
|
|
2869
2852
|
});
|
|
2870
2853
|
}
|
|
2854
|
+
function owedReloads(expired) {
|
|
2855
|
+
const reloading = [...discovered.values()]
|
|
2856
|
+
.filter((room) => replicas.has(room.locator) &&
|
|
2857
|
+
!expired.includes(room.locator) &&
|
|
2858
|
+
(owed.has(room.locator) || revoked(room.locator)))
|
|
2859
|
+
.map((room) => room.locator);
|
|
2860
|
+
owed.clear();
|
|
2861
|
+
for (const locator of reloading)
|
|
2862
|
+
catching.add(locator);
|
|
2863
|
+
readSide.recover();
|
|
2864
|
+
return reloading;
|
|
2865
|
+
}
|
|
2871
2866
|
async function reloadNow(replaced, progress) {
|
|
2867
|
+
const reloaded = [...discovered.values()].filter((room) => replicas.has(room.locator) && replaced(room));
|
|
2868
|
+
for (const room of reloaded)
|
|
2869
|
+
reloadsDue.set(room.locator, generation);
|
|
2872
2870
|
try {
|
|
2873
2871
|
const local = await openLocal();
|
|
2874
|
-
return await Promise.allSettled(
|
|
2875
|
-
.filter((room) => replicas.has(room.locator) && replaced(room))
|
|
2876
|
-
.map((room) => roomTask(room.locator, (live) => reload(room, local, progress, live))));
|
|
2872
|
+
return await Promise.allSettled(reloaded.map((room) => roomTask(room.locator, (live) => reload(room, local, progress, live))));
|
|
2877
2873
|
}
|
|
2878
2874
|
catch {
|
|
2875
|
+
for (const room of reloaded)
|
|
2876
|
+
reloadsDue.delete(room.locator);
|
|
2879
2877
|
progress.reachable = false;
|
|
2880
2878
|
return [];
|
|
2881
2879
|
}
|
|
@@ -3001,8 +2999,7 @@ export function composeRuntime(options) {
|
|
|
3001
2999
|
if (status.providerUnreachable)
|
|
3002
3000
|
conversations.reconnected();
|
|
3003
3001
|
const reading = { complete: true, reachable: true };
|
|
3004
|
-
|
|
3005
|
-
await conversations.catchUp(reading);
|
|
3002
|
+
await conversations.catchUp(reading);
|
|
3006
3003
|
if (progress.reachable && reading.reachable)
|
|
3007
3004
|
await conversations.resend(reading);
|
|
3008
3005
|
if (progress.reachable)
|
|
@@ -3067,7 +3064,7 @@ export function composeRuntime(options) {
|
|
|
3067
3064
|
return;
|
|
3068
3065
|
const room = discovered.get(locator);
|
|
3069
3066
|
const held = replicas.get(locator);
|
|
3070
|
-
if (room === undefined || room.replica.admission !== 'admitted'
|
|
3067
|
+
if (room === undefined || room.replica.admission !== 'admitted')
|
|
3071
3068
|
return;
|
|
3072
3069
|
if (held !== undefined &&
|
|
3073
3070
|
(held.confirmed.record.replica.selection !== room.replica.selection ||
|
|
@@ -3129,7 +3126,7 @@ export function composeRuntime(options) {
|
|
|
3129
3126
|
else if (event.kind === 'opening')
|
|
3130
3127
|
void applyOpening(event.expired);
|
|
3131
3128
|
else if (event.kind === 'authority-changed')
|
|
3132
|
-
void rediscover();
|
|
3129
|
+
void rediscover(event.scope);
|
|
3133
3130
|
else
|
|
3134
3131
|
void applyRoom(event.locator, event.roomVersion);
|
|
3135
3132
|
}, receipts);
|
|
@@ -3184,7 +3181,7 @@ export function composeRuntime(options) {
|
|
|
3184
3181
|
if (!live())
|
|
3185
3182
|
return;
|
|
3186
3183
|
await conversations.reconcile();
|
|
3187
|
-
if (conversations.current()
|
|
3184
|
+
if (conversations.current()) {
|
|
3188
3185
|
show();
|
|
3189
3186
|
return;
|
|
3190
3187
|
}
|
|
@@ -3202,8 +3199,6 @@ export function composeRuntime(options) {
|
|
|
3202
3199
|
if (closed)
|
|
3203
3200
|
return;
|
|
3204
3201
|
closed = true;
|
|
3205
|
-
if (narrowing !== null)
|
|
3206
|
-
clearTimeout(narrowing);
|
|
3207
3202
|
if (rechecking !== null)
|
|
3208
3203
|
clearInterval(rechecking);
|
|
3209
3204
|
readinessWatches.clear();
|
|
@@ -3251,7 +3246,11 @@ export function composeRuntime(options) {
|
|
|
3251
3246
|
if (options.adapter.roomStream === undefined)
|
|
3252
3247
|
void sync('unstreamed');
|
|
3253
3248
|
function planned(input, reach) {
|
|
3254
|
-
|
|
3249
|
+
const plan = planOf(input, roomFacts(reach), planReach(reach));
|
|
3250
|
+
const named = plan.paths !== null &&
|
|
3251
|
+
plan.rooms !== null &&
|
|
3252
|
+
plan.paths.length * plan.rooms.length <= MAXIMUM_WINDOW;
|
|
3253
|
+
return plan.limit === null && named ? plan : { ...plan, limit: capped(plan.limit) };
|
|
3255
3254
|
}
|
|
3256
3255
|
function watchPlan(plan, deliver) {
|
|
3257
3256
|
let seeded = false;
|
|
@@ -3288,7 +3287,8 @@ export function composeRuntime(options) {
|
|
|
3288
3287
|
};
|
|
3289
3288
|
}
|
|
3290
3289
|
async function searched(input, reach) {
|
|
3291
|
-
const
|
|
3290
|
+
const asked = searchPlanOf(input);
|
|
3291
|
+
const plan = { ...asked, limit: capped(asked.limit) };
|
|
3292
3292
|
const filter = filterOf(plan.documents ?? {}, roomFacts(reach), planReach(reach));
|
|
3293
3293
|
for (;;) {
|
|
3294
3294
|
const cover = covered(filter);
|
|
@@ -3327,6 +3327,7 @@ export function composeRuntime(options) {
|
|
|
3327
3327
|
if ('pending' in answered)
|
|
3328
3328
|
continue;
|
|
3329
3329
|
const searchedConversations = named.filter((one) => searchIndex.conversations().has(one));
|
|
3330
|
+
await readSide.settled();
|
|
3330
3331
|
const seen = searchIndex.changes();
|
|
3331
3332
|
await searchIndex.caughtUp();
|
|
3332
3333
|
const selected = roomsAlone(answering) ? null : await rowsQuery(answering);
|
|
@@ -3546,6 +3547,9 @@ export function composeRuntime(options) {
|
|
|
3546
3547
|
save(room, named, writtenBy) {
|
|
3547
3548
|
return exclusive(() => saveRoomDrafts(room, named, writtenBy));
|
|
3548
3549
|
},
|
|
3550
|
+
saveParts(room, parts, writtenBy) {
|
|
3551
|
+
return exclusive(() => saveParts(room, parts, writtenBy));
|
|
3552
|
+
},
|
|
3549
3553
|
history(locator, path, query) {
|
|
3550
3554
|
return readHistory(locator, path, query);
|
|
3551
3555
|
},
|
|
@@ -3607,7 +3611,6 @@ export function composeRuntime(options) {
|
|
|
3607
3611
|
stop,
|
|
3608
3612
|
lose: loseRooms,
|
|
3609
3613
|
watch,
|
|
3610
|
-
acquire,
|
|
3611
3614
|
persisted(answer) {
|
|
3612
3615
|
if (answer === persistence)
|
|
3613
3616
|
return;
|
package/dist/conversation.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export type ConversationSurface = {
|
|
|
68
68
|
};
|
|
69
69
|
export type ChatDraftSurface = {
|
|
70
70
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
71
|
+
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
71
72
|
discard(conversation: string): Promise<void>;
|
|
72
73
|
};
|
|
73
74
|
export type ConversationDependencies = {
|
|
@@ -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,EAAsB,MAAM,iBAAiB,CAAC;AAE5F,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAE7D,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;AAEpE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,iBAAiB,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