@agentshouse/app-bridge 0.1.0-c58a055eeaa71 → 0.1.0-c646d0da70608

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 (55) hide show
  1. package/README.md +3 -1
  2. package/dist/calls.d.ts +117 -0
  3. package/dist/calls.js +1 -0
  4. package/dist/index.d.ts +23 -11
  5. package/dist/mdmodel/blocks.d.ts +10 -0
  6. package/dist/mdmodel/condition.d.ts +149 -0
  7. package/dist/mdmodel/definition.d.ts +65 -0
  8. package/dist/mdmodel/divide.d.ts +2 -0
  9. package/dist/mdmodel/document.d.ts +15 -0
  10. package/dist/mdmodel/fields.d.ts +5 -0
  11. package/dist/mdmodel/index.d.ts +18 -0
  12. package/dist/mdmodel/paths.d.ts +17 -0
  13. package/dist/mdmodel/profile.d.ts +5 -0
  14. package/dist/mdmodel/project.d.ts +20 -0
  15. package/dist/mdmodel/references.d.ts +3 -0
  16. package/dist/mdmodel/types.d.ts +143 -0
  17. package/dist/mdmodel/validate.d.ts +7 -0
  18. package/dist/mdmodel/version.d.ts +1 -0
  19. package/dist/mdmodel/yaml.d.ts +55 -0
  20. package/dist/mdruntime/acquisition.d.ts +13 -0
  21. package/dist/mdruntime/adapter.d.ts +475 -0
  22. package/dist/mdruntime/binary.d.ts +22 -0
  23. package/dist/mdruntime/change-set.d.ts +34 -0
  24. package/dist/mdruntime/change.d.ts +88 -0
  25. package/dist/mdruntime/client.d.ts +82 -0
  26. package/dist/mdruntime/collection.d.ts +38 -0
  27. package/dist/mdruntime/connection.d.ts +138 -0
  28. package/dist/mdruntime/conversation.d.ts +104 -0
  29. package/dist/mdruntime/durability.d.ts +14 -0
  30. package/dist/mdruntime/failure.d.ts +12 -0
  31. package/dist/mdruntime/file.d.ts +19 -0
  32. package/dist/mdruntime/model.d.ts +57 -0
  33. package/dist/mdruntime/observation.d.ts +29 -0
  34. package/dist/mdruntime/open.d.ts +1 -0
  35. package/dist/mdruntime/outcome.d.ts +46 -0
  36. package/dist/mdruntime/overlay.d.ts +26 -0
  37. package/dist/mdruntime/query.d.ts +247 -0
  38. package/dist/mdruntime/reach.d.ts +45 -0
  39. package/dist/mdruntime/readiness.d.ts +52 -0
  40. package/dist/mdruntime/recovery.d.ts +24 -0
  41. package/dist/mdruntime/replica.d.ts +45 -0
  42. package/dist/mdruntime/room-draft.d.ts +143 -0
  43. package/dist/mdruntime/rows.d.ts +36 -0
  44. package/dist/mdruntime/save.d.ts +63 -0
  45. package/dist/mdruntime/search.d.ts +84 -0
  46. package/dist/mdruntime/shared.d.ts +10 -0
  47. package/dist/mdruntime/status.d.ts +26 -0
  48. package/dist/mdruntime/store.d.ts +160 -0
  49. package/dist/mdruntime/transfer.d.ts +9 -0
  50. package/dist/mdruntime/turn.d.ts +6 -0
  51. package/dist/mdruntime/wire.d.ts +206 -0
  52. package/dist/test-host.d.ts +5 -5
  53. package/dist/test-host.js +56 -21
  54. package/docs/families.md +41 -2
  55. package/package.json +1 -4
