@agentshouse/app-bridge 0.1.0-c8d8dc6285bbd → 0.1.0-c8dd3de04bf64

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 (95) hide show
  1. package/README.md +7 -7
  2. package/dist/index.d.ts +910 -19
  3. package/dist/mdmodel/definition.d.ts +1 -1
  4. package/dist/mdmodel/document.d.ts +2 -1
  5. package/dist/mdmodel/event.d.ts +77 -0
  6. package/dist/mdmodel/facts.d.ts +14 -0
  7. package/dist/mdmodel/index.d.ts +19 -7
  8. package/dist/mdmodel/kinds.d.ts +17 -0
  9. package/dist/mdmodel/pattern.d.ts +9 -0
  10. package/dist/mdmodel/query/language.d.ts +253 -0
  11. package/dist/mdmodel/query/match.d.ts +13 -0
  12. package/dist/mdmodel/query/rows.d.ts +31 -0
  13. package/dist/mdmodel/query/sql.d.ts +38 -0
  14. package/dist/mdmodel/reserved.d.ts +5 -0
  15. package/dist/mdmodel/types.d.ts +11 -0
  16. package/dist/mdmodel/validate.d.ts +7 -5
  17. package/dist/mdruntime/actions.d.ts +19 -0
  18. package/dist/mdruntime/adapter.d.ts +107 -71
  19. package/dist/mdruntime/attached-model.d.ts +7 -0
  20. package/dist/mdruntime/bootstrap.d.ts +43 -0
  21. package/dist/mdruntime/cell.d.ts +5 -0
  22. package/dist/mdruntime/chain.d.ts +2 -1
  23. package/dist/mdruntime/change.d.ts +1 -0
  24. package/dist/mdruntime/client.d.ts +28 -11
  25. package/dist/mdruntime/collection.d.ts +7 -4
  26. package/dist/mdruntime/compile.d.ts +6 -6
  27. package/dist/mdruntime/conversation-live.d.ts +135 -0
  28. package/dist/mdruntime/conversation-row.d.ts +32 -0
  29. package/dist/mdruntime/conversation.d.ts +41 -45
  30. package/dist/mdruntime/durability.d.ts +15 -1
  31. package/dist/mdruntime/figures.d.ts +48 -0
  32. package/dist/mdruntime/holdings.d.ts +28 -0
  33. package/dist/mdruntime/identity.d.ts +0 -1
  34. package/dist/mdruntime/install.d.ts +55 -0
  35. package/dist/mdruntime/job.d.ts +32 -0
  36. package/dist/mdruntime/listing.d.ts +52 -0
  37. package/dist/mdruntime/live.d.ts +22 -0
  38. package/dist/mdruntime/log.d.ts +5 -0
  39. package/dist/mdruntime/media.d.ts +7 -0
  40. package/dist/mdruntime/messages.d.ts +27 -3
  41. package/dist/mdruntime/model.d.ts +8 -10
  42. package/dist/mdruntime/observation.d.ts +3 -2
  43. package/dist/mdruntime/outcome.d.ts +17 -6
  44. package/dist/mdruntime/overlay.d.ts +1 -0
  45. package/dist/mdruntime/preparation.d.ts +19 -0
  46. package/dist/mdruntime/query.d.ts +18 -208
  47. package/dist/mdruntime/reach.d.ts +20 -11
  48. package/dist/mdruntime/readiness.d.ts +3 -18
  49. package/dist/mdruntime/reads.d.ts +36 -0
  50. package/dist/mdruntime/recovery.d.ts +1 -0
  51. package/dist/mdruntime/refresh.d.ts +26 -0
  52. package/dist/mdruntime/replica.d.ts +11 -12
  53. package/dist/mdruntime/room-draft.d.ts +21 -7
  54. package/dist/mdruntime/room-drafts.d.ts +23 -0
  55. package/dist/mdruntime/runtime.d.ts +42 -0
  56. package/dist/mdruntime/save.d.ts +7 -1
  57. package/dist/mdruntime/saves.d.ts +69 -0
  58. package/dist/mdruntime/search.d.ts +12 -63
  59. package/dist/mdruntime/seed.d.ts +11 -2
  60. package/dist/mdruntime/socket/admission.d.ts +6 -0
  61. package/dist/mdruntime/socket/answers.d.ts +5 -0
  62. package/dist/mdruntime/socket/lanes.d.ts +19 -0
  63. package/dist/mdruntime/socket/rooms.d.ts +43 -0
  64. package/dist/mdruntime/socket/session.d.ts +37 -0
  65. package/dist/mdruntime/socket.d.ts +69 -0
  66. package/dist/mdruntime/source.d.ts +60 -0
  67. package/dist/mdruntime/status.d.ts +4 -5
  68. package/dist/mdruntime/store/fences.d.ts +15 -0
  69. package/dist/mdruntime/store/installs.d.ts +29 -0
  70. package/dist/mdruntime/store/readiness.d.ts +9 -0
  71. package/dist/mdruntime/store/records.d.ts +211 -0
  72. package/dist/mdruntime/store/room-held.d.ts +7 -0
  73. package/dist/mdruntime/store/space.d.ts +10 -0
  74. package/dist/mdruntime/store/watchers.d.ts +16 -0
  75. package/dist/mdruntime/store/writes.d.ts +23 -0
  76. package/dist/mdruntime/store.d.ts +105 -158
  77. package/dist/mdruntime/stored.d.ts +66 -55
  78. package/dist/mdruntime/surface.d.ts +87 -0
  79. package/dist/mdruntime/tables.d.ts +131 -69
  80. package/dist/mdruntime/tallies.d.ts +17 -0
  81. package/dist/mdruntime/transfer.d.ts +0 -5
  82. package/dist/mdruntime/turn.d.ts +8 -0
  83. package/dist/mdruntime/wire.d.ts +25 -9
  84. package/dist/test-host.d.ts +1 -4
  85. package/dist/test-host.js +2 -28
  86. package/docs/families.md +49 -53
  87. package/package.json +1 -1
  88. package/dist/calls.d.ts +0 -1007
  89. package/dist/calls.js +0 -1
  90. package/dist/mdmodel/condition.d.ts +0 -160
  91. package/dist/mdmodel/profile.d.ts +0 -5
  92. package/dist/mdruntime/connection.d.ts +0 -151
  93. package/dist/mdruntime/file.d.ts +0 -11
  94. package/dist/mdruntime/fulltext.d.ts +0 -26
  95. package/dist/mdruntime/shared.d.ts +0 -15
