@agentshouse/app-bridge 0.1.0-c3fd29abbefb2 → 0.1.0-c41117ab5c766

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 (71) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +32 -54
  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 +4 -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 +830 -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 +20 -9
  13. package/dist/mdmodel/markdown.d.ts +28 -4
  14. package/dist/mdmodel/media-type.d.ts +71 -0
  15. package/dist/mdmodel/not-ready.d.ts +1 -0
  16. package/dist/mdmodel/paths.d.ts +10 -1
  17. package/dist/mdmodel/query/match.d.ts +1 -1
  18. package/dist/mdmodel/query/rows.d.ts +1 -1
  19. package/dist/mdmodel/references.d.ts +2 -2
  20. package/dist/mdmodel/room-types.d.ts +6 -0
  21. package/dist/mdmodel/types.d.ts +4 -16
  22. package/dist/mdmodel/validate.d.ts +2 -1
  23. package/dist/mdmodel/yaml.d.ts +4 -4
  24. package/dist/mdruntime/actions.d.ts +8 -2
  25. package/dist/mdruntime/adapter.d.ts +21 -12
  26. package/dist/mdruntime/attached-model.d.ts +0 -1
  27. package/dist/mdruntime/client.d.ts +6 -9
  28. package/dist/mdruntime/collection.d.ts +4 -1
  29. package/dist/mdruntime/compile.d.ts +2 -0
  30. package/dist/mdruntime/conversation-live.d.ts +21 -7
  31. package/dist/mdruntime/conversation-row.d.ts +2 -0
  32. package/dist/mdruntime/conversation.d.ts +17 -9
  33. package/dist/mdruntime/durability.d.ts +4 -0
  34. package/dist/mdruntime/failure.d.ts +2 -0
  35. package/dist/mdruntime/install.d.ts +59 -0
  36. package/dist/mdruntime/listing.d.ts +7 -3
  37. package/dist/mdruntime/live.d.ts +5 -3
  38. package/dist/mdruntime/messages.d.ts +12 -3
  39. package/dist/mdruntime/observation.d.ts +27 -12
  40. package/dist/mdruntime/outcome.d.ts +7 -0
  41. package/dist/mdruntime/overlay.d.ts +3 -0
  42. package/dist/mdruntime/preparation.d.ts +27 -6
  43. package/dist/mdruntime/presence.d.ts +8 -2
  44. package/dist/mdruntime/reach.d.ts +2 -3
  45. package/dist/mdruntime/readiness.d.ts +9 -3
  46. package/dist/mdruntime/reads.d.ts +3 -1
  47. package/dist/mdruntime/recovery.d.ts +3 -1
  48. package/dist/mdruntime/retried.d.ts +29 -0
  49. package/dist/mdruntime/room-draft.d.ts +2 -2
  50. package/dist/mdruntime/runtime.d.ts +2 -2
  51. package/dist/mdruntime/save.d.ts +1 -0
  52. package/dist/mdruntime/socket/lanes.d.ts +12 -4
  53. package/dist/mdruntime/socket.d.ts +3 -3
  54. package/dist/mdruntime/source.d.ts +0 -7
  55. package/dist/mdruntime/store/installs.d.ts +2 -2
  56. package/dist/mdruntime/store/readiness.d.ts +5 -4
  57. package/dist/mdruntime/store/records.d.ts +10 -5
  58. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  59. package/dist/mdruntime/store.d.ts +9 -6
  60. package/dist/mdruntime/stored.d.ts +24 -13
  61. package/dist/mdruntime/surface.d.ts +4 -3
  62. package/dist/mdruntime/tables.d.ts +14 -7
  63. package/dist/mdruntime/wire.d.ts +11 -10
  64. package/dist/session-content/index.d.ts +1 -1
  65. package/dist/session-content/parts.d.ts +4 -3
  66. package/dist/session-content/turn.d.ts +3 -3
  67. package/dist/test-host.d.ts +8 -1
  68. package/dist/test-host.js +26 -0
  69. package/docs/families.md +21 -12
  70. package/package.json +2 -2
  71. package/dist/mdruntime/log.d.ts +0 -5
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, installation, 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;
@@ -363,19 +347,9 @@ export interface HouseMethods {
363
347
  readonly state: "settled";
364
348
  };
365
349
  readonly indexed_text: {
366
- readonly approximate_pages: null | string;
367
350
  readonly bytes: string;
368
351
  readonly gigabytes: string;
369
352
  };
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
353
  readonly room_ref: string;
