@agentshouse/app-bridge 0.1.0-cfb240c3fb89d → 0.1.0-cfbb2e428ff88

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 (63) hide show
  1. package/README.md +11 -11
  2. package/dist/index.d.ts +865 -8
  3. package/dist/mdmodel/definition.d.ts +17 -1
  4. package/dist/mdmodel/document.d.ts +5 -5
  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 +23 -9
  8. package/dist/mdmodel/kinds.d.ts +18 -0
  9. package/dist/mdmodel/links.d.ts +28 -0
  10. package/dist/mdmodel/paths.d.ts +9 -1
  11. package/dist/mdmodel/project.d.ts +1 -0
  12. package/dist/mdmodel/query/language.d.ts +222 -0
  13. package/dist/mdmodel/query/match.d.ts +13 -0
  14. package/dist/mdmodel/query/rows.d.ts +31 -0
  15. package/dist/mdmodel/query/sql.d.ts +38 -0
  16. package/dist/mdmodel/reserved.d.ts +4 -0
  17. package/dist/mdmodel/types.d.ts +35 -4
  18. package/dist/mdmodel/validate.d.ts +29 -4
  19. package/dist/mdruntime/adapter.d.ts +147 -74
  20. package/dist/mdruntime/binary.d.ts +0 -5
  21. package/dist/mdruntime/chain.d.ts +11 -0
  22. package/dist/mdruntime/change-set.d.ts +9 -16
  23. package/dist/mdruntime/change.d.ts +31 -1
  24. package/dist/mdruntime/client.d.ts +27 -11
  25. package/dist/mdruntime/collection.d.ts +11 -21
  26. package/dist/mdruntime/compile.d.ts +10 -0
  27. package/dist/mdruntime/connection.d.ts +41 -14
  28. package/dist/mdruntime/conversation.d.ts +32 -15
  29. package/dist/mdruntime/durability.d.ts +10 -1
  30. package/dist/mdruntime/identity.d.ts +5 -0
  31. package/dist/mdruntime/media.d.ts +7 -0
  32. package/dist/mdruntime/messages.d.ts +27 -0
  33. package/dist/mdruntime/model.d.ts +11 -10
  34. package/dist/mdruntime/observation.d.ts +17 -2
  35. package/dist/mdruntime/opened.d.ts +21 -0
  36. package/dist/mdruntime/outcome.d.ts +45 -7
  37. package/dist/mdruntime/overlay.d.ts +3 -5
  38. package/dist/mdruntime/query.d.ts +17 -185
  39. package/dist/mdruntime/reach.d.ts +18 -6
  40. package/dist/mdruntime/readiness.d.ts +49 -0
  41. package/dist/mdruntime/recovery.d.ts +3 -2
  42. package/dist/mdruntime/replica.d.ts +58 -33
  43. package/dist/mdruntime/room-draft.d.ts +37 -6
  44. package/dist/mdruntime/save.d.ts +53 -14
  45. package/dist/mdruntime/search.d.ts +15 -77
  46. package/dist/mdruntime/seed.d.ts +15 -0
  47. package/dist/mdruntime/status.d.ts +5 -0
  48. package/dist/mdruntime/store.d.ts +93 -94
  49. package/dist/mdruntime/stored.d.ts +128 -0
  50. package/dist/mdruntime/tables.d.ts +326 -0
  51. package/dist/mdruntime/wire.d.ts +173 -32
  52. package/dist/test-host.d.ts +7 -1
  53. package/dist/test-host.js +19 -1
  54. package/docs/families.md +66 -12
  55. package/package.json +8 -3
  56. package/dist/calls.d.ts +0 -117
  57. package/dist/calls.js +0 -1
  58. package/dist/mdmodel/condition.d.ts +0 -149
  59. package/dist/mdruntime/file.d.ts +0 -19
  60. package/dist/mdruntime/rows.d.ts +0 -36
  61. package/dist/mdruntime/shared.d.ts +0 -10
  62. package/dist/mdruntime/transfer.d.ts +0 -9
  63. package/dist/mdruntime/turn.d.ts +0 -6
