@agentshouse/app-bridge 0.1.0-c43d9cbcf6c8d → 0.1.0-c44cf2cfcc09a

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 +6 -6
  2. package/dist/index.d.ts +143 -399
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/definition.d.ts +20 -10
  5. package/dist/mdmodel/document.d.ts +14 -7
  6. package/dist/mdmodel/event.d.ts +76 -0
  7. package/dist/mdmodel/facts.d.ts +14 -0
  8. package/dist/mdmodel/fields.d.ts +1 -1
  9. package/dist/mdmodel/index.d.ts +27 -13
  10. package/dist/mdmodel/kinds.d.ts +17 -0
  11. package/dist/mdmodel/markdown.d.ts +74 -0
  12. package/dist/mdmodel/paths.d.ts +10 -1
  13. package/dist/mdmodel/pattern.d.ts +9 -0
  14. package/dist/mdmodel/query/language.d.ts +253 -0
  15. package/dist/mdmodel/query/match.d.ts +13 -0
  16. package/dist/mdmodel/query/rows.d.ts +31 -0
  17. package/dist/mdmodel/query/sql.d.ts +38 -0
  18. package/dist/mdmodel/reserved.d.ts +5 -0
  19. package/dist/mdmodel/types.d.ts +21 -7
  20. package/dist/mdmodel/validate.d.ts +10 -6
  21. package/dist/mdruntime/actions.d.ts +25 -0
  22. package/dist/mdruntime/adapter.d.ts +71 -69
  23. package/dist/mdruntime/attached-model.d.ts +7 -0
  24. package/dist/mdruntime/bootstrap.d.ts +43 -0
  25. package/dist/mdruntime/cell.d.ts +5 -0
  26. package/dist/mdruntime/chain.d.ts +2 -1
  27. package/dist/mdruntime/change-set.d.ts +4 -0
  28. package/dist/mdruntime/change.d.ts +1 -0
  29. package/dist/mdruntime/client.d.ts +27 -19
  30. package/dist/mdruntime/collection.d.ts +23 -4
  31. package/dist/mdruntime/compile.d.ts +8 -6
  32. package/dist/mdruntime/conversation-live.d.ts +139 -0
  33. package/dist/mdruntime/conversation-row.d.ts +32 -0
  34. package/dist/mdruntime/conversation.d.ts +59 -45
  35. package/dist/mdruntime/declaration.d.ts +9 -0
  36. package/dist/mdruntime/durability.d.ts +18 -0
  37. package/dist/mdruntime/failure.d.ts +3 -0
  38. package/dist/mdruntime/figures.d.ts +48 -0
  39. package/dist/mdruntime/holdings.d.ts +28 -0
  40. package/dist/mdruntime/identity.d.ts +0 -1
  41. package/dist/mdruntime/listing.d.ts +47 -0
  42. package/dist/mdruntime/live.d.ts +22 -0
  43. package/dist/mdruntime/log.d.ts +5 -0
  44. package/dist/mdruntime/media.d.ts +1 -1
  45. package/dist/mdruntime/messages.d.ts +24 -3
  46. package/dist/mdruntime/model.d.ts +2 -10
  47. package/dist/mdruntime/observation.d.ts +2 -2
  48. package/dist/mdruntime/opened.d.ts +1 -1
  49. package/dist/mdruntime/outcome.d.ts +7 -1
  50. package/dist/mdruntime/overlay.d.ts +6 -1
  51. package/dist/mdruntime/preparation.d.ts +19 -0
  52. package/dist/mdruntime/presence.d.ts +51 -0
  53. package/dist/mdruntime/query.d.ts +13 -209
  54. package/dist/mdruntime/reach.d.ts +14 -12
  55. package/dist/mdruntime/readiness.d.ts +0 -3
  56. package/dist/mdruntime/reads.d.ts +38 -0
  57. package/dist/mdruntime/recovery.d.ts +3 -1
  58. package/dist/mdruntime/refresh.d.ts +26 -0
  59. package/dist/mdruntime/replica.d.ts +11 -16
  60. package/dist/mdruntime/retried.d.ts +29 -0
  61. package/dist/mdruntime/room-draft.d.ts +7 -8
  62. package/dist/mdruntime/room-drafts.d.ts +23 -0
  63. package/dist/mdruntime/runtime.d.ts +35 -0
  64. package/dist/mdruntime/save.d.ts +42 -86
  65. package/dist/mdruntime/saves.d.ts +31 -0
  66. package/dist/mdruntime/search.d.ts +12 -63
  67. package/dist/mdruntime/seed.d.ts +11 -2
  68. package/dist/mdruntime/socket/admission.d.ts +6 -0
  69. package/dist/mdruntime/socket/answers.d.ts +5 -0
  70. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  71. package/dist/mdruntime/socket/session.d.ts +37 -0
  72. package/dist/mdruntime/socket.d.ts +67 -0
  73. package/dist/mdruntime/source.d.ts +53 -0
  74. package/dist/mdruntime/status.d.ts +0 -2
  75. package/dist/mdruntime/store/installs.d.ts +29 -0
  76. package/dist/mdruntime/store/readiness.d.ts +9 -0
  77. package/dist/mdruntime/store/records.d.ts +212 -0
  78. package/dist/mdruntime/store/room-held.d.ts +7 -0
  79. package/dist/mdruntime/store/space.d.ts +10 -0
  80. package/dist/mdruntime/store/watchers.d.ts +16 -0
  81. package/dist/mdruntime/store/writes.d.ts +23 -0
  82. package/dist/mdruntime/store.d.ts +112 -145
  83. package/dist/mdruntime/stored.d.ts +59 -33
  84. package/dist/mdruntime/surface.d.ts +88 -0
  85. package/dist/mdruntime/tables.d.ts +116 -29
  86. package/dist/mdruntime/tallies.d.ts +17 -0
  87. package/dist/mdruntime/transfer.d.ts +4 -0
  88. package/dist/mdruntime/wire.d.ts +69 -5
  89. package/dist/session-content/bounds.d.ts +7 -0
  90. package/dist/session-content/check.d.ts +18 -0
  91. package/dist/session-content/index.d.ts +7 -0
  92. package/dist/session-content/parts.d.ts +102 -0
  93. package/dist/session-content/state.d.ts +61 -0
  94. package/dist/session-content/turn.d.ts +328 -0
  95. package/dist/test-host.js +1 -1
  96. package/docs/families.md +24 -17
  97. package/package.json +2 -2
  98. package/dist/mdmodel/blocks.d.ts +0 -10
  99. package/dist/mdmodel/condition.d.ts +0 -179
  100. package/dist/mdmodel/links.d.ts +0 -28
  101. package/dist/mdmodel/profile.d.ts +0 -5
  102. package/dist/mdruntime/connection.d.ts +0 -152
  103. package/dist/mdruntime/fulltext.d.ts +0 -26
