@agentshouse/app-bridge 0.1.0-cde8ea47c9af3 → 0.1.0-cdeb444178844

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 (64) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +92 -34
  3. package/dist/mdmodel/document.d.ts +2 -1
  4. package/dist/mdmodel/index.d.ts +3 -3
  5. package/dist/mdmodel/query/language.d.ts +35 -4
  6. package/dist/mdmodel/types.d.ts +4 -0
  7. package/dist/mdruntime/actions.d.ts +19 -0
  8. package/dist/mdruntime/adapter.d.ts +16 -16
  9. package/dist/mdruntime/attached-model.d.ts +7 -0
  10. package/dist/mdruntime/bootstrap.d.ts +43 -0
  11. package/dist/mdruntime/cell.d.ts +5 -0
  12. package/dist/mdruntime/change.d.ts +1 -0
  13. package/dist/mdruntime/client.d.ts +10 -1
  14. package/dist/mdruntime/compile.d.ts +5 -0
  15. package/dist/mdruntime/conversation-row.d.ts +32 -0
  16. package/dist/mdruntime/conversation.d.ts +13 -5
  17. package/dist/mdruntime/figures.d.ts +47 -0
  18. package/dist/mdruntime/install.d.ts +55 -0
  19. package/dist/mdruntime/job.d.ts +32 -0
  20. package/dist/mdruntime/listing.d.ts +52 -0
  21. package/dist/mdruntime/live.d.ts +22 -0
  22. package/dist/mdruntime/log.d.ts +5 -0
  23. package/dist/mdruntime/messages.d.ts +25 -1
  24. package/dist/mdruntime/model.d.ts +0 -2
  25. package/dist/mdruntime/outcome.d.ts +1 -0
  26. package/dist/mdruntime/overlay.d.ts +1 -0
  27. package/dist/mdruntime/preparation.d.ts +19 -0
  28. package/dist/mdruntime/query.d.ts +10 -0
  29. package/dist/mdruntime/reach.d.ts +8 -6
  30. package/dist/mdruntime/reads.d.ts +35 -0
  31. package/dist/mdruntime/refresh.d.ts +26 -0
  32. package/dist/mdruntime/replica.d.ts +0 -3
  33. package/dist/mdruntime/room-drafts.d.ts +23 -0
  34. package/dist/mdruntime/runtime.d.ts +41 -0
  35. package/dist/mdruntime/saves.d.ts +69 -0
  36. package/dist/mdruntime/seed.d.ts +11 -2
  37. package/dist/mdruntime/socket/admission.d.ts +6 -0
  38. package/dist/mdruntime/socket/answers.d.ts +5 -0
  39. package/dist/mdruntime/socket/lanes.d.ts +19 -0
  40. package/dist/mdruntime/socket/rooms.d.ts +42 -0
  41. package/dist/mdruntime/socket/session.d.ts +38 -0
  42. package/dist/mdruntime/socket.d.ts +69 -0
  43. package/dist/mdruntime/source.d.ts +60 -0
  44. package/dist/mdruntime/status.d.ts +0 -2
  45. package/dist/mdruntime/store/fences.d.ts +15 -0
  46. package/dist/mdruntime/store/installs.d.ts +29 -0
  47. package/dist/mdruntime/store/readiness.d.ts +9 -0
  48. package/dist/mdruntime/store/records.d.ts +211 -0
  49. package/dist/mdruntime/store/room-held.d.ts +7 -0
  50. package/dist/mdruntime/store/space.d.ts +10 -0
  51. package/dist/mdruntime/store/watchers.d.ts +16 -0
  52. package/dist/mdruntime/store/writes.d.ts +23 -0
  53. package/dist/mdruntime/store.d.ts +107 -142
  54. package/dist/mdruntime/stored.d.ts +55 -28
  55. package/dist/mdruntime/surface.d.ts +85 -0
  56. package/dist/mdruntime/tables.d.ts +99 -19
  57. package/dist/mdruntime/tallies.d.ts +17 -0
  58. package/dist/mdruntime/transfer.d.ts +4 -0
  59. package/dist/mdruntime/turn.d.ts +8 -0
  60. package/dist/mdruntime/wire.d.ts +7 -1
  61. package/dist/test-host.js +0 -1
  62. package/docs/families.md +5 -6
  63. package/package.json +1 -1
  64. package/dist/mdruntime/connection.d.ts +0 -154
