@agentshouse/app-bridge 0.1.0-c8444224686b2 → 0.1.0-c858d26919cb9

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 (79) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +142 -55
  3. package/dist/mdmodel/definition.d.ts +1 -1
  4. package/dist/mdmodel/document.d.ts +2 -2
  5. package/dist/mdmodel/event.d.ts +77 -0
  6. package/dist/mdmodel/facts.d.ts +14 -0
  7. package/dist/mdmodel/index.d.ts +18 -6
  8. package/dist/mdmodel/kinds.d.ts +18 -0
  9. package/dist/mdmodel/pattern.d.ts +9 -0
  10. package/dist/mdmodel/query/language.d.ts +253 -0
  11. package/dist/mdmodel/query/match.d.ts +13 -0
  12. package/dist/mdmodel/query/rows.d.ts +31 -0
  13. package/dist/mdmodel/query/sql.d.ts +38 -0
  14. package/dist/mdmodel/types.d.ts +4 -5
  15. package/dist/mdmodel/validate.d.ts +5 -4
  16. package/dist/mdruntime/actions.d.ts +19 -0
  17. package/dist/mdruntime/adapter.d.ts +20 -25
  18. package/dist/mdruntime/attached-model.d.ts +7 -0
  19. package/dist/mdruntime/bootstrap.d.ts +43 -0
  20. package/dist/mdruntime/cell.d.ts +5 -0
  21. package/dist/mdruntime/chain.d.ts +2 -1
  22. package/dist/mdruntime/change.d.ts +1 -0
  23. package/dist/mdruntime/client.d.ts +17 -2
  24. package/dist/mdruntime/compile.d.ts +7 -7
  25. package/dist/mdruntime/conversation-row.d.ts +32 -0
  26. package/dist/mdruntime/conversation.d.ts +14 -6
  27. package/dist/mdruntime/durability.d.ts +15 -0
  28. package/dist/mdruntime/figures.d.ts +47 -0
  29. package/dist/mdruntime/holdings.d.ts +28 -0
  30. package/dist/mdruntime/identity.d.ts +0 -1
  31. package/dist/mdruntime/install.d.ts +55 -0
  32. package/dist/mdruntime/job.d.ts +32 -0
  33. package/dist/mdruntime/listing.d.ts +52 -0
  34. package/dist/mdruntime/live.d.ts +22 -0
  35. package/dist/mdruntime/log.d.ts +5 -0
  36. package/dist/mdruntime/messages.d.ts +25 -1
  37. package/dist/mdruntime/model.d.ts +2 -9
  38. package/dist/mdruntime/outcome.d.ts +1 -0
  39. package/dist/mdruntime/overlay.d.ts +1 -0
  40. package/dist/mdruntime/preparation.d.ts +19 -0
  41. package/dist/mdruntime/query.d.ts +13 -212
  42. package/dist/mdruntime/reach.d.ts +8 -6
  43. package/dist/mdruntime/reads.d.ts +35 -0
  44. package/dist/mdruntime/refresh.d.ts +26 -0
  45. package/dist/mdruntime/replica.d.ts +6 -7
  46. package/dist/mdruntime/room-draft.d.ts +2 -2
  47. package/dist/mdruntime/room-drafts.d.ts +23 -0
  48. package/dist/mdruntime/runtime.d.ts +41 -0
  49. package/dist/mdruntime/saves.d.ts +69 -0
  50. package/dist/mdruntime/seed.d.ts +11 -2
  51. package/dist/mdruntime/socket/admission.d.ts +6 -0
  52. package/dist/mdruntime/socket/answers.d.ts +5 -0
  53. package/dist/mdruntime/socket/lanes.d.ts +19 -0
  54. package/dist/mdruntime/socket/rooms.d.ts +42 -0
  55. package/dist/mdruntime/socket/session.d.ts +38 -0
  56. package/dist/mdruntime/socket.d.ts +69 -0
  57. package/dist/mdruntime/source.d.ts +60 -0
  58. package/dist/mdruntime/status.d.ts +0 -2
  59. package/dist/mdruntime/store/fences.d.ts +15 -0
  60. package/dist/mdruntime/store/installs.d.ts +29 -0
  61. package/dist/mdruntime/store/readiness.d.ts +9 -0
  62. package/dist/mdruntime/store/records.d.ts +211 -0
  63. package/dist/mdruntime/store/room-held.d.ts +7 -0
  64. package/dist/mdruntime/store/space.d.ts +10 -0
  65. package/dist/mdruntime/store/watchers.d.ts +16 -0
  66. package/dist/mdruntime/store/writes.d.ts +23 -0
  67. package/dist/mdruntime/store.d.ts +107 -153
  68. package/dist/mdruntime/stored.d.ts +58 -64
  69. package/dist/mdruntime/surface.d.ts +87 -0
  70. package/dist/mdruntime/tables.d.ts +110 -48
  71. package/dist/mdruntime/tallies.d.ts +17 -0
  72. package/dist/mdruntime/transfer.d.ts +4 -0
  73. package/dist/mdruntime/turn.d.ts +8 -0
  74. package/dist/mdruntime/wire.d.ts +16 -1
  75. package/dist/test-host.js +1 -1
  76. package/docs/families.md +17 -6
  77. package/package.json +1 -1
  78. package/dist/mdmodel/condition.d.ts +0 -180
  79. package/dist/mdruntime/connection.d.ts +0 -151
