@agentshouse/mdruntime 0.1.0-c26a54071744b → 0.1.0-c27d511fb284d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -16
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +32 -22
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +51 -28
- package/dist/adapter.d.ts +136 -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 +347 -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 +20 -15
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +28 -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 +14 -14
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +19 -9
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +18 -8
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +29 -12
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +241 -177
- 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 +75 -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 +20 -12
- 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 +40 -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 +17 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +29 -10
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +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 +20 -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 +3 -0
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +31 -5
- 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 -0
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -1
- 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 +162 -38
- package/dist/react.d.ts +6 -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/reference-forms.d.ts +4 -0
- package/dist/reference-forms.d.ts.map +1 -0
- package/dist/reference-forms.js +74 -0
- 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 +239 -18
- 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 +45 -0
- package/dist/rows.d.ts +11 -2
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +24 -10
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runtime.d.ts +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/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 +2 -2
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +3 -9
- package/dist/source.d.ts +7 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +15 -2
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +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 +13 -8
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +57 -26
- 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 +28 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +95 -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 +36 -17
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +20 -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,9 @@ 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 AttachmentSurface, type SavedParts, type SavedRoomDraft, type SaveResult } from './saves.js';
|
|
22
22
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
23
|
+
import { type HouseQuery, type HouseQueryOptions, type HouseQueryResult } from './house-query.js';
|
|
23
24
|
import { type EntrySeed } from './seed.js';
|
|
24
25
|
import type { ConnectionRefusal } from './socket.js';
|
|
25
26
|
import type { SyncStatus } from './status.js';
|
|
@@ -29,12 +30,13 @@ export type RoomSchemas = {
|
|
|
29
30
|
};
|
|
30
31
|
export type MdRuntime = {
|
|
31
32
|
loaded(): Promise<void>;
|
|
32
|
-
rooms(): Promise<
|
|
33
|
+
rooms(): Promise<ListedRooms>;
|
|
33
34
|
query: {
|
|
34
35
|
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
35
36
|
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
36
37
|
};
|
|
37
38
|
search(request: SearchRequest): Promise<SearchResult>;
|
|
39
|
+
queryHouse(query: HouseQuery, options?: HouseQueryOptions): Promise<HouseQueryResult>;
|
|
38
40
|
types(locator: string): Promise<RoomSchemas>;
|
|
39
41
|
roomDraft: RoomDraftSurface;
|
|
40
42
|
conversation: ConversationSurface;
|
|
@@ -44,15 +46,15 @@ export type MdRuntime = {
|
|
|
44
46
|
saveParts(room: string, parts: readonly SavedParts[], writtenBy?: WrittenBy): Promise<SaveResult>;
|
|
45
47
|
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
46
48
|
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
47
|
-
|
|
49
|
+
attachment: AttachmentSurface;
|
|
48
50
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
49
51
|
answered(operation: string): Promise<boolean>;
|
|
50
52
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
51
|
-
log(): string;
|
|
52
53
|
persistence(): boolean;
|
|
53
54
|
retry(): Promise<void>;
|
|
54
55
|
cleanUp(): Promise<number>;
|
|
55
56
|
unsent(): Promise<readonly UnsentWork[]>;
|
|
57
|
+
sent(): Promise<void>;
|
|
56
58
|
reset(): Promise<void>;
|
|
57
59
|
readAgain(): Promise<void>;
|
|
58
60
|
observe: {
|
|
@@ -63,6 +65,7 @@ export type MdRuntime = {
|
|
|
63
65
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
64
66
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
65
67
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
68
|
+
(topic: 'time-zone'): Promise<Observation<string | null>>;
|
|
66
69
|
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
67
70
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
68
71
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
@@ -72,13 +75,15 @@ export type MdRuntime = {
|
|
|
72
75
|
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
73
76
|
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
74
77
|
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
78
|
+
(topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
|
|
79
|
+
(topic: 'room-list'): Promise<Observation<RoomList | null>>;
|
|
75
80
|
(topic: 'figures'): Promise<Observation<FiguresResult>>;
|
|
76
81
|
(topic: 'holdings'): Promise<Observation<Holdings>>;
|
|
77
82
|
(topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
|
|
78
83
|
};
|
|
79
84
|
reauthorize(): Promise<void>;
|
|
80
85
|
};
|
|
81
|
-
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';
|
|
86
|
+
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';
|
|
82
87
|
export type ComposedRuntime = RuntimeView & {
|
|
83
88
|
seed(entry: EntrySeed): void;
|
|
84
89
|
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,EAML,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
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,MAAM,eAAe,CAAC;AAE5E,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtF,OA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AAC;QAC5D,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;QACxD,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpD,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;KACnF,CAAC;IACF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,WAAW,GACX,oBAAoB,GACpB,cAAc,GACd,aAAa,GACb,cAAc,GACd,QAAQ,GACR,WAAW,GACX,mBAAmB,GACnB,OAAO,GACP,OAAO,GACP,aAAa,GACb,cAAc,GACd,cAAc,GACd,eAAe,GACf,QAAQ,GACR,eAAe,GACf,WAAW,GACX,SAAS,GACT,UAAU,GACV,MAAM,CAAC;AAEX,MAAM,MAAM,eAAe,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;AAwMF,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CA2CjE"}
|
package/dist/surface.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { answeredCall, called, located, readHistory, resolveReference, } from './actions.js';
|
|
2
|
-
import { chatDraftSurface, conversationSurface, watchConversation, watchConversationAgents, watchConversationList, } from './conversation.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,11 @@ 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 { attachmentSurface, conversationFiles, saveParts, saveRoomDrafts, } from './saves.js';
|
|
18
|
+
import { queriedHouse, } from './house-query.js';
|
|
16
19
|
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
|
|
20
|
+
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';
|
|
21
|
+
import { OPENING_LANE } from './sync.js';
|
|
19
22
|
function told(store, topic, deliver, current) {
|
|
20
23
|
const watcher = store.watch(topic, deliver);
|
|
21
24
|
deliver(current);
|
|
@@ -28,17 +31,17 @@ function watchRooms(runtime, deliver) {
|
|
|
28
31
|
return () => {
|
|
29
32
|
watcher.stop();
|
|
30
33
|
if (store.watching(ROOMS_TOPIC, 'ready').length === 0)
|
|
31
|
-
store.
|
|
34
|
+
store.roomsShown.show(null);
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
|
-
function
|
|
35
|
-
const watcher = store.watch(
|
|
37
|
+
function watchFact({ store }, topic, fact, deliver) {
|
|
38
|
+
const watcher = store.watch(topic, deliver);
|
|
36
39
|
void store
|
|
37
40
|
.open()
|
|
38
41
|
.then((local) => local.facts())
|
|
39
|
-
.then((
|
|
42
|
+
.then((facts) => {
|
|
40
43
|
if (watcher.held())
|
|
41
|
-
deliver(
|
|
44
|
+
deliver(facts[fact]);
|
|
42
45
|
}, uncaught);
|
|
43
46
|
return watcher.stop;
|
|
44
47
|
}
|
|
@@ -67,6 +70,10 @@ function watching(runtime) {
|
|
|
67
70
|
return watchConversationList(conversations, deliver);
|
|
68
71
|
if (topic === 'agents')
|
|
69
72
|
return watchConversationAgents(conversations, deliver);
|
|
73
|
+
if (topic === 'listed-agents')
|
|
74
|
+
return watchListedAgents(conversations, deliver);
|
|
75
|
+
if (topic === 'room-list')
|
|
76
|
+
return watchRoomList(runtime, deliver);
|
|
70
77
|
if (topic === 'figures')
|
|
71
78
|
return figures.watch(deliver, fail);
|
|
72
79
|
if (topic === 'holdings')
|
|
@@ -76,7 +83,7 @@ function watching(runtime) {
|
|
|
76
83
|
if (topic === 'presentation')
|
|
77
84
|
return watchPresentation(runtime, input[0], deliver);
|
|
78
85
|
if (topic === 'readiness') {
|
|
79
|
-
return watchReadiness(runtime, { target: '', code: 'stored' }, null, deliver);
|
|
86
|
+
return watchReadiness(runtime, { target: '', code: 'stored', first: null, inboxed: null }, null, deliver);
|
|
80
87
|
}
|
|
81
88
|
if (topic === 'rooms')
|
|
82
89
|
return watchRooms(runtime, deliver);
|
|
@@ -84,7 +91,7 @@ function watching(runtime) {
|
|
|
84
91
|
return told(store, REFUSAL_TOPIC, deliver, session.refusal);
|
|
85
92
|
}
|
|
86
93
|
if (topic === 'storage-loss') {
|
|
87
|
-
return told(store, STORAGE_LOSS_TOPIC, deliver,
|
|
94
|
+
return told(store, STORAGE_LOSS_TOPIC, deliver, storageLossNow(runtime));
|
|
88
95
|
}
|
|
89
96
|
if (topic === 'sync-status') {
|
|
90
97
|
return told(store, STATUS_TOPIC, deliver, store.device.now().status);
|
|
@@ -93,7 +100,9 @@ function watching(runtime) {
|
|
|
93
100
|
return told(store, SERVICE_MODE_TOPIC, deliver, session.serviceMode);
|
|
94
101
|
}
|
|
95
102
|
if (topic === 'member')
|
|
96
|
-
return
|
|
103
|
+
return watchFact(runtime, MEMBER_TOPIC, 'member', deliver);
|
|
104
|
+
if (topic === 'time-zone')
|
|
105
|
+
return watchFact(runtime, TIME_ZONE_TOPIC, 'timeZone', deliver);
|
|
97
106
|
if (topic === 'authority-changes') {
|
|
98
107
|
return told(store, AUTHORITY_TOPIC, deliver, session.authorityChanges);
|
|
99
108
|
}
|
|
@@ -105,7 +114,7 @@ function watching(runtime) {
|
|
|
105
114
|
function roomsOnce(runtime) {
|
|
106
115
|
const { store, socket } = runtime;
|
|
107
116
|
if (socket.closed())
|
|
108
|
-
return Promise.resolve([]);
|
|
117
|
+
return Promise.resolve({ rooms: [], models: {} });
|
|
109
118
|
return new Promise((settle) => {
|
|
110
119
|
const watcher = store.watch(ROOMS_TOPIC, (value) => {
|
|
111
120
|
watcher.stop();
|
|
@@ -123,37 +132,59 @@ async function typesOf(runtime, locator) {
|
|
|
123
132
|
typedSelection: (room?.typedSelection ?? null) === null ? null : modelTypes(builtIn),
|
|
124
133
|
};
|
|
125
134
|
}
|
|
135
|
+
async function sentAll(runtime) {
|
|
136
|
+
const { store } = runtime;
|
|
137
|
+
for (;;) {
|
|
138
|
+
let moved;
|
|
139
|
+
const status = new Promise((resolve) => {
|
|
140
|
+
moved = resolve;
|
|
141
|
+
});
|
|
142
|
+
const watcher = store.watch(STATUS_TOPIC, () => moved());
|
|
143
|
+
try {
|
|
144
|
+
if (!leftToSend(await store.ask({ kind: 'authored.unsent' })))
|
|
145
|
+
return;
|
|
146
|
+
const calls = await (await store.open()).calls();
|
|
147
|
+
await Promise.race([
|
|
148
|
+
status,
|
|
149
|
+
...calls.map(({ operation }) => answeredCall(runtime, operation)),
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
watcher.stop();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
126
157
|
async function reauthorized(runtime) {
|
|
127
|
-
const { store, socket
|
|
158
|
+
const { store, socket } = runtime;
|
|
128
159
|
const { refusal } = socket.session.now();
|
|
129
160
|
if (refusal === null || !refusal.reauthorizationOffered)
|
|
130
161
|
return;
|
|
131
|
-
journal.record('connection reauthorize');
|
|
132
162
|
await socket.lanes.current();
|
|
133
163
|
await store.written();
|
|
134
164
|
socket.session.set({ authorization: undefined, paused: false });
|
|
135
165
|
if (!socket.streamed)
|
|
136
|
-
await
|
|
166
|
+
await runtime.discover();
|
|
137
167
|
else
|
|
138
168
|
await socket.lanes.task(OPENING_LANE, () => socket.authorize());
|
|
139
169
|
}
|
|
140
170
|
function mdRuntime(runtime, watch) {
|
|
141
|
-
const { store, socket,
|
|
171
|
+
const { store, socket, shell, conversations, lastAnswers } = runtime;
|
|
142
172
|
return {
|
|
143
173
|
loaded: () => store.open().then(() => undefined),
|
|
144
174
|
rooms: () => roomsOnce(runtime),
|
|
145
175
|
query: ((input) => planned(runtime, input, null).then((plan) => rowsQuery(runtime, plan))),
|
|
146
176
|
search: (input) => searched(runtime, input, null),
|
|
177
|
+
queryHouse: (input, options) => queriedHouse(runtime, input, null, options),
|
|
147
178
|
types: (locator) => typesOf(runtime, locator),
|
|
148
179
|
roomDraft: roomDraftSurface(runtime),
|
|
149
|
-
conversation: conversationSurface(conversations),
|
|
180
|
+
conversation: conversationSurface(conversations, conversationFiles(runtime)),
|
|
150
181
|
chatDraft: chatDraftSurface(conversations),
|
|
151
182
|
presentation: presentationSurface(runtime),
|
|
152
183
|
save: (room, named, writtenBy) => saveRoomDrafts(runtime, room, named, writtenBy),
|
|
153
184
|
saveParts: (room, parts, writtenBy) => saveParts(runtime, room, parts, writtenBy),
|
|
154
185
|
history: (locator, path, query) => readHistory(runtime, locator, path, query),
|
|
155
186
|
resolve: (room, path, destination) => resolveReference(runtime, room, path, destination),
|
|
156
|
-
|
|
187
|
+
attachment: attachmentSurface(runtime),
|
|
157
188
|
call: (name, input) => called(runtime, name, input),
|
|
158
189
|
answered: (operation) => answeredCall(runtime, operation),
|
|
159
190
|
async reached(locator, roomVersion, path) {
|
|
@@ -161,7 +192,6 @@ function mdRuntime(runtime, watch) {
|
|
|
161
192
|
? reachedBy(runtime, locator, roomVersion)
|
|
162
193
|
: writtenAfter(runtime, locator, roomVersion, path);
|
|
163
194
|
},
|
|
164
|
-
log: () => journal.export(),
|
|
165
195
|
async cleanUp() {
|
|
166
196
|
const freed = await store.ask({ kind: 'opened.clean' });
|
|
167
197
|
const tidied = (await shell.cleanUp?.()) ?? 0;
|
|
@@ -169,13 +199,13 @@ function mdRuntime(runtime, watch) {
|
|
|
169
199
|
return freed + tidied;
|
|
170
200
|
},
|
|
171
201
|
unsent: () => store.ask({ kind: 'authored.unsent' }),
|
|
202
|
+
sent: () => sentAll(runtime),
|
|
172
203
|
reset: () => shell.reset(),
|
|
173
204
|
async readAgain() {
|
|
174
205
|
lastAnswers.again();
|
|
175
206
|
},
|
|
176
207
|
persistence: () => store.device.now().persistence === 'granted',
|
|
177
208
|
async retry() {
|
|
178
|
-
journal.record('retry');
|
|
179
209
|
store.prepareAgain();
|
|
180
210
|
store.readiness.queue();
|
|
181
211
|
if (store.space.full())
|
|
@@ -186,7 +216,7 @@ function mdRuntime(runtime, watch) {
|
|
|
186
216
|
};
|
|
187
217
|
}
|
|
188
218
|
export function composedRuntime(runtime) {
|
|
189
|
-
const { store
|
|
219
|
+
const { store } = runtime;
|
|
190
220
|
const watch = watching(runtime);
|
|
191
221
|
const md = mdRuntime(runtime, watch);
|
|
192
222
|
const reachable = {
|
|
@@ -196,12 +226,14 @@ export function composedRuntime(runtime) {
|
|
|
196
226
|
query: (plan) => rowsQuery(runtime, plan),
|
|
197
227
|
watchPlan: (plan, deliver, fail) => watchPlan(runtime, plan, deliver, fail),
|
|
198
228
|
search: (input, reach) => searched(runtime, input, reach),
|
|
229
|
+
queryHouse: (input, reach, options) => queriedHouse(runtime, input, reach, options),
|
|
230
|
+
queried: () => runtime.socket.session.now().queriesOnly,
|
|
199
231
|
watchReadiness: (port, reach, deliver) => watchReadiness(runtime, port, reach, deliver),
|
|
200
232
|
locked: (locator) => locked(runtime, locator),
|
|
201
233
|
lockedRooms: () => lockedRooms(runtime),
|
|
202
234
|
watchLocks: (notify) => watchLocks(runtime, notify),
|
|
203
235
|
located: (room, path, destination) => located(runtime, room, path, destination),
|
|
204
|
-
room: async (locator) => shownRooms(runtime, await listingNow(runtime)).find((one) => one.locator === locator),
|
|
236
|
+
room: async (locator) => shownRooms(runtime, await listingNow(runtime)).rooms.find((one) => one.locator === locator),
|
|
205
237
|
};
|
|
206
238
|
return {
|
|
207
239
|
md,
|
|
@@ -212,8 +244,7 @@ export function composedRuntime(runtime) {
|
|
|
212
244
|
if (answer === store.device.now().persistence)
|
|
213
245
|
return;
|
|
214
246
|
store.device.set({ persistence: answer });
|
|
215
|
-
|
|
216
|
-
store.readiness.queue();
|
|
247
|
+
emitStorageLoss(runtime);
|
|
217
248
|
},
|
|
218
249
|
within(reach, port) {
|
|
219
250
|
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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0ClB;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAW9D;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAK1E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAe7D;AAED,wBAAgB,oBAAoB,CAClC,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EACvC,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,QAM1B;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,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,
|