@@ -2,6 +2,7 @@ import type { Definition } from './definition.js';
2
2
  export type Library = Readonly<Record<string, string>>;
3
3
  export type VerifiedModel = {
4
4
  readonly types: Readonly<Record<string, Definition>>;
5
+ readonly nameable?: readonly string[];
5
6
  };
6
7
  export type ModelVerification = {
7
8
  readonly verdict: 'accept';
@@ -11,15 +12,23 @@ export type ModelVerification = {
11
12
  readonly rule: string;
12
13
  readonly location?: string;
13
14
  };
15
+ export type TypedPath = {
16
+ readonly path: string;
17
+ readonly type: string;
18
+ readonly named: boolean;
19
+ readonly body: boolean;
20
+ };
14
21
  export type ValidationContext = {
15
22
  readonly binaryTargets: readonly string[];
23
+ readonly anyRoom?: true;
24
+ readonly typedPaths?: readonly TypedPath[];
16
25
  };
17
26
  export type ProjectionContext = {
18
27
  readonly documentTargets: readonly string[];
19
28
  readonly definition?: Definition;
20
29
  };
21
30
  export type DivisionContext = ProjectionContext & {
22
- readonly budget: number;
31
+ readonly bound: number;
23
32
  };
24
33
  export type Extent = {
25
34
  readonly start: number;
@@ -60,6 +69,10 @@ export type Validation = {
60
69
  } | ({
61
70
  readonly verdict: 'refuse';
62
71
  } & Refusal);
72
+ export type ValidationStep = {
73
+ readonly path: string;
74
+ readonly resolved: number;
75
+ };
63
76
  export type Projection = {
64
77
  readonly ok: true;
65
78
  readonly text: string;
@@ -92,14 +105,31 @@ export type Link = {
92
105
  readonly href: string;
93
106
  readonly target: string;
94
107
  };
95
- export type LinkOccurrence = Link & {
96
- readonly start: number;
97
- };
98
108
  export type Reference = {
99
109
  readonly pointer: string;
100
110
  readonly value: string;
101
111
  readonly to: readonly string[];
112
+ readonly crossRoom?: true;
102
113
  };
114
+ export type RoomReference = {
115
+ readonly handle: string;
116
+ readonly path: string;
117
+ } & ({
118
+ readonly kind: 'link';
119
+ readonly href: string;
120
+ } | {
121
+ readonly kind: 'field';
122
+ readonly pointer: string;
123
+ readonly value: string;
124
+ readonly to: readonly string[];
125
+ readonly crossRoom?: true;
126
+ } | {
127
+ readonly kind: 'item';
128
+ readonly section: string;
129
+ readonly href: string;
130
+ readonly to: readonly string[];
131
+ readonly crossRoom?: true;
132
+ });
103
133
  export type Change = {
104
134
  readonly kind: 'field';
105
135
  readonly name: string;
@@ -130,6 +160,7 @@ export type ApplyResult = {
130
160
  } | {
131
161
  readonly outcome: 'stale';
132
162
  readonly document: Document;
163
+ readonly stale: readonly number[];
133
164
  } | {
134
165
  readonly outcome: 'refuse';
135
166
  readonly refusal: Refusal;
@@ -1,7 +1,32 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { DocumentCheck, Library, ModelVerification, Reached, Validation, ValidationContext, VerifiedModel } from './types.js';
2
+ import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
3
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
4
- export declare function verify(schema: string): ModelVerification;
5
- export declare function checkDocument(file: string, content: string, model: VerifiedModel): DocumentCheck;
6
- export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
4
+ export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
5
+ export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
6
+ type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
7
+ export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
8
+ export declare function bodyRoomLinks(body: string): RoomReference[];
9
+ export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
10
+ type Placed = {
11
+ readonly reference: Reached;
12
+ readonly location: string;
13
+ };
14
+ export type Assessment = {
15
+ readonly file: string;
16
+ readonly type: string | undefined;
17
+ readonly targets: readonly string[];
18
+ readonly read: Validation | null;
19
+ readonly structured: Validation | null;
20
+ readonly fields: readonly Placed[];
21
+ readonly linked: boolean;
22
+ readonly sections: readonly Placed[];
23
+ };
24
+ export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
25
+ export type Verdicts = {
26
+ add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
27
+ verdict(): Validation;
28
+ };
29
+ export declare function verdicts(): Verdicts;
30
+ export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
7
31
  export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
32
+ export {};
@@ -1,4 +1,6 @@
1
+ import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
1
2
  import type { ModelResult } from './model.js';
3
+ export type { SavedFacts, TypedPath };
2
4
  import type { Open } from './open.js';
3
5
  import type { ChangeBatch } from './change.js';
4
6
  export type Authorization = object;
@@ -10,14 +12,13 @@ export type TypedSelection = {
10
12
  roots: readonly string[];
11
13
  };
12
14
  export type OperationScopes = {
13
- read: readonly string[];
14
- sync: readonly string[];
15
15
  write: readonly string[];
16
16
  delete: readonly string[];
17
17
  };
18
18
  export type ReplicaAdmission = {
19
19
  selection: string;
20
20
  admission: Open<'admitted' | 'unavailable'>;
21
+ offline: Open<'locked' | 'open'>;
21
22
  };
22
23
  export type DiscoveredRoom = {
23
24
  name: string;
@@ -33,24 +34,21 @@ export type Capability = {
33
34
  name: string;
34
35
  limits?: readonly ProviderLimit[];
35
36
  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
37
  };
45
38
  export type ListedConversation = {
46
39
  conversation: string;
47
40
  agent: string;
41
+ agentName: string;
42
+ agentRetired: boolean;
48
43
  name: string;
49
44
  created: string;
50
45
  finished: string | null;
51
46
  outcome: string | null;
47
+ waiting: boolean;
48
+ newest: string | null;
49
+ processEnded: string | null;
52
50
  };
53
- export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
51
+ export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
54
52
  export type ConversationMessage = {
55
53
  identity: string;
56
54
  turn: string;
@@ -141,6 +139,10 @@ export type SessionOption = (SessionOptionNaming & {
141
139
  type: 'boolean';
142
140
  currentValue: boolean;
143
141
  });
142
+ export type RunningSubagent = {
143
+ description: string;
144
+ activity: string | null;
145
+ };
144
146
  export type ConversationEvent = {
145
147
  kind: 'turn';
146
148
  conversation: string;
@@ -162,6 +164,22 @@ export type ConversationEvent = {
162
164
  kind: 'options';
163
165
  conversation: string;
164
166
  options: readonly SessionOption[];
167
+ } | {
168
+ kind: 'starting';
169
+ conversation: string;
170
+ step: string | null;
171
+ } | {
172
+ kind: 'subagents';
173
+ conversation: string;
174
+ subagents: readonly RunningSubagent[];
175
+ } | {
176
+ kind: 'link';
177
+ conversation: string;
178
+ connected: boolean;
179
+ } | {
180
+ kind: 'deliveries';
181
+ conversation: string;
182
+ unknown: readonly string[];
165
183
  } | {
166
184
  kind: 'accepted-message';
167
185
  conversation: string;
@@ -172,6 +190,9 @@ export type ConversationEvent = {
172
190
  } | {
173
191
  kind: 'list';
174
192
  entries: readonly ListedConversation[];
193
+ whole: boolean;
194
+ more: boolean;
195
+ cursor: string | null;
175
196
  } | {
176
197
  kind: 'listed';
177
198
  entry: ListedConversation;
@@ -179,14 +200,23 @@ export type ConversationEvent = {
179
200
  kind: 'unlisted';
180
201
  conversation: string;
181
202
  };
203
+ export type ListedAgent = {
204
+ agent: string;
205
+ name: string;
206
+ retired: boolean;
207
+ };
182
208
  export type ConversationStream = {
183
209
  replicate(conversations: readonly string[]): void;
210
+ hold(cursor: string | null): void;
184
211
  observe(notify: (event: ConversationEvent) => void): () => void;
212
+ agents?(): Promise<readonly ListedAgent[] | null>;
213
+ history?(request: ConversationHistoryRequest): Promise<ActionResult>;
185
214
  };
186
215
  export type ActionDeclaration = {
187
216
  name: string;
188
217
  inputShape: unknown;
189
218
  resultKind: unknown;
219
+ room?: string;
190
220
  };
191
221
  export type ProviderLimit = {
192
222
  name: string;
@@ -200,7 +230,6 @@ export type HistoryRetention = {
200
230
  };
201
231
  export type Retention = {
202
232
  history: HistoryRetention;
203
- outcome: number;
204
233
  refreshHorizon: number;
205
234
  };
206
235
  export type Discovery = {
@@ -229,7 +258,7 @@ export type ProviderRefusal = {
229
258
  export type ScopedRefusal = ProviderRefusal & {
230
259
  kind: 'scoped-refusal';
231
260
  locator: string;
232
- scope: Open<'content' | 'sync' | 'model' | 'operation' | 'undisclosed'>;
261
+ scope: Open<'content' | 'model' | 'operation' | 'undisclosed'>;
233
262
  };
234
263
  export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
235
264
  export type ContractUnavailable = ProviderRefusal & {
@@ -238,50 +267,62 @@ export type ContractUnavailable = ProviderRefusal & {
238
267
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
239
268
  export type PageToken = string;
240
269
  export type ChangeAuthor = {
241
- kind: 'user';
270
+ kind: Open<'user' | 'site' | 'inbox' | 'app'>;
242
271
  id: string;
243
272
  name: string;
244
- } | {
245
- kind: 'site';
273
+ };
274
+ export type Member = {
275
+ kind: Open<'user'>;
246
276
  id: string;
247
277
  name: string;
248
278
  };
249
- export type Member = Extract<ChangeAuthor, {
250
- kind: 'user';
251
- }>;
252
279
  export type HeadChange = {
253
280
  author: ChangeAuthor | null;
254
281
  time: string;
255
282
  };
256
283
  export type BinaryFile = {
257
- fileRef: string;
258
284
  byteLength: number;
259
285
  mediaType: string;
260
286
  sha256: string;
261
287
  };
288
+ export type HeldFile = {
289
+ readonly path: string;
290
+ readonly revision: string;
291
+ };
262
292
  export type HeldContent = {
263
- documents: Readonly<Record<string, string>>;
264
- revisions: Readonly<Record<string, string>>;
293
+ files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
294
+ contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
295
+ readonly content: string;
296
+ readonly revision: string;
297
+ }>>;
265
298
  };
266
299
  export type BootstrapRequest = {
267
300
  locator: string;
268
301
  selection: string;
269
302
  pageToken?: PageToken;
270
303
  held?: HeldContent;
304
+ arriving?: (bytes: number) => void;
305
+ signal?: AbortSignal;
306
+ };
307
+ export type BootstrapInventory = {
308
+ readonly bytes: number;
271
309
  };
272
310
  export type RoomModels = {
273
311
  collection?: ModelResult;
274
- selection?: ModelResult;
275
312
  };
276
313
  export type BootstrapPage = {
277
314
  kind: 'bootstrap';
278
315
  roomVersion: string;
279
316
  models?: RoomModels;
280
317
  documents: Readonly<Record<string, string>>;
318
+ facts: Readonly<Record<string, SavedFacts>>;
281
319
  revisions: Readonly<Record<string, string>>;
320
+ fileIds?: Readonly<Record<string, string>>;
282
321
  changes: Readonly<Record<string, HeadChange>>;
283
322
  binaryFiles: Readonly<Record<string, BinaryFile>>;
323
+ folders?: readonly string[];
284
324
  pageToken?: PageToken;
325
+ bytes?: number;
285
326
  };
286
327
  export type BootstrapResult = BootstrapPage | {
287
328
  kind: 'beyond-horizon';
@@ -297,10 +338,14 @@ export type RefreshPage = {
297
338
  roomVersion: string;
298
339
  models?: RoomModels;
299
340
  documents: Readonly<Record<string, string>>;
341
+ facts: Readonly<Record<string, SavedFacts>>;
300
342
  revisions: Readonly<Record<string, string>>;
343
+ fileIds?: Readonly<Record<string, string>>;
301
344
  changes: Readonly<Record<string, HeadChange>>;
302
345
  binaryFiles: Readonly<Record<string, BinaryFile>>;
303
346
  removals: readonly string[];
347
+ folders?: readonly string[];
348
+ folderRemovals?: readonly string[];
304
349
  pageToken?: PageToken;
305
350
  };
306
351
  export type RefreshResult = {
@@ -311,6 +356,7 @@ export type RefreshResult = {
311
356
  export type MutationRequest = {
312
357
  locator: string;
313
358
  changeBatch: ChangeBatch;
359
+ file(localId: string): Promise<Blob>;
314
360
  upload?: unknown;
315
361
  };
316
362
  export type RetryableRefusal = ProviderRefusal & {
@@ -321,17 +367,21 @@ export type ServiceMode = Open<'open' | 'write-halted'>;
321
367
  export type ServiceModeSignal = {
322
368
  observe(notify: (mode: ServiceMode) => void): () => void;
323
369
  };
324
- export type MutationResult = {
325
- kind: 'accepted';
370
+ export type AcceptedRoom = {
326
371
  roomVersion: string;
327
372
  documents: Readonly<Record<string, string>>;
328
373
  revisions: Readonly<Record<string, string>>;
374
+ fileIds?: Readonly<Record<string, string>>;
329
375
  changes: Readonly<Record<string, HeadChange>>;
330
376
  removals: readonly string[];
331
377
  binaryFiles?: Readonly<Record<string, BinaryFile>>;
378
+ };
379
+ export type MutationResult = (AcceptedRoom & {
380
+ kind: 'accepted';
332
381
  author?: string;
333
382
  time?: string;
334
- } | (ProviderRefusal & {
383
+ destination?: AcceptedRoom;
384
+ }) | (ProviderRefusal & {
335
385
  kind: 'conflicted';
336
386
  roomVersion?: string;
337
387
  affected: Readonly<Record<string, string>>;
@@ -340,15 +390,9 @@ export type MutationResult = {
340
390
  affected: Readonly<Record<string, string>>;
341
391
  }) | RetryableRefusal | {
342
392
  kind: 'write-halted';
343
- } | {
344
- kind: 'expired';
345
- restored?: true;
346
393
  } | AdapterFailure;
347
394
  export type HistoryAuthor = {
348
- kind: 'user';
349
- id: string;
350
- } | {
351
- kind: 'site';
395
+ kind: 'user' | 'site' | 'inbox' | 'app';
352
396
  id: string;
353
397
  name: string;
354
398
  };
@@ -380,22 +424,35 @@ export type BinaryRequest = {
380
424
  locator: string;
381
425
  path: string;
382
426
  revision: string;
383
- fileRef?: string;
384
- } | {
385
- kind: 'reference';
386
- fileRef: string;
387
- referrer: unknown;
388
- };
389
- export type ReferrerScope = {
390
- kind: 'room';
391
- locator: string;
392
- path?: string;
393
- } | {
394
- kind: 'conversations';
395
427
  };
396
428
  export type BinaryResult = {
397
429
  kind: 'binary';
430
+ body: ReadableStream<Uint8Array>;
431
+ mediaType: string;
432
+ sha256?: string;
433
+ } | (ProviderRefusal & {
434
+ kind: 'rejected';
435
+ }) | AdapterFailure;
436
+ export type BinaryLinkResult = {
437
+ kind: 'link';
438
+ url: string;
439
+ name: string;
440
+ mediaType?: string;
441
+ } | (ProviderRefusal & {
442
+ kind: 'rejected';
443
+ }) | AdapterFailure;
444
+ export type AttachRequest = {
445
+ locator: string;
446
+ name: string;
447
+ mediaType: string;
448
+ byteLength: number;
449
+ sha256: string;
398
450
  blob: Blob;
451
+ };
452
+ export type AttachResult = {
453
+ kind: 'attached';
454
+ path: string;
455
+ revision: string;
399
456
  } | (ProviderRefusal & {
400
457
  kind: 'rejected';
401
458
  }) | AdapterFailure;
@@ -414,60 +471,76 @@ export type ActionResult = {
414
471
  } | (ProviderRefusal & {
415
472
  kind: 'rejected';
416
473
  }) | AdapterFailure;
474
+ export type SearchHit = {
475
+ room: string;
476
+ path: string;
477
+ line?: number;
478
+ snippet?: string;
479
+ };
480
+ export type SearchAsk = {
481
+ text: string;
482
+ rooms: readonly string[] | null;
483
+ };
484
+ export type SearchAnswer = {
485
+ kind: 'found';
486
+ documents: readonly SearchHit[];
487
+ } | (ProviderRefusal & {
488
+ kind: 'rejected';
489
+ }) | AdapterFailure;
417
490
  export type HeldRoom = {
418
491
  locator: string;
419
492
  roomVersion: string;
420
- documents: Readonly<Record<string, string>>;
421
- revisions: Readonly<Record<string, string>>;
493
+ };
494
+ export type RoomChange = {
495
+ kind: 'room-change';
496
+ locator: string;
497
+ from: string;
498
+ roomVersion: string;
499
+ read(): Promise<RefreshPage>;
500
+ };
501
+ export type AuthorityChange = {
502
+ kind: 'authority-changed';
503
+ rooms: readonly DiscoveredRoom[];
504
+ left: readonly string[];
505
+ member?: Member;
422
506
  };
423
507
  export type RoomStreamEvent = {
424
508
  kind: 'opened';
509
+ } | {
510
+ kind: 'discovered';
511
+ discovery: Discovery;
425
512
  } | {
426
513
  kind: 'closed';
427
514
  revoked: boolean;
515
+ lost: boolean;
516
+ authorityChanged: boolean;
428
517
  } | {
429
- kind: 'opening';
518
+ kind: 'caught-up';
430
519
  expired: readonly string[];
431
- } | {
432
- kind: 'room-version';
433
- locator: string;
434
- roomVersion: string;
435
- };
436
- export type KeptReceipt = {
437
- key: string;
438
- head: unknown;
439
- };
440
- export type StreamReceipts = {
441
- heads(): Promise<readonly KeptReceipt[]>;
442
- parts(key: string, count: number): Promise<readonly unknown[]>;
443
- keep(key: string, head: unknown, part?: {
444
- index: number;
445
- value: unknown;
446
- }): Promise<void>;
447
- drop(keys: readonly string[]): Promise<void>;
448
- };
520
+ } | AuthorityChange | RoomChange;
449
521
  export type RoomStream = {
450
522
  hold(rooms: readonly HeldRoom[]): void;
451
- reopen(): void;
452
- published(locator: string, roomVersion: string): void;
453
- observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
523
+ observe(notify: (event: RoomStreamEvent) => void): () => void;
454
524
  };
455
525
  export type Adapter = {
456
526
  readonly localSaves?: true;
457
- readonly exhaustiveDiscovery?: true;
527
+ readonly roomTypes?: string;
528
+ readonly nameableRoomTypes?: readonly string[];
529
+ readonly typedPaths?: readonly TypedPath[];
458
530
  authorize(): Promise<Authorization>;
459
- discover(authorization: Authorization): Promise<DiscoverResult>;
531
+ discover?(authorization: Authorization): Promise<DiscoverResult>;
460
532
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
461
- refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
533
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
462
534
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
463
535
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
464
536
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
465
- referrerScope(referrer: unknown): ReferrerScope | null;
537
+ link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
538
+ attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
466
539
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
540
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
467
541
  reached(locator: string, roomVersion: string, target: string): boolean;
468
542
  follows(locator: string, roomVersion: string, next: string): boolean;
469
543
  roomStream?: RoomStream;
470
544
  conversations?: ConversationStream;
471
545
  serviceMode?: ServiceModeSignal;
472
546
  };
473
- export {};
@@ -3,7 +3,6 @@ export type BinaryFileRecord = {
3
3
  readonly state: 'accepted';
4
4
  readonly revision: string;
5
5
  readonly path: string;
6
- readonly fileRef: string;
7
6
  readonly byteLength: number;
8
7
  readonly mediaType: string;
9
8
  readonly sha256: string;
@@ -15,8 +14,4 @@ export type BinaryFileRecord = {
15
14
  readonly mediaType: string;
16
15
  readonly sha256: string;
17
16
  };
18
- export type BinaryReference = {
19
- readonly fileRef: string;
20
- readonly referrer: unknown;
21
- };
22
17
  export declare function binaryRecord(path: string, held: HeldBinary, revision: string | undefined): BinaryFileRecord;
@@ -0,0 +1,11 @@
1
+ import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
2
+ import type { MdRuntimeClient } from './client.js';
3
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
4
+ type Rows = DocumentResult | GroupResult;
5
+ export type WindowAnswer = Rows | PendingResult;
6
+ export type WindowChain = {
7
+ want(count: number): void;
8
+ close(): void;
9
+ };
10
+ export declare function chainedWindows(runtime: MdRuntimeClient, query: DocumentQuery | GroupQuery, count: number, publish: (answers: readonly (WindowAnswer | null)[], settled: boolean) => void): WindowChain;
11
+ export {};
@@ -1,15 +1,6 @@
1
- import { type Replica } from './replica.js';
2
- import { type Row } from './rows.js';
3
1
  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;
2
+ readonly locator: string;
3
+ readonly path: string | null;
13
4
  };
14
5
  export type ChangeSet = {
15
6
  documents: readonly DocumentChange[];
@@ -20,15 +11,17 @@ export type ChangeSet = {
20
11
  rooms: readonly string[];
21
12
  queues: readonly string[];
22
13
  presentations: readonly string[];
23
- messages: readonly MessageChange[];
24
14
  conversations: readonly string[];
25
15
  };
26
- export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: {
16
+ type Changed = {
17
+ documents?: readonly string[] | null;
27
18
  drafts?: readonly string[];
28
19
  room?: boolean;
29
20
  queue?: boolean;
30
21
  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;
22
+ };
23
+ export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
24
+ export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
34
25
  export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
26
+ export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
27
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { BinaryFile, HeadChange } from './adapter.js';
1
2
  export type Change = {
2
3
  readonly kind: 'field';
3
4
  readonly path: string;
@@ -29,7 +30,6 @@ export type Change = {
29
30
  readonly kind: 'binary';
30
31
  readonly path: string;
31
32
  readonly localId: string;
32
- readonly blob: Blob;
33
33
  readonly byteLength: number;
34
34
  readonly mediaType: string;
35
35
  readonly sha256: string;
@@ -40,6 +40,32 @@ export type Change = {
40
40
  } | {
41
41
  readonly kind: 'remove';
42
42
  readonly path: string;
43
+ } | (Arriving & {
44
+ readonly content: string;
45
+ }) | (Arriving & {
46
+ readonly binary: BinaryFile;
47
+ });
48
+ type Arriving = {
49
+ readonly kind: 'arrival';
50
+ readonly path: string;
51
+ readonly revision?: string;
52
+ readonly fileId?: string;
53
+ readonly change?: HeadChange;
54
+ };
55
+ export type RoomMove = {
56
+ readonly source: {
57
+ readonly room: string;
58
+ readonly baseRoomVersion: string;
59
+ };
60
+ readonly destination: {
61
+ readonly room: string;
62
+ readonly baseRoomVersion: string;
63
+ readonly handle: string;
64
+ };
65
+ readonly moves: readonly {
66
+ readonly path: string;
67
+ readonly to: string;
68
+ }[];
43
69
  };
44
70
  export type Precondition = {
45
71
  readonly kind: 'field';
@@ -81,8 +107,12 @@ export type ChangeBatch = {
81
107
  readonly changes: readonly Change[];
82
108
  readonly preconditions: readonly Precondition[];
83
109
  readonly writtenBy?: WrittenBy;
110
+ readonly between?: RoomMove;
84
111
  };
85
112
  export declare function immutable(batch: ChangeBatch): ChangeBatch;
113
+ export declare function partnerOf(batch: ChangeBatch, locator: string): string | null;
114
+ export declare function leaving(batch: ChangeBatch, locator: string): boolean;
86
115
  export declare function landing(changes: readonly Change[], index: number, path: string): string | null;
87
116
  export declare function departure(changes: readonly Change[], index: number): string;
88
117
  export declare function queuedFile(batch: ChangeBatch, path: string, localId: string): number;
118
+ export {};