@agentshouse/app-bridge 0.1.0-cd2f88c8097d7 → 0.1.0-cd44fa24fb809

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.
Files changed (123) hide show
  1. package/README.md +11 -11
  2. package/dist/index.d.ts +626 -21
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/built-in.d.ts +3 -0
  5. package/dist/mdmodel/definition.d.ts +22 -11
  6. package/dist/mdmodel/document.d.ts +15 -9
  7. package/dist/mdmodel/event.d.ts +76 -0
  8. package/dist/mdmodel/facts.d.ts +14 -0
  9. package/dist/mdmodel/fields.d.ts +1 -1
  10. package/dist/mdmodel/house-model.d.ts +869 -0
  11. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  12. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  13. package/dist/mdmodel/index.d.ts +41 -14
  14. package/dist/mdmodel/kinds.d.ts +17 -0
  15. package/dist/mdmodel/markdown.d.ts +74 -0
  16. package/dist/mdmodel/media-type.d.ts +71 -0
  17. package/dist/mdmodel/moment.d.ts +6 -0
  18. package/dist/mdmodel/not-ready.d.ts +1 -0
  19. package/dist/mdmodel/paths.d.ts +24 -2
  20. package/dist/mdmodel/pattern.d.ts +9 -0
  21. package/dist/mdmodel/project.d.ts +1 -0
  22. package/dist/mdmodel/query/language.d.ts +253 -0
  23. package/dist/mdmodel/query/match.d.ts +13 -0
  24. package/dist/mdmodel/query/rows.d.ts +31 -0
  25. package/dist/mdmodel/query/sql.d.ts +38 -0
  26. package/dist/mdmodel/references.d.ts +2 -2
  27. package/dist/mdmodel/reserved.d.ts +5 -0
  28. package/dist/mdmodel/room-types.d.ts +6 -0
  29. package/dist/mdmodel/types.d.ts +44 -15
  30. package/dist/mdmodel/validate.d.ts +34 -4
  31. package/dist/mdmodel/yaml.d.ts +4 -4
  32. package/dist/mdruntime/actions.d.ts +25 -0
  33. package/dist/mdruntime/adapter.d.ts +216 -123
  34. package/dist/mdruntime/attached-model.d.ts +6 -0
  35. package/dist/mdruntime/authored.d.ts +87 -0
  36. package/dist/mdruntime/binary.d.ts +0 -5
  37. package/dist/mdruntime/bootstrap.d.ts +43 -0
  38. package/dist/mdruntime/cell.d.ts +5 -0
  39. package/dist/mdruntime/chain.d.ts +11 -0
  40. package/dist/mdruntime/change-set.d.ts +13 -16
  41. package/dist/mdruntime/change.d.ts +36 -1
  42. package/dist/mdruntime/client.d.ts +41 -25
  43. package/dist/mdruntime/collection.d.ts +32 -21
  44. package/dist/mdruntime/compile.d.ts +17 -0
  45. package/dist/mdruntime/conversation-live.d.ts +149 -0
  46. package/dist/mdruntime/conversation-row.d.ts +39 -0
  47. package/dist/mdruntime/conversation.d.ts +84 -50
  48. package/dist/mdruntime/declaration.d.ts +9 -0
  49. package/dist/mdruntime/durability.d.ts +21 -4
  50. package/dist/mdruntime/failure.d.ts +3 -0
  51. package/dist/mdruntime/figures.d.ts +48 -0
  52. package/dist/mdruntime/holdings.d.ts +28 -0
  53. package/dist/mdruntime/identity.d.ts +5 -0
  54. package/dist/mdruntime/install.d.ts +59 -0
  55. package/dist/mdruntime/listing.d.ts +51 -0
  56. package/dist/mdruntime/live.d.ts +24 -0
  57. package/dist/mdruntime/media.d.ts +24 -0
  58. package/dist/mdruntime/messages.d.ts +57 -0
  59. package/dist/mdruntime/model.d.ts +8 -11
  60. package/dist/mdruntime/observation.d.ts +40 -10
  61. package/dist/mdruntime/opened.d.ts +21 -0
  62. package/dist/mdruntime/outcome.d.ts +57 -10
  63. package/dist/mdruntime/overlay.d.ts +8 -6
  64. package/dist/mdruntime/preparation.d.ts +40 -0
  65. package/dist/mdruntime/presence.d.ts +57 -0
  66. package/dist/mdruntime/query.d.ts +25 -191
  67. package/dist/mdruntime/reach.d.ts +21 -11
  68. package/dist/mdruntime/readiness.d.ts +22 -20
  69. package/dist/mdruntime/reads.d.ts +38 -0
  70. package/dist/mdruntime/recovery.d.ts +5 -2
  71. package/dist/mdruntime/refresh.d.ts +26 -0
  72. package/dist/mdruntime/replica.d.ts +50 -33
  73. package/dist/mdruntime/retried.d.ts +29 -0
  74. package/dist/mdruntime/room-draft.d.ts +55 -13
  75. package/dist/mdruntime/room-drafts.d.ts +23 -0
  76. package/dist/mdruntime/runtime.d.ts +33 -0
  77. package/dist/mdruntime/save.d.ts +43 -48
  78. package/dist/mdruntime/saves.d.ts +33 -0
  79. package/dist/mdruntime/search.d.ts +12 -82
  80. package/dist/mdruntime/seed.d.ts +11 -2
  81. package/dist/mdruntime/socket/admission.d.ts +6 -0
  82. package/dist/mdruntime/socket/answers.d.ts +5 -0
  83. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  84. package/dist/mdruntime/socket/session.d.ts +37 -0
  85. package/dist/mdruntime/socket.d.ts +66 -0
  86. package/dist/mdruntime/source.d.ts +58 -0
  87. package/dist/mdruntime/status.d.ts +4 -5
  88. package/dist/mdruntime/store/installs.d.ts +29 -0
  89. package/dist/mdruntime/store/readiness.d.ts +10 -0
  90. package/dist/mdruntime/store/records.d.ts +223 -0
  91. package/dist/mdruntime/store/room-held.d.ts +7 -0
  92. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  93. package/dist/mdruntime/store/space.d.ts +10 -0
  94. package/dist/mdruntime/store/watchers.d.ts +16 -0
  95. package/dist/mdruntime/store/writes.d.ts +23 -0
  96. package/dist/mdruntime/store.d.ts +114 -157
  97. package/dist/mdruntime/stored.d.ts +166 -0
  98. package/dist/mdruntime/surface.d.ts +91 -0
  99. package/dist/mdruntime/tables.d.ts +375 -0
  100. package/dist/mdruntime/tallies.d.ts +17 -0
  101. package/dist/mdruntime/transfer.d.ts +0 -5
  102. package/dist/mdruntime/wire.d.ts +96 -9
  103. package/dist/session-content/bounds.d.ts +7 -0
  104. package/dist/session-content/check.d.ts +18 -0
  105. package/dist/session-content/index.d.ts +7 -0
  106. package/dist/session-content/parts.d.ts +103 -0
  107. package/dist/session-content/state.d.ts +61 -0
  108. package/dist/session-content/turn.d.ts +328 -0
  109. package/dist/test-host.d.ts +14 -4
  110. package/dist/test-host.js +45 -29
  111. package/docs/families.md +90 -59
  112. package/package.json +8 -3
  113. package/dist/calls.d.ts +0 -118
  114. package/dist/calls.js +0 -1
  115. package/dist/mdmodel/blocks.d.ts +0 -10
  116. package/dist/mdmodel/condition.d.ts +0 -149
  117. package/dist/mdmodel/profile.d.ts +0 -5
  118. package/dist/mdruntime/acquisition.d.ts +0 -13
  119. package/dist/mdruntime/connection.d.ts +0 -143
  120. package/dist/mdruntime/file.d.ts +0 -19
  121. package/dist/mdruntime/rows.d.ts +0 -37
  122. package/dist/mdruntime/shared.d.ts +0 -10
  123. package/dist/mdruntime/turn.d.ts +0 -6
