@agentshouse/app-bridge 0.1.0-c1bc683ed8f4e → 0.1.0-c1ccced28150f

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 (57) hide show
  1. package/README.md +9 -9
  2. package/dist/index.d.ts +826 -18
  3. package/dist/mdmodel/condition.d.ts +41 -11
  4. package/dist/mdmodel/definition.d.ts +17 -1
  5. package/dist/mdmodel/document.d.ts +5 -5
  6. package/dist/mdmodel/index.d.ts +11 -9
  7. package/dist/mdmodel/links.d.ts +28 -0
  8. package/dist/mdmodel/paths.d.ts +9 -1
  9. package/dist/mdmodel/project.d.ts +1 -0
  10. package/dist/mdmodel/types.d.ts +28 -4
  11. package/dist/mdmodel/validate.d.ts +27 -3
  12. package/dist/mdruntime/adapter.d.ts +121 -66
  13. package/dist/mdruntime/binary.d.ts +0 -5
  14. package/dist/mdruntime/chain.d.ts +10 -0
  15. package/dist/mdruntime/change-set.d.ts +9 -16
  16. package/dist/mdruntime/change.d.ts +31 -1
  17. package/dist/mdruntime/client.d.ts +15 -8
  18. package/dist/mdruntime/collection.d.ts +10 -21
  19. package/dist/mdruntime/compile.d.ts +15 -0
  20. package/dist/mdruntime/connection.d.ts +28 -14
  21. package/dist/mdruntime/conversation.d.ts +26 -11
  22. package/dist/mdruntime/durability.d.ts +2 -5
  23. package/dist/mdruntime/fulltext.d.ts +26 -0
  24. package/dist/mdruntime/identity.d.ts +6 -0
  25. package/dist/mdruntime/media.d.ts +7 -0
  26. package/dist/mdruntime/messages.d.ts +27 -0
  27. package/dist/mdruntime/model.d.ts +6 -1
  28. package/dist/mdruntime/observation.d.ts +15 -0
  29. package/dist/mdruntime/opened.d.ts +21 -0
  30. package/dist/mdruntime/outcome.d.ts +45 -7
  31. package/dist/mdruntime/overlay.d.ts +3 -5
  32. package/dist/mdruntime/query.d.ts +38 -2
  33. package/dist/mdruntime/reach.d.ts +14 -6
  34. package/dist/mdruntime/readiness.d.ts +14 -15
  35. package/dist/mdruntime/recovery.d.ts +3 -2
  36. package/dist/mdruntime/replica.d.ts +55 -33
  37. package/dist/mdruntime/room-draft.d.ts +33 -3
  38. package/dist/mdruntime/save.d.ts +53 -14
  39. package/dist/mdruntime/search.d.ts +32 -43
  40. package/dist/mdruntime/seed.d.ts +15 -0
  41. package/dist/mdruntime/status.d.ts +4 -3
  42. package/dist/mdruntime/store.d.ts +93 -98
  43. package/dist/mdruntime/stored.d.ts +129 -0
  44. package/dist/mdruntime/tables.d.ts +324 -0
  45. package/dist/mdruntime/wire.d.ts +33 -5
  46. package/dist/test-host.d.ts +7 -4
  47. package/dist/test-host.js +18 -28
  48. package/docs/families.md +52 -47
  49. package/package.json +8 -3
  50. package/dist/calls.d.ts +0 -117
  51. package/dist/calls.js +0 -1
  52. package/dist/mdruntime/acquisition.d.ts +0 -13
  53. package/dist/mdruntime/file.d.ts +0 -19
  54. package/dist/mdruntime/rows.d.ts +0 -36
  55. package/dist/mdruntime/shared.d.ts +0 -10
  56. package/dist/mdruntime/transfer.d.ts +0 -9
  57. package/dist/mdruntime/turn.d.ts +0 -6
@@ -10,14 +10,13 @@ export type TypedSelection = {
10
10
  roots: readonly string[];
11
11
  };
12
12
  export type OperationScopes = {
13
- read: readonly string[];
14
- sync: readonly string[];
15
13
  write: readonly string[];
16
14
  delete: readonly string[];
17
15
  };
18
16
  export type ReplicaAdmission = {
19
17
  selection: string;
20
18
  admission: Open<'admitted' | 'unavailable'>;
19
+ offline: Open<'locked' | 'open'>;
21
20
  };