package/README.md CHANGED
@@ -12,7 +12,7 @@ The bridge carries no credential handling and no Runtime family. House builds
12
12
  the MD Runtime client into the page beside the bridge and serves it the Chat, so
13
13
  the App imports, constructs and bundles neither: `bridge.runtime` resolves to the client.
14
14
 
15
- House's guide to building an App is its Guide's `apps/` pages, which `open_guide` opens.
15
+ House's guide to building an App is its Guide's `apps/` pages, which `guide/open` opens.
16
16
 
17
17
  ## Use
18
18
 
@@ -42,7 +42,7 @@ async function manageSecurity(securityPath) {
42
42
 
43
43
  `bridge.runtime` resolves to the `MdRuntimeClient` of `@agentshouse/mdruntime/client`,
44
44
  whose README describes its members. Its `call(method, params)` is a remote procedure call
45
- to a House act by its name, such as `call('rooms/members', { room_ref })`: `HouseMethods`
45
+ to a House act by its name, such as `call('rooms/members/list', { room_ref })`: `HouseMethods`
46
46
  names each with House's own input, `HouseParams<Name>`, and answer, `HouseResult<Name>`.
47
47
 
48
48
  ## Test without a House
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { MdRuntimeClient, Open } from './mdruntime/client.js';
2
2
  export interface HouseMethods {
3
- readonly "agent-functions/requests": {
3
+ readonly "agent-functions/requests/list": {
4
4
  readonly params: {
5
5
  readonly room_ref: string;
6
6
  };
@@ -15,7 +15,7 @@ export interface HouseMethods {
15
15
  }[];
16
16
  };
17
17
  };
18
- readonly "apps/features/read": {
18
+ readonly "apps/features/list": {
19
19
  readonly params: {};
20
20
  readonly result: {
21
21
  readonly features: readonly {
@@ -24,11 +24,10 @@ export interface HouseMethods {
24
24
  }[];
25
25
  };
26
26
  };
27
- readonly "apps/holders": {
27
+ readonly "apps/holders/list": {
28
28
  readonly params: {};
29
29
  readonly result: {
30
30
  readonly holders: readonly {
31
- readonly email: string;
32
31
  readonly name: string;
33
32
  readonly user: string;
34
33
  }[];
@@ -43,7 +42,7 @@ export interface HouseMethods {
43
42
  readonly [key: string]: never;
44
43
  };
45
44
  };
46
- readonly "apps/relay": {
45
+ readonly "apps/relay/read": {
47
46
  readonly params: {
48
47
  readonly [key: string]: never;
49
48
  };
@@ -73,6 +72,7 @@ export interface HouseMethods {
73
72
  } | {
74
73
  readonly user: string;
75
74
  };
75
+ readonly operation_id: string;
76
76
  readonly path: string;
77
77
  readonly room_ref: string;
78
78
  };
@@ -146,6 +146,7 @@ export interface HouseMethods {
146
146
  };
147
147
  readonly "chats/take-control": {
148
148
  readonly params: {
149
+ readonly operation_id: string;
149
150
  readonly path: string;
150
151
  readonly room_ref: string;
151
152
  };
@@ -214,7 +215,7 @@ export interface HouseMethods {
214
215
  readonly url: string;
215
216
  };
216
217
  };
217
- readonly "conversations/history": {
218
+ readonly "conversations/history/list": {
218
219
  readonly params: {
219
220
  readonly conversations: readonly {
220
221
  readonly after?: {
@@ -355,6 +356,12 @@ export interface HouseMethods {
355
356
  };
356
357
  readonly telegram_undelivered?: true;
357
358
  readonly text: string;
359
+ readonly tokens?: {
360
+ readonly cache_read: number;
361
+ readonly cache_write: number;
362
+ readonly input: number;
363
+ readonly output: number;
364
+ };
358
365
  readonly transcripts?: readonly {
359
366
  readonly path: string;
360
367
  readonly text: string;
@@ -418,7 +425,7 @@ export interface HouseMethods {
418
425
  readonly url: string;
419
426
  };
420
427
  };
421
- readonly "conversations/option": {
428
+ readonly "conversations/option/set": {
422
429
  readonly params: {
423
430
  readonly conversation_id: string;
424
431
  readonly operation_id: string;
@@ -482,7 +489,7 @@ export interface HouseMethods {
482
489
  readonly url: string;
483
490
  };
484
491
  };
485
- readonly "records/read": {
492
+ readonly "records/list": {
486
493
  readonly params: {
487
494
  readonly order?: "asc" | "desc";
488
495
  readonly room_ref: string;
@@ -497,10 +504,9 @@ export interface HouseMethods {
497
504
  }[];
498
505
  };
499
506
  };
500
- readonly "rooms/access/read": {
507
+ readonly "rooms/access/list": {
501
508
  readonly params: {
502
509
  readonly room_ref: string;
503
- readonly statistics?: boolean;
504
510
  };
505
511
  readonly result: {
506
512
  readonly authority: "administrator" | "member" | "owner";
@@ -509,41 +515,33 @@ export interface HouseMethods {
509
515
  readonly direct: readonly {
510
516
  readonly level: null | "keep" | "open" | "search";
511
517
  readonly namespace: string;
512
- readonly operations: readonly ("delete" | "export" | "manageAccess" | "write")[];
518
+ readonly operations: readonly ("erase" | "export" | "manageAccess" | "write")[];
513
519
  }[];
514
- readonly downloads_per_day?: number;
515
520
  readonly entries: readonly {
516
521
  readonly level: null | "keep" | "open" | "search";
517
522
  readonly namespace: string;
518
- readonly operations: readonly ("delete" | "export" | "manageAccess" | "write")[];
523
+ readonly operations: readonly ("erase" | "export" | "manageAccess" | "write")[];
519
524
  readonly sources: readonly {
520
525
  readonly kind: "direct" | "inherited";
521
526
  readonly level: null | "keep" | "open" | "search";
522
527
  readonly namespace: string;
523
- readonly operations: readonly ("delete" | "export" | "manageAccess" | "write")[];
528
+ readonly operations: readonly ("erase" | "export" | "manageAccess" | "write")[];
524
529
  }[];
525
530
  }[];
526
531
  readonly key: null | string;
527
- readonly requests_per_day?: number;
528
532
  readonly schema_roles: readonly string[];
533
+ readonly through_space?: true;
529
534
  readonly user: string;
530
535
  readonly user_name: string;
531
536
  }[];
532
537
  readonly namespaces: readonly string[];
533
538
  readonly owner: string;
534
539
  readonly room_ref: string;
535
- readonly statistics?: readonly {
536
- readonly day: string;
537
- readonly downloads: number;
538
- readonly requests: number;
539
- readonly text_bytes: number;
540
- readonly user: string;
541
- }[];
542
540
  readonly url: string;
543
541
  readonly viewer: string;
544
542
  };
545
543
  };
546
- readonly "rooms/members": {
544
+ readonly "rooms/members/list": {
547
545
  readonly params: {
548
546
  readonly history?: boolean;
549
547
  readonly room_ref: string;
@@ -555,14 +553,15 @@ export interface HouseMethods {
555
553
  readonly user: string;
556
554
  }[];
557
555
  readonly members: readonly {
558
- readonly access?: "edit" | "keep" | "manage" | "open" | "owner" | "search";
556
+ readonly access?: "manage" | "owner" | "read" | "write";
557
+ readonly copies?: "online_only" | "search_only";
559
558
  readonly display_name: string;
560
559
  readonly email?: string;
561
560
  readonly member_document: null | string;
562
- readonly only_while_online?: true;
563
561
  readonly owner: boolean;
564
562
  readonly schema_roles?: readonly string[];
565
563
  readonly since: null | string;
564
+ readonly through_space?: true;
566
565
  readonly user: string;
567
566
  }[];
568
567
  };
@@ -600,7 +599,7 @@ export interface HouseMethods {
600
599
  readonly writable: boolean;
601
600
  };
602
601
  };
603
- readonly "site/submission": {
602
+ readonly "sites/submissions/create": {
604
603
  readonly params: {
605
604
  readonly content: string;
606
605
  };
@@ -608,9 +607,10 @@ export interface HouseMethods {
608
607
  readonly submitted: true;
609
608
  };
610
609
  };
611
- readonly "storage/inventory": {
610
+ readonly "storage/inventory/read": {
612
611
  readonly params: {
613
612
  readonly room_ref?: string;
613
+ readonly rooms?: "owned";
614
614
  };
615
615
  readonly result: {
616
616
  readonly blob: {
@@ -662,6 +662,35 @@ export interface HouseMethods {
662
662
  readonly layout: string;
663
663
  };
664
664
  };
665
+ readonly rooms?: readonly {
666
+ readonly blob: {
667
+ readonly bytes: string;
668
+ readonly gigabytes: string;
669
+ };
670
+ readonly freshness: {
671
+ readonly state: "settled";
672
+ };
673
+ readonly indexed_text: {
674
+ readonly approximate_pages: null | string;
675
+ readonly bytes: string;
676
+ readonly gigabytes: string;
677
+ };
678
+ readonly measurement: {
679
+ readonly page_reference: null | {
680
+ readonly bytes_per_page: string;
681
+ readonly encoding: string;
682
+ readonly font: string;
683
+ readonly font_size_pt: string;
684
+ readonly layout: string;
685
+ };
686
+ };
687
+ readonly room_ref: string;
688
+ readonly total: {
689
+ readonly bytes: string;
690
+ readonly gigabytes: string;
691
+ };
692
+ readonly url: string;
693
+ }[];
665
694
  readonly site_images: {
666
695
  readonly bound: string;
667
696
  readonly bytes: string;
@@ -693,26 +722,55 @@ export interface HouseMethods {
693
722
  readonly layout: string;
694
723
  };
695
724
  };
725
+ readonly rooms?: readonly {
726
+ readonly blob: {
727
+ readonly bytes: string;
728
+ readonly gigabytes: string;
729
+ };
730
+ readonly freshness: {
731
+ readonly state: "settled";
732
+ };
733
+ readonly indexed_text: {
734
+ readonly approximate_pages: null | string;
735
+ readonly bytes: string;
736
+ readonly gigabytes: string;
737
+ };
738
+ readonly measurement: {
739
+ readonly page_reference: null | {
740
+ readonly bytes_per_page: string;
741
+ readonly encoding: string;
742
+ readonly font: string;
743
+ readonly font_size_pt: string;
744
+ readonly layout: string;
745
+ };
746
+ };
747
+ readonly room_ref: string;
748
+ readonly total: {
749
+ readonly bytes: string;
750
+ readonly gigabytes: string;
751
+ };
752
+ readonly url: string;
753
+ }[];
696
754
  readonly total: {
697
755
  readonly bytes: string;
698
756
  readonly gigabytes: string;
699
757
  };
700
758
  };
701
759
  };
702
- readonly "triggers/fired": {
760
+ readonly "triggers/fired/list": {
703
761
  readonly params: {
704
- readonly room_ref: string;
762
+ readonly room_ref?: string;
705
763
  };
706
764
  readonly result: {
707
765
  readonly events: readonly {
708
766
  readonly actions: readonly ({
709
- readonly cap: "address_submissions" | "app_sockets" | "environment_functions" | "export_starts" | "kit_connections" | "live_shares" | "open_uploads" | "ownership_offers" | "push_addresses" | "push_deliveries" | "room_triggers" | "service_keys" | "share_creations" | "share_room_creations" | "site_rooms" | "slot_rooms" | "spaces" | "waiting_web_wizards" | "writes";
767
+ readonly cap: "address_submissions" | "app_sockets" | "environment_functions" | "export_starts" | "kit_connections" | "live_shares" | "open_uploads" | "ownership_offers" | "push_addresses" | "push_deliveries" | "room_triggers" | "service_keys" | "share_creations" | "share_room_creations" | "site_published_bytes" | "site_rooms" | "slot_rooms" | "spaces" | "waiting_web_wizards" | "writes";
710
768
  readonly code: "cap_reached";
711
769
  readonly outcome: "refused";
712
770
  readonly position: number;
713
771
  readonly retry_at: string;
714
772
  } | {
715
- readonly cap: "address_submissions" | "app_sockets" | "environment_functions" | "export_starts" | "kit_connections" | "live_shares" | "open_uploads" | "ownership_offers" | "push_addresses" | "push_deliveries" | "room_triggers" | "service_keys" | "share_creations" | "share_room_creations" | "site_rooms" | "slot_rooms" | "spaces" | "waiting_web_wizards" | "writes";
773
+ readonly cap: "address_submissions" | "app_sockets" | "environment_functions" | "export_starts" | "kit_connections" | "live_shares" | "open_uploads" | "ownership_offers" | "push_addresses" | "push_deliveries" | "room_triggers" | "service_keys" | "share_creations" | "share_room_creations" | "site_published_bytes" | "site_rooms" | "slot_rooms" | "spaces" | "waiting_web_wizards" | "writes";
716
774
  readonly code: "cap_reached";
717
775
  readonly outcome: "refused";
718
776
  readonly position: number;
@@ -767,13 +825,13 @@ export interface HouseMethods {
767
825
  readonly value: string;
768
826
  } | {
769
827
  readonly code: "limit_reached";
770
- readonly limit: "custom_domains" | "external_calls" | "mcp_downloads" | "mcp_reads" | "publish_data" | "sites";
828
+ readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
771
829
  readonly outcome: "refused";
772
830
  readonly position: number;
773
831
  readonly retry_at: string;
774
832
  } | {
775
833
  readonly code: "limit_reached";
776
- readonly limit: "custom_domains" | "external_calls" | "mcp_downloads" | "mcp_reads" | "publish_data" | "sites";
834
+ readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
777
835
  readonly outcome: "refused";
778
836
  readonly position: number;
779
837
  } | {
@@ -835,6 +893,7 @@ export interface HouseMethods {
835
893
  readonly missed?: "failed" | "skipped";
836
894
  readonly moment?: string;
837
895
  readonly path?: string;
896
+ readonly room_ref?: string;
838
897
  readonly trigger: string;
839
898
  readonly url?: string;
840
899
  }[];
@@ -997,7 +1056,6 @@ export interface HouseBridge {
997
1056
  install(): Promise<HouseInstallation>;
998
1057
  notifications(on?: boolean): Promise<HouseNotifications>;
999
1058
  telegram(link?: true): Promise<HouseTelegram>;
1000
- setBadge(unread: readonly string[]): Promise<void>;
1001
1059
  setTab(tab: HouseTab): void;
1002
1060
  sourceTop(app: string, release?: string): Promise<HouseSourceTop | HouseRefusal | null>;
1003
1061
  sourceDownload(app: string, release?: string): Promise<HouseSourceDownload | HouseRefusal | null>;
@@ -1,6 +1,6 @@
1
1
  import { type Definition } from './definition.js';
2
2
  import { type LinkInventory } from './links.js';
3
- import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult } from './types.js';
3
+ import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult, UnlinkedBody } from './types.js';
4
4
  import { type YamlMap } from './yaml.js';
5
5
  export declare function inventoryOf(document: Document): LinkInventory;
6
6
  export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
@@ -8,6 +8,7 @@ export declare function parse(content: string, file?: string): ParseResult;
8
8
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
9
9
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
10
10
  export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
11
+ export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): UnlinkedBody;
11
12
  export declare function links(document: Document, file: string): readonly Link[];
12
13
  export declare function bodyLinks(body: string, file: string): readonly Link[];
13
14
  export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
@@ -3,7 +3,7 @@ export type { Actor, DocumentEvent, DocumentFacts, Fact, FactKind, ItemFacts, Me
3
3
  export { byCodePoint, compared, dated, fitsKind, instant, instantKey, KINDS, kindOf, kindWords, } from './kinds.js';
4
4
  export type { Kind, Ordering } from './kinds.js';
5
5
  export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
6
- export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupQuery, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
6
+ export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupKey, GroupOrder, GroupQuery, GroupSelect, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
7
7
  export { heldAt, matches } from './query/match.js';
8
8
  export type { Candidate } from './query/match.js';
9
9
  export { heldKind, indexed } from './query/rows.js';
@@ -12,7 +12,7 @@ export * as sql from './query/sql.js';
12
12
  export { headingLines } from './blocks.js';
13
13
  export type { HeadingLine } from './blocks.js';
14
14
  export { divide } from './divide.js';
15
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
15
+ export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, unlinkBody, } from './document.js';
16
16
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
17
17
  export type { ReferenceTarget, SavedFacts } from './facts.js';
18
18
  export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
@@ -25,7 +25,7 @@ export { references } from './references.js';
25
25
  export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
26
26
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
27
27
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
28
- export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
28
+ export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
29
29
  export { assess, assessReferences, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
30
30
  export type { Assessment, Verdicts } from './validate.js';
31
31
  export { VERSION } from './version.js';
@@ -37,6 +37,7 @@ export type Filter = {
37
37
  types?: readonly string[];
38
38
  where?: Where;
39
39
  pathPrefix?: string;
40
+ outside?: readonly string[];
40
41
  folder?: string;
41
42
  paths?: readonly string[];
42
43
  fileIds?: readonly string[];
@@ -48,7 +49,10 @@ export type Filter = {
48
49
  };
49
50
  text?: string;
50
51
  };
51
- export type Key = 'room' | 'path' | 'type' | 'folder' | {
52
+ export type Key = 'room' | 'path' | 'type' | 'folder' | 'size' | 'created' | 'updated' | {
53
+ field: string;
54
+ };
55
+ export type GroupKey = 'room' | 'type' | 'folder' | 'subfolder' | {
52
56
  field: string;
53
57
  };
54
58
  export type Select = 'all' | {
@@ -60,7 +64,17 @@ export type Select = 'all' | {
60
64
  change?: true;
61
65
  fileId?: true;
62
66
  revision?: true;
67
+ size?: true;
68
+ created?: true;
69
+ };
70
+ export type GroupSelect = {
71
+ size?: true;
72
+ updated?: true;
73
+ greatest?: {
74
+ field: string;
75
+ };
63
76
  };
77
+ export type GroupOrder = 'count' | 'size' | 'updated' | 'greatest';
64
78
  export type OrderOptions = {
65
79
  nulls?: 'first' | 'last';
66
80
  stringSort?: 'lexical' | 'locale';
@@ -79,10 +93,12 @@ export type DocumentQuery = Filter & {
79
93
  total?: true;
80
94
  };
81
95
  export type GroupQuery = Filter & {
82
- groupBy: readonly Exclude<Key, 'path'>[];
96
+ groupBy: readonly GroupKey[];
97
+ select?: GroupSelect;
83
98
  orderBy?: readonly {
84
- by: 'count' | Exclude<Key, 'path'>;
99
+ by: GroupOrder | GroupKey;
85
100
  direction?: Direction;
101
+ nulls?: 'first' | 'last';
86
102
  }[];
87
103
  limit?: number;
88
104
  after?: string;
@@ -148,6 +164,14 @@ export type KeyPlan = {
148
164
  of: 'type';
149
165
  } | {
150
166
  of: 'folder';
167
+ } | {
168
+ of: 'subfolder';
169
+ } | {
170
+ of: 'size';
171
+ } | {
172
+ of: 'created';
173
+ } | {
174
+ of: 'updated';
151
175
  } | {
152
176
  of: 'field';
153
177
  field: string;
@@ -162,6 +186,8 @@ export type DocumentShape = {
162
186
  change: boolean;
163
187
  fileId: boolean;
164
188
  revision: boolean;
189
+ size: boolean;
190
+ created: boolean;
165
191
  orderBy: readonly {
166
192
  key: KeyPlan;
167
193
  options: OrderOptions & {
@@ -172,9 +198,13 @@ export type DocumentShape = {
172
198
  export type GroupShape = {
173
199
  kind: 'groups';
174
200
  groupBy: readonly KeyPlan[];
201
+ size: boolean;
202
+ updated: boolean;
203
+ greatest: string | null;
175
204
  orderBy: readonly {
176
- by: 'count' | number;
205
+ by: GroupOrder | number;
177
206
  direction: Direction;
207
+ nulls: 'first' | 'last' | null;
178
208
  }[];
179
209
  };
180
210
  export type Continuation = {
@@ -185,6 +215,7 @@ export type QueryPlan = {
185
215
  key: string;
186
216
  rooms: readonly string[] | null;
187
217
  root: Scope;
218
+ outside: readonly string[] | null;
188
219
  folder: string | null;
189
220
  paths: readonly string[] | null;
190
221
  fileIds: readonly string[] | null;
@@ -172,3 +172,7 @@ export type BodyResult = {
172
172
  readonly outcome: 'refuse';
173
173
  readonly refusal: Refusal;
174
174
  };
175
+ export type UnlinkedBody = {
176
+ readonly body: string;
177
+ readonly links: ReadonlyMap<string, string>;
178
+ };
@@ -0,0 +1,19 @@
1
+ import type { ConversationHistoryRequest } from './adapter.js';
2
+ import { type CallResult, type HistoryAnswer, type Resolution } from './outcome.js';
3
+ import type { Attempted } from './recovery.js';
4
+ import type { Runtime } from './runtime.js';
5
+ export type HistoryQuery = {
6
+ revision?: string;
7
+ pageToken?: string;
8
+ };
9
+ export declare function readHistory(runtime: Runtime, locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
10
+ export declare function located(runtime: Runtime, room: string, path: string, destination: string): Promise<{
11
+ room: string;
12
+ path: string;
13
+ } | null>;
14
+ export declare function resolveReference(runtime: Runtime, room: string, path: string, destination: string): Promise<Resolution>;
15
+ export declare function invokeAction(runtime: Runtime, name: string, input: unknown, dispatching?: () => Promise<void>): Promise<CallResult>;
16
+ export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): Promise<CallResult>;
17
+ export declare function called(runtime: Runtime, name: string, input: unknown): Promise<CallResult>;
18
+ export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
19
+ export declare function resendLater(runtime: Runtime): void;
@@ -13,7 +13,7 @@ export type TypedSelection = {
13
13
  };
14
14
  export type OperationScopes = {
15
15
  write: readonly string[];
16
- delete: readonly string[];
16
+ erase: readonly string[];
17
17
  };
18
18
  export type ReplicaAdmission = {
19
19
  selection: string;
@@ -285,25 +285,17 @@ export type BinaryFile = {
285
285
  mediaType: string;
286
286
  sha256: string;
287
287
  };
288
- export type HeldFile = {
289
- readonly path: string;
290
- readonly revision: string;
291
- };
292
- export type HeldContent = {
293
- files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
294
- contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
295
- readonly content: string;
296
- readonly revision: string;
297
- }>>;
298
- };
299
288
  export type BootstrapRequest = {
300
289
  locator: string;
301
290
  selection: string;
302
291
  pageToken?: PageToken;
303
- held?: HeldContent;
304
292
  arriving?: (bytes: number) => void;
305
293
  signal?: AbortSignal;
306
294
  };
295
+ export type BootstrapPart = {
296
+ readonly id: string;
297
+ readonly bytes: number;
298
+ };
307
299
  export type BootstrapInventory = {
308
300
  readonly bytes: number;
309
301
  };
@@ -318,15 +310,20 @@ export type BootstrapPage = {
318
310
  facts: Readonly<Record<string, SavedFacts>>;
319
311
  revisions: Readonly<Record<string, string>>;
320
312
  fileIds?: Readonly<Record<string, string>>;
313
+ created?: Readonly<Record<string, string>>;
321
314
  changes: Readonly<Record<string, HeadChange>>;
322
315
  binaryFiles: Readonly<Record<string, BinaryFile>>;
323
316
  folders?: readonly string[];
324
317
  pageToken?: PageToken;
318
+ parts?: readonly BootstrapPart[];
325
319
  bytes?: number;
326
320
  };
321
+ export type NotReady = {
322
+ kind: 'not-ready';
323
+ };
327
324
  export type BootstrapResult = BootstrapPage | {
328
325
  kind: 'beyond-horizon';
329
- } | AdapterFailure;
326
+ } | NotReady | AdapterFailure;
330
327
  export type RefreshRequest = {
331
328
  locator: string;
332
329
  selection: string;
@@ -341,6 +338,7 @@ export type RefreshPage = {
341
338
  facts: Readonly<Record<string, SavedFacts>>;
342
339
  revisions: Readonly<Record<string, string>>;
343
340
  fileIds?: Readonly<Record<string, string>>;
341
+ created?: Readonly<Record<string, string>>;
344
342
  changes: Readonly<Record<string, HeadChange>>;
345
343
  binaryFiles: Readonly<Record<string, BinaryFile>>;
346
344
  removals: readonly string[];
@@ -489,12 +487,12 @@ export type SearchAnswer = {
489
487
  }) | AdapterFailure;
490
488
  export type HeldRoom = {
491
489
  locator: string;
492
- roomVersion: string;
490
+ roomVersion: string | null;
493
491
  };
494
492
  export type RoomChange = {
495
493
  kind: 'room-change';
496
494
  locator: string;
497
- from: string;
495
+ from: string | null;
498
496
  roomVersion: string;
499
497
  read(): Promise<RefreshPage>;
500
498
  };
@@ -527,6 +525,8 @@ export type Adapter = {
527
525
  readonly roomTypes?: string;
528
526
  readonly nameableRoomTypes?: readonly string[];
529
527
  readonly typedPaths?: readonly TypedPath[];
528
+ readonly unkeptReads?: readonly string[];
529
+ readonly leadingReads?: readonly string[];
530
530
  authorize(): Promise<Authorization>;
531
531
  discover?(authorization: Authorization): Promise<DiscoverResult>;
532
532
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
@@ -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>;
@@ -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 = {