@@ -1,4 +1,7 @@
1
+ import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
2
+ import type { Operation, SessionState } from '../session-content/index.js';
1
3
  import type { ModelResult } from './model.js';
4
+ export type { SavedFacts, TypedPath };
2
5
  import type { Open } from './open.js';
3
6
  import type { ChangeBatch } from './change.js';
4
7
  export type Authorization = object;
@@ -11,22 +14,25 @@ export type TypedSelection = {
11
14
  };
12
15
  export type OperationScopes = {
13
16
  write: readonly string[];
14
- delete: readonly string[];
17
+ erase: readonly string[];
15
18
  };
16
19
  export type ReplicaAdmission = {
17
20
  selection: string;
18
21
  admission: Open<'admitted' | 'unavailable'>;
19
22
  offline: Open<'locked' | 'open'>;
20
23
  };
21
- export type DiscoveredRoom = {
22
- name: string;
23
- locator: string;
24
- handle: string;
25
- roomVersion: string;
26
- operations: OperationScopes;
27
- replica: ReplicaAdmission;
28
- typedSelection?: TypedSelection;
29
- providerOwnedPaths: readonly string[];
24
+ export type RoomDeclaration = {
25
+ readonly name: string;
26
+ readonly handle: string;
27
+ readonly operations: OperationScopes;
28
+ readonly replica: ReplicaAdmission;
29
+ readonly typedSelection: TypedSelection | null;
30
+ readonly providerOwnedPaths: readonly string[];
31
+ readonly authoredPaths: readonly string[];
32
+ };
33
+ export type DiscoveredRoom = RoomDeclaration & {
34
+ readonly locator: string;
35
+ readonly roomVersion: string;
30
36
  };
31
37
  export type Capability = {
32
38
  name: string;
@@ -44,8 +50,9 @@ export type ListedConversation = {
44
50
  outcome: string | null;
45
51
  waiting: boolean;
46
52
  newest: string | null;
53
+ processEnded: string | null;
47
54
  };
48
- 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';
49
56
  export type ConversationMessage = {
50
57
  identity: string;
51
58
  turn: string;
@@ -54,6 +61,7 @@ export type ConversationMessage = {
54
61
  };
55
62
  export type AcceptedMessage = ConversationMessage & {
56
63
  position: string;
64
+ change: string;
57
65
  };
58
66
  export type ConversationHistoryRequest = {
59
67
  conversations: readonly {
@@ -69,37 +77,10 @@ export type ConversationHistoryPage = {
69
77
  export type ConversationHistories = {
70
78
  histories: readonly ConversationHistoryPage[];
71
79
  };
72
- export type TurnContext = {
73
- used: number;
74
- window: number;
75
- };
76
80
  export type TurnOperation = {
77
81
  op: 'begin';
78
82
  at: string;
79
- } | {
80
- op: 'start';
81
- index: number;
82
- part: unknown;
83
- } | {
84
- op: 'append';
85
- index: number;
86
- text: string;
87
- } | {
88
- op: 'status';
89
- index: number;
90
- status: string;
91
- result: unknown;
92
- } | {
93
- op: 'count';
94
- index: number;
95
- count: number;
96
- } | {
97
- op: 'plan';
98
- index: number;
99
- entries: readonly unknown[];
100
- } | ({
101
- op: 'context';
102
- } & TurnContext);
83
+ } | Operation;
103
84
  export type ProcessCommand = {
104
85
  [field: string]: unknown;
105
86
  name: string;
@@ -136,10 +117,6 @@ export type SessionOption = (SessionOptionNaming & {
136
117
  type: 'boolean';
137
118
  currentValue: boolean;
138
119
  });
139
- export type RunningSubagent = {
140
- description: string;
141
- activity: string | null;
142
- };
143
120
  export type ConversationEvent = {
144
121
  kind: 'turn';
145
122
  conversation: string;
@@ -166,9 +143,9 @@ export type ConversationEvent = {
166
143
  conversation: string;
167
144
  step: string | null;
168
145
  } | {
169
- kind: 'subagents';
146
+ kind: 'state';
170
147
  conversation: string;
171
- subagents: readonly RunningSubagent[];
148
+ state: SessionState | null;
172
149
  } | {
173
150
  kind: 'link';
174
151
  conversation: string;
@@ -176,6 +153,7 @@ export type ConversationEvent = {
176
153
  } | {
177
154
  kind: 'deliveries';
178
155
  conversation: string;
156
+ waiting: readonly string[];
179
157
  unknown: readonly string[];
180
158
  } | {
181
159
  kind: 'accepted-message';
@@ -197,10 +175,17 @@ export type ConversationEvent = {
197
175
  kind: 'unlisted';
198
176
  conversation: string;
199
177
  };
178
+ export type AgentEnvironment = {
179
+ identity: string;
180
+ name: string;
181
+ state: 'online' | 'offline';
182
+ };
200
183
  export type ListedAgent = {
201
184
  agent: string;
202
185
  name: string;
203
186
  retired: boolean;
187
+ cli: string;
188
+ environment: AgentEnvironment;
204
189
  };
205
190
  export type ConversationStream = {
206
191
  replicate(conversations: readonly string[]): void;
@@ -227,7 +212,6 @@ export type HistoryRetention = {
227
212
  };
228
213
  export type Retention = {
229
214
  history: HistoryRetention;
230
- outcome: number;
231
215
  refreshHorizon: number;
232
216
  };
233
217
  export type Discovery = {
@@ -240,6 +224,7 @@ export type Discovery = {
240
224
  };
241
225
  export type TransportUncertainty = {
242
226
  kind: 'transport-uncertainty';
227
+ failure?: unknown;
243
228
  };
244
229
  export type RoomNotReadable = {
245
230
  kind: 'room-not-readable';
@@ -283,25 +268,17 @@ export type BinaryFile = {
283
268
  mediaType: string;
284
269
  sha256: string;
285
270
  };
286
- export type HeldFile = {
287
- readonly path: string;
288
- readonly revision: string;
289
- };
290
- export type HeldContent = {
291
- files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
292
- contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
293
- readonly content: string;
294
- readonly revision: string;
295
- }>>;
296
- };
297
271
  export type BootstrapRequest = {
298
272
  locator: string;
299
273
  selection: string;
300
274
  pageToken?: PageToken;
301
- held?: HeldContent;
302
275
  arriving?: (bytes: number) => void;
303
276
  signal?: AbortSignal;
304
277
  };
278
+ export type BootstrapPart = {
279
+ readonly id: string;
280
+ readonly bytes: number;
281
+ };
305
282
  export type BootstrapInventory = {
306
283
  readonly bytes: number;
307
284
  };
@@ -313,17 +290,23 @@ export type BootstrapPage = {
313
290
  roomVersion: string;
314
291
  models?: RoomModels;
315
292
  documents: Readonly<Record<string, string>>;
293
+ facts: Readonly<Record<string, SavedFacts>>;
316
294
  revisions: Readonly<Record<string, string>>;
317
295
  fileIds?: Readonly<Record<string, string>>;
296
+ created?: Readonly<Record<string, string>>;
318
297
  changes: Readonly<Record<string, HeadChange>>;
319
298
  binaryFiles: Readonly<Record<string, BinaryFile>>;
320
299
  folders?: readonly string[];
321
300
  pageToken?: PageToken;
301
+ parts?: readonly BootstrapPart[];
322
302
  bytes?: number;
323
303
  };
304
+ export type NotReady = {
305
+ kind: 'not-ready';
306
+ };
324
307
  export type BootstrapResult = BootstrapPage | {
325
308
  kind: 'beyond-horizon';
326
- } | AdapterFailure;
309
+ } | NotReady | AdapterFailure;
327
310
  export type RefreshRequest = {
328
311
  locator: string;
329
312
  selection: string;
@@ -335,8 +318,10 @@ export type RefreshPage = {
335
318
  roomVersion: string;
336
319
  models?: RoomModels;
337
320
  documents: Readonly<Record<string, string>>;
321
+ facts: Readonly<Record<string, SavedFacts>>;
338
322
  revisions: Readonly<Record<string, string>>;
339
323
  fileIds?: Readonly<Record<string, string>>;
324
+ created?: Readonly<Record<string, string>>;
340
325
  changes: Readonly<Record<string, HeadChange>>;
341
326
  binaryFiles: Readonly<Record<string, BinaryFile>>;
342
327
  removals: readonly string[];
@@ -386,15 +371,9 @@ export type MutationResult = (AcceptedRoom & {
386
371
  affected: Readonly<Record<string, string>>;
387
372
  }) | RetryableRefusal | {
388
373
  kind: 'write-halted';
389
- } | {
390
- kind: 'expired';
391
- restored?: true;
392
374
  } | AdapterFailure;
393
375
  export type HistoryAuthor = {
394
- kind: 'user';
395
- id: string;
396
- } | {
397
- kind: 'site' | 'inbox' | 'app';
376
+ kind: 'user' | 'site' | 'inbox' | 'app';
398
377
  id: string;
399
378
  name: string;
400
379
  };
@@ -470,17 +449,34 @@ export type ActionResult = {
470
449
  kind: 'action';
471
450
  result: unknown;
472
451
  at?: RoomVersionAt;
452
+ } | (ProviderRefusal & {
453
+ kind: 'rejected';
454
+ reset?: string;
455
+ }) | AdapterFailure;
456
+ export type SearchHit = {
457
+ room: string;
458
+ path: string;
459
+ line?: number;
460
+ snippet?: string;
461
+ };
462
+ export type SearchAsk = {
463
+ text: string;
464
+ rooms: readonly string[] | null;
465
+ };
466
+ export type SearchAnswer = {
467
+ kind: 'found';
468
+ documents: readonly SearchHit[];
473
469
  } | (ProviderRefusal & {
474
470
  kind: 'rejected';
475
471
  }) | AdapterFailure;
476
472
  export type HeldRoom = {
477
473
  locator: string;
478
- roomVersion: string;
474
+ roomVersion: string | null;
479
475
  };
480
476
  export type RoomChange = {
481
477
  kind: 'room-change';
482
478
  locator: string;
483
- from: string;
479
+ from: string | null;
484
480
  roomVersion: string;
485
481
  read(): Promise<RefreshPage>;
486
482
  };
@@ -499,6 +495,7 @@ export type RoomStreamEvent = {
499
495
  kind: 'closed';
500
496
  revoked: boolean;
501
497
  lost: boolean;
498
+ authorityChanged: boolean;
502
499
  } | {
503
500
  kind: 'caught-up';
504
501
  expired: readonly string[];
@@ -507,10 +504,15 @@ export type RoomStream = {
507
504
  hold(rooms: readonly HeldRoom[]): void;
508
505
  observe(notify: (event: RoomStreamEvent) => void): () => void;
509
506
  };
507
+ export type PathRule = (path: string) => boolean;
510
508
  export type Adapter = {
511
509
  readonly localSaves?: true;
512
510
  readonly roomTypes?: string;
513
511
  readonly nameableRoomTypes?: readonly string[];
512
+ readonly typedPaths?: readonly TypedPath[];
513
+ readonly pathRule?: PathRule;
514
+ readonly unkeptReads?: readonly string[];
515
+ readonly leadingReads?: readonly string[];
514
516
  authorize(): Promise<Authorization>;
515
517
  discover?(authorization: Authorization): Promise<DiscoverResult>;
516
518
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
@@ -521,10 +523,10 @@ export type Adapter = {
521
523
  link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
522
524
  attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
523
525
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
526
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
524
527
  reached(locator: string, roomVersion: string, target: string): boolean;
525
528
  follows(locator: string, roomVersion: string, next: string): boolean;
526
529
  roomStream?: RoomStream;
527
530
  conversations?: ConversationStream;
528
531
  serviceMode?: ServiceModeSignal;
529
532
  };
530
- 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 = {
@@ -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;
@@ -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,15 +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, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
8
+ import type { UnsentWork } from './durability.js';
9
+ import type { ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView } from './conversation.js';
4
10
  import { type Observation } from './observation.js';
5
- import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
6
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
11
+ import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, 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';
7
15
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
8
16
  import type { SearchRequest, SearchResult } from './search.js';
9
17
  import type { Readiness } from './readiness.js';
18
+ import type { ObservedRead } from './reads.js';
10
19
  import type { SyncStatus } from './status.js';
11
20
  import { type RuntimePort } from './wire.js';
21
+ export type BuildFile = (name: string) => Promise<Blob | null>;
12
22
  export type MdRuntimeClient = {
23
+ buildFile(name: string): Promise<Blob | null>;
13
24
  rooms(): Promise<readonly AppRoom[]>;
14
25
  query: {
15
26
  (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
@@ -30,21 +41,10 @@ export type MdRuntimeClient = {
30
41
  write(value: unknown): Promise<void>;
31
42
  edit(members: Readonly<Record<string, unknown>>): Promise<void>;
32
43
  };
33
- conversation: {
34
- list(): Promise<readonly ConversationEntry[]>;
35
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
36
- create(input: unknown): Promise<CallResult>;
37
- send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
38
- answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
39
- interrupt(conversation: string): Promise<CallResult>;
40
- kill(conversation: string): Promise<CallResult>;
41
- delete(conversation: string): Promise<CallResult>;
42
- };
43
- chatDraft: {
44
- write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
45
- prepend(conversation: string, draft: ChatDraft): Promise<void>;
46
- discard(conversation: string): Promise<void>;
44
+ conversation: ConversationSurface & {
45
+ pageMetadata(app: string, address: string): Promise<string>;
47
46
  };
47
+ chatDraft: ChatDraftSurface;
48
48
  history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
49
49
  resolve(room: string, path: string, destination: string): Promise<Resolution>;
50
50
  binaryFile: {
@@ -53,11 +53,15 @@ export type MdRuntimeClient = {
53
53
  download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
54
54
  };
55
55
  call(name: string, input: unknown): Promise<CallResult>;
56
+ answered(operation: string): Promise<boolean>;
56
57
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
57
58
  log(): Promise<string>;
58
59
  persistence(): Promise<boolean>;
59
60
  retry(): Promise<void>;
60
61
  cleanUp(): Promise<number>;
62
+ unsent(): Promise<readonly UnsentWork[]>;
63
+ reset(): Promise<void>;
64
+ readAgain(): Promise<void>;
61
65
  observe: {
62
66
  (topic: 'deployment-facts'): Promise<Observation<unknown>>;
63
67
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
@@ -67,6 +71,7 @@ export type MdRuntimeClient = {
67
71
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
68
72
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
69
73
  (topic: 'member'): Promise<Observation<Member | null>>;
74
+ (topic: 'authority-changes'): Promise<Observation<number>>;
70
75
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
71
76
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
72
77
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -75,11 +80,14 @@ export type MdRuntimeClient = {
75
80
  (topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
76
81
  (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
77
82
  (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
83
+ (topic: 'figures'): Promise<Observation<FiguresResult>>;
84
+ (topic: 'holdings'): Promise<Observation<Holdings>>;
85
+ (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
78
86
  };
79
87
  reauthorize(): Promise<void>;
80
88
  settled(): Promise<void>;
81
89
  };
82
- export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
90
+ export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
83
91
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
84
92
  export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
85
93
  export { roomDraftRevision } from './identity.js';
@@ -1,5 +1,6 @@
1
- import { type Document } from '../mdmodel/index.js';
2
- import type { ModelState } from './model.js';
1
+ import { type DefinitionOf, type Document, type TypedPath } 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 = {
@@ -13,15 +14,33 @@ export type Composition = {
13
14
  roots: readonly string[];
14
15
  model: ModelState;
15
16
  } | null;
17
+ typedPaths: readonly TypedPath[];
16
18
  };
17
19
  export type Composed = {
18
20
  readonly composition: Composition;
19
21
  readonly fingerprint: string;
20
22
  };
21
23
  export declare function composedOf(composition: Composition): Composed;
22
- export declare function selected(composition: Composition, path: string): boolean;
23
- export declare function governing(composition: Composition, path: string): ModelState;
24
+ type Selecting<M> = {
25
+ readonly model: M;
26
+ readonly selection: {
27
+ readonly roots: readonly string[];
28
+ readonly model: M;
29
+ } | null;
30
+ };
31
+ export declare function selected(composition: {
32
+ readonly selection: {
33
+ readonly roots: readonly string[];
34
+ } | null;
35
+ }, path: string): boolean;
36
+ export declare function governing<M>(composition: Selecting<M>, path: string): M;
37
+ export declare function definitionsAt(composition: Composition, path: string): DefinitionOf;
38
+ export declare function definitionsIn(room: {
39
+ readonly model: TypesResult;
40
+ readonly typedSelection: AppTypedSelection | null;
41
+ }, path: string, typedPaths: readonly TypedPath[]): DefinitionOf;
24
42
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
25
43
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
26
44
  export declare function validRoot(root: unknown): root is string;
27
45
  export declare function available(composition: Composition): boolean;
46
+ export {};
@@ -1,15 +1,17 @@
1
+ import { sql } from '../mdmodel/index.js';
2
+ import { type Composition } from './collection.js';
1
3
  import type { Plan, QueryRows } from './query.js';
2
- import type { Connection, Value } from './tables.js';
4
+ import type { Connection } from './tables.js';
3
5
  export type QueryRoom = {
4
6
  readonly locator: string;
5
7
  readonly key: number;
8
+ readonly composition?: Composition;
6
9
  };
7
- export type Fragment = {
8
- readonly sql: string;
9
- readonly bind: readonly Value[];
10
- };
10
+ type Fragment = sql.Fragment;
11
+ export declare const VISIBLE: (alias: string) => string;
12
+ export declare function within(alias: string, path: string): Fragment;
11
13
  export type QueryAnswer = QueryRows & {
12
14
  readonly more?: string;
13
15
  };
14
- export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
15
16
  export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
17
+ export {};