@agentshouse/app-bridge 0.1.0-cf2e2ca943fbc → 0.1.0-cf304386b60e3

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 (101) hide show
  1. package/README.md +21 -16
  2. package/dist/index.d.ts +1075 -0
  3. package/dist/index.js +1 -0
  4. package/dist/mdmodel/blocks.d.ts +10 -0
  5. package/dist/mdmodel/definition.d.ts +81 -0
  6. package/dist/mdmodel/divide.d.ts +2 -0
  7. package/dist/mdmodel/document.d.ts +16 -0
  8. package/dist/mdmodel/event.d.ts +77 -0
  9. package/dist/mdmodel/facts.d.ts +14 -0
  10. package/dist/mdmodel/fields.d.ts +5 -0
  11. package/dist/mdmodel/index.d.ts +33 -0
  12. package/dist/mdmodel/kinds.d.ts +18 -0
  13. package/dist/mdmodel/links.d.ts +28 -0
  14. package/dist/mdmodel/paths.d.ts +25 -0
  15. package/dist/mdmodel/pattern.d.ts +9 -0
  16. package/dist/mdmodel/profile.d.ts +5 -0
  17. package/dist/mdmodel/project.d.ts +21 -0
  18. package/dist/mdmodel/query/language.d.ts +253 -0
  19. package/dist/mdmodel/query/match.d.ts +13 -0
  20. package/dist/mdmodel/query/rows.d.ts +31 -0
  21. package/dist/mdmodel/query/sql.d.ts +38 -0
  22. package/dist/mdmodel/references.d.ts +3 -0
  23. package/dist/mdmodel/reserved.d.ts +4 -0
  24. package/dist/mdmodel/types.d.ts +178 -0
  25. package/dist/mdmodel/validate.d.ts +33 -0
  26. package/dist/mdmodel/version.d.ts +1 -0
  27. package/dist/mdmodel/yaml.d.ts +55 -0
  28. package/dist/mdruntime/adapter.d.ts +546 -0
  29. package/dist/mdruntime/attached-model.d.ts +7 -0
  30. package/dist/mdruntime/binary.d.ts +17 -0
  31. package/dist/mdruntime/bootstrap.d.ts +43 -0
  32. package/dist/mdruntime/chain.d.ts +11 -0
  33. package/dist/mdruntime/change-set.d.ts +27 -0
  34. package/dist/mdruntime/change.d.ts +119 -0
  35. package/dist/mdruntime/client.d.ts +100 -0
  36. package/dist/mdruntime/collection.d.ts +28 -0
  37. package/dist/mdruntime/compile.d.ts +15 -0
  38. package/dist/mdruntime/connection.d.ts +129 -0
  39. package/dist/mdruntime/conversation-row.d.ts +32 -0
  40. package/dist/mdruntime/conversation.d.ts +127 -0
  41. package/dist/mdruntime/durability.d.ts +17 -0
  42. package/dist/mdruntime/failure.d.ts +12 -0
  43. package/dist/mdruntime/figures.d.ts +47 -0
  44. package/dist/mdruntime/identity.d.ts +5 -0
  45. package/dist/mdruntime/job.d.ts +32 -0
  46. package/dist/mdruntime/live.d.ts +22 -0
  47. package/dist/mdruntime/log.d.ts +5 -0
  48. package/dist/mdruntime/media.d.ts +7 -0
  49. package/dist/mdruntime/messages.d.ts +51 -0
  50. package/dist/mdruntime/model.d.ts +55 -0
  51. package/dist/mdruntime/observation.d.ts +44 -0
  52. package/dist/mdruntime/open.d.ts +1 -0
  53. package/dist/mdruntime/opened.d.ts +21 -0
  54. package/dist/mdruntime/outcome.d.ts +85 -0
  55. package/dist/mdruntime/overlay.d.ts +25 -0
  56. package/dist/mdruntime/query.d.ts +88 -0
  57. package/dist/mdruntime/reach.d.ts +53 -0
  58. package/dist/mdruntime/readiness.d.ts +49 -0
  59. package/dist/mdruntime/reads.d.ts +35 -0
  60. package/dist/mdruntime/recovery.d.ts +25 -0
  61. package/dist/mdruntime/refresh.d.ts +26 -0
  62. package/dist/mdruntime/replica.d.ts +67 -0
  63. package/dist/mdruntime/room-draft.d.ts +174 -0
  64. package/dist/mdruntime/room-drafts.d.ts +28 -0
  65. package/dist/mdruntime/save.d.ts +102 -0
  66. package/dist/mdruntime/saves.d.ts +95 -0
  67. package/dist/mdruntime/search.d.ts +21 -0
  68. package/dist/mdruntime/seed.d.ts +29 -0
  69. package/dist/mdruntime/socket/admission.d.ts +6 -0
  70. package/dist/mdruntime/socket/answers.d.ts +5 -0
  71. package/dist/mdruntime/socket.d.ts +42 -0
  72. package/dist/mdruntime/source.d.ts +60 -0
  73. package/dist/mdruntime/status.d.ts +25 -0
  74. package/dist/mdruntime/store/fences.d.ts +15 -0
  75. package/dist/mdruntime/store/installs.d.ts +29 -0
  76. package/dist/mdruntime/store/records.d.ts +211 -0
  77. package/dist/mdruntime/store/room-held.d.ts +7 -0
  78. package/dist/mdruntime/store/watchers.d.ts +14 -0
  79. package/dist/mdruntime/store/writes.d.ts +23 -0
  80. package/dist/mdruntime/store.d.ts +86 -0
  81. package/dist/mdruntime/stored.d.ts +155 -0
  82. package/dist/mdruntime/tables.d.ts +406 -0
  83. package/dist/mdruntime/tallies.d.ts +17 -0
  84. package/dist/mdruntime/transfer.d.ts +4 -0
  85. package/dist/mdruntime/turn.d.ts +8 -0
  86. package/dist/mdruntime/wire.d.ts +249 -0
  87. package/dist/{client/src/test-host.d.ts → test-host.d.ts} +10 -8
  88. package/dist/test-host.js +190 -0
  89. package/docs/families.md +101 -45
  90. package/package.json +12 -10
  91. package/dist/client/src/bridge.d.ts +0 -38
  92. package/dist/client/src/bridge.js +0 -320
  93. package/dist/client/src/index.d.ts +0 -3
  94. package/dist/client/src/index.js +0 -2
  95. package/dist/client/src/test-host.js +0 -185
  96. package/dist/client/src/wire.d.ts +0 -215
  97. package/dist/client/src/wire.js +0 -1
  98. package/dist/src/apps/remainder.d.ts +0 -2
  99. package/dist/src/apps/remainder.js +0 -16
  100. package/dist/src/apps/tab.d.ts +0 -6
  101. package/dist/src/apps/tab.js +0 -27
