@agentshouse/app-bridge 0.1.0-cd2f88c8097d7 → 0.1.0-cd44fa24fb809

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 (123) hide show
  1. package/README.md +11 -11
  2. package/dist/index.d.ts +626 -21
  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 +22 -11
  6. package/dist/mdmodel/document.d.ts +15 -9
  7. package/dist/mdmodel/event.d.ts +76 -0
  8. package/dist/mdmodel/facts.d.ts +14 -0
  9. package/dist/mdmodel/fields.d.ts +1 -1
  10. package/dist/mdmodel/house-model.d.ts +869 -0
  11. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  12. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  13. package/dist/mdmodel/index.d.ts +41 -14
  14. package/dist/mdmodel/kinds.d.ts +17 -0
  15. package/dist/mdmodel/markdown.d.ts +74 -0
  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 +24 -2
  20. package/dist/mdmodel/pattern.d.ts +9 -0
  21. package/dist/mdmodel/project.d.ts +1 -0
  22. package/dist/mdmodel/query/language.d.ts +253 -0
  23. package/dist/mdmodel/query/match.d.ts +13 -0
  24. package/dist/mdmodel/query/rows.d.ts +31 -0
  25. package/dist/mdmodel/query/sql.d.ts +38 -0
  26. package/dist/mdmodel/references.d.ts +2 -2
  27. package/dist/mdmodel/reserved.d.ts +5 -0
  28. package/dist/mdmodel/room-types.d.ts +6 -0
  29. package/dist/mdmodel/types.d.ts +44 -15
  30. package/dist/mdmodel/validate.d.ts +34 -4
  31. package/dist/mdmodel/yaml.d.ts +4 -4
  32. package/dist/mdruntime/actions.d.ts +25 -0
  33. package/dist/mdruntime/adapter.d.ts +216 -123
  34. package/dist/mdruntime/attached-model.d.ts +6 -0
  35. package/dist/mdruntime/authored.d.ts +87 -0
  36. package/dist/mdruntime/binary.d.ts +0 -5
  37. package/dist/mdruntime/bootstrap.d.ts +43 -0
  38. package/dist/mdruntime/cell.d.ts +5 -0
  39. package/dist/mdruntime/chain.d.ts +11 -0
  40. package/dist/mdruntime/change-set.d.ts +13 -16
  41. package/dist/mdruntime/change.d.ts +36 -1
  42. package/dist/mdruntime/client.d.ts +41 -25
  43. package/dist/mdruntime/collection.d.ts +32 -21
  44. package/dist/mdruntime/compile.d.ts +17 -0
  45. package/dist/mdruntime/conversation-live.d.ts +149 -0
  46. package/dist/mdruntime/conversation-row.d.ts +39 -0
  47. package/dist/mdruntime/conversation.d.ts +84 -50
  48. package/dist/mdruntime/declaration.d.ts +9 -0
  49. package/dist/mdruntime/durability.d.ts +21 -4
  50. package/dist/mdruntime/failure.d.ts +3 -0
  51. package/dist/mdruntime/figures.d.ts +48 -0
  52. package/dist/mdruntime/holdings.d.ts +28 -0
  53. package/dist/mdruntime/identity.d.ts +5 -0
  54. package/dist/mdruntime/install.d.ts +59 -0
  55. package/dist/mdruntime/listing.d.ts +51 -0
  56. package/dist/mdruntime/live.d.ts +24 -0
  57. package/dist/mdruntime/media.d.ts +24 -0
  58. package/dist/mdruntime/messages.d.ts +57 -0
  59. package/dist/mdruntime/model.d.ts +8 -11
  60. package/dist/mdruntime/observation.d.ts +40 -10
  61. package/dist/mdruntime/opened.d.ts +21 -0
  62. package/dist/mdruntime/outcome.d.ts +57 -10
  63. package/dist/mdruntime/overlay.d.ts +8 -6
  64. package/dist/mdruntime/preparation.d.ts +40 -0
  65. package/dist/mdruntime/presence.d.ts +57 -0
  66. package/dist/mdruntime/query.d.ts +25 -191
  67. package/dist/mdruntime/reach.d.ts +21 -11
  68. package/dist/mdruntime/readiness.d.ts +22 -20
  69. package/dist/mdruntime/reads.d.ts +38 -0
  70. package/dist/mdruntime/recovery.d.ts +5 -2
  71. package/dist/mdruntime/refresh.d.ts +26 -0
  72. package/dist/mdruntime/replica.d.ts +50 -33
  73. package/dist/mdruntime/retried.d.ts +29 -0
  74. package/dist/mdruntime/room-draft.d.ts +55 -13
  75. package/dist/mdruntime/room-drafts.d.ts +23 -0
  76. package/dist/mdruntime/runtime.d.ts +33 -0
  77. package/dist/mdruntime/save.d.ts +43 -48
  78. package/dist/mdruntime/saves.d.ts +33 -0
  79. package/dist/mdruntime/search.d.ts +12 -82
  80. package/dist/mdruntime/seed.d.ts +11 -2
  81. package/dist/mdruntime/socket/admission.d.ts +6 -0
  82. package/dist/mdruntime/socket/answers.d.ts +5 -0
  83. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  84. package/dist/mdruntime/socket/session.d.ts +37 -0
  85. package/dist/mdruntime/socket.d.ts +66 -0
  86. package/dist/mdruntime/source.d.ts +58 -0
  87. package/dist/mdruntime/status.d.ts +4 -5
  88. package/dist/mdruntime/store/installs.d.ts +29 -0
  89. package/dist/mdruntime/store/readiness.d.ts +10 -0
  90. package/dist/mdruntime/store/records.d.ts +223 -0
  91. package/dist/mdruntime/store/room-held.d.ts +7 -0
  92. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  93. package/dist/mdruntime/store/space.d.ts +10 -0
  94. package/dist/mdruntime/store/watchers.d.ts +16 -0
  95. package/dist/mdruntime/store/writes.d.ts +23 -0
  96. package/dist/mdruntime/store.d.ts +114 -157
  97. package/dist/mdruntime/stored.d.ts +166 -0
  98. package/dist/mdruntime/surface.d.ts +91 -0
  99. package/dist/mdruntime/tables.d.ts +375 -0
  100. package/dist/mdruntime/tallies.d.ts +17 -0
  101. package/dist/mdruntime/transfer.d.ts +0 -5
  102. package/dist/mdruntime/wire.d.ts +96 -9
  103. package/dist/session-content/bounds.d.ts +7 -0
  104. package/dist/session-content/check.d.ts +18 -0
  105. package/dist/session-content/index.d.ts +7 -0
  106. package/dist/session-content/parts.d.ts +103 -0
  107. package/dist/session-content/state.d.ts +61 -0
  108. package/dist/session-content/turn.d.ts +328 -0
  109. package/dist/test-host.d.ts +14 -4
  110. package/dist/test-host.js +45 -29
  111. package/docs/families.md +90 -59
  112. package/package.json +8 -3
  113. package/dist/calls.d.ts +0 -118
  114. package/dist/calls.js +0 -1
  115. package/dist/mdmodel/blocks.d.ts +0 -10
  116. package/dist/mdmodel/condition.d.ts +0 -149
  117. package/dist/mdmodel/profile.d.ts +0 -5
  118. package/dist/mdruntime/acquisition.d.ts +0 -13
  119. package/dist/mdruntime/connection.d.ts +0 -143
  120. package/dist/mdruntime/file.d.ts +0 -19
  121. package/dist/mdruntime/rows.d.ts +0 -37
  122. package/dist/mdruntime/shared.d.ts +0 -10
  123. package/dist/mdruntime/turn.d.ts +0 -6
