@agentshouse/app-bridge 0.1.0-c895bda3a3f6a → 0.1.0-c8a7dd564e490

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 (49) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +91 -59
  3. package/dist/mdmodel/definition.d.ts +1 -1
  4. package/dist/mdmodel/document.d.ts +1 -2
  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 -6
  8. package/dist/mdmodel/kinds.d.ts +18 -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 +4 -0
  15. package/dist/mdmodel/types.d.ts +7 -5
  16. package/dist/mdmodel/validate.d.ts +7 -5
  17. package/dist/mdruntime/adapter.d.ts +37 -25
  18. package/dist/mdruntime/chain.d.ts +2 -1
  19. package/dist/mdruntime/change.d.ts +1 -0
  20. package/dist/mdruntime/client.d.ts +7 -3
  21. package/dist/mdruntime/collection.d.ts +2 -1
  22. package/dist/mdruntime/compile.d.ts +2 -7
  23. package/dist/mdruntime/connection.d.ts +7 -6
  24. package/dist/mdruntime/conversation-row.d.ts +32 -0
  25. package/dist/mdruntime/conversation.d.ts +18 -9
  26. package/dist/mdruntime/durability.d.ts +6 -0
  27. package/dist/mdruntime/identity.d.ts +0 -1
  28. package/dist/mdruntime/job.d.ts +32 -0
  29. package/dist/mdruntime/messages.d.ts +27 -3
  30. package/dist/mdruntime/model.d.ts +2 -9
  31. package/dist/mdruntime/observation.d.ts +2 -2
  32. package/dist/mdruntime/overlay.d.ts +1 -0
  33. package/dist/mdruntime/query.d.ts +13 -210
  34. package/dist/mdruntime/reach.d.ts +11 -11
  35. package/dist/mdruntime/readiness.d.ts +0 -2
  36. package/dist/mdruntime/replica.d.ts +8 -5
  37. package/dist/mdruntime/room-draft.d.ts +3 -2
  38. package/dist/mdruntime/search.d.ts +12 -63
  39. package/dist/mdruntime/source.d.ts +60 -0
  40. package/dist/mdruntime/status.d.ts +0 -2
  41. package/dist/mdruntime/store.d.ts +88 -41
  42. package/dist/mdruntime/stored.d.ts +58 -65
  43. package/dist/mdruntime/tables.d.ts +88 -51
  44. package/dist/mdruntime/wire.d.ts +8 -0
  45. package/dist/test-host.js +1 -1
  46. package/docs/families.md +17 -6
  47. package/package.json +1 -1
  48. package/dist/mdmodel/condition.d.ts +0 -180
  49. package/dist/mdruntime/fulltext.d.ts +0 -26
@@ -1,4 +1,5 @@
1
- import type { BootstrapInventory, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
1
+ import { type TypedPath } from '../mdmodel/index.js';
2
+ import type { BootstrapInventory, SavedFacts, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
2
3
  import { type ChangeBatch, type Precondition } from './change.js';
3
4
  import { type Collection, type Composition } from './collection.js';
4
5
  import { type ModelState } from './model.js';
@@ -31,14 +32,16 @@ export type VisibleLayer = Layer & {
31
32
  };
32
33
  export type Slice = Layer & {
33
34
  readonly written: Readonly<Record<string, string>>;
35
+ readonly facts: Readonly<Record<string, SavedFacts>>;
34
36
  readonly held: ReadonlySet<string>;
35
37
  };
36
- export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState): Composition;
38
+ export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState, typedPaths: readonly TypedPath[]): Composition;
37
39
  export declare function storedRecord(record: ReplicaRecord): string;
38
40
  export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
41
+ export type LayerEntry = Omit<StoredEntry, 'facts'>;
39
42
  export declare function entryAt(layer: Layer & {
40
43
  readonly written?: Readonly<Record<string, string>>;
41
- }, path: string): StoredEntry | null;
44
+ }, path: string): LayerEntry | null;
42
45
  export declare function slicingWith(slice: Slice, set: readonly StoredEntry[], removed: readonly string[]): Generator<number, Slice, void>;
43
46
  export declare function touchedBy(queue: readonly ChangeBatch[]): Set<string>;
44
47
  export declare function movedBy(queue: readonly ChangeBatch[], locator: string): Set<string>;
@@ -47,7 +50,7 @@ export type Replayed = {
47
50
  readonly touched: ReadonlySet<string>;
48
51
  };
