@agentshouse/mdruntime 0.1.0-c3c7796382e28 → 0.1.0-c3faae279d4d2
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 +2 -2
- package/dist/acceptance.d.ts +6 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +385 -0
- package/dist/actions.d.ts +20 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +251 -0
- package/dist/adapter.d.ts +90 -70
- 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 +29 -47
- package/dist/bootstrap.d.ts +14 -17
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +259 -152
- 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/change.js +4 -2
- 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 +21 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -2
- package/dist/collection.d.ts +2 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +1 -17
- package/dist/compile.d.ts +6 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +272 -326
- package/dist/connection.d.ts +5 -143
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +102 -5122
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-live.d.ts +136 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +248 -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 +41 -43
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +870 -779
- 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 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +18 -8
- package/dist/figures.d.ts +49 -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 +4 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +29 -31
- 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 +26 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/install.d.ts +56 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +554 -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 +268 -0
- package/dist/listing.d.ts +53 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +176 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +62 -23
- 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/media.d.ts +2 -2
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +22 -12
- package/dist/memory.d.ts +12 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +175 -83
- package/dist/messages.d.ts +27 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +103 -31
- package/dist/model.d.ts +2 -10
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -18
- package/dist/models.d.ts +14 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +195 -0
- package/dist/observation.d.ts +2 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +14 -14
- package/dist/opened.js +3 -3
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +57 -0
- package/dist/outcome.d.ts +4 -4
- 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 +60 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +126 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +26 -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 +14 -210
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- 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 +15 -12
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +185 -139
- package/dist/react.d.ts +10 -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/readiness.d.ts +3 -18
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/reads.d.ts +36 -10
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +157 -86
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +35 -1
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +33 -5
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +55 -0
- package/dist/replica.d.ts +10 -10
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +53 -21
- package/dist/room-draft.d.ts +21 -7
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +101 -54
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +217 -0
- package/dist/rows.d.ts +14 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +48 -184
- package/dist/runtime.d.ts +43 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +7 -1
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +31 -24
- package/dist/saves.d.ts +70 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +1005 -0
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/seed.d.ts +11 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +71 -1
- package/dist/shared.d.ts +1 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +13 -105
- package/dist/shown.d.ts +31 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +292 -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 +44 -0
- package/dist/socket/rooms.d.ts.map +1 -0
- package/dist/socket/rooms.js +90 -0
- package/dist/socket/session.d.ts +38 -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 +82 -0
- package/dist/status.d.ts +4 -5
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- 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 +431 -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 +41 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +56 -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 +115 -171
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +143 -416
- package/dist/stored.d.ts +61 -57
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +311 -233
- package/dist/surface.d.ts +88 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +223 -0
- package/dist/sync.d.ts +19 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +532 -0
- package/dist/tables.d.ts +126 -64
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +221 -105
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +42 -100
- 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 +17 -5
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +7 -1
- 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/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -368
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/reach.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
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
|
-
import {
|
|
6
|
+
import type { SearchResult } from './search.js';
|
|
5
7
|
export type ReachedDocument = {
|
|
6
8
|
readonly room: string;
|
|
7
9
|
readonly path: string;
|
|
@@ -9,7 +11,7 @@ export type ReachedDocument = {
|
|
|
9
11
|
export type ReachedArea = {
|
|
10
12
|
readonly room: string;
|
|
11
13
|
readonly path: string;
|
|
12
|
-
readonly
|
|
14
|
+
readonly open: readonly string[];
|
|
13
15
|
};
|
|
14
16
|
export type PortReach = {
|
|
15
17
|
readonly rooms: readonly string[];
|
|
@@ -18,25 +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:
|
|
34
|
-
search(input: unknown, reach: PortReach | null
|
|
35
|
+
watchPlan(plan: Plan, deliver: Deliver, fail: Fail): () => void;
|
|
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
|
|
41
|
+
located(room: string, path: string, destination: string): Promise<ReachedDocument | null>;
|
|
42
|
+
room(locator: string): Promise<AppRoom | undefined>;
|
|
40
43
|
};
|
|
41
44
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
42
45
|
export declare function governs(reach: PortReach | null, room: {
|
|
@@ -49,5 +52,5 @@ export declare function governs(reach: PortReach | null, room: {
|
|
|
49
52
|
readonly selection: boolean;
|
|
50
53
|
};
|
|
51
54
|
export declare function planReach(reach: PortReach | null): PlanReach | null;
|
|
52
|
-
export declare function narrowed(runtime: Reachable, given: PortReach | null,
|
|
55
|
+
export declare function narrowed(runtime: Reachable, given: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
53
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,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS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eclared, UNREADABLE, } from './out
|
|
|
6
6
|
import { beneath } from './paths.js';
|
|
7
7
|
import { moveTarget, readParts, staleWrite, } from './room-draft.js';
|
|
8
8
|
import { documentKey } from './rows.js';
|
|
9
|
-
import { undeclaredSearch } from './search.js';
|
|
10
9
|
const UNHELD_TYPES = { collection: modelTypes(NO_MODEL), typedSelection: null };
|
|
11
10
|
function unconversed(name) {
|
|
12
11
|
return () => Promise.resolve(undeclared(name));
|
|
@@ -14,13 +13,12 @@ function unconversed(name) {
|
|
|
14
13
|
const NO_CONVERSATION = {
|
|
15
14
|
list: () => Promise.resolve([]),
|
|
16
15
|
read: (conversation) => Promise.resolve(unheldView(conversation)),
|
|
17
|
-
create: unconversed('
|
|
18
|
-
send: unconversed('
|
|
19
|
-
answer: unconversed('
|
|
20
|
-
interrupt: unconversed('
|
|
21
|
-
kill: unconversed('
|
|
22
|
-
|
|
23
|
-
delete: unconversed('conversation.delete'),
|
|
16
|
+
create: unconversed('conversations/create'),
|
|
17
|
+
send: unconversed('conversations/send'),
|
|
18
|
+
answer: unconversed('conversations/interaction/answer'),
|
|
19
|
+
interrupt: unconversed('conversations/interrupt'),
|
|
20
|
+
kill: unconversed('conversations/kill'),
|
|
21
|
+
delete: unconversed('conversations/delete'),
|
|
24
22
|
};
|
|
25
23
|
const NO_CHAT_DRAFT = {
|
|
26
24
|
write: () => Promise.resolve(),
|
|
@@ -30,17 +28,15 @@ const NO_CHAT_DRAFT = {
|
|
|
30
28
|
function areasOf(reach) {
|
|
31
29
|
return reach.areas ?? [];
|
|
32
30
|
}
|
|
33
|
-
function typedAreas(reach, room) {
|
|
34
|
-
return areasOf(reach).filter((area) => area.room === room && area.types.length > 0);
|
|
35
|
-
}
|
|
36
31
|
function fenced(reach, room, path) {
|
|
37
|
-
return areasOf(reach).some((area) => area.room === room &&
|
|
32
|
+
return areasOf(reach).some((area) => area.room === room &&
|
|
33
|
+
beneath(area.path, path) &&
|
|
34
|
+
!area.open.some((open) => beneath(open, path)));
|
|
38
35
|
}
|
|
39
36
|
export function holds(reach, room) {
|
|
40
37
|
return (reach === null ||
|
|
41
38
|
reach.rooms.includes(room) ||
|
|
42
|
-
reach.documents.some((document) => document.room === room)
|
|
43
|
-
typedAreas(reach, room).length > 0);
|
|
39
|
+
reach.documents.some((document) => document.room === room));
|
|
44
40
|
}
|
|
45
41
|
function wholly(reach, room) {
|
|
46
42
|
return reach === null || reach.rooms.includes(room);
|
|
@@ -50,12 +46,9 @@ export function governs(reach, room) {
|
|
|
50
46
|
return { collection: true, selection: room.typedSelection !== null };
|
|
51
47
|
}
|
|
52
48
|
const selected = (path) => room.typedSelection?.roots.some((root) => beneath(root, path)) ?? false;
|
|
53
|
-
const paths =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
.map(({ path }) => path),
|
|
57
|
-
...typedAreas(reach, room.locator).map(({ path }) => path),
|
|
58
|
-
];
|
|
49
|
+
const paths = reach.documents
|
|
50
|
+
.filter((document) => document.room === room.locator)
|
|
51
|
+
.map(({ path }) => path);
|
|
59
52
|
return { collection: paths.some((path) => !selected(path)), selection: paths.some(selected) };
|
|
60
53
|
}
|
|
61
54
|
function covers(reach, room, path) {
|
|
@@ -76,7 +69,7 @@ export function planReach(reach) {
|
|
|
76
69
|
...new Set(reach.documents.map(({ room, path }) => documentKey(room, path))),
|
|
77
70
|
].sort(),
|
|
78
71
|
areas: areasOf(reach)
|
|
79
|
-
.map(({ room, path,
|
|
72
|
+
.map(({ room, path, open }) => ({ room, path, open: [...new Set(open)].sort() }))
|
|
80
73
|
.sort((left, right) => documentKey(left.room, left.path) < documentKey(right.room, right.path) ? -1 : 1),
|
|
81
74
|
};
|
|
82
75
|
}
|
|
@@ -126,7 +119,8 @@ function savedWithin(reach, room, result) {
|
|
|
126
119
|
function statusWithin(reach, status) {
|
|
127
120
|
return {
|
|
128
121
|
...status,
|
|
129
|
-
attentionRequired: status.attentionRequired.filter((entry) =>
|
|
122
|
+
attentionRequired: status.attentionRequired.filter((entry) => covers(reach, entry.room, entry.path)),
|
|
123
|
+
unsent: status.unsent.filter((change) => covers(reach, change.room, change.path)),
|
|
130
124
|
};
|
|
131
125
|
}
|
|
132
126
|
function queueWithin(reach, room, entries) {
|
|
@@ -143,13 +137,13 @@ function queueWithin(reach, room, entries) {
|
|
|
143
137
|
});
|
|
144
138
|
}
|
|
145
139
|
function unreached(room) {
|
|
146
|
-
return runtimeError('room
|
|
140
|
+
return runtimeError('unknown-room', `Unknown Room ${room}`);
|
|
147
141
|
}
|
|
148
142
|
function lockedError(room) {
|
|
149
143
|
return runtimeError(ROOM_LOCKED, `${room} is locked until House confirms its access`, true);
|
|
150
144
|
}
|
|
151
145
|
function deviceUnreached() {
|
|
152
|
-
return runtimeError('device-unreached', 'Only the panel
|
|
146
|
+
return runtimeError('device-unreached', 'Only the panel reaches this device');
|
|
153
147
|
}
|
|
154
148
|
const ATTACH_REQUIRED = 'attach-required';
|
|
155
149
|
function attachRequired() {
|
|
@@ -158,10 +152,9 @@ function attachRequired() {
|
|
|
158
152
|
function carriesFile(parts) {
|
|
159
153
|
return parts !== null && typeof parts === 'object' && Object.hasOwn(parts, 'file');
|
|
160
154
|
}
|
|
161
|
-
export function narrowed(runtime, given,
|
|
155
|
+
export function narrowed(runtime, given, port) {
|
|
162
156
|
const { md, watch } = runtime;
|
|
163
157
|
let reach = given;
|
|
164
|
-
let port = told;
|
|
165
158
|
const open = new Set();
|
|
166
159
|
function following(begin, locking = false) {
|
|
167
160
|
let stop = begin();
|
|
@@ -177,70 +170,127 @@ export function narrowed(runtime, given, told) {
|
|
|
177
170
|
stop();
|
|
178
171
|
};
|
|
179
172
|
}
|
|
180
|
-
const unlocking = (rooms) => {
|
|
181
|
-
const
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
|
|
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' })) };
|
|
176
|
+
};
|
|
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;
|
|
185
184
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
+
}
|
|
189
232
|
if (topic === 'rooms') {
|
|
190
|
-
return following(() => watch(topic, input, (rooms) => deliver(roomsWithin(reach, rooms))));
|
|
233
|
+
return following(() => watch(topic, input, (rooms) => deliver(roomsWithin(reach, rooms)), fail));
|
|
191
234
|
}
|
|
192
235
|
if (topic === 'readiness') {
|
|
193
236
|
return following(() => runtime.watchReadiness(port, reach, deliver));
|
|
194
237
|
}
|
|
195
238
|
if (topic === 'sync-status') {
|
|
196
|
-
return following(() =>
|
|
197
|
-
const
|
|
198
|
-
|
|
239
|
+
return following(() => unlockedWatch(topic, input, deliver, fail, (status, locked) => {
|
|
240
|
+
const shown = statusWithin(reach, status);
|
|
241
|
+
return { ...shown, attentionRequired: unlocked(shown.attentionRequired, locked) };
|
|
199
242
|
}), true);
|
|
200
243
|
}
|
|
201
244
|
if (topic === 'room-drafts') {
|
|
202
|
-
return following(() =>
|
|
245
|
+
return following(() => unlockedWatch(topic, input, deliver, fail, (drafts, locked) => unlocked(draftsWithin(reach, drafts), locked)), true);
|
|
203
246
|
}
|
|
204
247
|
if (topic === 'queue') {
|
|
205
248
|
const room = input[0];
|
|
206
|
-
return following(() =>
|
|
207
|
-
if (!holds(reach, room) || runtime.locked(room)) {
|
|
208
|
-
deliver([]);
|
|
209
|
-
return () => { };
|
|
210
|
-
}
|
|
211
|
-
return watch(topic, input, (entries) => deliver(queueWithin(reach, room, entries)));
|
|
212
|
-
}, true);
|
|
249
|
+
return following(() => lockedFirst(room, () => watch(topic, input, (entries) => deliver(queueWithin(reach, room, entries)), fail), () => deliver([])), true);
|
|
213
250
|
}
|
|
214
251
|
if (topic === 'query') {
|
|
215
|
-
const
|
|
252
|
+
const planning = runtime.plan(input[0], reach);
|
|
216
253
|
let held = null;
|
|
217
254
|
return following(() => {
|
|
218
|
-
const locked = unlocking(plan.rooms);
|
|
219
|
-
if (locked !== null) {
|
|
220
|
-
const answer = { result: locked, keys: [] };
|
|
221
|
-
if (held === null || changeOf(held, answer) !== null)
|
|
222
|
-
deliver(answer);
|
|
223
|
-
held = digestOf(answer);
|
|
224
|
-
return () => { };
|
|
225
|
-
}
|
|
226
|
-
let first = true;
|
|
227
255
|
let open = true;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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);
|
|
232
268
|
return;
|
|
233
269
|
}
|
|
234
|
-
first =
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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) => {
|
|
242
292
|
if (open)
|
|
243
|
-
|
|
293
|
+
fail(error);
|
|
244
294
|
});
|
|
245
295
|
return () => {
|
|
246
296
|
open = false;
|
|
@@ -251,7 +301,7 @@ export function narrowed(runtime, given, told) {
|
|
|
251
301
|
if (topic === 'conversation') {
|
|
252
302
|
return following(() => {
|
|
253
303
|
if (conversing(reach))
|
|
254
|
-
return watch(topic, input, deliver);
|
|
304
|
+
return watch(topic, input, deliver, fail);
|
|
255
305
|
deliver(unheldView(input[0]));
|
|
256
306
|
return () => { };
|
|
257
307
|
});
|
|
@@ -259,12 +309,18 @@ export function narrowed(runtime, given, told) {
|
|
|
259
309
|
if (topic === 'conversations' || topic === 'agents') {
|
|
260
310
|
return following(() => {
|
|
261
311
|
if (conversing(reach))
|
|
262
|
-
return watch(topic, input, deliver);
|
|
312
|
+
return watch(topic, input, deliver, fail);
|
|
263
313
|
deliver([]);
|
|
264
314
|
return () => { };
|
|
265
315
|
});
|
|
266
316
|
}
|
|
267
|
-
|
|
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);
|
|
268
324
|
};
|
|
269
325
|
const files = new Map();
|
|
270
326
|
let handed = 0;
|
|
@@ -281,35 +337,34 @@ export function narrowed(runtime, given, told) {
|
|
|
281
337
|
const chatDraft = () => (conversing(reach) ? md.chatDraft : NO_CHAT_DRAFT);
|
|
282
338
|
const view = {
|
|
283
339
|
...md,
|
|
284
|
-
rooms: () => roomsWithin(reach,
|
|
285
|
-
query: ((input) => {
|
|
286
|
-
const plan = runtime.plan(input, reach);
|
|
287
|
-
|
|
340
|
+
rooms: () => md.rooms().then((rooms) => roomsWithin(reach, rooms)),
|
|
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 });
|
|
288
345
|
}),
|
|
289
|
-
search: (input) =>
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
types(room) {
|
|
293
|
-
if (holds(reach, room) && runtime.locked(room))
|
|
346
|
+
search: (input) => runtime.search(input, reach),
|
|
347
|
+
async types(room) {
|
|
348
|
+
if (holds(reach, room) && (await runtime.locked(room)))
|
|
294
349
|
throw lockedError(room);
|
|
295
350
|
if (wholly(reach, room))
|
|
296
351
|
return md.types(room);
|
|
297
352
|
if (!holds(reach, room))
|
|
298
353
|
return structuredClone(UNHELD_TYPES);
|
|
299
|
-
|
|
300
|
-
return typesWithin(reach, listed, md.types(room));
|
|
354
|
+
return typesWithin(reach, await runtime.room(room), await md.types(room));
|
|
301
355
|
},
|
|
302
356
|
async save(room, roomDrafts, writtenBy) {
|
|
303
357
|
if (!holds(reach, room))
|
|
304
358
|
throw unreached(room);
|
|
305
|
-
if (runtime.locked(room))
|
|
359
|
+
if (await runtime.locked(room)) {
|
|
306
360
|
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
361
|
+
}
|
|
307
362
|
const held = (await Promise.all(roomDrafts.map(({ path }) => md.roomDraft.read(room, path)))).map((draft) => draft?.parts.move);
|
|
308
363
|
const outside = roomDrafts.find(({ path }, at) => !covers(reach, room, path) || !moves(reach, room, held[at]));
|
|
309
364
|
if (outside !== undefined) {
|
|
310
365
|
return { outcome: 'refused', code: 'stale', retryable: false, file: outside.path };
|
|
311
366
|
}
|
|
312
|
-
if (intoLocked(held))
|
|
367
|
+
if (await intoLocked(held))
|
|
313
368
|
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
314
369
|
return savedWithin(reach, room, await md.save(room, roomDrafts, writtenBy));
|
|
315
370
|
},
|
|
@@ -320,47 +375,48 @@ export function narrowed(runtime, given, told) {
|
|
|
320
375
|
if (filed !== undefined) {
|
|
321
376
|
return { outcome: 'refused', code: ATTACH_REQUIRED, retryable: false, file: filed.path };
|
|
322
377
|
}
|
|
323
|
-
if (runtime.locked(room))
|
|
378
|
+
if (await runtime.locked(room)) {
|
|
324
379
|
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
325
|
-
|
|
380
|
+
}
|
|
381
|
+
const held = parts.map(({ path, parts: one }) => readParts(one, path).move);
|
|
326
382
|
if (parts.some(({ path }, at) => !covers(reach, room, path) || !moves(reach, room, held[at]))) {
|
|
327
383
|
throw unreached(room);
|
|
328
384
|
}
|
|
329
|
-
if (intoLocked(held))
|
|
385
|
+
if (await intoLocked(held))
|
|
330
386
|
return { outcome: 'refused', code: ROOM_LOCKED, retryable: true };
|
|
331
387
|
return savedWithin(reach, room, await md.saveParts(room, parts, writtenBy));
|
|
332
388
|
},
|
|
333
|
-
resolve(room, path, destination) {
|
|
334
|
-
const at = runtime.located(room, path, destination);
|
|
389
|
+
async resolve(room, path, destination) {
|
|
390
|
+
const at = await runtime.located(room, path, destination);
|
|
335
391
|
return at !== null && !covers(reach, at.room, at.path)
|
|
336
|
-
?
|
|
392
|
+
? UNREADABLE
|
|
337
393
|
: md.resolve(room, path, destination);
|
|
338
394
|
},
|
|
339
|
-
history: (room, path, query) => !covers(reach, room, path)
|
|
340
|
-
?
|
|
341
|
-
: runtime.locked(room)
|
|
342
|
-
?
|
|
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)
|
|
343
399
|
: md.history(room, path, query),
|
|
344
400
|
binaryFile: {
|
|
345
|
-
read: (room, path, revision) => !covers(reach, room, path)
|
|
346
|
-
?
|
|
347
|
-
: runtime.locked(room)
|
|
348
|
-
?
|
|
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)
|
|
349
405
|
: hand(md.binaryFile.read(room, path, revision)),
|
|
350
|
-
link: (room, path, revision) => !covers(reach, room, path)
|
|
351
|
-
?
|
|
352
|
-
: runtime.locked(room)
|
|
353
|
-
?
|
|
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)
|
|
354
410
|
: md.binaryFile.link(room, path, revision),
|
|
355
|
-
show: (room, path, revision) => !covers(reach, room, path)
|
|
356
|
-
?
|
|
357
|
-
: runtime.locked(room)
|
|
358
|
-
?
|
|
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)
|
|
359
415
|
: hand(md.binaryFile.show(room, path, revision)),
|
|
360
|
-
attach: (room, file) => !wholly(reach, room)
|
|
361
|
-
?
|
|
362
|
-
: runtime.locked(room)
|
|
363
|
-
?
|
|
416
|
+
attach: async (room, file) => !wholly(reach, room)
|
|
417
|
+
? failure({ kind: 'room-not-readable', locator: room })
|
|
418
|
+
: (await runtime.locked(room))
|
|
419
|
+
? lockedRoom(room)
|
|
364
420
|
: md.binaryFile.attach(room, file),
|
|
365
421
|
async part(file, part) {
|
|
366
422
|
const key = files.get(file);
|
|
@@ -373,42 +429,38 @@ export function narrowed(runtime, given, told) {
|
|
|
373
429
|
},
|
|
374
430
|
},
|
|
375
431
|
reached: async (room, roomVersion, path) => (path === undefined ? wholly(reach, room) : covers(reach, room, path)) &&
|
|
376
|
-
!runtime.locked(room) &&
|
|
432
|
+
!(await runtime.locked(room)) &&
|
|
377
433
|
(await md.reached(room, roomVersion, path)),
|
|
378
434
|
log: () => (reach === null ? md.log() : ''),
|
|
379
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())),
|
|
380
439
|
roomDraft: {
|
|
381
|
-
list: () => md.roomDraft.list()
|
|
440
|
+
list: async () => unlocked(draftsWithin(reach, await md.roomDraft.list()), await runtime.lockedRooms()),
|
|
382
441
|
async read(room, path) {
|
|
383
442
|
if (!covers(reach, room, path))
|
|
384
443
|
return null;
|
|
385
|
-
if (runtime.locked(room))
|
|
444
|
+
if (await runtime.locked(room))
|
|
386
445
|
throw lockedError(room);
|
|
387
446
|
return shownDraft(reach, await md.roomDraft.read(room, path));
|
|
388
447
|
},
|
|
389
|
-
write(room, path, revision, parts, next) {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
catch (error) {
|
|
402
|
-
return Promise.reject(error);
|
|
403
|
-
}
|
|
404
|
-
return md.roomDraft
|
|
405
|
-
.write(room, path, revision, parts, next)
|
|
406
|
-
.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));
|
|
407
459
|
},
|
|
408
460
|
async discard(room, path, revision) {
|
|
409
461
|
if (!covers(reach, room, path))
|
|
410
462
|
return staleWrite(null);
|
|
411
|
-
if (runtime.locked(room))
|
|
463
|
+
if (await runtime.locked(room))
|
|
412
464
|
throw lockedError(room);
|
|
413
465
|
return writeWithin(reach, await md.roomDraft.discard(room, path, revision));
|
|
414
466
|
},
|
|
@@ -421,7 +473,6 @@ export function narrowed(runtime, given, told) {
|
|
|
421
473
|
answer: (id, answer) => conversation().answer(id, answer),
|
|
422
474
|
interrupt: (id) => conversation().interrupt(id),
|
|
423
475
|
kill: (id) => conversation().kill(id),
|
|
424
|
-
cancel: (id, turn) => conversation().cancel(id, turn),
|
|
425
476
|
delete: (id) => conversation().delete(id),
|
|
426
477
|
},
|
|
427
478
|
chatDraft: {
|
|
@@ -439,10 +490,5 @@ export function narrowed(runtime, given, told) {
|
|
|
439
490
|
for (const restart of [...open])
|
|
440
491
|
restart();
|
|
441
492
|
},
|
|
442
|
-
facts(next) {
|
|
443
|
-
port = next;
|
|
444
|
-
for (const restart of [...open])
|
|
445
|
-
restart();
|
|
446
|
-
},
|
|
447
493
|
};
|
|
448
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';
|
|
@@ -23,6 +28,7 @@ export declare function useObserve(client: Client, topic: 'storage-loss'): Obser
|
|
|
23
28
|
export declare function useObserve(client: Client, topic: 'sync-status'): Observed<SyncStatus>;
|
|
24
29
|
export declare function useObserve(client: Client, topic: 'service-mode'): Observed<ServiceMode>;
|
|
25
30
|
export declare function useObserve(client: Client, topic: 'member'): Observed<Member | null>;
|
|
31
|
+
export declare function useObserve(client: Client, topic: 'authority-changes'): Observed<number>;
|
|
26
32
|
export declare function useObserve(client: Client, topic: 'query', query: DocumentQuery): Observed<DocumentResult | PendingResult>;
|
|
27
33
|
export declare function useObserve(client: Client, topic: 'query', query: GroupQuery): Observed<GroupResult | PendingResult>;
|
|
28
34
|
export declare function useObserve(client: Client, topic: 'queue', locator: string): Observed<readonly QueueEntry[]>;
|
|
@@ -31,6 +37,8 @@ export declare function useObserve(client: Client, topic: 'presentation'): Obser
|
|
|
31
37
|
export declare function useObserve(client: Client, topic: 'conversation', conversation: string, options: ConversationOptions): Observed<ConversationView>;
|
|
32
38
|
export declare function useObserve(client: Client, topic: 'conversations'): Observed<readonly ConversationEntry[]>;
|
|
33
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>;
|
|
34
42
|
export type Saving = {
|
|
35
43
|
readonly busy: boolean;
|
|
36
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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