@@ -0,0 +1,6 @@
1
+ export declare const CHAT_TYPE = "chat";
2
+ export declare const CHAT_MESSAGE_TYPE = "chat-message";
3
+ export declare const INBOX_TYPES: readonly string[];
4
+ export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot', 'telegram-business', 'whatsapp', 'messenger', 'instagram', 'tiktok'];
5
+ export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
6
+ export declare const ROOM_TYPES_TEXT: string;
@@ -2,6 +2,7 @@ import type { Definition } from './definition.js';
2
2
  export type Library = Readonly<Record<string, string>>;
3
3
  export type VerifiedModel = {
4
4
  readonly types: Readonly<Record<string, Definition>>;
5
+ readonly nameable?: readonly string[];
5
6
  };
6
7
  export type ModelVerification = {
7
8
  readonly verdict: 'accept';
@@ -11,15 +12,23 @@ export type ModelVerification = {
11
12
  readonly rule: string;
12
13
  readonly location?: string;
13
14
  };
15
+ export type TypedPath = {
16
+ readonly path: string;
17
+ readonly type: string;
18
+ readonly named: boolean;
19
+ readonly body: boolean;
20
+ };
14
21
  export type ValidationContext = {
15
22
  readonly binaryTargets: readonly string[];
23
+ readonly anyRoom?: true;
24
+ readonly typedPaths?: readonly TypedPath[];
16
25
  };
17
26
  export type ProjectionContext = {
18
27
  readonly documentTargets: readonly string[];
19
28
  readonly definition?: Definition;
20
29
  };
21
30
  export type DivisionContext = ProjectionContext & {
22
- readonly budget: number;
31
+ readonly bound: number;
23
32
  };
24
33
  export type Extent = {
25
34
  readonly start: number;
@@ -28,19 +37,22 @@ export type Extent = {
28
37
  export type Span = Extent & {
29
38
  readonly text: string;
30
39
  };
31
- export type Frontmatter = {
40
+ export type Document = {
32
41
  readonly content: string;
33
42
  readonly type: string | undefined;
34
43
  readonly fields: Readonly<Record<string, unknown>>;
35
- };
36
- export type Document = Frontmatter & {
37
44
  readonly preamble: string;
38
45
  readonly sections: Readonly<Record<string, string>>;
46
+ readonly text: string;
47
+ readonly ranges: Readonly<Record<string, Extent>>;
48
+ readonly listEnd: number;
39
49
  };
50
+ export type DefinitionOf = (type: string | undefined) => Definition | undefined;
40
51
  export type Refusal = {
41
52
  readonly file: string;
42
53
  readonly rule: string;
43
54
  readonly location?: string;
55
+ readonly line?: number;
44
56
  readonly referrers?: readonly string[];
45
57
  };
46
58
  export type Reached = {
@@ -60,6 +72,10 @@ export type Validation = {
60
72
  } | ({
61
73
  readonly verdict: 'refuse';
62
74
  } & Refusal);
75
+ export type ValidationStep = {
76
+ readonly path: string;
77
+ readonly resolved: number;
78
+ };
63
79
  export type Projection = {
64
80
  readonly ok: true;
65
81
  readonly text: string;
@@ -74,13 +90,6 @@ export type Division = {
74
90
  readonly ok: false;
75
91
  readonly refusal: Refusal;
76
92
  };
77
- export type FrontmatterResult = {
78
- readonly ok: true;
79
- readonly frontmatter: Frontmatter;
80
- } | {
81
- readonly ok: false;
82
- readonly refusal: Refusal;
83
- };
84
93
  export type ParseResult = {
85
94
  readonly ok: true;
86
95
  readonly document: Document;
@@ -92,14 +101,25 @@ export type Link = {
92
101
  readonly href: string;
93
102
  readonly target: string;
94
103
  };
95
- export type LinkOccurrence = Link & {
96
- readonly start: number;
97
- };
98
104
  export type Reference = {
99
105
  readonly pointer: string;
100
106
  readonly value: string;
101
107
  readonly to: readonly string[];
108
+ readonly crossRoom?: true;
102
109
  };
110
+ export type RoomReference = {
111
+ readonly handle: string;
112
+ readonly path: string;
113
+ } & ({
114
+ readonly kind: 'link';
115
+ readonly href: string;
116
+ } | {
117
+ readonly kind: 'field';
118
+ readonly pointer: string;
119
+ readonly value: string;
120
+ readonly to: readonly string[];
121
+ readonly crossRoom?: true;
122
+ });
103
123
  export type Change = {
104
124
  readonly kind: 'field';
105
125
  readonly name: string;
@@ -109,11 +129,15 @@ export type Change = {
109
129
  readonly kind: 'section';
110
130
  readonly name: string;
111
131
  readonly value: string;
112
- readonly prior: string;
132
+ readonly prior: string | undefined;
113
133
  } | {
114
134
  readonly kind: 'preamble';
115
135
  readonly value: string;
116
136
  readonly prior: string;
137
+ } | {
138
+ readonly kind: 'text';
139
+ readonly value: string;
140
+ readonly prior: string;
117
141
  } | {
118
142
  readonly kind: 'link';
119
143
  readonly href: string;
@@ -130,6 +154,7 @@ export type ApplyResult = {
130
154
  } | {
131
155
  readonly outcome: 'stale';
132
156
  readonly document: Document;
157
+ readonly stale: readonly number[];
133
158
  } | {
134
159
  readonly outcome: 'refuse';
135
160
  readonly refusal: Refusal;
@@ -141,3 +166,7 @@ export type BodyResult = {
141
166
  readonly outcome: 'refuse';
142
167
  readonly refusal: Refusal;
143
168
  };
169
+ export type UnlinkedBody = {
170
+ readonly body: string;
171
+ readonly links: ReadonlyMap<string, string>;
172
+ };
@@ -1,7 +1,37 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { DocumentCheck, Library, ModelVerification, Reached, Validation, ValidationContext, VerifiedModel } from './types.js';
2
+ import { type KeyedLink } from './paths.js';
3
+ import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
4
+ export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
3
5
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
4
- export declare function verify(schema: string): ModelVerification;
5
- export declare function checkDocument(file: string, content: string, model: VerifiedModel): DocumentCheck;
6
- export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
6
+ export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
7
+ export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
8
+ type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
9
+ export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
10
+ export declare function bodyRoomLinks(body: string): RoomReference[];
11
+ export declare function bodyKeyedLinks(body: string): KeyedLink[];
12
+ export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
13
+ type Placed = {
14
+ readonly reference: Reached;
15
+ readonly location: string;
16
+ readonly line?: number;
17
+ };
18
+ export type Assessment = {
19
+ readonly file: string;
20
+ readonly type: string | undefined;
21
+ readonly targets: readonly string[];
22
+ readonly read: Validation | null;
23
+ readonly structured: Validation | null;
24
+ readonly fields: readonly Placed[];
25
+ readonly linked: boolean;
26
+ };
27
+ export declare function assess(file: string, parsed: ParseResult, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
28
+ export declare function assessReferences(file: string, parsed: ParseResult, changed: ReadonlySet<string>, model?: VerifiedModel, context?: Placing): Assessment;
29
+ export type Verdicts = {
30
+ add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
31
+ verdict(): Validation;
32
+ };
33
+ export declare function verdicts(): Verdicts;
34
+ export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
7
35
  export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
36
+ export declare function validateParsed(library: ReadonlyMap<string, ParseResult>, context?: ValidationContext, model?: VerifiedModel): Validation;
37
+ export {};
@@ -31,12 +31,12 @@ export declare function parseYamlMapping(text: string, start: number, end: numbe
31
31
  export declare function jsValue(node: YamlNode): unknown;
32
32
  export declare function mapEntry(map: YamlMap, key: string): YamlEntry | undefined;
33
33
  export declare function isPlainSafe(text: string): boolean;
34
- export type FrontmatterValue = string | number | boolean | null | readonly FrontmatterValue[] | {
35
- readonly [name: string]: FrontmatterValue;
34
+ export type DocumentValue = string | number | boolean | null | readonly DocumentValue[] | {
35
+ readonly [name: string]: DocumentValue;
36
36
  };
37
37
  export declare function plain(value: unknown): value is Record<string, unknown>;
38
- export declare function frontmatterValue(value: unknown): value is FrontmatterValue;
39
- export declare function serializeJs(value: FrontmatterValue): string;
38
+ export declare function documentValue(value: unknown): value is DocumentValue;
39
+ export declare function serializeJs(value: DocumentValue): string;
40
40
  export declare function isRecord(value: unknown): value is Record<string, unknown>;
41
41
  export declare function serializeKey(name: string): string;
42
42
  export declare function bodyStartAfterYaml(content: string, yamlEnd: number): number;
@@ -0,0 +1,25 @@
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 { Attempt } from './retried.js';
5
+ import type { Runtime } from './runtime.js';
6
+ export type HistoryQuery = {
7
+ revision?: string;
8
+ pageToken?: string;
9
+ };
10
+ export declare function readHistory(runtime: Runtime, locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
11
+ export declare function located(runtime: Runtime, room: string, path: string, destination: string): Promise<{
12
+ room: string;
13
+ path: string;
14
+ } | null>;
15
+ export declare function resolveReference(runtime: Runtime, room: string, path: string, destination: string): Promise<Resolution>;
16
+ export type Invoked = {
17
+ readonly dispatching?: () => Promise<void>;
18
+ readonly attempt?: Attempt;
19
+ };
20
+ export declare function invokeAction(runtime: Runtime, name: string, input: unknown, { dispatching, attempt }?: Invoked): Promise<CallResult>;
21
+ export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): Promise<CallResult>;
22
+ export declare function called(runtime: Runtime, name: string, input: unknown, attempt?: Attempt): Promise<CallResult>;
23
+ export declare function answeredCall(runtime: Runtime, operation: string): Promise<boolean>;
24
+ export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
25
+ export declare function resendLater(runtime: Runtime): void;