@agentshouse/app-bridge 0.1.0-c3aff7d33e077 → 0.1.0-c3ee7fcd01608

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 (103) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +173 -422
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/built-in.d.ts +3 -0
  5. package/dist/mdmodel/definition.d.ts +23 -10
  6. package/dist/mdmodel/document.d.ts +14 -8
  7. package/dist/mdmodel/event.d.ts +1 -2
  8. package/dist/mdmodel/fields.d.ts +1 -1
  9. package/dist/mdmodel/house-model.d.ts +869 -0
  10. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  11. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  12. package/dist/mdmodel/index.d.ts +31 -15
  13. package/dist/mdmodel/indexed.d.ts +8 -0
  14. package/dist/mdmodel/kinds.d.ts +4 -2
  15. package/dist/mdmodel/markdown.d.ts +74 -0
  16. package/dist/mdmodel/media-type.d.ts +71 -0
  17. package/dist/mdmodel/moment.d.ts +6 -0
  18. package/dist/mdmodel/not-ready.d.ts +1 -0
  19. package/dist/mdmodel/paths.d.ts +15 -1
  20. package/dist/mdmodel/query/language.d.ts +2 -1
  21. package/dist/mdmodel/query/match.d.ts +1 -1
  22. package/dist/mdmodel/query/rows.d.ts +1 -1
  23. package/dist/mdmodel/query/sql.d.ts +5 -1
  24. package/dist/mdmodel/query/walk.d.ts +62 -0
  25. package/dist/mdmodel/references.d.ts +2 -2
  26. package/dist/mdmodel/reserved.d.ts +1 -0
  27. package/dist/mdmodel/room-types.d.ts +6 -0
  28. package/dist/mdmodel/types.d.ts +11 -17
  29. package/dist/mdmodel/validate.d.ts +6 -2
  30. package/dist/mdmodel/yaml.d.ts +4 -4
  31. package/dist/mdruntime/actions.d.ts +8 -2
  32. package/dist/mdruntime/adapter.d.ts +120 -57
  33. package/dist/mdruntime/attached-model.d.ts +0 -1
  34. package/dist/mdruntime/authored.d.ts +87 -0
  35. package/dist/mdruntime/bootstrap.d.ts +1 -1
  36. package/dist/mdruntime/change-set.d.ts +4 -0
  37. package/dist/mdruntime/change.d.ts +4 -0
  38. package/dist/mdruntime/client.d.ts +19 -21
  39. package/dist/mdruntime/collection.d.ts +26 -4
  40. package/dist/mdruntime/compile.d.ts +2 -0
  41. package/dist/mdruntime/conversation-live.d.ts +28 -12
  42. package/dist/mdruntime/conversation-row.d.ts +8 -1
  43. package/dist/mdruntime/conversation.d.ts +37 -12
  44. package/dist/mdruntime/declaration.d.ts +9 -0
  45. package/dist/mdruntime/durability.d.ts +5 -0
  46. package/dist/mdruntime/failure.d.ts +3 -0
  47. package/dist/mdruntime/figures.d.ts +1 -0
  48. package/dist/mdruntime/house-query.d.ts +14 -0
  49. package/dist/mdruntime/install.d.ts +10 -6
  50. package/dist/mdruntime/listing.d.ts +29 -22
  51. package/dist/mdruntime/live.d.ts +5 -3
  52. package/dist/mdruntime/media.d.ts +19 -2
  53. package/dist/mdruntime/messages.d.ts +12 -6
  54. package/dist/mdruntime/modal.d.ts +1 -0
  55. package/dist/mdruntime/model.d.ts +4 -3
  56. package/dist/mdruntime/observation.d.ts +29 -12
  57. package/dist/mdruntime/opened.d.ts +1 -1
  58. package/dist/mdruntime/outcome.d.ts +13 -1
  59. package/dist/mdruntime/overlay.d.ts +6 -2
  60. package/dist/mdruntime/preparation.d.ts +33 -7
  61. package/dist/mdruntime/presence.d.ts +57 -0
  62. package/dist/mdruntime/query.d.ts +0 -1
  63. package/dist/mdruntime/reach.d.ts +15 -6
  64. package/dist/mdruntime/readiness.d.ts +20 -5
  65. package/dist/mdruntime/reads.d.ts +4 -2
  66. package/dist/mdruntime/recovery.d.ts +4 -1
  67. package/dist/mdruntime/replica.d.ts +5 -10
  68. package/dist/mdruntime/retried.d.ts +29 -0
  69. package/dist/mdruntime/room-draft.d.ts +31 -8
  70. package/dist/mdruntime/runtime.d.ts +11 -19
  71. package/dist/mdruntime/save.d.ts +42 -88
  72. package/dist/mdruntime/saves.d.ts +4 -40
  73. package/dist/mdruntime/socket/lanes.d.ts +12 -4
  74. package/dist/mdruntime/socket/session.d.ts +4 -2
  75. package/dist/mdruntime/socket.d.ts +4 -6
  76. package/dist/mdruntime/source.d.ts +5 -7
  77. package/dist/mdruntime/store/installs.d.ts +2 -2
  78. package/dist/mdruntime/store/readiness.d.ts +5 -4
  79. package/dist/mdruntime/store/records.d.ts +23 -8
  80. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  81. package/dist/mdruntime/store/space.d.ts +1 -1
  82. package/dist/mdruntime/store.d.ts +26 -16
  83. package/dist/mdruntime/stored.d.ts +33 -15
  84. package/dist/mdruntime/surface.d.ts +12 -6
  85. package/dist/mdruntime/tables.d.ts +19 -58
  86. package/dist/mdruntime/wire.d.ts +66 -7
  87. package/dist/session-content/check.d.ts +17 -0
  88. package/dist/session-content/index.d.ts +6 -0
  89. package/dist/session-content/parts.d.ts +30 -0
  90. package/dist/session-content/state.d.ts +59 -0
  91. package/dist/session-content/turn.d.ts +137 -0
  92. package/dist/test-host.d.ts +8 -1
  93. package/dist/test-host.js +44 -1
  94. package/docs/families.md +61 -33
  95. package/package.json +2 -2
  96. package/dist/mdmodel/blocks.d.ts +0 -10
  97. package/dist/mdmodel/links.d.ts +0 -28
  98. package/dist/mdmodel/profile.d.ts +0 -5
  99. package/dist/mdruntime/job.d.ts +0 -32
  100. package/dist/mdruntime/log.d.ts +0 -5
  101. package/dist/mdruntime/socket/rooms.d.ts +0 -42
  102. package/dist/mdruntime/store/fences.d.ts +0 -15
  103. package/dist/mdruntime/turn.d.ts +0 -8
