@agentshouse/mdruntime 0.1.0-c9ede0b00364b → 0.1.0-ca10b2b0a3e33
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 +21 -19
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +32 -22
- 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 +135 -55
- package/dist/adapter.d.ts +176 -29
- 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 +2 -7
- package/dist/{binary.d.ts → attachment.d.ts} +8 -4
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +15 -0
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- package/dist/change.d.ts +6 -2
- 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 +2 -4
- package/dist/client.d.ts +27 -15
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +29 -57
- package/dist/collection.d.ts +6 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +23 -9
- 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 +2 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +73 -42
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +15 -14
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +21 -9
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +19 -8
- package/dist/conversation-row.d.ts +20 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +30 -7
- package/dist/conversation.d.ts +30 -12
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +278 -198
- package/dist/declaration.js +3 -3
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +30 -8
- 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 +25 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +111 -34
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -1
- package/dist/figures.d.ts +1 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +6 -4
- 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 +7 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +77 -31
- package/dist/house-query.d.ts +24 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +102 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +22 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- 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 +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +42 -29
- 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 +19 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +94 -36
- package/dist/loaded.d.ts +7 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +46 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +4 -3
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +2 -3
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +181 -34
- package/dist/memory.d.ts +7 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +63 -23
- package/dist/messages.d.ts +21 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +43 -13
- 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 +10 -7
- 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/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- 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/opened.d.ts +5 -5
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +2 -2
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +22 -10
- package/dist/outcome.d.ts +30 -13
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +21 -6
- package/dist/overlay.d.ts +20 -9
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +110 -41
- package/dist/parts.d.ts +4 -9
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +30 -15
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +1 -1
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +198 -87
- 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 +116 -71
- package/dist/query.d.ts +2 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +1 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -8
- 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 +15 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +178 -38
- package/dist/react.d.ts +12 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +23 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +18 -10
- package/dist/reads.d.ts +1 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +17 -6
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +2 -1
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +4 -4
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +1 -3
- package/dist/replica.d.ts +3 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +5 -5
- package/dist/room-draft.d.ts +29 -4
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +240 -19
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +12 -7
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +47 -0
- package/dist/rows.d.ts +11 -3
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +25 -11
- package/dist/run-tables.d.ts +25 -0
- package/dist/run-tables.d.ts.map +1 -0
- package/dist/run-tables.js +98 -0
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runs.d.ts +27 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +92 -0
- package/dist/runtime.d.ts +5 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +17 -86
- package/dist/saves.d.ts +7 -5
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +107 -57
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/selector.d.ts +3 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +22 -0
- package/dist/shown.d.ts +5 -2
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +79 -43
- 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 +4 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +3 -0
- package/dist/socket.d.ts +6 -4
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +10 -9
- package/dist/source.d.ts +22 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +46 -9
- 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 +30 -8
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +70 -26
- 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 +15 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +12 -5
- package/dist/stored.d.ts +41 -16
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +215 -57
- package/dist/surface.d.ts +20 -8
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +62 -27
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +52 -35
- package/dist/tables.d.ts +40 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +109 -326
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +3 -4
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +50 -10
- package/dist/wire.d.ts +40 -16
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +22 -14
- package/package.json +4 -4
- package/dist/binary.d.ts.map +0 -1
- package/dist/binary.js +0 -8
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
package/dist/surface.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
2
2
|
import { type HistoryQuery } from './actions.js';
|
|
3
|
-
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
+
import type { ListedAgent, Member, RoomList, ServiceMode } from './adapter.js';
|
|
4
4
|
import type { WrittenBy } from './change.js';
|
|
5
5
|
import { type ChatDraftSurface, type ConversationEntry, type ConversationAgent, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
|
|
6
|
-
import type
|
|
6
|
+
import { type UnsentWork } from './durability.js';
|
|
7
7
|
import type { FiguresResult } from './figures.js';
|
|
8
8
|
import { type Holdings } from './holdings.js';
|
|
9
|
-
import { type AppRoom } from './listing.js';
|
|
9
|
+
import { type AppRoom, type ListedRooms } from './listing.js';
|
|
10
10
|
import { type TypesResult } from './model.js';
|
|
11
11
|
import { type Observation } from './observation.js';
|
|
12
12
|
import type { HistoryAnswer, QueueEntry, Resolution, CallResult } from './outcome.js';
|
|
@@ -18,8 +18,10 @@ import type { ObservedRead } from './reads.js';
|
|
|
18
18
|
import type { RoomDraft } from './room-draft.js';
|
|
19
19
|
import { type PresentationSurface, type RoomDraftSurface } from './room-drafts.js';
|
|
20
20
|
import type { Runtime } from './runtime.js';
|
|
21
|
-
import { type
|
|
21
|
+
import { type Runs } from './runs.js';
|
|
22
|
+
import { type AttachmentSurface, type SavedParts, type SavedRoomDraft, type SaveResult } from './saves.js';
|
|
22
23
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
24
|
+
import { type HouseQuery, type HouseQueryOptions, type HouseQueryResult } from './house-query.js';
|
|
23
25
|
import { type EntrySeed } from './seed.js';
|
|
24
26
|
import type { ConnectionRefusal } from './socket.js';
|
|
25
27
|
import type { SyncStatus } from './status.js';
|
|
@@ -29,12 +31,13 @@ export type RoomSchemas = {
|
|
|
29
31
|
};
|
|
30
32
|
export type MdRuntime = {
|
|
31
33
|
loaded(): Promise<void>;
|
|
32
|
-
rooms(): Promise<
|
|
34
|
+
rooms(): Promise<ListedRooms>;
|
|
33
35
|
query: {
|
|
34
36
|
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
35
37
|
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
36
38
|
};
|
|
37
39
|
search(request: SearchRequest): Promise<SearchResult>;
|
|
40
|
+
queryHouse(query: HouseQuery, options?: HouseQueryOptions): Promise<HouseQueryResult>;
|
|
38
41
|
types(locator: string): Promise<RoomSchemas>;
|
|
39
42
|
roomDraft: RoomDraftSurface;
|
|
40
43
|
conversation: ConversationSurface;
|
|
@@ -44,14 +47,15 @@ export type MdRuntime = {
|
|
|
44
47
|
saveParts(room: string, parts: readonly SavedParts[], writtenBy?: WrittenBy): Promise<SaveResult>;
|
|
45
48
|
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
46
49
|
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
47
|
-
|
|
50
|
+
attachment: AttachmentSurface;
|
|
48
51
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
52
|
+
answered(operation: string): Promise<boolean>;
|
|
49
53
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
50
|
-
log(): string;
|
|
51
54
|
persistence(): boolean;
|
|
52
55
|
retry(): Promise<void>;
|
|
53
56
|
cleanUp(): Promise<number>;
|
|
54
57
|
unsent(): Promise<readonly UnsentWork[]>;
|
|
58
|
+
sent(): Promise<void>;
|
|
55
59
|
reset(): Promise<void>;
|
|
56
60
|
readAgain(): Promise<void>;
|
|
57
61
|
observe: {
|
|
@@ -62,6 +66,7 @@ export type MdRuntime = {
|
|
|
62
66
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
63
67
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
64
68
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
69
|
+
(topic: 'time-zone'): Promise<Observation<string | null>>;
|
|
65
70
|
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
66
71
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
67
72
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
@@ -71,13 +76,20 @@ export type MdRuntime = {
|
|
|
71
76
|
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
72
77
|
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
73
78
|
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
79
|
+
(topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
|
|
80
|
+
(topic: 'room-list'): Promise<Observation<RoomList | null>>;
|
|
74
81
|
(topic: 'figures'): Promise<Observation<FiguresResult>>;
|
|
75
82
|
(topic: 'holdings'): Promise<Observation<Holdings>>;
|
|
76
83
|
(topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
|
|
84
|
+
(topic: 'runs', asked: {
|
|
85
|
+
room: string;
|
|
86
|
+
} | {
|
|
87
|
+
sent: true;
|
|
88
|
+
}): Promise<Observation<Runs | PendingResult>>;
|
|
77
89
|
};
|
|
78
90
|
reauthorize(): Promise<void>;
|
|
79
91
|
};
|
|
80
|
-
export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents' | 'figures' | 'holdings' | 'read';
|
|
92
|
+
export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'time-zone' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents' | 'listed-agents' | 'room-list' | 'figures' | 'holdings' | 'read' | 'runs';
|
|
81
93
|
export type ComposedRuntime = RuntimeView & {
|
|
82
94
|
seed(entry: EntrySeed): void;
|
|
83
95
|
stop(): Promise<void>;
|
package/dist/surface.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAOL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAgC,KAAK,QAAQ,EAAE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e,GAAG,WAAW,GAAG;IAC1C,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;CACpE,CAAC;AAyMF,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CA2CjE"}
|
package/dist/surface.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { called, located, readHistory, resolveReference } from './actions.js';
|
|
2
|
-
import { chatDraftSurface, conversationSurface, watchConversation, watchConversationAgents, watchConversationList, } from './conversation.js';
|
|
1
|
+
import { answeredCall, called, located, readHistory, resolveReference, } from './actions.js';
|
|
2
|
+
import { chatDraftSurface, conversationSurface, watchConversation, watchConversationAgents, watchListedAgents, watchConversationList, } from './conversation.js';
|
|
3
|
+
import { leftToSend } from './durability.js';
|
|
3
4
|
import { uncaught } from './failure.js';
|
|
5
|
+
import { watchRoomList } from './room-list.js';
|
|
4
6
|
import { CLEANED_TOPIC, watchHoldings } from './holdings.js';
|
|
5
7
|
import { reachedBy, writtenAfter } from './install.js';
|
|
6
|
-
import { declarationOf, listingNow, modelIn, shownRooms } from './listing.js';
|
|
8
|
+
import { declarationOf, listingNow, modelIn, shownRooms, } from './listing.js';
|
|
7
9
|
import { stop } from './lifecycle.js';
|
|
8
10
|
import { locked, lockedRooms, watchLocks } from './locks.js';
|
|
9
11
|
import { modelTypes } from './model.js';
|
|
@@ -12,10 +14,12 @@ import { watchReadiness } from './preparation.js';
|
|
|
12
14
|
import { planned, rowsQuery, searched, watchPlan, watchPlanned } from './queries.js';
|
|
13
15
|
import { narrowed, } from './reach.js';
|
|
14
16
|
import { presentationSurface, roomDraftSurface, watchPresentation, watchRoomDrafts, } from './room-drafts.js';
|
|
15
|
-
import {
|
|
17
|
+
import { watchRuns } from './runs.js';
|
|
18
|
+
import { attachmentSurface, conversationFiles, saveParts, saveRoomDrafts, } from './saves.js';
|
|
19
|
+
import { queriedHouse, } from './house-query.js';
|
|
16
20
|
import { keepEntrySeed } from './seed.js';
|
|
17
|
-
import { AUTHORITY_TOPIC, emitKnownRooms, entriesOf, MEMBER_TOPIC, queueTopic, REFUSAL_TOPIC, ROOMS_TOPIC, SERVICE_MODE_TOPIC, STATUS_TOPIC, STORAGE_LOSS_TOPIC, } from './shown.js';
|
|
18
|
-
import { OPENING_LANE
|
|
21
|
+
import { AUTHORITY_TOPIC, emitKnownRooms, emitStorageLoss, entriesOf, MEMBER_TOPIC, queueTopic, REFUSAL_TOPIC, ROOMS_TOPIC, SERVICE_MODE_TOPIC, STATUS_TOPIC, STORAGE_LOSS_TOPIC, storageLossNow, TIME_ZONE_TOPIC, } from './shown.js';
|
|
22
|
+
import { OPENING_LANE } from './sync.js';
|
|
19
23
|
function told(store, topic, deliver, current) {
|
|
20
24
|
const watcher = store.watch(topic, deliver);
|
|
21
25
|
deliver(current);
|
|
@@ -28,17 +32,17 @@ function watchRooms(runtime, deliver) {
|
|
|
28
32
|
return () => {
|
|
29
33
|
watcher.stop();
|
|
30
34
|
if (store.watching(ROOMS_TOPIC, 'ready').length === 0)
|
|
31
|
-
store.
|
|
35
|
+
store.roomsShown.show(null);
|
|
32
36
|
};
|
|
33
37
|
}
|
|
34
|
-
function
|
|
35
|
-
const watcher = store.watch(
|
|
38
|
+
function watchFact({ store }, topic, fact, deliver) {
|
|
39
|
+
const watcher = store.watch(topic, deliver);
|
|
36
40
|
void store
|
|
37
41
|
.open()
|
|
38
42
|
.then((local) => local.facts())
|
|
39
|
-
.then((
|
|
43
|
+
.then((facts) => {
|
|
40
44
|
if (watcher.held())
|
|
41
|
-
deliver(
|
|
45
|
+
deliver(facts[fact]);
|
|
42
46
|
}, uncaught);
|
|
43
47
|
return watcher.stop;
|
|
44
48
|
}
|
|
@@ -67,16 +71,22 @@ function watching(runtime) {
|
|
|
67
71
|
return watchConversationList(conversations, deliver);
|
|
68
72
|
if (topic === 'agents')
|
|
69
73
|
return watchConversationAgents(conversations, deliver);
|
|
74
|
+
if (topic === 'listed-agents')
|
|
75
|
+
return watchListedAgents(conversations, deliver);
|
|
76
|
+
if (topic === 'room-list')
|
|
77
|
+
return watchRoomList(runtime, deliver);
|
|
70
78
|
if (topic === 'figures')
|
|
71
79
|
return figures.watch(deliver, fail);
|
|
72
80
|
if (topic === 'holdings')
|
|
73
81
|
return watchHoldings(runtime, deliver, fail);
|
|
74
82
|
if (topic === 'read')
|
|
75
83
|
return lastAnswers.watch(input[0], input[1], deliver);
|
|
84
|
+
if (topic === 'runs')
|
|
85
|
+
return watchRuns(runtime, input[0], deliver);
|
|
76
86
|
if (topic === 'presentation')
|
|
77
87
|
return watchPresentation(runtime, input[0], deliver);
|
|
78
88
|
if (topic === 'readiness') {
|
|
79
|
-
return watchReadiness(runtime, { target: '', code: 'stored' }, null, deliver);
|
|
89
|
+
return watchReadiness(runtime, { target: '', code: 'stored', first: null, inboxed: null }, null, deliver);
|
|
80
90
|
}
|
|
81
91
|
if (topic === 'rooms')
|
|
82
92
|
return watchRooms(runtime, deliver);
|
|
@@ -84,7 +94,7 @@ function watching(runtime) {
|
|
|
84
94
|
return told(store, REFUSAL_TOPIC, deliver, session.refusal);
|
|
85
95
|
}
|
|
86
96
|
if (topic === 'storage-loss') {
|
|
87
|
-
return told(store, STORAGE_LOSS_TOPIC, deliver,
|
|
97
|
+
return told(store, STORAGE_LOSS_TOPIC, deliver, storageLossNow(runtime));
|
|
88
98
|
}
|
|
89
99
|
if (topic === 'sync-status') {
|
|
90
100
|
return told(store, STATUS_TOPIC, deliver, store.device.now().status);
|
|
@@ -93,7 +103,9 @@ function watching(runtime) {
|
|
|
93
103
|
return told(store, SERVICE_MODE_TOPIC, deliver, session.serviceMode);
|
|
94
104
|
}
|
|
95
105
|
if (topic === 'member')
|
|
96
|
-
return
|
|
106
|
+
return watchFact(runtime, MEMBER_TOPIC, 'member', deliver);
|
|
107
|
+
if (topic === 'time-zone')
|
|
108
|
+
return watchFact(runtime, TIME_ZONE_TOPIC, 'timeZone', deliver);
|
|
97
109
|
if (topic === 'authority-changes') {
|
|
98
110
|
return told(store, AUTHORITY_TOPIC, deliver, session.authorityChanges);
|
|
99
111
|
}
|
|
@@ -105,7 +117,7 @@ function watching(runtime) {
|
|
|
105
117
|
function roomsOnce(runtime) {
|
|
106
118
|
const { store, socket } = runtime;
|
|
107
119
|
if (socket.closed())
|
|
108
|
-
return Promise.resolve([]);
|
|
120
|
+
return Promise.resolve({ rooms: [], models: {} });
|
|
109
121
|
return new Promise((settle) => {
|
|
110
122
|
const watcher = store.watch(ROOMS_TOPIC, (value) => {
|
|
111
123
|
watcher.stop();
|
|
@@ -123,44 +135,66 @@ async function typesOf(runtime, locator) {
|
|
|
123
135
|
typedSelection: (room?.typedSelection ?? null) === null ? null : modelTypes(builtIn),
|
|
124
136
|
};
|
|
125
137
|
}
|
|
138
|
+
async function sentAll(runtime) {
|
|
139
|
+
const { store } = runtime;
|
|
140
|
+
for (;;) {
|
|
141
|
+
let moved;
|
|
142
|
+
const status = new Promise((resolve) => {
|
|
143
|
+
moved = resolve;
|
|
144
|
+
});
|
|
145
|
+
const watcher = store.watch(STATUS_TOPIC, () => moved());
|
|
146
|
+
try {
|
|
147
|
+
if (!leftToSend(await store.ask({ kind: 'authored.unsent' })))
|
|
148
|
+
return;
|
|
149
|
+
const calls = await (await store.open()).calls();
|
|
150
|
+
await Promise.race([
|
|
151
|
+
status,
|
|
152
|
+
...calls.map(({ operation }) => answeredCall(runtime, operation)),
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
watcher.stop();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
126
160
|
async function reauthorized(runtime) {
|
|
127
|
-
const { store, socket
|
|
161
|
+
const { store, socket } = runtime;
|
|
128
162
|
const { refusal } = socket.session.now();
|
|
129
163
|
if (refusal === null || !refusal.reauthorizationOffered)
|
|
130
164
|
return;
|
|
131
|
-
journal.record('connection reauthorize');
|
|
132
165
|
await socket.lanes.current();
|
|
133
166
|
await store.written();
|
|
134
167
|
socket.session.set({ authorization: undefined, paused: false });
|
|
135
168
|
if (!socket.streamed)
|
|
136
|
-
await
|
|
169
|
+
await runtime.discover();
|
|
137
170
|
else
|
|
138
171
|
await socket.lanes.task(OPENING_LANE, () => socket.authorize());
|
|
139
172
|
}
|
|
140
173
|
function mdRuntime(runtime, watch) {
|
|
141
|
-
const { store, socket,
|
|
174
|
+
const { store, socket, shell, conversations, lastAnswers } = runtime;
|
|
142
175
|
return {
|
|
143
176
|
loaded: () => store.open().then(() => undefined),
|
|
144
177
|
rooms: () => roomsOnce(runtime),
|
|
145
178
|
query: ((input) => planned(runtime, input, null).then((plan) => rowsQuery(runtime, plan))),
|
|
146
179
|
search: (input) => searched(runtime, input, null),
|
|
180
|
+
queryHouse: (input, options) => queriedHouse(runtime, input, null, options),
|
|
147
181
|
types: (locator) => typesOf(runtime, locator),
|
|
148
182
|
roomDraft: roomDraftSurface(runtime),
|
|
149
|
-
conversation: conversationSurface(conversations),
|
|
183
|
+
conversation: conversationSurface(conversations, conversationFiles(runtime)),
|
|
150
184
|
chatDraft: chatDraftSurface(conversations),
|
|
151
185
|
presentation: presentationSurface(runtime),
|
|
152
186
|
save: (room, named, writtenBy) => saveRoomDrafts(runtime, room, named, writtenBy),
|
|
153
187
|
saveParts: (room, parts, writtenBy) => saveParts(runtime, room, parts, writtenBy),
|
|
154
188
|
history: (locator, path, query) => readHistory(runtime, locator, path, query),
|
|
155
189
|
resolve: (room, path, destination) => resolveReference(runtime, room, path, destination),
|
|
156
|
-
|
|
190
|
+
attachment: attachmentSurface(runtime),
|
|
157
191
|
call: (name, input) => called(runtime, name, input),
|
|
192
|
+
answered: (operation) => answeredCall(runtime, operation),
|
|
158
193
|
async reached(locator, roomVersion, path) {
|
|
159
194
|
return path === undefined
|
|
160
195
|
? reachedBy(runtime, locator, roomVersion)
|
|
161
196
|
: writtenAfter(runtime, locator, roomVersion, path);
|
|
162
197
|
},
|
|
163
|
-
log: () => journal.export(),
|
|
164
198
|
async cleanUp() {
|
|
165
199
|
const freed = await store.ask({ kind: 'opened.clean' });
|
|
166
200
|
const tidied = (await shell.cleanUp?.()) ?? 0;
|
|
@@ -168,13 +202,13 @@ function mdRuntime(runtime, watch) {
|
|
|
168
202
|
return freed + tidied;
|
|
169
203
|
},
|
|
170
204
|
unsent: () => store.ask({ kind: 'authored.unsent' }),
|
|
205
|
+
sent: () => sentAll(runtime),
|
|
171
206
|
reset: () => shell.reset(),
|
|
172
207
|
async readAgain() {
|
|
173
208
|
lastAnswers.again();
|
|
174
209
|
},
|
|
175
210
|
persistence: () => store.device.now().persistence === 'granted',
|
|
176
211
|
async retry() {
|
|
177
|
-
journal.record('retry');
|
|
178
212
|
store.prepareAgain();
|
|
179
213
|
store.readiness.queue();
|
|
180
214
|
if (store.space.full())
|
|
@@ -185,7 +219,7 @@ function mdRuntime(runtime, watch) {
|
|
|
185
219
|
};
|
|
186
220
|
}
|
|
187
221
|
export function composedRuntime(runtime) {
|
|
188
|
-
const { store
|
|
222
|
+
const { store } = runtime;
|
|
189
223
|
const watch = watching(runtime);
|
|
190
224
|
const md = mdRuntime(runtime, watch);
|
|
191
225
|
const reachable = {
|
|
@@ -195,12 +229,14 @@ export function composedRuntime(runtime) {
|
|
|
195
229
|
query: (plan) => rowsQuery(runtime, plan),
|
|
196
230
|
watchPlan: (plan, deliver, fail) => watchPlan(runtime, plan, deliver, fail),
|
|
197
231
|
search: (input, reach) => searched(runtime, input, reach),
|
|
232
|
+
queryHouse: (input, reach, options) => queriedHouse(runtime, input, reach, options),
|
|
233
|
+
queried: () => runtime.socket.session.now().queriesOnly,
|
|
198
234
|
watchReadiness: (port, reach, deliver) => watchReadiness(runtime, port, reach, deliver),
|
|
199
235
|
locked: (locator) => locked(runtime, locator),
|
|
200
236
|
lockedRooms: () => lockedRooms(runtime),
|
|
201
237
|
watchLocks: (notify) => watchLocks(runtime, notify),
|
|
202
238
|
located: (room, path, destination) => located(runtime, room, path, destination),
|
|
203
|
-
room: async (locator) => shownRooms(runtime, await listingNow(runtime)).find((one) => one.locator === locator),
|
|
239
|
+
room: async (locator) => shownRooms(runtime, await listingNow(runtime)).rooms.find((one) => one.locator === locator),
|
|
204
240
|
};
|
|
205
241
|
return {
|
|
206
242
|
md,
|
|
@@ -211,8 +247,7 @@ export function composedRuntime(runtime) {
|
|
|
211
247
|
if (answer === store.device.now().persistence)
|
|
212
248
|
return;
|
|
213
249
|
store.device.set({ persistence: answer });
|
|
214
|
-
|
|
215
|
-
store.readiness.queue();
|
|
250
|
+
emitStorageLoss(runtime);
|
|
216
251
|
},
|
|
217
252
|
within(reach, port) {
|
|
218
253
|
if (store.space.full())
|
package/dist/sync.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ export declare function withhold(runtime: Runtime, withheld: Withheld, room: Dis
|
|
|
11
11
|
export declare function loadRoom(runtime: Runtime, room: DiscoveredRoom, local: RuntimeStore, progress: CycleProgress, live: Live, unheld?: Unheld): Promise<void>;
|
|
12
12
|
export declare function reload(runtime: Runtime, room: DiscoveredRoom, local: RuntimeStore, progress: CycleProgress, live: Live): Promise<void>;
|
|
13
13
|
export declare function finishOpening(runtime: Runtime, progress: CycleProgress, live: Live): Promise<void>;
|
|
14
|
-
export declare function sync(runtime: Runtime, attempt: Attempt, found: Discovery | null): Promise<
|
|
14
|
+
export declare function sync(runtime: Runtime, attempt: Attempt, found: Discovery | null, current?: () => boolean): Promise<boolean>;
|
|
15
|
+
export declare function discover(runtime: Runtime): Promise<void>;
|
|
16
|
+
export declare function adopt(runtime: Runtime, unstored: Discovery): Promise<void>;
|
|
15
17
|
export declare function resynchronize(runtime: Runtime): Promise<void>;
|
|
16
|
-
export declare function countAuthorityChange({ store, socket, lastAnswers }: Runtime): void;
|
|
18
|
+
export declare function countAuthorityChange({ store, socket, lastAnswers }: Runtime, listed?: Promise<unknown>): void;
|
|
17
19
|
export declare function changeAuthority(runtime: Runtime, change: AuthorityChange): Promise<void>;
|
|
18
20
|
export declare function applyRoom(runtime: Runtime, change: RoomChange): Promise<void>;
|
|
19
21
|
//# sourceMappingURL=sync.d.ts.map
|
package/dist/sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACX,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACX,MAAM,cAAc,CAAC;AAMtB,OAAO,EASL,KAAK,MAAM,EACX,KAAK,QAAQ,EACd,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAU5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,YAAY,CAAC;AAG5D,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AAE7D,eAAO,MAAM,YAAY,YAAY,CAAC;AA2FtC,wBAAgB,QAAQ,CACtB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,aAAa,GACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAI1B;AAED,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ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AI,CAAC,CA+BxF;AAyDD,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA4D7E"}
|
package/dist/sync.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { resendCalls, resendLater } from './actions.js';
|
|
2
|
-
import { catchUpConversations,
|
|
2
|
+
import { catchUpConversations, reconcileOpening, resendConversations } from './conversation.js';
|
|
3
3
|
import { declared, sameDeclaration } from './declaration.js';
|
|
4
|
-
import { applyDiscovery, discoverRooms, malformed, signIn } from './discovery.js';
|
|
4
|
+
import { applyDiscovery, discoverRooms, DISCOVERY, malformed, signIn, zoned } from './discovery.js';
|
|
5
5
|
import { behind, caughtUpTo, publish, pullBootstrap, pullRefresh, reachedBy, replaced, standingAt, } from './install.js';
|
|
6
6
|
import { heldRooms, name } from './listing.js';
|
|
7
7
|
import { retainModel, revoked, scoped } from './models.js';
|
|
8
8
|
import { refusalError } from './failure.js';
|
|
9
9
|
import { refuse } from './refusal.js';
|
|
10
|
+
import { roomListChanged } from './room-list.js';
|
|
10
11
|
import { emitRooms, moveTo, rest, roomUnreadable, submissionDue, transferring, AUTHORITY_TOPIC, } from './shown.js';
|
|
11
12
|
import { unconfirmed } from './transfer.js';
|
|
12
13
|
export const OPENING_LANE = 'opening';
|
|
@@ -56,7 +57,7 @@ async function refreshedRoom(runtime, room, local, authorized, held, live, hold,
|
|
|
56
57
|
presence.stood(room.locator, false);
|
|
57
58
|
runtime.retries.succeeded('download', room.locator);
|
|
58
59
|
if (presence.readable(room.locator))
|
|
59
|
-
emitRooms(runtime);
|
|
60
|
+
emitRooms(runtime, [room.locator]);
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
63
|
if (refreshed.kind === 'advanced') {
|
|
@@ -79,7 +80,7 @@ export function advanced(runtime, room, local, authorized) {
|
|
|
79
80
|
return runtime.socket.lanes.inRoom(room.locator, (live) => advance(runtime, room, local, authorized, live));
|
|
80
81
|
}
|
|
81
82
|
export async function withhold(runtime, withheld, room, local, progress) {
|
|
82
|
-
const { presence
|
|
83
|
+
const { presence } = runtime;
|
|
83
84
|
if (withheld.kind === 'unconfirmed' || presence.lost(room.locator))
|
|
84
85
|
return;
|
|
85
86
|
if (withheld.kind === 'not-ready') {
|
|
@@ -106,9 +107,6 @@ export async function withhold(runtime, withheld, room, local, progress) {
|
|
|
106
107
|
else if (withheld.kind === 'transport-uncertainty') {
|
|
107
108
|
progress.reachable = false;
|
|
108
109
|
}
|
|
109
|
-
else if (withheld.kind === 'retryable-refusal') {
|
|
110
|
-
journal.record(`refusal ${withheld.kind} ${withheld.code}`);
|
|
111
|
-
}
|
|
112
110
|
else if (withheld.kind === 'room-not-readable') {
|
|
113
111
|
roomUnreadable(runtime, room.locator);
|
|
114
112
|
}
|
|
@@ -133,15 +131,14 @@ function askAgain(runtime, locator) {
|
|
|
133
131
|
});
|
|
134
132
|
}
|
|
135
133
|
async function prepareRoom(runtime, room, progress, prior) {
|
|
136
|
-
const { socket
|
|
134
|
+
const { socket } = runtime;
|
|
137
135
|
const { session } = socket;
|
|
138
136
|
if (socket.closed() || session.now().authorization === undefined) {
|
|
139
137
|
progress.complete = false;
|
|
140
138
|
return false;
|
|
141
139
|
}
|
|
142
140
|
if (prior !== undefined && prior.declaration.replica.selection !== room.replica.selection) {
|
|
143
|
-
emitRooms(runtime);
|
|
144
|
-
journal.record(`selection changed ${room.locator}`);
|
|
141
|
+
emitRooms(runtime, [room.locator]);
|
|
145
142
|
progress.complete = false;
|
|
146
143
|
return false;
|
|
147
144
|
}
|
|
@@ -154,8 +151,14 @@ async function prepareRoom(runtime, room, progress, prior) {
|
|
|
154
151
|
return false;
|
|
155
152
|
return room.replica.admission === 'admitted';
|
|
156
153
|
}
|
|
157
|
-
async function synchronize(runtime, listed,
|
|
154
|
+
async function synchronize(runtime, listed, progress, attempt, live) {
|
|
158
155
|
const { store, socket } = runtime;
|
|
156
|
+
if (listed.length === 0) {
|
|
157
|
+
if (attempt === 'opened')
|
|
158
|
+
socket.hand([]);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const local = await store.open();
|
|
159
162
|
const heldNow = await store.rooms(listed.map(({ locator }) => locator));
|
|
160
163
|
const prepared = await Promise.allSettled(listed.map((room) => prepareRoom(runtime, room, progress, heldNow.get(room.locator)?.record)));
|
|
161
164
|
if (!live())
|
|
@@ -291,21 +294,23 @@ async function repairPass(runtime, locator, signal) {
|
|
|
291
294
|
return repairable.reset === undefined ? 'again' : { at: Date.parse(repairable.reset) };
|
|
292
295
|
}
|
|
293
296
|
export async function finishOpening(runtime, progress, live) {
|
|
294
|
-
const { socket, presence, conversations, recovery } = runtime;
|
|
297
|
+
const { store, socket, presence, conversations, recovery } = runtime;
|
|
295
298
|
try {
|
|
296
299
|
if (!live()) {
|
|
297
300
|
progress.complete = false;
|
|
298
301
|
return;
|
|
299
302
|
}
|
|
303
|
+
const kept = store.needed();
|
|
300
304
|
await submissionDue(runtime);
|
|
301
305
|
for (const locator of presence.repairsOwed())
|
|
302
306
|
repairLater(runtime, locator, {});
|
|
303
|
-
await
|
|
307
|
+
await reconcileOpening(conversations);
|
|
304
308
|
const reading = { complete: true, reachable: true };
|
|
305
309
|
await catchUpConversations(conversations, reading);
|
|
306
|
-
if (progress.reachable && reading.reachable)
|
|
310
|
+
if (kept && progress.reachable && reading.reachable) {
|
|
307
311
|
await resendConversations(conversations, reading);
|
|
308
|
-
|
|
312
|
+
}
|
|
313
|
+
if (kept && progress.reachable) {
|
|
309
314
|
void recovery.attempt('calls', (signal) => resendCalls(runtime, signal));
|
|
310
315
|
}
|
|
311
316
|
if (!reading.reachable) {
|
|
@@ -325,14 +330,17 @@ export async function finishOpening(runtime, progress, live) {
|
|
|
325
330
|
}
|
|
326
331
|
}
|
|
327
332
|
}
|
|
328
|
-
export function sync(runtime, attempt, found) {
|
|
329
|
-
const {
|
|
333
|
+
export async function sync(runtime, attempt, found, current = () => true) {
|
|
334
|
+
const { socket } = runtime;
|
|
330
335
|
const { session } = socket;
|
|
331
|
-
|
|
336
|
+
let answered = true;
|
|
337
|
+
await socket.lanes.task(OPENING_LANE, async (live) => {
|
|
332
338
|
if (!live()) {
|
|
333
339
|
socket.readyFromStore();
|
|
334
340
|
return;
|
|
335
341
|
}
|
|
342
|
+
if (!current())
|
|
343
|
+
return;
|
|
336
344
|
const progress = { complete: true, reachable: true };
|
|
337
345
|
session.set({
|
|
338
346
|
underway: attempt === 'opened' ? progress : null,
|
|
@@ -342,15 +350,13 @@ export function sync(runtime, attempt, found) {
|
|
|
342
350
|
});
|
|
343
351
|
moveTo(runtime, transferring(runtime));
|
|
344
352
|
try {
|
|
345
|
-
const local = await store.open();
|
|
346
|
-
if (!live())
|
|
347
|
-
return;
|
|
348
353
|
await socket.authorize();
|
|
349
354
|
if (!live())
|
|
350
355
|
return;
|
|
351
|
-
const listed = await discoverRooms(runtime,
|
|
356
|
+
const listed = await discoverRooms(runtime, progress, live, found);
|
|
357
|
+
answered = progress.reachable;
|
|
352
358
|
if (listed !== null)
|
|
353
|
-
await synchronize(runtime, listed,
|
|
359
|
+
await synchronize(runtime, listed, progress, attempt, live);
|
|
354
360
|
runtime.retries.succeeded('connection', OPENING_LANE);
|
|
355
361
|
}
|
|
356
362
|
catch (error) {
|
|
@@ -373,19 +379,29 @@ export function sync(runtime, attempt, found) {
|
|
|
373
379
|
session.set({ underway: null });
|
|
374
380
|
await rest(runtime, progress, live);
|
|
375
381
|
});
|
|
382
|
+
return answered;
|
|
383
|
+
}
|
|
384
|
+
export async function discover(runtime) {
|
|
385
|
+
const { recovery } = runtime;
|
|
386
|
+
if (await sync(runtime, 'unstreamed', null)) {
|
|
387
|
+
recovery.cancel(DISCOVERY);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
void recovery.attempt(DISCOVERY, async () => ((await sync(runtime, 'unstreamed', null)) ? 'done' : 'again'), { again: true, attempts: Infinity });
|
|
391
|
+
}
|
|
392
|
+
export function adopt(runtime, unstored) {
|
|
393
|
+
const { session } = runtime.socket;
|
|
394
|
+
return sync(runtime, 'unstreamed', unstored, () => session.now().unstored === unstored).then(() => undefined);
|
|
376
395
|
}
|
|
377
396
|
export function resynchronize(runtime) {
|
|
378
|
-
const {
|
|
397
|
+
const { socket, presence } = runtime;
|
|
379
398
|
return socket.lanes.task(OPENING_LANE, async (live) => {
|
|
380
399
|
if (!live() || !socket.isAnnounced())
|
|
381
400
|
return;
|
|
382
401
|
const progress = { complete: true, reachable: true };
|
|
383
402
|
moveTo(runtime, transferring(runtime));
|
|
384
403
|
try {
|
|
385
|
-
|
|
386
|
-
if (!live())
|
|
387
|
-
return;
|
|
388
|
-
await synchronize(runtime, presence.rooms(), local, progress, 'unstreamed', live);
|
|
404
|
+
await synchronize(runtime, presence.rooms(), progress, 'unstreamed', live);
|
|
389
405
|
runtime.retries.succeeded('download', OPENING_LANE);
|
|
390
406
|
}
|
|
391
407
|
catch (error) {
|
|
@@ -396,19 +412,19 @@ export function resynchronize(runtime) {
|
|
|
396
412
|
await finishOpening(runtime, progress, live);
|
|
397
413
|
});
|
|
398
414
|
}
|
|
399
|
-
export function countAuthorityChange({ store, socket, lastAnswers }) {
|
|
415
|
+
export function countAuthorityChange({ store, socket, lastAnswers }, listed) {
|
|
400
416
|
const authorityChanges = socket.session.now().authorityChanges + 1;
|
|
401
417
|
socket.session.set({ authorityChanges });
|
|
402
418
|
store.tell(AUTHORITY_TOPIC, authorityChanges);
|
|
403
|
-
lastAnswers.again();
|
|
419
|
+
lastAnswers.again(listed);
|
|
404
420
|
}
|
|
405
421
|
export function changeAuthority(runtime, change) {
|
|
406
|
-
const { store, socket
|
|
422
|
+
const { store, socket } = runtime;
|
|
407
423
|
const { session } = socket;
|
|
408
424
|
return socket.lanes.task(OPENING_LANE, async (live) => {
|
|
409
425
|
if (!live() || !socket.isAnnounced())
|
|
410
426
|
return;
|
|
411
|
-
countAuthorityChange(runtime);
|
|
427
|
+
countAuthorityChange(runtime, roomListChanged(runtime, change.roomList));
|
|
412
428
|
const progress = { complete: true, reachable: true };
|
|
413
429
|
moveTo(runtime, transferring(runtime));
|
|
414
430
|
try {
|
|
@@ -417,16 +433,17 @@ export function changeAuthority(runtime, change) {
|
|
|
417
433
|
return;
|
|
418
434
|
const invalid = malformed(change.rooms);
|
|
419
435
|
if (invalid !== null) {
|
|
420
|
-
journal.record(invalid);
|
|
421
436
|
await refuse(runtime, 'missing-required-guarantee');
|
|
422
437
|
return;
|
|
423
438
|
}
|
|
424
439
|
if (change.member !== undefined)
|
|
425
440
|
await signIn(runtime, local, change.member);
|
|
441
|
+
if (change.timeZone !== undefined)
|
|
442
|
+
await zoned(runtime, local, change.timeZone);
|
|
426
443
|
const discoveries = session.now().discoveries + 1;
|
|
427
444
|
session.set({ discoveries });
|
|
428
445
|
const listed = await applyDiscovery(runtime, change.rooms, discoveries, change.left);
|
|
429
|
-
await synchronize(runtime, listed,
|
|
446
|
+
await synchronize(runtime, listed, progress, 'authorized', live);
|
|
430
447
|
runtime.retries.succeeded('connection', OPENING_LANE);
|
|
431
448
|
}
|
|
432
449
|
catch (error) {
|
|
@@ -461,7 +478,7 @@ async function installCarried(runtime, room, local, change, live, progress) {
|
|
|
461
478
|
...(page.fileIds === undefined ? {} : { fileIds: page.fileIds }),
|
|
462
479
|
...(page.created === undefined ? {} : { created: page.created }),
|
|
463
480
|
changes: page.changes,
|
|
464
|
-
|
|
481
|
+
attachments: page.attachments,
|
|
465
482
|
...(page.folders === undefined ? {} : { folders: page.folders }),
|
|
466
483
|
}),
|
|
467
484
|
reached: socket.reads.reached,
|