@@ -0,0 +1,23 @@
1
+ import type { Composition } from '../collection.js';
2
+ import type { RefreshedPage, RuntimeStore } from './records.js';
3
+ export type InstallHold = {
4
+ take(): void;
5
+ release(): void;
6
+ };
7
+ type Writes = {
8
+ exclusive<T>(work: () => Promise<T>): Promise<T>;
9
+ gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
10
+ written(): Promise<unknown>;
11
+ startingWrite<T>(work: () => Promise<T>): Promise<T>;
12
+ finishingWrite<T>(work: () => Promise<T>): Promise<T>;
13
+ ahead<T>(work: (hold: InstallHold) => Promise<T>): Promise<T>;
14
+ rederive(local: RuntimeStore, key: number, composition: Composition): Promise<{
15
+ readonly done: boolean;
16
+ readonly text: number;
17
+ }>;
18
+ refreshPage(local: RuntimeStore, key: number, composition: Composition, page: RefreshedPage): Promise<void>;
19
+ stageBytes(): number;
20
+ deriveBytes(): number;
21
+ };
22
+ export declare function createWrites(): Writes;
23
+ export {};
@@ -1,168 +1,125 @@
1
- import type { ModelState } from './model.js';
2
- import type { Capability, HeadChange, Member, OperationScopes, ProviderLimit, ReplicaAdmission, TypedSelection } from './adapter.js';
3
- import type { AcceptedMessage, KeptReceipt } from './adapter.js';
1
+ import type { TypedPath } from './adapter.js';
2
+ import { schemaTypes } from './attached-model.js';
3
+ import { type Cell } from './cell.js';
4
4
  import type { ChangeBatch } from './change.js';
