@agentshouse/mdruntime 0.1.0-cff1b70c6ad46 → 0.1.0-cffcba9cd9c2f
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/dist/acceptance.d.ts +0 -3
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +48 -124
- package/dist/actions.js +2 -2
- package/dist/adapter.d.ts +16 -44
- package/dist/adapter.d.ts.map +1 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +6 -19
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -3
- package/dist/collection.d.ts +22 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +12 -2
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +13 -13
- package/dist/conversation-live.d.ts +3 -4
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +2 -3
- package/dist/conversation.d.ts +4 -6
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +43 -71
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +5 -3
- package/dist/failure.d.ts +1 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -0
- package/dist/host.d.ts +17 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +16 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/install.d.ts +0 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +46 -57
- package/dist/job.d.ts +1 -29
- package/dist/job.d.ts.map +1 -1
- package/dist/job.js +2 -49
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +9 -6
- package/dist/listing.d.ts +3 -4
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +14 -22
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +3 -1
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +2 -1
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +3 -3
- package/dist/memory.d.ts +4 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +8 -6
- package/dist/messages.d.ts +0 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +0 -14
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -5
- package/dist/models.d.ts +4 -8
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +101 -126
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +6 -4
- package/dist/overlay.d.ts +2 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +32 -21
- package/dist/parts.d.ts +3 -52
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +15 -120
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +10 -3
- package/dist/queue.d.ts +32 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +402 -0
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +5 -4
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +4 -1
- package/dist/refresh.js +2 -2
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +3 -1
- package/dist/replica.d.ts +5 -11
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +12 -14
- package/dist/room-draft.d.ts +3 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +33 -20
- package/dist/room-drafts.js +3 -3
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +3 -4
- package/dist/runtime.d.ts +5 -16
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +5 -10
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +59 -56
- package/dist/saves.d.ts +2 -40
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +23 -349
- package/dist/shown.d.ts +2 -1
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +13 -6
- package/dist/socket/rooms.d.ts +1 -4
- package/dist/socket/rooms.d.ts.map +1 -1
- package/dist/socket.d.ts +0 -1
- package/dist/socket.d.ts.map +1 -1
- package/dist/store/records.d.ts +0 -2
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +0 -3
- package/dist/store.d.ts +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +1 -1
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +3 -3
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +2 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +18 -20
- package/dist/tables.d.ts +0 -4
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +1 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +2 -2
- package/dist/wire.d.ts +4 -4
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +3 -3
- package/package.json +3 -2
package/dist/install.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { attachedModel } from './attached-model.js';
|
|
2
2
|
import { bootstrapRoom } from './bootstrap.js';
|
|
3
3
|
import { refusedForSpace } from './durability.js';
|
|
4
|
+
import { uncaught } from './failure.js';
|
|
4
5
|
import { name, usable } from './listing.js';
|
|
5
6
|
import { NO_MODEL } from './model.js';
|
|
7
|
+
import { settle } from './queue.js';
|
|
6
8
|
import { advancement } from './refresh.js';
|
|
7
|
-
import { recoverReads
|
|
9
|
+
import { recoverReads } from './shown.js';
|
|
8
10
|
import { NO_INSTALL, } from './store.js';
|
|
9
11
|
import { unconfirmed } from './transfer.js';
|
|
10
12
|
import { ROW_WEIGHT, yielded } from './turn.js';
|
|
@@ -130,8 +132,9 @@ export function sweep({ store, socket, journal }) {
|
|
|
130
132
|
await yielded();
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
|
-
catch {
|
|
135
|
+
catch (error) {
|
|
134
136
|
journal.record('erasure failed');
|
|
137
|
+
uncaught(error);
|
|
135
138
|
}
|
|
136
139
|
finally {
|
|
137
140
|
store.device.set({ sweeping: false });
|
|
@@ -150,12 +153,6 @@ export function caughtUpTo(runtime, locator) {
|
|
|
150
153
|
export function catching(store, locator) {
|
|
151
154
|
store.installs.change(locator, (held) => ({ ...held, catching: true }));
|
|
152
155
|
}
|
|
153
|
-
export function confirmedAgain(store, locator) {
|
|
154
|
-
store.installs.change(locator, (held) => ({
|
|
155
|
-
...held,
|
|
156
|
-
confirmations: held.confirmations + 1,
|
|
157
|
-
}));
|
|
158
|
-
}
|
|
159
156
|
export function standingAt(store, locator, held) {
|
|
160
157
|
return { key: held?.key ?? null, confirmed: store.installs.of(locator).confirmations };
|
|
161
158
|
}
|
|
@@ -394,7 +391,9 @@ function staging(runtime, local, liveness, unheld) {
|
|
|
394
391
|
if (!liveness())
|
|
395
392
|
return null;
|
|
396
393
|
const prior = unheld === undefined ? await store.record(locator) : undefined;
|
|
397
|
-
const published = prior !== undefined && prior.replica.selection === record.selection
|
|
394
|
+
const published = prior !== undefined && prior.declaration.replica.selection === record.selection
|
|
395
|
+
? prior.key
|
|
396
|
+
: null;
|
|
398
397
|
const kept = unheld?.staged ?? (await local.held()).staged.has(locator);
|
|
399
398
|
if (published === null && !kept)
|
|
400
399
|
return { record: null, staged: new Set() };
|
|
@@ -479,21 +478,22 @@ export async function pullBootstrap(runtime, authorized, room, local, liveness,
|
|
|
479
478
|
}
|
|
480
479
|
export function publish(runtime, local, room, reached, landing, live) {
|
|
481
480
|
const { store } = runtime;
|
|
482
|
-
|
|
481
|
+
let published = true;
|
|
482
|
+
const landed = settle(runtime, [room.locator], async (held) => {
|
|
483
483
|
if (!live()) {
|
|
484
484
|
caughtUpTo(runtime, room.locator);
|
|
485
|
-
return
|
|
485
|
+
return [];
|
|
486
486
|
}
|
|
487
|
-
const
|
|
488
|
-
const prior = work.replica;
|
|
487
|
+
const prior = held.get(room.locator)?.replica;
|
|
489
488
|
if (!standsAt(store, room.locator, prior?.record, landing.from)) {
|
|
489
|
+
published = false;
|
|
490
490
|
if (landing.kind === 'refreshed') {
|
|
491
491
|
await local.unrefresh(reached.key);
|
|
492
|
-
return
|
|
492
|
+
return [];
|
|
493
493
|
}
|
|
494
494
|
caughtUpTo(runtime, room.locator);
|
|
495
495
|
await abandoned(runtime, local, room.locator);
|
|
496
|
-
return
|
|
496
|
+
return [];
|
|
497
497
|
}
|
|
498
498
|
const record = landing.kind === 'refreshed' && prior !== undefined
|
|
499
499
|
? {
|
|
@@ -502,51 +502,40 @@ export function publish(runtime, local, room, reached, landing, live) {
|
|
|
502
502
|
...(landing.remodelled ? { model: reached.model } : {}),
|
|
503
503
|
}
|
|
504
504
|
: reached;
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
: {
|
|
514
|
-
room: true,
|
|
515
|
-
view: landing.refreshed ? 'refreshed' : 'confirmed',
|
|
516
|
-
commit: {
|
|
505
|
+
return [
|
|
506
|
+
{
|
|
507
|
+
locator: room.locator,
|
|
508
|
+
record,
|
|
509
|
+
installed: landing.kind === 'refreshed'
|
|
510
|
+
? { refreshed: true }
|
|
511
|
+
: {
|
|
517
512
|
published: { from: prior?.record.key ?? null },
|
|
518
513
|
...(landing.refreshed ? { refreshed: true } : {}),
|
|
519
514
|
},
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
await runtime.unpair(local);
|
|
545
|
-
void statusShown(runtime);
|
|
546
|
-
if (landing.kind === 'bootstrapped' && work.queue.length > 0) {
|
|
547
|
-
runtime.submitLater(room.locator);
|
|
548
|
-
}
|
|
549
|
-
return true;
|
|
515
|
+
after() {
|
|
516
|
+
if (landing.kind === 'bootstrapped') {
|
|
517
|
+
runtime.socket.rooms.readied(room.locator);
|
|
518
|
+
store.installs.change(room.locator, (held) => ({
|
|
519
|
+
...transferGone(held),
|
|
520
|
+
highest: null,
|
|
521
|
+
beyondHorizon: false,
|
|
522
|
+
startedOver: null,
|
|
523
|
+
catching: false,
|
|
524
|
+
}));
|
|
525
|
+
runtime.socket.rooms.stand(room.locator, { unheldModel: null });
|
|
526
|
+
if (prior !== undefined && prior.record.key !== record.key)
|
|
527
|
+
sweep(runtime);
|
|
528
|
+
void name(runtime, room.locator);
|
|
529
|
+
}
|
|
530
|
+
usable(runtime, room);
|
|
531
|
+
},
|
|
532
|
+
},
|
|
533
|
+
];
|
|
534
|
+
}).then(() => published, (error) => {
|
|
535
|
+
if (!refusedForSpace(error))
|
|
536
|
+
throw error;
|
|
537
|
+
caughtUpTo(runtime, room.locator);
|
|
538
|
+
return published;
|
|
550
539
|
});
|
|
551
540
|
return landing.kind === 'refreshed'
|
|
552
541
|
? landed
|
package/dist/job.d.ts
CHANGED
|
@@ -1,33 +1,5 @@
|
|
|
1
|
-
type Job = {
|
|
2
|
-
readonly label: string;
|
|
3
|
-
readonly kind: 'started' | 'scheduled' | 'ended';
|
|
4
|
-
readonly state: string;
|
|
5
|
-
readonly next: string | null;
|
|
6
|
-
};
|
|
7
1
|
export type RunningJob = {
|
|
8
2
|
readonly name: string;
|
|
9
|
-
readonly running_since: string;
|
|
10
|
-
};
|
|
11
|
-
export type JobMarker = {
|
|
12
|
-
readonly said: string;
|
|
13
|
-
readonly at: string;
|
|
14
|
-
};
|
|
15
|
-
export type OpenJob<At = string | null> = {
|
|
16
|
-
readonly name: string;
|
|
17
|
-
readonly started: At;
|
|
18
3
|
};
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function closeLast(open: {
|
|
21
|
-
readonly key: string;
|
|
22
|
-
}[], key: string): void;
|
|
23
|
-
export declare function markerMoved<Kept extends {
|
|
24
|
-
readonly key: string;
|
|
25
|
-
}>(open: Kept[], said: string, opened: (job: Job, key: string) => Kept | null): void;
|
|
26
|
-
export declare function openJobs<At>(markers: readonly {
|
|
27
|
-
readonly said: string;
|
|
28
|
-
readonly at: At;
|
|
29
|
-
}[]): readonly OpenJob<At>[];
|
|
30
|
-
export declare function jobsRunning(jobs: readonly RunningJob[], now: number): string[];
|
|
31
|
-
export declare function sessionEnded(jobs: readonly RunningJob[], now: number): string;
|
|
32
|
-
export {};
|
|
4
|
+
export declare function sessionEnded(jobs: readonly RunningJob[]): string;
|
|
33
5
|
//# sourceMappingURL=job.d.ts.map
|
package/dist/job.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAIF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAIhE"}
|
package/dist/job.js
CHANGED
|
@@ -1,54 +1,7 @@
|
|
|
1
|
-
const NEXT_RUN = 'next run ';
|
|
2
|
-
const MINUTE = 60_000;
|
|
3
1
|
const ENDED = 'Session ended.';
|
|
4
|
-
export function
|
|
5
|
-
const at = said.lastIndexOf(': ');
|
|
6
|
-
const label = at === -1 ? said : said.slice(0, at);
|
|
7
|
-
const state = at === -1 ? '' : said.slice(at + 2);
|
|
8
|
-
if (state === 'running')
|
|
9
|
-
return { label, kind: 'started', state, next: null };
|
|
10
|
-
if (state === 'scheduled')
|
|
11
|
-
return { label, kind: 'scheduled', state, next: null };
|
|
12
|
-
return state.startsWith(NEXT_RUN)
|
|
13
|
-
? { label, kind: 'scheduled', state, next: state.slice(NEXT_RUN.length) }
|
|
14
|
-
: { label, kind: 'ended', state, next: null };
|
|
15
|
-
}
|
|
16
|
-
export function closeLast(open, key) {
|
|
17
|
-
const at = open.map((one) => one.key).lastIndexOf(key);
|
|
18
|
-
if (at !== -1)
|
|
19
|
-
open.splice(at, 1);
|
|
20
|
-
}
|
|
21
|
-
export function markerMoved(open, said, opened) {
|
|
22
|
-
const job = jobOf(said);
|
|
23
|
-
const started = `job\u0000${job.label}`;
|
|
24
|
-
const schedule = `schedule\u0000${job.label}`;
|
|
25
|
-
if (job.kind === 'ended')
|
|
26
|
-
closeLast(open, started);
|
|
27
|
-
if (job.kind !== 'started')
|
|
28
|
-
closeLast(open, schedule);
|
|
29
|
-
if (job.kind === 'ended')
|
|
30
|
-
return;
|
|
31
|
-
const kept = opened(job, job.kind === 'started' ? started : schedule);
|
|
32
|
-
if (kept !== null)
|
|
33
|
-
open.push(kept);
|
|
34
|
-
}
|
|
35
|
-
export function openJobs(markers) {
|
|
36
|
-
const open = [];
|
|
37
|
-
for (const { said, at } of markers) {
|
|
38
|
-
markerMoved(open, said, (job, key) => job.kind === 'started' ? { key, name: job.label, started: at } : null);
|
|
39
|
-
}
|
|
40
|
-
return open.map(({ name, started }) => ({ name, started }));
|
|
41
|
-
}
|
|
42
|
-
export function jobsRunning(jobs, now) {
|
|
43
|
-
return jobs.map((job) => {
|
|
44
|
-
const since = Date.parse(job.running_since);
|
|
45
|
-
const ran = Number.isNaN(since) ? 0 : Math.floor((now - since) / MINUTE);
|
|
46
|
-
return ran >= 1 ? `${job.name} (${ran} min)` : job.name;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export function sessionEnded(jobs, now) {
|
|
2
|
+
export function sessionEnded(jobs) {
|
|
50
3
|
if (jobs.length === 0)
|
|
51
4
|
return ENDED;
|
|
52
5
|
const counted = jobs.length === 1 ? '1 background job' : `${jobs.length} background jobs`;
|
|
53
|
-
return `${ENDED} ${counted} stopped: ${
|
|
6
|
+
return `${ENDED} ${counted} stopped: ${jobs.map(({ name }) => name).join(', ')}`;
|
|
54
7
|
}
|
package/dist/lifecycle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAyN5C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,QAOhD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,QAS1C;AAED,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,OAAO,QAQ9F;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,iBAS1C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,QAyCtE"}
|
package/dist/lifecycle.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { submitAll } from './acceptance.js';
|
|
2
1
|
import { catchUpConversations, receiveConversationEvent, reconcileConversations, } from './conversation.js';
|
|
2
|
+
import { declared } from './declaration.js';
|
|
3
|
+
import { uncaught } from './failure.js';
|
|
3
4
|
import { catching, replaced } from './install.js';
|
|
4
5
|
import { connectionLost } from './locks.js';
|
|
5
6
|
import { fenceLive } from './lost.js';
|
|
6
7
|
import { cachedModels, revoked, settleModels } from './models.js';
|
|
7
8
|
import { refuse } from './refusal.js';
|
|
8
|
-
import { moveTo, recoverReads, rest, SERVICE_MODE_TOPIC, show, transferring } from './shown.js';
|
|
9
|
+
import { moveTo, recoverReads, rest, SERVICE_MODE_TOPIC, show, submissionDue, transferring, } from './shown.js';
|
|
9
10
|
import { applyRoom, changeAuthority, countAuthorityChange, finishOpening, loadRoom, OPENING_LANE, reload, resynchronize, sync, } from './sync.js';
|
|
10
11
|
const CONVERSATION_LANE = 'conversations';
|
|
11
12
|
function closing(runtime, opened) {
|
|
@@ -112,11 +113,12 @@ function caughtUpRooms(runtime, expired) {
|
|
|
112
113
|
if (progress.reachable) {
|
|
113
114
|
const stored = await held;
|
|
114
115
|
const owed = await reloading;
|
|
115
|
-
await settleModels(runtime, socket.rooms
|
|
116
|
+
await settleModels(runtime, new Map(socket.rooms
|
|
116
117
|
.discoveredRooms()
|
|
117
118
|
.filter((room) => stored.has(room.locator) &&
|
|
118
119
|
!expired.includes(room.locator) &&
|
|
119
|
-
!owed.includes(room.locator))
|
|
120
|
+
!owed.includes(room.locator))
|
|
121
|
+
.map((room) => [room.locator, declared(room)])), 'current', local);
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
catch {
|
|
@@ -145,7 +147,7 @@ function signalled(runtime, mode) {
|
|
|
145
147
|
store.tell(SERVICE_MODE_TOPIC, mode);
|
|
146
148
|
}
|
|
147
149
|
if (releasing)
|
|
148
|
-
|
|
150
|
+
void submissionDue(runtime);
|
|
149
151
|
}
|
|
150
152
|
async function runCurrency(runtime, live) {
|
|
151
153
|
const { socket, conversations } = runtime;
|
|
@@ -260,8 +262,9 @@ export function start(runtime, signal) {
|
|
|
260
262
|
if ((await local.facts()).capabilities.length > 0)
|
|
261
263
|
socket.readyFromStore();
|
|
262
264
|
})
|
|
263
|
-
.catch(() => {
|
|
265
|
+
.catch((error) => {
|
|
264
266
|
socket.readyFromStore();
|
|
267
|
+
uncaught(error);
|
|
265
268
|
});
|
|
266
269
|
if (!socket.streamed)
|
|
267
270
|
void sync(runtime, 'unstreamed', null);
|
package/dist/listing.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { HeldRooms } from '@agentshouse/mdmodel';
|
|
2
|
-
import type { DiscoveredRoom, HeldRoom, OperationScopes, ProviderRefusal, ReplicaAdmission } from './adapter.js';
|
|
2
|
+
import type { DiscoveredRoom, HeldRoom, OperationScopes, ProviderRefusal, ReplicaAdmission, RoomDeclaration } from './adapter.js';
|
|
3
3
|
import type { Composition } from './collection.js';
|
|
4
4
|
import { type ModelState, type TypesResult } from './model.js';
|
|
5
5
|
import { type PortReach } from './reach.js';
|
|
6
6
|
import type { ReplicaRecord } from './replica.js';
|
|
7
7
|
import type { Runtime } from './runtime.js';
|
|
8
|
-
import type { RoomDeclaration } from './socket.js';
|
|
9
8
|
import type { Stored } from './store.js';
|
|
10
9
|
export type AppTypedSelection = {
|
|
11
10
|
roots: readonly string[];
|
|
@@ -42,9 +41,9 @@ export declare function patchedListing(runtime: Runtime, changed: ReadonlySet<st
|
|
|
42
41
|
export declare function listingNow(runtime: Runtime): Promise<Listing>;
|
|
43
42
|
export declare function shownRooms(runtime: Runtime, listing: Listing): readonly AppRoom[];
|
|
44
43
|
export declare function roomFacts(runtime: Runtime, reach?: PortReach | null): Promise<HeldRooms>;
|
|
45
|
-
export declare function list({ store, socket }: Runtime,
|
|
44
|
+
export declare function list({ store, socket }: Runtime, locator: string, declaration: RoomDeclaration, synchronizationAvailable: boolean): void;
|
|
46
45
|
export declare function listHeld({ store, socket }: Runtime, locator: string): void;
|
|
47
|
-
export declare function admitted({ socket }: Runtime,
|
|
46
|
+
export declare function admitted({ socket }: Runtime, locator: string, declaration: RoomDeclaration): boolean;
|
|
48
47
|
export declare function readable(runtime: Runtime, room: DiscoveredRoom): void;
|
|
49
48
|
export declare function usable(runtime: Runtime, room: DiscoveredRoom): void;
|
|
50
49
|
export declare function heldRooms({ store }: Runtime, listed: readonly DiscoveredRoom[]): Promise<HeldRoom[]>;
|
package/dist/listing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../src/listing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EACR,eAAe,EACf,eAAe,EACf,gBAAgB,
|
|
1
|
+
{"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../src/listing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EACR,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAwB,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,KAAK,EAAE,WAAW,CAAC;IACnB,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,kBAA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AC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnE;AAQD,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,OAAO,EAAE,CAcjF;AAED,wBAAsB,SAAS,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,SAAS,GAAG,IAAW,GAC7B,OAAO,CAAC,SAAS,CAAC,CAoBpB;AAED,wBAAgB,IAAI,CAClB,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAC1B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,eAAe,EAC5B,wBAAwB,EAAE,OAAO,QAIlC;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAGnE;AAED,wBAAgB,QAAQ,CACtB,EAAE,MAAM,EAAE,EAAE,OAAO,EACnB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,eAAe,GAC3B,OAAO,CAET;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,QAG9D;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,QAO5D;AAED,wBAAsB,SAAS,CAC7B,EAAE,KAAK,EAAE,EAAE,OAAO,EAClB,MAAM,EAAE,SAAS,cAAc,EAAE,GAChC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAYrB;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAO3D"}
|
package/dist/listing.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { declared } from './declaration.js';
|
|
1
2
|
import { modelTypes, NO_MODEL } from './model.js';
|
|
2
3
|
import { governs, holds } from './reach.js';
|
|
3
4
|
export function modelIn({ socket }, locator, stored) {
|
|
@@ -13,7 +14,10 @@ export function compositionFor(runtime, record) {
|
|
|
13
14
|
}
|
|
14
15
|
export function declarationOf({ socket }, locator, stored) {
|
|
15
16
|
const held = socket.rooms.declared(locator);
|
|
16
|
-
const
|
|
17
|
+
const discovered = socket.rooms.discovered(locator);
|
|
18
|
+
const room = stored?.record.declaration ??
|
|
19
|
+
held?.room ??
|
|
20
|
+
(discovered === undefined ? undefined : declared(discovered));
|
|
17
21
|
return room === undefined ? undefined : { room, available: held?.available ?? true };
|
|
18
22
|
}
|
|
19
23
|
export function listedLocators({ store, socket }, held) {
|
|
@@ -33,7 +37,7 @@ function listedRoom(runtime, locator, stored) {
|
|
|
33
37
|
if (declaration === undefined)
|
|
34
38
|
return undefined;
|
|
35
39
|
const { room, available } = declaration;
|
|
36
|
-
const selection = room.typedSelection
|
|
40
|
+
const selection = room.typedSelection;
|
|
37
41
|
return {
|
|
38
42
|
name: room.name,
|
|
39
43
|
locator,
|
|
@@ -113,34 +117,22 @@ export async function roomFacts(runtime, reach = null) {
|
|
|
113
117
|
});
|
|
114
118
|
return { listed: socket.session.now().roomsListed, rooms };
|
|
115
119
|
}
|
|
116
|
-
export function list({ store, socket },
|
|
117
|
-
if (store.fences.has(
|
|
120
|
+
export function list({ store, socket }, locator, declaration, synchronizationAvailable) {
|
|
121
|
+
if (store.fences.has(locator))
|
|
118
122
|
return;
|
|
119
|
-
socket.rooms.declare(
|
|
120
|
-
room: {
|
|
121
|
-
name: room.name,
|
|
122
|
-
locator: room.locator,
|
|
123
|
-
handle: room.handle,
|
|
124
|
-
operations: room.operations,
|
|
125
|
-
replica: room.replica,
|
|
126
|
-
typedSelection: room.typedSelection ?? null,
|
|
127
|
-
providerOwnedPaths: room.providerOwnedPaths,
|
|
128
|
-
authoredPaths: room.authoredPaths,
|
|
129
|
-
},
|
|
130
|
-
available: synchronizationAvailable,
|
|
131
|
-
});
|
|
123
|
+
socket.rooms.declare(locator, { room: declaration, available: synchronizationAvailable });
|
|
132
124
|
}
|
|
133
125
|
export function listHeld({ store, socket }, locator) {
|
|
134
126
|
if (store.fences.has(locator))
|
|
135
127
|
return;
|
|
136
128
|
socket.rooms.declare(locator, { room: null, available: false });
|
|
137
129
|
}
|
|
138
|
-
export function admitted({ socket },
|
|
139
|
-
return
|
|
130
|
+
export function admitted({ socket }, locator, declaration) {
|
|
131
|
+
return declaration.replica.admission === 'admitted' && !socket.rooms.standing(locator).unreadable;
|
|
140
132
|
}
|
|
141
133
|
export function readable(runtime, room) {
|
|
142
134
|
runtime.socket.rooms.stand(room.locator, { unreadable: false });
|
|
143
|
-
list(runtime, room, true);
|
|
135
|
+
list(runtime, room.locator, declared(room), true);
|
|
144
136
|
}
|
|
145
137
|
export function usable(runtime, room) {
|
|
146
138
|
const { rooms } = runtime.socket;
|
|
@@ -148,7 +140,7 @@ export function usable(runtime, room) {
|
|
|
148
140
|
if (rooms.standing(room.locator).unreadable) {
|
|
149
141
|
rooms.stand(room.locator, { unreadable: false, refusal: null });
|
|
150
142
|
}
|
|
151
|
-
list(runtime, room, true);
|
|
143
|
+
list(runtime, room.locator, declared(room), true);
|
|
152
144
|
}
|
|
153
145
|
export async function heldRooms({ store }, listed) {
|
|
154
146
|
const stored = await store.rooms(listed.map((room) => room.locator));
|
|
@@ -159,7 +151,7 @@ export async function heldRooms({ store }, listed) {
|
|
|
159
151
|
? [{ locator: room.locator, roomVersion: null }]
|
|
160
152
|
: [];
|
|
161
153
|
}
|
|
162
|
-
if (record.replica.selection !== room.replica.selection)
|
|
154
|
+
if (record.declaration.replica.selection !== room.replica.selection)
|
|
163
155
|
return [];
|
|
164
156
|
return [{ locator: room.locator, roomVersion: record.roomVersion }];
|
|
165
157
|
});
|
package/dist/live.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,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AAK,KAAK,EACzB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,IAAI,GACX,MAAM,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAmCF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CA2HxF"}
|
package/dist/live.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { changeOf, digestOf, } from './observation.js';
|
|
2
|
+
import { uncaught } from './failure.js';
|
|
2
3
|
import { roomOfKey } from './rows.js';
|
|
3
4
|
function narrowed(plan) {
|
|
4
5
|
return (plan.paths !== null &&
|
|
@@ -112,7 +113,8 @@ export function createLiveQueries(run, holding) {
|
|
|
112
113
|
}
|
|
113
114
|
} while (recoverAgain && !closed);
|
|
114
115
|
}
|
|
115
|
-
catch {
|
|
116
|
+
catch (error) {
|
|
117
|
+
uncaught(error);
|
|
116
118
|
}
|
|
117
119
|
finally {
|
|
118
120
|
recovering = false;
|
package/dist/locks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../src/locks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../src/locks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAa5C,wBAAsB,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAK1F;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAW9E;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,iBAMzE;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,cAAc,EAAE,QAOlF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAU9C;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAE7E"}
|
package/dist/locks.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { uncaught } from './failure.js';
|
|
1
2
|
import { emitRooms, LOCKS_TOPIC } from './shown.js';
|
|
2
3
|
async function offlineModes({ store, socket }) {
|
|
3
4
|
const modes = new Map();
|
|
@@ -53,7 +54,7 @@ export function connectionLost(runtime) {
|
|
|
53
54
|
void lockedRooms(runtime).then((before) => {
|
|
54
55
|
socket.rooms.standAll({ confirmed: false });
|
|
55
56
|
return relocked(runtime, before);
|
|
56
|
-
},
|
|
57
|
+
}, uncaught);
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
export function watchLocks({ store }, notify) {
|
package/dist/lost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lost.d.ts","sourceRoot":"","sources":["../src/lost.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"lost.d.ts","sourceRoot":"","sources":["../src/lost.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAW5C,wBAAsB,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,iBAIhF;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,QAOtE;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,iBAoC5E"}
|
package/dist/lost.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { changeSet, mergeChangeSets } from './change-set.js';
|
|
2
2
|
import { ERASE_BATCH, forgetInstall } from './install.js';
|
|
3
|
-
import {
|
|
3
|
+
import { unpair } from './queue.js';
|
|
4
|
+
import { recoverReads } from './shown.js';
|
|
4
5
|
import { yielded } from './turn.js';
|
|
5
6
|
function forget({ store, socket }, locator) {
|
|
6
7
|
forgetInstall(store, locator);
|
|
@@ -54,8 +55,7 @@ export async function loseRooms(runtime, locators) {
|
|
|
54
55
|
drafts: held.filter((draft) => draft.locator === locator).map(({ path }) => path),
|
|
55
56
|
}))));
|
|
56
57
|
recoverReads(runtime);
|
|
57
|
-
statusShown(runtime);
|
|
58
58
|
}
|
|
59
|
-
await
|
|
59
|
+
await unpair(runtime);
|
|
60
60
|
await eraseFenced(runtime, fresh);
|
|
61
61
|
}
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ModelResult } from './model.js';
|
|
2
|
-
import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type SavedFacts, type HeadChange, type ListedAgent, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode, type TypedPath } from './adapter.js';
|
|
3
|
-
export type MemoryRoom = DiscoveredRoom & {
|
|
2
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type SavedFacts, type HeadChange, type ListedAgent, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode, type TypedPath, type TypedSelection } from './adapter.js';
|
|
3
|
+
export type MemoryRoom = Omit<DiscoveredRoom, 'typedSelection' | 'authoredPaths'> & {
|
|
4
|
+
typedSelection?: TypedSelection | null;
|
|
5
|
+
authoredPaths?: readonly string[];
|
|
4
6
|
model?: ModelResult;
|
|
5
7
|
documents?: Readonly<Record<string, string>>;
|
|
6
8
|
facts?: Readonly<Record<string, SavedFacts>>;
|
package/dist/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EAMf,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAKtB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,UAAU,EAGf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,MAAM,EAGX,KAAK,aAAa,EAIlB,KAAK,SAAS,EAGd,KAAK,WAAW,EAChB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EAMf,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAKtB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,UAAU,EAGf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,MAAM,EAGX,KAAK,aAAa,EAIlB,KAAK,SAAS,EAGd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAuBtB,MAAM,MAAM,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EAAE,GAAG,IAAI,CAAC;IAC1C,iBAAiB,CAAC,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,sBAAsB,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3D,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;IAC7C,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAAC;CACzC,CAAC;AA0CF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAupBrF"}
|
package/dist/memory.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { documentFacts, parse } from '@agentshouse/mdmodel';
|
|
1
|
+
import { definitionAt, documentFacts, parse } from '@agentshouse/mdmodel';
|
|
2
2
|
import { NO_ROOM_TYPES, schemaTypes } from './attached-model.js';
|
|
3
3
|
import { sameChange } from './overlay.js';
|
|
4
4
|
const ATTACHMENTS = 'attachments';
|
|
@@ -113,7 +113,9 @@ export function createMemoryAdapter(options = {}) {
|
|
|
113
113
|
}
|
|
114
114
|
const key = `${path}\u0000${content}`;
|
|
115
115
|
if (!held.has(key)) {
|
|
116
|
-
const facts = documentFacts(path, parse(content, path
|
|
116
|
+
const facts = documentFacts(path, parse(content, path, definitionAt({ types }, path, options.typedPaths)), {
|
|
117
|
+
types,
|
|
118
|
+
});
|
|
117
119
|
held.set(key, facts === null ? null : JSON.parse(JSON.stringify(facts)));
|
|
118
120
|
}
|
|
119
121
|
return held.get(key);
|
|
@@ -147,9 +149,9 @@ export function createMemoryAdapter(options = {}) {
|
|
|
147
149
|
roomVersion: room.roomVersion,
|
|
148
150
|
operations: room.operations,
|
|
149
151
|
replica: room.replica,
|
|
150
|
-
|
|
152
|
+
typedSelection: room.typedSelection ?? null,
|
|
151
153
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
152
|
-
authoredPaths: room.authoredPaths,
|
|
154
|
+
authoredPaths: room.authoredPaths ?? ['**'],
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
157
|
function page(room, after) {
|
|
@@ -599,7 +601,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
599
601
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
600
602
|
const blob = heldBlob(room, request.path);
|
|
601
603
|
return blob === undefined
|
|
602
|
-
? { kind: 'rejected', code: '
|
|
604
|
+
? { kind: 'rejected', code: 'not_found', fields: {}, retryable: false }
|
|
603
605
|
: { kind: 'binary', body: blob.stream(), mediaType: blob.type };
|
|
604
606
|
}, request);
|
|
605
607
|
},
|
|
@@ -610,7 +612,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
610
612
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
611
613
|
const blob = heldBlob(room, request.path);
|
|
612
614
|
if (blob === undefined) {
|
|
613
|
-
return { kind: 'rejected', code: '
|
|
615
|
+
return { kind: 'rejected', code: 'not_found', fields: {}, retryable: false };
|
|
614
616
|
}
|
|
615
617
|
const url = linked.get(blob) ?? URL.createObjectURL(blob);
|
|
616
618
|
linked.set(blob, url);
|
package/dist/messages.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { AcceptedMessage } from './adapter.js';
|
|
2
|
-
import type { JobMarker } from './job.js';
|
|
3
2
|
import type { Connection } from './tables.js';
|
|
4
3
|
export declare const MESSAGE_TABLES: readonly string[];
|
|
5
4
|
export declare const ROWS = "WITH chosen AS (\n SELECT listed.value AS conversation,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'assistant' ORDER BY position DESC, identity DESC LIMIT 1) AS answer,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND text <> '' ORDER BY position DESC, identity DESC LIMIT 1) AS said,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' ORDER BY position, identity LIMIT 1) AS opened,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' AND json_extract(message, '$.waiting') = 1 ORDER BY position, identity LIMIT 1) AS asking\n FROM json_each(?) AS listed\n )\n SELECT chosen.conversation AS conversation,\n substr(said.text, 1, 512) AS said_text,\n json_extract(said.message, '$.role') AS said_role,\n json_extract(said.message, '$.accepted_at') AS said_at,\n substr(json_extract(answer.message, '$.failure'), 1, 512) AS failure,\n json_extract(opened.message, '$.source') AS opened_source,\n json_extract(opened.message, '$.sender') AS opened_sender,\n asking.identity AS asking_identity,\n asking.text AS asking_text,\n json_extract(asking.message, '$.accepted_at') AS asking_at,\n json_extract(asking.message, '$.source') AS asking_source,\n json_extract(asking.message, '$.sender') AS asking_sender\n FROM chosen\n LEFT JOIN conversation_messages said ON said.id = chosen.said\n LEFT JOIN conversation_messages answer ON answer.id = chosen.answer\n LEFT JOIN conversation_messages opened ON opened.id = chosen.opened\n LEFT JOIN conversation_messages asking ON asking.id = chosen.asking";
|
|
6
|
-
export declare const JOB_MARKERS = "SELECT json_extract(part.value, '$.text') AS said,\n json_extract(message, '$.accepted_at') AS at\n FROM conversation_messages, json_each(message, '$.parts') AS part\n WHERE conversation = ? AND instr(message, '\"marker\":\"job\"') > 0\n AND json_extract(part.value, '$.type') = 'marker'\n AND json_extract(part.value, '$.marker') = 'job'\n ORDER BY position, identity, part.key";
|
|
7
5
|
export type HeldConversation = {
|
|
8
6
|
readonly conversation: string;
|
|
9
7
|
readonly read: string | null | undefined;
|
|
@@ -45,7 +43,6 @@ export declare function keptMessages(connection: Connection, { conversation, mes
|
|
|
45
43
|
export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null, phrase: string | null): MessageWindow;
|
|
46
44
|
export declare function messageCount(connection: Connection, conversation: string, phrase: string | null): number;
|
|
47
45
|
export declare function conversationRows(connection: Connection, conversations: readonly string[]): HeldRow[];
|
|
48
|
-
export declare function jobMarkers(connection: Connection, conversation: string): JobMarker[];
|
|
49
46
|
export declare function turnArrived(connection: Connection, conversation: string, turn: string): boolean;
|
|
50
47
|
export declare function droppedMessages(connection: Connection, conversations: readonly string[]): void;
|
|
51
48
|
export declare function forgottenMessages(connection: Connection): void;
|
package/dist/messages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAM1D,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;AAQF,eAAO,MAAM,IAAI,qwDAwBqD,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7F,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEtF,MAAM,MAA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