22
21
  export type DiscoveredRoom = {
23
22
  name: string;
@@ -33,24 +32,20 @@ export type Capability = {
33
32
  name: string;
34
33
  limits?: readonly ProviderLimit[];
35
34
  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
35
  };
45
36
  export type ListedConversation = {
46
37
  conversation: string;
47
38
  agent: string;
39
+ agentName: string;
40
+ agentRetired: boolean;
48
41
  name: string;
49
42
  created: string;
50
43
  finished: string | null;
51
44
  outcome: string | null;
45
+ waiting: boolean;
46
+ newest: string | null;
52
47
  };
53
- export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
48
+ export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
54
49
  export type ConversationMessage = {
55
50
  identity: string;
56
51
  turn: string;
@@ -141,6 +136,10 @@ export type SessionOption = (SessionOptionNaming & {
141
136
  type: 'boolean';
142
137
  currentValue: boolean;
143
138
  });
139
+ export type RunningSubagent = {
140
+ description: string;
141
+ activity: string | null;
142
+ };
144
143
  export type ConversationEvent = {
145
144
  kind: 'turn';
146
145
  conversation: string;
@@ -162,6 +161,22 @@ export type ConversationEvent = {
162
161
  kind: 'options';
163
162
  conversation: string;
164
163
  options: readonly SessionOption[];
164
+ } | {
165
+ kind: 'starting';
166
+ conversation: string;
167
+ step: string | null;
168
+ } | {
169
+ kind: 'subagents';
170
+ conversation: string;
171
+ subagents: readonly RunningSubagent[];
172
+ } | {
173
+ kind: 'link';
174
+ conversation: string;
175
+ connected: boolean;
176
+ } | {
177
+ kind: 'deliveries';
178
+ conversation: string;
179
+ unknown: readonly string[];
165
180
  } | {
166
181
  kind: 'accepted-message';
167
182
  conversation: string;
@@ -172,6 +187,9 @@ export type ConversationEvent = {
172
187
  } | {
173
188
  kind: 'list';
174
189
  entries: readonly ListedConversation[];
190
+ whole: boolean;
191
+ more: boolean;
192
+ cursor: string | null;
175
193
  } | {
176
194
  kind: 'listed';
177
195
  entry: ListedConversation;
@@ -179,14 +197,23 @@ export type ConversationEvent = {
179
197
  kind: 'unlisted';
180
198
  conversation: string;
181
199
  };
200
+ export type ListedAgent = {
201
+ agent: string;
202
+ name: string;
203
+ retired: boolean;
204
+ };
182
205
  export type ConversationStream = {
183
206
  replicate(conversations: readonly string[]): void;
207
+ hold(cursor: string | null): void;
184
208
  observe(notify: (event: ConversationEvent) => void): () => void;
209
+ agents?(): Promise<readonly ListedAgent[] | null>;
210
+ history?(request: ConversationHistoryRequest): Promise<ActionResult>;
185
211
  };
186
212
  export type ActionDeclaration = {
187
213
  name: string;
188
214
  inputShape: unknown;
189
215
  resultKind: unknown;
216
+ room?: string;
190
217
  };
191
218
  export type ProviderLimit = {
192
219
  name: string;
@@ -229,7 +256,7 @@ export type ProviderRefusal = {
229
256
  export type ScopedRefusal = ProviderRefusal & {
230
257
  kind: 'scoped-refusal';
231
258
  locator: string;
232
- scope: Open<'content' | 'sync' | 'model' | 'operation' | 'undisclosed'>;
259
+ scope: Open<'content' | 'model' | 'operation' | 'undisclosed'>;
233
260
  };
234
261
  export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
235
262
  export type ContractUnavailable = ProviderRefusal & {
@@ -238,7 +265,7 @@ export type ContractUnavailable = ProviderRefusal & {
238
265
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
239
266
  export type PageToken = string;
240
267
  export type ChangeAuthor = {
241
- kind: Open<'user' | 'site'>;
268
+ kind: Open<'user' | 'site' | 'inbox' | 'app'>;
242
269
  id: string;
243
270
  name: string;
244
271
  };
@@ -252,24 +279,34 @@ export type HeadChange = {
252
279
  time: string;
253
280
  };
254
281
  export type BinaryFile = {
255
- fileRef: string;
256
282
  byteLength: number;
257
283
  mediaType: string;
258
284
  sha256: string;
259
285
  };
286
+ export type HeldFile = {
287
+ readonly path: string;
288
+ readonly revision: string;
289
+ };
260
290
  export type HeldContent = {
261
- documents: Readonly<Record<string, string>>;
262
- revisions: Readonly<Record<string, string>>;
291
+ files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
292
+ contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
293
+ readonly content: string;
294
+ readonly revision: string;
295
+ }>>;
263
296
  };
264
297
  export type BootstrapRequest = {
265
298
  locator: string;
266
299
  selection: string;
267
300
  pageToken?: PageToken;
268
301
  held?: HeldContent;
302
+ arriving?: (bytes: number) => void;
303
+ signal?: AbortSignal;
304
+ };
305
+ export type BootstrapInventory = {
306
+ readonly bytes: number;
269
307
  };
270
308
  export type RoomModels = {
271
309
  collection?: ModelResult;
272
- selection?: ModelResult;
273
310
  };
274
311
  export type BootstrapPage = {
275
312
  kind: 'bootstrap';
@@ -277,9 +314,12 @@ export type BootstrapPage = {
277
314
  models?: RoomModels;
278
315
  documents: Readonly<Record<string, string>>;
279
316
  revisions: Readonly<Record<string, string>>;
317
+ fileIds?: Readonly<Record<string, string>>;
280
318
  changes: Readonly<Record<string, HeadChange>>;
281
319
  binaryFiles: Readonly<Record<string, BinaryFile>>;
320
+ folders?: readonly string[];
282
321
  pageToken?: PageToken;
322
+ bytes?: number;
283
323
  };
284
324
  export type BootstrapResult = BootstrapPage | {
285
325
  kind: 'beyond-horizon';
@@ -296,9 +336,12 @@ export type RefreshPage = {
296
336
  models?: RoomModels;
297
337
  documents: Readonly<Record<string, string>>;
298
338
  revisions: Readonly<Record<string, string>>;
339
+ fileIds?: Readonly<Record<string, string>>;
299
340
  changes: Readonly<Record<string, HeadChange>>;
300
341
  binaryFiles: Readonly<Record<string, BinaryFile>>;
301
342
  removals: readonly string[];
343
+ folders?: readonly string[];
344
+ folderRemovals?: readonly string[];
302
345
  pageToken?: PageToken;
303
346
  };
304
347
  export type RefreshResult = {
@@ -309,6 +352,7 @@ export type RefreshResult = {
309
352
  export type MutationRequest = {
310
353
  locator: string;
311
354
  changeBatch: ChangeBatch;
355
+ file(localId: string): Promise<Blob>;
312
356
  upload?: unknown;
313
357
  };
314
358
  export type RetryableRefusal = ProviderRefusal & {
@@ -319,17 +363,21 @@ export type ServiceMode = Open<'open' | 'write-halted'>;
319
363
  export type ServiceModeSignal = {
320
364
  observe(notify: (mode: ServiceMode) => void): () => void;
321
365
  };
322
- export type MutationResult = {
323
- kind: 'accepted';
366
+ export type AcceptedRoom = {
324
367
  roomVersion: string;
325
368
  documents: Readonly<Record<string, string>>;
326
369
  revisions: Readonly<Record<string, string>>;
370
+ fileIds?: Readonly<Record<string, string>>;
327
371
  changes: Readonly<Record<string, HeadChange>>;
328
372
  removals: readonly string[];
329
373
  binaryFiles?: Readonly<Record<string, BinaryFile>>;
374
+ };
375
+ export type MutationResult = (AcceptedRoom & {
376
+ kind: 'accepted';
330
377
  author?: string;
331
378
  time?: string;
332
- } | (ProviderRefusal & {
379
+ destination?: AcceptedRoom;
380
+ }) | (ProviderRefusal & {
333
381
  kind: 'conflicted';
334
382
  roomVersion?: string;
335
383
  affected: Readonly<Record<string, string>>;
@@ -346,7 +394,7 @@ export type HistoryAuthor = {
346
394
  kind: 'user';
347
395
  id: string;
348
396
  } | {
349
- kind: 'site';
397
+ kind: 'site' | 'inbox' | 'app';
350
398
  id: string;
351
399
  name: string;
352
400
  };
@@ -378,22 +426,35 @@ export type BinaryRequest = {
378
426
  locator: string;
379
427
  path: string;
380
428
  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
429
  };
394
430
  export type BinaryResult = {
395
431
  kind: 'binary';
432
+ body: ReadableStream<Uint8Array>;
433
+ mediaType: string;
434
+ sha256?: string;
435
+ } | (ProviderRefusal & {
436
+ kind: 'rejected';
437
+ }) | AdapterFailure;
438
+ export type BinaryLinkResult = {
439
+ kind: 'link';
440
+ url: string;
441
+ name: string;
442
+ mediaType?: string;
443
+ } | (ProviderRefusal & {
444
+ kind: 'rejected';
445
+ }) | AdapterFailure;
446
+ export type AttachRequest = {
447
+ locator: string;
448
+ name: string;
449
+ mediaType: string;
450
+ byteLength: number;
451
+ sha256: string;
396
452
  blob: Blob;
453
+ };
454
+ export type AttachResult = {
455
+ kind: 'attached';
456
+ path: string;
457
+ revision: string;
397
458
  } | (ProviderRefusal & {
398
459
  kind: 'rejected';
399
460
  }) | AdapterFailure;
@@ -415,56 +476,50 @@ export type ActionResult = {
415
476
  export type HeldRoom = {
416
477
  locator: string;
417
478
  roomVersion: string;
418
- documents: Readonly<Record<string, string>>;
419
- revisions: Readonly<Record<string, string>>;
479
+ };
480
+ export type RoomChange = {
481
+ kind: 'room-change';
482
+ locator: string;
483
+ from: string;
484
+ roomVersion: string;
485
+ read(): Promise<RefreshPage>;
486
+ };
487
+ export type AuthorityChange = {
488
+ kind: 'authority-changed';
489
+ rooms: readonly DiscoveredRoom[];
490
+ left: readonly string[];
491
+ member?: Member;
420
492
  };
421
493
  export type RoomStreamEvent = {
422
494
  kind: 'opened';
495
+ } | {
496
+ kind: 'discovered';
497
+ discovery: Discovery;
423
498
  } | {
424
499
  kind: 'closed';
425
500
  revoked: boolean;
501
+ lost: boolean;
426
502
  } | {
427
- kind: 'opening';
503
+ kind: 'caught-up';
428
504
  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
- };
505
+ } | AuthorityChange | RoomChange;
451
506
  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;
507
+ hold(rooms: readonly HeldRoom[]): void;
508
+ observe(notify: (event: RoomStreamEvent) => void): () => void;
456
509
  };
457
510
  export type Adapter = {
458
511
  readonly localSaves?: true;
459
- readonly exhaustiveDiscovery?: true;
512
+ readonly roomTypes?: string;
513
+ readonly nameableRoomTypes?: readonly string[];
460
514
  authorize(): Promise<Authorization>;
461
- discover(authorization: Authorization): Promise<DiscoverResult>;
515
+ discover?(authorization: Authorization): Promise<DiscoverResult>;
462
516
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
463
- refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
517
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
464
518
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
465
519
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
466
520
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
467
- referrerScope(referrer: unknown): ReferrerScope | null;
521
+ link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
522
+ attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
468
523
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
469
524
  reached(locator: string, roomVersion: string, target: string): boolean;
470
525
  follows(locator: string, roomVersion: string, next: string): boolean;
@@ -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,10 @@
1
+ import type { MdRuntimeClient } from './client.js';
2
+ import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
3
+ type Rows = DocumentResult | GroupResult;
4
+ export type WindowAnswer = Rows | PendingResult;
5
+ export type WindowChain = {
6
+ want(count: number): void;
7
+ close(): void;
8
+ };
9
+ export declare function chainedWindows(runtime: MdRuntimeClient, query: DocumentQuery | GroupQuery, count: number, publish: (answers: readonly (WindowAnswer | null)[], settled: boolean) => void): WindowChain;
10
+ 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 {};
@@ -1,9 +1,8 @@
1
- import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedRoomDraft, SaveResult } from './connection.js';
1
+ import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
2
2
  import type { Member, ServiceMode } from './adapter.js';
3
- import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
3
+ import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
4
4
  import { type Observation } from './observation.js';
5
- import type { BinaryReference } from './binary.js';
6
- import type { BinaryAnswer, CallResult, HistoryAnswer, Offline, QueueEntry } from './outcome.js';
5
+ import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
7
6
  import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
8
7
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
9
8
  import type { SearchRequest, SearchResult } from './search.js';
@@ -21,39 +20,44 @@ export type MdRuntimeClient = {
21
20
  roomDraft: {
22
21
  list(): Promise<readonly RoomDraft[]>;
23
22
  read(room: string, path: string): Promise<RoomDraft | null>;
24
- write(room: string, path: string, revision: string | null, parts: RoomDraftParts): Promise<RoomDraftWrite>;
23
+ write(room: string, path: string, revision: string | null, parts: RoomDraftParts, next?: string): Promise<RoomDraftWrite>;
25
24
  discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
26
25
  };
27
26
  save(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
27
+ saveParts(room: string, parts: readonly SavedParts[]): Promise<SaveResult>;
28
28
  presentation: {
29
29
  read(): Promise<unknown>;
30
30
  write(value: unknown): Promise<void>;
31
+ edit(members: Readonly<Record<string, unknown>>): Promise<void>;
31
32
  };
32
33
  conversation: {
33
34
  list(): Promise<readonly ConversationEntry[]>;
34
35
  read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
35
36
  create(input: unknown): Promise<CallResult>;
36
37
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
37
- answer(conversation: string, answer: unknown): Promise<CallResult>;
38
+ answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
38
39
  interrupt(conversation: string): Promise<CallResult>;
39
40
  kill(conversation: string): Promise<CallResult>;
40
- cancel(conversation: string, turn: string): Promise<CallResult>;
41
41
  delete(conversation: string): Promise<CallResult>;
42
42
  };
43
43
  chatDraft: {
44
44
  write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
45
+ prepend(conversation: string, draft: ChatDraft): Promise<void>;
45
46
  discard(conversation: string): Promise<void>;
46
47
  };
47
48
  history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
49
+ resolve(room: string, path: string, destination: string): Promise<Resolution>;
48
50
  binaryFile: {
49
51
  read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
50
- readReference(reference: BinaryReference): Promise<BinaryAnswer>;
52
+ attach(room: string, file: File): Promise<AttachAnswer>;
53
+ download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
51
54
  };
52
55
  call(name: string, input: unknown): Promise<CallResult>;
53
56
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
54
57
  log(): Promise<string>;
55
58
  persistence(): Promise<boolean>;
56
59
  retry(): Promise<void>;
60
+ cleanUp(): Promise<number>;
57
61
  observe: {
58
62
  (topic: 'deployment-facts'): Promise<Observation<unknown>>;
59
63
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
@@ -77,6 +81,9 @@ export type MdRuntimeClient = {
77
81
  };
78
82
  export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
79
83
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
84
+ export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
85
+ export { roomDraftRevision } from './identity.js';
86
+ export { defineRoomMedia, ROOM_MEDIA } from './media.js';
80
87
  export type { Observation } from './observation.js';
81
88
  export type { Open } from './open.js';
82
89
  export { unanswered, type RuntimePort, type WireMember } from './wire.js';
@@ -1,9 +1,6 @@
1
- import { type Document, type Frontmatter, type Validation } from '../mdmodel/index.js';
2
- import { type ModelState } from './model.js';
1
+ import { type Document } from '../mdmodel/index.js';
2
+ import type { ModelState } from './model.js';
3
3
  import type { MdModelIdentity } from './adapter.js';
4
- import { type Paths } from './shared.js';
5
- import type { Refused } from './transfer.js';
6
- import { type Later } from './turn.js';
7
4
  export declare const MD_MODEL: MdModelIdentity;
8
5
  export type Collection = {
9
6
  text: Readonly<Record<string, string>>;
@@ -17,22 +14,14 @@ export type Composition = {
17
14
  model: ModelState;
18
15
  } | null;
19
16
  };
17
+ export type Composed = {
18
+ readonly composition: Composition;
19
+ readonly fingerprint: string;
20
+ };
21
+ export declare function composedOf(composition: Composition): Composed;
22
+ export declare function selected(composition: Composition, path: string): boolean;
20
23
  export declare function governing(composition: Composition, path: string): ModelState;
21
- export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Collection;
22
- export declare function passingFrontmatter(collection: Collection, path: string): Frontmatter | undefined;
23
- export declare function documentsOf(collection: Collection): Generator<readonly [string, Document]>;
24
- export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Refused | null;
24
+ export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
25
+ export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
25
26
  export declare function validRoot(root: unknown): root is string;
26
- export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Validation;
27
- type Held = {
28
- text: Paths<string>;
29
- binaries: Paths<unknown>;
30
- };
31
- export declare function indexReferrers(held: Held, composition: Composition): Later<void>;
32
- export declare function referencesIndexed(held: Held, composition: Composition): boolean;
33
- export declare function referring(held: Held, composition: Composition, targets: Iterable<string>): ReadonlySet<string> | null;
34
27
  export declare function available(composition: Composition): boolean;
35
- export declare function changedCleanly(next: Held, previous: Held & {
36
- composition: Composition;
37
- }, composition: Composition): boolean;
38
- export {};
@@ -0,0 +1,15 @@
1
+ import type { Plan, QueryRows } from './query.js';
2
+ import type { Connection, Value } from './tables.js';
3
+ export type QueryRoom = {
4
+ readonly locator: string;
5
+ readonly key: number;
6
+ };
7
+ export type Fragment = {
8
+ readonly sql: string;
9
+ readonly bind: readonly Value[];
10
+ };
11
+ export type QueryAnswer = QueryRows & {
12
+ readonly more?: string;
13
+ };
14
+ export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
15
+ export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;