@agentshouse/app-bridge 0.1.0-cd3bc6240e9ba → 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 (116) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +186 -376
  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 +20 -11
  6. package/dist/mdmodel/document.d.ts +14 -8
  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 +40 -15
  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 +15 -1
  20. package/dist/mdmodel/pattern.d.ts +9 -0
  21. package/dist/mdmodel/query/language.d.ts +253 -0
  22. package/dist/mdmodel/query/match.d.ts +13 -0
  23. package/dist/mdmodel/query/rows.d.ts +31 -0
  24. package/dist/mdmodel/query/sql.d.ts +38 -0
  25. package/dist/mdmodel/references.d.ts +2 -2
  26. package/dist/mdmodel/reserved.d.ts +5 -0
  27. package/dist/mdmodel/room-types.d.ts +6 -0
  28. package/dist/mdmodel/types.d.ts +22 -17
  29. package/dist/mdmodel/validate.d.ts +12 -6
  30. package/dist/mdmodel/yaml.d.ts +4 -4
  31. package/dist/mdruntime/actions.d.ts +25 -0
  32. package/dist/mdruntime/adapter.d.ts +135 -81
  33. package/dist/mdruntime/attached-model.d.ts +6 -0
  34. package/dist/mdruntime/authored.d.ts +87 -0
  35. package/dist/mdruntime/bootstrap.d.ts +43 -0
  36. package/dist/mdruntime/cell.d.ts +5 -0
  37. package/dist/mdruntime/chain.d.ts +2 -1
  38. package/dist/mdruntime/change-set.d.ts +4 -0
  39. package/dist/mdruntime/change.d.ts +5 -0
  40. package/dist/mdruntime/client.d.ts +33 -22
  41. package/dist/mdruntime/collection.d.ts +26 -4
  42. package/dist/mdruntime/compile.d.ts +8 -6
  43. package/dist/mdruntime/conversation-live.d.ts +149 -0
  44. package/dist/mdruntime/conversation-row.d.ts +39 -0
  45. package/dist/mdruntime/conversation.d.ts +67 -46
  46. package/dist/mdruntime/declaration.d.ts +9 -0
  47. package/dist/mdruntime/durability.d.ts +20 -0
  48. package/dist/mdruntime/failure.d.ts +3 -0
  49. package/dist/mdruntime/figures.d.ts +48 -0
  50. package/dist/mdruntime/holdings.d.ts +28 -0
  51. package/dist/mdruntime/identity.d.ts +0 -1
  52. package/dist/mdruntime/install.d.ts +59 -0
  53. package/dist/mdruntime/listing.d.ts +51 -0
  54. package/dist/mdruntime/live.d.ts +24 -0
  55. package/dist/mdruntime/media.d.ts +19 -2
  56. package/dist/mdruntime/messages.d.ts +35 -5
  57. package/dist/mdruntime/model.d.ts +2 -10
  58. package/dist/mdruntime/observation.d.ts +28 -13
  59. package/dist/mdruntime/opened.d.ts +1 -1
  60. package/dist/mdruntime/outcome.d.ts +17 -2
  61. package/dist/mdruntime/overlay.d.ts +7 -2
  62. package/dist/mdruntime/preparation.d.ts +40 -0
  63. package/dist/mdruntime/presence.d.ts +57 -0
  64. package/dist/mdruntime/query.d.ts +13 -209
  65. package/dist/mdruntime/reach.d.ts +15 -14
  66. package/dist/mdruntime/readiness.d.ts +9 -6
  67. package/dist/mdruntime/reads.d.ts +38 -0
  68. package/dist/mdruntime/recovery.d.ts +3 -1
  69. package/dist/mdruntime/refresh.d.ts +26 -0
  70. package/dist/mdruntime/replica.d.ts +11 -16
  71. package/dist/mdruntime/retried.d.ts +29 -0
  72. package/dist/mdruntime/room-draft.d.ts +34 -10
  73. package/dist/mdruntime/room-drafts.d.ts +23 -0
  74. package/dist/mdruntime/runtime.d.ts +33 -0
  75. package/dist/mdruntime/save.d.ts +42 -86
  76. package/dist/mdruntime/saves.d.ts +33 -0
  77. package/dist/mdruntime/search.d.ts +12 -63
  78. package/dist/mdruntime/seed.d.ts +11 -2
  79. package/dist/mdruntime/socket/admission.d.ts +6 -0
  80. package/dist/mdruntime/socket/answers.d.ts +5 -0
  81. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  82. package/dist/mdruntime/socket/session.d.ts +37 -0
  83. package/dist/mdruntime/socket.d.ts +66 -0
  84. package/dist/mdruntime/source.d.ts +58 -0
  85. package/dist/mdruntime/status.d.ts +0 -2
  86. package/dist/mdruntime/store/installs.d.ts +29 -0
  87. package/dist/mdruntime/store/readiness.d.ts +10 -0
  88. package/dist/mdruntime/store/records.d.ts +223 -0
  89. package/dist/mdruntime/store/room-held.d.ts +7 -0
  90. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  91. package/dist/mdruntime/store/space.d.ts +10 -0
  92. package/dist/mdruntime/store/watchers.d.ts +16 -0
  93. package/dist/mdruntime/store/writes.d.ts +23 -0
  94. package/dist/mdruntime/store.d.ts +115 -144
  95. package/dist/mdruntime/stored.d.ts +72 -35
  96. package/dist/mdruntime/surface.d.ts +91 -0
  97. package/dist/mdruntime/tables.d.ts +118 -67
  98. package/dist/mdruntime/tallies.d.ts +17 -0
  99. package/dist/mdruntime/transfer.d.ts +4 -0
  100. package/dist/mdruntime/wire.d.ts +74 -7
  101. package/dist/session-content/bounds.d.ts +7 -0
  102. package/dist/session-content/check.d.ts +18 -0
  103. package/dist/session-content/index.d.ts +7 -0
  104. package/dist/session-content/parts.d.ts +103 -0
  105. package/dist/session-content/state.d.ts +61 -0
  106. package/dist/session-content/turn.d.ts +328 -0
  107. package/dist/test-host.d.ts +8 -1
  108. package/dist/test-host.js +27 -1
  109. package/docs/families.md +52 -22
  110. package/package.json +2 -2
  111. package/dist/mdmodel/blocks.d.ts +0 -10
  112. package/dist/mdmodel/condition.d.ts +0 -179
  113. package/dist/mdmodel/links.d.ts +0 -28
  114. package/dist/mdmodel/profile.d.ts +0 -5
  115. package/dist/mdruntime/connection.d.ts +0 -152
  116. package/dist/mdruntime/fulltext.d.ts +0 -26