package/README.md CHANGED
@@ -3,16 +3,16 @@
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 twelve families: navigation,
7
- ceremonies, installation, notifications, status, Site image reads, App release
8
- code, external calls, App messages, App and Site screenshot reads and the Chat.
9
- [docs/families.md](docs/families.md) describes each and the test host.
6
+ carries no bridge code of its own. It carries thirteen families: navigation,
7
+ ceremonies, installation, notifications, Telegram, status, Site image reads, App
8
+ release code, external calls, App messages, App and Site screenshot reads and the
9
+ Chat. [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
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,21 @@
1
1
  import type { MdRuntimeClient, Open } from './mdruntime/client.js';
2
2
  export interface HouseMethods {
3
- readonly "apps/features/read": {
3
+ readonly "agent-functions/requests/list": {
4
+ readonly params: {
5
+ readonly room_ref: string;
6
+ };
7
+ readonly result: {
8
+ readonly current: readonly {
9
+ readonly document: string;
10
+ readonly name: string;
11
+ }[];
12
+ readonly history: readonly {
13
+ readonly document: string;
14
+ readonly name: string;
15
+ }[];
16
+ };
17
+ };
18
+ readonly "apps/features/list": {
4
19
  readonly params: {};
5
20
  readonly result: {
6
21
  readonly features: readonly {
@@ -9,11 +24,10 @@ export interface HouseMethods {
9
24
  }[];
10
25
  };
11
26
  };
12
- readonly "apps/holders": {
27
+ readonly "apps/holders/list": {
13
28
  readonly params: {};
14
29
  readonly result: {
15
30
  readonly holders: readonly {
16
- readonly email: string;
17
31
  readonly name: string;
18
32
  readonly user: string;
19
33
  }[];
@@ -28,7 +42,7 @@ export interface HouseMethods {
28
42
  readonly [key: string]: never;
29
43
  };
30
44
  };
31
- readonly "apps/relay": {
45
+ readonly "apps/relay/read": {
32
46
  readonly params: {
33
47
  readonly [key: string]: never;
34
48
  };
@@ -58,6 +72,7 @@ export interface HouseMethods {
58
72
  } | {
59
73
  readonly user: string;
60
74
  };
75
+ readonly operation_id: string;
61
76
  readonly path: string;
62
77
  readonly room_ref: string;
63
78
  };
@@ -81,6 +96,29 @@ export interface HouseMethods {
81
96
  readonly url: string;
82
97
  };
83
98
  };
99
+ readonly "chats/reply": {
100
+ readonly params: {
101
+ readonly operation_id: string;
102
+ readonly path: string;
103
+ readonly room_ref: string;
104
+ readonly template?: {
105
+ readonly language: string;
106
+ readonly name: string;
107
+ };
108
+ readonly text?: string;
109
+ readonly values?: {
110
+ readonly [key: string]: string;
111
+ };
112
+ };
113
+ readonly result: {
114
+ readonly authority: string;
115
+ readonly log_epoch: string;
116
+ readonly path: string;
117
+ readonly position: string;
118
+ readonly room_ref: string;
119
+ readonly url: string;
120
+ };
121
+ };
84
122
  readonly "chats/return": {
85
123
  readonly params: {
86
124
  readonly path: string;
@@ -108,6 +146,7 @@ export interface HouseMethods {
108
146
  };
109
147
  readonly "chats/take-control": {
110
148
  readonly params: {
149
+ readonly operation_id: string;
111
150
  readonly path: string;
112
151
  readonly room_ref: string;
113
152
  };
@@ -176,7 +215,7 @@ export interface HouseMethods {
176
215
  readonly url: string;
177
216
  };
178
217
  };
179
- readonly "conversations/history": {
218
+ readonly "conversations/history/list": {
180
219
  readonly params: {
181
220
  readonly conversations: readonly {
182
221
  readonly after?: {
@@ -276,6 +315,11 @@ export interface HouseMethods {
276
315
  };
277
316
  readonly request: string;
278
317
  } | {
318
+ readonly agent_function: null | {
319
+ readonly id: string;
320
+ readonly name: string;
321
+ readonly version: number;
322
+ };
279
323
  readonly approved_at: null | string;
280
324
  readonly kind: "request";
281
325
  readonly request: string;
@@ -293,11 +337,6 @@ export interface HouseMethods {
293
337
  readonly ref: string;
294
338
  readonly url: string;
295
339
  };
296
- readonly routine: null | {
297
- readonly id: string;
298
- readonly name: string;
299
- readonly version: number;
300
- };
301
340
  } | {
302
341
  readonly kind: "reply";
303
342
  readonly name: string;
@@ -317,6 +356,12 @@ export interface HouseMethods {
317
356
  };
318
357
  readonly telegram_undelivered?: true;
319
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
+ };
320
365
  readonly transcripts?: readonly {
321
366
  readonly path: string;
322
367
  readonly text: string;
@@ -380,7 +425,7 @@ export interface HouseMethods {
380
425
  readonly url: string;
381
426
  };
382
427
  };
383
- readonly "conversations/option": {
428
+ readonly "conversations/option/set": {
384
429
  readonly params: {
385
430
  readonly conversation_id: string;
386
431
  readonly operation_id: string;
@@ -444,7 +489,7 @@ export interface HouseMethods {
444
489
  readonly url: string;
445
490
  };
446
491
  };
447
- readonly "records/read": {
492
+ readonly "records/list": {
448
493
  readonly params: {
449
494
  readonly order?: "asc" | "desc";
450
495
  readonly room_ref: string;
@@ -459,10 +504,9 @@ export interface HouseMethods {
459
504
  }[];
460
505
  };
461
506
  };
462
- readonly "rooms/access/read": {
507
+ readonly "rooms/access/list": {
463
508
  readonly params: {
464
509
  readonly room_ref: string;
465
- readonly statistics?: boolean;
466
510
  };
467
511
  readonly result: {
468
512
  readonly authority: "administrator" | "member" | "owner";
@@ -471,41 +515,33 @@ export interface HouseMethods {
471
515
  readonly direct: readonly {
472
516
  readonly level: null | "keep" | "open" | "search";
473
517
  readonly namespace: string;
474
- readonly operations: readonly ("delete" | "export" | "manageAccess" | "write")[];
518
+ readonly operations: readonly ("erase" | "export" | "manageAccess" | "write")[];
475
519
  }[];
476
- readonly downloads_per_day?: number;
477
520
  readonly entries: readonly {
478
521
  readonly level: null | "keep" | "open" | "search";
479
522
  readonly namespace: string;
480
- readonly operations: readonly ("delete" | "export" | "manageAccess" | "write")[];
523
+ readonly operations: readonly ("erase" | "export" | "manageAccess" | "write")[];
481
524
  readonly sources: readonly {
482
525
  readonly kind: "direct" | "inherited";
483
526
  readonly level: null | "keep" | "open" | "search";
484
527
  readonly namespace: string;
485
- readonly operations: readonly ("delete" | "export" | "manageAccess" | "write")[];
528
+ readonly operations: readonly ("erase" | "export" | "manageAccess" | "write")[];
486
529
  }[];
487
530
  }[];
488
531
  readonly key: null | string;
489
- readonly requests_per_day?: number;
490
532
  readonly schema_roles: readonly string[];
533
+ readonly through_space?: true;
491
534
  readonly user: string;
492
535
  readonly user_name: string;
493
536
  }[];
494
537
  readonly namespaces: readonly string[];
495
538
  readonly owner: string;
496
539
  readonly room_ref: string;
497
- readonly statistics?: readonly {
498
- readonly day: string;
499
- readonly downloads: number;
500
- readonly requests: number;
501
- readonly text_bytes: number;
502
- readonly user: string;
503
- }[];
504
540
  readonly url: string;
505
541
  readonly viewer: string;
506
542
  };
507
543
  };
508
- readonly "rooms/members": {
544
+ readonly "rooms/members/list": {
509
545
  readonly params: {
510
546
  readonly history?: boolean;
511
547
  readonly room_ref: string;
@@ -517,14 +553,15 @@ export interface HouseMethods {
517
553
  readonly user: string;
518
554
  }[];
519
555
  readonly members: readonly {
520
- readonly access?: "edit" | "keep" | "manage" | "open" | "owner" | "search";
556
+ readonly access?: "manage" | "owner" | "read" | "write";
557
+ readonly copies?: "online_only" | "search_only";
521
558
  readonly display_name: string;
522
559
  readonly email?: string;
523
560
  readonly member_document: null | string;
524
- readonly only_while_online?: true;
525
561
  readonly owner: boolean;
526
562
  readonly schema_roles?: readonly string[];
527
563
  readonly since: null | string;
564
+ readonly through_space?: true;
528
565
  readonly user: string;
529
566
  }[];
530
567
  };
@@ -562,22 +599,7 @@ export interface HouseMethods {
562
599
  readonly writable: boolean;
563
600
  };
564
601
  };
565
- readonly "routines/requests": {
566
- readonly params: {
567
- readonly room_ref: string;
568
- };
569
- readonly result: {
570
- readonly current: readonly {
571
- readonly document: string;
572
- readonly name: string;
573
- }[];
574
- readonly history: readonly {
575
- readonly document: string;
576
- readonly name: string;
577
- }[];
578
- };
579
- };
580
- readonly "site/submission": {
602
+ readonly "sites/submissions/create": {
581
603
  readonly params: {
582
604
  readonly content: string;
583
605
  };
@@ -585,9 +607,10 @@ export interface HouseMethods {
585
607
  readonly submitted: true;
586
608
  };
587
609
  };
588
- readonly "storage/inventory": {
610
+ readonly "storage/inventory/read": {
589
611
  readonly params: {
590
612
  readonly room_ref?: string;
613
+ readonly rooms?: "owned";
591
614
  };
592
615
  readonly result: {
593
616
  readonly blob: {
@@ -639,6 +662,35 @@ export interface HouseMethods {
639
662
  readonly layout: string;
640
663
  };
641
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
+ }[];
642
694
  readonly site_images: {
643
695
  readonly bound: string;
644
696
  readonly bytes: string;
@@ -670,26 +722,55 @@ export interface HouseMethods {
670
722
  readonly layout: string;
671
723
  };
672
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
+ }[];
673
754
  readonly total: {
674
755
  readonly bytes: string;
675
756
  readonly gigabytes: string;
676
757
  };
677
758
  };
678
759
  };
679
- readonly "triggers/fired": {
760
+ readonly "triggers/fired/list": {
680
761
  readonly params: {
681
- readonly room_ref: string;
762
+ readonly room_ref?: string;
682
763
  };
683
764
  readonly result: {
684
765
  readonly events: readonly {
685
766
  readonly actions: readonly ({
686
- readonly cap: "address_submissions" | "app_sockets" | "environment_functions" | "export_starts" | "folder_subscriptions" | "kit_connections" | "live_shares" | "open_uploads" | "ownership_offers" | "push_addresses" | "push_deliveries" | "room_triggers" | "service_keys" | "share_creations" | "share_room_creations" | "shared_schemas" | "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";
687
768
  readonly code: "cap_reached";
688
769
  readonly outcome: "refused";
689
770
  readonly position: number;
690
771
  readonly retry_at: string;
691
772
  } | {
692
- readonly cap: "address_submissions" | "app_sockets" | "environment_functions" | "export_starts" | "folder_subscriptions" | "kit_connections" | "live_shares" | "open_uploads" | "ownership_offers" | "push_addresses" | "push_deliveries" | "room_triggers" | "service_keys" | "share_creations" | "share_room_creations" | "shared_schemas" | "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";
693
774
  readonly code: "cap_reached";
694
775
  readonly outcome: "refused";
695
776
  readonly position: number;
@@ -744,21 +825,21 @@ export interface HouseMethods {
744
825
  readonly value: string;
745
826
  } | {
746
827
  readonly code: "limit_reached";
747
- readonly limit: "custom_domains" | "external_calls" | "mcp_downloads" | "mcp_reads" | "publish_data" | "site_submissions" | "sites";
828
+ readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
748
829
  readonly outcome: "refused";
749
830
  readonly position: number;
750
831
  readonly retry_at: string;
751
832
  } | {
752
833
  readonly code: "limit_reached";
753
- readonly limit: "custom_domains" | "external_calls" | "mcp_downloads" | "mcp_reads" | "publish_data" | "site_submissions" | "sites";
834
+ readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
754
835
  readonly outcome: "refused";
755
836
  readonly position: number;
756
837
  } | {
757
- readonly code: "app_function_not_found" | "app_not_found" | "environment_function_not_found" | "environment_offline" | "no_recipient" | "routine_not_found" | "routine_retired" | "target_agent_unavailable";
838
+ readonly code: "agent_function_not_found" | "agent_function_retired" | "app_function_not_found" | "app_not_found" | "environment_function_not_found" | "environment_offline" | "no_recipient" | "target_agent_unavailable";
758
839
  readonly outcome: "no_target";
759
840
  readonly position: number;
760
841
  } | {
761
- readonly code: "internal_error" | "routine_request_not_started";
842
+ readonly code: "agent_function_request_not_started" | "internal_error";
762
843
  readonly outcome: "failed";
763
844
  readonly position: number;
764
845
  } | {
@@ -812,6 +893,7 @@ export interface HouseMethods {
812
893
  readonly missed?: "failed" | "skipped";
813
894
  readonly moment?: string;
814
895
  readonly path?: string;
896
+ readonly room_ref?: string;
815
897
  readonly trigger: string;
816
898
  readonly url?: string;
817
899
  }[];
@@ -919,6 +1001,11 @@ export interface HouseAppMessage {
919
1001
  }
920
1002
  export type HouseInstallation = Open<'accepted' | 'dismissed' | 'manual'>;
921
1003
  export type HouseNotifications = Open<'on' | 'off' | 'blocked' | 'unavailable'>;
1004
+ export interface HouseTelegram {
1005
+ readonly state: Open<'available' | 'linked' | 'unavailable'>;
1006
+ readonly name: string | null;
1007
+ readonly username: string | null;
1008
+ }
922
1009
  export interface HouseCeremonyRefused extends Error {
923
1010
  readonly name: 'HouseCeremonyRefused';
924
1011
  readonly code: Open<'house_ceremony_refused'>;
@@ -968,7 +1055,7 @@ export interface HouseBridge {
968
1055
  ceremony(path: string): Promise<never>;
969
1056
  install(): Promise<HouseInstallation>;
970
1057
  notifications(on?: boolean): Promise<HouseNotifications>;
971
- setBadge(unread: readonly string[]): Promise<void>;
1058
+ telegram(link?: true): Promise<HouseTelegram>;
972
1059
  setTab(tab: HouseTab): void;
973
1060
  sourceTop(app: string, release?: string): Promise<HouseSourceTop | HouseRefusal | null>;
974
1061
  sourceDownload(app: string, release?: string): Promise<HouseSourceDownload | HouseRefusal | null>;
@@ -78,4 +78,4 @@ export type PointerFacts = {
78
78
  export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
79
79
  export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
80
80
  export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
81
- export declare function readSchema(text: string, provided?: VerifiedModel): VerifiedModel | Failure;
81
+ export declare function readSchema(text: string, provided?: VerifiedModel, checked?: boolean): VerifiedModel | Failure;
@@ -1,14 +1,14 @@
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, Outline, 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;
7
- export declare function outline(content: string, file: string): Outline;
8
7
  export declare function parse(content: string, file?: string): ParseResult;
9
8
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
10
9
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
11
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;
12
12
  export declare function links(document: Document, file: string): readonly Link[];
13
13
  export declare function bodyLinks(body: string, file: string): readonly Link[];
14
14
  export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
@@ -0,0 +1,77 @@
1
+ import { type Definition } from './definition.js';
2
+ import type { Candidate } from './query/match.js';
3
+ import type { Document, VerifiedModel } from './types.js';
4
+ export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
5
+ type Scalar = string | number | boolean;
6
+ export type Fact = {
7
+ readonly kind: FactKind;
8
+ readonly value: Scalar;
9
+ readonly member?: string;
10
+ } | {
11
+ readonly kind: 'prose';
12
+ } | {
13
+ readonly kind: 'null';
14
+ } | {
15
+ readonly kind: 'unreadable';
16
+ } | {
17
+ readonly kind: 'list';
18
+ readonly items: readonly Fact[];
19
+ } | {
20
+ readonly kind: 'object';
21
+ readonly fields: Readonly<Record<string, Fact>>;
22
+ };
23
+ export type DocumentFacts = {
24
+ readonly id: string;
25
+ readonly path: string;
26
+ readonly type: string | null;
27
+ readonly fields: Readonly<Record<string, Fact>>;
28
+ readonly sections: readonly string[];
29
+ };
30
+ export declare const TEXT_FIELD = "/text";
31
+ export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client', 'function'];
32
+ export type WriteDoor = (typeof WRITE_DOORS)[number];
33
+ export type Actor = {
34
+ readonly user?: string;
35
+ readonly site?: string;
36
+ readonly app?: string;
37
+ readonly door?: WriteDoor;
38
+ };
39
+ export type DocumentEvent = {
40
+ readonly before: DocumentFacts | null;
41
+ readonly after: DocumentFacts | null;
42
+ readonly changed: readonly string[];
43
+ readonly by: Actor;
44
+ readonly moved_between_rooms: boolean;
45
+ };
46
+ export type ItemFacts = {
47
+ readonly delivery: string;
48
+ readonly source: string | null;
49
+ readonly address: string | null;
50
+ readonly container: string | null;
51
+ readonly author: string | null;
52
+ readonly headers: Readonly<Record<string, string>>;
53
+ readonly json: {
54
+ readonly value: unknown;
55
+ } | null;
56
+ };
57
+ export type MessageFacts = {
58
+ readonly sender: string;
59
+ readonly agent_function: string | null;
60
+ readonly path: string | null;
61
+ };
62
+ export type Resolved = {
63
+ readonly id: string;
64
+ readonly member?: string;
65
+ };
66
+ export declare function facts(document: Pick<Document, 'type' | 'fields' | 'sections'>, at: {
67
+ readonly id: string;
68
+ readonly path: string;
69
+ }, model: VerifiedModel, resolve: (target: string) => Resolved | undefined): DocumentFacts;
70
+ export declare function prosePaths(facts: DocumentFacts): string[];
71
+ export declare function members(document: DocumentFacts, path: string): readonly string[];
72
+ export declare function pointed(value: unknown, pointer: string): unknown;
73
+ export declare function valuedChange(definition: Definition, pointer: string): boolean;
74
+ export declare function datePointers(definition: Definition): string[];
75
+ export declare function memberPointers(definition: Definition, memberType: string): string[];
76
+ export declare function candidateOf(document: DocumentFacts): Candidate;
77
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { Document, ParseResult, VerifiedModel } from './types.js';
2
+ export type SavedFacts = {
3
+ readonly type: string;
4
+ readonly fields: Readonly<Record<string, unknown>>;
5
+ readonly links: readonly string[];
6
+ };
7
+ export type ReferenceTarget = {
8
+ readonly location: string;
9
+ readonly to: readonly string[];
10
+ readonly target: string;
11
+ };
12
+ export declare function referenceTarget(file: string, value: string): string | null;
13
+ export declare function referenceTargets(document: Document, file: string, model: VerifiedModel): readonly ReferenceTarget[];
14
+ export declare function documentFacts(file: string, parsed: ParseResult, model: VerifiedModel): SavedFacts | null;
@@ -1,11 +1,23 @@
1
- export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, inScope, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, MESSAGE_PATHS, messageFires, messageOperators, notificationFires, pointed, prosePaths, testOperators, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './condition.js';
2
- export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, MessageCondition, MessageFacts, NotificationCondition, Resolved, WriteDoor, } from './condition.js';
1
+ export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
2
+ export type { Actor, DocumentEvent, DocumentFacts, Fact, FactKind, ItemFacts, MessageFacts, Resolved, WriteDoor, } from './event.js';
3
+ export { byCodePoint, compared, dated, fitsKind, instant, instantKey, KINDS, kindOf, kindWords, } from './kinds.js';
4
+ export type { Kind, Ordering } from './kinds.js';
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, 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
+ export { heldAt, matches } from './query/match.js';
8
+ export type { Candidate } from './query/match.js';
9
+ export { heldKind, indexed } from './query/rows.js';
10
+ export type { HeldKind, HeldLink, HeldValue, Indexed, Reach } from './query/rows.js';
11
+ export * as sql from './query/sql.js';
3
12
  export { headingLines } from './blocks.js';
4
13
  export type { HeadingLine } from './blocks.js';
5
14
  export { divide } from './divide.js';
6
- export { apply, bodyLinks, links, outline, 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
+ export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
17
+ export type { ReferenceTarget, SavedFacts } from './facts.js';
7
18
  export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
8
19
  export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
20
+ export { openPatternBudget } from './pattern.js';
9
21
  export type { RoomTarget } from './paths.js';
10
22
  export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
11
23
  export { project } from './project.js';
@@ -13,9 +25,9 @@ export { references } from './references.js';
13
25
  export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
14
26
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
15
27
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
16
- export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, Outline, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
17
- export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.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
+ export { assess, assessReferences, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
18
30
  export type { Assessment, Verdicts } from './validate.js';
19
31
  export { VERSION } from './version.js';
20
- export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
32
+ export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
21
33
  export type { FrontmatterValue } from './yaml.js';
@@ -0,0 +1,18 @@
1
+ import type { ValueFacts } from './definition.js';
2
+ export declare const KINDS: readonly ['string', 'number', 'integer', 'boolean', 'date', 'date-time', 'time', 'enum', 'reference'];
3
+ export type Kind = (typeof KINDS)[number];
4
+ export type Ordering = {
5
+ readonly direction: 'asc' | 'desc';
6
+ readonly nulls: 'first' | 'last';
7
+ readonly stringSort: 'lexical' | 'locale';
8
+ readonly locale: string | undefined;
9
+ readonly localeOptions: Intl.CollatorOptions | undefined;
10
+ };
11
+ export declare function kindOf(facts: ValueFacts): Kind | null;
12
+ export declare function fitsKind(kind: Kind, facts: ValueFacts, value: unknown): boolean;
13
+ export declare function kindWords(facts: ValueFacts | undefined): readonly string[];
14
+ export declare function dated(value: unknown): value is string;
15
+ export declare function instant(value: unknown): bigint | undefined;
16
+ export declare function instantKey(value: unknown): string | null;
17
+ export declare function byCodePoint(left: string, right: string): number;
18
+ export declare function compared(left: unknown, right: unknown, ordering: Ordering): number;
@@ -0,0 +1,9 @@
1
+ export declare const PATTERN_STATES = 1000;
2
+ export declare class PatternTooCostly extends Error {
3
+ }
4
+ export type Pattern = {
5
+ readonly test: (text: string) => boolean;
6
+ };
7
+ export declare function linearPattern(source: string): Pattern | null;
8
+ export declare function withLinearRegExp<T>(run: () => T): T;
9
+ export declare function openPatternBudget(): () => void;