@@ -0,0 +1,546 @@
1
+ import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
2
+ import type { ModelResult } from './model.js';
3
+ export type { SavedFacts, TypedPath };
4
+ import type { Open } from './open.js';
5
+ import type { ChangeBatch } from './change.js';
6
+ export type Authorization = object;
7
+ export type MdModelIdentity = {
8
+ identity: string;
9
+ version: string;
10
+ };
11
+ export type TypedSelection = {
12
+ roots: readonly string[];
13
+ };
14
+ export type OperationScopes = {
15
+ write: readonly string[];
16
+ erase: readonly string[];
17
+ };
18
+ export type ReplicaAdmission = {
19
+ selection: string;
20
+ admission: Open<'admitted' | 'unavailable'>;
21
+ offline: Open<'locked' | 'open'>;
22
+ };
23
+ export type DiscoveredRoom = {
24
+ name: string;
25
+ locator: string;
26
+ handle: string;
27
+ roomVersion: string;
28
+ operations: OperationScopes;
29
+ replica: ReplicaAdmission;
30
+ typedSelection?: TypedSelection;
31
+ providerOwnedPaths: readonly string[];
32
+ };
33
+ export type Capability = {
34
+ name: string;
35
+ limits?: readonly ProviderLimit[];
36
+ actions?: readonly ActionDeclaration[];
37
+ };
38
+ export type ListedConversation = {
39
+ conversation: string;
40
+ agent: string;
41
+ agentName: string;
42
+ agentRetired: boolean;
43
+ name: string;
44
+ created: string;
45
+ finished: string | null;
46
+ outcome: string | null;
47
+ waiting: boolean;
48
+ newest: string | null;
49
+ processEnded: string | null;
50
+ };
51
+ export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
52
+ export type ConversationMessage = {
53
+ identity: string;
54
+ turn: string;
55
+ text: string;
56
+ message: unknown;
57
+ };
58
+ export type AcceptedMessage = ConversationMessage & {
59
+ position: string;
60
+ };
61
+ export type ConversationHistoryRequest = {
62
+ conversations: readonly {
63
+ conversation: string;
64
+ after?: string;
65
+ }[];
66
+ };
67
+ export type ConversationHistoryPage = {
68
+ conversation: string;
69
+ messages: readonly AcceptedMessage[];
70
+ next?: string;
71
+ };
72
+ export type ConversationHistories = {
73
+ histories: readonly ConversationHistoryPage[];
74
+ };
75
+ export type TurnContext = {
76
+ used: number;
77
+ window: number;
78
+ };
79
+ export type TurnOperation = {
80
+ op: 'begin';
81
+ at: string;
82
+ } | {
83
+ op: 'start';
84
+ index: number;
85
+ part: unknown;
86
+ } | {
87
+ op: 'append';
88
+ index: number;
89
+ text: string;
90
+ } | {
91
+ op: 'status';
92
+ index: number;
93
+ status: string;
94
+ result: unknown;
95
+ } | {
96
+ op: 'count';
97
+ index: number;
98
+ count: number;
99
+ } | {
100
+ op: 'plan';
101
+ index: number;
102
+ entries: readonly unknown[];
103
+ } | ({
104
+ op: 'context';
105
+ } & TurnContext);
106
+ export type ProcessCommand = {
107
+ [field: string]: unknown;
108
+ name: string;
109
+ description: string;
110
+ input?: {
111
+ [field: string]: unknown;
112
+ hint: string;
113
+ } | null;
114
+ };
115
+ type SelectValue = {
116
+ [field: string]: unknown;
117
+ value: string;
118
+ name: string;
119
+ description?: string | null;
120
+ };
121
+ type SelectGroup = {
122
+ [field: string]: unknown;
123
+ group: string;
124
+ name: string;
125
+ options: readonly SelectValue[];
126
+ };
127
+ type SessionOptionNaming = {
128
+ [field: string]: unknown;
129
+ id: string;
130
+ name: string;
131
+ description?: string | null;
132
+ category?: string | null;
133
+ };
134
+ export type SessionOption = (SessionOptionNaming & {
135
+ type: 'select';
136
+ currentValue: string;
137
+ options: readonly SelectValue[] | readonly SelectGroup[];
138
+ }) | (SessionOptionNaming & {
139
+ type: 'boolean';
140
+ currentValue: boolean;
141
+ });
142
+ export type RunningSubagent = {
143
+ description: string;
144
+ activity: string | null;
145
+ };
146
+ export type ConversationEvent = {
147
+ kind: 'turn';
148
+ conversation: string;
149
+ turn: string;
150
+ operation: TurnOperation;
151
+ } | {
152
+ kind: 'questions';
153
+ conversation: string;
154
+ questions: readonly unknown[];
155
+ } | {
156
+ kind: 'process';
157
+ conversation: string;
158
+ running: boolean;
159
+ } | {
160
+ kind: 'commands';
161
+ conversation: string;
162
+ commands: readonly ProcessCommand[];
163
+ } | {
164
+ kind: 'options';
165
+ conversation: string;
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[];
183
+ } | {
184
+ kind: 'accepted-message';
185
+ conversation: string;
186
+ message: AcceptedMessage;
187
+ } | {
188
+ kind: 'gap';
189
+ conversation: string;
190
+ } | {
191
+ kind: 'list';
192
+ entries: readonly ListedConversation[];
193
+ whole: boolean;
194
+ more: boolean;
195
+ cursor: string | null;
196
+ } | {
197
+ kind: 'listed';
198
+ entry: ListedConversation;
199
+ } | {
200
+ kind: 'unlisted';
201
+ conversation: string;
202
+ };
203
+ export type ListedAgent = {
204
+ agent: string;
205
+ name: string;
206
+ retired: boolean;
207
+ };
208
+ export type ConversationStream = {
209
+ replicate(conversations: readonly string[]): void;
210
+ hold(cursor: string | null): void;
211
+ observe(notify: (event: ConversationEvent) => void): () => void;
212
+ agents?(): Promise<readonly ListedAgent[] | null>;
213
+ history?(request: ConversationHistoryRequest): Promise<ActionResult>;
214
+ };
215
+ export type ActionDeclaration = {
216
+ name: string;
217
+ inputShape: unknown;
218
+ resultKind: unknown;
219
+ room?: string;
220
+ };
221
+ export type ProviderLimit = {
222
+ name: string;
223
+ value?: number | string;
224
+ };
225
+ export type HistoryRetention = {
226
+ kind: 'duration';
227
+ seconds: number;
228
+ } | {
229
+ kind: 'no-declared-time-bound';
230
+ };
231
+ export type Retention = {
232
+ history: HistoryRetention;
233
+ refreshHorizon: number;
234
+ };
235
+ export type Discovery = {
236
+ kind: 'discovery';
237
+ rooms: readonly DiscoveredRoom[];
238
+ capabilities: readonly Capability[];
239
+ providerLimits: readonly ProviderLimit[];
240
+ retention: Retention;
241
+ member?: Member;
242
+ };
243
+ export type TransportUncertainty = {
244
+ kind: 'transport-uncertainty';
245
+ };
246
+ export type RoomNotReadable = {
247
+ kind: 'room-not-readable';
248
+ locator: string;
249
+ };
250
+ export type RevokedAuthorization = {
251
+ kind: 'revoked-authorization';
252
+ };
253
+ export type ProviderRefusal = {
254
+ code: string;
255
+ fields: Readonly<Record<string, unknown>>;
256
+ retryable: boolean;
257
+ };
258
+ export type ScopedRefusal = ProviderRefusal & {
259
+ kind: 'scoped-refusal';
260
+ locator: string;
261
+ scope: Open<'content' | 'model' | 'operation' | 'undisclosed'>;
262
+ };
263
+ export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
264
+ export type ContractUnavailable = ProviderRefusal & {
265
+ kind: 'contract-unavailable';
266
+ };
267
+ export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
268
+ export type PageToken = string;
269
+ export type ChangeAuthor = {
270
+ kind: Open<'user' | 'site' | 'inbox' | 'app'>;
271
+ id: string;
272
+ name: string;
273
+ };
274
+ export type Member = {
275
+ kind: Open<'user'>;
276
+ id: string;
277
+ name: string;
278
+ };
279
+ export type HeadChange = {
280
+ author: ChangeAuthor | null;
281
+ time: string;
282
+ };
283
+ export type BinaryFile = {
284
+ byteLength: number;
285
+ mediaType: string;
286
+ sha256: string;
287
+ };
288
+ export type BootstrapRequest = {
289
+ locator: string;
290
+ selection: string;
291
+ pageToken?: PageToken;
292
+ arriving?: (bytes: number) => void;
293
+ signal?: AbortSignal;
294
+ };
295
+ export type BootstrapPart = {
296
+ readonly id: string;
297
+ readonly bytes: number;
298
+ };
299
+ export type BootstrapInventory = {
300
+ readonly bytes: number;
301
+ };
302
+ export type RoomModels = {
303
+ collection?: ModelResult;
304
+ };
305
+ export type BootstrapPage = {
306
+ kind: 'bootstrap';
307
+ roomVersion: string;
308
+ models?: RoomModels;
309
+ documents: Readonly<Record<string, string>>;
310
+ facts: Readonly<Record<string, SavedFacts>>;
311
+ revisions: Readonly<Record<string, string>>;
312
+ fileIds?: Readonly<Record<string, string>>;
313
+ created?: Readonly<Record<string, string>>;
314
+ changes: Readonly<Record<string, HeadChange>>;
315
+ binaryFiles: Readonly<Record<string, BinaryFile>>;
316
+ folders?: readonly string[];
317
+ pageToken?: PageToken;
318
+ parts?: readonly BootstrapPart[];
319
+ bytes?: number;
320
+ };
321
+ export type NotReady = {
322
+ kind: 'not-ready';
323
+ };
324
+ export type BootstrapResult = BootstrapPage | {
325
+ kind: 'beyond-horizon';
326
+ } | NotReady | AdapterFailure;
327
+ export type RefreshRequest = {
328
+ locator: string;
329
+ selection: string;
330
+ fromRoomVersion: string;
331
+ pageToken?: PageToken;
332
+ };
333
+ export type RefreshPage = {
334
+ kind: 'net-advancement';
335
+ roomVersion: string;
336
+ models?: RoomModels;
337
+ documents: Readonly<Record<string, string>>;
338
+ facts: Readonly<Record<string, SavedFacts>>;
339
+ revisions: Readonly<Record<string, string>>;
340
+ fileIds?: Readonly<Record<string, string>>;
341
+ created?: Readonly<Record<string, string>>;
342
+ changes: Readonly<Record<string, HeadChange>>;
343
+ binaryFiles: Readonly<Record<string, BinaryFile>>;
344
+ removals: readonly string[];
345
+ folders?: readonly string[];
346
+ folderRemovals?: readonly string[];
347
+ pageToken?: PageToken;
348
+ };
349
+ export type RefreshResult = {
350
+ kind: 'still-current';
351
+ } | RefreshPage | {
352
+ kind: 'beyond-horizon';
353
+ } | RetryableRefusal | AdapterFailure;
354
+ export type MutationRequest = {
355
+ locator: string;
356
+ changeBatch: ChangeBatch;
357
+ file(localId: string): Promise<Blob>;
358
+ upload?: unknown;
359
+ };
360
+ export type RetryableRefusal = ProviderRefusal & {
361
+ kind: 'retryable-refusal';
362
+ reset?: string;
363
+ };
364
+ export type ServiceMode = Open<'open' | 'write-halted'>;
365
+ export type ServiceModeSignal = {
366
+ observe(notify: (mode: ServiceMode) => void): () => void;
367
+ };
368
+ export type AcceptedRoom = {
369
+ roomVersion: string;
370
+ documents: Readonly<Record<string, string>>;
371
+ revisions: Readonly<Record<string, string>>;
372
+ fileIds?: Readonly<Record<string, string>>;
373
+ changes: Readonly<Record<string, HeadChange>>;
374
+ removals: readonly string[];
375
+ binaryFiles?: Readonly<Record<string, BinaryFile>>;
376
+ };
377
+ export type MutationResult = (AcceptedRoom & {
378
+ kind: 'accepted';
379
+ author?: string;
380
+ time?: string;
381
+ destination?: AcceptedRoom;
382
+ }) | (ProviderRefusal & {
383
+ kind: 'conflicted';
384
+ roomVersion?: string;
385
+ affected: Readonly<Record<string, string>>;
386
+ }) | (ProviderRefusal & {
387
+ kind: 'rejected';
388
+ affected: Readonly<Record<string, string>>;
389
+ }) | RetryableRefusal | {
390
+ kind: 'write-halted';
391
+ } | AdapterFailure;
392
+ export type HistoryAuthor = {
393
+ kind: 'user' | 'site' | 'inbox' | 'app';
394
+ id: string;
395
+ name: string;
396
+ };
397
+ export type HistoryRevision = {
398
+ revision: string;
399
+ author: HistoryAuthor;
400
+ time: string;
401
+ binaryFile?: BinaryFile;
402
+ };
403
+ export type HistoryRequest = {
404
+ locator: string;
405
+ path: string;
406
+ revision?: string;
407
+ pageToken?: PageToken;
408
+ };
409
+ export type HistoryResult = {
410
+ kind: 'history';
411
+ revisions: readonly HistoryRevision[];
412
+ pageToken?: PageToken;
413
+ deleted?: true;
414
+ } | {
415
+ kind: 'revision';
416
+ content: string;
417
+ } | {
418
+ kind: 'no-history';
419
+ } | AdapterFailure;
420
+ export type BinaryRequest = {
421
+ kind: 'path';
422
+ locator: string;
423
+ path: string;
424
+ revision: string;
425
+ };
426
+ export type BinaryResult = {
427
+ kind: 'binary';
428
+ body: ReadableStream<Uint8Array>;
429
+ mediaType: string;
430
+ sha256?: string;
431
+ } | (ProviderRefusal & {
432
+ kind: 'rejected';
433
+ }) | AdapterFailure;
434
+ export type BinaryLinkResult = {
435
+ kind: 'link';
436
+ url: string;
437
+ name: string;
438
+ mediaType?: string;
439
+ } | (ProviderRefusal & {
440
+ kind: 'rejected';
441
+ }) | AdapterFailure;
442
+ export type AttachRequest = {
443
+ locator: string;
444
+ name: string;
445
+ mediaType: string;
446
+ byteLength: number;
447
+ sha256: string;
448
+ blob: Blob;
449
+ };
450
+ export type AttachResult = {
451
+ kind: 'attached';
452
+ path: string;
453
+ revision: string;
454
+ } | (ProviderRefusal & {
455
+ kind: 'rejected';
456
+ }) | AdapterFailure;
457
+ export type ActionRequest = {
458
+ name: string;
459
+ input: unknown;
460
+ };
461
+ export type RoomVersionAt = {
462
+ locator: string;
463
+ roomVersion: string;
464
+ };
465
+ export type ActionResult = {
466
+ kind: 'action';
467
+ result: unknown;
468
+ at?: RoomVersionAt;
469
+ } | (ProviderRefusal & {
470
+ kind: 'rejected';
471
+ }) | AdapterFailure;
472
+ export type SearchHit = {
473
+ room: string;
474
+ path: string;
475
+ line?: number;
476
+ snippet?: string;
477
+ };
478
+ export type SearchAsk = {
479
+ text: string;
480
+ rooms: readonly string[] | null;
481
+ };
482
+ export type SearchAnswer = {
483
+ kind: 'found';
484
+ documents: readonly SearchHit[];
485
+ } | (ProviderRefusal & {
486
+ kind: 'rejected';
487
+ }) | AdapterFailure;
488
+ export type HeldRoom = {
489
+ locator: string;
490
+ roomVersion: string | null;
491
+ };
492
+ export type RoomChange = {
493
+ kind: 'room-change';
494
+ locator: string;
495
+ from: string | null;
496
+ roomVersion: string;
497
+ read(): Promise<RefreshPage>;
498
+ };
499
+ export type AuthorityChange = {
500
+ kind: 'authority-changed';
501
+ rooms: readonly DiscoveredRoom[];
502
+ left: readonly string[];
503
+ member?: Member;
504
+ };
505
+ export type RoomStreamEvent = {
506
+ kind: 'opened';
507
+ } | {
508
+ kind: 'discovered';
509
+ discovery: Discovery;
510
+ } | {
511
+ kind: 'closed';
512
+ revoked: boolean;
513
+ lost: boolean;
514
+ authorityChanged: boolean;
515
+ } | {
516
+ kind: 'caught-up';
517
+ expired: readonly string[];
518
+ } | AuthorityChange | RoomChange;
519
+ export type RoomStream = {
520
+ hold(rooms: readonly HeldRoom[]): void;
521
+ observe(notify: (event: RoomStreamEvent) => void): () => void;
522
+ };
523
+ export type Adapter = {
524
+ readonly localSaves?: true;
525
+ readonly roomTypes?: string;
526
+ readonly nameableRoomTypes?: readonly string[];
527
+ readonly typedPaths?: readonly TypedPath[];
528
+ readonly unkeptReads?: readonly string[];
529
+ readonly leadingReads?: readonly string[];
530
+ authorize(): Promise<Authorization>;
531
+ discover?(authorization: Authorization): Promise<DiscoverResult>;
532
+ bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
533
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
534
+ mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
535
+ history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
536
+ binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
537
+ link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
538
+ attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
539
+ action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
540
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
541
+ reached(locator: string, roomVersion: string, target: string): boolean;
542
+ follows(locator: string, roomVersion: string, next: string): boolean;
543
+ roomStream?: RoomStream;
544
+ conversations?: ConversationStream;
545
+ serviceMode?: ServiceModeSignal;
546
+ };
@@ -0,0 +1,7 @@
1
+ import { type VerifiedModel } from '../mdmodel/index.js';
2
+ import type { ModelResult, ModelState } from './model.js';
3
+ export declare const NO_ROOM_TYPES: VerifiedModel;
4
+ export declare function roomTypesOf(schema: string | undefined, nameable?: readonly string[]): VerifiedModel;
5
+ export declare function builtInModel(roomTypes: VerifiedModel): ModelState;
6
+ export declare function schemaTypes(schema: string | null, roomTypes: VerifiedModel): VerifiedModel['types'];
7
+ export declare function attachedModel(answer: ModelResult, roomTypes: VerifiedModel): ModelState;
@@ -0,0 +1,17 @@
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 byteLength: number;
7
+ readonly mediaType: string;
8
+ readonly sha256: string;
9
+ } | {
10
+ readonly state: 'pending';
11
+ readonly localId: string;
12
+ readonly path: string;
13
+ readonly byteLength: number;
14
+ readonly mediaType: string;
15
+ readonly sha256: string;
16
+ };
17
+ export declare function binaryRecord(path: string, held: HeldBinary, revision: string | undefined): BinaryFileRecord;
@@ -0,0 +1,43 @@
1
+ import type { ModelState } from './model.js';
2
+ import type { Adapter, TypedPath, AdapterFailure, Authorization, BootstrapPart, DiscoveredRoom, NotReady, RetryableRefusal, RoomModels } from './adapter.js';
3
+ import type { Composition } from './collection.js';
4
+ import type { InstallationStep } from './readiness.js';
5
+ import { type Refreshing } from './refresh.js';
6
+ import type { ReplicaRecord } from './replica.js';
7
+ import type { StagedPage, TransferRecord } from './store.js';
8
+ import { type Unconfirmed } from './transfer.js';
9
+ export type Bootstrapped = {
10
+ kind: 'staged';
11
+ record: ReplicaRecord;
12
+ refreshed: boolean;
13
+ };
14
+ export type BootstrapOutcome = Bootstrapped | Unconfirmed | NotReady | RetryableRefusal | AdapterFailure;
15
+ export type HeldModels = {
16
+ collection: ModelState;
17
+ };
18
+ export type Remodel = (models: RoomModels | undefined, held: HeldModels) => HeldModels;
19
+ export type Reads = Pick<Adapter, 'bootstrap' | 'refresh' | 'reached'>;
20
+ export type Arriving = {
21
+ at(bytes: number): void;
22
+ end(): void;
23
+ };
24
+ export type Resumed = {
25
+ readonly record: TransferRecord | null;
26
+ readonly staged: ReadonlySet<string>;
27
+ };
28
+ export type Staging = {
29
+ held(locator: string): TransferRecord | null;
30
+ turn(locator: string, step: InstallationStep): Promise<() => void>;
31
+ unqueued(): Promise<void>;
32
+ queued(text: number): () => void;
33
+ arriving(locator: string): Arriving;
34
+ readonly streamed: boolean;
35
+ stage(record: TransferRecord, page: StagedPage, composition: Composition): Promise<TransferRecord | null>;
36
+ resume(record: TransferRecord, parts: readonly BootstrapPart[], composition: Composition): Promise<Resumed | null>;
37
+ derive(locator: string, key: number, composition: Composition): Promise<boolean>;
38
+ refreshing(locator: string, key: number, composition: Composition): Promise<Refreshing>;
39
+ abandon(locator: string): Promise<void>;
40
+ setAside(locator: string): Promise<void>;
41
+ release(key: number): Promise<void>;
42
+ };
43
+ export declare function bootstrapRoom(adapter: Reads, authorization: Authorization, room: DiscoveredRoom, held: HeldModels, builtIn: ModelState, typedPaths: readonly TypedPath[], remodel: Remodel, continuing: () => boolean, staging: Staging): Promise<BootstrapOutcome>;
@@ -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 {};
@@ -0,0 +1,27 @@
1
+ export type DocumentChange = {
2
+ readonly locator: string;
3
+ readonly path: string | null;
4
+ };
5
+ export type ChangeSet = {
6
+ documents: readonly DocumentChange[];
7
+ drafts: readonly {
8
+ locator: string;
9
+ path: string;
10
+ }[];
11
+ rooms: readonly string[];
12
+ queues: readonly string[];
13
+ presentations: readonly string[];
14
+ conversations: readonly string[];
15
+ };
16
+ type Changed = {
17
+ documents?: readonly string[] | null;
18
+ drafts?: readonly string[];
19
+ room?: boolean;
20
+ queue?: boolean;
21
+ presentation?: string;
22
+ };
23
+ export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
24
+ export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
25
+ export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
26
+ export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
27
+ export {};