@agentshouse/app-bridge 0.1.0-c925d1f17abd4 → 0.1.0-c92708f9be9bb

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 (83) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +108 -60
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/built-in.d.ts +3 -0
  5. package/dist/mdmodel/definition.d.ts +8 -10
  6. package/dist/mdmodel/document.d.ts +7 -5
  7. package/dist/mdmodel/event.d.ts +1 -2
  8. package/dist/mdmodel/fields.d.ts +1 -1
  9. package/dist/mdmodel/house-model.d.ts +869 -0
  10. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  11. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  12. package/dist/mdmodel/index.d.ts +24 -9
  13. package/dist/mdmodel/indexed.d.ts +8 -0
  14. package/dist/mdmodel/kinds.d.ts +2 -0
  15. package/dist/mdmodel/markdown.d.ts +28 -4
  16. package/dist/mdmodel/media-type.d.ts +71 -0
  17. package/dist/mdmodel/moment.d.ts +6 -0
  18. package/dist/mdmodel/not-ready.d.ts +1 -0
  19. package/dist/mdmodel/paths.d.ts +6 -0
  20. package/dist/mdmodel/query/match.d.ts +1 -1
  21. package/dist/mdmodel/query/rows.d.ts +1 -1
  22. package/dist/mdmodel/references.d.ts +2 -2
  23. package/dist/mdmodel/room-types.d.ts +6 -0
  24. package/dist/mdmodel/types.d.ts +4 -16
  25. package/dist/mdmodel/validate.d.ts +4 -1
  26. package/dist/mdmodel/yaml.d.ts +4 -4
  27. package/dist/mdruntime/actions.d.ts +1 -0
  28. package/dist/mdruntime/adapter.d.ts +85 -14
  29. package/dist/mdruntime/attached-model.d.ts +0 -1
  30. package/dist/mdruntime/authored.d.ts +87 -0
  31. package/dist/mdruntime/change.d.ts +4 -0
  32. package/dist/mdruntime/client.d.ts +14 -11
  33. package/dist/mdruntime/collection.d.ts +5 -1
  34. package/dist/mdruntime/compile.d.ts +2 -0
  35. package/dist/mdruntime/conversation-live.d.ts +18 -6
  36. package/dist/mdruntime/conversation-row.d.ts +8 -1
  37. package/dist/mdruntime/conversation.d.ts +19 -7
  38. package/dist/mdruntime/durability.d.ts +2 -0
  39. package/dist/mdruntime/house-query.d.ts +20 -0
  40. package/dist/mdruntime/install.d.ts +59 -0
  41. package/dist/mdruntime/listing.d.ts +24 -12
  42. package/dist/mdruntime/live.d.ts +5 -3
  43. package/dist/mdruntime/media.d.ts +18 -1
  44. package/dist/mdruntime/messages.d.ts +12 -3
  45. package/dist/mdruntime/modal.d.ts +1 -0
  46. package/dist/mdruntime/model.d.ts +4 -2
  47. package/dist/mdruntime/observation.d.ts +29 -12
  48. package/dist/mdruntime/outcome.d.ts +10 -1
  49. package/dist/mdruntime/overlay.d.ts +4 -1
  50. package/dist/mdruntime/preparation.d.ts +27 -6
  51. package/dist/mdruntime/presence.d.ts +8 -2
  52. package/dist/mdruntime/reach.d.ts +11 -5
  53. package/dist/mdruntime/readiness.d.ts +9 -3
  54. package/dist/mdruntime/reads.d.ts +1 -1
  55. package/dist/mdruntime/recovery.d.ts +1 -0
  56. package/dist/mdruntime/room-draft.d.ts +30 -5
  57. package/dist/mdruntime/runtime.d.ts +1 -2
  58. package/dist/mdruntime/save.d.ts +1 -0
  59. package/dist/mdruntime/saves.d.ts +2 -0
  60. package/dist/mdruntime/socket/lanes.d.ts +10 -3
  61. package/dist/mdruntime/socket/session.d.ts +2 -1
  62. package/dist/mdruntime/socket.d.ts +3 -3
  63. package/dist/mdruntime/source.d.ts +5 -7
  64. package/dist/mdruntime/store/installs.d.ts +2 -2
  65. package/dist/mdruntime/store/readiness.d.ts +5 -4
  66. package/dist/mdruntime/store/records.d.ts +19 -5
  67. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  68. package/dist/mdruntime/store.d.ts +13 -9
  69. package/dist/mdruntime/stored.d.ts +24 -13
  70. package/dist/mdruntime/surface.d.ts +12 -6
  71. package/dist/mdruntime/tables.d.ts +16 -52
  72. package/dist/mdruntime/wire.d.ts +33 -10
  73. package/dist/session-content/check.d.ts +0 -1
  74. package/dist/session-content/index.d.ts +2 -3
  75. package/dist/session-content/parts.d.ts +12 -84
  76. package/dist/session-content/state.d.ts +4 -6
  77. package/dist/session-content/turn.d.ts +28 -219
  78. package/dist/test-host.d.ts +8 -1
  79. package/dist/test-host.js +31 -1
  80. package/docs/families.md +54 -30
  81. package/package.json +2 -2
  82. package/dist/mdruntime/log.d.ts +0 -5
  83. package/dist/session-content/bounds.d.ts +0 -7
