@agentshouse/app-bridge 0.1.0-c8d97d63f2350 → 0.1.0-c8dd3de04bf64

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 (89) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +196 -132
  3. package/dist/mdmodel/definition.d.ts +1 -1
  4. package/dist/mdmodel/document.d.ts +2 -1
  5. package/dist/mdmodel/event.d.ts +77 -0
  6. package/dist/mdmodel/facts.d.ts +14 -0
  7. package/dist/mdmodel/index.d.ts +19 -7
  8. package/dist/mdmodel/kinds.d.ts +17 -0
  9. package/dist/mdmodel/pattern.d.ts +9 -0
  10. package/dist/mdmodel/query/language.d.ts +253 -0
  11. package/dist/mdmodel/query/match.d.ts +13 -0
  12. package/dist/mdmodel/query/rows.d.ts +31 -0
  13. package/dist/mdmodel/query/sql.d.ts +38 -0
  14. package/dist/mdmodel/reserved.d.ts +5 -0
  15. package/dist/mdmodel/types.d.ts +11 -0
  16. package/dist/mdmodel/validate.d.ts +7 -5
  17. package/dist/mdruntime/actions.d.ts +19 -0
  18. package/dist/mdruntime/adapter.d.ts +45 -25
  19. package/dist/mdruntime/attached-model.d.ts +7 -0
  20. package/dist/mdruntime/bootstrap.d.ts +43 -0
  21. package/dist/mdruntime/cell.d.ts +5 -0
  22. package/dist/mdruntime/chain.d.ts +2 -1
  23. package/dist/mdruntime/change.d.ts +1 -0
  24. package/dist/mdruntime/client.d.ts +23 -5
  25. package/dist/mdruntime/collection.d.ts +2 -1
  26. package/dist/mdruntime/compile.d.ts +6 -6
  27. package/dist/mdruntime/conversation-live.d.ts +135 -0
  28. package/dist/mdruntime/conversation-row.d.ts +32 -0
  29. package/dist/mdruntime/conversation.d.ts +34 -38
  30. package/dist/mdruntime/durability.d.ts +15 -0
  31. package/dist/mdruntime/figures.d.ts +48 -0
  32. package/dist/mdruntime/holdings.d.ts +28 -0
  33. package/dist/mdruntime/identity.d.ts +0 -1
  34. package/dist/mdruntime/install.d.ts +55 -0
  35. package/dist/mdruntime/job.d.ts +32 -0
  36. package/dist/mdruntime/listing.d.ts +52 -0
  37. package/dist/mdruntime/live.d.ts +22 -0
  38. package/dist/mdruntime/log.d.ts +5 -0
  39. package/dist/mdruntime/media.d.ts +1 -1
  40. package/dist/mdruntime/messages.d.ts +27 -3
  41. package/dist/mdruntime/model.d.ts +2 -9
  42. package/dist/mdruntime/observation.d.ts +2 -2
  43. package/dist/mdruntime/outcome.d.ts +4 -1
  44. package/dist/mdruntime/overlay.d.ts +1 -0
  45. package/dist/mdruntime/preparation.d.ts +19 -0
  46. package/dist/mdruntime/query.d.ts +13 -209
  47. package/dist/mdruntime/reach.d.ts +14 -12
  48. package/dist/mdruntime/readiness.d.ts +0 -3
  49. package/dist/mdruntime/reads.d.ts +36 -0
  50. package/dist/mdruntime/refresh.d.ts +26 -0
  51. package/dist/mdruntime/replica.d.ts +9 -8
  52. package/dist/mdruntime/room-draft.d.ts +4 -5
  53. package/dist/mdruntime/room-drafts.d.ts +23 -0
  54. package/dist/mdruntime/runtime.d.ts +42 -0
  55. package/dist/mdruntime/save.d.ts +5 -1
  56. package/dist/mdruntime/saves.d.ts +69 -0
  57. package/dist/mdruntime/search.d.ts +12 -63
  58. package/dist/mdruntime/seed.d.ts +11 -2
  59. package/dist/mdruntime/socket/admission.d.ts +6 -0
  60. package/dist/mdruntime/socket/answers.d.ts +5 -0
  61. package/dist/mdruntime/socket/lanes.d.ts +19 -0
  62. package/dist/mdruntime/socket/rooms.d.ts +43 -0
  63. package/dist/mdruntime/socket/session.d.ts +37 -0
  64. package/dist/mdruntime/socket.d.ts +69 -0
  65. package/dist/mdruntime/source.d.ts +60 -0
  66. package/dist/mdruntime/status.d.ts +0 -2
  67. package/dist/mdruntime/store/fences.d.ts +15 -0
  68. package/dist/mdruntime/store/installs.d.ts +29 -0
  69. package/dist/mdruntime/store/readiness.d.ts +9 -0
  70. package/dist/mdruntime/store/records.d.ts +211 -0
  71. package/dist/mdruntime/store/room-held.d.ts +7 -0
  72. package/dist/mdruntime/store/space.d.ts +10 -0
  73. package/dist/mdruntime/store/watchers.d.ts +16 -0
  74. package/dist/mdruntime/store/writes.d.ts +23 -0
  75. package/dist/mdruntime/store.d.ts +107 -145
  76. package/dist/mdruntime/stored.d.ts +59 -33
  77. package/dist/mdruntime/surface.d.ts +87 -0
  78. package/dist/mdruntime/tables.d.ts +120 -29
  79. package/dist/mdruntime/tallies.d.ts +17 -0
  80. package/dist/mdruntime/transfer.d.ts +4 -0
  81. package/dist/mdruntime/turn.d.ts +8 -0
  82. package/dist/mdruntime/wire.d.ts +17 -1
  83. package/dist/test-host.js +1 -1
  84. package/docs/families.md +20 -8
  85. package/package.json +1 -1
  86. package/dist/mdmodel/condition.d.ts +0 -167
  87. package/dist/mdmodel/profile.d.ts +0 -5
  88. package/dist/mdruntime/connection.d.ts +0 -152
  89. package/dist/mdruntime/fulltext.d.ts +0 -26