@@ -1,8 +1,10 @@
1
- import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
1
+ import type { SavedFacts, TypedPath, VerifiedModel } from '../mdmodel/index.js';
2
+ import type { Operation, SessionState } from '../session-content/index.js';
2
3
  import type { ModelResult } from './model.js';
3
4
  export type { SavedFacts, TypedPath };
4
5
  import type { Open } from './open.js';
5
6
  import type { ChangeBatch } from './change.js';
7
+ import type { QueryDocument, QueryGroup } from './query.js';
6
8
  export type Authorization = object;
7
9
  export type MdModelIdentity = {
8
10
  identity: string;
@@ -20,15 +22,18 @@ export type ReplicaAdmission = {
20
22
  admission: Open<'admitted' | 'unavailable'>;
21
23
  offline: Open<'locked' | 'open'>;
22
24
  };
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[];
25
+ export type RoomDeclaration = {
26
+ readonly name: string;
27
+ readonly handle: string;
28
+ readonly operations: OperationScopes;
29
+ readonly replica: ReplicaAdmission;
30
+ readonly typedSelection: TypedSelection | null;
31
+ readonly providerOwnedPaths: readonly string[];
32
+ readonly authoredPaths: readonly string[];
33
+ };
34
+ export type DiscoveredRoom = RoomDeclaration & {
35
+ readonly locator: string;
36
+ readonly roomVersion: string;
32
37
  };
33
38
  export type Capability = {
34
39
  name: string;
@@ -38,8 +43,6 @@ export type Capability = {
38
43
  export type ListedConversation = {
39
44
  conversation: string;
40
45
  agent: string;
41
- agentName: string;
42
- agentRetired: boolean;
43
46
  name: string;
44
47
  created: string;
45
48
  finished: string | null;
@@ -47,8 +50,9 @@ export type ListedConversation = {
47
50
  waiting: boolean;
48
51
  newest: string | null;
49
52
  processEnded: string | null;
53
+ subject: string | null;
50
54
  };
51
- export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
55
+ export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/option/set' | 'conversations/retry' | 'agent-functions/decide';
52
56
  export type ConversationMessage = {
53
57
  identity: string;
54
58
  turn: string;
@@ -57,6 +61,7 @@ export type ConversationMessage = {
57
61
  };
58
62
  export type AcceptedMessage = ConversationMessage & {
59
63
  position: string;
64
+ change: string;
60
65
  };
61
66
  export type ConversationHistoryRequest = {
62
67
  conversations: readonly {
@@ -72,37 +77,10 @@ export type ConversationHistoryPage = {
72
77
  export type ConversationHistories = {
73
78
  histories: readonly ConversationHistoryPage[];
74
79
  };
75
- export type TurnContext = {
76
- used: number;
77
- window: number;
78
- };
79
80
  export type TurnOperation = {
80
81
  op: 'begin';
81
82
  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);
83
+ } | Operation;
106
84
  export type ProcessCommand = {
107
85
  [field: string]: unknown;
108
86
  name: string;
@@ -139,10 +117,6 @@ export type SessionOption = (SessionOptionNaming & {
139
117
  type: 'boolean';
140
118
  currentValue: boolean;
141
119
  });
142
- export type RunningSubagent = {
143
- description: string;
144
- activity: string | null;
145
- };
146
120
  export type ConversationEvent = {
147
121
  kind: 'turn';
148
122
  conversation: string;
@@ -169,9 +143,9 @@ export type ConversationEvent = {
169
143
  conversation: string;
170
144
  step: string | null;
171
145
  } | {
172
- kind: 'subagents';
146
+ kind: 'state';
173
147
  conversation: string;
174
- subagents: readonly RunningSubagent[];
148
+ state: SessionState | null;
175
149
  } | {
176
150
  kind: 'link';
177
151
  conversation: string;
@@ -179,6 +153,7 @@ export type ConversationEvent = {
179
153
  } | {
180
154
  kind: 'deliveries';
181
155
  conversation: string;
156
+ waiting: readonly string[];
182
157
  unknown: readonly string[];
183
158
  } | {
184
159
  kind: 'accepted-message';
@@ -189,6 +164,7 @@ export type ConversationEvent = {
189
164
  conversation: string;
190
165
  } | {
191
166
  kind: 'list';
167
+ agents: readonly ListedAgent[];
192
168
  entries: readonly ListedConversation[];
193
169
  whole: boolean;
194
170
  more: boolean;
@@ -196,20 +172,68 @@ export type ConversationEvent = {
196
172
  } | {
197
173
  kind: 'listed';
198
174
  entry: ListedConversation;
175
+ } | {
176
+ kind: 'agent';
177
+ agent: ListedAgent;
199
178
  } | {
200
179
  kind: 'unlisted';
201
180
  conversation: string;
202
181
  };
182
+ export type AgentEnvironment = {
183
+ identity: string;
184
+ name: string;
185
+ state: 'online' | 'offline';
186
+ };
187
+ export type ListedOwner = {
188
+ readonly user: string;
189
+ readonly name: string;
190
+ };
191
+ export type ListedSpaceRef = {
192
+ readonly space_ref: string;
193
+ readonly name: string;
194
+ };
195
+ export type RoomListEntry = {
196
+ readonly room_ref: string;
197
+ readonly room_handle: string;
198
+ readonly name: string;
199
+ readonly level: 'search' | 'open' | 'keep';
200
+ readonly access: 'owner' | 'manage' | 'write' | 'read' | 'public';
201
+ readonly owner: ListedOwner;
202
+ readonly created: string;
203
+ readonly archived?: string;
204
+ readonly exportable?: true;
205
+ readonly space?: ListedSpaceRef;
206
+ };
207
+ export type SpaceListEntry = ListedSpaceRef & {
208
+ readonly owner: ListedOwner;
209
+ readonly created: string;
210
+ readonly manages?: true;
211
+ };
212
+ export type RoomList = {
213
+ readonly rooms: readonly RoomListEntry[];
214
+ readonly spaces: readonly SpaceListEntry[];
215
+ };
203
216
  export type ListedAgent = {
204
- agent: string;
217
+ id: string;
205
218
  name: string;
206
- retired: boolean;
219
+ revision: number;
220
+ environment: string;
221
+ environment_name: string;
222
+ environment_connected: boolean;
223
+ launch_directory: string;
224
+ cli: string;
225
+ model: string | null;
226
+ effort: string | null;
227
+ mode: string | null;
228
+ base_instructions: string;
229
+ in_telegram: boolean;
230
+ created: string;
231
+ retired_at: string | null;
207
232
  };
208
233
  export type ConversationStream = {
209
234
  replicate(conversations: readonly string[]): void;
210
235
  hold(cursor: string | null): void;
211
236
  observe(notify: (event: ConversationEvent) => void): () => void;
212
- agents?(): Promise<readonly ListedAgent[] | null>;
213
237
  history?(request: ConversationHistoryRequest): Promise<ActionResult>;
214
238
  };
215
239
  export type ActionDeclaration = {
@@ -232,6 +256,11 @@ export type Retention = {
232
256
  history: HistoryRetention;
233
257
  refreshHorizon: number;
234
258
  };
259
+ export type QueriedRoom = {
260
+ readonly locator: string;
261
+ readonly handle: string;
262
+ readonly name: string;
263
+ };
235
264
  export type Discovery = {
236
265
  kind: 'discovery';
237
266
  rooms: readonly DiscoveredRoom[];
@@ -239,9 +268,13 @@ export type Discovery = {
239
268
  providerLimits: readonly ProviderLimit[];
240
269
  retention: Retention;
241
270
  member?: Member;
271
+ timeZone?: string | null;
272
+ roomList?: RoomList;
273
+ queriesOnly?: readonly QueriedRoom[];
242
274
  };
243
275
  export type TransportUncertainty = {
244
276
  kind: 'transport-uncertainty';
277
+ failure?: unknown;
245
278
  };
246
279
  export type RoomNotReadable = {
247
280
  kind: 'room-not-readable';
@@ -376,12 +409,9 @@ export type AcceptedRoom = {
376
409
  };
377
410
  export type MutationResult = (AcceptedRoom & {
378
411
  kind: 'accepted';
379
- author?: string;
380
- time?: string;
381
412
  destination?: AcceptedRoom;
382
413
  }) | (ProviderRefusal & {
383
414
  kind: 'conflicted';
384
- roomVersion?: string;
385
415
  affected: Readonly<Record<string, string>>;
386
416
  }) | (ProviderRefusal & {
387
417
  kind: 'rejected';
@@ -423,6 +453,10 @@ export type BinaryRequest = {
423
453
  path: string;
424
454
  revision: string;
425
455
  };
456
+ export type KeyedRequest = {
457
+ kind: 'key';
458
+ link: string;
459
+ };
426
460
  export type BinaryResult = {
427
461
  kind: 'binary';
428
462
  body: ReadableStream<Uint8Array>;
@@ -440,7 +474,7 @@ export type BinaryLinkResult = {
440
474
  kind: 'rejected';
441
475
  }) | AdapterFailure;
442
476
  export type AttachRequest = {
443
- locator: string;
477
+ locator?: string;
444
478
  name: string;
445
479
  mediaType: string;
446
480
  byteLength: number;
@@ -451,6 +485,9 @@ export type AttachResult = {
451
485
  kind: 'attached';
452
486
  path: string;
453
487
  revision: string;
488
+ } | {
489
+ kind: 'linked';
490
+ link: string;
454
491
  } | (ProviderRefusal & {
455
492
  kind: 'rejected';
456
493
  }) | AdapterFailure;
@@ -486,6 +523,26 @@ export type SearchAnswer = {
486
523
  } | (ProviderRefusal & {
487
524
  kind: 'rejected';
488
525
  }) | AdapterFailure;
526
+ export type HouseQueryAsk = {
527
+ room: string;
528
+ query: Readonly<Record<string, unknown>>;
529
+ };
530
+ export type HouseQueryRows = {
531
+ kind: 'rows';
532
+ documents: readonly QueryDocument[];
533
+ next?: string;
534
+ total?: number;
535
+ totalCapped?: true;
536
+ };
537
+ export type HouseQueryGroups = {
538
+ kind: 'groups';
539
+ groups: readonly QueryGroup[];
540
+ next?: string;
541
+ capped?: true;
542
+ };
543
+ export type HouseQueryAnswer = HouseQueryRows | HouseQueryGroups | (ProviderRefusal & {
544
+ kind: 'rejected';
545
+ }) | AdapterFailure;
489
546
  export type HeldRoom = {
490
547
  locator: string;
491
548
  roomVersion: string | null;
@@ -502,6 +559,10 @@ export type AuthorityChange = {
502
559
  rooms: readonly DiscoveredRoom[];
503
560
  left: readonly string[];
504
561
  member?: Member;
562
+ timeZone?: string | null;
563
+ roomList?: RoomList & {
564
+ readonly left: readonly string[];
565
+ };
505
566
  };
506
567
  export type RoomStreamEvent = {
507
568
  kind: 'opened';
@@ -516,6 +577,8 @@ export type RoomStreamEvent = {
516
577
  } | {
517
578
  kind: 'caught-up';
518
579
  expired: readonly string[];
580
+ } | {
581
+ kind: 'reported';
519
582
  } | AuthorityChange | RoomChange;
520
583
  export type RoomStream = {
521
584
  hold(rooms: readonly HeldRoom[]): void;
@@ -524,8 +587,7 @@ export type RoomStream = {
524
587
  export type PathRule = (path: string) => boolean;
525
588
  export type Adapter = {
526
589
  readonly localSaves?: true;
527
- readonly roomTypes?: string;
528
- readonly nameableRoomTypes?: readonly string[];
590
+ readonly roomTypes?: VerifiedModel;
529
591
  readonly typedPaths?: readonly TypedPath[];
530
592
  readonly pathRule?: PathRule;
531
593
  readonly unkeptReads?: readonly string[];
@@ -537,10 +599,11 @@ export type Adapter = {
537
599
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
538
600
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
539
601
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
540
- link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
602
+ link(authorization: Authorization, request: BinaryRequest | KeyedRequest): Promise<BinaryLinkResult>;
541
603
  attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
542
604
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
543
605
  search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
606
+ queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
544
607
  reached(locator: string, roomVersion: string, target: string): boolean;
545
608
  follows(locator: string, roomVersion: string, next: string): boolean;
546
609
  roomStream?: RoomStream;
@@ -1,7 +1,6 @@
1
1
  import { type VerifiedModel } from '../mdmodel/index.js';
2
2
  import type { ModelResult, ModelState } from './model.js';
3
3
  export declare const NO_ROOM_TYPES: VerifiedModel;
4
- export declare function roomTypesOf(schema: string | undefined, nameable?: readonly string[]): VerifiedModel;
5
4
  export declare function builtInModel(roomTypes: VerifiedModel): ModelState;
6
5
  export declare function schemaTypes(schema: string | null, roomTypes: VerifiedModel): VerifiedModel['types'];
7
6
  export declare function attachedModel(answer: ModelResult, roomTypes: VerifiedModel): ModelState;
@@ -0,0 +1,87 @@
1
+ import type { UnsentWork } from './durability.js';
2
+ import type { Connection, FileSpool, HeldStatus } from './tables.js';
3
+ export declare const FILE_PART_BYTES = 1048576;
4
+ export declare const AUTHORED_TABLES: readonly string[];
5
+ export type AuthoredFact = 'holder' | 'generation' | 'format';
6
+ export type StoredFile = {
7
+ readonly key: string;
8
+ readonly blob: Blob;
9
+ };
10
+ type KeptPending = {
11
+ readonly id: string;
12
+ readonly batch: string;
13
+ readonly state: string;
14
+ readonly files: readonly string[];
15
+ readonly paths: readonly string[];
16
+ readonly moving: boolean;
17
+ };
18
+ export type KeptRecord = {
19
+ readonly record: string;
20
+ readonly files: readonly string[];
21
+ };
22
+ export type AuthoredRows = {
23
+ readonly locator: string;
24
+ readonly order?: readonly string[];
25
+ readonly added?: readonly KeptPending[];
26
+ readonly founded?: readonly Omit<KeptPending, 'state'>[];
27
+ readonly roomDrafts?: readonly (KeptRecord & {
28
+ readonly path: string;
29
+ })[];
30
+ readonly consumedRoomDrafts?: readonly string[];
31
+ };
32
+ export type AuthoredWrite = {
33
+ readonly writes: readonly AuthoredRows[];
34
+ readonly files: readonly StoredFile[];
35
+ readonly whole: boolean;
36
+ };
37
+ export type HeldQueues = {
38
+ readonly queues: readonly {
39
+ readonly locator: string;
40
+ readonly ids: readonly string[];
41
+ }[];
42
+ readonly pending: readonly QueuedRow[];
43
+ };
44
+ type QueuedRow = {
45
+ readonly locator: string;
46
+ readonly id: string;
47
+ readonly batch: string;
48
+ readonly state: string;
49
+ };
50
+ export declare function authoredTable(name: string): boolean;
51
+ export declare function heldTables(connection: Connection): string[];
52
+ export declare function formatted(connection: Connection, format: string, tables: readonly string[]): void;
53
+ export declare function fact(connection: Connection, name: AuthoredFact): string | null;
54
+ export declare function remember(connection: Connection, name: AuthoredFact, value: string): null;
55
+ export declare function fenced(connection: Connection, locator: string): boolean;
56
+ export declare function authoredPart(connection: Connection, key: string, part: number): Uint8Array | null;
57
+ export declare function spooled(connection: Connection, spool: FileSpool, key: string, type: string): Promise<Blob>;
58
+ export declare function queues(connection: Connection): HeldQueues['queues'];
59
+ export declare function queuedLocators(connection: Connection): string[];
60
+ export declare function authoredLocators(connection: Connection): string[];
61
+ export declare function heldOrder(connection: Connection, locator: string): readonly string[];
62
+ export declare function queueOf(connection: Connection, locator: string): Omit<QueuedRow, 'locator'>[];
63
+ export declare function moving(connection: Connection): HeldQueues;
64
+ export declare function unsentStatus(connection: Connection): Omit<HeldStatus, 'lastCompleted'>;
65
+ export declare function pendingState(connection: Connection, locator: string, id: string): string | null;
66
+ export declare function pendingBatch(connection: Connection, locator: string, id: string): string | null;
67
+ export declare function roomDraftRecords(connection: Connection, locator: string | null, paths: readonly string[] | null): string[];
68
+ export declare function chatDraftRecord(connection: Connection, conversation: string): string | null;
69
+ export declare function chatDraftRecords(connection: Connection): string[];
70
+ export declare function chatDraftConversations(connection: Connection, conversations: readonly string[] | null): string[];
71
+ export declare function chatDraftsDropped(connection: Connection, conversations: readonly string[]): void;
72
+ export declare function callRecords(connection: Connection): string[];
73
+ export declare function fences(connection: Connection): string[];
74
+ export declare function kept(connection: Connection, { writes, files, whole }: AuthoredWrite): Promise<string | null>;
75
+ export declare function amended(connection: Connection, locator: string, id: string, amendment: string): null;
76
+ export declare function roomDraft(connection: Connection, locator: string, path: string, draft: KeptRecord | null, files: readonly StoredFile[]): Promise<string | null>;
77
+ export declare function chatDraft(connection: Connection, drafts: readonly {
78
+ readonly conversation: string;
79
+ readonly record: string;
80
+ }[], dropped: readonly string[]): null;
81
+ export declare function call(connection: Connection, operation: string, held: KeptRecord | null, files: readonly StoredFile[]): Promise<null>;
82
+ export declare function fencedWork(connection: Connection, locators: readonly string[]): void;
83
+ export declare function unfenced(connection: Connection, locators: readonly string[]): void;
84
+ export declare function claim(connection: Connection, holder: string): boolean;
85
+ export declare function authoredEmptied(connection: Connection): void;
86
+ export declare function unsent(connection: Connection): UnsentWork[];
87
+ export {};
@@ -3,7 +3,7 @@ import type { Adapter, TypedPath, AdapterFailure, Authorization, BootstrapPart,
3
3
  import type { Composition } from './collection.js';
4
4
  import type { InstallationStep } from './readiness.js';
5
5
  import { type Refreshing } from './refresh.js';
6
- import type { ReplicaRecord } from './replica.js';
6
+ import { type ReplicaRecord } from './replica.js';
7
7
  import type { StagedPage, TransferRecord } from './store.js';
8
8
  import { type Unconfirmed } from './transfer.js';
9
9
  export type Bootstrapped = {
@@ -12,6 +12,8 @@ export type ChangeSet = {
12
12
  queues: readonly string[];
13
13
  presentations: readonly string[];
14
14
  conversations: readonly string[];
15
+ unindexed: readonly string[];
16
+ due: readonly string[];
15
17
  };
16
18
  type Changed = {
17
19
  documents?: readonly string[] | null;
@@ -19,6 +21,8 @@ type Changed = {
19
21
  room?: boolean;
20
22
  queue?: boolean;
21
23
  presentation?: string;
24
+ unindexed?: boolean;
25
+ due?: boolean;
22
26
  };
23
27
  export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
24
28
  export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
@@ -53,6 +53,10 @@ type Arriving = {
53
53
  readonly created?: string;
54
54
  readonly change?: HeadChange;
55
55
  };
56
+ export type PartChange = Extract<Change, {
57
+ readonly kind: 'field' | 'section' | 'preamble';
58
+ }>;
59
+ export declare function isPart(change: Change): change is PartChange;
56
60
  export type RoomMove = {
57
61
  readonly source: {
58
62
  readonly room: string;
@@ -4,27 +4,31 @@ import type { AppRoom } from './listing.js';
4
4
  import type { ConnectionRefusal } from './socket.js';
5
5
  import type { RoomSchemas } from './surface.js';
6
6
  import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
7
- import type { Member, ServiceMode } from './adapter.js';
7
+ import type { ListedAgent, Member, RoomList, ServiceMode } from './adapter.js';
8
8
  import type { UnsentWork } from './durability.js';
9
- import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
9
+ import type { ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView } from './conversation.js';
10
10
  import { type Observation } from './observation.js';
11
- import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
11
+ import { type AttachAnswer, type BinaryAnswer, type CallResult, type DownloadAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
12
12
  import type { FiguresResult } from './figures.js';
13
13
  import type { Holdings } from './holdings.js';
14
14
  import type { DocumentResult, GroupResult, PendingResult } from './query.js';
15
15
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
16
16
  import type { SearchRequest, SearchResult } from './search.js';
17
+ import type { HouseQuery, HouseQueryResult } from './house-query.js';
17
18
  import type { Readiness } from './readiness.js';
18
19
  import type { ObservedRead } from './reads.js';
19
20
  import type { SyncStatus } from './status.js';
20
21
  import { type RuntimePort } from './wire.js';
22
+ export type BuildFile = (name: string) => Promise<Blob | null>;
21
23
  export type MdRuntimeClient = {
24
+ buildFile(name: string): Promise<Blob | null>;
22
25
  rooms(): Promise<readonly AppRoom[]>;
23
26
  query: {
24
27
  (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
25
28
  (query: GroupQuery): Promise<GroupResult | PendingResult>;
26
29
  };
27
30
  search(request: SearchRequest): Promise<SearchResult>;
31
+ queryHouse(query: HouseQuery): Promise<HouseQueryResult>;
28
32
  types(locator: string): Promise<RoomSchemas>;
29
33
  roomDraft: {
30
34
  list(): Promise<readonly RoomDraft[]>;
@@ -39,21 +43,10 @@ export type MdRuntimeClient = {
39
43
  write(value: unknown): Promise<void>;
40
44
  edit(members: Readonly<Record<string, unknown>>): Promise<void>;
41
45
  };
42
- conversation: {
43
- list(): Promise<readonly ConversationEntry[]>;
44
- read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
45
- create(input: unknown): Promise<CallResult>;
46
- send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
47
- answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
48
- interrupt(conversation: string): Promise<CallResult>;
49
- kill(conversation: string): Promise<CallResult>;
50
- delete(conversation: string): Promise<CallResult>;
51
- };
52
- chatDraft: {
53
- write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
54
- prepend(conversation: string, draft: ChatDraft): Promise<void>;
55
- discard(conversation: string): Promise<void>;
46
+ conversation: ConversationSurface & {
47
+ pageMetadata(app: string, address: string): Promise<string>;
56
48
  };
49
+ chatDraft: ChatDraftSurface;
57
50
  history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
58
51
  resolve(room: string, path: string, destination: string): Promise<Resolution>;
59
52
  binaryFile: {
@@ -62,12 +55,13 @@ export type MdRuntimeClient = {
62
55
  download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
63
56
  };
64
57
  call(name: string, input: unknown): Promise<CallResult>;
58
+ answered(operation: string): Promise<boolean>;
65
59
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
66
- log(): Promise<string>;
67
60
  persistence(): Promise<boolean>;
68
61
  retry(): Promise<void>;
69
62
  cleanUp(): Promise<number>;
70
63
  unsent(): Promise<readonly UnsentWork[]>;
64
+ sent(): Promise<void>;
71
65
  reset(): Promise<void>;
72
66
  readAgain(): Promise<void>;
73
67
  observe: {
@@ -79,6 +73,7 @@ export type MdRuntimeClient = {
79
73
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
80
74
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
81
75
  (topic: 'member'): Promise<Observation<Member | null>>;
76
+ (topic: 'time-zone'): Promise<Observation<string | null>>;
82
77
  (topic: 'authority-changes'): Promise<Observation<number>>;
83
78
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
84
79
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
@@ -88,6 +83,8 @@ export type MdRuntimeClient = {
88
83
  (topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
89
84
  (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
90
85
  (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
86
+ (topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
87
+ (topic: 'room-list'): Promise<Observation<RoomList | null>>;
91
88
  (topic: 'figures'): Promise<Observation<FiguresResult>>;
92
89
  (topic: 'holdings'): Promise<Observation<Holdings>>;
93
90
  (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
@@ -95,11 +92,12 @@ export type MdRuntimeClient = {
95
92
  reauthorize(): Promise<void>;
96
93
  settled(): Promise<void>;
97
94
  };
98
- export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
95
+ export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
99
96
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
100
97
  export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
101
98
  export { roomDraftRevision } from './identity.js';
102
- export { defineRoomMedia, ROOM_MEDIA } from './media.js';
99
+ export { defineRoomMedia, ROOM_MEDIA, viewFile } from './media.js';
100
+ export { shownModal } from './modal.js';
103
101
  export type { Observation } from './observation.js';
104
102
  export type { Open } from './open.js';
105
- export { unanswered, type RuntimePort, type WireMember } from './wire.js';
103
+ export { unanswered, undelivered, type RuntimePort, type WireMember } from './wire.js';
@@ -1,5 +1,6 @@
1
- import { type Document, type TypedPath } from '../mdmodel/index.js';
2
- import type { ModelState } from './model.js';
1
+ import { type DefinitionOf, type Document, type ParseResult, type TypedPath, type VerifiedModel } from '../mdmodel/index.js';
2
+ import type { ModelState, TypesResult } from './model.js';
3
+ import type { AppTypedSelection } from './listing.js';
3
4
  import type { MdModelIdentity } from './adapter.js';
4
5
  export declare const MD_MODEL: MdModelIdentity;
5
6
  export type Collection = {
@@ -19,10 +20,31 @@ export type Composed = {
19
20
  readonly composition: Composition;
20
21
  readonly fingerprint: string;
21
22
  };
23
+ export declare function typesPrint(types: VerifiedModel['types']): string;
22
24
  export declare function composedOf(composition: Composition): Composed;
23
- export declare function selected(composition: Composition, path: string): boolean;
24
- export declare function governing(composition: Composition, path: string): ModelState;
25
+ type Selecting<M> = {
26
+ readonly model: M;
27
+ readonly selection: {
28
+ readonly roots: readonly string[];
29
+ readonly model: M;
30
+ } | null;
31
+ };
32
+ export declare function selected(composition: {
33
+ readonly selection: {
34
+ readonly roots: readonly string[];
35
+ } | null;
36
+ }, path: string): boolean;
37
+ export declare function governing<M>(composition: Selecting<M>, path: string): M;
38
+ export declare function definitionsAt(composition: Composition, path: string): DefinitionOf;
39
+ export declare function definitionsIn(room: {
40
+ readonly model: TypesResult;
41
+ readonly typedSelection: AppTypedSelection | null;
42
+ }, path: string, typedPaths: readonly TypedPath[]): DefinitionOf;
25
43
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
26
44
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
27
45
  export declare function validRoot(root: unknown): root is string;
46
+ export declare const UNTYPED = "any";
47
+ export declare function textType(read: ParseResult): string | undefined;
48
+ export declare function typedText(read: ParseResult): boolean;
28
49
  export declare function available(composition: Composition): boolean;
50
+ export {};
@@ -1,9 +1,11 @@
1
1
  import { sql } from '../mdmodel/index.js';
2
+ import { type Composition } from './collection.js';
2
3
  import type { Plan, QueryRows } from './query.js';
3
4
  import type { Connection } from './tables.js';
4
5
  export type QueryRoom = {
5
6
  readonly locator: string;
6
7
  readonly key: number;
8
+ readonly composition?: Composition;
7
9
  };
8
10
  type Fragment = sql.Fragment;
9
11
  export declare const VISIBLE: (alias: string) => string;