@agentshouse/mdruntime 0.1.0-cd9e28a590f84 → 0.1.0-cdded6c080913
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 +1 -1
- package/dist/acceptance.d.ts +6 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +389 -0
- package/dist/actions.d.ts +20 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +250 -0
- package/dist/adapter.d.ts +23 -25
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +21 -56
- package/dist/bootstrap.d.ts +8 -4
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +209 -78
- package/dist/cell.d.ts +6 -0
- package/dist/cell.d.ts.map +1 -0
- package/dist/cell.js +9 -0
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/chat-types.d.ts +5 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +13 -0
- package/dist/client.d.ts +17 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -0
- package/dist/collection.d.ts +2 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/compile.d.ts +7 -7
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +229 -301
- package/dist/connection.d.ts +5 -141
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +98 -5279
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +53 -0
- package/dist/conversation.d.ts +16 -6
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +366 -216
- package/dist/discovery.d.ts +10 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +175 -0
- package/dist/durability.d.ts +15 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +2 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +17 -8
- package/dist/figures.d.ts +48 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/holdings.d.ts +29 -0
- package/dist/holdings.d.ts.map +1 -0
- package/dist/holdings.js +95 -0
- package/dist/host.d.ts +2 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +22 -15
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +19 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/install.d.ts +56 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +560 -0
- package/dist/job.d.ts +33 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +54 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +267 -0
- package/dist/listing.d.ts +53 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +175 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +62 -20
- package/dist/locks.d.ts +9 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +61 -0
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +61 -0
- package/dist/memory.d.ts +4 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +43 -4
- package/dist/messages.d.ts +25 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +84 -5
- package/dist/model.d.ts +2 -9
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -9
- package/dist/models.d.ts +14 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +193 -0
- package/dist/observation.d.ts +2 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +7 -2
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +56 -0
- package/dist/outcome.d.ts +4 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +3 -0
- package/dist/overlay.d.ts +1 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +11 -0
- package/dist/parts.d.ts +59 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +118 -0
- package/dist/preparation.d.ts +20 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +226 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +272 -0
- package/dist/query.d.ts +13 -212
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -524
- package/dist/questions.d.ts +34 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +122 -0
- package/dist/reach.d.ts +12 -10
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +165 -109
- package/dist/react.d.ts +9 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/reads.d.ts +36 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +150 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +9 -1
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +8 -20
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +56 -0
- package/dist/replica.d.ts +8 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +50 -18
- package/dist/room-draft.d.ts +2 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +216 -0
- package/dist/rows.d.ts +14 -22
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +48 -189
- package/dist/runtime.d.ts +42 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +11 -8
- package/dist/saves.d.ts +70 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +1004 -0
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +1 -1
- package/dist/seed.d.ts +11 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +71 -0
- package/dist/shown.d.ts +31 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +294 -0
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/lanes.d.ts +20 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +77 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket/rooms.d.ts +43 -0
- package/dist/socket/rooms.d.ts.map +1 -0
- package/dist/socket/rooms.js +90 -0
- package/dist/socket/session.d.ts +39 -0
- package/dist/socket/session.d.ts.map +1 -0
- package/dist/socket/session.js +23 -0
- package/dist/socket.d.ts +70 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +175 -0
- package/dist/source.d.ts +61 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +81 -0
- package/dist/status.d.ts +0 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -6
- package/dist/store/fences.d.ts +16 -0
- package/dist/store/fences.d.ts.map +1 -0
- package/dist/store/fences.js +26 -0
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/readiness.d.ts +10 -0
- package/dist/store/readiness.d.ts.map +1 -0
- package/dist/store/readiness.js +52 -0
- package/dist/store/records.d.ts +212 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +408 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/space.d.ts +11 -0
- package/dist/store/space.d.ts.map +1 -0
- package/dist/store/space.js +43 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +57 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +107 -153
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +143 -396
- package/dist/stored.d.ts +58 -64
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +244 -156
- package/dist/surface.d.ts +88 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +222 -0
- package/dist/sync.d.ts +20 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +531 -0
- package/dist/tables.d.ts +110 -48
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +209 -54
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +7 -4
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +16 -1
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +6 -0
- package/package.json +2 -2
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/phrase.d.ts +0 -3
- package/dist/phrase.d.ts.map +0 -1
- package/dist/phrase.js +0 -8
package/dist/reach.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { AppRoom
|
|
1
|
+
import type { AppRoom } from './listing.js';
|
|
2
|
+
import type { ReadinessPort } from './preparation.js';
|
|
3
|
+
import type { MdRuntime, RuntimeTopic } from './surface.js';
|
|
2
4
|
import type { Plan, PlanReach, QueryResult } from './query.js';
|
|
3
5
|
import type { Readiness } from './readiness.js';
|
|
4
6
|
import type { SearchResult } from './search.js';
|
|
@@ -18,26 +20,26 @@ export type PortReach = {
|
|
|
18
20
|
readonly conversations: boolean;
|
|
19
21
|
};
|
|
20
22
|
export type Deliver = (message: unknown) => void;
|
|
21
|
-
export type
|
|
23
|
+
export type Fail = (error: unknown) => void;
|
|
24
|
+
export type Watch = (topic: RuntimeTopic, input: readonly unknown[], deliver: Deliver, fail: Fail) => () => void;
|
|
22
25
|
export type RuntimeView = {
|
|
23
26
|
md: MdRuntime;
|
|
24
27
|
watch: Watch;
|
|
25
28
|
};
|
|
26
29
|
export type NarrowedView = RuntimeView & {
|
|
27
30
|
narrow(reach: PortReach | null): void;
|
|
28
|
-
facts(port: ReadinessPort): void;
|
|
29
31
|
};
|
|
30
32
|
export type Reachable = RuntimeView & {
|
|
31
|
-
plan(input: unknown, reach: PortReach | null): Plan
|
|
33
|
+
plan(input: unknown, reach: PortReach | null): Promise<Plan>;
|
|
32
34
|
query(plan: Plan): Promise<QueryResult>;
|
|
33
|
-
watchPlan(plan: Plan, deliver:
|
|
35
|
+
watchPlan(plan: Plan, deliver: Deliver, fail: Fail): () => void;
|
|
34
36
|
search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
|
|
35
37
|
watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
36
|
-
locked(room: string): boolean
|
|
37
|
-
lockedRooms(): readonly string[]
|
|
38
|
+
locked(room: string): Promise<boolean>;
|
|
39
|
+
lockedRooms(): Promise<readonly string[]>;
|
|
38
40
|
watchLocks(notify: () => void): () => void;
|
|
39
|
-
located(room: string, path: string, destination: string): ReachedDocument | null
|
|
40
|
-
room(locator: string): AppRoom | undefined
|
|
41
|
+
located(room: string, path: string, destination: string): Promise<ReachedDocument | null>;
|
|
42
|
+
room(locator: string): Promise<AppRoom | undefined>;
|
|
41
43
|
};
|
|
42
44
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
43
45
|
export declare function governs(reach: PortReach | null, room: {
|
|
@@ -50,5 +52,5 @@ export declare function governs(reach: PortReach | null, room: {
|
|
|
50
52
|
readonly selection: boolean;
|
|
51
53
|
};
|
|
52
54
|
export declare function planReach(reach: PortReach | null): PlanReach | null;
|
|
53
|
-
export declare function narrowed(runtime: Reachable, given: PortReach | null,
|
|
55
|
+
export declare function narrowed(runtime: Reachable, given: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
54
56
|
//# sourceMappingURL=reach.d.ts.map
|
package/dist/reach.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reach.d.ts","sourceRoot":"","sources":["../src/reach.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"reach.d.ts","sourceRoot":"","sources":["../src/reach.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AA2BzE,OAAO,KAAK,EAAiB,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAA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,CAU/D;AAeD,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAcnE;AA2GD,wBAAgB,QAAQ,CACtB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,SAAS,GAAG,IAAI,EACvB,IAAI,EAAE,aAAa,GAClB,YAAY,CAiYd"}
|
package/dist/reach.js
CHANGED
|
@@ -143,7 +143,7 @@ function lockedError(room) {
|
|
|
143
143
|
return runtimeError(ROOM_LOCKED, `${room} is locked until House confirms its access`, true);
|
|
144
144
|
}
|
|
145
145
|
function deviceUnreached() {
|
|
146
|
-
return runtimeError('device-unreached', 'Only the panel
|
|
146
|
+
return runtimeError('device-unreached', 'Only the panel reaches this device');
|
|
147
147
|
}
|
|
148
148
|
const ATTACH_REQUIRED = 'attach-required';
|
|
149
149
|
function attachRequired() {
|
|
@@ -152,10 +152,9 @@ function attachRequired() {
|
|
|
152
152
|
function carriesFile(parts) {
|
|
153
153
|
return parts !== null && typeof parts === 'object' && Object.hasOwn(parts, 'file');
|
|
154
154
|
}
|
|
155
|
-
export function narrowed(runtime, given,
|
|
155
|
+
export function narrowed(runtime, given, port) {
|
|
156
156
|
const { md, watch } = runtime;
|
|
157
157
|
let reach = given;
|
|
158
|
-
let port = told;
|
|
159
158
|
const open = new Set();
|
|
160
159
|
function following(begin, locking = false) {
|
|
161
160
|
let stop = begin();
|
|
@@ -171,70 +170,127 @@ export function narrowed(runtime, given, told) {
|
|
|
171
170
|
stop();
|
|
172
171
|
};
|
|
173
172
|
}
|
|
174
|
-
const unlocking = (rooms) => {
|
|
175
|
-
const
|
|
176
|
-
return
|
|
177
|
-
? null
|
|
178
|
-
: { pending: locked.map((room) => ({ room, awaits: 'unlock' })) };
|
|
173
|
+
const unlocking = (rooms, locked) => {
|
|
174
|
+
const held = (rooms ?? []).filter((room) => locked.includes(room));
|
|
175
|
+
return held.length === 0 ? null : { pending: held.map((room) => ({ room, awaits: 'unlock' })) };
|
|
179
176
|
};
|
|
180
|
-
const unlocked = (entries) => entries.filter((entry) => !
|
|
181
|
-
const intoLocked = (held) =>
|
|
182
|
-
|
|
177
|
+
const unlocked = (entries, locked) => entries.filter((entry) => !locked.includes(entry.room));
|
|
178
|
+
const intoLocked = async (held) => {
|
|
179
|
+
for (const move of held) {
|
|
180
|
+
if (move?.room !== undefined && (await runtime.locked(move.room)))
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
};
|
|
185
|
+
function ordered(deliver) {
|
|
186
|
+
let open = true;
|
|
187
|
+
let shown = Promise.resolve();
|
|
188
|
+
return {
|
|
189
|
+
push(making) {
|
|
190
|
+
shown = shown.then(() => making.then((value) => {
|
|
191
|
+
if (open)
|
|
192
|
+
deliver(value);
|
|
193
|
+
}, () => { }), () => { });
|
|
194
|
+
},
|
|
195
|
+
stop() {
|
|
196
|
+
open = false;
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function unlockedWatch(topic, input, deliver, fail, within) {
|
|
201
|
+
const shown = ordered(deliver);
|
|
202
|
+
const stop = watch(topic, input, (message) => {
|
|
203
|
+
shown.push(runtime.lockedRooms().then((locked) => within(message, locked)));
|
|
204
|
+
}, fail);
|
|
205
|
+
return () => {
|
|
206
|
+
shown.stop();
|
|
207
|
+
stop();
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function lockedFirst(room, start, shut) {
|
|
211
|
+
let open = true;
|
|
212
|
+
let stop = () => { };
|
|
213
|
+
void (async () => {
|
|
214
|
+
const closed = !holds(reach, room) || (await runtime.locked(room));
|
|
215
|
+
if (!open)
|
|
216
|
+
return;
|
|
217
|
+
if (closed)
|
|
218
|
+
shut();
|
|
219
|
+
else
|
|
220
|
+
stop = start();
|
|
221
|
+
})();
|
|
222
|
+
return () => {
|
|
223
|
+
open = false;
|
|
224
|
+
stop();
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
const within = (topic, input, deliver, fail) => {
|
|
228
|
+
if (topic === 'read' && reach !== null) {
|
|
229
|
+
fail(deviceUnreached());
|
|
230
|
+
return () => { };
|
|
231
|
+
}
|
|
183
232
|
if (topic === 'rooms') {
|
|
184
|
-
return following(() => watch(topic, input, (rooms) => deliver(roomsWithin(reach, rooms))));
|
|
233
|
+
return following(() => watch(topic, input, (rooms) => deliver(roomsWithin(reach, rooms)), fail));
|
|
185
234
|
}
|
|
186
235
|
if (topic === 'readiness') {
|
|
187
236
|
return following(() => runtime.watchReadiness(port, reach, deliver));
|
|
188
237
|
}
|
|
189
238
|
if (topic === 'sync-status') {
|
|
190
|
-
return following(() =>
|
|
191
|
-
const
|
|
192
|
-
|
|
239
|
+
return following(() => unlockedWatch(topic, input, deliver, fail, (status, locked) => {
|
|
240
|
+
const shown = statusWithin(reach, status);
|
|
241
|
+
return { ...shown, attentionRequired: unlocked(shown.attentionRequired, locked) };
|
|
193
242
|
}), true);
|
|
194
243
|
}
|
|
195
244
|
if (topic === 'room-drafts') {
|
|
196
|
-
return following(() =>
|
|
245
|
+
return following(() => unlockedWatch(topic, input, deliver, fail, (drafts, locked) => unlocked(draftsWithin(reach, drafts), locked)), true);
|
|
197
246
|
}
|
|
198
247
|
if (topic === 'queue') {
|
|
199
248
|
const room = input[0];
|
|
200
|
-
return following(() =>
|
|
201
|
-
if (!holds(reach, room) || runtime.locked(room)) {
|
|
202
|
-
deliver([]);
|
|
203
|
-
return () => { };
|
|
204
|
-
}
|
|
205
|
-
return watch(topic, input, (entries) => deliver(queueWithin(reach, room, entries)));
|
|
206
|
-
}, true);
|
|
249
|
+
return following(() => lockedFirst(room, () => watch(topic, input, (entries) => deliver(queueWithin(reach, room, entries)), fail), () => deliver([])), true);
|
|
207
250
|
}
|
|
208
251
|
if (topic === 'query') {
|
|
209
|
-
const
|
|
252
|
+
const planning = runtime.plan(input[0], reach);
|
|
210
253
|
let held = null;
|
|
211
254
|
return following(() => {
|
|
212
|
-
const locked = unlocking(plan.rooms);
|
|
213
|
-
if (locked !== null) {
|
|
214
|
-
const answer = { result: locked, keys: [] };
|
|
215
|
-
if (held === null || changeOf(held, answer) !== null)
|
|
216
|
-
deliver(answer);
|
|
217
|
-
held = digestOf(answer);
|
|
218
|
-
return () => { };
|
|
219
|
-
}
|
|
220
|
-
let first = true;
|
|
221
255
|
let open = true;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
256
|
+
let stop = () => { };
|
|
257
|
+
void (async () => {
|
|
258
|
+
const plan = await planning;
|
|
259
|
+
const locked = await runtime.lockedRooms();
|
|
260
|
+
if (!open)
|
|
261
|
+
return;
|
|
262
|
+
const pending = unlocking(plan.rooms, locked);
|
|
263
|
+
if (pending !== null) {
|
|
264
|
+
const answer = { result: pending, keys: [] };
|
|
265
|
+
if (held === null || changeOf(held, answer) !== null)
|
|
266
|
+
deliver(answer);
|
|
267
|
+
held = digestOf(answer);
|
|
226
268
|
return;
|
|
227
269
|
}
|
|
228
|
-
first =
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
270
|
+
let first = true;
|
|
271
|
+
const heard = (message) => {
|
|
272
|
+
if (!first) {
|
|
273
|
+
held = digestApplied(held, message);
|
|
274
|
+
deliver(message);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
first = false;
|
|
278
|
+
const change = held === null ? message : changeOf(held, message);
|
|
279
|
+
held = digestOf(message);
|
|
280
|
+
if (change !== null)
|
|
281
|
+
deliver(change);
|
|
282
|
+
};
|
|
283
|
+
const current = { ...plan, reach: planReach(reach), locked };
|
|
284
|
+
stop = runtime.watchPlan(current, (message) => {
|
|
285
|
+
if (open)
|
|
286
|
+
heard(message);
|
|
287
|
+
}, (error) => {
|
|
288
|
+
if (open)
|
|
289
|
+
fail(error);
|
|
290
|
+
});
|
|
291
|
+
})().catch((error) => {
|
|
236
292
|
if (open)
|
|
237
|
-
|
|
293
|
+
fail(error);
|
|
238
294
|
});
|
|
239
295
|
return () => {
|
|
240
296
|
open = false;
|
|
@@ -245,7 +301,7 @@ export function narrowed(runtime, given, told) {
|
|
|
245
301
|
if (topic === 'conversation') {
|
|
246
302
|
return following(() => {
|
|
247
303
|
if (conversing(reach))
|
|
248
|
-
return watch(topic, input, deliver);
|
|
304
|
+
return watch(topic, input, deliver, fail);
|
|
249
305
|
deliver(unheldView(input[0]));
|
|
250
306
|
return () => { };
|
|
251
307
|
});
|
|
@@ -253,12 +309,18 @@ export function narrowed(runtime, given, told) {
|
|
|
253
309
|
if (topic === 'conversations' || topic === 'agents') {
|
|
254
310
|
return following(() => {
|
|
255
311
|
if (conversing(reach))
|
|
256
|
-
return watch(topic, input, deliver);
|
|
312
|
+
return watch(topic, input, deliver, fail);
|
|
257
313
|
deliver([]);
|
|
258
314
|
return () => { };
|
|
259
315
|
});
|
|
260
316
|
}
|
|
261
|
-
|
|
317
|
+
if (topic === 'figures' || topic === 'holdings') {
|
|
318
|
+
if (reach === null)
|
|
319
|
+
return watch(topic, input, deliver, fail);
|
|
320
|
+
fail(deviceUnreached());
|
|
321
|
+
return () => { };
|
|
322
|
+
}
|
|
323
|
+
return watch(topic, input, deliver, fail);
|
|
262
324
|
};
|
|
263
325
|
const files = new Map();
|
|
264
326
|
let handed = 0;
|
|
@@ -276,31 +338,33 @@ export function narrowed(runtime, given, told) {
|
|
|
276
338
|
const view = {
|
|
277
339
|
...md,
|
|
278
340
|
rooms: () => md.rooms().then((rooms) => roomsWithin(reach, rooms)),
|
|
279
|
-
query: ((input) => {
|
|
280
|
-
const plan = runtime.plan(input, reach);
|
|
281
|
-
|
|
341
|
+
query: (async (input) => {
|
|
342
|
+
const plan = await runtime.plan(input, reach);
|
|
343
|
+
const locked = await runtime.lockedRooms();
|
|
344
|
+
return unlocking(plan.rooms, locked) ?? runtime.query({ ...plan, locked });
|
|
282
345
|
}),
|
|
283
346
|
search: (input) => runtime.search(input, reach),
|
|
284
|
-
types(room) {
|
|
285
|
-
if (holds(reach, room) && runtime.locked(room))
|
|
347
|
+
async types(room) {
|
|
348
|
+
if (holds(reach, room) && (await runtime.locked(room)))
|
|
286
349
|
throw lockedError(room);
|
|
287
350
|
if (wholly(reach, room))
|
|
288
351
|
return md.types(room);
|
|
289
352
|
if (!holds(reach, room))
|
|
290
353
|
return structuredClone(UNHELD_TYPES);
|
|
291
|
-
return typesWithin(reach, runtime.room(room), md.types(room));
|
|
354
|
+
return typesWithin(reach, await runtime.room(room), await md.types(room));
|
|
292
355
|
},
|
|
293
356
|
async save(room, roomDrafts, writtenBy) {
|
|
294
357
|
if (!holds(reach, room))
|
|
295
358
|
throw unreached(room);
|
|
296
|
-
if (runtime.locked(room))
|
|
359
|
+
if (await runtime.locked(room)) {
|
|
297
360
|
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
361
|
+
}
|
|
298
362
|
const held = (await Promise.all(roomDrafts.map(({ path }) => md.roomDraft.read(room, path)))).map((draft) => draft?.parts.move);
|
|
299
363
|
const outside = roomDrafts.find(({ path }, at) => !covers(reach, room, path) || !moves(reach, room, held[at]));
|
|
300
364
|
if (outside !== undefined) {
|
|
301
365
|
return { outcome: 'refused', code: 'stale', retryable: false, file: outside.path };
|
|
302
366
|
}
|
|
303
|
-
if (intoLocked(held))
|
|
367
|
+
if (await intoLocked(held))
|
|
304
368
|
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
305
369
|
return savedWithin(reach, room, await md.save(room, roomDrafts, writtenBy));
|
|
306
370
|
},
|
|
@@ -311,47 +375,48 @@ export function narrowed(runtime, given, told) {
|
|
|
311
375
|
if (filed !== undefined) {
|
|
312
376
|
return { outcome: 'refused', code: ATTACH_REQUIRED, retryable: false, file: filed.path };
|
|
313
377
|
}
|
|
314
|
-
if (runtime.locked(room))
|
|
378
|
+
if (await runtime.locked(room)) {
|
|
315
379
|
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
380
|
+
}
|
|
316
381
|
const held = parts.map(({ path, parts: one }) => readParts(one, path).move);
|
|
317
382
|
if (parts.some(({ path }, at) => !covers(reach, room, path) || !moves(reach, room, held[at]))) {
|
|
318
383
|
throw unreached(room);
|
|
319
384
|
}
|
|
320
|
-
if (intoLocked(held))
|
|
385
|
+
if (await intoLocked(held))
|
|
321
386
|
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
322
387
|
return savedWithin(reach, room, await md.saveParts(room, parts, writtenBy));
|
|
323
388
|
},
|
|
324
|
-
resolve(room, path, destination) {
|
|
325
|
-
const at = runtime.located(room, path, destination);
|
|
389
|
+
async resolve(room, path, destination) {
|
|
390
|
+
const at = await runtime.located(room, path, destination);
|
|
326
391
|
return at !== null && !covers(reach, at.room, at.path)
|
|
327
|
-
?
|
|
392
|
+
? UNREADABLE
|
|
328
393
|
: md.resolve(room, path, destination);
|
|
329
394
|
},
|
|
330
|
-
history: (room, path, query) => !covers(reach, room, path)
|
|
331
|
-
?
|
|
332
|
-
: runtime.locked(room)
|
|
333
|
-
?
|
|
395
|
+
history: async (room, path, query) => !covers(reach, room, path)
|
|
396
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
397
|
+
: (await runtime.locked(room))
|
|
398
|
+
? lockedRoom(room)
|
|
334
399
|
: md.history(room, path, query),
|
|
335
400
|
binaryFile: {
|
|
336
|
-
read: (room, path, revision) => !covers(reach, room, path)
|
|
337
|
-
?
|
|
338
|
-
: runtime.locked(room)
|
|
339
|
-
?
|
|
401
|
+
read: async (room, path, revision) => !covers(reach, room, path)
|
|
402
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
403
|
+
: (await runtime.locked(room))
|
|
404
|
+
? lockedRoom(room)
|
|
340
405
|
: hand(md.binaryFile.read(room, path, revision)),
|
|
341
|
-
link: (room, path, revision) => !covers(reach, room, path)
|
|
342
|
-
?
|
|
343
|
-
: runtime.locked(room)
|
|
344
|
-
?
|
|
406
|
+
link: async (room, path, revision) => !covers(reach, room, path)
|
|
407
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
408
|
+
: (await runtime.locked(room))
|
|
409
|
+
? lockedRoom(room)
|
|
345
410
|
: md.binaryFile.link(room, path, revision),
|
|
346
|
-
show: (room, path, revision) => !covers(reach, room, path)
|
|
347
|
-
?
|
|
348
|
-
: runtime.locked(room)
|
|
349
|
-
?
|
|
411
|
+
show: async (room, path, revision) => !covers(reach, room, path)
|
|
412
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
413
|
+
: (await runtime.locked(room))
|
|
414
|
+
? lockedRoom(room)
|
|
350
415
|
: hand(md.binaryFile.show(room, path, revision)),
|
|
351
|
-
attach: (room, file) => !wholly(reach, room)
|
|
352
|
-
?
|
|
353
|
-
: runtime.locked(room)
|
|
354
|
-
?
|
|
416
|
+
attach: async (room, file) => !wholly(reach, room)
|
|
417
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
418
|
+
: (await runtime.locked(room))
|
|
419
|
+
? lockedRoom(room)
|
|
355
420
|
: md.binaryFile.attach(room, file),
|
|
356
421
|
async part(file, part) {
|
|
357
422
|
const key = files.get(file);
|
|
@@ -364,42 +429,38 @@ export function narrowed(runtime, given, told) {
|
|
|
364
429
|
},
|
|
365
430
|
},
|
|
366
431
|
reached: async (room, roomVersion, path) => (path === undefined ? wholly(reach, room) : covers(reach, room, path)) &&
|
|
367
|
-
!runtime.locked(room) &&
|
|
432
|
+
!(await runtime.locked(room)) &&
|
|
368
433
|
(await md.reached(room, roomVersion, path)),
|
|
369
434
|
log: () => (reach === null ? md.log() : ''),
|
|
370
435
|
cleanUp: () => (reach === null ? md.cleanUp() : Promise.reject(deviceUnreached())),
|
|
436
|
+
unsent: () => (reach === null ? md.unsent() : Promise.reject(deviceUnreached())),
|
|
437
|
+
reset: () => (reach === null ? md.reset() : Promise.reject(deviceUnreached())),
|
|
438
|
+
readAgain: () => (reach === null ? md.readAgain() : Promise.reject(deviceUnreached())),
|
|
371
439
|
roomDraft: {
|
|
372
|
-
list: () => md.roomDraft.list()
|
|
440
|
+
list: async () => unlocked(draftsWithin(reach, await md.roomDraft.list()), await runtime.lockedRooms()),
|
|
373
441
|
async read(room, path) {
|
|
374
442
|
if (!covers(reach, room, path))
|
|
375
443
|
return null;
|
|
376
|
-
if (runtime.locked(room))
|
|
444
|
+
if (await runtime.locked(room))
|
|
377
445
|
throw lockedError(room);
|
|
378
446
|
return shownDraft(reach, await md.roomDraft.read(room, path));
|
|
379
447
|
},
|
|
380
|
-
write(room, path, revision, parts, next) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
catch (error) {
|
|
393
|
-
return Promise.reject(error);
|
|
394
|
-
}
|
|
395
|
-
return md.roomDraft
|
|
396
|
-
.write(room, path, revision, parts, next)
|
|
397
|
-
.then((written) => writeWithin(reach, written));
|
|
448
|
+
async write(room, path, revision, parts, next) {
|
|
449
|
+
if (reach !== null && carriesFile(parts))
|
|
450
|
+
throw attachRequired();
|
|
451
|
+
const move = readParts(parts, path).move;
|
|
452
|
+
if (!covers(reach, room, path) || !moves(reach, room, move))
|
|
453
|
+
throw unreached(room);
|
|
454
|
+
if (await runtime.locked(room))
|
|
455
|
+
throw lockedError(room);
|
|
456
|
+
if (await intoLocked([move]))
|
|
457
|
+
throw lockedError(move.room);
|
|
458
|
+
return writeWithin(reach, await md.roomDraft.write(room, path, revision, parts, next));
|
|
398
459
|
},
|
|
399
460
|
async discard(room, path, revision) {
|
|
400
461
|
if (!covers(reach, room, path))
|
|
401
462
|
return staleWrite(null);
|
|
402
|
-
if (runtime.locked(room))
|
|
463
|
+
if (await runtime.locked(room))
|
|
403
464
|
throw lockedError(room);
|
|
404
465
|
return writeWithin(reach, await md.roomDraft.discard(room, path, revision));
|
|
405
466
|
},
|
|
@@ -429,10 +490,5 @@ export function narrowed(runtime, given, told) {
|
|
|
429
490
|
for (const restart of [...open])
|
|
430
491
|
restart();
|
|
431
492
|
},
|
|
432
|
-
facts(next) {
|
|
433
|
-
port = next;
|
|
434
|
-
for (const restart of [...open])
|
|
435
|
-
restart();
|
|
436
|
-
},
|
|
437
493
|
};
|
|
438
494
|
}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
1
2
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import type { AppRoom
|
|
3
|
+
import type { AppRoom } from './listing.js';
|
|
4
|
+
import type { ConnectionRefusal } from './socket.js';
|
|
5
|
+
import type { SavedRoomDraft, SaveResult } from './saves.js';
|
|
3
6
|
import type { Member, ServiceMode } from './adapter.js';
|
|
4
7
|
import type { ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
5
8
|
import { type RuntimeError } from './failure.js';
|
|
9
|
+
import type { FiguresResult } from './figures.js';
|
|
10
|
+
import type { Holdings } from './holdings.js';
|
|
6
11
|
import type { QueueEntry } from './outcome.js';
|
|
7
|
-
import type {
|
|
12
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
8
13
|
import type { Readiness } from './readiness.js';
|
|
9
14
|
import type { RoomDraft, RoomDraftParts } from './room-draft.js';
|
|
10
15
|
import type { SyncStatus } from './status.js';
|
|
@@ -32,6 +37,8 @@ export declare function useObserve(client: Client, topic: 'presentation'): Obser
|
|
|
32
37
|
export declare function useObserve(client: Client, topic: 'conversation', conversation: string, options: ConversationOptions): Observed<ConversationView>;
|
|
33
38
|
export declare function useObserve(client: Client, topic: 'conversations'): Observed<readonly ConversationEntry[]>;
|
|
34
39
|
export declare function useObserve(client: Client, topic: 'agents'): Observed<readonly ConversationAgent[]>;
|
|
40
|
+
export declare function useObserve(client: Client, topic: 'figures'): Observed<FiguresResult>;
|
|
41
|
+
export declare function useObserve(client: Client, topic: 'holdings'): Observed<Holdings>;
|
|
35
42
|
export type Saving = {
|
|
36
43
|
readonly busy: boolean;
|
|
37
44
|
readonly outcome: SaveResult | null;
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK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AAK,EAAE,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AACtF,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAsClF,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IACtC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpF,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACvF,CAAC;AAMF,wBAAgB,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CA8BvD"}
|
package/dist/read.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Fields = Readonly<Record<string, unknown>>;
|
|
2
|
+
export declare const EXCERPT = 512;
|
|
3
|
+
export declare function excerpt(said: string): string;
|
|
4
|
+
export declare function record(entry: unknown): Fields;
|
|
5
|
+
export declare function text(fields: Fields, name: string): string | null;
|
|
6
|
+
export declare function list(fields: Fields, name: string): readonly unknown[];
|
|
7
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvD,eAAO,MAAM,OAAO,MAAM,CAAC;AAE3B,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI7C;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,CAGrE"}
|
package/dist/read.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const EXCERPT = 512;
|
|
2
|
+
export function excerpt(said) {
|
|
3
|
+
return [...said.slice(0, EXCERPT * 2)].slice(0, EXCERPT).join('');
|
|
4
|
+
}
|
|
5
|
+
export function record(entry) {
|
|
6
|
+
return typeof entry === 'object' && entry !== null && !Array.isArray(entry)
|
|
7
|
+
? entry
|
|
8
|
+
: {};
|
|
9
|
+
}
|
|
10
|
+
export function text(fields, name) {
|
|
11
|
+
const value = fields[name];
|
|
12
|
+
return typeof value === 'string' && value !== '' ? value : null;
|
|
13
|
+
}
|
|
14
|
+
export function list(fields, name) {
|
|
15
|
+
const value = fields[name];
|
|
16
|
+
return Array.isArray(value) ? value : [];
|
|
17
|
+
}
|
package/dist/reads.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type CallResult } from './outcome.js';
|
|
2
|
+
import type { Recovery } from './recovery.js';
|
|
3
|
+
import type { Connection, RuntimeDatabase } from './tables.js';
|
|
4
|
+
export declare const READ_TABLES: readonly string[];
|
|
5
|
+
export type ReadAt = {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly input: string;
|
|
8
|
+
readonly build: string;
|
|
9
|
+
};
|
|
10
|
+
export type ObservedRead = {
|
|
11
|
+
readonly answer: unknown;
|
|
12
|
+
readonly failure: CallResult | null;
|
|
13
|
+
readonly kept: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type ReadAnswers = {
|
|
16
|
+
watch(name: string, input: unknown, deliver: (read: ObservedRead) => void): () => void;
|
|
17
|
+
again(): void;
|
|
18
|
+
reopened(): void;
|
|
19
|
+
};
|
|
20
|
+
export type ReadAnswersOptions = {
|
|
21
|
+
readonly database: RuntimeDatabase;
|
|
22
|
+
readonly build: string;
|
|
23
|
+
readonly unkept: readonly string[];
|
|
24
|
+
readonly leading: readonly string[];
|
|
25
|
+
readonly recovery: Recovery;
|
|
26
|
+
call(name: string, input: unknown): Promise<CallResult>;
|
|
27
|
+
online(): boolean;
|
|
28
|
+
closed(): boolean;
|
|
29
|
+
full(): boolean;
|
|
30
|
+
filled(): void;
|
|
31
|
+
};
|
|
32
|
+
export declare function storedRead(connection: Connection, { name, input, build }: ReadAt): string | null;
|
|
33
|
+
export declare function keptRead(connection: Connection, { name, input, build }: ReadAt, answer: string): null;
|
|
34
|
+
export declare function readsOfOtherBuildsForgotten(connection: Connection, build: string): null;
|
|
35
|
+
export declare function readAnswers(options: ReadAnswersOptions): ReadAnswers;
|
|
36
|
+
//# sourceMappingURL=reads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads.d.ts","sourceRoot":"","sources":["../src/reads.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAExC,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,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