@agentshouse/mdruntime 0.1.0-c5fe3b2cddda7 → 0.1.0-c6197367d5fad
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 +3 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +299 -0
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +26 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +302 -0
- package/dist/adapter.d.ts +156 -89
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -11
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +20 -60
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/bootstrap.d.ts +9 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +204 -85
- 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-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts +5 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +7 -2
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +11 -0
- package/dist/client.d.ts +33 -23
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +43 -56
- package/dist/collection.d.ts +26 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +19 -2
- 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 +8 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +286 -336
- package/dist/connection.d.ts +5 -142
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +111 -4993
- 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 +150 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +259 -0
- package/dist/conversation-row.d.ts +40 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +66 -0
- package/dist/conversation.d.ts +72 -51
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +1001 -926
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts +11 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +157 -0
- 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 +20 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +2 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +18 -8
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -0
- package/dist/figures.d.ts +49 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +199 -0
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- 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 +21 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +83 -41
- 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 +37 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -5
- package/dist/install.d.ts +60 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +537 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +282 -0
- package/dist/listing.d.ts +52 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +152 -0
- package/dist/live.d.ts +9 -6
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +118 -36
- package/dist/loaded.d.ts +5 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +40 -0
- package/dist/locks.d.ts +7 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +32 -0
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +49 -0
- package/dist/media.d.ts +19 -2
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +105 -27
- package/dist/memory.d.ts +18 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +214 -91
- package/dist/messages.d.ts +35 -5
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +109 -39
- package/dist/model.d.ts +2 -10
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -14
- package/dist/models.d.ts +10 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +153 -0
- package/dist/observation.d.ts +28 -13
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +185 -81
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +53 -0
- package/dist/outcome.d.ts +17 -2
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +35 -2
- package/dist/overlay.d.ts +7 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +48 -24
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +4 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +13 -0
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +22 -0
- package/dist/preparation.d.ts +41 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +314 -0
- package/dist/presence.d.ts +58 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +231 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +308 -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 +30 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +116 -0
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +480 -0
- package/dist/reach.d.ts +16 -15
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +257 -148
- package/dist/react.d.ts +19 -3
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -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 +9 -6
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +3 -5
- package/dist/reads.d.ts +39 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +178 -0
- package/dist/recovery.d.ts +3 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +38 -8
- package/dist/refresh.d.ts +2 -1
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +31 -3
- 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 +11 -16
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +66 -32
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +34 -10
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +331 -111
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +220 -0
- 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 +16 -22
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +49 -186
- package/dist/runtime.d.ts +34 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +42 -86
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +332 -228
- package/dist/saves.d.ts +34 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +437 -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 -6
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +13 -95
- package/dist/shown.d.ts +35 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +313 -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 +28 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +103 -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/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 +67 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +164 -0
- package/dist/source.d.ts +59 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +93 -0
- package/dist/status.d.ts +0 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -6
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +40 -0
- package/dist/store/readiness.d.ts +11 -0
- package/dist/store/readiness.d.ts.map +1 -0
- package/dist/store/readiness.js +68 -0
- package/dist/store/records.d.ts +224 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +466 -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/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/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 -143
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +171 -364
- package/dist/stored.d.ts +72 -35
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +337 -197
- package/dist/surface.d.ts +92 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +251 -0
- package/dist/sync.d.ts +19 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +538 -0
- package/dist/tables.d.ts +118 -67
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +199 -278
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +128 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +9 -12
- 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 +72 -9
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +26 -5
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- 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 -370
- package/dist/log.d.ts +0 -5
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -156
package/dist/react.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { Acting, Lane, LaneShown } from './act-lanes.js';
|
|
1
3
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import type { AppRoom
|
|
3
|
-
import type {
|
|
4
|
+
import type { AppRoom } from './listing.js';
|
|
5
|
+
import type { ConnectionRefusal } from './socket.js';
|
|
6
|
+
import type { SavedRoomDraft, SaveResult } from './saves.js';
|
|
7
|
+
import type { ListedAgent, Member, RoomList, ServiceMode } from './adapter.js';
|
|
4
8
|
import type { ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
5
9
|
import { type RuntimeError } from './failure.js';
|
|
10
|
+
import type { FiguresResult } from './figures.js';
|
|
11
|
+
import type { Holdings } from './holdings.js';
|
|
12
|
+
import type { Descriptor, Expecting } from './expectation.js';
|
|
6
13
|
import type { QueueEntry } from './outcome.js';
|
|
7
|
-
import type {
|
|
14
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
8
15
|
import type { Readiness } from './readiness.js';
|
|
9
16
|
import type { RoomDraft, RoomDraftParts } from './room-draft.js';
|
|
10
17
|
import type { SyncStatus } from './status.js';
|
|
@@ -23,6 +30,8 @@ export declare function useObserve(client: Client, topic: 'storage-loss'): Obser
|
|
|
23
30
|
export declare function useObserve(client: Client, topic: 'sync-status'): Observed<SyncStatus>;
|
|
24
31
|
export declare function useObserve(client: Client, topic: 'service-mode'): Observed<ServiceMode>;
|
|
25
32
|
export declare function useObserve(client: Client, topic: 'member'): Observed<Member | null>;
|
|
33
|
+
export declare function useObserve(client: Client, topic: 'time-zone'): Observed<string | null>;
|
|
34
|
+
export declare function useObserve(client: Client, topic: 'authority-changes'): Observed<number>;
|
|
26
35
|
export declare function useObserve(client: Client, topic: 'query', query: DocumentQuery): Observed<DocumentResult | PendingResult>;
|
|
27
36
|
export declare function useObserve(client: Client, topic: 'query', query: GroupQuery): Observed<GroupResult | PendingResult>;
|
|
28
37
|
export declare function useObserve(client: Client, topic: 'queue', locator: string): Observed<readonly QueueEntry[]>;
|
|
@@ -31,6 +40,13 @@ export declare function useObserve(client: Client, topic: 'presentation'): Obser
|
|
|
31
40
|
export declare function useObserve(client: Client, topic: 'conversation', conversation: string, options: ConversationOptions): Observed<ConversationView>;
|
|
32
41
|
export declare function useObserve(client: Client, topic: 'conversations'): Observed<readonly ConversationEntry[]>;
|
|
33
42
|
export declare function useObserve(client: Client, topic: 'agents'): Observed<readonly ConversationAgent[]>;
|
|
43
|
+
export declare function useObserve(client: Client, topic: 'listed-agents'): Observed<readonly ListedAgent[]>;
|
|
44
|
+
export declare function useObserve(client: Client, topic: 'room-list'): Observed<RoomList | null>;
|
|
45
|
+
export declare function useObserve(client: Client, topic: 'figures'): Observed<FiguresResult>;
|
|
46
|
+
export declare function useObserve(client: Client, topic: 'holdings'): Observed<Holdings>;
|
|
47
|
+
export declare function useExpected<A, T>(store: Expecting, descriptor: Descriptor<A, T>, places: readonly A[], held: ReadonlyMap<A, T> | null): (place: A, held: T) => T;
|
|
48
|
+
export type LaneHeld<O> = LaneShown<O> & Pick<Lane<O>, 'run' | 'forget'>;
|
|
49
|
+
export declare function useLane<O>(lanes: Acting<O>): LaneHeld<O>;
|
|
34
50
|
export type Saving = {
|
|
35
51
|
readonly busy: boolean;
|
|
36
52
|
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":"
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC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vB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IACtC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpF,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACvF,CAAC;AAMF,wBAAgB,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CA8BvD"}
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
|
|
2
2
|
import { failed } from './failure.js';
|
|
3
3
|
const LOADING = { state: 'loading' };
|
|
4
4
|
export function useObserve(client, topic, ...input) {
|
|
@@ -32,6 +32,38 @@ export function useObserve(client, topic, ...input) {
|
|
|
32
32
|
}, [client, key]);
|
|
33
33
|
return held !== null && held.client === client && held.key === key ? held.observed : LOADING;
|
|
34
34
|
}
|
|
35
|
+
function sameHeld(descriptor, was, now) {
|
|
36
|
+
if (was === now)
|
|
37
|
+
return true;
|
|
38
|
+
if (was === null || now === null || was.size !== now.size)
|
|
39
|
+
return false;
|
|
40
|
+
const before = new Map([...was].map(([place, value]) => [descriptor.place(place), value]));
|
|
41
|
+
return [...now].every(([place, value]) => {
|
|
42
|
+
const at = descriptor.place(place);
|
|
43
|
+
return before.has(at) && Object.is(before.get(at), value);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function useExpected(store, descriptor, places, held) {
|
|
47
|
+
const reader = useId();
|
|
48
|
+
const version = useSyncExternalStore(store.subscribe, store.version);
|
|
49
|
+
const asked = JSON.stringify(places.map((one) => descriptor.place(one)));
|
|
50
|
+
const kept = useRef(held);
|
|
51
|
+
if (!sameHeld(descriptor, kept.current, held))
|
|
52
|
+
kept.current = held;
|
|
53
|
+
const shown = kept.current;
|
|
54
|
+
useLayoutEffect(() => store.reads(reader, descriptor, places), [store, reader, descriptor, asked]);
|
|
55
|
+
useLayoutEffect(() => () => store.left(reader), [store, reader]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (shown !== null)
|
|
58
|
+
store.heard(reader, descriptor, shown);
|
|
59
|
+
}, [store, reader, descriptor, shown]);
|
|
60
|
+
return useCallback((place, value) => store.draw(descriptor, place, value), [store, descriptor, version]);
|
|
61
|
+
}
|
|
62
|
+
export function useLane(lanes) {
|
|
63
|
+
const lane = useMemo(() => lanes.open(), [lanes]);
|
|
64
|
+
const shown = useSyncExternalStore(lane.subscribe, lane.shown);
|
|
65
|
+
return useMemo(() => ({ ...shown, run: lane.run, forget: lane.forget }), [shown, lane]);
|
|
66
|
+
}
|
|
35
67
|
const IDLE = { busy: false, outcome: null, failure: null };
|
|
36
68
|
export function useSave(client) {
|
|
37
69
|
const [state, setState] = useState(IDLE);
|
package/dist/read.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Fields = Readonly<Record<string, unknown>>;
|
|
2
|
+
export declare const EXCERPT = 512;
|
|
3
|
+
export declare function excerpt(said: string): string;
|
|
4
|
+
export declare function record(entry: unknown): Fields;
|
|
5
|
+
export declare function text(fields: Fields, name: string): string | null;
|
|
6
|
+
export declare function list(fields: Fields, name: string): readonly unknown[];
|
|
7
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvD,eAAO,MAAM,OAAO,MAAM,CAAC;AAE3B,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI7C;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,CAGrE"}
|
package/dist/read.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const EXCERPT = 512;
|
|
2
|
+
export function excerpt(said) {
|
|
3
|
+
return [...said.slice(0, EXCERPT * 2)].slice(0, EXCERPT).join('');
|
|
4
|
+
}
|
|
5
|
+
export function record(entry) {
|
|
6
|
+
return typeof entry === 'object' && entry !== null && !Array.isArray(entry)
|
|
7
|
+
? entry
|
|
8
|
+
: {};
|
|
9
|
+
}
|
|
10
|
+
export function text(fields, name) {
|
|
11
|
+
const value = fields[name];
|
|
12
|
+
return typeof value === 'string' && value !== '' ? value : null;
|
|
13
|
+
}
|
|
14
|
+
export function list(fields, name) {
|
|
15
|
+
const value = fields[name];
|
|
16
|
+
return Array.isArray(value) ? value : [];
|
|
17
|
+
}
|
package/dist/readiness.d.ts
CHANGED
|
@@ -6,15 +6,13 @@ export type RoomCoverage = {
|
|
|
6
6
|
readonly state: RoomPreparation;
|
|
7
7
|
};
|
|
8
8
|
export type ConversationCoverage = Open<'complete' | 'acquiring' | 'undeclared'>;
|
|
9
|
-
export type SearchObligation = Open<'required' | 'unused'>;
|
|
10
9
|
export type TargetCoverage = {
|
|
11
10
|
readonly complete: boolean;
|
|
12
11
|
readonly listed: boolean;
|
|
13
12
|
readonly rooms: readonly RoomCoverage[];
|
|
14
13
|
readonly conversations: ConversationCoverage;
|
|
15
|
-
readonly search: SearchObligation;
|
|
16
14
|
};
|
|
17
|
-
export type Persistence = Open<'granted' | 'denied' | 'unavailable'>;
|
|
15
|
+
export type Persistence = Open<'granted' | 'denied' | 'unavailable' | 'memory'>;
|
|
18
16
|
export type Durability = Open<'persistent' | 'best-effort'>;
|
|
19
17
|
export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
|
|
20
18
|
export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
|
|
@@ -26,7 +24,6 @@ export type InstallationAmount = {
|
|
|
26
24
|
};
|
|
27
25
|
export type Installation = {
|
|
28
26
|
readonly step: InstallationStep | null;
|
|
29
|
-
readonly rooms: InstallationAmount;
|
|
30
27
|
readonly bytes: InstallationAmount;
|
|
31
28
|
};
|
|
32
29
|
export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
|
|
@@ -44,9 +41,15 @@ export type Readiness = {
|
|
|
44
41
|
readonly installation: Installation;
|
|
45
42
|
readonly lost: boolean;
|
|
46
43
|
};
|
|
44
|
+
export type ReadinessShown = Omit<Readiness, 'coverage'> & {
|
|
45
|
+
readonly coverage: Omit<TargetCoverage, 'rooms'>;
|
|
46
|
+
};
|
|
47
47
|
export type ReadinessFacts = Omit<Readiness, 'status' | 'ready' | 'usable' | 'durability' | 'coverage'> & {
|
|
48
|
-
readonly coverage: Omit<TargetCoverage, 'complete'
|
|
48
|
+
readonly coverage: Omit<TargetCoverage, 'complete' | 'rooms'> & {
|
|
49
|
+
readonly unsettled: number;
|
|
50
|
+
};
|
|
49
51
|
readonly established: boolean;
|
|
50
52
|
};
|
|
51
|
-
export declare
|
|
53
|
+
export declare const COMPLETE_ROOMS: ReadonlySet<string>;
|
|
54
|
+
export declare function readinessOf(facts: ReadinessFacts): ReadinessShown;
|
|
52
55
|
//# sourceMappingURL=readiness.d.ts.map
|
package/dist/readiness.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../src/readiness.ts"],"names":[],"mappings":"AAAA,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AAsB,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IACzD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,SAAS,EACT,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,CAC1D,GAAG;IACF,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/F,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAAuC,CAAC;AAEvF,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CA4BjE"}
|
package/dist/readiness.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
const COMPLETE_ROOMS = new Set(['complete', 'unadmitted']);
|
|
1
|
+
export const COMPLETE_ROOMS = new Set(['complete', 'unadmitted']);
|
|
2
2
|
export function readinessOf(facts) {
|
|
3
|
-
const { established, coverage: held, ...reported } = facts;
|
|
3
|
+
const { established, coverage: { unsettled, ...held }, ...reported } = facts;
|
|
4
4
|
const settledConversations = held.conversations === 'complete' || held.conversations === 'undeclared';
|
|
5
|
-
const complete = held.listed &&
|
|
6
|
-
settledConversations &&
|
|
7
|
-
held.rooms.every((room) => COMPLETE_ROOMS.has(room.state));
|
|
5
|
+
const complete = held.listed && settledConversations && unsettled === 0;
|
|
8
6
|
const coverage = { ...held, complete };
|
|
9
7
|
const stored = facts.code === 'stored';
|
|
10
8
|
const ready = stored && complete;
|
package/dist/reads.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type CallResult } from './outcome.js';
|
|
2
|
+
import type { Recovery } from './recovery.js';
|
|
3
|
+
import type { Attempt, Retries } from './retried.js';
|
|
4
|
+
import type { Connection, RuntimeDatabase } from './tables.js';
|
|
5
|
+
export declare const READ_TABLES: readonly string[];
|
|
6
|
+
export type ReadAt = {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly input: string;
|
|
9
|
+
readonly build: string;
|
|
10
|
+
};
|
|
11
|
+
export type ObservedRead = {
|
|
12
|
+
readonly answer: unknown;
|
|
13
|
+
readonly failure: CallResult | null;
|
|
14
|
+
readonly kept: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type ReadAnswers = {
|
|
17
|
+
watch(name: string, input: unknown, deliver: (read: ObservedRead) => void): () => void;
|
|
18
|
+
again(led?: Promise<unknown>): void;
|
|
19
|
+
reopened(): void;
|
|
20
|
+
};
|
|
21
|
+
export type ReadAnswersOptions = {
|
|
22
|
+
readonly database: RuntimeDatabase;
|
|
23
|
+
readonly build: string;
|
|
24
|
+
readonly unkept: readonly string[];
|
|
25
|
+
readonly leading: readonly string[];
|
|
26
|
+
readonly recovery: Recovery;
|
|
27
|
+
readonly retries: Retries;
|
|
28
|
+
call(name: string, input: unknown, attempt: Attempt): Promise<CallResult>;
|
|
29
|
+
online(): boolean;
|
|
30
|
+
streaming(): boolean;
|
|
31
|
+
closed(): boolean;
|
|
32
|
+
full(): boolean;
|
|
33
|
+
filled(): void;
|
|
34
|
+
};
|
|
35
|
+
export declare function storedRead(connection: Connection, { name, input, build }: ReadAt): string | null;
|
|
36
|
+
export declare function keptRead(connection: Connection, { name, input, build }: ReadAt, answer: string): null;
|
|
37
|
+
export declare function readsOfOtherBuildsForgotten(connection: Connection, build: string): null;
|
|
38
|
+
export declare function readAnswers(options: ReadAnswersOptions): ReadAnswers;
|
|
39
|
+
//# sourceMappingURL=reads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads.d.ts","sourceRoot":"","sources":["../src/reads.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAExC,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACvF,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACpC,QAAQ,IAAI,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1E,MAAM,IAAI,OAAO,CAAC;IAClB,SAAS,IAAI,OAAO,CAAC;IACrB,MAAM,IAAI,OAAO,CAAC;IAClB,IAAI,IAAI,OAAO,CAAC;IAChB,MAAM,IAAI,IAAI,CAAC;CAChB,CAAC;AAeF,wBAAgB,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMhG;AAED,wBAAgB,QAAQ,CACtB,UAAU,EAAE,UAAU,EACtB,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAC9B,MAAM,EAAE,MAAM,GACb,IAAI,CAMN;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAGvF;AAMD,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAwJpE"}
|
package/dist/reads.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { refusedForSpace } from './durability.js';
|
|
2
|
+
import { uncaught } from './failure.js';
|
|
3
|
+
import { answeredResult, UNCERTAIN } from './outcome.js';
|
|
4
|
+
export const READ_TABLES = [
|
|
5
|
+
'CREATE TABLE read_answers (name TEXT NOT NULL, input TEXT NOT NULL, build TEXT NOT NULL, answer TEXT NOT NULL, PRIMARY KEY (name, input)) WITHOUT ROWID',
|
|
6
|
+
];
|
|
7
|
+
export function storedRead(connection, { name, input, build }) {
|
|
8
|
+
const [held] = connection.rows('SELECT answer FROM read_answers WHERE name = ? AND input = ? AND build = ?', [name, input, build]);
|
|
9
|
+
return held === undefined ? null : String(held.answer);
|
|
10
|
+
}
|
|
11
|
+
export function keptRead(connection, { name, input, build }, answer) {
|
|
12
|
+
connection.run('INSERT OR REPLACE INTO read_answers (name, input, build, answer) VALUES (?, ?, ?, ?)', [name, input, build, answer]);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
export function readsOfOtherBuildsForgotten(connection, build) {
|
|
16
|
+
connection.run('DELETE FROM read_answers WHERE build <> ?', [build]);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
function answered(result) {
|
|
20
|
+
return result.kind === 'action' && answeredResult(result.result);
|
|
21
|
+
}
|
|
22
|
+
export function readAnswers(options) {
|
|
23
|
+
const { database, build, recovery } = options;
|
|
24
|
+
const unkept = new Set(options.unkept);
|
|
25
|
+
const leading = new Set(options.leading);
|
|
26
|
+
const reads = new Map();
|
|
27
|
+
function leads(read) {
|
|
28
|
+
return leading.has(read.at.name);
|
|
29
|
+
}
|
|
30
|
+
function show(read, shown) {
|
|
31
|
+
read.shown = shown;
|
|
32
|
+
for (const deliver of read.observers)
|
|
33
|
+
deliver(shown);
|
|
34
|
+
}
|
|
35
|
+
async function kept(read, answer) {
|
|
36
|
+
if (!read.shown.kept || options.full())
|
|
37
|
+
return;
|
|
38
|
+
await database.ask({ kind: 'read.keep', ...read.at, answer }).catch((error) => {
|
|
39
|
+
if (refusedForSpace(error))
|
|
40
|
+
options.filled();
|
|
41
|
+
else
|
|
42
|
+
uncaught(error);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async function asked(read, led) {
|
|
46
|
+
if (!options.online()) {
|
|
47
|
+
read.owed = true;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const attempt = { step: 'reading', instance: read.key };
|
|
51
|
+
const result = await options.call(read.at.name, read.asked, attempt).catch((error) => {
|
|
52
|
+
options.retries.failed(attempt.step, attempt.instance, error);
|
|
53
|
+
return UNCERTAIN;
|
|
54
|
+
});
|
|
55
|
+
if (options.closed())
|
|
56
|
+
return;
|
|
57
|
+
read.owed = !answered(result);
|
|
58
|
+
if (read.owed) {
|
|
59
|
+
show(read, { ...read.shown, failure: result });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const answer = result.result;
|
|
63
|
+
const text = JSON.stringify(answer);
|
|
64
|
+
if (text === read.text && read.shown.failure === null)
|
|
65
|
+
return;
|
|
66
|
+
read.text = text;
|
|
67
|
+
await kept(read, text);
|
|
68
|
+
await led;
|
|
69
|
+
if (!options.closed())
|
|
70
|
+
show(read, { ...read.shown, answer, failure: null });
|
|
71
|
+
}
|
|
72
|
+
function lost(read) {
|
|
73
|
+
return read.owed && read.shown.failure?.kind === 'transport-uncertainty' && options.streaming();
|
|
74
|
+
}
|
|
75
|
+
function retrying(read) {
|
|
76
|
+
return `${read.key} again`;
|
|
77
|
+
}
|
|
78
|
+
function askedLater(read) {
|
|
79
|
+
void recovery.attempt(retrying(read), async () => {
|
|
80
|
+
if (options.closed() || read.observers.size === 0 || !lost(read))
|
|
81
|
+
return 'done';
|
|
82
|
+
await attempted(read);
|
|
83
|
+
return lost(read) ? 'again' : 'done';
|
|
84
|
+
}, { again: true });
|
|
85
|
+
}
|
|
86
|
+
function forgotten(read) {
|
|
87
|
+
read.text = null;
|
|
88
|
+
read.shown = { ...read.shown, answer: null, failure: null };
|
|
89
|
+
}
|
|
90
|
+
function attempted(read, led) {
|
|
91
|
+
read.asking = true;
|
|
92
|
+
return recovery
|
|
93
|
+
.attempt(read.key, async () => {
|
|
94
|
+
await asked(read, led);
|
|
95
|
+
return 'done';
|
|
96
|
+
})
|
|
97
|
+
.finally(() => {
|
|
98
|
+
const unanswered = read.joined && read.owed;
|
|
99
|
+
read.asking = false;
|
|
100
|
+
read.joined = false;
|
|
101
|
+
if (unanswered)
|
|
102
|
+
void ask(read);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function ask(read, led) {
|
|
106
|
+
return attempted(read, led).finally(() => {
|
|
107
|
+
if (lost(read))
|
|
108
|
+
askedLater(read);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function opened(name, input, key) {
|
|
112
|
+
const held = !unkept.has(name);
|
|
113
|
+
const read = {
|
|
114
|
+
key,
|
|
115
|
+
at: { name, input: JSON.stringify(input ?? null), build },
|
|
116
|
+
asked: input,
|
|
117
|
+
observers: new Set(),
|
|
118
|
+
stored: Promise.resolve(),
|
|
119
|
+
text: null,
|
|
120
|
+
shown: { answer: null, failure: null, kept: held },
|
|
121
|
+
owed: false,
|
|
122
|
+
asking: false,
|
|
123
|
+
joined: false,
|
|
124
|
+
};
|
|
125
|
+
if (held) {
|
|
126
|
+
read.stored = database.ask({ kind: 'read.stored', ...read.at }).then((text) => {
|
|
127
|
+
if (text === null || read.text !== null)
|
|
128
|
+
return;
|
|
129
|
+
read.text = text;
|
|
130
|
+
read.shown = { ...read.shown, answer: JSON.parse(text) };
|
|
131
|
+
}, uncaught);
|
|
132
|
+
}
|
|
133
|
+
reads.set(key, read);
|
|
134
|
+
return read;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
watch(name, input, deliver) {
|
|
138
|
+
const key = JSON.stringify([name, input ?? null]);
|
|
139
|
+
const read = reads.get(key) ?? opened(name, input, key);
|
|
140
|
+
read.observers.add(deliver);
|
|
141
|
+
void read.stored.then(() => {
|
|
142
|
+
if (!read.observers.has(deliver))
|
|
143
|
+
return;
|
|
144
|
+
if (!read.shown.kept)
|
|
145
|
+
forgotten(read);
|
|
146
|
+
deliver(read.shown);
|
|
147
|
+
if (read.asking)
|
|
148
|
+
read.joined = true;
|
|
149
|
+
else
|
|
150
|
+
void ask(read);
|
|
151
|
+
});
|
|
152
|
+
return () => {
|
|
153
|
+
read.observers.delete(deliver);
|
|
154
|
+
if (read.observers.size === 0 && reads.get(key) === read)
|
|
155
|
+
reads.delete(key);
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
again(first = Promise.resolve()) {
|
|
159
|
+
const all = [...reads.values()];
|
|
160
|
+
const led = Promise.all([first, ...all.filter(leads).map((read) => ask(read, first))]);
|
|
161
|
+
for (const read of all)
|
|
162
|
+
if (!leads(read))
|
|
163
|
+
void ask(read, led);
|
|
164
|
+
},
|
|
165
|
+
reopened() {
|
|
166
|
+
for (const read of reads.values()) {
|
|
167
|
+
recovery.cancel(retrying(read));
|
|
168
|
+
if (read.text === null) {
|
|
169
|
+
if (read.owed)
|
|
170
|
+
void ask(read);
|
|
171
|
+
}
|
|
172
|
+
else if (read.shown.failure?.kind === 'transport-uncertainty') {
|
|
173
|
+
show(read, { ...read.shown, failure: null });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
}
|
package/dist/recovery.d.ts
CHANGED
|
@@ -16,11 +16,13 @@ export type Recovery = {
|
|
|
16
16
|
attempt(intent: string, run: Attempt, options?: AttemptOptions): Promise<boolean>;
|
|
17
17
|
pending(intent: string): boolean;
|
|
18
18
|
resume(): void;
|
|
19
|
+
again(): void;
|
|
20
|
+
waits(wake: () => void): () => void;
|
|
19
21
|
cancel(intent: string): void;
|
|
20
22
|
scope(inFlight?: number): Recovery;
|
|
21
23
|
retire(): Promise<void>;
|
|
22
24
|
};
|
|
23
25
|
export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
|
|
24
|
-
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
|
|
26
|
+
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean, owner?: Recovery): Promise<T>;
|
|
25
27
|
export declare function createRecovery(options?: RecoveryOptions): Recovery;
|
|
26
28
|
//# sour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AI,CAAC;IAC7B,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACnC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB,CAAC;AAsBF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAW,EAAE,KAAK,SAAS,GAAG,MAAM,CAGpF;AAED,wBAAsB,aAAa,CAAC,CAAC,EACnC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACrB,MAAM,EAAE,WAAW,EACnB,QAAQ,GAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAoB,EAC7C,KAAK,CAAC,EAAE,QAAQ,GACf,OAAO,CAAC,CAAC,CAAC,CAsBZ;AAgMD,wBAAgB,cAAc,CAAC,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAStE"}
|
package/dist/recovery.js
CHANGED
|
@@ -7,7 +7,7 @@ export function retryDelay(tries, firstMs = FIRST_MS, maxMs = MAX_MS) {
|
|
|
7
7
|
const longest = Math.min(maxMs, firstMs * 2 ** tries);
|
|
8
8
|
return longest / 2 + (Math.random() * longest) / 2;
|
|
9
9
|
}
|
|
10
|
-
export async function untilAnswered(ask, signal, answered = () => true) {
|
|
10
|
+
export async function untilAnswered(ask, signal, answered = () => true, owner) {
|
|
11
11
|
for (let tries = 0;; tries += 1) {
|
|
12
12
|
try {
|
|
13
13
|
const answer = await ask();
|
|
@@ -19,16 +19,16 @@ export async function untilAnswered(ask, signal, answered = () => true) {
|
|
|
19
19
|
throw error;
|
|
20
20
|
}
|
|
21
21
|
await new Promise((resume) => {
|
|
22
|
-
const
|
|
22
|
+
const done = () => {
|
|
23
23
|
clearTimeout(again);
|
|
24
|
+
signal.removeEventListener('abort', done);
|
|
25
|
+
unheld();
|
|
24
26
|
resume();
|
|
25
27
|
};
|
|
26
28
|
// A read that failed is asked again on the doubling backoff, so its asker is answered once the failure clears.
|
|
27
|
-
const again = setTimeout(()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, retryDelay(tries));
|
|
31
|
-
signal.addEventListener('abort', stop, { once: true });
|
|
29
|
+
const again = setTimeout(done, retryDelay(tries));
|
|
30
|
+
signal.addEventListener('abort', done, { once: true });
|
|
31
|
+
const unheld = owner?.waits(done) ?? (() => { });
|
|
32
32
|
});
|
|
33
33
|
signal.throwIfAborted();
|
|
34
34
|
}
|
|
@@ -38,6 +38,7 @@ function owner(backoff, inFlight, release = () => { }) {
|
|
|
38
38
|
const children = new Set();
|
|
39
39
|
const running = new Set();
|
|
40
40
|
const queued = [];
|
|
41
|
+
const waiting = new Set();
|
|
41
42
|
let free = inFlight;
|
|
42
43
|
let retired = false;
|
|
43
44
|
function finish(key, intent, done) {
|
|
@@ -106,7 +107,15 @@ function owner(backoff, inFlight, release = () => { }) {
|
|
|
106
107
|
}
|
|
107
108
|
intent.tries += 1;
|
|
108
109
|
if (intent.tries >= backoff.attempts) {
|
|
109
|
-
|
|
110
|
+
if (again === null) {
|
|
111
|
+
finish(key, intent, false);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
intent.tries = 0;
|
|
115
|
+
if (again === 'now')
|
|
116
|
+
launch(key, intent);
|
|
117
|
+
else
|
|
118
|
+
wait(key, intent, again, true);
|
|
110
119
|
return;
|
|
111
120
|
}
|
|
112
121
|
if (result === 'again') {
|
|
@@ -187,6 +196,27 @@ function owner(backoff, inFlight, release = () => { }) {
|
|
|
187
196
|
launch(key, intent);
|
|
188
197
|
}
|
|
189
198
|
},
|
|
199
|
+
again() {
|
|
200
|
+
if (retired)
|
|
201
|
+
return;
|
|
202
|
+
for (const [key, intent] of [...intents]) {
|
|
203
|
+
if (intent.timer === null || intent.guided)
|
|
204
|
+
continue;
|
|
205
|
+
clearTimeout(intent.timer);
|
|
206
|
+
intent.timer = null;
|
|
207
|
+
launch(key, intent);
|
|
208
|
+
}
|
|
209
|
+
for (const wake of [...waiting])
|
|
210
|
+
wake();
|
|
211
|
+
for (const child of [...children])
|
|
212
|
+
child.again();
|
|
213
|
+
},
|
|
214
|
+
waits(wake) {
|
|
215
|
+
waiting.add(wake);
|
|
216
|
+
return () => {
|
|
217
|
+
waiting.delete(wake);
|
|
218
|
+
};
|
|
219
|
+
},
|
|
190
220
|
cancel(key) {
|
|
191
221
|
const intent = intents.get(key);
|
|
192
222
|
if (intent === undefined)
|
package/dist/refresh.d.ts
CHANGED
|
@@ -17,9 +17,10 @@ export type Refresher = (authorization: Authorization, request: RefreshRequest)
|
|
|
17
17
|
export type Refreshing = {
|
|
18
18
|
turn(): void;
|
|
19
19
|
prior(paths: readonly string[]): Promise<ReadonlyMap<string, HeldEntry>>;
|
|
20
|
+
later(paths: readonly string[], roomVersion: string): Promise<ReadonlySet<string>>;
|
|
20
21
|
stage(page: RefreshedPage): Promise<boolean>;
|
|
21
22
|
};
|
|
22
|
-
type PageContent = Pick<RefreshPage, 'documents' | 'revisions' | 'fileIds' | 'changes' | 'binaryFiles'>;
|
|
23
|
+
type PageContent = Pick<RefreshPage, 'documents' | 'facts' | 'revisions' | 'fileIds' | 'created' | 'changes' | 'binaryFiles'>;
|
|
23
24
|
export declare function pageEntries(page: PageContent, removals: readonly string[], roomVersion: string, prior: (paths: readonly string[]) => Promise<ReadonlyMap<string, HeldEntry>>): Promise<StoredEntry[]>;
|
|
24
25
|
export declare function advancement(refresh: Refresher, authorization: Authorization, held: ReplicaRecord, remodel: Remodel, continuing: () => boolean, staging: Refreshing): Promise<Advancement>;
|
|
25
26
|
export {};
|
package/dist/refresh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../src/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAA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AE,MAAM,EACnB,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAC3E,OAAO,CAAC,WAAW,EAAE,CAAC,CAKxB;AAgDD,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,OAAO,EACzB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,WAAW,CAAC,CA8CtB"}
|
package/dist/refresh.js
CHANGED
|
@@ -45,9 +45,11 @@ function* entering(page, roomVersion, listed, prior) {
|
|
|
45
45
|
entries.push({
|
|
46
46
|
path,
|
|
47
47
|
content: page.documents[path],
|
|
48
|
+
facts: page.facts[path] ?? null,
|
|
48
49
|
binary: null,
|
|
49
50
|
revision: page.revisions[path] ?? prior.get(path)?.revision ?? null,
|
|
50
51
|
fileId: page.fileIds?.[path] ?? null,
|
|
52
|
+
created: page.created?.[path] ?? null,
|
|
51
53
|
change: page.changes[path] ?? null,
|
|
52
54
|
written: roomVersion,
|
|
53
55
|
});
|
|
@@ -57,9 +59,11 @@ function* entering(page, roomVersion, listed, prior) {
|
|
|
57
59
|
entries.push({
|
|
58
60
|
path,
|
|
59
61
|
content: null,
|
|
62
|
+
facts: null,
|
|
60
63
|
binary: { state: 'accepted', ...page.binaryFiles[path] },
|
|
61
64
|
revision: page.revisions[path] ?? prior.get(path)?.revision ?? null,
|
|
62
65
|
fileId: page.fileIds?.[path] ?? null,
|
|
66
|
+
created: page.created?.[path] ?? null,
|
|
63
67
|
change: page.changes[path] ?? null,
|
|
64
68
|
written: null,
|
|
65
69
|
});
|
|
@@ -74,6 +78,7 @@ function* entering(page, roomVersion, listed, prior) {
|
|
|
74
78
|
...kept,
|
|
75
79
|
revision: page.revisions[path] ?? held.revision,
|
|
76
80
|
fileId: page.fileIds?.[path] ?? held.fileId,
|
|
81
|
+
created: page.created?.[path] ?? held.created,
|
|
77
82
|
change: page.changes[path] ?? held.change,
|
|
78
83
|
});
|
|
79
84
|
}
|
|
@@ -85,7 +90,30 @@ export async function pageEntries(page, removals, roomVersion, prior) {
|
|
|
85
90
|
const held = listed.asked.length === 0 ? new Map() : await prior(listed.asked);
|
|
86
91
|
return stepped(entering(page, roomVersion, listed, held));
|
|
87
92
|
}
|
|
88
|
-
|
|
93
|
+
function without(named, kept) {
|
|
94
|
+
return Object.fromEntries(Object.entries(named).filter(([path]) => !kept.has(path)));
|
|
95
|
+
}
|
|
96
|
+
function unwritten(page, kept) {
|
|
97
|
+
if (kept.size === 0)
|
|
98
|
+
return page;
|
|
99
|
+
return {
|
|
100
|
+
...page,
|
|
101
|
+
documents: without(page.documents, kept),
|
|
102
|
+
facts: without(page.facts, kept),
|
|
103
|
+
revisions: without(page.revisions, kept),
|
|
104
|
+
...(page.fileIds === undefined ? {} : { fileIds: without(page.fileIds, kept) }),
|
|
105
|
+
...(page.created === undefined ? {} : { created: without(page.created, kept) }),
|
|
106
|
+
changes: without(page.changes, kept),
|
|
107
|
+
binaryFiles: without(page.binaryFiles, kept),
|
|
108
|
+
removals: page.removals.filter((path) => !kept.has(path)),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async function pageOf(answered, roomVersion, staging) {
|
|
112
|
+
const page = unwritten(answered, await staging.later([
|
|
113
|
+
...Object.keys(answered.documents),
|
|
114
|
+
...Object.keys(answered.binaryFiles),
|
|
115
|
+
...answered.removals,
|
|
116
|
+
], roomVersion));
|
|
89
117
|
return {
|
|
90
118
|
entries: await pageEntries(page, page.removals, roomVersion, (paths) => staging.prior(paths)),
|
|
91
119
|
removals: page.removals,
|
|
@@ -101,7 +129,7 @@ export async function advancement(refresh, authorization, held, remodel, continu
|
|
|
101
129
|
return unconfirmed;
|
|
102
130
|
const first = await refresh(authorization, {
|
|
103
131
|
locator,
|
|
104
|
-
selection: held.replica.selection,
|
|
132
|
+
selection: held.declaration.replica.selection,
|
|
105
133
|
fromRoomVersion,
|
|
106
134
|
});
|
|
107
135
|
if (first.kind !== 'net-advancement')
|
|
@@ -126,7 +154,7 @@ export async function advancement(refresh, authorization, held, remodel, continu
|
|
|
126
154
|
return unconfirmed;
|
|
127
155
|
const page = await refresh(authorization, {
|
|
128
156
|
locator,
|
|
129
|
-
selection: held.replica.selection,
|
|
157
|
+
selection: held.declaration.replica.selection,
|
|
130
158
|
fromRoomVersion,
|
|
131
159
|
pageToken,
|
|
132
160
|
});
|