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

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 (42) hide show
  1. package/README.md +4 -4
  2. package/dist/calls.d.ts +96 -44
  3. package/dist/index.d.ts +21 -0
  4. package/dist/mdmodel/condition.d.ts +0 -1
  5. package/dist/mdmodel/definition.d.ts +1 -0
  6. package/dist/mdmodel/index.d.ts +3 -2
  7. package/dist/mdmodel/types.d.ts +1 -0
  8. package/dist/mdmodel/validate.d.ts +21 -0
  9. package/dist/mdruntime/adapter.d.ts +24 -19
  10. package/dist/mdruntime/binary.d.ts +0 -5
  11. package/dist/mdruntime/chain.d.ts +10 -0
  12. package/dist/mdruntime/change-set.d.ts +6 -16
  13. package/dist/mdruntime/client.d.ts +3 -3
  14. package/dist/mdruntime/collection.d.ts +5 -19
  15. package/dist/mdruntime/compile.d.ts +15 -0
  16. package/dist/mdruntime/connection.d.ts +6 -7
  17. package/dist/mdruntime/conversation.d.ts +3 -1
  18. package/dist/mdruntime/durability.d.ts +2 -5
  19. package/dist/mdruntime/fulltext.d.ts +26 -0
  20. package/dist/mdruntime/identity.d.ts +6 -0
  21. package/dist/mdruntime/messages.d.ts +27 -0
  22. package/dist/mdruntime/observation.d.ts +12 -0
  23. package/dist/mdruntime/outcome.d.ts +0 -1
  24. package/dist/mdruntime/overlay.d.ts +0 -3
  25. package/dist/mdruntime/query.d.ts +4 -1
  26. package/dist/mdruntime/reach.d.ts +0 -2
  27. package/dist/mdruntime/readiness.d.ts +20 -9
  28. package/dist/mdruntime/replica.d.ts +57 -38
  29. package/dist/mdruntime/room-draft.d.ts +1 -0
  30. package/dist/mdruntime/save.d.ts +9 -10
  31. package/dist/mdruntime/search.d.ts +11 -43
  32. package/dist/mdruntime/shared.d.ts +0 -3
  33. package/dist/mdruntime/store.d.ts +84 -86
  34. package/dist/mdruntime/stored.d.ts +144 -0
  35. package/dist/mdruntime/tables.d.ts +280 -168
  36. package/dist/mdruntime/wire.d.ts +0 -4
  37. package/dist/test-host.d.ts +7 -1
  38. package/dist/test-host.js +16 -0
  39. package/docs/families.md +22 -5
  40. package/package.json +8 -3
  41. package/dist/mdruntime/rows.d.ts +0 -38
  42. package/dist/mdruntime/turn.d.ts +0 -8
package/README.md CHANGED
@@ -3,14 +3,14 @@
3
3
  The types of the agents.house App bridge, an accessor and an in-page test host.
4
4
  House builds the bridge object in every App it serves and hands it to the page
5
5
  before the App's own scripts run; `houseBridge()` returns that object, so an App
6
- carries no bridge code of its own. It carries eleven families: navigation,
6
+ carries no bridge code of its own. It carries twelve families: navigation,
7
7
  ceremonies, installation, notifications, status, Site image reads, App release
8
- code, external calls, App messages and App and Site screenshot reads.
8
+ code, external calls, App messages, App and Site screenshot reads and the Chat.
9
9
  [docs/families.md](docs/families.md) describes each and the test host.
10
10
 
11
11
  The bridge carries no credential handling and no Runtime family. House builds
12
- the MD Runtime client into the page beside the bridge, and `bridge.runtime`
13
- resolves to that client, so the App imports and constructs none.
12
+ the MD Runtime client into the page beside the bridge and serves it the Chat, so
13
+ the App imports, constructs and bundles neither: `bridge.runtime` resolves to the client.
14
14
 
15
15
  House's `find_command` "App" is the guide to building an App or a Site.
16
16
 