380
354
  readonly total: {
381
355
  readonly bytes: string;
@@ -391,19 +365,9 @@ export interface HouseMethods {
391
365
  readonly state: "settled";
392
366
  };
393
367
  readonly indexed_text: {
394
- readonly approximate_pages: null | string;
395
368
  readonly bytes: string;
396
369
  readonly gigabytes: string;
397
370
  };
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
371
  readonly rooms?: readonly {
408
372
  readonly blob: {
409
373
  readonly bytes: string;
@@ -413,19 +377,9 @@ export interface HouseMethods {
413
377
  readonly state: "settled";
414
378
  };
415
379
  readonly indexed_text: {
416
- readonly approximate_pages: null | string;
417
380
  readonly bytes: string;
418
381
  readonly gigabytes: string;
419
382
  };
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
383
  readonly room_ref: string;
430
384
  readonly total: {
431
385
  readonly bytes: string;
@@ -462,6 +416,17 @@ export interface HouseMethods {
462
416
  readonly code: "cap_reached";
463
417
  readonly outcome: "refused";
464
418
  readonly position: number;
419
+ } | {
420
+ readonly code: "agent_function_request_not_started";
421
+ readonly final?: true;
422
+ readonly outcome: "failed";
423
+ readonly position: number;
424
+ } | {
425
+ readonly code: "agent_function_unreadable";
426
+ readonly document_path: string;
427
+ readonly final: true;
428
+ readonly outcome: "failed";
429
+ readonly position: number;
465
430
  } | {
466
431
  readonly code: "agent_unavailable";
467
432
  readonly outcome: "withdrawn";
@@ -489,6 +454,11 @@ export interface HouseMethods {
489
454
  readonly outcome: "failed";
490
455
  readonly position: number;
491
456
  readonly tries: number;
457
+ } | {
458
+ readonly code: "internal_error";
459
+ readonly final: true;
460
+ readonly outcome: "failed";
461
+ readonly position: number;
492
462
  } | {
493
463
  readonly code: "limit_reached";
494
464
  readonly limit: "reads";
@@ -522,10 +492,6 @@ export interface HouseMethods {
522
492
  readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
523
493
  readonly outcome: "refused";
524
494
  readonly position: number;
525
- } | {
526
- readonly code: "agent_function_request_not_started" | "internal_error";
527
- readonly outcome: "failed";
528
- readonly position: number;
529
495
  } | {
530
496
  readonly code: "agent_function_retired" | "environment_offline" | "no_recipient" | "not_found" | "target_agent_unavailable";
531
497
  readonly outcome: "no_target";
@@ -608,7 +574,7 @@ export interface HouseCredentialState {
608
574
  readonly state: Open<'none' | 'held' | 'rejected'>;
609
575
  readonly expiresAt: number | null;
610
576
  }
611
- export type HouseDatabaseFailure = 'unsupported' | 'damaged';
577
+ export type HouseDatabaseFailure = 'damaged';
612
578
  export type HouseAnalyticsChoice = 'accept' | 'decline';
613
579
  export interface HouseAnalytics {
614
580
  readonly measures: boolean;
@@ -712,7 +678,6 @@ export interface HouseBrowserRefused extends Error {
712
678
  export interface HouseCooperation {
713
679
  placed(): Promise<void> | void;
714
680
  }
715
- export type HouseChatWidth = 'full' | '3/4' | '1/2' | '1/3';
716
681
  export interface HouseChatOpened {
717
682
  readonly conversation: string | null;
718
683
  readonly agent: string | null;
@@ -720,8 +685,6 @@ export interface HouseChatOpened {
720
685
  export interface HouseChatOptions {
721
686
  readonly conversation?: string | null;
722
687
  readonly agent?: string | null;
723
- readonly showChats?: boolean;
724
- readonly width?: HouseChatWidth;
725
688
  readonly onOpen?: (opened: HouseChatOpened) => void;
726
689
  readonly onLink?: (href: string) => void;
727
690
  }
@@ -729,8 +692,23 @@ export interface HouseMountedChat {
729
692
  update(options: HouseChatOptions): void;
730
693
  unmount(): void;
731
694
  }
695
+ export interface HouseChatButtonOptions {
696
+ readonly onOpen?: (opened: HouseChatOpened) => void;
697
+ readonly onLink?: (href: string) => void;
698
+ }
699
+ export interface HouseChatTarget {
700
+ readonly conversation?: string | null;
701
+ readonly agent?: string | null;
702
+ }
703
+ export interface HouseChatButton {
704
+ open(target?: HouseChatTarget): void;
705
+ hide(): void;
706
+ update(options: HouseChatButtonOptions): void;
707
+ unmount(): void;
708
+ }
732
709
  export interface HouseChat {
733
710
  mount(element: object, options?: HouseChatOptions): Promise<HouseMountedChat>;
711
+ mountButton(options?: HouseChatButtonOptions): Promise<HouseChatButton>;
734
712
  }
735
713
  export interface HouseBridge {
736
714
  readonly runtime: Promise<HouseRuntime>;
@@ -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,6 +8,9 @@ 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>>;
@@ -18,14 +21,6 @@ export type PatternFacts = {
18
21
  readonly pattern: string;
19
22
  readonly facts: ValueFacts;
20
23
  };
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
24
  export type Shape = {
30
25
  readonly schema: Readonly<Record<string, unknown>>;
31
26
  readonly defs: Readonly<Record<string, unknown>>;
@@ -44,9 +39,8 @@ export type FieldRules = {
44
39
  export type Definition = {
45
40
  readonly name: string;
46
41
  readonly memberDocument: boolean;
47
- readonly frontmatter: ValueFacts;
42
+ readonly root: ValueFacts;
48
43
  readonly fields: Readonly<Record<string, ValueFacts>>;
49
- readonly sections: Readonly<Record<string, SectionSpec>>;
50
44
  readonly rules: Readonly<Record<string, FieldRules>>;
51
45
  readonly createRoles?: readonly string[];
52
46
  readonly deleteRoles?: readonly string[];
@@ -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[];