@agentshouse/mdruntime 0.1.0-caf080a9a9c60 → 0.1.0-cb0700ba4630b
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/README.md +18 -16
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +2 -21
- package/dist/act-lanes.d.ts +1 -0
- package/dist/act-lanes.d.ts.map +1 -1
- package/dist/act-lanes.js +53 -5
- package/dist/actions.d.ts +1 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +102 -50
- package/dist/adapter.d.ts +85 -14
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +0 -5
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/change.d.ts +4 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +3 -0
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +0 -2
- package/dist/client.d.ts +14 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -46
- package/dist/collection.d.ts +5 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +16 -8
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +2 -3
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +11 -12
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +18 -6
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +16 -6
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +19 -7
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +226 -163
- package/dist/discovery.d.ts +2 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +15 -6
- package/dist/download.d.ts +6 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +42 -0
- package/dist/durability.d.ts +2 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +5 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +22 -11
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +3 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +32 -10
- package/dist/house-query.d.ts +21 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +41 -0
- package/dist/index.d.ts +11 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/install.d.ts +9 -3
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +44 -46
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +26 -18
- package/dist/listing.d.ts +24 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +50 -21
- package/dist/live.d.ts +5 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +71 -30
- package/dist/loaded.d.ts +5 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +40 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +2 -3
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +2 -3
- package/dist/media.d.ts +18 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +102 -24
- package/dist/memory.d.ts +5 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +55 -15
- package/dist/messages.d.ts +12 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +24 -10
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +5 -8
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +206 -69
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +4 -9
- package/dist/outcome.d.ts +10 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +17 -2
- package/dist/overlay.d.ts +1 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +3 -5
- package/dist/parts.d.ts +3 -0
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +31 -5
- package/dist/preparation.d.ts +27 -6
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +137 -56
- package/dist/presence.d.ts +8 -2
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +24 -13
- package/dist/queries.d.ts +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +63 -61
- package/dist/questions.d.ts +1 -0
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +1 -0
- package/dist/queue.d.ts +1 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +54 -39
- package/dist/reach.d.ts +14 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +140 -29
- package/dist/react.d.ts +6 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +9 -3
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +3 -5
- package/dist/reads.d.ts +1 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +2 -2
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +2 -1
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +1 -3
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +2 -2
- package/dist/room-draft.d.ts +28 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +230 -12
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +5 -2
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +45 -0
- package/dist/rows.d.ts +2 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +6 -6
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runtime.d.ts +1 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +17 -86
- package/dist/saves.d.ts +2 -0
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +42 -18
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/shown.d.ts +5 -2
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +62 -39
- package/dist/socket/lanes.d.ts +10 -3
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +29 -6
- package/dist/socket/session.d.ts +2 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +1 -0
- package/dist/socket.d.ts +3 -3
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +3 -9
- package/dist/source.d.ts +5 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +13 -2
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +19 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +60 -22
- package/dist/store/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store.d.ts +14 -9
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +9 -4
- package/dist/stored.d.ts +24 -13
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +78 -27
- package/dist/surface.d.ts +12 -6
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +57 -25
- package/dist/sync.d.ts +3 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +27 -18
- package/dist/tables.d.ts +16 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +86 -324
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +1 -2
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +3 -9
- package/dist/wire.d.ts +33 -10
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +15 -8
- package/package.json +3 -3
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
package/dist/index.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
export { heldFacts } from './conversation-row.js';
|
|
2
2
|
export { PAGE_METADATA_WORDS } from './page-metadata.js';
|
|
3
3
|
export { writeRule } from './declaration.js';
|
|
4
|
+
export { blobOf, declaredType } from './outcome.js';
|
|
4
5
|
export { refusalError } from './failure.js';
|
|
5
|
-
export {
|
|
6
|
+
export { keptFile, keptLines } from './chat-types.js';
|
|
6
7
|
export { FIGURES_DAY_MS } from './figures.js';
|
|
7
8
|
export { departure } from './change.js';
|
|
8
9
|
export { definitionsIn, selected } from './collection.js';
|
|
9
10
|
export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
|
|
10
11
|
export { cutName, nameFrom, transliterated } from './name.js';
|
|
11
|
-
export { HISTORY_CONVERSATIONS
|
|
12
|
+
export { HISTORY_CONVERSATIONS } from './conversation.js';
|
|
12
13
|
export { contextFigure } from './context.js';
|
|
14
|
+
export { runningWords } from './running.js';
|
|
15
|
+
export { turnLine, WORKING } from './parts.js';
|
|
13
16
|
export { changeBatchIdentity } from './identity.js';
|
|
14
17
|
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
15
18
|
export { authoredAt, covered } from './paths.js';
|
|
16
19
|
export { untilAnswered } from './recovery.js';
|
|
17
20
|
export { createRetries, STEPS, retrying, Unanswered, uncertainError, } from './retried.js';
|
|
18
|
-
export {
|
|
21
|
+
export { patching } from './shared.js';
|
|
19
22
|
export { acting, } from './act-lanes.js';
|
|
20
23
|
export { expectation, expecting, } from './expectation.js';
|
|
24
|
+
export { leftToSend } from './durability.js';
|
package/dist/install.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AdapterFailure, Authorization, DiscoveredRoom, NotReady, RetryableRefusal } from './adapter.js';
|
|
2
2
|
import { type Reads } from './bootstrap.js';
|
|
3
|
-
import type { Installation, RoomCoverage } from './readiness.js';
|
|
3
|
+
import type { Installation, InstallationAmount, RoomCoverage } from './readiness.js';
|
|
4
4
|
import { advancement, type Refresher } from './refresh.js';
|
|
5
5
|
import type { ReplicaRecord } from './replica.js';
|
|
6
6
|
import type { Runtime } from './runtime.js';
|
|
@@ -33,9 +33,15 @@ type Refreshed = {
|
|
|
33
33
|
kind: 'advanced';
|
|
34
34
|
}>;
|
|
35
35
|
export declare const ERASE_BATCH = 512;
|
|
36
|
-
export
|
|
36
|
+
export type InstallShare = {
|
|
37
|
+
readonly installing: boolean;
|
|
38
|
+
readonly downloading: boolean;
|
|
39
|
+
readonly bytes: InstallationAmount;
|
|
40
|
+
};
|
|
41
|
+
export declare function installShare(store: Store, { room, state }: RoomCoverage, held: ReadonlyMap<string, CoveredRoom>): InstallShare;
|
|
42
|
+
export declare function installationOf(installing: number, downloading: number, bytes: InstallationAmount): Installation;
|
|
37
43
|
export declare function roomInFlight(store: Store, locator: string): boolean;
|
|
38
|
-
export declare function sweep({ store, socket
|
|
44
|
+
export declare function sweep({ store, socket }: Runtime): void;
|
|
39
45
|
export declare function caughtUpTo(runtime: Runtime, locator: string): void;
|
|
40
46
|
export declare function catching(store: Store, locator: string): void;
|
|
41
47
|
export declare function standingAt(store: Store, locator: string, held: Pick<ReplicaRecord, 'key'> | undefined): Standing;
|
package/dist/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,QAAQ,EACR,gBAAgB,EAEjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAkC,KAAK,KAAK,EAAgB,MAAM,gBAAgB,CAAC;AAO1F,OAAO,KAAK,EACV,YAAY,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,QAAQ,EACR,gBAAgB,EAEjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAkC,KAAK,KAAK,EAAgB,MAAM,gBAAgB,CAAC;AAO1F,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAElB,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAmB,MAAM,cAAc,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,KAAK,KAAK,EAGX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAG9D,KAAK,QAAQ,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,I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EAAE,MAAM,EAAE,EAAE,OAAO,EAC1B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAUlB;AAiFD,wBAAsB,WAAW,CAC/B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,aAAa,EACzB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,IAAI,EACd,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,CAAC,CA0CpB;AA8ID,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,aAAa,EACzB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,IAAI,EACd,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,IAAI,GAAE,KAA4B,EAClC,MAAM,CAAC,EAAE,MAAM;mBA6BI,uBAAuB;6DAa3C;AAED,wBAAgB,OAAO,CACrB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,OAAO,CAAC,CAmElB"}
|
package/dist/install.js
CHANGED
|
@@ -79,28 +79,32 @@ function batchEnd(entries, from, bytes) {
|
|
|
79
79
|
}
|
|
80
80
|
return end;
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
bytes
|
|
99
|
-
|
|
100
|
-
|
|
82
|
+
const UNSHARED = {
|
|
83
|
+
installing: false,
|
|
84
|
+
downloading: false,
|
|
85
|
+
bytes: { done: 0, total: 0 },
|
|
86
|
+
};
|
|
87
|
+
export function installShare(store, { room, state }, held) {
|
|
88
|
+
if (state === 'unadmitted')
|
|
89
|
+
return UNSHARED;
|
|
90
|
+
const install = store.installs.of(room);
|
|
91
|
+
const underway = state === 'acquiring' || (install.installing && state !== 'complete');
|
|
92
|
+
const kept = underway ? NOTHING_HELD.bytes : (held.get(room)?.bytes ?? NOTHING_HELD.bytes);
|
|
93
|
+
const now = amountOf(install, kept);
|
|
94
|
+
const earlier = underway ? install.startedOver : null;
|
|
95
|
+
return {
|
|
96
|
+
installing: underway,
|
|
97
|
+
downloading: underway && (install.streaming || install.arrived === null),
|
|
98
|
+
bytes: {
|
|
99
|
+
done: Math.max(now.done, earlier?.done ?? 0),
|
|
100
|
+
total: Math.max(now.total, earlier?.total ?? 0),
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export function installationOf(installing, downloading, bytes) {
|
|
101
105
|
const step = installing === 0
|
|
102
106
|
? null
|
|
103
|
-
: downloading
|
|
107
|
+
: downloading > 0
|
|
104
108
|
? 'downloading'
|
|
105
109
|
: bytes.done < bytes.total
|
|
106
110
|
? 'writing'
|
|
@@ -113,15 +117,15 @@ export function roomInFlight(store, locator) {
|
|
|
113
117
|
}
|
|
114
118
|
function installing(runtime, locator) {
|
|
115
119
|
runtime.store.installs.change(locator, (held) => ({ ...held, installing: true }));
|
|
116
|
-
runtime.store.readiness.queue();
|
|
120
|
+
runtime.store.readiness.queue([locator]);
|
|
117
121
|
}
|
|
118
122
|
function installed(runtime, locator) {
|
|
119
123
|
if (!runtime.store.installs.of(locator).installing)
|
|
120
124
|
return;
|
|
121
125
|
runtime.store.installs.change(locator, (held) => ({ ...held, installing: false }));
|
|
122
|
-
runtime.store.readiness.queue();
|
|
126
|
+
runtime.store.readiness.queue([locator]);
|
|
123
127
|
}
|
|
124
|
-
export function sweep({ store, socket
|
|
128
|
+
export function sweep({ store, socket }) {
|
|
125
129
|
if (store.device.now().sweeping || socket.closed())
|
|
126
130
|
return;
|
|
127
131
|
store.device.set({ sweeping: true });
|
|
@@ -132,7 +136,6 @@ export function sweep({ store, socket, journal }) {
|
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
138
|
catch (error) {
|
|
135
|
-
journal.record('erasure failed');
|
|
136
139
|
uncaught(error);
|
|
137
140
|
}
|
|
138
141
|
finally {
|
|
@@ -144,7 +147,7 @@ export function caughtUpTo(runtime, locator) {
|
|
|
144
147
|
if (!runtime.store.installs.of(locator).catching)
|
|
145
148
|
return;
|
|
146
149
|
runtime.store.installs.change(locator, (held) => ({ ...held, catching: false }));
|
|
147
|
-
recoverReads(runtime);
|
|
150
|
+
recoverReads(runtime, [locator]);
|
|
148
151
|
}
|
|
149
152
|
export function catching(store, locator) {
|
|
150
153
|
store.installs.change(locator, (held) => ({ ...held, catching: true }));
|
|
@@ -263,7 +266,7 @@ function refreshingOf(runtime, local, locator, key, composition, liveness, repla
|
|
|
263
266
|
export async function pullRefresh(runtime, authorized, record, liveness, hold, refresh) {
|
|
264
267
|
if (!liveness())
|
|
265
268
|
return unconfirmed;
|
|
266
|
-
const { store
|
|
269
|
+
const { store } = runtime;
|
|
267
270
|
const from = standingAt(store, record.locator, record);
|
|
268
271
|
const local = await store.open();
|
|
269
272
|
try {
|
|
@@ -277,11 +280,8 @@ export async function pullRefresh(runtime, authorized, record, liveness, hold, r
|
|
|
277
280
|
hold.take();
|
|
278
281
|
}
|
|
279
282
|
}, authorized, record, (models, kept) => (liveness() ? remodel(runtime, models, kept) : kept), liveness, refreshingOf(runtime, local, record.locator, record.key, store.composed(record), liveness, false, record.roomVersion));
|
|
280
|
-
if (result.kind !== 'advanced')
|
|
281
|
-
journal.record(`transfer refresh ${record.locator} ${result.kind}`);
|
|
283
|
+
if (result.kind !== 'advanced')
|
|
282
284
|
return result;
|
|
283
|
-
}
|
|
284
|
-
journal.record(`transfer refresh ${record.locator} ${result.record.roomVersion}`);
|
|
285
285
|
return {
|
|
286
286
|
kind: 'advanced',
|
|
287
287
|
record: result.record,
|
|
@@ -292,14 +292,14 @@ export async function pullRefresh(runtime, authorized, record, liveness, hold, r
|
|
|
292
292
|
catch (error) {
|
|
293
293
|
if (refusedForSpace(error))
|
|
294
294
|
return unconfirmed;
|
|
295
|
-
journal.record(`transfer refresh ${record.locator} transport-uncertainty`);
|
|
296
295
|
throw error;
|
|
297
296
|
}
|
|
298
297
|
}
|
|
299
298
|
async function abandoned(runtime, local, locator) {
|
|
300
299
|
await local.abandon(locator);
|
|
301
300
|
runtime.store.installs.change(locator, (held) => transferGone(setBack(held)));
|
|
302
|
-
recoverReads(runtime);
|
|
301
|
+
recoverReads(runtime, [locator]);
|
|
302
|
+
runtime.store.readiness.queue([locator]);
|
|
303
303
|
sweep(runtime);
|
|
304
304
|
}
|
|
305
305
|
function staging(runtime, local, liveness, unheld) {
|
|
@@ -313,7 +313,7 @@ function staging(runtime, local, liveness, unheld) {
|
|
|
313
313
|
if (done === null)
|
|
314
314
|
return false;
|
|
315
315
|
store.installs.change(locator, (held) => built(held, done.done, done.text));
|
|
316
|
-
runtime.store.readiness.queue();
|
|
316
|
+
runtime.store.readiness.queue([locator]);
|
|
317
317
|
if (done.done)
|
|
318
318
|
return true;
|
|
319
319
|
}
|
|
@@ -337,9 +337,9 @@ function staging(runtime, local, liveness, unheld) {
|
|
|
337
337
|
arrived: bytes,
|
|
338
338
|
streaming: true,
|
|
339
339
|
}));
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
const due = store.installs.arrivalsDue(locator, performance.now(), ARRIVAL_REPORT_MS);
|
|
341
|
+
if (due.length > 0)
|
|
342
|
+
runtime.store.readiness.queue(due);
|
|
343
343
|
},
|
|
344
344
|
end() {
|
|
345
345
|
if (ended)
|
|
@@ -348,7 +348,7 @@ function staging(runtime, local, liveness, unheld) {
|
|
|
348
348
|
if (!store.installs.of(locator).streaming)
|
|
349
349
|
return;
|
|
350
350
|
store.installs.change(locator, (held) => ({ ...held, streaming: false }));
|
|
351
|
-
runtime.store.readiness.queue();
|
|
351
|
+
runtime.store.readiness.queue([locator]);
|
|
352
352
|
},
|
|
353
353
|
};
|
|
354
354
|
},
|
|
@@ -376,7 +376,7 @@ function staging(runtime, local, liveness, unheld) {
|
|
|
376
376
|
underived: owed,
|
|
377
377
|
}));
|
|
378
378
|
installing(runtime, locator);
|
|
379
|
-
recoverReads(runtime);
|
|
379
|
+
recoverReads(runtime, [locator]);
|
|
380
380
|
if (owed < store.deriveBytes())
|
|
381
381
|
return held;
|
|
382
382
|
return (await derived(locator, key, composition)) ? held : null;
|
|
@@ -411,7 +411,8 @@ function staging(runtime, local, liveness, unheld) {
|
|
|
411
411
|
done: { bytes },
|
|
412
412
|
};
|
|
413
413
|
store.installs.change(locator, (room) => ({ ...room, transfer: held }));
|
|
414
|
-
recoverReads(runtime);
|
|
414
|
+
recoverReads(runtime, [locator]);
|
|
415
|
+
store.readiness.queue([locator]);
|
|
415
416
|
return { record: held, staged: parted };
|
|
416
417
|
},
|
|
417
418
|
derive: derived,
|
|
@@ -427,7 +428,8 @@ function staging(runtime, local, liveness, unheld) {
|
|
|
427
428
|
if (!liveness())
|
|
428
429
|
return;
|
|
429
430
|
store.installs.change(locator, (held) => transferGone(setBack(held)));
|
|
430
|
-
recoverReads(runtime);
|
|
431
|
+
recoverReads(runtime, [locator]);
|
|
432
|
+
store.readiness.queue([locator]);
|
|
431
433
|
},
|
|
432
434
|
release: (key) => store.exclusive(async () => {
|
|
433
435
|
await local.release(key);
|
|
@@ -438,23 +440,20 @@ function staging(runtime, local, liveness, unheld) {
|
|
|
438
440
|
export async function pullBootstrap(runtime, authorized, room, local, liveness, prior, from = runtime.socket.reads, unheld) {
|
|
439
441
|
if (!liveness())
|
|
440
442
|
return unconfirmed;
|
|
441
|
-
const { store
|
|
443
|
+
const { store } = runtime;
|
|
442
444
|
if (prior !== undefined) {
|
|
443
445
|
catching(store, room.locator);
|
|
444
|
-
recoverReads(runtime);
|
|
446
|
+
recoverReads(runtime, [room.locator]);
|
|
445
447
|
}
|
|
446
448
|
try {
|
|
447
449
|
const result = await bootstrapRoom(from, authorized, room, {
|
|
448
450
|
collection: prior?.model ?? runtime.presence.unheldModel(room.locator) ?? NO_MODEL,
|
|
449
451
|
}, runtime.builtIn, runtime.typedPaths, (models, held) => (liveness() ? remodel(runtime, models, held) : held), liveness, staging(runtime, local, liveness, unheld));
|
|
450
|
-
const detail = result.kind === 'staged' ? result.record.roomVersion : result.kind;
|
|
451
|
-
journal.record(`transfer bootstrap ${room.locator} ${detail}`);
|
|
452
452
|
if (result.kind === 'staged' &&
|
|
453
453
|
(await older(runtime, room.locator, result.record.roomVersion))) {
|
|
454
454
|
caughtUpTo(runtime, room.locator);
|
|
455
455
|
installed(runtime, room.locator);
|
|
456
456
|
await abandoned(runtime, local, room.locator);
|
|
457
|
-
journal.record(`transfer bootstrap ${room.locator} older than shown`);
|
|
458
457
|
return { kind: 'transport-uncertainty' };
|
|
459
458
|
}
|
|
460
459
|
if (result.kind !== 'staged') {
|
|
@@ -468,7 +467,6 @@ export async function pullBootstrap(runtime, authorized, room, local, liveness,
|
|
|
468
467
|
installed(runtime, room.locator);
|
|
469
468
|
if (refusedForSpace(error))
|
|
470
469
|
return unconfirmed;
|
|
471
|
-
journal.record(`transfer bootstrap ${room.locator} transport-uncertainty`);
|
|
472
470
|
throw error;
|
|
473
471
|
}
|
|
474
472
|
}
|
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":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAqO5C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,QAOhD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,QAQ1C;AAED,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,WAAW,EACX,OAAO,GACR,EAAE,OAAO,QAST;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,iBAS1C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,QAgDtE"}
|
package/dist/lifecycle.js
CHANGED
|
@@ -6,7 +6,8 @@ import { connectionLost } from './locks.js';
|
|
|
6
6
|
import { fenceLive } from './lost.js';
|
|
7
7
|
import { cachedModels, revoked, settleModels } from './models.js';
|
|
8
8
|
import { refuse } from './refusal.js';
|
|
9
|
-
import {
|
|
9
|
+
import { roomsListed } from './room-list.js';
|
|
10
|
+
import { emitRooms, moveTo, recoverReads, rest, SERVICE_MODE_TOPIC, show, submissionDue, transferring, } from './shown.js';
|
|
10
11
|
import { applyRoom, changeAuthority, countAuthorityChange, finishOpening, loadRoom, OPENING_LANE, reload, resynchronize, sync, } from './sync.js';
|
|
11
12
|
const CONVERSATION_LANE = 'conversations';
|
|
12
13
|
const RELOADING = 'reloading';
|
|
@@ -52,13 +53,13 @@ function owedReloads(runtime, expired, held) {
|
|
|
52
53
|
.map((room) => room.locator);
|
|
53
54
|
for (const locator of reloading)
|
|
54
55
|
catching(store, locator);
|
|
55
|
-
recoverReads(runtime);
|
|
56
|
+
recoverReads(runtime, reloading);
|
|
56
57
|
return reloading;
|
|
57
58
|
}
|
|
58
|
-
async function reloadNow(runtime, replacing, progress, held, installing) {
|
|
59
|
+
async function reloadNow(runtime, among, replacing, progress, held, installing) {
|
|
59
60
|
const { store, socket, presence } = runtime;
|
|
60
61
|
const { lanes } = socket;
|
|
61
|
-
const discovered = presence.rooms();
|
|
62
|
+
const discovered = among === null ? presence.rooms() : among.flatMap((locator) => presence.room(locator) ?? []);
|
|
62
63
|
const reloaded = discovered.filter((room) => held.has(room.locator) && !installing.has(room.locator) && replacing(room));
|
|
63
64
|
const acquired = discovered.filter((room) => (!held.has(room.locator) || installing.has(room.locator)) &&
|
|
64
65
|
room.replica.admission === 'admitted' &&
|
|
@@ -96,12 +97,13 @@ function caughtUpRooms(runtime, expired) {
|
|
|
96
97
|
socket.named();
|
|
97
98
|
const cycle = progress ?? { complete: true, reachable: true };
|
|
98
99
|
replaced(store, expired);
|
|
99
|
-
const
|
|
100
|
-
const
|
|
100
|
+
const among = progress === null ? expired : null;
|
|
101
|
+
const installing = store.installs.underway(among);
|
|
102
|
+
const held = among === null ? store.rooms() : store.rooms(among);
|
|
101
103
|
const reloading = progress === null
|
|
102
104
|
? Promise.resolve([])
|
|
103
105
|
: held.then((stored) => owedReloads(runtime, expired, stored));
|
|
104
|
-
const replacing = Promise.all([held, reloading]).then(([stored, owed]) => reloadNow(runtime, (room) => expired.includes(room.locator) || owed.includes(room.locator), cycle, stored, installing));
|
|
106
|
+
const replacing = Promise.all([held, reloading]).then(([stored, owed]) => reloadNow(runtime, among, (room) => expired.includes(room.locator) || owed.includes(room.locator), cycle, stored, installing));
|
|
105
107
|
return socket.lanes.task(OPENING_LANE, async (live) => {
|
|
106
108
|
if (!live())
|
|
107
109
|
return;
|
|
@@ -135,7 +137,7 @@ function caughtUpRooms(runtime, expired) {
|
|
|
135
137
|
});
|
|
136
138
|
}
|
|
137
139
|
function signalled(runtime, mode) {
|
|
138
|
-
const { store, socket
|
|
140
|
+
const { store, socket } = runtime;
|
|
139
141
|
const { session } = socket;
|
|
140
142
|
const { closed, serviceMode, haltedRefusal, openSignals } = session.now();
|
|
141
143
|
if (closed)
|
|
@@ -147,8 +149,7 @@ function signalled(runtime, mode) {
|
|
|
147
149
|
session.set({ haltedRefusal: false });
|
|
148
150
|
if (mode !== serviceMode) {
|
|
149
151
|
session.set({ serviceMode: mode });
|
|
150
|
-
store.readiness.queue();
|
|
151
|
-
journal.record(`service mode ${mode}`);
|
|
152
|
+
store.readiness.queue([]);
|
|
152
153
|
store.tell(SERVICE_MODE_TOPIC, mode);
|
|
153
154
|
}
|
|
154
155
|
if (releasing)
|
|
@@ -163,7 +164,7 @@ async function runCurrency(runtime, live) {
|
|
|
163
164
|
return;
|
|
164
165
|
await reconcileConversations(conversations);
|
|
165
166
|
if (conversations.current()) {
|
|
166
|
-
|
|
167
|
+
await rest(runtime, null, live);
|
|
167
168
|
return;
|
|
168
169
|
}
|
|
169
170
|
const progress = {
|
|
@@ -190,15 +191,14 @@ export function scheduleCurrency(runtime) {
|
|
|
190
191
|
void socket.lanes.task(CONVERSATION_LANE, (live) => runCurrency(runtime, live));
|
|
191
192
|
}
|
|
192
193
|
export function spaceFreed(runtime) {
|
|
193
|
-
const { store, socket
|
|
194
|
+
const { store, socket } = runtime;
|
|
194
195
|
store.prepareAgain();
|
|
195
|
-
journal.record('space freed');
|
|
196
196
|
store.readiness.queue();
|
|
197
197
|
const { closed, authorization } = socket.session.now();
|
|
198
198
|
if (closed || authorization === undefined)
|
|
199
199
|
return;
|
|
200
200
|
if (!socket.streamed)
|
|
201
|
-
void
|
|
201
|
+
void runtime.discover();
|
|
202
202
|
else
|
|
203
203
|
void resynchronize(runtime);
|
|
204
204
|
}
|
|
@@ -229,7 +229,7 @@ export function start(runtime, signal) {
|
|
|
229
229
|
socket.observeServiceMode((mode) => signalled(runtime, mode));
|
|
230
230
|
socket.observeConversations((event) => {
|
|
231
231
|
if (event.kind === 'list' || event.kind === 'listed' || event.kind === 'unlisted')
|
|
232
|
-
store.readiness.queue();
|
|
232
|
+
store.readiness.queue([]);
|
|
233
233
|
receiveConversationEvent(conversations, event);
|
|
234
234
|
if (event.kind !== 'gap' || conversations.current())
|
|
235
235
|
return;
|
|
@@ -247,8 +247,9 @@ export function start(runtime, signal) {
|
|
|
247
247
|
recovery.resume();
|
|
248
248
|
}
|
|
249
249
|
else if (event.kind === 'discovered') {
|
|
250
|
+
const listed = roomsListed(runtime, event.discovery.roomList);
|
|
250
251
|
if (event.missed)
|
|
251
|
-
countAuthorityChange(runtime);
|
|
252
|
+
countAuthorityChange(runtime, listed);
|
|
252
253
|
void sync(runtime, 'opened', event.discovery);
|
|
253
254
|
}
|
|
254
255
|
else if (event.kind === 'closed') {
|
|
@@ -256,6 +257,8 @@ export function start(runtime, signal) {
|
|
|
256
257
|
}
|
|
257
258
|
else if (event.kind === 'caught-up')
|
|
258
259
|
void caughtUpRooms(runtime, event.expired);
|
|
260
|
+
else if (event.kind === 'reported')
|
|
261
|
+
lastAnswers.again();
|
|
259
262
|
else if (event.kind === 'authority-changed') {
|
|
260
263
|
if (socket.isAnnounced() && socket.isOpen())
|
|
261
264
|
fenceLive(runtime, event.left);
|
|
@@ -267,7 +270,12 @@ export function start(runtime, signal) {
|
|
|
267
270
|
void store
|
|
268
271
|
.open()
|
|
269
272
|
.then(async (local) => {
|
|
270
|
-
|
|
273
|
+
const { capabilities, queriesOnly } = await local.facts(['capabilities', 'queriesOnly']);
|
|
274
|
+
if (queriesOnly.length > 0 && !socket.session.now().roomsNamed) {
|
|
275
|
+
socket.session.set({ queriesOnly });
|
|
276
|
+
void emitRooms(runtime);
|
|
277
|
+
}
|
|
278
|
+
if (capabilities.length > 0)
|
|
271
279
|
socket.readyFromStore();
|
|
272
280
|
})
|
|
273
281
|
.catch((error) => {
|
|
@@ -275,5 +283,5 @@ export function start(runtime, signal) {
|
|
|
275
283
|
uncaught(error);
|
|
276
284
|
});
|
|
277
285
|
if (!socket.streamed)
|
|
278
|
-
void
|
|
286
|
+
void runtime.discover();
|
|
279
287
|
}
|
package/dist/listing.d.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import type { HeldRooms } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { DiscoveredRoom, HeldRoom, OperationScopes, ProviderRefusal, ReplicaAdmission, RoomDeclaration } from './adapter.js';
|
|
3
|
-
import type
|
|
4
|
-
import
|
|
3
|
+
import { type Composition } from './collection.js';
|
|
4
|
+
import type { KeyedChange } from './observation.js';
|
|
5
|
+
import { type MdType, type ModelState, type TypesResult } from './model.js';
|
|
5
6
|
import { type PortReach } from './reach.js';
|
|
6
7
|
import type { ReplicaRecord } from './replica.js';
|
|
7
8
|
import type { Runtime } from './runtime.js';
|
|
8
9
|
import type { Stored } from './store.js';
|
|
9
|
-
|
|
10
|
+
type Selection<Model> = {
|
|
10
11
|
roots: readonly string[];
|
|
11
|
-
model:
|
|
12
|
+
model: Model;
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
+
type Shown<Model> = {
|
|
14
15
|
name: string;
|
|
15
16
|
locator: string;
|
|
16
17
|
handle: string;
|
|
17
18
|
operations: OperationScopes;
|
|
18
19
|
replica: ReplicaAdmission;
|
|
19
|
-
model:
|
|
20
|
-
typedSelection:
|
|
20
|
+
model: Model;
|
|
21
|
+
typedSelection: Selection<Model> | null;
|
|
21
22
|
providerOwnedPaths: readonly string[];
|
|
22
23
|
authoredPaths: readonly string[];
|
|
23
24
|
roomVersion: string | null;
|
|
@@ -25,12 +26,21 @@ export type AppRoom = {
|
|
|
25
26
|
synchronizationAvailable: boolean;
|
|
26
27
|
refusal: ProviderRefusal | null;
|
|
27
28
|
locked: boolean;
|
|
29
|
+
queriesOnly?: true;
|
|
28
30
|
};
|
|
29
|
-
type
|
|
30
|
-
type
|
|
31
|
-
|
|
31
|
+
export type AppTypedSelection = Selection<TypesResult>;
|
|
32
|
+
export type AppRoom = Shown<TypesResult>;
|
|
33
|
+
export type ListedRoom = Shown<TypesResult<string>>;
|
|
34
|
+
export type ListedModels = Readonly<Record<string, readonly MdType[]>>;
|
|
35
|
+
export type ListedRooms = {
|
|
36
|
+
readonly rooms: readonly ListedRoom[];
|
|
37
|
+
readonly models: ListedModels;
|
|
32
38
|
};
|
|
39
|
+
export type ListedEntry = Omit<Shown<ModelState>, 'locked'>;
|
|
33
40
|
export type Listing = ReadonlyMap<string, ListedEntry>;
|
|
41
|
+
export type RoomsChange = KeyedChange<string, ListedRoom> & {
|
|
42
|
+
readonly models: ListedModels;
|
|
43
|
+
};
|
|
34
44
|
export declare function modelIn({ socket, presence }: Runtime, locator: string, stored: Stored | undefined): ModelState;
|
|
35
45
|
export declare function compositionFor(runtime: Runtime, record: ReplicaRecord): Composition;
|
|
36
46
|
export declare function declarationOf({ presence }: Runtime, locator: string, stored: Stored | undefined): {
|
|
@@ -38,9 +48,11 @@ export declare function declarationOf({ presence }: Runtime, locator: string, st
|
|
|
38
48
|
readonly available: boolean;
|
|
39
49
|
} | undefined;
|
|
40
50
|
export declare function listedLocators({ presence }: Runtime, held: ReadonlyMap<string, unknown>): string[];
|
|
41
|
-
export declare function
|
|
51
|
+
export declare function listedOrHeld({ presence }: Runtime, held: ReadonlyMap<string, unknown>, locator: string): boolean;
|
|
52
|
+
export declare function listedEntries(runtime: Runtime, touched: readonly string[]): Promise<readonly ListedEntry[] | null>;
|
|
42
53
|
export declare function listingNow(runtime: Runtime): Promise<Listing>;
|
|
43
|
-
export declare function shownRooms(
|
|
54
|
+
export declare function shownRooms(runtime: Runtime, listing: Listing): ListedRooms;
|
|
55
|
+
export declare function shownChange(runtime: Runtime, entries: readonly ListedEntry[]): RoomsChange;
|
|
44
56
|
export declare function roomFacts(runtime: Runtime, reach?: PortReach | null): Promise<HeldRooms>;
|
|
45
57
|
export declare function heldRooms({ store }: Runtime, listed: readonly DiscoveredRoom[]): Promise<HeldRoom[]>;
|
|
46
58
|
export declare function name(runtime: Runtime, locator: string): Promise<void>;
|
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,EAChB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
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'./collection.js';
|
|
1
2
|
import { declared } from './declaration.js';
|
|
2
|
-
import {
|
|
3
|
+
import { modelResult, NO_MODEL, sortedTypes, } from './model.js';
|
|
3
4
|
import { governs, holds } from './reach.js';
|
|
4
5
|
export function modelIn({ socket, presence }, locator, stored) {
|
|
5
6
|
if (socket.session.now().refusal?.code === 'revoked-authorization')
|
|
@@ -26,6 +27,9 @@ export function listedLocators({ presence }, held) {
|
|
|
26
27
|
const listed = presence.rooms().map(({ locator }) => locator);
|
|
27
28
|
return [...new Set([...listed, ...held.keys()])];
|
|
28
29
|
}
|
|
30
|
+
export function listedOrHeld({ presence }, held, locator) {
|
|
31
|
+
return presence.room(locator) !== undefined || held.has(locator);
|
|
32
|
+
}
|
|
29
33
|
function selectionModel({ socket, builtIn }) {
|
|
30
34
|
return socket.session.now().refusal?.code === 'revoked-authorization'
|
|
31
35
|
? { status: 'unavailable', reason: 'revoked' }
|
|
@@ -43,10 +47,8 @@ function listedRoom(runtime, locator, stored) {
|
|
|
43
47
|
handle: room.handle,
|
|
44
48
|
operations: room.operations,
|
|
45
49
|
replica: room.replica,
|
|
46
|
-
model:
|
|
47
|
-
typedSelection: selection === null
|
|
48
|
-
? null
|
|
49
|
-
: { roots: selection.roots, model: modelTypes(selectionModel(runtime)) },
|
|
50
|
+
model: modelIn(runtime, locator, stored),
|
|
51
|
+
typedSelection: selection === null ? null : { roots: selection.roots, model: selectionModel(runtime) },
|
|
50
52
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
51
53
|
authoredPaths: room.authoredPaths,
|
|
52
54
|
roomVersion: stored?.record.roomVersion ?? null,
|
|
@@ -64,35 +66,62 @@ function listingOf(runtime, held) {
|
|
|
64
66
|
}
|
|
65
67
|
return listing;
|
|
66
68
|
}
|
|
67
|
-
export async function
|
|
69
|
+
export async function listedEntries(runtime, touched) {
|
|
68
70
|
const { store } = runtime;
|
|
69
|
-
|
|
70
|
-
if (roomsShown === null)
|
|
71
|
+
if (store.roomsShown.now() === null)
|
|
71
72
|
return null;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
if (touched.length === 0)
|
|
74
|
+
return [];
|
|
75
|
+
const held = await store.rooms(touched);
|
|
76
|
+
const entries = [];
|
|
77
|
+
for (const locator of touched) {
|
|
75
78
|
const room = listedRoom(runtime, locator, held.get(locator));
|
|
76
|
-
if (room === undefined ||
|
|
79
|
+
if (room === undefined || store.roomsShown.now()?.has(locator) !== true)
|
|
77
80
|
return null;
|
|
78
|
-
|
|
81
|
+
entries.push(room);
|
|
79
82
|
}
|
|
80
|
-
return
|
|
83
|
+
return entries;
|
|
81
84
|
}
|
|
82
85
|
export async function listingNow(runtime) {
|
|
83
86
|
return listingOf(runtime, await runtime.store.rooms());
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
function listedModel(state, models) {
|
|
89
|
+
return modelResult(state, (types) => {
|
|
90
|
+
const key = typesPrint(types);
|
|
91
|
+
if (!models.has(key))
|
|
92
|
+
models.set(key, sortedTypes(types));
|
|
93
|
+
return key;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function shownRoom({ presence }, { model, typedSelection, documents, ...room }, models) {
|
|
97
|
+
if (presence.lockedAs(room.locator, room.replica.offline)) {
|
|
98
|
+
return {
|
|
89
99
|
...room,
|
|
90
|
-
model:
|
|
100
|
+
model: listedModel(NO_MODEL, models),
|
|
91
101
|
typedSelection: null,
|
|
92
102
|
documents: 0,
|
|
93
103
|
locked: true,
|
|
94
|
-
}
|
|
95
|
-
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
...room,
|
|
108
|
+
model: listedModel(model, models),
|
|
109
|
+
typedSelection: typedSelection === null
|
|
110
|
+
? null
|
|
111
|
+
: { roots: typedSelection.roots, model: listedModel(typedSelection.model, models) },
|
|
112
|
+
documents,
|
|
113
|
+
locked: false,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export function shownRooms(runtime, listing) {
|
|
117
|
+
const models = new Map();
|
|
118
|
+
const rooms = [...listing.values()].map((entry) => shownRoom(runtime, entry, models));
|
|
119
|
+
return structuredClone({ rooms, models: Object.fromEntries(models) });
|
|
120
|
+
}
|
|
121
|
+
export function shownChange(runtime, entries) {
|
|
122
|
+
const models = new Map();
|
|
123
|
+
const changed = entries.map((entry) => [entry.locator, shownRoom(runtime, entry, models)]);
|
|
124
|
+
return structuredClone({ changed, removed: [], order: null, models: Object.fromEntries(models) });
|
|
96
125
|
}
|
|
97
126
|
export async function roomFacts(runtime, reach = null) {
|
|
98
127
|
const { store, socket, builtIn } = runtime;
|