@agentshouse/mdruntime 0.1.0-c7b0ab1aa40a3 → 0.1.0-c7bd7ca3faee4
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 +40 -19
- 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.map +1 -1
- package/dist/bootstrap.js +1 -0
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +35 -0
- package/dist/connection.d.ts +4 -2
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +54 -15
- package/dist/host.d.ts +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1 -0
- 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 +8 -0
- 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/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/replica.d.ts +3 -3
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +4 -3
- package/dist/rows.d.ts +2 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +77 -37
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +90 -43
- package/dist/store.d.ts +5 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +13 -2
- 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
|
@@ -82,6 +82,7 @@ export function composeRuntime(options) {
|
|
|
82
82
|
let withdrawStream;
|
|
83
83
|
const announced = new Map();
|
|
84
84
|
let underway = null;
|
|
85
|
+
let handed = false;
|
|
85
86
|
const submitting = new Map();
|
|
86
87
|
const answering = new Map();
|
|
87
88
|
let complete = false;
|
|
@@ -104,6 +105,8 @@ export function composeRuntime(options) {
|
|
|
104
105
|
let haltedRefusal = false;
|
|
105
106
|
let openSignals = 0;
|
|
106
107
|
const serviceModeListeners = new Set();
|
|
108
|
+
let member = null;
|
|
109
|
+
const memberListeners = new Set();
|
|
107
110
|
const conversations = createConversationStore({
|
|
108
111
|
agents: declaredAgents,
|
|
109
112
|
documents: (locator) => readSide.query(planOf({ rooms: [locator], select: 'all' }, roomFacts())),
|
|
@@ -244,6 +247,10 @@ export function composeRuntime(options) {
|
|
|
244
247
|
for (const listener of storageLossListeners)
|
|
245
248
|
listener(storageLoss);
|
|
246
249
|
}
|
|
250
|
+
function emitMember() {
|
|
251
|
+
for (const listener of memberListeners)
|
|
252
|
+
listener(member);
|
|
253
|
+
}
|
|
247
254
|
function moveTo(next) {
|
|
248
255
|
if (closed)
|
|
249
256
|
return;
|
|
@@ -395,6 +402,7 @@ export function composeRuntime(options) {
|
|
|
395
402
|
rooms.set(room.locator, {
|
|
396
403
|
name: room.name,
|
|
397
404
|
locator: room.locator,
|
|
405
|
+
handle: room.handle,
|
|
398
406
|
operations: room.operations,
|
|
399
407
|
replica: room.replica,
|
|
400
408
|
model: modelTypes(modelOf(room.locator)),
|
|
@@ -486,7 +494,7 @@ export function composeRuntime(options) {
|
|
|
486
494
|
return model;
|
|
487
495
|
}
|
|
488
496
|
async function hydrate(opened) {
|
|
489
|
-
const [records, queues, kept, presented, held, chatDrafts, lastCompleted, declared, named] = await Promise.all([
|
|
497
|
+
const [records, queues, kept, presented, held, chatDrafts, lastCompleted, declared, named, known,] = await Promise.all([
|
|
490
498
|
opened.all(),
|
|
491
499
|
opened.queues(),
|
|
492
500
|
opened.roomDrafts(),
|
|
@@ -496,9 +504,11 @@ export function composeRuntime(options) {
|
|
|
496
504
|
opened.lastCompleted(),
|
|
497
505
|
opened.providerLimits(),
|
|
498
506
|
opened.capabilities(),
|
|
507
|
+
opened.member(),
|
|
499
508
|
]);
|
|
500
509
|
limits = declared;
|
|
501
510
|
capabilities = named;
|
|
511
|
+
member = known;
|
|
502
512
|
roomDrafts.clear();
|
|
503
513
|
for (const record of kept)
|
|
504
514
|
rememberRoomDraft(record);
|
|
@@ -562,6 +572,8 @@ export function composeRuntime(options) {
|
|
|
562
572
|
applyChangeSet(read);
|
|
563
573
|
if (replicas.size > 0)
|
|
564
574
|
emitRooms();
|
|
575
|
+
if (member !== null)
|
|
576
|
+
emitMember();
|
|
565
577
|
for (const locator of locators)
|
|
566
578
|
emitQueue(locator);
|
|
567
579
|
publishRoomDrafts(false);
|
|
@@ -611,8 +623,12 @@ export function composeRuntime(options) {
|
|
|
611
623
|
async function settle(local, locator, before, confirmed, queue, settling = {}) {
|
|
612
624
|
const withdrawn = withdrawals(confirmed, queue, withdrawable);
|
|
613
625
|
const kept = queue.filter((batch) => !withdrawn.includes(batch));
|
|
626
|
+
const unqueued = withdrawn.map((batch) => ({
|
|
627
|
+
batch,
|
|
628
|
+
returned: landed(batch, confirmed) ? null : { kind: 'withdrawn' },
|
|
629
|
+
}));
|
|
614
630
|
const returning = [
|
|
615
|
-
...
|
|
631
|
+
...[...unqueued].reverse(),
|
|
616
632
|
...(settling.leaving === undefined ? [] : [settling.leaving]),
|
|
617
633
|
];
|
|
618
634
|
const written = new Map();
|
|
@@ -643,8 +659,9 @@ export function composeRuntime(options) {
|
|
|
643
659
|
}
|
|
644
660
|
for (const record of written.values())
|
|
645
661
|
rememberRoomDraft(record);
|
|
646
|
-
for (const batch of
|
|
647
|
-
journal.record(`outcome ${locator} ${batch.id} withdrawn`);
|
|
662
|
+
for (const { batch, returned } of unqueued) {
|
|
663
|
+
journal.record(`outcome ${locator} ${batch.id} ${returned === null ? 'landed' : 'withdrawn'}`);
|
|
664
|
+
}
|
|
648
665
|
replicas.set(locator, replicaOf(confirmed, kept, before));
|
|
649
666
|
return changeSet(locator, before ?? null, replicas.get(locator) ?? null, {
|
|
650
667
|
room: settling.room,
|
|
@@ -740,6 +757,7 @@ export function composeRuntime(options) {
|
|
|
740
757
|
operations: room.operations,
|
|
741
758
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
742
759
|
providerLimits: limits,
|
|
760
|
+
handle: room.handle,
|
|
743
761
|
visible: replica.visible,
|
|
744
762
|
changes: parts.flatMap(({ changes }) => changes),
|
|
745
763
|
bases: parts.flatMap(({ bases }) => bases),
|
|
@@ -1033,7 +1051,7 @@ export function composeRuntime(options) {
|
|
|
1033
1051
|
logAccepted(room.locator, submitted, accepted);
|
|
1034
1052
|
const applied = options.adapter.reached(room.locator, held, accepted.roomVersion)
|
|
1035
1053
|
? { 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)
|
|
1054
|
+
: applyReturned(current.confirmed, accepted.documents, accepted.revisions, accepted.changes, accepted.removals, accepted.attachments, options.adapter.follows(room.locator, held, accepted.roomVersion)
|
|
1037
1055
|
? accepted.roomVersion
|
|
1038
1056
|
: held, accepted.roomVersion);
|
|
1039
1057
|
if (applied.kind !== 'staged') {
|
|
@@ -1179,7 +1197,8 @@ export function composeRuntime(options) {
|
|
|
1179
1197
|
return;
|
|
1180
1198
|
}
|
|
1181
1199
|
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)
|
|
1200
|
+
leaving: (result.kind === 'expired' && landed(head, current.confirmed)) ||
|
|
1201
|
+
(result.kind === 'conflicted' && landed(head, current.confirmed, result.affected))
|
|
1183
1202
|
? { ...left, returned: null }
|
|
1184
1203
|
: left,
|
|
1185
1204
|
});
|
|
@@ -1328,8 +1347,10 @@ export function composeRuntime(options) {
|
|
|
1328
1347
|
const outcome = prepared[index];
|
|
1329
1348
|
return outcome?.status === 'fulfilled' && outcome.value;
|
|
1330
1349
|
});
|
|
1331
|
-
if (attempt === 'opened')
|
|
1350
|
+
if (attempt === 'opened') {
|
|
1332
1351
|
options.adapter.roomStream?.hold(heldRooms(ready));
|
|
1352
|
+
handed = true;
|
|
1353
|
+
}
|
|
1333
1354
|
const loaded = await Promise.allSettled(ready
|
|
1334
1355
|
.filter((room) => attempt === 'unstreamed' || !replicas.has(room.locator))
|
|
1335
1356
|
.map((room) => loadRoom(room, local, progress)));
|
|
@@ -1432,9 +1453,6 @@ export function composeRuntime(options) {
|
|
|
1432
1453
|
}
|
|
1433
1454
|
progress.reachable = false;
|
|
1434
1455
|
progress.complete = false;
|
|
1435
|
-
if (attempt === 'opened') {
|
|
1436
|
-
options.adapter.roomStream?.hold(heldRooms([...discovered.values()]));
|
|
1437
|
-
}
|
|
1438
1456
|
notifyReady();
|
|
1439
1457
|
return;
|
|
1440
1458
|
}
|
|
@@ -1481,6 +1499,12 @@ export function composeRuntime(options) {
|
|
|
1481
1499
|
limits = result.providerLimits;
|
|
1482
1500
|
await local.declare(limits, capabilities);
|
|
1483
1501
|
}
|
|
1502
|
+
const signedIn = result.member ?? null;
|
|
1503
|
+
if (JSON.stringify(signedIn) !== JSON.stringify(member)) {
|
|
1504
|
+
await local.keepMember(signedIn);
|
|
1505
|
+
member = signedIn;
|
|
1506
|
+
emitMember();
|
|
1507
|
+
}
|
|
1484
1508
|
await applyDiscovery(result.rooms, local);
|
|
1485
1509
|
await synchronize(result.rooms, local, progress, attempt);
|
|
1486
1510
|
}
|
|
@@ -1513,6 +1537,7 @@ export function composeRuntime(options) {
|
|
|
1513
1537
|
complete = false;
|
|
1514
1538
|
recorded = false;
|
|
1515
1539
|
moveTo(transferring(status));
|
|
1540
|
+
handed = false;
|
|
1516
1541
|
try {
|
|
1517
1542
|
const local = await openLocal();
|
|
1518
1543
|
if (closed)
|
|
@@ -1524,16 +1549,22 @@ export function composeRuntime(options) {
|
|
|
1524
1549
|
}
|
|
1525
1550
|
catch {
|
|
1526
1551
|
progress.complete = false;
|
|
1527
|
-
if (attempt === 'opened')
|
|
1528
|
-
|
|
1529
|
-
}
|
|
1552
|
+
if (attempt === 'opened' && !handed)
|
|
1553
|
+
progress.reachable = false;
|
|
1530
1554
|
}
|
|
1531
1555
|
finally {
|
|
1532
1556
|
notifyReady();
|
|
1533
1557
|
}
|
|
1534
|
-
if (attempt
|
|
1558
|
+
if (attempt !== 'opened') {
|
|
1559
|
+
await finishOpening(progress);
|
|
1535
1560
|
return;
|
|
1536
|
-
|
|
1561
|
+
}
|
|
1562
|
+
if (handed || closed || progress.reachable)
|
|
1563
|
+
return;
|
|
1564
|
+
underway = null;
|
|
1565
|
+
journal.record('connection reopen');
|
|
1566
|
+
await rest(progress);
|
|
1567
|
+
options.adapter.roomStream?.reopen();
|
|
1537
1568
|
});
|
|
1538
1569
|
}
|
|
1539
1570
|
function closedSocket(revoked) {
|
|
@@ -1823,6 +1854,7 @@ export function composeRuntime(options) {
|
|
|
1823
1854
|
storageLossListeners.clear();
|
|
1824
1855
|
statusListeners.clear();
|
|
1825
1856
|
serviceModeListeners.clear();
|
|
1857
|
+
memberListeners.clear();
|
|
1826
1858
|
readSide.close();
|
|
1827
1859
|
queueSubscriptions.clear();
|
|
1828
1860
|
roomDraftListeners.clear();
|
|
@@ -1940,6 +1972,13 @@ export function composeRuntime(options) {
|
|
|
1940
1972
|
serviceModeListeners.delete(deliver);
|
|
1941
1973
|
};
|
|
1942
1974
|
}
|
|
1975
|
+
if (topic === 'member') {
|
|
1976
|
+
memberListeners.add(deliver);
|
|
1977
|
+
deliver(member);
|
|
1978
|
+
return () => {
|
|
1979
|
+
memberListeners.delete(deliver);
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1943
1982
|
if (topic === 'queue') {
|
|
1944
1983
|
const queue = { locator: input[0], notify: deliver };
|
|
1945
1984
|
queueSubscriptions.add(queue);
|
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/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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ACV,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,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAkBtB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,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,EAAE,MAAM,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACxD,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1C,iBAAiB,CAAC,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,SAAS,IAAI,SAAS,MAAM,EAAE,CAAC;IAC/B,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC;AA+CF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAybrF"}
|
package/dist/memory.js
CHANGED
|
@@ -99,6 +99,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
99
99
|
return {
|
|
100
100
|
name: room.name,
|
|
101
101
|
locator: room.locator,
|
|
102
|
+
handle: room.handle,
|
|
102
103
|
roomVersion: room.roomVersion,
|
|
103
104
|
operations: room.operations,
|
|
104
105
|
replica: room.replica,
|
|
@@ -245,6 +246,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
245
246
|
capabilities,
|
|
246
247
|
providerLimits,
|
|
247
248
|
retention,
|
|
249
|
+
...(options.member === undefined ? {} : { member: options.member }),
|
|
248
250
|
};
|
|
249
251
|
}
|
|
250
252
|
return {
|
|
@@ -329,6 +331,12 @@ export function createMemoryAdapter(options = {}) {
|
|
|
329
331
|
}
|
|
330
332
|
});
|
|
331
333
|
},
|
|
334
|
+
reopen() {
|
|
335
|
+
queueMicrotask(() => {
|
|
336
|
+
for (const observer of observers)
|
|
337
|
+
observer({ kind: 'closed', revoked: false });
|
|
338
|
+
});
|
|
339
|
+
},
|
|
332
340
|
observe(notify) {
|
|
333
341
|
observers.add(notify);
|
|
334
342
|
queueMicrotask(() => {
|
package/dist/model.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type ModelIdentity = {
|
|
|
5
5
|
};
|
|
6
6
|
export type ModelSnapshot = ModelIdentity & {
|
|
7
7
|
schema: string | null;
|
|
8
|
+
revision: string | null;
|
|
8
9
|
};
|
|
9
10
|
export type ModelUnavailableReason = 'not-readable' | 'revoked' | 'not-acquired' | 'invalid';
|
|
10
11
|
export type ModelResult = {
|
|
@@ -18,6 +19,8 @@ export type MdType = Definition;
|
|
|
18
19
|
export type ModelState = {
|
|
19
20
|
status: 'unavailable';
|
|
20
21
|
reason: ModelUnavailableReason;
|
|
22
|
+
schema?: string | null;
|
|
23
|
+
revision?: string | null;
|
|
21
24
|
} | {
|
|
22
25
|
status: 'current' | 'cached';
|
|
23
26
|
snapshot: ModelSnapshot;
|
|
@@ -27,12 +30,16 @@ export type ModelState = {
|
|
|
27
30
|
export type TypesResult = {
|
|
28
31
|
status: 'unavailable';
|
|
29
32
|
reason: ModelUnavailableReason;
|
|
33
|
+
schema?: string | null;
|
|
34
|
+
revision?: string | null;
|
|
30
35
|
} | {
|
|
31
36
|
status: 'current' | 'cached';
|
|
32
37
|
identity: string;
|
|
33
38
|
version: string;
|
|
34
39
|
verifiedWith: ModelIdentity;
|
|
35
40
|
types: readonly MdType[];
|
|
41
|
+
schema: string | null;
|
|
42
|
+
revision: string | null;
|
|
36
43
|
};
|
|
37
44
|
export type ValidationReceipt = {
|
|
38
45
|
identity: string;
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAElF,MAAM,MAAM,aAAa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AAC;CAC/B,CAAC;AACN,MAAM,MAAM,WAAW,GACnB;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GACD;IACE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,aAAa,CAAC;IAC5B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AACN,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAA;CAAE,CAAC;AACpG,eAAO,MAAM,QAAQ,EAAE,UAA8D,CAAC;AACtF,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAGhG;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAgBzD;AACD,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAEpD;AACD,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAE5E;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAErE"}
|
package/dist/model.js
CHANGED
|
@@ -12,6 +12,8 @@ export function modelTypes(state) {
|
|
|
12
12
|
identity: state.snapshot.identity,
|
|
13
13
|
version: state.snapshot.version,
|
|
14
14
|
verifiedWith: { ...state.verifiedWith },
|
|
15
|
+
schema: state.snapshot.schema,
|
|
16
|
+
revision: state.snapshot.revision,
|
|
15
17
|
types: structuredClone(Object.values(state.types).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0)),
|
|
16
18
|
};
|
|
17
19
|
}
|
package/dist/paths.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare function normalize(path: string): string | null;
|
|
2
|
-
export declare function relative(from: string, target: string): string;
|
|
3
2
|
export declare function beneath(prefix: string, path: string): boolean;
|
|
4
3
|
export declare function covered(prefixes: readonly string[], path: string): boolean;
|
|
5
4
|
//# sourceMappingURL=paths.d.ts.map
|
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrD;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAK1E"}
|
package/dist/paths.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
function dirname(path) {
|
|
2
|
-
const index = path.lastIndexOf('/');
|
|
3
|
-
return index === -1 ? '' : path.slice(0, index);
|
|
4
|
-
}
|
|
5
1
|
export function normalize(path) {
|
|
6
2
|
const parts = [];
|
|
7
3
|
for (const part of path.split('/')) {
|
|
@@ -17,18 +13,6 @@ export function normalize(path) {
|
|
|
17
13
|
}
|
|
18
14
|
return parts.join('/');
|
|
19
15
|
}
|
|
20
|
-
export function relative(from, target) {
|
|
21
|
-
const base = dirname(from)
|
|
22
|
-
.split('/')
|
|
23
|
-
.filter((part) => part !== '');
|
|
24
|
-
const parts = target.split('/');
|
|
25
|
-
let shared = 0;
|
|
26
|
-
while (shared < base.length && shared + 1 < parts.length && base[shared] === parts[shared]) {
|
|
27
|
-
shared += 1;
|
|
28
|
-
}
|
|
29
|
-
const up = Array.from({ length: base.length - shared }, () => '..');
|
|
30
|
-
return [...up, ...parts.slice(shared)].join('/');
|
|
31
|
-
}
|
|
32
16
|
export function beneath(prefix, path) {
|
|
33
17
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
34
18
|
}
|
package/dist/query.d.ts
CHANGED
package/dist/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAErD,MAAM,MAAM,SAAS,GACjB,KAAK,GACL;IAAE,GAAG,EAAE,KAAK,CAAA;CAAE,GACd;IAAE,GAAG,EAAE,KAAK,CAAA;CAAE,GACd;IAAE,GAAG,EAAE,SAAS,KAAK,EAAE,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,SAAS,KAAK,EAAE,CAAA;CAAE,GAC1B;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,GAAG,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,SAAS,KAAK,EAAE,CAAA;CAAE,GAC1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CACtB,CAAC;AAEF,qBAAa,UAAW,SAAQ,KAAK;IACnC,YAAY,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAE5D;CACF;AAED,KAAK,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAejD,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAE1D;AAMD,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAOtD;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,QAI3E;AAsZD,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,GAAE,SAAS,GAAG,IAAW,GAAG,IAAI,CAkB7F;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAMrD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,GAAE,SAAS,GAAG,IAAW,GAAG,IAAI,CAI/F;AAaD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C"}
|
package/dist/query.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pointerFacts, } from '@agentshouse/mdmodel';
|
|
1
2
|
import { referenceField } from './model.js';
|
|
2
3
|
import { normalize } from './paths.js';
|
|
3
4
|
export class QueryError extends Error {
|
|
@@ -12,6 +13,7 @@ const RELATED = ['types', 'where', 'pathPrefix', 'field'];
|
|
|
12
13
|
const PARTS = ['fields', 'sections', 'preamble', 'markdown', 'backlinks', 'change'];
|
|
13
14
|
const ORDER = ['by', 'direction', 'nulls', 'stringSort', 'locale', 'localeOptions'];
|
|
14
15
|
const CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
16
|
+
const STRAY_ESCAPE = /~(?![01])/u;
|
|
15
17
|
export function invalid(at, problem) {
|
|
16
18
|
throw new QueryError('invalid-query', at, problem);
|
|
17
19
|
}
|
|
@@ -109,23 +111,46 @@ function typing(facts, rooms, types, at) {
|
|
|
109
111
|
types: types === null ? declared : declared.filter((type) => types.includes(type.name)),
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
+
function pointer(input, at) {
|
|
115
|
+
if (typeof input !== 'string' || !input.startsWith('/') || STRAY_ESCAPE.test(input)) {
|
|
116
|
+
invalid(at, 'expects a JSON Pointer');
|
|
117
|
+
}
|
|
118
|
+
return input;
|
|
119
|
+
}
|
|
120
|
+
function specs(typed, input, at) {
|
|
121
|
+
const field = pointer(input, at);
|
|
122
|
+
const declared = typed.types.flatMap((type) => {
|
|
123
|
+
const spec = pointerFacts(type, field);
|
|
124
|
+
return spec === undefined ? [] : [spec];
|
|
125
|
+
});
|
|
114
126
|
if (declared.length === 0 && !typed.untyped) {
|
|
115
127
|
throw new QueryError('unknown-field', at, `no MD Type it reads declares ${field}`);
|
|
116
128
|
}
|
|
117
|
-
|
|
129
|
+
if (!declared.some((spec) => spec.conditional))
|
|
130
|
+
return declared;
|
|
131
|
+
return declared.map((spec) => ({
|
|
132
|
+
facts: { prose: false },
|
|
133
|
+
through: several(spec),
|
|
134
|
+
conditional: true,
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
function several(spec) {
|
|
138
|
+
return spec.through || spec.facts.type === 'array';
|
|
139
|
+
}
|
|
140
|
+
function single(spec) {
|
|
141
|
+
return spec.facts.type !== undefined && spec.facts.type !== 'array';
|
|
142
|
+
}
|
|
143
|
+
function every(declared, holds) {
|
|
144
|
+
return declared.length > 0 && declared.every(holds);
|
|
118
145
|
}
|
|
119
146
|
function kind(declared, checked, at) {
|
|
120
|
-
if (checked === null ||
|
|
147
|
+
if (checked === null ||
|
|
148
|
+
declared.length === 0 ||
|
|
149
|
+
declared.some((spec) => fits(spec.facts, checked))) {
|
|
121
150
|
return;
|
|
122
151
|
}
|
|
123
152
|
throw new QueryError('wrong-kind', at, `${JSON.stringify(checked)} is not of its field's kind`);
|
|
124
153
|
}
|
|
125
|
-
function listed(declared, list) {
|
|
126
|
-
return (declared.length > 0 &&
|
|
127
|
-
declared.every((facts) => facts.type !== undefined && (facts.type === 'array') === list));
|
|
128
|
-
}
|
|
129
154
|
function test(declared, input, at) {
|
|
130
155
|
if (!plain(input)) {
|
|
131
156
|
const equal = value(input, at);
|
|
@@ -139,8 +164,11 @@ function test(declared, input, at) {
|
|
|
139
164
|
const stray = operators.find((operator) => !RANGE.includes(operator));
|
|
140
165
|
if (stray !== undefined)
|
|
141
166
|
invalid(place(at, stray), 'cannot join a range');
|
|
142
|
-
if (
|
|
167
|
+
if (every(declared, (spec) => spec.facts.type === 'array'))
|
|
143
168
|
invalid(at, 'a range on a list');
|
|
169
|
+
if (every(declared, (spec) => spec.facts.type === 'boolean' || spec.facts.type === 'object')) {
|
|
170
|
+
throw new QueryError('wrong-kind', at, 'its field does not compare in order');
|
|
171
|
+
}
|
|
144
172
|
return {
|
|
145
173
|
op: 'range',
|
|
146
174
|
bounds: RANGE.filter((operator) => operators.includes(operator)).map((operator) => {
|
|
@@ -173,7 +201,7 @@ function test(declared, input, at) {
|
|
|
173
201
|
return { op: 'nin', values: compared };
|
|
174
202
|
if (compared.includes(null))
|
|
175
203
|
invalid(where, 'a list holds no null');
|
|
176
|
-
if (
|
|
204
|
+
if (every(declared, single))
|
|
177
205
|
invalid(where, 'the field is not a list');
|
|
178
206
|
return { op: 'all', values: compared };
|
|
179
207
|
}
|
|
@@ -181,7 +209,7 @@ function test(declared, input, at) {
|
|
|
181
209
|
if (!Number.isSafeInteger(operand) || operand < 0) {
|
|
182
210
|
invalid(where, 'expects a nonnegative integer');
|
|
183
211
|
}
|
|
184
|
-
if (
|
|
212
|
+
if (every(declared, single))
|
|
185
213
|
invalid(where, 'the field is not a list');
|
|
186
214
|
return { op: 'size', size: operand };
|
|
187
215
|
}
|
|
@@ -194,7 +222,7 @@ function condition(typed, input, at) {
|
|
|
194
222
|
invalid(at, 'expects an object of field predicates');
|
|
195
223
|
const conditions = [];
|
|
196
224
|
for (const name of Object.keys(input).sort()) {
|
|
197
|
-
const where = place(at, name);
|
|
225
|
+
const where = name.startsWith('/') ? `${at}${name}` : place(at, name);
|
|
198
226
|
const entry = input[name];
|
|
199
227
|
if (name === '$and' || name === '$or') {
|
|
200
228
|
const nested = list(entry, where).map((item, index) => condition(typed, item, `${where}[${index}]`));
|
|
@@ -224,11 +252,11 @@ function scope(facts, rooms, input, at) {
|
|
|
224
252
|
};
|
|
225
253
|
}
|
|
226
254
|
function referenceName(typed, field, at) {
|
|
227
|
-
if (typeof field !== 'string')
|
|
228
|
-
invalid(at, 'expects a field name');
|
|
229
255
|
const declared = specs(typed, field, at);
|
|
230
|
-
if (declared.length > 0 &&
|
|
256
|
+
if (declared.length > 0 &&
|
|
257
|
+
!declared.some((spec) => spec.conditional || referenceField(spec.facts))) {
|
|
231
258
|
invalid(at, 'not a reference field');
|
|
259
|
+
}
|
|
232
260
|
return field;
|
|
233
261
|
}
|
|
234
262
|
function hopOf(facts, rooms, root, input) {
|
|
@@ -250,8 +278,10 @@ function backlinksOf(facts, rooms, input) {
|
|
|
250
278
|
function keyPlan(typed, input, at, path) {
|
|
251
279
|
if (input === 'room' || input === 'type' || (path && input === 'path'))
|
|
252
280
|
return { of: input };
|
|
253
|
-
if (plain(input) &&
|
|
254
|
-
specs(typed, input.field, place(at, 'field'))
|
|
281
|
+
if (plain(input) && Object.hasOwn(input, 'field') && Object.keys(input).length === 1) {
|
|
282
|
+
if (specs(typed, input.field, place(at, 'field')).some(several)) {
|
|
283
|
+
invalid(place(at, 'field'), 'a path that can hold several values');
|
|
284
|
+
}
|
|
255
285
|
return { of: 'field', field: input.field };
|
|
256
286
|
}
|
|
257
287
|
return invalid(at, path ? 'expects room, path, type or a field' : 'expects room, type or a field');
|
|
@@ -309,10 +339,10 @@ function parts(typed, input, at, fields) {
|
|
|
309
339
|
return 'all';
|
|
310
340
|
const named = list(input, at);
|
|
311
341
|
named.forEach((name, index) => {
|
|
312
|
-
if (typeof name !== 'string')
|
|
313
|
-
invalid(`${at}[${index}]`, 'expects a name');
|
|
314
342
|
if (fields)
|
|
315
343
|
specs(typed, name, `${at}[${index}]`);
|
|
344
|
+
else if (typeof name !== 'string')
|
|
345
|
+
invalid(`${at}[${index}]`, 'expects a name');
|
|
316
346
|
});
|
|
317
347
|
return named;
|
|
318
348
|
}
|