@@ -0,0 +1,55 @@
1
+ export declare class YamlError extends Error {
2
+ readonly offset: number;
3
+ constructor(offset: number);
4
+ }
5
+ export type YamlScalar = {
6
+ readonly kind: 'scalar';
7
+ readonly value: string | number | boolean | null;
8
+ readonly start: number;
9
+ readonly end: number;
10
+ };
11
+ export type YamlSeq = {
12
+ readonly kind: 'seq';
13
+ readonly items: readonly YamlNode[];
14
+ readonly start: number;
15
+ readonly end: number;
16
+ };
17
+ export type YamlEntry = {
18
+ readonly key: string;
19
+ readonly after: number;
20
+ readonly value: YamlNode;
21
+ };
22
+ export type YamlMap = {
23
+ readonly kind: 'map';
24
+ readonly entries: readonly YamlEntry[];
25
+ readonly start: number;
26
+ readonly end: number;
27
+ };
28
+ export type YamlNode = YamlScalar | YamlSeq | YamlMap;
29
+ export declare function interpretPlain(text: string): string | number | boolean | null;
30
+ export declare function parseYamlMapping(text: string, start: number, end: number): YamlMap;
31
+ export declare function jsValue(node: YamlNode): unknown;
32
+ export declare function mapEntry(map: YamlMap, key: string): YamlEntry | undefined;
33
+ export declare function isPlainSafe(text: string): boolean;
34
+ export type FrontmatterValue = string | number | boolean | null | readonly FrontmatterValue[] | {
35
+ readonly [name: string]: FrontmatterValue;
36
+ };
37
+ export declare function plain(value: unknown): value is Record<string, unknown>;
38
+ export declare function frontmatterValue(value: unknown): value is FrontmatterValue;
39
+ export declare function serializeJs(value: FrontmatterValue): string;
40
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
41
+ export declare function serializeKey(name: string): string;
42
+ export declare function bodyStartAfterYaml(content: string, yamlEnd: number): number;
43
+ export declare function bodyStartOf(content: string): number;
44
+ export declare function bodyAfterFrontmatter(content: string): string;
45
+ export declare function extractFrontmatter(content: string): {
46
+ kind: 'none';
47
+ } | {
48
+ kind: 'unclosed';
49
+ } | {
50
+ kind: 'ok';
51
+ yamlStart: number;
52
+ yamlEnd: number;
53
+ };
54
+ export declare function equalValue(left: unknown, right: unknown): boolean;
55
+ export declare function lineEnding(content: string): '\n' | '\r\n';
@@ -0,0 +1,13 @@
1
+ export type RuntimeDemand = {
2
+ readonly whole: boolean;
3
+ readonly rooms: readonly string[];
4
+ readonly handles: readonly string[];
5
+ readonly conversations: boolean;
6
+ };
7
+ export declare const WHOLE_DEMAND: RuntimeDemand;
8
+ export declare function demanded(demand: RuntimeDemand, room: {
9
+ readonly locator: string;
10
+ readonly handle: string;
11
+ }): boolean;
12
+ export declare function wider(next: RuntimeDemand, current: RuntimeDemand): boolean;
13
+ export declare function narrower(next: RuntimeDemand, current: RuntimeDemand): boolean;
@@ -0,0 +1,475 @@
1
+ import type { ModelResult } from './model.js';
2
+ import type { Open } from './open.js';
3
+ import type { ChangeBatch } from './change.js';
4
+ export type Authorization = object;
5
+ export type MdModelIdentity = {
6
+ identity: string;
7
+ version: string;
8
+ };
9
+ export type TypedSelection = {
10
+ roots: readonly string[];
11
+ };
12
+ export type OperationScopes = {
13
+ read: readonly string[];
14
+ sync: readonly string[];
15
+ write: readonly string[];
16
+ delete: readonly string[];
17
+ };
18
+ export type ReplicaAdmission = {
19
+ selection: string;
20
+ admission: Open<'admitted' | 'unavailable'>;
21
+ };
22
+ export type DiscoveredRoom = {
23
+ name: string;
24
+ locator: string;
25
+ handle: string;
26
+ roomVersion: string;
27
+ operations: OperationScopes;
28
+ replica: ReplicaAdmission;
29
+ typedSelection?: TypedSelection;
30
+ providerOwnedPaths: readonly string[];
31
+ };
32
+ export type Capability = {
33
+ name: string;
34
+ limits?: readonly ProviderLimit[];
35
+ actions?: readonly ActionDeclaration[];
36
+ conversationAgents?: ConversationAgents;
37
+ };
38
+ export type ConversationAgents = {
39
+ locator: string;
40
+ type: string;
41
+ identity: string;
42
+ name: string;
43
+ retired?: string;
44
+ };
45
+ export type ListedConversation = {
46
+ conversation: string;
47
+ agent: string;
48
+ name: string;
49
+ created: string;
50
+ finished: string | null;
51
+ outcome: string | null;
52
+ };
53
+ export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
54
+ export type ConversationMessage = {
55
+ identity: string;
56
+ turn: string;
57
+ text: string;
58
+ message: unknown;
59
+ };
60
+ export type AcceptedMessage = ConversationMessage & {
61
+ position: string;
62
+ };
63
+ export type ConversationHistoryRequest = {
64
+ conversations: readonly {
65
+ conversation: string;
66
+ after?: string;
67
+ }[];
68
+ };
69
+ export type ConversationHistoryPage = {
70
+ conversation: string;
71
+ messages: readonly AcceptedMessage[];
72
+ next?: string;
73
+ };
74
+ export type ConversationHistories = {
75
+ histories: readonly ConversationHistoryPage[];
76
+ };
77
+ export type TurnContext = {
78
+ used: number;
79
+ window: number;
80
+ };
81
+ export type TurnOperation = {
82
+ op: 'begin';
83
+ at: string;
84
+ } | {
85
+ op: 'start';
86
+ index: number;
87
+ part: unknown;
88
+ } | {
89
+ op: 'append';
90
+ index: number;
91
+ text: string;
92
+ } | {
93
+ op: 'status';
94
+ index: number;
95
+ status: string;
96
+ result: unknown;
97
+ } | {
98
+ op: 'count';
99
+ index: number;
100
+ count: number;
101
+ } | {
102
+ op: 'plan';
103
+ index: number;
104
+ entries: readonly unknown[];
105
+ } | ({
106
+ op: 'context';
107
+ } & TurnContext);
108
+ export type ProcessCommand = {
109
+ [field: string]: unknown;
110
+ name: string;
111
+ description: string;
112
+ input?: {
113
+ [field: string]: unknown;
114
+ hint: string;
115
+ } | null;
116
+ };
117
+ type SelectValue = {
118
+ [field: string]: unknown;
119
+ value: string;
120
+ name: string;
121
+ description?: string | null;
122
+ };
123
+ type SelectGroup = {
124
+ [field: string]: unknown;
125
+ group: string;
126
+ name: string;
127
+ options: readonly SelectValue[];
128
+ };
129
+ type SessionOptionNaming = {
130
+ [field: string]: unknown;
131
+ id: string;
132
+ name: string;
133
+ description?: string | null;
134
+ category?: string | null;
135
+ };
136
+ export type SessionOption = (SessionOptionNaming & {
137
+ type: 'select';
138
+ currentValue: string;
139
+ options: readonly SelectValue[] | readonly SelectGroup[];
140
+ }) | (SessionOptionNaming & {
141
+ type: 'boolean';
142
+ currentValue: boolean;
143
+ });
144
+ export type ConversationEvent = {
145
+ kind: 'turn';
146
+ conversation: string;
147
+ turn: string;
148
+ operation: TurnOperation;
149
+ } | {
150
+ kind: 'questions';
151
+ conversation: string;
152
+ questions: readonly unknown[];
153
+ } | {
154
+ kind: 'process';
155
+ conversation: string;
156
+ running: boolean;
157
+ } | {
158
+ kind: 'commands';
159
+ conversation: string;
160
+ commands: readonly ProcessCommand[];
161
+ } | {
162
+ kind: 'options';
163
+ conversation: string;
164
+ options: readonly SessionOption[];
165
+ } | {
166
+ kind: 'accepted-message';
167
+ conversation: string;
168
+ message: AcceptedMessage;
169
+ } | {
170
+ kind: 'gap';
171
+ conversation: string;
172
+ } | {
173
+ kind: 'list';
174
+ entries: readonly ListedConversation[];
175
+ } | {
176
+ kind: 'listed';
177
+ entry: ListedConversation;
178
+ } | {
179
+ kind: 'unlisted';
180
+ conversation: string;
181
+ };
182
+ export type ConversationStream = {
183
+ replicate(conversations: readonly string[]): void;
184
+ observe(notify: (event: ConversationEvent) => void): () => void;
185
+ };
186
+ export type ActionDeclaration = {
187
+ name: string;
188
+ inputShape: unknown;
189
+ resultKind: unknown;
190
+ };
191
+ export type ProviderLimit = {
192
+ name: string;
193
+ value?: number | string;
194
+ };
195
+ export type HistoryRetention = {
196
+ kind: 'duration';
197
+ seconds: number;
198
+ } | {
199
+ kind: 'no-declared-time-bound';
200
+ };
201
+ export type Retention = {
202
+ history: HistoryRetention;
203
+ outcome: number;
204
+ refreshHorizon: number;
205
+ };
206
+ export type Discovery = {
207
+ kind: 'discovery';
208
+ rooms: readonly DiscoveredRoom[];
209
+ capabilities: readonly Capability[];
210
+ providerLimits: readonly ProviderLimit[];
211
+ retention: Retention;
212
+ member?: Member;
213
+ };
214
+ export type TransportUncertainty = {
215
+ kind: 'transport-uncertainty';
216
+ };
217
+ export type RoomNotReadable = {
218
+ kind: 'room-not-readable';
219
+ locator: string;
220
+ };
221
+ export type RevokedAuthorization = {
222
+ kind: 'revoked-authorization';
223
+ };
224
+ export type ProviderRefusal = {
225
+ code: string;
226
+ fields: Readonly<Record<string, unknown>>;
227
+ retryable: boolean;
228
+ };
229
+ export type ScopedRefusal = ProviderRefusal & {
230
+ kind: 'scoped-refusal';
231
+ locator: string;
232
+ scope: Open<'content' | 'sync' | 'model' | 'operation' | 'undisclosed'>;
233
+ };
234
+ export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
235
+ export type ContractUnavailable = ProviderRefusal & {
236
+ kind: 'contract-unavailable';
237
+ };
238
+ export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
239
+ export type PageToken = string;
240
+ export type ChangeAuthor = {
241
+ kind: Open<'user' | 'site'>;
242
+ id: string;
243
+ name: string;
244
+ };
245
+ export type Member = {
246
+ kind: Open<'user'>;
247
+ id: string;
248
+ name: string;
249
+ };
250
+ export type HeadChange = {
251
+ author: ChangeAuthor | null;
252
+ time: string;
253
+ };
254
+ export type BinaryFile = {
255
+ fileRef: string;
256
+ byteLength: number;
257
+ mediaType: string;
258
+ sha256: string;
259
+ };
260
+ export type HeldContent = {
261
+ documents: Readonly<Record<string, string>>;
262
+ revisions: Readonly<Record<string, string>>;
263
+ };
264
+ export type BootstrapRequest = {
265
+ locator: string;
266
+ selection: string;
267
+ pageToken?: PageToken;
268
+ held?: HeldContent;
269
+ };
270
+ export type RoomModels = {
271
+ collection?: ModelResult;
272
+ selection?: ModelResult;
273
+ };
274
+ export type BootstrapPage = {
275
+ kind: 'bootstrap';
276
+ roomVersion: string;
277
+ models?: RoomModels;
278
+ documents: Readonly<Record<string, string>>;
279
+ revisions: Readonly<Record<string, string>>;
280
+ changes: Readonly<Record<string, HeadChange>>;
281
+ binaryFiles: Readonly<Record<string, BinaryFile>>;
282
+ pageToken?: PageToken;
283
+ };
284
+ export type BootstrapResult = BootstrapPage | {
285
+ kind: 'beyond-horizon';
286
+ } | AdapterFailure;
287
+ export type RefreshRequest = {
288
+ locator: string;
289
+ selection: string;
290
+ fromRoomVersion: string;
291
+ pageToken?: PageToken;
292
+ };
293
+ export type RefreshPage = {
294
+ kind: 'net-advancement';
295
+ roomVersion: string;
296
+ models?: RoomModels;
297
+ documents: Readonly<Record<string, string>>;
298
+ revisions: Readonly<Record<string, string>>;
299
+ changes: Readonly<Record<string, HeadChange>>;
300
+ binaryFiles: Readonly<Record<string, BinaryFile>>;
301
+ removals: readonly string[];
302
+ pageToken?: PageToken;
303
+ };
304
+ export type RefreshResult = {
305
+ kind: 'still-current';
306
+ } | RefreshPage | {
307
+ kind: 'beyond-horizon';
308
+ } | RetryableRefusal | AdapterFailure;
309
+ export type MutationRequest = {
310
+ locator: string;
311
+ changeBatch: ChangeBatch;
312
+ upload?: unknown;
313
+ };
314
+ export type RetryableRefusal = ProviderRefusal & {
315
+ kind: 'retryable-refusal';
316
+ reset?: string;
317
+ };
318
+ export type ServiceMode = Open<'open' | 'write-halted'>;
319
+ export type ServiceModeSignal = {
320
+ observe(notify: (mode: ServiceMode) => void): () => void;
321
+ };
322
+ export type MutationResult = {
323
+ kind: 'accepted';
324
+ roomVersion: string;
325
+ documents: Readonly<Record<string, string>>;
326
+ revisions: Readonly<Record<string, string>>;
327
+ changes: Readonly<Record<string, HeadChange>>;
328
+ removals: readonly string[];
329
+ binaryFiles?: Readonly<Record<string, BinaryFile>>;
330
+ author?: string;
331
+ time?: string;
332
+ } | (ProviderRefusal & {
333
+ kind: 'conflicted';
334
+ roomVersion?: string;
335
+ affected: Readonly<Record<string, string>>;
336
+ }) | (ProviderRefusal & {
337
+ kind: 'rejected';
338
+ affected: Readonly<Record<string, string>>;
339
+ }) | RetryableRefusal | {
340
+ kind: 'write-halted';
341
+ } | {
342
+ kind: 'expired';
343
+ restored?: true;
344
+ } | AdapterFailure;
345
+ export type HistoryAuthor = {
346
+ kind: 'user';
347
+ id: string;
348
+ } | {
349
+ kind: 'site';
350
+ id: string;
351
+ name: string;
352
+ };
353
+ export type HistoryRevision = {
354
+ revision: string;
355
+ author: HistoryAuthor;
356
+ time: string;
357
+ binaryFile?: BinaryFile;
358
+ };
359
+ export type HistoryRequest = {
360
+ locator: string;
361
+ path: string;
362
+ revision?: string;
363
+ pageToken?: PageToken;
364
+ };
365
+ export type HistoryResult = {
366
+ kind: 'history';
367
+ revisions: readonly HistoryRevision[];
368
+ pageToken?: PageToken;
369
+ deleted?: true;
370
+ } | {
371
+ kind: 'revision';
372
+ content: string;
373
+ } | {
374
+ kind: 'no-history';
375
+ } | AdapterFailure;
376
+ export type BinaryRequest = {
377
+ kind: 'path';
378
+ locator: string;
379
+ path: string;
380
+ revision: string;
381
+ fileRef?: string;
382
+ } | {
383
+ kind: 'reference';
384
+ fileRef: string;
385
+ referrer: unknown;
386
+ };
387
+ export type ReferrerScope = {
388
+ kind: 'room';
389
+ locator: string;
390
+ path?: string;
391
+ } | {
392
+ kind: 'conversations';
393
+ };
394
+ export type BinaryResult = {
395
+ kind: 'binary';
396
+ blob: Blob;
397
+ } | (ProviderRefusal & {
398
+ kind: 'rejected';
399
+ }) | AdapterFailure;
400
+ export type ActionRequest = {
401
+ name: string;
402
+ input: unknown;
403
+ };
404
+ export type RoomVersionAt = {
405
+ locator: string;
406
+ roomVersion: string;
407
+ };
408
+ export type ActionResult = {
409
+ kind: 'action';
410
+ result: unknown;
411
+ at?: RoomVersionAt;
412
+ } | (ProviderRefusal & {
413
+ kind: 'rejected';
414
+ }) | AdapterFailure;
415
+ export type HeldRoom = {
416
+ locator: string;
417
+ roomVersion: string;
418
+ documents: Readonly<Record<string, string>>;
419
+ revisions: Readonly<Record<string, string>>;
420
+ };
421
+ export type RoomStreamEvent = {
422
+ kind: 'opened';
423
+ } | {
424
+ kind: 'closed';
425
+ revoked: boolean;
426
+ } | {
427
+ kind: 'opening';
428
+ expired: readonly string[];
429
+ } | {
430
+ kind: 'room-version';
431
+ locator: string;
432
+ roomVersion: string;
433
+ };
434
+ export type KeptReceipt = {
435
+ key: string;
436
+ head: unknown;
437
+ };
438
+ export type StreamReceipts = {
439
+ heads(): Promise<readonly KeptReceipt[]>;
440
+ parts(key: string, count: number): Promise<readonly unknown[]>;
441
+ keep(key: string, head: unknown, part?: {
442
+ index: number;
443
+ value: unknown;
444
+ }): Promise<void>;
445
+ drop(keys: readonly string[]): Promise<void>;
446
+ };
447
+ export type AcquiredDemand = {
448
+ rooms: readonly string[];
449
+ conversations: boolean;
450
+ };
451
+ export type RoomStream = {
452
+ hold(rooms: readonly HeldRoom[], demand: AcquiredDemand | null): void;
453
+ reopen(): void;
454
+ published(locator: string, roomVersion: string): void;
455
+ observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
456
+ };
457
+ export type Adapter = {
458
+ readonly localSaves?: true;
459
+ readonly exhaustiveDiscovery?: true;
460
+ authorize(): Promise<Authorization>;
461
+ discover(authorization: Authorization): Promise<DiscoverResult>;
462
+ bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
463
+ refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
464
+ mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
465
+ history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
466
+ binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
467
+ referrerScope(referrer: unknown): ReferrerScope | null;
468
+ action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
469
+ reached(locator: string, roomVersion: string, target: string): boolean;
470
+ follows(locator: string, roomVersion: string, next: string): boolean;
471
+ roomStream?: RoomStream;
472
+ conversations?: ConversationStream;
473
+ serviceMode?: ServiceModeSignal;
474
+ };
475
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { HeldBinary } from './overlay.js';
2
+ export type BinaryFileRecord = {
3
+ readonly state: 'accepted';
4
+ readonly revision: string;
5
+ readonly path: string;
6
+ readonly fileRef: string;
7
+ readonly byteLength: number;
8
+ readonly mediaType: string;
9
+ readonly sha256: string;
10
+ } | {
11
+ readonly state: 'pending';
12
+ readonly localId: string;
13
+ readonly path: string;
14
+ readonly byteLength: number;
15
+ readonly mediaType: string;
16
+ readonly sha256: string;
17
+ };
18
+ export type BinaryReference = {
19
+ readonly fileRef: string;
20
+ readonly referrer: unknown;
21
+ };
22
+ export declare function binaryRecord(path: string, held: HeldBinary, revision: string | undefined): BinaryFileRecord;
@@ -0,0 +1,34 @@
1
+ import { type Replica } from './replica.js';
2
+ import { type Row } from './rows.js';
3
+ export type DocumentChange = {
4
+ locator: string;
5
+ path: string;
6
+ before: readonly Row[];
7
+ after: readonly Row[];
8
+ };
9
+ export type MessageChange = {
10
+ conversation: string;
11
+ identity: string;
12
+ text: string | null;
13
+ };
14
+ export type ChangeSet = {
15
+ documents: readonly DocumentChange[];
16
+ drafts: readonly {
17
+ locator: string;
18
+ path: string;
19
+ }[];
20
+ rooms: readonly string[];
21
+ queues: readonly string[];
22
+ presentations: readonly string[];
23
+ messages: readonly MessageChange[];
24
+ conversations: readonly string[];
25
+ };
26
+ export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: {
27
+ drafts?: readonly string[];
28
+ room?: boolean;
29
+ queue?: boolean;
30
+ presentation?: string;
31
+ }): ChangeSet;
32
+ export declare function entering(locator: string, replica: Replica, paths: readonly string[]): ChangeSet;
33
+ export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
34
+ export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
@@ -0,0 +1,88 @@
1
+ export type Change = {
2
+ readonly kind: 'field';
3
+ readonly path: string;
4
+ readonly name: string;
5
+ readonly value: unknown;
6
+ } | {
7
+ readonly kind: 'section';
8
+ readonly path: string;
9
+ readonly name: string;
10
+ readonly value: string;
11
+ } | {
12
+ readonly kind: 'preamble';
13
+ readonly path: string;
14
+ readonly value: string;
15
+ } | {
16
+ readonly kind: 'create';
17
+ readonly path: string;
18
+ readonly fields: Readonly<Record<string, unknown>>;
19
+ readonly sections: Readonly<Record<string, string>>;
20
+ } | {
21
+ readonly kind: 'create';
22
+ readonly path: string;
23
+ readonly content: string;
24
+ } | {
25
+ readonly kind: 'replace';
26
+ readonly path: string;
27
+ readonly content: string;
28
+ } | {
29
+ readonly kind: 'binary';
30
+ readonly path: string;
31
+ readonly localId: string;
32
+ readonly blob: Blob;
33
+ readonly byteLength: number;
34
+ readonly mediaType: string;
35
+ readonly sha256: string;
36
+ } | {
37
+ readonly kind: 'move';
38
+ readonly path: string;
39
+ readonly to: string;
40
+ } | {
41
+ readonly kind: 'remove';
42
+ readonly path: string;
43
+ };
44
+ export type Precondition = {
45
+ readonly kind: 'field';
46
+ readonly path: string;
47
+ readonly name: string;
48
+ readonly value: unknown;
49
+ } | {
50
+ readonly kind: 'section';
51
+ readonly path: string;
52
+ readonly name: string;
53
+ readonly value: string;
54
+ } | {
55
+ readonly kind: 'preamble';
56
+ readonly path: string;
57
+ readonly value: string;
58
+ } | {
59
+ readonly kind: 'revision';
60
+ readonly path: string;
61
+ readonly revision: string;
62
+ } | {
63
+ readonly kind: 'content';
64
+ readonly path: string;
65
+ readonly content: string;
66
+ } | {
67
+ readonly kind: 'present';
68
+ readonly path: string;
69
+ } | {
70
+ readonly kind: 'absent';
71
+ readonly path: string;
72
+ };
73
+ export type WrittenBy = {
74
+ readonly app: string;
75
+ readonly release: string;
76
+ };
77
+ export type ChangeBatch = {
78
+ validation?: import('./model.js').ValidationReceipt;
79
+ readonly id: string;
80
+ readonly baseRoomVersion: string;
81
+ readonly changes: readonly Change[];
82
+ readonly preconditions: readonly Precondition[];
83
+ readonly writtenBy?: WrittenBy;
84
+ };
85
+ export declare function immutable(batch: ChangeBatch): ChangeBatch;
86
+ export declare function landing(changes: readonly Change[], index: number, path: string): string | null;
87
+ export declare function departure(changes: readonly Change[], index: number): string;
88
+ export declare function queuedFile(batch: ChangeBatch, path: string, localId: string): number;