@@ -1,154 +1,125 @@
1
- import type { BootstrapInventory, Capability, ListedConversation, Member, ProviderLimit } from './adapter.js';
1
+ import type { TypedPath } from './adapter.js';
2
+ import { schemaTypes } from './attached-model.js';
3
+ import { type Cell } from './cell.js';
2
4
  import type { ChangeBatch } from './change.js';
3
- import { type Composition } from './collection.js';
4
- import type { Plan } from './query.js';
5
- import type { ReplicaRecord } from './replica.js';
6
- import type { Submission } from './outcome.js';
7
- import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
8
- import type { ModelState, StoredModel } from './model.js';
9
- import type { SearchWindow } from './search.js';
10
- import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
11
- export type { ConversationWrite, HeldConversation, MessageWindow } from './tables.js';
12
- export type TransferRecord = {
13
- readonly locator: string;
14
- readonly transfer: string;
15
- readonly selection: string;
16
- readonly from: string;
17
- readonly last: string;
18
- readonly done: BootstrapInventory;
19
- readonly models: {
20
- readonly collection: ModelState;
21
- };
22
- readonly key: number | null;
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;
23
33
  };
24
- export type StoredReplica = Omit<ReplicaRecord, 'model'> & {
25
- readonly model: StoredModel;
34
+ export type Held = HeldReplica & {
35
+ readonly states: ReadonlyMap<string, PendingState>;
26
36
  };
27
- export type PendingState = {
28
- readonly drafts: readonly SavedDraft[];
29
- readonly submission: Submission;
30
- readonly lost: boolean;
31
- readonly upload?: unknown;
37
+ export type Work = {
38
+ readonly replica: Held | undefined;
39
+ readonly queue: readonly ChangeBatch[];
40
+ readonly states: ReadonlyMap<string, PendingState>;
32
41
  };
33
- export type TargetRecord = {
34
- established: boolean;
42
+ type HeldConflict = {
43
+ readonly revisions: Readonly<Record<string, string | undefined>>;
44
+ readonly returned: ReturnReason | null;
35
45
  };
36
- export type QueueRecord = {
37
- locator: string;
38
- pending: readonly {
39
- batch: ChangeBatch;
40
- state: PendingState;
41
- }[];
46
+ type AttachedFile = {
47
+ readonly revision: string;
48
+ readonly mediaType: string;
42
49
  };
43
- export type PresentationRecord = {
44
- app: string;
45
- value: unknown;
50
+ type Seeds = {
51
+ of(key: string): Seeded | undefined;
52
+ keep(key: string, seed: Seeded): void;
53
+ drop(key: string): void;
46
54
  };
47
- export type ChatSubmission = {
48
- readonly operation: string;
49
- readonly text: string;
50
- readonly turn: string | null;
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;
51
65
  };
52
- export type ChatDraftRecord = {
53
- conversation: string;
54
- text: string;
55
- revision: string;
56
- submitted?: readonly ChatSubmission[];
57
- moves?: 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;
58
80
  };
59
- export type CallRecord = {
60
- readonly operation: string;
61
- readonly name: string;
62
- readonly input: unknown;
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;
123
+ close(): void;
63
124
  };
64
- export type AuthoredWrite = {
65
- locator: string;
66
- queue?: readonly ChangeBatch[];
67
- founded?: readonly ChangeBatch[];
68
- saved?: ReadonlyMap<string, readonly SavedDraft[]>;
69
- roomDrafts?: readonly RoomDraftRecord[];
70
- consumedRoomDrafts?: readonly string[];
71
- };
72
- export type StagedPage = {
73
- readonly entries: readonly StoredEntry[];
74
- readonly folders: readonly string[];
75
- };
76
- export type RefreshedPage = StagedPage & {
77
- readonly removals: readonly string[];
78
- readonly folderRemovals: readonly string[];
79
- };
80
- export type Opened = {
81
- readonly rooms: ReadonlyMap<string, StoredReplica>;
82
- readonly unindexed: ReadonlySet<number>;
83
- readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
84
- readonly erasing: boolean;
85
- readonly orphans: readonly number[];
86
- readonly lastCompleted: string | null;
87
- readonly providerLimits: readonly ProviderLimit[];
88
- readonly capabilities: readonly Capability[];
89
- readonly member: Member | null;
90
- readonly targets: Readonly<Record<string, TargetRecord>>;
91
- readonly presentation: readonly PresentationRecord[];
92
- readonly conversationList: readonly ListedConversation[] | null;
93
- readonly conversationCursor: string | null;
94
- };
95
- export type Commit = {
96
- readonly rooms: readonly RoomCommit[];
97
- readonly writes?: readonly AuthoredWrite[];
98
- readonly files?: readonly StoredFile[];
99
- readonly whole?: boolean;
100
- readonly discards?: readonly string[];
101
- };
102
- export type RuntimeStore = {
103
- opened(): Promise<Opened>;
104
- counts(rooms: readonly CountedRoom[]): Promise<readonly number[]>;
105
- query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
106
- changes(keys: readonly number[]): number;
107
- entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
108
- typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
109
- referrers(key: number, view: View, targets: readonly string[], kinds: readonly string[]): Promise<readonly Referrer[]>;
110
- files(key: number, view: View, after: string | null, limit: number): Promise<readonly {
111
- readonly path: string;
112
- readonly revision: string;
113
- }[]>;
114
- folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
115
- typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
116
- search(ask: SearchAsk): Promise<SearchWindow>;
117
- stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
118
- refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
119
- unrefresh(key: number): Promise<void>;
120
- commit(commit: Commit): Promise<CommittedWrite>;
121
- fence(locators: readonly string[]): Promise<void>;
122
- erase(locator: string | null, limit: number): Promise<boolean>;
123
- abandon(locator: string): Promise<void>;
124
- release(key: number): Promise<void>;
125
- rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
126
- readonly done: boolean;
127
- readonly text: number;
128
- }>;
129
- fact(name: string, value: unknown): Promise<void>;
130
- queues(): Promise<readonly QueueRecord[]>;
131
- submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
132
- keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
133
- roomDrafts(): Promise<readonly RoomDraftRecord[]>;
134
- present(record: PresentationRecord): Promise<void>;
135
- conversations(): Promise<readonly HeldConversation[]>;
136
- keepMessages(write: ConversationWrite): Promise<void>;
137
- messageWindow(conversation: string, limit: number, before: readonly [string, string] | null): Promise<MessageWindow>;
138
- messageCount(conversation: string): Promise<number>;
139
- turnArrived(conversation: string, turn: string): Promise<boolean>;
140
- dropConversations(conversations: readonly string[]): Promise<void>;
141
- chatDrafts(): Promise<readonly ChatDraftRecord[]>;
142
- keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
143
- dropChatDraft(conversation: string): Promise<void>;
144
- calls(): Promise<readonly CallRecord[]>;
145
- keepCall(record: CallRecord): Promise<void>;
146
- dropCall(operation: string): Promise<void>;
147
- keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
148
- discardRoomDraft(locator: string, path: string): Promise<void>;
149
- fences(): Promise<readonly string[]>;
150
- generation(): Promise<string | null>;
151
- rememberGeneration(value: string): Promise<void>;
152
- file(key: string, type: string): Promise<Blob>;
153
- };
154
- export declare function openRuntimeStore(fenced: (locator: string) => boolean, authored: RuntimeDatabase): RuntimeStore;
125
+ export declare function createStore(options: StoreOptions): Store;
@@ -1,4 +1,4 @@
1
- import type { HeadChange } from './adapter.js';
1
+ import type { SavedFacts, HeadChange } from './adapter.js';
2
2
  import { type Composed, type Composition } from './collection.js';
3
3
  import type { HeldBinary } from './overlay.js';
4
4
  import type { Connection } from './tables.js';
@@ -10,8 +10,10 @@ export type StoredEntry = {
10
10
  readonly binary: HeldBinary | null;
11
11
  readonly revision: string | null;
12
12
  readonly fileId: string | null;
13
+ readonly created: string | null;
13
14
  readonly change: HeadChange | null;
14
15
  readonly written: string | null;
16
+ readonly facts: SavedFacts | null;
15
17
  };
16
18
  export type OverlayEntry = StoredEntry & {
17
19
  readonly present: boolean;
@@ -27,35 +29,56 @@ export type TypedEntry = {
27
29
  export type Referrer = {
28
30
  readonly path: string;
29
31
  readonly target: string;
30
- readonly kind: string;
31
32
  };
32
- export type HeldKey = {
33
+ export type HeldRoomRow = {
34
+ readonly locator: string;
33
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 = {
34
55
  readonly locator: string;
56
+ readonly key: number;
35
57
  readonly transfer: string;
36
- readonly rederiving: number | null;
37
- readonly searching: number | null;
58
+ readonly roomVersion: string;
59
+ readonly indexed: boolean;
60
+ readonly documents: number;
61
+ readonly bytes: number;
62
+ readonly offline: string;
38
63
  };
39
- export type ReplicaOpened = {
40
- readonly rooms: readonly {
41
- readonly locator: string;
42
- readonly key: number;
43
- readonly record: string;
44
- }[];
45
- readonly keys: readonly HeldKey[];
46
- readonly facts: Readonly<Record<string, string>>;
47
- readonly presentation: readonly {
48
- readonly app: string;
49
- readonly value: string;
50
- }[];
51
- readonly overlaid: readonly {
52
- readonly key: number;
53
- readonly path: string;
54
- }[];
55
- readonly erasing: readonly {
56
- readonly key: number;
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 {
57
72
  readonly locator: string;
73
+ readonly ids: readonly string[];
58
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;
59
82
  readonly orphans: readonly number[];
60
83
  };
61
84
  export type RoomCommit = {
@@ -78,14 +101,9 @@ export type RoomCommit = {
78
101
  };
79
102
  };
80
103
  export type Committed = {
81
- readonly counts: Readonly<Record<string, number>>;
82
104
  readonly changed: Readonly<Record<string, readonly string[] | null>>;
83
105
  readonly indexed: Readonly<Record<string, boolean>>;
84
106
  };
85
- export type CountedRoom = {
86
- readonly key: number;
87
- readonly roots: readonly string[];
88
- };
89
107
  export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
90
108
  export declare function stage(connection: Connection, request: {
91
109
  readonly locator: string;
@@ -94,7 +112,20 @@ export declare function stage(connection: Connection, request: {
94
112
  readonly fingerprint: string;
95
113
  readonly entries: readonly StoredEntry[];
96
114
  readonly folders: readonly string[];
115
+ readonly part: string | null;
97
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;
98
129
  export declare function refreshing(connection: Connection, request: {
99
130
  readonly key: number;
100
131
  readonly composed: Composed;
@@ -104,7 +135,6 @@ export declare function refreshing(connection: Connection, request: {
104
135
  readonly folderRemovals: readonly string[];
105
136
  }): null;
106
137
  export declare function unrefresh(connection: Connection, key: number): null;
107
- export declare function counts(connection: Connection, rooms: readonly CountedRoom[]): number[];
108
138
  export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
109
139
  export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
110
140
  export declare function abandon(connection: Connection, locator: string): null;
@@ -118,12 +148,19 @@ export declare function rederive(connection: Connection, key: number, composed:
118
148
  };
119
149
  export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
120
150
  export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
121
- export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[], kinds: readonly string[]): Referrer[];
122
- export declare function files(connection: Connection, key: number, view: View, after: string | null, limit: number): {
123
- readonly path: string;
124
- readonly revision: string;
125
- }[];
126
- export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
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[];
127
153
  export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
128
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[];
129
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;