@@ -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,154 +1,116 @@
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 { ReadinessWatch } from './preparation.js';
8
+ import type { Persistence } from './readiness.js';
9
+ import type { Listing } from './listing.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 { RoomDraftRecord } from './room-draft.js';
15
+ import { type SyncStatus } from './status.js';
16
+ import type { RuntimeDatabase } from './tables.js';
17
+ import { type Fences } from './store/fences.js';
18
+ import { type Installs } from './store/installs.js';
19
+ import { type HeldCover, type PendingState, type RuntimeStore } from './store/records.js';
20
+ import { type ReadinessQueue } from './store/readiness.js';
21
+ import { type RoomHeld } from './store/room-held.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 { NO_INSTALL, type RoomInstall } from './store/installs.js';
26
+ export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, 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 LandedAhead = Readonly<Record<string, string | undefined>>;
43
+ type AttachedFile = {
44
+ readonly revision: string;
45
+ readonly mediaType: string;
35
46
  };
36
- export type QueueRecord = {
37
- locator: string;
38
- pending: readonly {
39
- batch: ChangeBatch;
40
- state: PendingState;
41
- }[];
47
+ type Seeds = {
48
+ of(key: string): Seeded | undefined;
49
+ keep(key: string, seed: Seeded): void;
50
+ drop(key: string): void;
42
51
  };
43
- export type PresentationRecord = {
44
- app: string;
45
- value: unknown;
52
+ type Device = {
53
+ readonly persistence: Persistence;
54
+ readonly storageLoss: string | null;
55
+ readonly heldWhenOpened: boolean;
56
+ readonly preparing: boolean;
57
+ readonly sweeping: boolean;
58
+ readonly unpreparedDemand: ReadonlySet<string>;
59
+ readonly establishing: ReadonlySet<string>;
60
+ readonly status: SyncStatus;
61
+ readonly roomsShown: Listing | null;
46
62
  };
47
- export type ChatSubmission = {
48
- readonly operation: string;
49
- readonly text: string;
50
- readonly turn: string | null;
63
+ type StoreOptions = {
64
+ readonly database: RuntimeDatabase;
65
+ readonly roomTypes: Parameters<typeof schemaTypes>[1];
66
+ readonly builtIn: ModelState;
67
+ readonly typedPaths: readonly TypedPath[];
68
+ readonly persistence: Persistence;
69
+ opening(records: RuntimeStore): Promise<RuntimeStore>;
70
+ unpublished(error: unknown): void;
71
+ changed(set: ChangeSet): Promise<void>;
72
+ deliverReadiness(owed: readonly ReadinessWatch[]): Promise<void>;
73
+ spaceFreed(): void;
51
74
  };
52
- export type ChatDraftRecord = {
53
- conversation: string;
54
- text: string;
55
- revision: string;
56
- submitted?: readonly ChatSubmission[];
57
- moves?: readonly string[];
75
+ export type Store = {
76
+ readonly device: Cell<Device>;
77
+ readonly space: Space;
78
+ readonly readiness: ReadinessQueue<ReadinessWatch>;
79
+ ask: RuntimeDatabase['ask'];
80
+ changed(set: ChangeSet): Promise<void>;
81
+ open(): Promise<RuntimeStore>;
82
+ durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
83
+ exclusive<T>(work: () => Promise<T>): Promise<T>;
84
+ gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
85
+ written(): Promise<unknown>;
86
+ startingWrite<T>(work: () => Promise<T>): Promise<T>;
87
+ finishingWrite<T>(work: () => Promise<T>): Promise<T>;
88
+ ahead<T>(work: (hold: InstallHold) => Promise<T>): Promise<T>;
89
+ rederive: ReturnType<typeof createWrites>['rederive'];
90
+ refreshPage: ReturnType<typeof createWrites>['refreshPage'];
91
+ stageBytes(): number;
92
+ deriveBytes(): number;
93
+ rooms(locators?: readonly string[]): Promise<ReadonlyMap<string, Stored>>;
94
+ record(locator: string): Promise<ReplicaRecord | undefined>;
95
+ work(locator: string): Promise<Work>;
96
+ replica(locator: string): Promise<Held | undefined>;
97
+ covering(): Promise<HeldCover>;
98
+ drafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
99
+ draft(locator: string, path: string): Promise<RoomDraftRecord | undefined>;
100
+ composed(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>): Composition;
101
+ publication(work: () => Promise<void>): Promise<void>;
102
+ owing<T>(topic: string, add: (owed: T | undefined) => T, work: (owed: T) => Promise<void>): Promise<void>;
103
+ watch(topic: string, notify: (value: unknown) => void): Watcher;
104
+ watching(topic: string, which?: Watching): readonly Watcher[];
105
+ tell(topic: string, value: unknown): void;
106
+ readonly fences: Fences;
107
+ readonly installs: Installs;
108
+ readonly seeds: Seeds;
109
+ readonly landed: RoomHeld<LandedAhead>;
110
+ readonly attached: RoomHeld<AttachedFile>;
111
+ readonly opened: OpenedFiles;
112
+ part(file: string, part: number): Promise<Uint8Array | null>;
113
+ forget(locator: string): void;
114
+ close(): void;
58
115
  };
59
- export type CallRecord = {
60
- readonly operation: string;
61
- readonly name: string;
62
- readonly input: unknown;
63
- };
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;
116
+ 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,46 @@ 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
- readonly key: number;
33
+ export type HeldRoomRow = {
34
34
  readonly locator: string;
35
- readonly transfer: string;
36
- readonly rederiving: number | null;
37
- readonly searching: number | null;
35
+ readonly key: number;
36
+ readonly record: string;
37
+ readonly indexed: boolean;
38
+ readonly documents: number;
38
39
  };
39
- export type ReplicaOpened = {
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 Covering = {
40
51
  readonly rooms: readonly {
41
52
  readonly locator: string;
42
53
  readonly key: number;
43
- readonly record: string;
54
+ readonly transfer: string;
55
+ readonly roomVersion: string;
56
+ readonly indexed: boolean;
57
+ readonly documents: number;
58
+ readonly bytes: number;
59
+ readonly offline: string;
44
60
  }[];
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;
61
+ readonly queues: readonly {
57
62
  readonly locator: string;
63
+ readonly ids: readonly string[];
58
64
  }[];
65
+ };
66
+ export type HeldLocators = {
67
+ readonly held: readonly string[];
68
+ readonly staged: readonly string[];
69
+ };
70
+ export type ReplicaOpened = {
71
+ readonly erasing: boolean;
59
72
  readonly orphans: readonly number[];
60
73
  };
61
74
  export type RoomCommit = {
@@ -78,14 +91,9 @@ export type RoomCommit = {
78
91
  };
79
92
  };
80
93
  export type Committed = {
81
- readonly counts: Readonly<Record<string, number>>;
82
94
  readonly changed: Readonly<Record<string, readonly string[] | null>>;
83
95
  readonly indexed: Readonly<Record<string, boolean>>;
84
96
  };
85
- export type CountedRoom = {
86
- readonly key: number;
87
- readonly roots: readonly string[];
88
- };
89
97
  export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
90
98
  export declare function stage(connection: Connection, request: {
91
99
  readonly locator: string;
@@ -94,7 +102,20 @@ export declare function stage(connection: Connection, request: {
94
102
  readonly fingerprint: string;
95
103
  readonly entries: readonly StoredEntry[];
96
104
  readonly folders: readonly string[];
105
+ readonly part: string | null;
97
106
  }): number;
107
+ export type Resumed = {
108
+ readonly key: number | null;
109
+ readonly transfer: string;
110
+ readonly staged: readonly string[];
111
+ };
112
+ export declare function resume(connection: Connection, request: {
113
+ readonly locator: string;
114
+ readonly transfer: string;
115
+ readonly fingerprint: string;
116
+ readonly parts: readonly string[];
117
+ readonly published: number | null;
118
+ }): Resumed;
98
119
  export declare function refreshing(connection: Connection, request: {
99
120
  readonly key: number;
100
121
  readonly composed: Composed;
@@ -104,7 +125,6 @@ export declare function refreshing(connection: Connection, request: {
104
125
  readonly folderRemovals: readonly string[];
105
126
  }): null;
106
127
  export declare function unrefresh(connection: Connection, key: number): null;
107
- export declare function counts(connection: Connection, rooms: readonly CountedRoom[]): number[];
108
128
  export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
109
129
  export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
110
130
  export declare function abandon(connection: Connection, locator: string): null;
@@ -118,12 +138,18 @@ export declare function rederive(connection: Connection, key: number, composed:
118
138
  };
119
139
  export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
120
140
  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[];
141
+ export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[]): Referrer[];
142
+ export declare function folders(connection: Connection, key: number, list: readonly string[]): string[];
127
143
  export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
128
144
  export declare function opened(connection: Connection): ReplicaOpened;
145
+ export declare function heldRooms(connection: Connection, locators: readonly string[] | null): readonly HeldRoomRow[];
146
+ export declare function heldRoom(connection: Connection, locator: string): HeldRoomRow | null;
147
+ export declare function overlaid(connection: Connection, key: number): readonly string[];
148
+ export declare function covering(connection: Connection): Covering['rooms'];
149
+ export declare function offlineMode(connection: Connection, locator: string): string | null;
150
+ export declare function stagedLocators(connection: Connection): readonly string[];
151
+ export declare function heldLocators(connection: Connection): readonly string[];
152
+ export declare function demoted(connection: Connection): null;
153
+ export declare function facts(connection: Connection): Readonly<Record<string, string>>;
154
+ export declare function presentation(connection: Connection, app: string): string | null;
129
155
  export declare function ended(connection: Connection): void;
@@ -0,0 +1,87 @@
1
+ import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
2
+ import { type HistoryQuery } from './actions.js';
3
+ import type { Member, 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
+ reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
50
+ log(): string;
51
+ persistence(): boolean;
52
+ retry(): Promise<void>;
53
+ cleanUp(): Promise<number>;
54
+ unsent(): Promise<readonly UnsentWork[]>;
55
+ reset(): Promise<void>;
56
+ readAgain(): Promise<void>;
57
+ observe: {
58
+ (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
59
+ (topic: 'readiness'): Promise<Observation<Readiness>>;
60
+ (topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
61
+ (topic: 'storage-loss'): Promise<Observation<string | null>>;
62
+ (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
63
+ (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
64
+ (topic: 'member'): Promise<Observation<Member | null>>;
65
+ (topic: 'authority-changes'): Promise<Observation<number>>;
66
+ (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
67
+ (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
68
+ (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
69
+ (topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
70
+ (topic: 'presentation', app: string): Promise<Observation<unknown>>;
71
+ (topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
72
+ (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
73
+ (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
74
+ (topic: 'figures'): Promise<Observation<FiguresResult>>;
75
+ (topic: 'holdings'): Promise<Observation<Holdings>>;
76
+ (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
77
+ };
78
+ reauthorize(): Promise<void>;
79
+ };
80
+ export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents' | 'figures' | 'holdings' | 'read';
81
+ export type ComposedRuntime = RuntimeView & {
82
+ seed(entry: EntrySeed): void;
83
+ stop(): Promise<void>;
84
+ persisted(answer: Persistence): void;
85
+ within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
86
+ };
87
+ export declare function composedRuntime(runtime: Runtime): ComposedRuntime;