49
52
  export declare function replaying(confirmed: Slice, queue: readonly ChangeBatch[], locator: string, composition: Composition): Generator<number, Replayed, void>;
50
- export declare function overlayOf(visible: Layer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
53
+ export declare function overlayOf(visible: VisibleLayer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
51
54
  export declare function holds(layer: Layer, preconditions: readonly Precondition[]): boolean;
52
55
  export declare function landed(batch: ChangeBatch, confirmed: Layer, current?: Readonly<Record<string, string>>): boolean;
53
56
  export type Standing = {
@@ -63,5 +66,5 @@ export type Returned = {
63
66
  readonly removed: readonly string[];
64
67
  };
65
68
  export declare function returnedPaths(submitted: ChangeBatch, accepted: Accepted): Set<string>;
66
- export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string): Generator<number, Returned, void>;
69
+ export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string, composition: Composition): Generator<number, Returned, void>;
67
70
  export {};
@@ -90,9 +90,9 @@ type ChangedUnderneath = {
90
90
  readonly file?: string | null;
91
91
  };
92
92
  export type ReturnReason = ProviderRefusal & {
93
- readonly kind: Open<'conflicted' | 'rejected' | 'expired' | 'withdrawn'>;
93
+ readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
94
94
  };
95
- export declare function returnedBy(kind: 'expired' | 'withdrawn'): ReturnReason;
95
+ export declare function returnedBy(kind: 'withdrawn'): ReturnReason;
96
96
  export type RoomDraft = {
97
97
  readonly room: string;
98
98
  readonly path: string;
@@ -134,6 +134,7 @@ export declare function underneath(parts: HeldParts, path: string, visible: Visi
134
134
  export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
135
135
  export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
136
136
  export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
137
+ export declare function lineEnded(text: string): string;
137
138
  export type TextParts = {
138
139
  readonly fields?: Readonly<Record<string, {
139
140
  readonly value: unknown;
@@ -1,72 +1,21 @@
1
- import type { ProviderRefusal } from './adapter.js';
2
- import { type CoveredRoom, type Filter, type PendingRoom } from './query.js';
3
- import type { Open } from './open.js';
4
- export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
1
+ import type { ProviderRefusal, SearchHit } from './adapter.js';
2
+ import type { Failure, Offline } from './outcome.js';
5
3
  export type SearchRequest = {
6
4
  text: string;
7
- documents?: Filter;
8
- collection?: true;
9
- conversations?: readonly string[];
10
- limit?: number;
11
- after?: string;
12
- total?: true;
5
+ rooms?: readonly string[];
13
6
  };
14
- export type MessagePart = Open<'text'>;
15
- export type Snippet<Part extends string> = {
16
- part: Part;
17
- text: string;
18
- at: readonly [number, number];
19
- };
20
- export type DocumentHit = {
21
- room: string;
22
- path: string;
23
- type: string;
24
- score: number;
25
- matches: Readonly<Record<string, readonly DocumentPart[]>>;
26
- snippet?: Snippet<DocumentPart>;
27
- };
28
- export type MessageHit = {
29
- conversation: string;
30
- identity: string;
31
- score: number;
32
- matches: Readonly<Record<string, readonly MessagePart[]>>;
33
- snippet?: Snippet<MessagePart>;
34
- };
35
- export type SearchCoverage = {
36
- rooms: readonly CoveredRoom[];
37
- conversations: readonly string[];
38
- overlay: readonly string[];
7
+ export type { SearchHit } from './adapter.js';
8
+ export type SearchFound = {
9
+ kind: 'found';
10
+ documents: readonly SearchHit[];
39
11
  };
40
- export type SearchHits = {
41
- documents: readonly DocumentHit[];
42
- messages: readonly MessageHit[];
43
- };
44
- export type SearchWindow = SearchHits & {
45
- next?: string;
46
- total?: {
47
- documents: number;
48
- messages: number;
49
- };
50
- };
51
- export type SearchPending = SearchHits & {
52
- pending: readonly PendingRoom[];
53
- coverage: SearchCoverage;
54
- };
55
- export type SearchUndeclared = ProviderRefusal & {
12
+ export type SearchResult = SearchFound | Offline | (ProviderRefusal & {
13
+ kind: 'rejected';
14
+ }) | (ProviderRefusal & {
56
15
  kind: 'undeclared';
57
- };
58
- export type SearchResult = (SearchWindow & {
59
- coverage: SearchCoverage;
60
- }) | SearchPending | SearchUndeclared;
61
- export declare function undeclaredSearch(): SearchUndeclared;
62
- export type HitCursor = readonly [number, string, string] | readonly [] | null;
16
+ }) | Failure;
63
17
  export type SearchPlan = {
64
18
  text: string;
65
- documents: unknown;
66
- collection: boolean;
67
- conversations: readonly string[] | null;
68
- limit: number | null;
69
- after: readonly [HitCursor, HitCursor] | null;
70
- total: boolean;
19
+ rooms: readonly string[] | null;
71
20
  };
72
21
  export declare function searchPlanOf(input: unknown): SearchPlan;
@@ -0,0 +1,60 @@
1
+ export type HouseSource = {
2
+ readonly kind: 'request';
3
+ readonly request: string;
4
+ readonly agentFunction: RequestAgentFunction | null;
5
+ readonly requester: {
6
+ readonly name: string;
7
+ readonly room: boolean;
8
+ };
9
+ readonly room: {
10
+ readonly ref: string;
11
+ readonly name: string;
12
+ };
13
+ readonly approved: string | null;
14
+ } | {
15
+ readonly kind: 'mail';
16
+ readonly request: string;
17
+ readonly room: string;
18
+ readonly report: boolean;
19
+ readonly agent: string;
20
+ readonly owner: string;
21
+ readonly approved: string | null;
22
+ readonly declined: string | null;
23
+ } | {
24
+ readonly kind: 'trigger';
25
+ readonly customer: boolean;
26
+ readonly trigger: string;
27
+ readonly room: {
28
+ readonly ref: string;
29
+ readonly name: string;
30
+ };
31
+ } | {
32
+ readonly kind: 'conversation';
33
+ readonly conversation: {
34
+ readonly id: string;
35
+ readonly name: string;
36
+ };
37
+ readonly agent: string;
38
+ } | {
39
+ readonly kind: 'declined';
40
+ readonly agent: string;
41
+ readonly owner: string;
42
+ };
43
+ export type ChatRequest = {
44
+ readonly request: string;
45
+ readonly room: string;
46
+ readonly message?: string;
47
+ };
48
+ export type ChatRoomRequest = {
49
+ readonly request: string;
50
+ readonly room: {
51
+ readonly ref: string;
52
+ readonly name: string;
53
+ };
54
+ };
55
+ type RequestAgentFunction = {
56
+ readonly name: string;
57
+ readonly version: number;
58
+ };
59
+ export declare function sourceOf(value: unknown, sender: string | null): HouseSource | null;
60
+ export {};
@@ -22,6 +22,4 @@ export type CycleProgress = {
22
22
  reachable: boolean;
23
23
  };
24
24
  export declare const STARTING: SyncStatus;
25
- export declare function transferring(status: SyncStatus): SyncStatus;
26
- export declare function saving(status: SyncStatus): SyncStatus;
27
25
  export declare function same(one: SyncStatus, other: SyncStatus): boolean;
@@ -6,8 +6,8 @@ import type { ReplicaRecord } from './replica.js';
6
6
  import type { Submission } from './outcome.js';
7
7
  import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
8
8
  import type { ModelState, StoredModel } from './model.js';
9
- import type { SearchWindow } from './search.js';
10
- import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, HeldText, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
9
+ import type { CommittedWrite, ConversationWrite, HeldConversation, HeldRow, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, ReplicaOpened, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
10
+ import type { JobMarker } from './job.js';
11
11
  export type { ConversationWrite, HeldConversation, MessageWindow } from './tables.js';
12
12
  export type TransferRecord = {
13
13
  readonly locator: string;
@@ -33,13 +33,6 @@ export type PendingState = {
33
33
  export type TargetRecord = {
34
34
  established: boolean;
35
35
  };
36
- export type QueueRecord = {
37
- locator: string;
38
- pending: readonly {
39
- batch: ChangeBatch;
40
- state: PendingState;
41
- }[];
42
- };
43
36
  export type PresentationRecord = {
44
37
  app: string;
45
38
  value: unknown;
@@ -64,6 +57,7 @@ export type CallRecord = {
64
57
  export type AuthoredWrite = {
65
58
  locator: string;
66
59
  queue?: readonly ChangeBatch[];
60
+ stored?: readonly ChangeBatch[];
67
61
  founded?: readonly ChangeBatch[];
68
62
  saved?: ReadonlyMap<string, readonly SavedDraft[]>;
69
63
  roomDrafts?: readonly RoomDraftRecord[];
@@ -72,23 +66,64 @@ export type AuthoredWrite = {
72
66
  export type StagedPage = {
73
67
  readonly entries: readonly StoredEntry[];
74
68
  readonly folders: readonly string[];
69
+ readonly part?: string;
70
+ };
71
+ export type ResumedTransfer = {
72
+ readonly key: number | null;
73
+ readonly transfer: string;
74
+ readonly staged: readonly string[];
75
75
  };
76
76
  export type RefreshedPage = StagedPage & {
77
77
  readonly removals: readonly string[];
78
78
  readonly folderRemovals: readonly string[];
79
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[];
80
+ export type HeldRoom = {
81
+ readonly record: StoredReplica;
82
+ readonly indexed: boolean;
83
+ readonly documents: number;
84
+ };
85
+ export type QueuedChange = {
86
+ readonly batch: ChangeBatch;
87
+ readonly state: PendingState;
88
+ };
89
+ export type HeldWork = {
90
+ readonly room: (HeldRoom & {
91
+ readonly overlaid: ReadonlySet<string>;
92
+ }) | null;
93
+ readonly queue: readonly QueuedChange[];
94
+ };
95
+ export type CoveredRoom = {
96
+ readonly key: number;
97
+ readonly transfer: string;
98
+ readonly roomVersion: string;
99
+ readonly indexed: boolean;
100
+ readonly documents: number;
101
+ readonly bytes: number;
102
+ readonly offline: string;
103
+ };
104
+ export type HeldCover = {
105
+ readonly rooms: ReadonlyMap<string, CoveredRoom>;
106
+ readonly queues: ReadonlyMap<string, readonly string[]>;
107
+ };
108
+ export type HeldStatus = {
109
+ readonly queued: readonly string[];
110
+ readonly lastCompleted: string | null;
111
+ readonly unsent: readonly {
112
+ readonly room: string;
113
+ readonly path: string;
114
+ }[];
115
+ readonly resets: readonly {
116
+ readonly locator: string;
117
+ readonly reset: string;
118
+ }[];
119
+ readonly returned: readonly RoomDraftRecord[];
120
+ };
121
+ export type Facts = {
86
122
  readonly lastCompleted: string | null;
87
123
  readonly providerLimits: readonly ProviderLimit[];
88
124
  readonly capabilities: readonly Capability[];
89
125
  readonly member: Member | null;
90
126
  readonly targets: Readonly<Record<string, TargetRecord>>;
91
- readonly presentation: readonly PresentationRecord[];
92
127
  readonly conversationList: readonly ListedConversation[] | null;
93
128
  readonly conversationCursor: string | null;
94
129
  };
@@ -97,58 +132,70 @@ export type Commit = {
97
132
  readonly writes?: readonly AuthoredWrite[];
98
133
  readonly files?: readonly StoredFile[];
99
134
  readonly whole?: boolean;
100
- readonly discards?: readonly string[];
101
135
  };
102
136
  export type RuntimeStore = {
103
- opened(): Promise<Opened>;
104
- counts(rooms: readonly CountedRoom[]): Promise<readonly number[]>;
137
+ opened(): Promise<ReplicaOpened>;
138
+ rooms(locators?: readonly string[]): Promise<readonly HeldRoom[]>;
139
+ room(locator: string): Promise<HeldWork>;
140
+ covering(): Promise<HeldCover>;
141
+ offline(locator: string): Promise<string | null>;
142
+ held(): Promise<{
143
+ readonly held: ReadonlySet<string>;
144
+ readonly staged: ReadonlySet<string>;
145
+ }>;
146
+ status(): Promise<HeldStatus>;
147
+ batch(locator: string, id: string): Promise<ChangeBatch | null>;
148
+ order(locator: string): Promise<readonly string[]>;
149
+ queued(): Promise<readonly string[]>;
150
+ moving(): Promise<{
151
+ readonly queued: ReadonlyMap<string, readonly string[]>;
152
+ readonly moving: readonly (QueuedChange & {
153
+ readonly locator: string;
154
+ })[];
155
+ }>;
156
+ pending(locator: string, id: string): Promise<{
157
+ readonly state: PendingState | undefined;
158
+ readonly room: boolean;
159
+ }>;
160
+ facts(): Promise<Facts>;
161
+ presentation(app: string): Promise<unknown>;
162
+ demote(): Promise<void>;
105
163
  query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
106
164
  changes(keys: readonly number[]): number;
107
165
  entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
108
166
  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
- }[]>;
167
+ referrers(key: number, view: View, targets: readonly string[]): Promise<readonly Referrer[]>;
114
168
  folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
115
169
  typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
116
- search(ask: SearchAsk): Promise<SearchWindow>;
117
170
  stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
171
+ resume(record: TransferRecord, composition: Composition, parts: readonly string[], published: number | null): Promise<ResumedTransfer | null>;
118
172
  refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
119
173
  unrefresh(key: number): Promise<void>;
120
- hold(locator: string, key: number, composition: Composition, texts: readonly HeldText[]): Promise<readonly string[]>;
121
- unhold(locator: string, key: number, composition: Composition): Promise<{
122
- readonly paths: readonly string[];
123
- readonly bytes: number;
124
- }>;
125
- wanted(locator: string, key: number): Promise<readonly {
126
- readonly path: string;
127
- readonly revision: string;
128
- }[]>;
129
- remember(locator: string, key: number, paths: readonly string[]): Promise<void>;
130
174
  commit(commit: Commit): Promise<CommittedWrite>;
131
175
  fence(locators: readonly string[]): Promise<void>;
132
176
  erase(locator: string | null, limit: number): Promise<boolean>;
133
177
  abandon(locator: string): Promise<void>;
178
+ unfence(locators: readonly string[]): Promise<ReadonlySet<string>>;
134
179
  release(key: number): Promise<void>;
135
180
  rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
136
181
  readonly done: boolean;
137
182
  readonly text: number;
138
183
  }>;
139
184
  fact(name: string, value: unknown): Promise<void>;
140
- queues(): Promise<readonly QueueRecord[]>;
141
185
  submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
142
186
  keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
143
- roomDrafts(): Promise<readonly RoomDraftRecord[]>;
187
+ roomDrafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
144
188
  present(record: PresentationRecord): Promise<void>;
145
- conversations(): Promise<readonly HeldConversation[]>;
189
+ conversations(conversations?: readonly string[]): Promise<readonly HeldConversation[]>;
146
190
  keepMessages(write: ConversationWrite): Promise<void>;
147
- messageWindow(conversation: string, limit: number, before: readonly [string, string] | null): Promise<MessageWindow>;
148
- messageCount(conversation: string): Promise<number>;
191
+ messageWindow(conversation: string, limit: number, before: readonly [string, string] | null, phrase?: string | null): Promise<MessageWindow>;
192
+ messageCount(conversation: string, phrase?: string | null): Promise<number>;
149
193
  turnArrived(conversation: string, turn: string): Promise<boolean>;
194
+ conversationRows(conversations: readonly string[]): Promise<readonly HeldRow[]>;
195
+ jobMarkers(conversation: string): Promise<readonly JobMarker[]>;
150
196
  dropConversations(conversations: readonly string[]): Promise<void>;
151
197
  chatDrafts(): Promise<readonly ChatDraftRecord[]>;
198
+ chatDraft(conversation: string): Promise<ChatDraftRecord | null>;
152
199
  keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
153
200
  dropChatDraft(conversation: string): Promise<void>;
154
201
  calls(): Promise<readonly CallRecord[]>;
@@ -161,4 +208,4 @@ export type RuntimeStore = {
161
208
  rememberGeneration(value: string): Promise<void>;
162
209
  file(key: string, type: string): Promise<Blob>;
163
210
  };
164
- export declare function openRuntimeStore(fenced: (locator: string) => boolean, authored: RuntimeDatabase): RuntimeStore;
211
+ export declare function openRuntimeStore(authored: RuntimeDatabase): RuntimeStore;
@@ -1,5 +1,4 @@
1
- import type { Outline } from '../mdmodel/index.js';
2
- import type { HeadChange } from './adapter.js';
1
+ import type { SavedFacts, HeadChange } from './adapter.js';
3
2
  import { type Composed, type Composition } from './collection.js';
4
3
  import type { HeldBinary } from './overlay.js';
5
4
  import type { Connection } from './tables.js';
@@ -8,12 +7,13 @@ export type View = 'confirmed' | 'visible' | 'refreshed';
8
7
  export type StoredEntry = {
9
8
  readonly path: string;
10
9
  readonly content: string | null;
11
- readonly outline: Outline | null;
12
10
  readonly binary: HeldBinary | null;
13
11
  readonly revision: string | null;
14
12
  readonly fileId: string | null;
13
+ readonly created: string | null;
15
14
  readonly change: HeadChange | null;
16
15
  readonly written: string | null;
16
+ readonly facts: SavedFacts | null;
17
17
  };
18
18
  export type OverlayEntry = StoredEntry & {
19
19
  readonly present: boolean;
@@ -29,35 +29,46 @@ export type TypedEntry = {
29
29
  export type Referrer = {
30
30
  readonly path: string;
31
31
  readonly target: string;
32
- readonly kind: string;
33
32
  };
34
- export type HeldKey = {
35
- readonly key: number;
33
+ export type HeldRoomRow = {
36
34
  readonly locator: string;
37
- readonly transfer: string;
38
- readonly rederiving: number | null;
39
- readonly searching: number | null;
35
+ readonly key: number;
36
+ readonly record: string;
37
+ readonly indexed: boolean;
38
+ readonly documents: number;
40
39
  };
41
- 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 = {
42
51
  readonly rooms: readonly {
43
52
  readonly locator: string;
44
53
  readonly key: number;
45
- readonly record: string;
46
- }[];
47
- readonly keys: readonly HeldKey[];
48
- readonly facts: Readonly<Record<string, string>>;
49
- readonly presentation: readonly {
50
- readonly app: string;
51
- readonly value: 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;
52
60
  }[];
53
- readonly overlaid: readonly {
54
- readonly key: number;
55
- readonly path: string;
56
- }[];
57
- readonly erasing: readonly {
58
- readonly key: number;
61
+ readonly queues: readonly {
59
62
  readonly locator: string;
63
+ readonly ids: readonly string[];
60
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;
61
72
  readonly orphans: readonly number[];
62
73
  };
63
74
  export type RoomCommit = {
@@ -80,14 +91,9 @@ export type RoomCommit = {
80
91
  };
81
92
  };
82
93
  export type Committed = {
83
- readonly counts: Readonly<Record<string, number>>;
84
94
  readonly changed: Readonly<Record<string, readonly string[] | null>>;
85
95
  readonly indexed: Readonly<Record<string, boolean>>;
86
96
  };
87
- export type CountedRoom = {
88
- readonly key: number;
89
- readonly roots: readonly string[];
90
- };
91
97
  export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
92
98
  export declare function stage(connection: Connection, request: {
93
99
  readonly locator: string;
@@ -96,7 +102,20 @@ export declare function stage(connection: Connection, request: {
96
102
  readonly fingerprint: string;
97
103
  readonly entries: readonly StoredEntry[];
98
104
  readonly folders: readonly string[];
105
+ readonly part: string | null;
99
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;
100
119
  export declare function refreshing(connection: Connection, request: {
101
120
  readonly key: number;
102
121
  readonly composed: Composed;
@@ -106,7 +125,6 @@ export declare function refreshing(connection: Connection, request: {
106
125
  readonly folderRemovals: readonly string[];
107
126
  }): null;
108
127
  export declare function unrefresh(connection: Connection, key: number): null;
109
- export declare function counts(connection: Connection, rooms: readonly CountedRoom[]): number[];
110
128
  export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
111
129
  export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
112
130
  export declare function abandon(connection: Connection, locator: string): null;
@@ -118,45 +136,20 @@ export declare function rederive(connection: Connection, key: number, composed:
118
136
  readonly done: boolean;
119
137
  readonly text: number;
120
138
  };
121
- export type HeldText = {
122
- readonly path: string;
123
- readonly revision: string;
124
- readonly content: string;
125
- };
126
- export declare function holdTexts(connection: Connection, request: {
127
- readonly key: number;
128
- readonly locator: string;
129
- readonly composed: Composed;
130
- readonly texts: readonly HeldText[];
131
- }): string[];
132
- export declare function unholdTexts(connection: Connection, request: {
133
- readonly key: number;
134
- readonly locator: string;
135
- readonly composed: Composed;
136
- }): {
137
- readonly paths: readonly string[];
138
- readonly bytes: number;
139
- };
140
- export declare function remembered(connection: Connection, request: {
141
- readonly key: number;
142
- readonly locator: string;
143
- readonly paths: readonly string[];
144
- }): null;
145
- export declare function wanted(connection: Connection, request: {
146
- readonly key: number;
147
- readonly locator: string;
148
- }): {
149
- readonly path: string;
150
- readonly revision: string;
151
- }[];
152
139
  export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
153
140
  export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
154
- export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[], kinds: readonly string[]): Referrer[];
155
- export declare function files(connection: Connection, key: number, view: View, after: string | null, limit: number): {
156
- readonly path: string;
157
- readonly revision: string;
158
- }[];
141
+ export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[]): Referrer[];
159
142
  export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
160
143
  export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
161
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;
162
155
  export declare function ended(connection: Connection): void;