package/dist/calls.d.ts CHANGED
@@ -81,6 +81,7 @@ export interface HouseMethods {
81
81
  readonly params: {
82
82
  readonly agent_id: string;
83
83
  readonly operation_id?: string;
84
+ readonly replaces?: string;
84
85
  };
85
86
  readonly result: {
86
87
  readonly agent_id: string;
@@ -264,6 +265,86 @@ export interface HouseMethods {
264
265
  readonly log_epoch: string;
265
266
  };
266
267
  };
268
+ readonly 'inboxChat.assign': {
269
+ readonly params: {
270
+ readonly room_ref: string;
271
+ readonly path: string;
272
+ readonly assignee: {
273
+ readonly user: string;
274
+ } | {
275
+ readonly agent: string;
276
+ } | null;
277
+ };
278
+ readonly result: {
279
+ readonly room_ref: string;
280
+ readonly path: string;
281
+ readonly assignee: {
282
+ readonly user: string;
283
+ readonly name: string;
284
+ } | {
285
+ readonly agent: string;
286
+ readonly name: string;
287
+ } | null;
288
+ readonly return_to: {
289
+ readonly agent: string;
290
+ readonly name: string;
291
+ } | null;
292
+ readonly authority: string;
293
+ readonly position: string;
294
+ readonly log_epoch: string;
295
+ readonly url: string;
296
+ };
297
+ };
298
+ readonly 'inboxChat.return': {
299
+ readonly params: {
300
+ readonly room_ref: string;
301
+ readonly path: string;
302
+ };
303
+ readonly result: {
304
+ readonly room_ref: string;
305
+ readonly path: string;
306
+ readonly assignee: {
307
+ readonly user: string;
308
+ readonly name: string;
309
+ } | {
310
+ readonly agent: string;
311
+ readonly name: string;
312
+ } | null;
313
+ readonly return_to: {
314
+ readonly agent: string;
315
+ readonly name: string;
316
+ } | null;
317
+ readonly authority: string;
318
+ readonly position: string;
319
+ readonly log_epoch: string;
320
+ readonly url: string;
321
+ };
322
+ };
323
+ readonly 'inboxChat.takeControl': {
324
+ readonly params: {
325
+ readonly room_ref: string;
326
+ readonly path: string;
327
+ };
328
+ readonly result: {
329
+ readonly room_ref: string;
330
+ readonly path: string;
331
+ readonly assignee: {
332
+ readonly user: string;
333
+ readonly name: string;
334
+ } | {
335
+ readonly agent: string;
336
+ readonly name: string;
337
+ } | null;
338
+ readonly return_to: {
339
+ readonly agent: string;
340
+ readonly name: string;
341
+ } | null;
342
+ readonly authority: string;
343
+ readonly position: string;
344
+ readonly log_epoch: string;
345
+ readonly url: string;
346
+ };
347
+ };
267
348
  readonly 'member.list': {
268
349
  readonly params: {
269
350
  readonly room_ref: string;
@@ -333,48 +414,19 @@ export interface HouseMethods {
333
414
  readonly 'record.list': {
334
415
  readonly params: {
335
416
  readonly room_ref: string;
336
- readonly record?: string;
337
417
  readonly cursor?: string;
338
418
  readonly limit?: number;
339
419
  readonly order?: 'asc' | 'desc';
340
420
  };
341
421
  readonly result: {
342
- readonly attachments: readonly {
343
- readonly bytes: number;
344
- readonly file: string;
345
- readonly media_type: string | null;
346
- readonly name: string | null;
347
- readonly referrer: {
348
- readonly record: string;
349
- readonly room_ref: string;
350
- };
351
- readonly sha256: string;
352
- }[];
353
- readonly body: string | null;
354
- readonly claimed: unknown;
355
- readonly created_at: string;
356
- readonly record: string;
357
- readonly ref: string;
358
- } | {
359
- readonly next_cursor?: string;
360
422
  readonly records: readonly {
361
- readonly attachments: readonly {
362
- readonly bytes: number;
363
- readonly file: string;
364
- readonly media_type: string | null;
365
- readonly name: string | null;
366
- readonly referrer: {
367
- readonly record: string;
368
- readonly room_ref: string;
369
- };
370
- readonly sha256: string;
371
- }[];
372
- readonly body: string | null;
373
- readonly claimed: unknown;
374
- readonly created_at: string;
375
423
  readonly record: string;
376
424
  readonly ref: string;
425
+ readonly created_at: string;
426
+ readonly body: string | null;
427
+ readonly claimed: unknown;
377
428
  }[];
429
+ readonly next_cursor?: string;
378
430
  };
379
431
  };
380
432
  readonly 'relay.read': {
@@ -876,10 +928,15 @@ export interface HouseMethods {
876
928
  } | {
877
929
  readonly position: number;
878
930
  readonly outcome: 'no_target';
931
+ readonly code: 'no_recipient' | 'routine_access_not_found' | 'routine_retired' | 'target_agent_unavailable';
879
932
  } | {
880
933
  readonly position: number;
881
934
  readonly outcome: 'requested';
882
935
  readonly request: string;
936
+ } | {
937
+ readonly position: number;
938
+ readonly outcome: 'continued';
939
+ readonly request: string;
883
940
  } | {
884
941
  readonly position: number;
885
942
  readonly outcome: 'refused';
@@ -888,12 +945,12 @@ export interface HouseMethods {
888
945
  readonly position: number;
889
946
  readonly outcome: 'refused';
890
947
  readonly code: 'limit_reached';
891
- readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'external_calls' | 'routine_requests' | 'routine_mail';
948
+ readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'mcp_reads' | 'mcp_downloads' | 'external_calls' | 'routine_requests' | 'routine_mail';
892
949
  } | {
893
950
  readonly position: number;
894
951
  readonly outcome: 'refused';
895
952
  readonly code: 'limit_reached';
896
- readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'external_calls' | 'routine_requests' | 'routine_mail';
953
+ readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'mcp_reads' | 'mcp_downloads' | 'external_calls' | 'routine_requests' | 'routine_mail';
897
954
  readonly retry_at: string;
898
955
  } | {
899
956
  readonly position: number;
@@ -917,30 +974,25 @@ export interface HouseMethods {
917
974
  readonly limit: 'writes';
918
975
  readonly period: 'minute' | 'day';
919
976
  readonly retry_at: string;
920
- } | {
921
- readonly position: number;
922
- readonly outcome: 'refused';
923
- readonly code: 'limit_reached';
924
- readonly limit: 'mcp_reads' | 'mcp_downloads';
925
- readonly value: string;
926
- readonly retry_at: string;
927
977
  } | {
928
978
  readonly position: number;
929
979
  readonly outcome: 'refused';
930
980
  readonly code: 'cap_reached';
931
- readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'external_accounts' | 'shared_schemas' | 'export_starts' | 'share_creations' | 'share_room_creations' | 'live_shares' | 'ownership_offers' | 'site_rooms' | 'slot_rooms' | 'room_triggers' | 'app_sockets' | 'kit_connections' | 'open_uploads' | 'waiting_web_wizards';
981
+ readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'external_accounts' | 'shared_schemas' | 'export_starts' | 'share_creations' | 'share_room_creations' | 'live_shares' | 'ownership_offers' | 'site_rooms' | 'slot_rooms' | 'room_triggers' | 'app_sockets' | 'kit_connections' | 'open_uploads' | 'waiting_web_wizards' | 'folder_subscriptions';
932
982
  } | {
933
983
  readonly position: number;
934
984
  readonly outcome: 'refused';
935
985
  readonly code: 'cap_reached';
936
- readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'external_accounts' | 'shared_schemas' | 'export_starts' | 'share_creations' | 'share_room_creations' | 'live_shares' | 'ownership_offers' | 'site_rooms' | 'slot_rooms' | 'room_triggers' | 'app_sockets' | 'kit_connections' | 'open_uploads' | 'waiting_web_wizards';
986
+ readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'external_accounts' | 'shared_schemas' | 'export_starts' | 'share_creations' | 'share_room_creations' | 'live_shares' | 'ownership_offers' | 'site_rooms' | 'slot_rooms' | 'room_triggers' | 'app_sockets' | 'kit_connections' | 'open_uploads' | 'waiting_web_wizards' | 'folder_subscriptions';
937
987
  readonly retry_at: string;
938
988
  } | {
939
989
  readonly position: number;
940
990
  readonly outcome: 'withdrawn';
991
+ readonly code: 'agent_unavailable';
941
992
  } | {
942
993
  readonly position: number;
943
994
  readonly outcome: 'failed';
995
+ readonly code: 'internal_error' | 'routine_request_not_started';
944
996
  } | {
945
997
  readonly position: number;
946
998
  readonly outcome: 'waiting';
package/dist/index.d.ts CHANGED
@@ -134,8 +134,29 @@ export interface HouseCooperation {
134
134
  ready(): Promise<boolean> | boolean;
135
135
  settle(activation: HouseActivation): void;
136
136
  }
137
+ export type HouseChatWidth = 'full' | '3/4' | '1/2' | '1/3';
138
+ export interface HouseChatOpened {
139
+ readonly conversation: string | null;
140
+ readonly agent: string | null;
141
+ }
142
+ export interface HouseChatOptions {
143
+ readonly conversation?: string | null;
144
+ readonly agent?: string | null;
145
+ readonly showChats?: boolean;
146
+ readonly width?: HouseChatWidth;
147
+ readonly onOpen?: (opened: HouseChatOpened) => void;
148
+ readonly onLink?: (href: string) => void;
149
+ }
150
+ export interface HouseMountedChat {
151
+ update(options: HouseChatOptions): void;
152
+ unmount(): void;
153
+ }
154
+ export interface HouseChat {
155
+ mount(element: object, options?: HouseChatOptions): Promise<HouseMountedChat>;
156
+ }
137
157
  export interface HouseBridge {
138
158
  readonly runtime: Promise<HouseRuntime>;
159
+ readonly chat: HouseChat;
139
160
  address(): string | null;
140
161
  onAddress(listener: (address: string) => void): () => void;
141
162
  push(address: string): Promise<string>;
@@ -121,7 +121,6 @@ export type ItemFacts = {
121
121
  readonly delivery: string;
122
122
  readonly source: string | null;
123
123
  readonly address: string | null;
124
- readonly has_attachment: boolean;
125
124
  readonly container: string | null;
126
125
  readonly author: string | null;
127
126
  readonly headers: Readonly<Record<string, string>>;
@@ -60,6 +60,7 @@ export declare const JSON_TYPES: readonly JsonType[];
60
60
  export declare const BUILT_IN_TYPE = "any";
61
61
  export declare const ATTACHMENT = "attachment";
62
62
  export declare const ARRAY_INDEX: RegExp;
63
+ export declare const JSON_POINTER: RegExp;
63
64
  export declare function escapePointer(key: string): string;
64
65
  export declare function pointerSegments(pointer: string): string[];
65
66
  export declare function refTarget(reference: string, defs: Readonly<Record<string, unknown>>): {
@@ -10,10 +10,11 @@ export type { RoomTarget } from './paths.js';
10
10
  export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
11
11
  export { project } from './project.js';
12
12
  export { references } from './references.js';
13
- export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
13
+ export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
14
14
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
15
15
  export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
16
- export { bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verify, } from './validate.js';
16
+ export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.js';
17
+ export type { Assessment, Verdicts } from './validate.js';
17
18
  export { VERSION } from './version.js';
18
19
  export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
19
20
  export type { FrontmatterValue } from './yaml.js';
@@ -2,6 +2,7 @@ import type { Definition } from './definition.js';
2
2
  export type Library = Readonly<Record<string, string>>;
3
3
  export type VerifiedModel = {
4
4
  readonly types: Readonly<Record<string, Definition>>;
5
+ readonly nameable?: readonly string[];
5
6
  };
6
7
  export type ModelVerification = {
7
8
  readonly verdict: 'accept';
@@ -6,5 +6,26 @@ export declare function checkDocument(file: string, content: string, model: Veri
6
6
  export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
7
7
  export declare function bodyRoomLinks(body: string): RoomReference[];
8
8
  export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
9
+ type Placed = {
10
+ readonly reference: Reached;
11
+ readonly location: string;
12
+ };
13
+ export type Assessment = {
14
+ readonly file: string;
15
+ readonly type: string | undefined;
16
+ readonly targets: readonly string[];
17
+ readonly read: Validation | null;
18
+ readonly structured: Validation | null;
19
+ readonly fields: readonly Placed[];
20
+ readonly linked: boolean;
21
+ readonly sections: readonly Placed[];
22
+ };
23
+ export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): Assessment;
24
+ export type Verdicts = {
25
+ add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
26
+ verdict(): Validation;
27
+ };
28
+ export declare function verdicts(): Verdicts;
9
29
  export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
10
30
  export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
31
+ export {};
@@ -269,20 +269,32 @@ export type HeadChange = {
269
269
  time: string;
270
270
  };
271
271
  export type BinaryFile = {
272
- fileRef: string;
273
272
  byteLength: number;
274
273
  mediaType: string;
275
274
  sha256: string;
276
275
  };
276
+ export type HeldFile = {
277
+ readonly path: string;
278
+ readonly revision: string;
279
+ };
277
280
  export type HeldContent = {
278
- documents: Readonly<Record<string, string>>;
279
- revisions: Readonly<Record<string, string>>;
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
+ }>>;
280
286
  };
281
287
  export type BootstrapRequest = {
282
288
  locator: string;
283
289
  selection: string;
284
290
  pageToken?: PageToken;
285
291
  held?: HeldContent;
292
+ received?: Uint8Array;
293
+ arriving?: (bytes: number) => void;
294
+ };
295
+ export type BootstrapInventory = {
296
+ readonly parts: number;
297
+ readonly bytes: number;
286
298
  };
287
299
  export type RoomModels = {
288
300
  collection?: ModelResult;
@@ -297,7 +309,10 @@ export type BootstrapPage = {
297
309
  fileIds?: Readonly<Record<string, string>>;
298
310
  changes: Readonly<Record<string, HeadChange>>;
299
311
  binaryFiles: Readonly<Record<string, BinaryFile>>;
312
+ folders?: readonly string[];
300
313
  pageToken?: PageToken;
314
+ inventory?: BootstrapInventory;
315
+ received?: Uint8Array;
301
316
  };
302
317
  export type BootstrapResult = BootstrapPage | {
303
318
  kind: 'beyond-horizon';
@@ -318,6 +333,8 @@ export type RefreshPage = {
318
333
  changes: Readonly<Record<string, HeadChange>>;
319
334
  binaryFiles: Readonly<Record<string, BinaryFile>>;
320
335
  removals: readonly string[];
336
+ folders?: readonly string[];
337
+ folderRemovals?: readonly string[];
321
338
  pageToken?: PageToken;
322
339
  };
323
340
  export type RefreshResult = {
@@ -402,15 +419,6 @@ export type BinaryRequest = {
402
419
  locator: string;
403
420
  path: string;
404
421
  revision: string;
405
- fileRef?: string;
406
- } | {
407
- kind: 'reference';
408
- fileRef: string;
409
- referrer: unknown;
410
- };
411
- export type ReferrerScope = {
412
- locator: string;
413
- path?: string;
414
422
  };
415
423
  export type BinaryResult = {
416
424
  kind: 'binary';
@@ -445,9 +453,8 @@ export type ActionResult = {
445
453
  export type HeldRoom = {
446
454
  locator: string;
447
455
  roomVersion: string;
448
- documents: Readonly<Record<string, string>>;
449
- revisions: Readonly<Record<string, string>>;
450
456
  };
457
+ export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
451
458
  export type RoomStreamEvent = {
452
459
  kind: 'opened';
453
460
  } | {
@@ -482,12 +489,13 @@ export type RoomStream = {
482
489
  hold(rooms: readonly HeldRoom[]): void;
483
490
  reopen(): void;
484
491
  published(locator: string, roomVersion: string): void;
485
- observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
492
+ observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
486
493
  };
487
494
  export type Adapter = {
488
495
  readonly localSaves?: true;
489
496
  readonly exhaustiveDiscovery?: true;
490
497
  readonly roomTypes?: string;
498
+ readonly nameableRoomTypes?: readonly string[];
491
499
  authorize(): Promise<Authorization>;
492
500
  discover(authorization: Authorization, scope?: DiscoveryScope): Promise<DiscoverResult>;
493
501
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
@@ -495,10 +503,7 @@ export type Adapter = {
495
503
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
496
504
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
497
505
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
498
- link(authorization: Authorization, request: Extract<BinaryRequest, {
499
- kind: 'path';
500
- }>): Promise<BinaryLinkResult>;
501
- referrerScope(referrer: unknown): ReferrerScope | null;
506
+ link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
502
507
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
503
508
  reached(locator: string, roomVersion: string, target: string): boolean;
504
509
  follows(locator: string, roomVersion: string, next: string): boolean;
@@ -3,7 +3,6 @@ export type BinaryFileRecord = {
3
3
  readonly state: 'accepted';
4
4
  readonly revision: string;
5
5
  readonly path: string;
6
- readonly fileRef: string;
7
6
  readonly byteLength: number;
8
7
  readonly mediaType: string;
9
8
  readonly sha256: string;
@@ -15,8 +14,4 @@ export type BinaryFileRecord = {
15
14
  readonly mediaType: string;
16
15
  readonly sha256: string;
17
16
  };
18
- export type BinaryReference = {
19
- readonly fileRef: string;
20
- readonly referrer: unknown;
21
- };
22
17
  export declare function binaryRecord(path: string, held: HeldBinary, revision: string | undefined): BinaryFileRecord;
@@ -0,0 +1,10 @@
1
+ import type { MdRuntimeClient } from './client.js';
2
+ import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
3
+ type Rows = DocumentResult | GroupResult;
4
+ export type WindowAnswer = Rows | PendingResult;
5
+ export type WindowChain = {
6
+ want(count: number): void;
7
+ close(): void;
8
+ };
9
+ export declare function chainedWindows(runtime: MdRuntimeClient, query: DocumentQuery | GroupQuery, count: number, publish: (answers: readonly (WindowAnswer | null)[], settled: boolean) => void): WindowChain;
10
+ export {};
@@ -1,15 +1,6 @@
1
- import { type Replica } from './replica.js';
2
- import { type Row } from './rows.js';
3
1
  export type DocumentChange = {
4
- locator: string;
5
- path: string;
6
- before: readonly Row[];
7
- after: readonly Row[];
8
- };
9
- export type MessageChange = {
10
- conversation: string;
11
- identity: string;
12
- text: string | null;
2
+ readonly locator: string;
3
+ readonly path: string | null;
13
4
  };
14
5
  export type ChangeSet = {
15
6
  documents: readonly DocumentChange[];
@@ -20,18 +11,17 @@ export type ChangeSet = {
20
11
  rooms: readonly string[];
21
12
  queues: readonly string[];
22
13
  presentations: readonly string[];
23
- messages: readonly MessageChange[];
24
14
  conversations: readonly string[];
25
15
  };
26
16
  type Changed = {
17
+ documents?: readonly string[] | null;
27
18
  drafts?: readonly string[];
28
19
  room?: boolean;
29
20
  queue?: boolean;
30
21
  presentation?: string;
31
22
  };
32
- export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: Changed): ChangeSet;
33
- export declare function changing(locator: string, before: Replica | null, after: Replica | null, changed?: Changed): Generator<number, ChangeSet, void>;
34
- export declare function entering(locator: string, replica: Replica, paths: readonly string[]): ChangeSet;
35
- export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
23
+ export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
24
+ export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
36
25
  export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
26
+ export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
37
27
  export {};
@@ -2,7 +2,6 @@ import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts,
2
2
  import type { Member, ServiceMode } from './adapter.js';
3
3
  import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
4
4
  import { type Observation } from './observation.js';
5
- import type { BinaryReference } from './binary.js';
6
5
  import type { ChosenFile } from './file.js';
7
6
  import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
8
7
  import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
@@ -22,7 +21,7 @@ export type MdRuntimeClient = {
22
21
  roomDraft: {
23
22
  list(): Promise<readonly RoomDraft[]>;
24
23
  read(room: string, path: string): Promise<RoomDraft | null>;
25
- write(room: string, path: string, revision: string | null, parts: RoomDraftParts): Promise<RoomDraftWrite>;
24
+ write(room: string, path: string, revision: string | null, parts: RoomDraftParts, next?: string): Promise<RoomDraftWrite>;
26
25
  discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
27
26
  };
28
27
  save(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
@@ -54,7 +53,6 @@ export type MdRuntimeClient = {
54
53
  binaryFile: {
55
54
  read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
56
55
  link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
57
- readReference(reference: BinaryReference): Promise<BinaryAnswer>;
58
56
  };
59
57
  call(name: string, input: unknown): Promise<CallResult>;
60
58
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
@@ -85,6 +83,8 @@ export type MdRuntimeClient = {
85
83
  };
86
84
  export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
87
85
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
86
+ export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
87
+ export { roomDraftRevision } from './identity.js';
88
88
  export type { Observation } from './observation.js';
89
89
  export type { Open } from './open.js';
90
90
  export { unanswered, type RuntimePort, type WireMember } from './wire.js';
@@ -1,9 +1,8 @@
1
- import { type Document, type Frontmatter, type Validation } from '../mdmodel/index.js';
2
- import { type ModelState } from './model.js';
1
+ import { type Document } from '../mdmodel/index.js';
2
+ import type { ModelState } from './model.js';
3
3
  import type { MdModelIdentity } from './adapter.js';
4
4
  import { type Paths } from './shared.js';
5
5
  import type { Refused } from './transfer.js';
6
- import { type Later } from './turn.js';
7
6
  export declare const MD_MODEL: MdModelIdentity;
8
7
  export type Collection = {
9
8
  text: Readonly<Record<string, string>>;
@@ -17,23 +16,10 @@ export type Composition = {
17
16
  model: ModelState;
18
17
  } | null;
19
18
  };
19
+ export declare function selected(composition: Composition, path: string): boolean;
20
20
  export declare function governing(composition: Composition, path: string): ModelState;
21
- export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Collection;
22
- export declare function collecting(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Generator<number, Collection, void>;
23
- export declare function passingFrontmatter(collection: Collection, path: string): Frontmatter | undefined;
21
+ export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
24
22
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
25
- export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Generator<number, Refused | null, void>;
23
+ export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
26
24
  export declare function validRoot(root: unknown): root is string;
27
- export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Generator<number, Validation, void>;
28
- type Held = {
29
- text: Paths<string>;
30
- binaries: Paths<unknown>;
31
- };
32
- export declare function indexReferrers(held: Held, composition: Composition): Later<void>;
33
- export declare function referencesIndexed(held: Held, composition: Composition): boolean;
34
- export declare function referring(held: Held, composition: Composition, targets: Iterable<string>): Generator<number, ReadonlySet<string> | null, void>;
35
25
  export declare function available(composition: Composition): boolean;
36
- export declare function changedCleanly(next: Held, previous: Held & {
37
- composition: Composition;
38
- }, composition: Composition): Generator<number, boolean, void>;
39
- export {};
@@ -0,0 +1,15 @@
1
+ import type { Plan, QueryRows } from './query.js';
2
+ import type { Connection, Value } from './tables.js';
3
+ export type QueryRoom = {
4
+ readonly locator: string;
5
+ readonly key: number;
6
+ };
7
+ export type Fragment = {
8
+ readonly sql: string;
9
+ readonly bind: readonly Value[];
10
+ };
11
+ export type QueryAnswer = QueryRows & {
12
+ readonly more?: string;
13
+ };
14
+ export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
15
+ export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;