@@ -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;
@@ -11,7 +13,7 @@ export type TypedSelection = {
11
13
  };
12
14
  export type OperationScopes = {
13
15
  write: readonly string[];
14
- delete: readonly string[];
16
+ erase: readonly string[];
15
17
  };
16
18
  export type ReplicaAdmission = {
17
19
  selection: string;
@@ -27,30 +29,27 @@ export type DiscoveredRoom = {
27
29
  replica: ReplicaAdmission;
28
30
  typedSelection?: TypedSelection;
29
31
  providerOwnedPaths: readonly string[];
32
+ authoredPaths?: readonly string[];
30
33
  };
31
34
  export type Capability = {
32
35
  name: string;
33
36
  limits?: readonly ProviderLimit[];
34
37
  actions?: readonly ActionDeclaration[];
35
- conversationAgents?: ConversationAgents;
36
- };
37
- export type ConversationAgents = {
38
- locator: string;
39
- type: string;
40
- identity: string;
41
- name: string;
42
- retired?: string;
43
38
  };
44
39
  export type ListedConversation = {
45
40
  conversation: string;
46
41
  agent: string;
42
+ agentName: string;
43
+ agentRetired: boolean;
47
44
  name: string;
48
45
  created: string;
49
46
  finished: string | null;
50
47
  outcome: string | null;
51
48
  waiting: boolean;
49
+ newest: string | null;
50
+ processEnded: string | null;
52
51
  };
53
- export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.attach' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
52
+ export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
54
53
  export type ConversationMessage = {
55
54
  identity: string;
56
55
  turn: string;
@@ -141,6 +140,10 @@ export type SessionOption = (SessionOptionNaming & {
141
140
  type: 'boolean';
142
141
  currentValue: boolean;
143
142
  });
143
+ export type RunningSubagent = {
144
+ description: string;
145
+ activity: string | null;
146
+ };
144
147
  export type ConversationEvent = {
145
148
  kind: 'turn';
146
149
  conversation: string;
@@ -166,6 +169,10 @@ export type ConversationEvent = {
166
169
  kind: 'starting';
167
170
  conversation: string;
168
171
  step: string | null;
172
+ } | {
173
+ kind: 'subagents';
174
+ conversation: string;
175
+ subagents: readonly RunningSubagent[];
169
176
  } | {
170
177
  kind: 'link';
171
178
  conversation: string;
@@ -184,6 +191,9 @@ export type ConversationEvent = {
184
191
  } | {
185
192
  kind: 'list';
186
193
  entries: readonly ListedConversation[];
194
+ whole: boolean;
195
+ more: boolean;
196
+ cursor: string | null;
187
197
  } | {
188
198
  kind: 'listed';
189
199
  entry: ListedConversation;
@@ -191,9 +201,17 @@ export type ConversationEvent = {
191
201
  kind: 'unlisted';
192
202
  conversation: string;
193
203
  };
204
+ export type ListedAgent = {
205
+ agent: string;
206
+ name: string;
207
+ retired: boolean;
208
+ };
194
209
  export type ConversationStream = {
195
210
  replicate(conversations: readonly string[]): void;
211
+ hold(cursor: string | null): void;
196
212
  observe(notify: (event: ConversationEvent) => void): () => void;
213
+ agents?(): Promise<readonly ListedAgent[] | null>;
214
+ history?(request: ConversationHistoryRequest): Promise<ActionResult>;
197
215
  };
198
216
  export type ActionDeclaration = {
199
217
  name: string;
@@ -213,7 +231,6 @@ export type HistoryRetention = {
213
231
  };
214
232
  export type Retention = {
215
233
  history: HistoryRetention;
216
- outcome: number;
217
234
  refreshHorizon: number;
218
235
  };
219
236
  export type Discovery = {
@@ -223,10 +240,6 @@ export type Discovery = {
223
240
  providerLimits: readonly ProviderLimit[];
224
241
  retention: Retention;
225
242
  member?: Member;
226
- covered?: readonly string[];
227
- };
228
- export type DiscoveryScope = {
229
- readonly authorities: readonly string[];
230
243
  };
231
244
  export type TransportUncertainty = {
232
245
  kind: 'transport-uncertainty';
@@ -255,7 +268,7 @@ export type ContractUnavailable = ProviderRefusal & {
255
268
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
256
269
  export type PageToken = string;
257
270
  export type ChangeAuthor = {
258
- kind: Open<'user' | 'site' | 'inbox'>;
271
+ kind: Open<'user' | 'site' | 'inbox' | 'app'>;
259
272
  id: string;
260
273
  name: string;
261
274
  };
@@ -273,50 +286,45 @@ export type BinaryFile = {
273
286
  mediaType: string;
274
287
  sha256: string;
275
288
  };
276
- export type HeldFile = {
277
- readonly path: string;
278
- readonly revision: string;
279
- };
280
- export type HeldContent = {
281
- files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
282
- contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
283
- readonly content: string;
284
- readonly revision: string;
285
- }>>;
286
- };
287
289
  export type BootstrapRequest = {
288
290
  locator: string;
289
291
  selection: string;
290
292
  pageToken?: PageToken;
291
- held?: HeldContent;
292
- received?: Uint8Array;
293
293
  arriving?: (bytes: number) => void;
294
+ signal?: AbortSignal;
295
+ };
296
+ export type BootstrapPart = {
297
+ readonly id: string;
298
+ readonly bytes: number;
294
299
  };
295
300
  export type BootstrapInventory = {
296
- readonly parts: number;
297
301
  readonly bytes: number;
298
302
  };
299
303
  export type RoomModels = {
300
304
  collection?: ModelResult;
301
- selection?: ModelResult;
302
305
  };
303
306
  export type BootstrapPage = {
304
307
  kind: 'bootstrap';
305
308
  roomVersion: string;
306
309
  models?: RoomModels;
307
310
  documents: Readonly<Record<string, string>>;
311
+ facts: Readonly<Record<string, SavedFacts>>;
308
312
  revisions: Readonly<Record<string, string>>;
309
313
  fileIds?: Readonly<Record<string, string>>;
314
+ created?: Readonly<Record<string, string>>;
310
315
  changes: Readonly<Record<string, HeadChange>>;
311
316
  binaryFiles: Readonly<Record<string, BinaryFile>>;
312
317
  folders?: readonly string[];
313
318
  pageToken?: PageToken;
314
- inventory?: BootstrapInventory;
315
- received?: Uint8Array;
319
+ parts?: readonly BootstrapPart[];
320
+ bytes?: number;
321
+ };
322
+ export type NotReady = {
323
+ kind: 'not-ready';
316
324
  };
317
325
  export type BootstrapResult = BootstrapPage | {
318
326
  kind: 'beyond-horizon';
319
- } | AdapterFailure;
327
+ } | NotReady | AdapterFailure;
320
328
  export type RefreshRequest = {
321
329
  locator: string;
322
330
  selection: string;
@@ -328,8 +336,10 @@ export type RefreshPage = {
328
336
  roomVersion: string;
329
337
  models?: RoomModels;
330
338
  documents: Readonly<Record<string, string>>;
339
+ facts: Readonly<Record<string, SavedFacts>>;
331
340
  revisions: Readonly<Record<string, string>>;
332
341
  fileIds?: Readonly<Record<string, string>>;
342
+ created?: Readonly<Record<string, string>>;
333
343
  changes: Readonly<Record<string, HeadChange>>;
334
344
  binaryFiles: Readonly<Record<string, BinaryFile>>;
335
345
  removals: readonly string[];
@@ -379,15 +389,9 @@ export type MutationResult = (AcceptedRoom & {
379
389
  affected: Readonly<Record<string, string>>;
380
390
  }) | RetryableRefusal | {
381
391
  kind: 'write-halted';
382
- } | {
383
- kind: 'expired';
384
- restored?: true;
385
392
  } | AdapterFailure;
386
393
  export type HistoryAuthor = {
387
- kind: 'user';
388
- id: string;
389
- } | {
390
- kind: 'site' | 'inbox';
394
+ kind: 'user' | 'site' | 'inbox' | 'app';
391
395
  id: string;
392
396
  name: string;
393
397
  };
@@ -432,6 +436,22 @@ export type BinaryLinkResult = {
432
436
  kind: 'link';
433
437
  url: string;
434
438
  name: string;
439
+ mediaType?: string;
440
+ } | (ProviderRefusal & {
441
+ kind: 'rejected';
442
+ }) | AdapterFailure;
443
+ export type AttachRequest = {
444
+ locator: string;
445
+ name: string;
446
+ mediaType: string;
447
+ byteLength: number;
448
+ sha256: string;
449
+ blob: Blob;
450
+ };
451
+ export type AttachResult = {
452
+ kind: 'attached';
453
+ path: string;
454
+ revision: string;
435
455
  } | (ProviderRefusal & {
436
456
  kind: 'rejected';
437
457
  }) | AdapterFailure;
@@ -447,68 +467,84 @@ export type ActionResult = {
447
467
  kind: 'action';
448
468
  result: unknown;
449
469
  at?: RoomVersionAt;
470
+ } | (ProviderRefusal & {
471
+ kind: 'rejected';
472
+ reset?: string;
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[];
450
487
  } | (ProviderRefusal & {
451
488
  kind: 'rejected';
452
489
  }) | AdapterFailure;
453
490
  export type HeldRoom = {
454
491
  locator: string;
492
+ roomVersion: string | null;
493
+ };
494
+ export type RoomChange = {
495
+ kind: 'room-change';
496
+ locator: string;
497
+ from: string | null;
455
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;
456
506
  };
457
- export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
458
507
  export type RoomStreamEvent = {
459
508
  kind: 'opened';
509
+ } | {
510
+ kind: 'discovered';
511
+ discovery: Discovery;
460
512
  } | {
461
513
  kind: 'closed';
462
514
  revoked: boolean;
463
515
  lost: boolean;
516
+ authorityChanged: boolean;
464
517
  } | {
465
- kind: 'opening';
518
+ kind: 'caught-up';
466
519
  expired: readonly string[];
467
- } | {
468
- kind: 'authority-changed';
469
- scope?: DiscoveryScope;
470
- } | {
471
- kind: 'room-version';
472
- locator: string;
473
- roomVersion: string;
474
- };
475
- export type KeptReceipt = {
476
- key: string;
477
- head: unknown;
478
- };
479
- export type StreamReceipts = {
480
- heads(): Promise<readonly KeptReceipt[]>;
481
- parts(key: string, count: number): Promise<readonly unknown[]>;
482
- keep(key: string, head: unknown, part?: {
483
- index: number;
484
- value: unknown;
485
- }): Promise<void>;
486
- drop(keys: readonly string[]): Promise<void>;
487
- };
520
+ } | AuthorityChange | RoomChange;
488
521
  export type RoomStream = {
489
522
  hold(rooms: readonly HeldRoom[]): void;
490
- reopen(): void;
491
- published(locator: string, roomVersion: string): void;
492
- observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
523
+ observe(notify: (event: RoomStreamEvent) => void): () => void;
493
524
  };
525
+ export type PathRule = (path: string) => boolean;
494
526
  export type Adapter = {
495
527
  readonly localSaves?: true;
496
- readonly exhaustiveDiscovery?: true;
497
528
  readonly roomTypes?: string;
498
529
  readonly nameableRoomTypes?: readonly string[];
530
+ readonly typedPaths?: readonly TypedPath[];
531
+ readonly pathRule?: PathRule;
532
+ readonly unkeptReads?: readonly string[];
533
+ readonly leadingReads?: readonly string[];
499
534
  authorize(): Promise<Authorization>;
500
- discover(authorization: Authorization, scope?: DiscoveryScope): Promise<DiscoverResult>;
535
+ discover?(authorization: Authorization): Promise<DiscoverResult>;
501
536
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
502
- refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
537
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
503
538
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
504
539
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
505
540
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
506
541
  link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
542
+ attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
507
543
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
544
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
508
545
  reached(locator: string, roomVersion: string, target: string): boolean;
509
546
  follows(locator: string, roomVersion: string, next: string): boolean;
510
547
  roomStream?: RoomStream;
511
548
  conversations?: ConversationStream;
512
549
  serviceMode?: ServiceModeSignal;
513
550
  };
514
- export {};
@@ -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,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,5 @@
1
+ export type Cell<T> = {
2
+ now(): T;
3
+ set(change: Partial<T>): void;
4
+ };
5
+ export declare function createCell<T extends object>(first: T): Cell<T>;
@@ -1,5 +1,6 @@
1
+ import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
1
2
  import type { MdRuntimeClient } from './client.js';
2
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
3
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
3
4
  type Rows = DocumentResult | GroupResult;
4
5
  export type WindowAnswer = Rows | PendingResult;
5
6
  export type WindowChain = {
@@ -50,6 +50,7 @@ type Arriving = {
50
50
  readonly path: string;
51
51
  readonly revision?: string;
52
52
  readonly fileId?: string;
53
+ readonly created?: string;
53
54
  readonly change?: HeadChange;
54
55
  };
55
56
  export type RoomMove = {
@@ -1,16 +1,26 @@
1
- import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
1
+ import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
2
+ import type { HistoryQuery } from './actions.js';
3
+ import type { AppRoom } from './listing.js';
4
+ import type { ConnectionRefusal } from './socket.js';
5
+ import type { RoomSchemas } from './surface.js';
6
+ import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
2
7
  import type { Member, ServiceMode } from './adapter.js';
3
- import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
8
+ import type { UnsentWork } from './durability.js';
9
+ import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
4
10
  import { type Observation } from './observation.js';
5
- import type { ChosenFile } from './file.js';
6
- import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
7
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
11
+ import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
12
+ import type { FiguresResult } from './figures.js';
13
+ import type { Holdings } from './holdings.js';
14
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
8
15
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
9
16
  import type { SearchRequest, SearchResult } from './search.js';
10
17
  import type { Readiness } from './readiness.js';
18
+ import type { ObservedRead } from './reads.js';
11
19
  import type { SyncStatus } from './status.js';
12
20
  import { type RuntimePort } from './wire.js';
21
+ export type BuildFile = (name: string) => Promise<Blob | null>;
13
22
  export type MdRuntimeClient = {
23
+ buildFile(name: string): Promise<Blob | null>;
14
24
  rooms(): Promise<readonly AppRoom[]>;
15
25
  query: {
16
26
  (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
@@ -33,14 +43,12 @@ export type MdRuntimeClient = {
33
43
  };
34
44
  conversation: {
35
45
  list(): Promise<readonly ConversationEntry[]>;
36
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
46
+ read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
37
47
  create(input: unknown): Promise<CallResult>;
38
48
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
39
- attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
40
- answer(conversation: string, answer: unknown): Promise<CallResult>;
49
+ answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
41
50
  interrupt(conversation: string): Promise<CallResult>;
42
51
  kill(conversation: string): Promise<CallResult>;
43
- cancel(conversation: string, turn: string): Promise<CallResult>;
44
52
  delete(conversation: string): Promise<CallResult>;
45
53
  };
46
54
  chatDraft: {
@@ -52,7 +60,8 @@ export type MdRuntimeClient = {
52
60
  resolve(room: string, path: string, destination: string): Promise<Resolution>;
53
61
  binaryFile: {
54
62
  read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
55
- link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
63
+ attach(room: string, file: File): Promise<AttachAnswer>;
64
+ download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
56
65
  };
57
66
  call(name: string, input: unknown): Promise<CallResult>;
58
67
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
@@ -60,6 +69,9 @@ export type MdRuntimeClient = {
60
69
  persistence(): Promise<boolean>;
61
70
  retry(): Promise<void>;
62
71
  cleanUp(): Promise<number>;
72
+ unsent(): Promise<readonly UnsentWork[]>;
73
+ reset(): Promise<void>;
74
+ readAgain(): Promise<void>;
63
75
  observe: {
64
76
  (topic: 'deployment-facts'): Promise<Observation<unknown>>;
65
77
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
@@ -69,6 +81,7 @@ export type MdRuntimeClient = {
69
81
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
70
82
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
71
83
  (topic: 'member'): Promise<Observation<Member | null>>;
84
+ (topic: 'authority-changes'): Promise<Observation<number>>;
72
85
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
73
86
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
74
87
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -77,14 +90,18 @@ export type MdRuntimeClient = {
77
90
  (topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
78
91
  (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
79
92
  (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
93
+ (topic: 'figures'): Promise<Observation<FiguresResult>>;
94
+ (topic: 'holdings'): Promise<Observation<Holdings>>;
95
+ (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
80
96
  };
81
97
  reauthorize(): Promise<void>;
82
98
  settled(): Promise<void>;
83
99
  };
84
- export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
100
+ export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
85
101
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
86
102
  export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
87
103
  export { roomDraftRevision } from './identity.js';
104
+ export { defineRoomMedia, ROOM_MEDIA } from './media.js';
88
105
  export type { Observation } from './observation.js';
89
106
  export type { Open } from './open.js';
90
107
  export { unanswered, type RuntimePort, type WireMember } from './wire.js';
@@ -1,8 +1,6 @@
1
- import { type Document } from '../mdmodel/index.js';
1
+ import { type Document, type TypedPath } from '../mdmodel/index.js';
2
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
4
  export declare const MD_MODEL: MdModelIdentity;
7
5
  export type Collection = {
8
6
  text: Readonly<Record<string, string>>;
@@ -15,11 +13,16 @@ export type Composition = {
15
13
  roots: readonly string[];
16
14
  model: ModelState;
17
15
  } | null;
16
+ typedPaths: readonly TypedPath[];
18
17
  };
18
+ export type Composed = {
19
+ readonly composition: Composition;
20
+ readonly fingerprint: string;
21
+ };
22
+ export declare function composedOf(composition: Composition): Composed;
19
23
  export declare function selected(composition: Composition, path: string): boolean;
20
24
  export declare function governing(composition: Composition, path: string): ModelState;
21
25
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
22
26
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
23
- export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
24
27
  export declare function validRoot(root: unknown): root is string;
25
28
  export declare function available(composition: Composition): boolean;
@@ -1,15 +1,15 @@
1
+ import { sql } from '../mdmodel/index.js';
1
2
  import type { Plan, QueryRows } from './query.js';
2
- import type { Connection, Value } from './tables.js';
3
+ import type { Connection } from './tables.js';
3
4
  export type QueryRoom = {
4
5
  readonly locator: string;
5
6
  readonly key: number;
6
7
  };
7
- export type Fragment = {
8
- readonly sql: string;
9
- readonly bind: readonly Value[];
10
- };
8
+ type Fragment = sql.Fragment;
9
+ export declare const VISIBLE: (alias: string) => string;
10
+ export declare function within(alias: string, path: string): Fragment;
11
11
  export type QueryAnswer = QueryRows & {
12
12
  readonly more?: string;
13
13
  };
14
- export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
15
14
  export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
15
+ export {};