5
- import { type HeldBinary } from './overlay.js';
6
- import type { ChatDraftFile } from './file.js';
7
- import type { Submission } from './outcome.js';
8
- import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
9
- export declare const STORE_SCHEMA = 25;
10
- export declare const AUTHORED_SCHEMA = 3;
11
- export type ReplicaRecord = {
12
- locator: string;
13
- name: string;
14
- handle: string;
15
- operations: OperationScopes;
16
- replica: ReplicaAdmission;
17
- model: ModelState;
18
- typedSelection: TypedSelection | null;
19
- selectionModel: ModelState;
20
- providerOwnedPaths: readonly string[];
21
- roomVersion: string;
22
- transfer: string;
23
- documents: Readonly<Record<string, string>>;
24
- binaries: Readonly<Record<string, HeldBinary>>;
25
- revisions: Readonly<Record<string, string>>;
26
- fileIds: Readonly<Record<string, string>>;
27
- changes: Readonly<Record<string, HeadChange>>;
28
- written: Readonly<Record<string, string>>;
29
- };
30
- export type StagedLayer = Pick<ReplicaRecord, 'documents' | 'binaries' | 'revisions' | 'fileIds' | 'changes' | 'written'>;
31
- export type TransferRecord = {
32
- locator: string;
33
- transfer: string;
34
- selection: string;
35
- from: string;
36
- last: string;
37
- pageToken: string | null;
38
- models: {
39
- collection: ModelState;
40
- selection: ModelState;
41
- };
42
- };
43
- export type PendingState = {
44
- readonly drafts: readonly SavedDraft[];
45
- readonly submission: Submission;
46
- readonly lost: boolean;
47
- readonly upload?: unknown;
48
- readonly accepted?: string;
49
- };
50
- export type TargetRecord = {
51
- established: boolean;
52
- };
53
- export type QueueRecord = {
54
- locator: string;
55
- pending: readonly {
56
- batch: ChangeBatch;
57
- state: PendingState;
58
- }[];
59
- };
60
- export type PresentationRecord = {
61
- app: string;
62
- value: unknown;
5
+ import type { ChangeSet } from './change-set.js';
6
+ import type { Composition } from './collection.js';
7
+ import type { ReadinessShowing, ReadinessWatch } from './preparation.js';
8
+ import type { Persistence } from './readiness.js';
9
+ import type { Retries } from './retried.js';
10
+ import type { Seeded } from './seed.js';
11
+ import type { ModelState } from './model.js';
12
+ import { type OpenedFiles } from './opened.js';
13
+ import { type HeldReplica, type ReplicaRecord } from './replica.js';
14
+ import type { ReturnReason, RoomDraftRecord } from './room-draft.js';
15
+ import { type SyncStatus } from './status.js';
16
+ import type { RuntimeDatabase } from './tables.js';
17
+ import { type Installs } from './store/installs.js';
18
+ import { type HeldCover, type HeldStatus, type PendingState, type RuntimeStore } from './store/records.js';
19
+ import { type ReadinessQueue } from './store/readiness.js';
20
+ import { type RoomHeld } from './store/room-held.js';
21
+ import { type RoomsShown } from './store/rooms-shown.js';
22
+ import { type Space } from './store/space.js';
23
+ import { type Watcher, type Watching } from './store/watchers.js';
24
+ import { createWrites, type InstallHold } from './store/writes.js';
25
+ export type { RoomInstall } from './store/installs.js';
26
+ export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, ConversationFact, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
27
+ export type { InstallHold } from './store/writes.js';
28
+ export type { CommittedWrite, QueryRoom, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, View, } from './tables.js';
29
+ export type Stored = {
30
+ readonly record: ReplicaRecord;
31
+ readonly indexed: boolean;
32
+ readonly documents: number;
63
33
  };
64
- export type HeldConversation = {
65
- conversation: string;
66
- read: string | null | undefined;
67
- partial: boolean;
34
+ export type Held = HeldReplica & {
35
+ readonly states: ReadonlyMap<string, PendingState>;
68
36
  };
69
- export type ConversationWrite = {
70
- conversation: string;
71
- messages: readonly AcceptedMessage[];
72
- read?: {
73
- at: string | null;
74
- partial: boolean;
75
- };
37
+ export type Work = {
38
+ readonly replica: Held | undefined;
39
+ readonly queue: readonly ChangeBatch[];
40
+ readonly states: ReadonlyMap<string, PendingState>;
76
41
  };
77
- export type ChatSubmission = {
78
- readonly operation: string;
79
- readonly text: string;
80
- readonly files: readonly ChatDraftFile[];
81
- readonly turn: string | null;
42
+ type HeldConflict = {
43
+ readonly revisions: Readonly<Record<string, string | undefined>>;
44
+ readonly returned: ReturnReason | null;
82
45
  };
83
- export type ChatDraftRecord = {
84
- conversation: string;
85
- text: string;
86
- files: readonly ChatDraftFile[];
87
- revision: string;
88
- submitted?: readonly ChatSubmission[];
89
- moves?: readonly string[];
46
+ type AttachedFile = {
47
+ readonly revision: string;
48
+ readonly mediaType: string;
90
49
  };
91
- export type CallRecord = {
92
- readonly operation: string;
93
- readonly name: string;
94
- readonly input: unknown;
50
+ type Seeds = {
51
+ of(key: string): Seeded | undefined;
52
+ keep(key: string, seed: Seeded): void;
53
+ drop(key: string): void;
95
54
  };
96
- export type RecordWrite = {
97
- next: ReplicaRecord;
98
- previous: ReplicaRecord | null;
99
- stored?: StagedLayer;
55
+ type Device = {
56
+ readonly persistence: Persistence;
57
+ readonly storageLoss: string | null;
58
+ readonly heldWhenOpened: boolean;
59
+ readonly preparing: boolean;
60
+ readonly sweeping: boolean;
61
+ readonly unpreparedDemand: ReadonlySet<string>;
62
+ readonly unpreparable: ReadonlySet<string>;
63
+ readonly establishing: ReadonlySet<string>;
64
+ readonly status: SyncStatus;
100
65
  };
101
- export type AuthoredWrite = {
102
- locator: string;
103
- queue: readonly ChangeBatch[];
104
- saved?: ReadonlyMap<string, readonly SavedDraft[]>;
105
- roomDrafts?: readonly RoomDraftRecord[];
106
- consumedRoomDrafts?: readonly string[];
66
+ type StoreOptions = {
67
+ readonly database: RuntimeDatabase;
68
+ readonly roomTypes: Parameters<typeof schemaTypes>[1];
69
+ readonly builtIn: ModelState;
70
+ readonly typedPaths: readonly TypedPath[];
71
+ readonly persistence: Persistence;
72
+ readonly retries: Retries;
73
+ lost(locator: string): boolean;
74
+ losing(): boolean;
75
+ opening(records: RuntimeStore): Promise<RuntimeStore>;
76
+ unpublished(error: unknown): void;
77
+ changed(set: ChangeSet): Promise<void>;
78
+ deliverReadiness(owed: readonly ReadinessWatch[], rooms: ReadonlySet<string> | null): Promise<void>;
79
+ spaceFreed(): void;
107
80
  };
108
- export type RuntimeStore = {
109
- all(): Promise<readonly ReplicaRecord[]>;
110
- keepAuthored(input: AuthoredWrite): Promise<void>;
111
- write(input: RecordWrite): Promise<void>;
112
- revokeModels(records: readonly ReplicaRecord[]): Promise<void>;
113
- lastCompleted(): Promise<string | null>;
114
- complete(at: string): Promise<void>;
115
- providerLimits(): Promise<readonly ProviderLimit[]>;
116
- capabilities(): Promise<readonly Capability[]>;
117
- declare(limits: readonly ProviderLimit[], capabilities: readonly Capability[]): Promise<void>;
118
- member(): Promise<Member | null>;
119
- keepMember(member: Member | null): Promise<void>;
120
- targets(): Promise<Readonly<Record<string, TargetRecord>>>;
121
- keepTargets(targets: Readonly<Record<string, TargetRecord>>): Promise<void>;
122
- queues(): Promise<readonly QueueRecord[]>;
123
- submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
124
- accept(locator: string, id: string, roomVersion: string): Promise<void>;
125
- keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
126
- roomDrafts(): Promise<readonly RoomDraftRecord[]>;
127
- presentation(): Promise<readonly PresentationRecord[]>;
128
- present(record: PresentationRecord): Promise<void>;
129
- conversations(): Promise<readonly HeldConversation[]>;
130
- keepMessages(write: ConversationWrite): Promise<void>;
131
- messageWindow(conversation: string, limit: number | undefined): Promise<AcceptedMessage[]>;
132
- messagesAfter(conversation: string, identity: string | null): Promise<AcceptedMessage[]>;
133
- messageIdentities(conversation: string): Promise<readonly string[]>;
134
- turnArrived(conversation: string, turn: string): Promise<boolean>;
135
- dropConversations(conversations: readonly string[]): Promise<void>;
136
- chatDrafts(): Promise<readonly ChatDraftRecord[]>;
137
- keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
138
- dropChatDraft(conversation: string): Promise<void>;
139
- calls(): Promise<readonly CallRecord[]>;
140
- keepCall(record: CallRecord): Promise<void>;
141
- dropCall(operation: string): Promise<void>;
142
- keepRoomDraft(record: RoomDraftRecord): Promise<void>;
143
- discardRoomDraft(locator: string, path: string): Promise<void>;
144
- fences(): Promise<readonly string[]>;
145
- erase(locators: readonly string[]): Promise<void>;
146
- discard(locator: string): Promise<void>;
147
- transfers(): Promise<readonly TransferRecord[]>;
148
- staged(record: TransferRecord): Promise<StagedLayer>;
149
- stage(record: TransferRecord, page: StagedLayer): Promise<void>;
150
- abandon(locator: string): Promise<void>;
151
- receivedHeads(): Promise<readonly KeptReceipt[]>;
152
- receivedParts(key: string, count: number): Promise<readonly unknown[]>;
153
- keepReceived(key: string, head: unknown, part?: {
154
- index: number;
155
- value: unknown;
156
- }): Promise<void>;
157
- dropReceived(keys: readonly string[]): Promise<void>;
158
- generation(): Promise<string | null>;
159
- rememberGeneration(value: string): Promise<void>;
81
+ export type Store = {
82
+ readonly device: Cell<Device>;
83
+ readonly roomsShown: RoomsShown;
84
+ readonly space: Space;
85
+ readonly readiness: ReadinessQueue<ReadinessWatch, ReadinessShowing>;
86
+ ask: RuntimeDatabase['ask'];
87
+ changed(set: ChangeSet): Promise<void>;
88
+ open(): Promise<RuntimeStore>;
89
+ durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
90
+ exclusive<T>(work: () => Promise<T>): Promise<T>;
91
+ gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
92
+ written(): Promise<unknown>;
93
+ startingWrite<T>(work: () => Promise<T>): Promise<T>;
94
+ finishingWrite<T>(work: () => Promise<T>): Promise<T>;
95
+ ahead<T>(work: (hold: InstallHold) => Promise<T>): Promise<T>;
96
+ rederive: ReturnType<typeof createWrites>['rederive'];
97
+ refreshPage: ReturnType<typeof createWrites>['refreshPage'];
98
+ stageBytes(): number;
99
+ deriveBytes(): number;
100
+ rooms(locators?: readonly string[]): Promise<ReadonlyMap<string, Stored>>;
101
+ record(locator: string): Promise<ReplicaRecord | undefined>;
102
+ work(locator: string): Promise<Work>;
103
+ replica(locator: string): Promise<Held | undefined>;
104
+ covering(): Promise<HeldCover>;
105
+ status(): Promise<HeldStatus>;
106
+ queued(): Promise<readonly string[]>;
107
+ drafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
108
+ draft(locator: string, path: string): Promise<RoomDraftRecord | undefined>;
109
+ composed(record: Pick<ReplicaRecord, 'model' | 'declaration'>): Composition;
110
+ publication(work: () => Promise<void>): Promise<void>;
111
+ owing<T>(topic: string, add: (owed: T | undefined) => T, work: (owed: T) => Promise<void>): Promise<void>;
112
+ watch(topic: string, notify: (value: unknown) => void): Watcher;
113
+ watching(topic: string, which?: Watching): readonly Watcher[];
114
+ tell(topic: string, value: unknown): void;
115
+ readonly installs: Installs;
116
+ readonly seeds: Seeds;
117
+ readonly conflicted: RoomHeld<HeldConflict>;
118
+ readonly attached: RoomHeld<AttachedFile>;
119
+ readonly opened: OpenedFiles;
120
+ part(file: string, part: number): Promise<Uint8Array | null>;
121
+ prepareAgain(locator?: string): void;
122
+ forget(locator: string): void;
160
123
  close(): void;
161
124
  };
162
- export declare function authoredHolder(): Promise<string | null>;
163
- export declare function authoredBy(holder: string): Promise<boolean>;
164
- export declare function authoredBinding(): Promise<string | null>;
165
- export declare function bindAuthored(binding: string): Promise<void>;
166
- export declare function removeRuntimeStore(holder?: string): Promise<boolean>;
167
- export declare function openDatabase(name: string, version: number, upgrade: (opening: IDBOpenDBRequest, oldVersion: number) => void): Promise<IDBDatabase>;
168
- export declare function openRuntimeStore(fenced: (locator: string) => boolean): Promise<RuntimeStore>;
125
+ export declare function createStore(options: StoreOptions): Store;
@@ -0,0 +1,166 @@
1
+ import type { SavedFacts, HeadChange } from './adapter.js';
2
+ import { type Composed, type Composition } from './collection.js';
3
+ import type { HeldBinary } from './overlay.js';
4
+ import type { Connection } from './tables.js';
5
+ export declare const REPLICA_TABLES: readonly string[];
6
+ export type View = 'confirmed' | 'visible' | 'refreshed';
7
+ export type StoredEntry = {
8
+ readonly path: string;
9
+ readonly content: string | null;
10
+ readonly binary: HeldBinary | null;
11
+ readonly revision: string | null;
12
+ readonly fileId: string | null;
13
+ readonly created: string | null;
14
+ readonly change: HeadChange | null;
15
+ readonly written: string | null;
16
+ readonly facts: SavedFacts | null;
17
+ };
18
+ export type OverlayEntry = StoredEntry & {
19
+ readonly present: boolean;
20
+ };
21
+ export type HeldEntry = StoredEntry & {
22
+ readonly type: string | null;
23
+ };
24
+ export type TypedEntry = {
25
+ readonly path: string;
26
+ readonly type: string | null;
27
+ readonly binary: boolean;
28
+ };
29
+ export type Referrer = {
30
+ readonly path: string;
31
+ readonly target: string;
32
+ };
33
+ export type HeldRoomRow = {
34
+ readonly locator: string;
35
+ readonly key: number;
36
+ readonly record: string;
37
+ readonly indexed: boolean;
38
+ readonly documents: number;
39
+ };
40
+ export type HeldRoomWork = {
41
+ readonly room: (HeldRoomRow & {
42
+ readonly overlaid: readonly string[];
43
+ }) | null;
44
+ readonly queue: readonly {
45
+ readonly id: string;
46
+ readonly batch: string;
47
+ readonly state: string;
48
+ }[];
49
+ };
50
+ export type CoverLog = {
51
+ readonly token: string;
52
+ readonly at: number;
53
+ };
54
+ export type CoveredRow = {
55
+ readonly locator: string;
56
+ readonly key: number;
57
+ readonly transfer: string;
58
+ readonly roomVersion: string;
59
+ readonly indexed: boolean;
60
+ readonly documents: number;
61
+ readonly bytes: number;
62
+ readonly offline: string;
63
+ };
64
+ export type CoveredRooms = {
65
+ readonly log: CoverLog;
66
+ readonly whole: boolean;
67
+ readonly rooms: readonly CoveredRow[];
68
+ readonly removed: readonly string[];
69
+ };
70
+ export type Covering = CoveredRooms & {
71
+ readonly queues: readonly {
72
+ readonly locator: string;
73
+ readonly ids: readonly string[];
74
+ }[];
75
+ };
76
+ export type HeldLocators = {
77
+ readonly held: readonly string[];
78
+ readonly staged: readonly string[];
79
+ };
80
+ export type ReplicaOpened = {
81
+ readonly erasing: boolean;
82
+ readonly orphans: readonly number[];
83
+ };
84
+ export type RoomCommit = {
85
+ readonly locator: string;
86
+ readonly key: number;
87
+ readonly record?: string;
88
+ readonly roots?: readonly string[];
89
+ readonly published?: {
90
+ readonly from: number | null;
91
+ };
92
+ readonly refreshed?: true;
93
+ readonly composed: Composed;
94
+ readonly confirmed?: {
95
+ readonly set: readonly StoredEntry[];
96
+ readonly removed: readonly string[];
97
+ };
98
+ readonly overlay?: {
99
+ readonly set: readonly OverlayEntry[];
100
+ readonly cleared: readonly string[];
101
+ };
102
+ };
103
+ export type Committed = {
104
+ readonly changed: Readonly<Record<string, readonly string[] | null>>;
105
+ readonly indexed: Readonly<Record<string, boolean>>;
106
+ };
107
+ export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
108
+ export declare function stage(connection: Connection, request: {
109
+ readonly locator: string;
110
+ readonly transfer: string;
111
+ readonly key: number | null;
112
+ readonly fingerprint: string;
113
+ readonly entries: readonly StoredEntry[];
114
+ readonly folders: readonly string[];
115
+ readonly part: string | null;
116
+ }): number;
117
+ export type Resumed = {
118
+ readonly key: number | null;
119
+ readonly transfer: string;
120
+ readonly staged: readonly string[];
121
+ };
122
+ export declare function resume(connection: Connection, request: {
123
+ readonly locator: string;
124
+ readonly transfer: string;
125
+ readonly fingerprint: string;
126
+ readonly parts: readonly string[];
127
+ readonly published: number | null;
128
+ }): Resumed;
129
+ export declare function refreshing(connection: Connection, request: {
130
+ readonly key: number;
131
+ readonly composed: Composed;
132
+ readonly entries: readonly StoredEntry[];
133
+ readonly removals: readonly string[];
134
+ readonly folders: readonly string[];
135
+ readonly folderRemovals: readonly string[];
136
+ }): null;
137
+ export declare function unrefresh(connection: Connection, key: number): null;
138
+ export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
139
+ export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
140
+ export declare function abandon(connection: Connection, locator: string): null;
141
+ export declare function release(connection: Connection, key: number): null;
142
+ export declare function erase(connection: Connection, locator: string | null, limit: number): {
143
+ readonly remaining: boolean;
144
+ };
145
+ export declare function rederive(connection: Connection, key: number, composed: Composed, bytes: number, ms: number, floor: number): {
146
+ readonly done: boolean;
147
+ readonly text: number;
148
+ };
149
+ export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
150
+ export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
151
+ export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[]): Referrer[];
152
+ export declare function folders(connection: Connection, key: number, list: readonly string[]): string[];
153
+ export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
154
+ export declare function opened(connection: Connection): ReplicaOpened;
155
+ export declare function heldRooms(connection: Connection, locators: readonly string[] | null): readonly HeldRoomRow[];
156
+ export declare function heldRoom(connection: Connection, locator: string): HeldRoomRow | null;
157
+ export declare function overlaid(connection: Connection, key: number): readonly string[];
158
+ export declare function covering(connection: Connection, since: CoverLog | null): CoveredRooms;
159
+ export declare function offlineMode(connection: Connection, locator: string): string | null;
160
+ export declare function stagedLocators(connection: Connection): readonly string[];
161
+ export declare function heldLocators(connection: Connection): readonly string[];
162
+ export declare function demoted(connection: Connection): null;
163
+ export declare function facts(connection: Connection, names: readonly string[] | null): Readonly<Record<string, string>>;
164
+ export declare function presentation(connection: Connection, app: string): string | null;
165
+ export declare function tablesOf(statements: readonly string[]): readonly string[];
166
+ export declare function ended(connection: Connection): void;
@@ -0,0 +1,91 @@
1
+ import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
2
+ import { type HistoryQuery } from './actions.js';
3
+ import type { ListedAgent, Member, RoomList, ServiceMode } from './adapter.js';
4
+ import type { WrittenBy } from './change.js';
5
+ import { type ChatDraftSurface, type ConversationEntry, type ConversationAgent, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
6
+ import { type UnsentWork } from './durability.js';
7
+ import type { FiguresResult } from './figures.js';
8
+ import { type Holdings } from './holdings.js';
9
+ import { type AppRoom } from './listing.js';
10
+ import { type TypesResult } from './model.js';
11
+ import { type Observation } from './observation.js';
12
+ import type { HistoryAnswer, QueueEntry, Resolution, CallResult } from './outcome.js';
13
+ import { type ReadinessPort } from './preparation.js';
14
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
15
+ import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
16
+ import type { Persistence, Readiness } from './readiness.js';
17
+ import type { ObservedRead } from './reads.js';
18
+ import type { RoomDraft } from './room-draft.js';
19
+ import { type PresentationSurface, type RoomDraftSurface } from './room-drafts.js';
20
+ import type { Runtime } from './runtime.js';
21
+ import { type BinaryFileSurface, type SavedParts, type SavedRoomDraft, type SaveResult } from './saves.js';
22
+ import type { SearchRequest, SearchResult } from './search.js';
23
+ import { type EntrySeed } from './seed.js';
24
+ import type { ConnectionRefusal } from './socket.js';
25
+ import type { SyncStatus } from './status.js';
26
+ export type RoomSchemas = {
27
+ collection: TypesResult;
28
+ typedSelection: TypesResult | null;
29
+ };
30
+ export type MdRuntime = {
31
+ loaded(): Promise<void>;
32
+ rooms(): Promise<readonly AppRoom[]>;
33
+ query: {
34
+ (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
35
+ (query: GroupQuery): Promise<GroupResult | PendingResult>;
36
+ };
37
+ search(request: SearchRequest): Promise<SearchResult>;
38
+ types(locator: string): Promise<RoomSchemas>;
39
+ roomDraft: RoomDraftSurface;
40
+ conversation: ConversationSurface;
41
+ chatDraft: ChatDraftSurface;
42
+ presentation: PresentationSurface;
43
+ save(room: string, roomDrafts: readonly SavedRoomDraft[], writtenBy?: WrittenBy): Promise<SaveResult>;
44
+ saveParts(room: string, parts: readonly SavedParts[], writtenBy?: WrittenBy): Promise<SaveResult>;
45
+ history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
46
+ resolve(room: string, path: string, destination: string): Promise<Resolution>;
47
+ binaryFile: BinaryFileSurface;
48
+ call(name: string, input: unknown): Promise<CallResult>;
49
+ answered(operation: string): Promise<boolean>;
50
+ reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
51
+ persistence(): boolean;
52
+ retry(): Promise<void>;
53
+ cleanUp(): Promise<number>;
54
+ unsent(): Promise<readonly UnsentWork[]>;
55
+ sent(): Promise<void>;
56
+ reset(): Promise<void>;
57
+ readAgain(): Promise<void>;
58
+ observe: {
59
+ (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
60
+ (topic: 'readiness'): Promise<Observation<Readiness>>;
61
+ (topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
62
+ (topic: 'storage-loss'): Promise<Observation<string | null>>;
63
+ (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
64
+ (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
65
+ (topic: 'member'): Promise<Observation<Member | null>>;
66
+ (topic: 'time-zone'): Promise<Observation<string | null>>;
67
+ (topic: 'authority-changes'): Promise<Observation<number>>;
68
+ (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
69
+ (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
70
+ (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
71
+ (topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
72
+ (topic: 'presentation', app: string): Promise<Observation<unknown>>;
73
+ (topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
74
+ (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
75
+ (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
76
+ (topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
77
+ (topic: 'room-list'): Promise<Observation<RoomList | null>>;
78
+ (topic: 'figures'): Promise<Observation<FiguresResult>>;
79
+ (topic: 'holdings'): Promise<Observation<Holdings>>;
80
+ (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
81
+ };
82
+ reauthorize(): Promise<void>;
83
+ };
84
+ 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';
85
+ export type ComposedRuntime = RuntimeView & {
86
+ seed(entry: EntrySeed): void;
87
+ stop(): Promise<void>;
88
+ persisted(answer: Persistence): void;
89
+ within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
90
+ };
91
+ export declare function composedRuntime(runtime: Runtime): ComposedRuntime;