package/README.md CHANGED
@@ -3,8 +3,8 @@
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 thirteen families: navigation,
7
- ceremonies, installation, notifications, Telegram, status, Site image reads, App
6
+ carries no bridge code of its own. It carries these families: navigation,
7
+ ceremonies, notifications, Telegram, status, App
8
8
  release code, external calls, App messages, App and Site screenshot reads and the
9
9
  Chat. [docs/families.md](docs/families.md) describes each and the test host.
10
10
 
package/dist/index.d.ts CHANGED
@@ -226,22 +226,6 @@ export interface HouseMethods {
226
226
  readonly params: never;
227
227
  readonly result: never;
228
228
  };
229
- readonly "records/list": {
230
- readonly params: {
231
- readonly operation_id?: string;
232
- readonly order?: "asc" | "desc";
233
- readonly room_ref: string;
234
- };
235
- readonly result: {
236
- readonly records: readonly {
237
- readonly body: null | string;
238
- readonly claimed: unknown;
239
- readonly created_at: string;
240
- readonly record: string;
241
- readonly ref: string;
242
- }[];
243
- };
244
- };
245
229
  readonly "rooms/access/list": {
246
230
  readonly params: {
247
231
  readonly operation_id?: string;
@@ -287,11 +271,18 @@ export interface HouseMethods {
287
271
  readonly room_ref: string;
288
272
  };
289
273
  readonly result: {
290
- readonly history?: readonly {
274
+ readonly history?: readonly ({
275
+ readonly agent_name?: string;
276
+ readonly at: string;
277
+ readonly by?: string;
278
+ readonly kind: "role_given" | "role_taken";
279
+ readonly role: string;
280
+ readonly user: string;
281
+ } | {
291
282
  readonly at: string;
292
283
  readonly kind: "granted" | "revoked";
293
284
  readonly user: string;
294
- }[];
285
+ })[];
295
286
  readonly members: readonly {
296
287
  readonly access?: "manage" | "owner" | "read" | "write";
297
288
  readonly copies?: "online_only" | "search_only";
@@ -300,6 +291,12 @@ export interface HouseMethods {
300
291
  readonly member_document: null | string;
301
292
  readonly owner: boolean;
302
293
  readonly schema_roles?: readonly string[];
294
+ readonly schema_roles_given?: readonly {
295
+ readonly agent_name?: string;
296
+ readonly at: string;
297
+ readonly by?: string;
298
+ readonly role: string;
299
+ }[];
303
300
  readonly since: null | string;
304
301
  readonly through_space?: true;
305
302
  readonly user: string;
@@ -334,12 +331,41 @@ export interface HouseMethods {
334
331
  readonly policy: {
335
332
  readonly from: null | string;
336
333
  readonly origin: "default" | "explicit" | "inherited";
337
- readonly reason: null | "room_too_large" | "unfunded";
334
+ readonly reason: null | "full_house_required" | "room_too_large";
338
335
  readonly value: "Off" | "On";
339
336
  };
340
337
  readonly writable: boolean;
341
338
  };
342
339
  };
340
+ readonly "service-keys/signatures/check": {
341
+ readonly params: {
342
+ readonly operation_id?: string;
343
+ readonly origin: string;
344
+ readonly room_ref: string;
345
+ readonly signature: string;
346
+ readonly text: string;
347
+ };
348
+ readonly result: {
349
+ readonly matched: boolean;
350
+ };
351
+ };
352
+ readonly "sites/functions/call": {
353
+ readonly params: {
354
+ readonly function: string;
355
+ readonly input?: readonly (readonly unknown[] | boolean | null | number | {
356
+ readonly [key: string]: unknown;
357
+ } | string)[] | boolean | null | number | {
358
+ readonly [key: string]: readonly unknown[] | boolean | null | number | {
359
+ readonly [key: string]: unknown;
360
+ } | string;
361
+ } | string;
362
+ };
363
+ readonly result: {
364
+ readonly answer: readonly unknown[] | boolean | null | number | {
365
+ readonly [key: string]: unknown;
366
+ } | string;
367
+ };
368
+ };
343
369
  readonly "sites/submissions/create": {
344
370
  readonly params: {
345
371
  readonly content: string;
@@ -363,19 +389,9 @@ export interface HouseMethods {
363
389
  readonly state: "settled";
364
390
  };
365
391
  readonly indexed_text: {
366
- readonly approximate_pages: null | string;
367
392
  readonly bytes: string;
368
393
  readonly gigabytes: string;
369
394
  };
370
- readonly measurement: {
371
- readonly page_reference: null | {
372
- readonly bytes_per_page: string;
373
- readonly encoding: string;
374
- readonly font: string;
375
- readonly font_size_pt: string;
376
- readonly layout: string;
377
- };
378
- };
379
395
  readonly room_ref: string;
380
396
  readonly total: {
381
397
  readonly bytes: string;
@@ -391,19 +407,9 @@ export interface HouseMethods {
391
407
  readonly state: "settled";
392
408
  };
393
409
  readonly indexed_text: {
394
- readonly approximate_pages: null | string;
395
410
  readonly bytes: string;
396
411
  readonly gigabytes: string;
397
412
  };
398
- readonly measurement: {
399
- readonly page_reference: null | {
400
- readonly bytes_per_page: string;
401
- readonly encoding: string;
402
- readonly font: string;
403
- readonly font_size_pt: string;
404
- readonly layout: string;
405
- };
406
- };
407
413
  readonly rooms?: readonly {
408
414
  readonly blob: {
409
415
  readonly bytes: string;
@@ -413,19 +419,9 @@ export interface HouseMethods {
413
419
  readonly state: "settled";
414
420
  };
415
421
  readonly indexed_text: {
416
- readonly approximate_pages: null | string;
417
422
  readonly bytes: string;
418
423
  readonly gigabytes: string;
419
424
  };
420
- readonly measurement: {
421
- readonly page_reference: null | {
422
- readonly bytes_per_page: string;
423
- readonly encoding: string;
424
- readonly font: string;
425
- readonly font_size_pt: string;
426
- readonly layout: string;
427
- };
428
- };
429
425
  readonly room_ref: string;
430
426
  readonly total: {
431
427
  readonly bytes: string;
@@ -462,6 +458,17 @@ export interface HouseMethods {
462
458
  readonly code: "cap_reached";
463
459
  readonly outcome: "refused";
464
460
  readonly position: number;
461
+ } | {
462
+ readonly code: "agent_function_request_not_started";
463
+ readonly final?: true;
464
+ readonly outcome: "failed";
465
+ readonly position: number;
466
+ } | {
467
+ readonly code: "agent_function_unreadable";
468
+ readonly document_path: string;
469
+ readonly final: true;
470
+ readonly outcome: "failed";
471
+ readonly position: number;
465
472
  } | {
466
473
  readonly code: "agent_unavailable";
467
474
  readonly outcome: "withdrawn";
@@ -489,6 +496,11 @@ export interface HouseMethods {
489
496
  readonly outcome: "failed";
490
497
  readonly position: number;
491
498
  readonly tries: number;
499
+ } | {
500
+ readonly code: "internal_error";
501
+ readonly final: true;
502
+ readonly outcome: "failed";
503
+ readonly position: number;
492
504
  } | {
493
505
  readonly code: "limit_reached";
494
506
  readonly limit: "reads";
@@ -513,21 +525,22 @@ export interface HouseMethods {
513
525
  readonly value: string;
514
526
  } | {
515
527
  readonly code: "limit_reached";
516
- readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
528
+ readonly limit: "custom_domains" | "external_calls" | "publish_data" | "site_function_calls" | "sites";
517
529
  readonly outcome: "refused";
518
530
  readonly position: number;
519
531
  readonly retry_at: string;
520
532
  } | {
521
533
  readonly code: "limit_reached";
522
- readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
534
+ readonly limit: "custom_domains" | "external_calls" | "publish_data" | "site_function_calls" | "sites";
523
535
  readonly outcome: "refused";
524
536
  readonly position: number;
525
537
  } | {
526
- readonly code: "agent_function_request_not_started" | "internal_error";
538
+ readonly code: "post_not_confirmed";
539
+ readonly final: true;
527
540
  readonly outcome: "failed";
528
541
  readonly position: number;
529
542
  } | {
530
- readonly code: "agent_function_retired" | "environment_offline" | "no_recipient" | "not_found" | "target_agent_unavailable";
543
+ readonly code: "agent_function_retired" | "environment_offline" | "no_group" | "no_recipient" | "not_found" | "target_agent_unavailable";
531
544
  readonly outcome: "no_target";
532
545
  readonly position: number;
533
546
  } | {
@@ -545,6 +558,10 @@ export interface HouseMethods {
545
558
  readonly output?: string;
546
559
  readonly position: number;
547
560
  readonly run: string;
561
+ } | {
562
+ readonly mentioned: number;
563
+ readonly outcome: "posted";
564
+ readonly position: number;
548
565
  } | {
549
566
  readonly outcome: "continued";
550
567
  readonly position: number;
@@ -608,7 +625,7 @@ export interface HouseCredentialState {
608
625
  readonly state: Open<'none' | 'held' | 'rejected'>;
609
626
  readonly expiresAt: number | null;
610
627
  }
611
- export type HouseDatabaseFailure = 'unsupported' | 'damaged';
628
+ export type HouseDatabaseFailure = 'damaged';
612
629
  export type HouseAnalyticsChoice = 'accept' | 'decline';
613
630
  export interface HouseAnalytics {
614
631
  readonly measures: boolean;
@@ -636,6 +653,7 @@ export type HouseNavigationMode = 'push' | 'replace';
636
653
  export interface HouseTab {
637
654
  readonly title?: string;
638
655
  readonly icon?: string;
656
+ readonly scheme?: 'light' | 'dark' | null;
639
657
  }
640
658
  interface HouseRelease {
641
659
  readonly app_ref: string;
@@ -686,13 +704,26 @@ export interface HouseAppMessage {
686
704
  readonly from: string;
687
705
  readonly body: unknown;
688
706
  }
689
- export type HouseInstallation = Open<'accepted' | 'dismissed' | 'manual'>;
707
+ export interface HouseBox {
708
+ readonly x: number;
709
+ readonly y: number;
710
+ readonly width: number;
711
+ readonly height: number;
712
+ }
713
+ export interface HouseTitleRow {
714
+ readonly height: number;
715
+ readonly controls: readonly HouseBox[];
716
+ }
690
717
  export type HouseNotifications = Open<'on' | 'off' | 'blocked' | 'unavailable'>;
691
718
  export interface HouseTelegram {
692
719
  readonly state: Open<'available' | 'linked' | 'unavailable'>;
693
720
  readonly name: string | null;
694
721
  readonly username: string | null;
695
722
  }
723
+ export interface HouseCeremonyEnded {
724
+ readonly said: string | null;
725
+ readonly done: boolean;
726
+ }
696
727
  export interface HouseCeremonyRefused extends Error {
697
728
  readonly name: 'HouseCeremonyRefused';
698
729
  readonly code: Open<'house_ceremony_refused'>;
@@ -712,7 +743,6 @@ export interface HouseBrowserRefused extends Error {
712
743
  export interface HouseCooperation {
713
744
  placed(): Promise<void> | void;
714
745
  }
715
- export type HouseChatWidth = 'full' | '3/4' | '1/2' | '1/3';
716
746
  export interface HouseChatOpened {
717
747
  readonly conversation: string | null;
718
748
  readonly agent: string | null;
@@ -720,8 +750,6 @@ export interface HouseChatOpened {
720
750
  export interface HouseChatOptions {
721
751
  readonly conversation?: string | null;
722
752
  readonly agent?: string | null;
723
- readonly showChats?: boolean;
724
- readonly width?: HouseChatWidth;
725
753
  readonly onOpen?: (opened: HouseChatOpened) => void;
726
754
  readonly onLink?: (href: string) => void;
727
755
  }
@@ -729,8 +757,27 @@ export interface HouseMountedChat {
729
757
  update(options: HouseChatOptions): void;
730
758
  unmount(): void;
731
759
  }
760
+ export interface HouseChatButtonOptions {
761
+ readonly onOpen?: (opened: HouseChatOpened) => void;
762
+ readonly onLink?: (href: string) => void;
763
+ }
764
+ export interface HouseChatButtonMount extends HouseChatButtonOptions {
765
+ readonly agent?: string | null;
766
+ }
767
+ export interface HouseChatTarget {
768
+ readonly conversation?: string | null;
769
+ readonly agent?: string | null;
770
+ readonly docked?: boolean;
771
+ }
772
+ export interface HouseChatButton {
773
+ open(target?: HouseChatTarget): void;
774
+ hide(): void;
775
+ update(options: HouseChatButtonOptions): void;
776
+ unmount(): void;
777
+ }
732
778
  export interface HouseChat {
733
779
  mount(element: object, options?: HouseChatOptions): Promise<HouseMountedChat>;
780
+ mountButton(options?: HouseChatButtonMount): Promise<HouseChatButton>;
734
781
  }
735
782
  export interface HouseBridge {
736
783
  readonly runtime: Promise<HouseRuntime>;
@@ -739,8 +786,9 @@ export interface HouseBridge {
739
786
  onAddress(listener: (address: string) => void): () => void;
740
787
  push(address: string): Promise<string>;
741
788
  replace(address: string): Promise<string>;
742
- ceremony(path: string): Promise<never>;
743
- install(): Promise<HouseInstallation>;
789
+ ceremony(path: string): Promise<HouseCeremonyEnded>;
790
+ onTitleBar(listener: (area: HouseBox | null) => void): () => void;
791
+ setTitleBar(row: HouseTitleRow | null): void;
744
792
  notifications(on?: boolean): Promise<HouseNotifications>;
745
793
  telegram(link?: true): Promise<HouseTelegram>;
746
794
  setTab(tab: HouseTab): void;
@@ -0,0 +1,84 @@
1
+ import { type ValueFacts } from './definition.js';
2
+ import { type Reading, type SectionSpan } from './markdown.js';
3
+ import type { Extent } from './types.js';
4
+ export declare const NAME_FIELD = "name";
5
+ export declare const DEEPEST_HEADING = 6;
6
+ export type Form = 'text' | 'number' | 'boolean' | 'reference' | 'group' | 'list' | 'json';
7
+ export type Placement = {
8
+ readonly key: string;
9
+ readonly as: 'name' | 'line' | 'heading';
10
+ readonly start: number;
11
+ readonly end: number;
12
+ readonly next: number;
13
+ };
14
+ export type ProseText = Extent & {
15
+ readonly text: string;
16
+ readonly markdown: boolean;
17
+ };
18
+ export type Destination = Extent & {
19
+ readonly bracketed: boolean;
20
+ };
21
+ export type Body = {
22
+ readonly values: Readonly<Record<string, unknown>>;
23
+ readonly ranges: Readonly<Record<string, Extent>>;
24
+ readonly prose: readonly ProseText[];
25
+ readonly links: Readonly<Record<string, Destination>>;
26
+ readonly labels: readonly LabelAt[];
27
+ readonly top: readonly Placement[];
28
+ readonly name: Placement | null;
29
+ readonly list: Extent | null;
30
+ readonly listAt: number;
31
+ readonly head: number;
32
+ readonly preamble: Extent;
33
+ readonly sections: readonly SectionSpan[];
34
+ readonly free: readonly Extent[];
35
+ readonly ending: Extent | null;
36
+ readonly anchor: number;
37
+ };
38
+ export type BodyRefusal = {
39
+ readonly rule: string;
40
+ readonly location: string;
41
+ readonly at: number;
42
+ };
43
+ export declare function formOf(facts: ValueFacts | undefined): Form;
44
+ export declare function labelOf(key: string, facts: ValueFacts | undefined): string;
45
+ export declare function unescaped(text: string): string;
46
+ export declare function longText(value: string): string;
47
+ export type LabelAt = Extent & {
48
+ readonly path: string;
49
+ readonly written: 'line' | 'heading' | 'cell';
50
+ };
51
+ export declare function readBody(content: string, bodyStart: number, reading: Reading, root: ValueFacts): {
52
+ readonly ok: true;
53
+ readonly body: Body;
54
+ } | {
55
+ readonly ok: false;
56
+ readonly refusal: BodyRefusal;
57
+ };
58
+ export type Naming = (reference: string) => string | undefined;
59
+ export type Written = {
60
+ readonly ending: string;
61
+ readonly nameOf: Naming | undefined;
62
+ };
63
+ export declare function lineFits(text: string): boolean;
64
+ export declare function lineOfValue(key: string, facts: ValueFacts | undefined, value: unknown, indent: string, written: Written, pointer: string): string | null;
65
+ export declare function regionOfValue(key: string, facts: ValueFacts | undefined, value: unknown, level: number, written: Written, pointer: string, heading?: string): string;
66
+ export declare function groupBody(facts: ValueFacts, value: Record<string, unknown>, level: number, written: Written, pointer: string, root: boolean): string;
67
+ export type Placed = {
68
+ readonly as: 'name';
69
+ readonly text: string;
70
+ } | {
71
+ readonly as: 'line';
72
+ readonly text: string;
73
+ } | {
74
+ readonly as: 'heading';
75
+ readonly text: string;
76
+ };
77
+ export declare function placedValue(key: string, root: ValueFacts, value: unknown, written: Written): Placed | {
78
+ readonly unwritable: string;
79
+ };
80
+ export declare function bodyOrder(root: ValueFacts): readonly string[];
81
+ export declare function writtenValue(value: unknown, facts: ValueFacts | undefined): unknown;
82
+ export declare function labelAt(root: ValueFacts, path: string): string | undefined;
83
+ export declare function labelsIn(facts: ValueFacts, path?: string, into?: Map<string, string>): Map<string, string>;
84
+ export declare function writtenLabel(label: string, written: LabelAt['written']): string;
@@ -0,0 +1,3 @@
1
+ import type { VerifiedModel } from './types.js';
2
+ export declare const HOUSE_MODEL: VerifiedModel;
3
+ export declare const HOUSE_ROOM_TYPES: VerifiedModel;
@@ -8,9 +8,13 @@ export type ValueFacts = {
8
8
  readonly crossRoom?: true;
9
9
  readonly prose: boolean;
10
10
  readonly conditional?: true;
11
+ readonly title?: string;
12
+ readonly markdown?: true;
13
+ readonly json?: true;
11
14
  readonly prefix?: readonly ValueFacts[];
12
15
  readonly items?: ValueFacts;
13
16
  readonly properties?: Readonly<Record<string, ValueFacts>>;
17
+ readonly required?: readonly string[];
14
18
  readonly patterns?: readonly PatternFacts[];
15
19
  readonly additional?: ValueFacts;
16
20
  };
@@ -18,14 +22,6 @@ export type PatternFacts = {
18
22
  readonly pattern: string;
19
23
  readonly facts: ValueFacts;
20
24
  };
21
- export type SectionSpec = {
22
- readonly kind: 'text';
23
- readonly required: boolean;
24
- } | {
25
- readonly kind: 'list';
26
- readonly required: boolean;
27
- readonly items: ValueFacts;
28
- };
29
25
  export type Shape = {
30
26
  readonly schema: Readonly<Record<string, unknown>>;
31
27
  readonly defs: Readonly<Record<string, unknown>>;
@@ -44,12 +40,12 @@ export type FieldRules = {
44
40
  export type Definition = {
45
41
  readonly name: string;
46
42
  readonly memberDocument: boolean;
47
- readonly frontmatter: ValueFacts;
43
+ readonly root: ValueFacts;
48
44
  readonly fields: Readonly<Record<string, ValueFacts>>;
49
- readonly sections: Readonly<Record<string, SectionSpec>>;
50
45
  readonly rules: Readonly<Record<string, FieldRules>>;
51
46
  readonly createRoles?: readonly string[];
52
47
  readonly deleteRoles?: readonly string[];
48
+ readonly indexed?: readonly string[];
53
49
  readonly shape: Shape;
54
50
  };
55
51
  export type Failure = {
@@ -64,6 +60,7 @@ export declare const JSON_TYPES: readonly JsonType[];
64
60
  export declare const BUILT_IN_TYPE = "any";
65
61
  export declare const ATTACHMENT = "attachment";
66
62
  export declare const OPENING: readonly string[];
63
+ export declare const UNIONS: readonly string[];
67
64
  export declare const ARRAY_INDEX: RegExp;
68
65
  export declare const JSON_POINTER: RegExp;
69
66
  export declare function refuse(rule: string, location: string): Failure;
@@ -81,6 +78,7 @@ export declare function conjoined(declared: readonly {
81
78
  readonly ancestry: ReadonlySet<unknown>;
82
79
  };
83
80
  export declare function variantsOf({ node, at }: Placed): Placed[];
81
+ export declare function admitted(nodes: readonly unknown[], defs: Readonly<Record<string, unknown>>, ancestry: ReadonlySet<unknown>): Set<string> | null;
84
82
  export declare function valueFacts(node: unknown, defs: Readonly<Record<string, unknown>>): ValueFacts;
85
83
  export declare function itemFacts(facts: ValueFacts, index: number): ValueFacts | undefined;
86
84
  export declare function memberFacts(facts: ValueFacts, key: string): ValueFacts | undefined;
@@ -1,11 +1,11 @@
1
+ import { type Body, type Naming } from './body.js';
1
2
  import { type Definition } from './definition.js';
2
3
  import { type HrefOccurrence, type Reading } from './markdown.js';
3
- import type { ApplyResult, BodyResult, FrontmatterResult, Change, DefinitionOf, Document, Link, ParseResult, Span, UnlinkedBody } from './types.js';
4
- import { type YamlMap } from './yaml.js';
4
+ import type { ApplyResult, BodyResult, Change, DefinitionOf, Document, Link, ParseResult, Refusal, Span, UnlinkedBody } from './types.js';
5
5
  export declare function readingOf(document: Document): Reading;
6
+ export declare function bodyOf(document: Document): Body | null;
6
7
  export declare function linkDestinations(document: Document): readonly HrefOccurrence[];
7
8
  export declare function textSpans(document: Document): readonly Span[];
8
- export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
9
9
  export declare function parse(content: string, file?: string, definition?: Definition | DefinitionOf): ParseResult;
10
10
  export declare function create(type: string | undefined, definition?: Definition): Document;
11
11
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
@@ -14,6 +14,8 @@ export declare function relinkBody(body: string, file: string, moves: ReadonlyMa
14
14
  export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): UnlinkedBody;
15
15
  export declare function links(document: Document, file: string): readonly Link[];
16
16
  export declare function bodyLinks(body: string, file: string): readonly Link[];
17
- export declare function apply(document: Document, changes: readonly Change[], definition?: Definition): ApplyResult;
17
+ export declare function bodyWith(document: Document, definition: Definition | undefined): Body | null | Refusal;
18
+ export declare function apply(document: Document, changes: readonly Change[], definition?: Definition, nameOf?: Naming): ApplyResult;
19
+ export declare function relabel(document: Document, before: Definition, after: Definition): string;
20
+ export declare function relabels(before: Definition, after: Definition): boolean;
18
21
  export declare function serialize(document: Document): string;
19
- export declare function frontmatter(document: Document): YamlMap | null;
@@ -25,7 +25,6 @@ export type DocumentFacts = {
25
25
  readonly path: string;
26
26
  readonly type: string | null;
27
27
  readonly fields: Readonly<Record<string, Fact>>;
28
- readonly sections: readonly string[];
29
28
  };
30
29
  export declare const TEXT_FIELD = "/text";
31
30
  export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client', 'function'];
@@ -63,7 +62,7 @@ export type Resolved = {
63
62
  readonly id: string;
64
63
  readonly member?: string;
65
64
  };
66
- export declare function facts(document: Pick<Document, 'type' | 'fields' | 'sections'>, at: {
65
+ export declare function facts(document: Pick<Document, 'type' | 'fields'>, at: {
67
66
  readonly id: string;
68
67
  readonly path: string;
69
68
  }, model: VerifiedModel, resolve: (target: string) => Resolved | undefined): DocumentFacts;
@@ -1,5 +1,5 @@
1
1
  export declare const TYPE_FIELD = "type";
2
2
  export declare const MEMBER_FIELD = "member";
3
3
  export declare const SITE_FIELD = "site";
4
- export declare const RECEIVED_FIELD = "received";
4
+ export declare const SUBMITTED_FIELD = "submitted";
5
5
  export declare const HOUSE_FIELDS: readonly string[];