@agentshouse/app-bridge 0.1.0-c3ebb08f5de71 → 0.1.0-c3ee7fcd01608

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 +7 -7
  2. package/dist/index.d.ts +669 -26
  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 +24 -11
  6. package/dist/mdmodel/document.d.ts +15 -8
  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 +44 -15
  14. package/dist/mdmodel/indexed.d.ts +8 -0
  15. package/dist/mdmodel/kinds.d.ts +20 -0
  16. package/dist/mdmodel/markdown.d.ts +74 -0
  17. package/dist/mdmodel/media-type.d.ts +71 -0
  18. package/dist/mdmodel/moment.d.ts +6 -0
  19. package/dist/mdmodel/not-ready.d.ts +1 -0
  20. package/dist/mdmodel/paths.d.ts +15 -1
  21. package/dist/mdmodel/pattern.d.ts +9 -0
  22. package/dist/mdmodel/query/language.d.ts +254 -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 +42 -0
  26. package/dist/mdmodel/query/walk.d.ts +62 -0
  27. package/dist/mdmodel/references.d.ts +2 -2
  28. package/dist/mdmodel/reserved.d.ts +5 -0
  29. package/dist/mdmodel/room-types.d.ts +6 -0
  30. package/dist/mdmodel/types.d.ts +22 -17
  31. package/dist/mdmodel/validate.d.ts +12 -6
  32. package/dist/mdmodel/yaml.d.ts +4 -4
  33. package/dist/mdruntime/actions.d.ts +25 -0
  34. package/dist/mdruntime/adapter.d.ts +211 -112
  35. package/dist/mdruntime/attached-model.d.ts +6 -0
  36. package/dist/mdruntime/authored.d.ts +87 -0
  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 +2 -1
  40. package/dist/mdruntime/change-set.d.ts +4 -0
  41. package/dist/mdruntime/change.d.ts +5 -0
  42. package/dist/mdruntime/client.d.ts +39 -26
  43. package/dist/mdruntime/collection.d.ts +32 -7
  44. package/dist/mdruntime/compile.d.ts +8 -6
  45. package/dist/mdruntime/conversation-live.d.ts +151 -0
  46. package/dist/mdruntime/conversation-row.d.ts +39 -0
  47. package/dist/mdruntime/conversation.d.ts +72 -51
  48. package/dist/mdruntime/declaration.d.ts +9 -0
  49. package/dist/mdruntime/durability.d.ts +20 -1
  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/house-query.d.ts +14 -0
  54. package/dist/mdruntime/identity.d.ts +0 -1
  55. package/dist/mdruntime/install.d.ts +59 -0
  56. package/dist/mdruntime/listing.d.ts +59 -0
  57. package/dist/mdruntime/live.d.ts +24 -0
  58. package/dist/mdruntime/media.d.ts +24 -0
  59. package/dist/mdruntime/messages.d.ts +35 -5
  60. package/dist/mdruntime/modal.d.ts +1 -0
  61. package/dist/mdruntime/model.d.ts +12 -13
  62. package/dist/mdruntime/observation.d.ts +31 -13
  63. package/dist/mdruntime/opened.d.ts +1 -1
  64. package/dist/mdruntime/outcome.d.ts +30 -7
  65. package/dist/mdruntime/overlay.d.ts +7 -2
  66. package/dist/mdruntime/preparation.d.ts +45 -0
  67. package/dist/mdruntime/presence.d.ts +57 -0
  68. package/dist/mdruntime/query.d.ts +14 -210
  69. package/dist/mdruntime/reach.d.ts +26 -14
  70. package/dist/mdruntime/readiness.d.ts +23 -22
  71. package/dist/mdruntime/reads.d.ts +38 -0
  72. package/dist/mdruntime/recovery.d.ts +4 -0
  73. package/dist/mdruntime/refresh.d.ts +26 -0
  74. package/dist/mdruntime/replica.d.ts +13 -19
  75. package/dist/mdruntime/retried.d.ts +29 -0
  76. package/dist/mdruntime/room-draft.d.ts +51 -12
  77. package/dist/mdruntime/room-drafts.d.ts +23 -0
  78. package/dist/mdruntime/runtime.d.ts +34 -0
  79. package/dist/mdruntime/save.d.ts +42 -84
  80. package/dist/mdruntime/saves.d.ts +33 -0
  81. package/dist/mdruntime/search.d.ts +12 -63
  82. package/dist/mdruntime/seed.d.ts +11 -2
  83. package/dist/mdruntime/socket/admission.d.ts +6 -0
  84. package/dist/mdruntime/socket/answers.d.ts +5 -0
  85. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  86. package/dist/mdruntime/socket/session.d.ts +40 -0
  87. package/dist/mdruntime/socket.d.ts +67 -0
  88. package/dist/mdruntime/source.d.ts +58 -0
  89. package/dist/mdruntime/status.d.ts +4 -5
  90. package/dist/mdruntime/store/installs.d.ts +29 -0
  91. package/dist/mdruntime/store/readiness.d.ts +10 -0
  92. package/dist/mdruntime/store/records.d.ts +226 -0
  93. package/dist/mdruntime/store/room-held.d.ts +7 -0
  94. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  95. package/dist/mdruntime/store/space.d.ts +10 -0
  96. package/dist/mdruntime/store/watchers.d.ts +16 -0
  97. package/dist/mdruntime/store/writes.d.ts +23 -0
  98. package/dist/mdruntime/store.d.ts +114 -156
  99. package/dist/mdruntime/stored.d.ts +87 -58
  100. package/dist/mdruntime/surface.d.ts +93 -0
  101. package/dist/mdruntime/tables.d.ts +129 -107
  102. package/dist/mdruntime/tallies.d.ts +17 -0
  103. package/dist/mdruntime/transfer.d.ts +0 -5
  104. package/dist/mdruntime/wire.d.ts +88 -13
  105. package/dist/session-content/check.d.ts +17 -0
  106. package/dist/session-content/index.d.ts +6 -0
  107. package/dist/session-content/parts.d.ts +30 -0
  108. package/dist/session-content/state.d.ts +59 -0
  109. package/dist/session-content/turn.d.ts +137 -0
  110. package/dist/test-host.d.ts +8 -4
  111. package/dist/test-host.js +46 -29
  112. package/docs/families.md +108 -84
  113. package/package.json +2 -2
  114. package/dist/calls.d.ts +0 -1007
  115. package/dist/calls.js +0 -1
  116. package/dist/mdmodel/blocks.d.ts +0 -10
  117. package/dist/mdmodel/condition.d.ts +0 -160
  118. package/dist/mdmodel/links.d.ts +0 -28
  119. package/dist/mdmodel/profile.d.ts +0 -5
  120. package/dist/mdruntime/connection.d.ts +0 -151
  121. package/dist/mdruntime/file.d.ts +0 -11
  122. package/dist/mdruntime/fulltext.d.ts +0 -26
  123. package/dist/mdruntime/shared.d.ts +0 -15
@@ -0,0 +1,62 @@
1
+ import { type Definition } from '../definition.js';
2
+ import type { VerifiedModel } from '../types.js';
3
+ import { type Direction, type QueryPlan } from './language.js';
4
+ export type KeyBound = {
5
+ readonly key: Uint8Array;
6
+ readonly inclusive: boolean;
7
+ };
8
+ export type KeyRange = {
9
+ readonly lower: KeyBound;
10
+ readonly upper: KeyBound | null;
11
+ };
12
+ export type WalkRun = {
13
+ readonly by: 'key';
14
+ readonly key: Uint8Array;
15
+ readonly after: boolean;
16
+ } | {
17
+ readonly by: 'range';
18
+ readonly range: KeyRange;
19
+ };
20
+ export type PageOrder = {
21
+ readonly by: 'path';
22
+ readonly direction: Direction;
23
+ } | {
24
+ readonly by: 'field';
25
+ readonly field: string;
26
+ readonly direction: Direction;
27
+ readonly nulls: 'first' | 'last';
28
+ readonly lexical: boolean;
29
+ readonly after: {
30
+ readonly key: Uint8Array;
31
+ readonly tie: unknown;
32
+ } | null;
33
+ };
34
+ export type Walk = {
35
+ readonly by: 'path';
36
+ readonly direction: Direction;
37
+ } | {
38
+ readonly by: 'keys';
39
+ readonly field: string;
40
+ readonly direction: Direction;
41
+ readonly types: readonly {
42
+ readonly type: string;
43
+ readonly keys: readonly Uint8Array[];
44
+ }[];
45
+ } | {
46
+ readonly by: 'order';
47
+ readonly field: string;
48
+ readonly direction: Direction;
49
+ readonly types: readonly {
50
+ readonly type: string;
51
+ readonly runs: readonly WalkRun[];
52
+ }[];
53
+ };
54
+ export type Count = {
55
+ readonly walk: Walk;
56
+ readonly fields: readonly string[];
57
+ };
58
+ export declare function pageOrder(plan: QueryPlan): PageOrder;
59
+ export declare function walkOf(plan: QueryPlan, model: VerifiedModel): Walk;
60
+ export declare function countShape(plan: QueryPlan): boolean;
61
+ export declare function countOf(plan: QueryPlan, model: VerifiedModel, where: unknown): Count | null;
62
+ export declare function walkedValue(definition: Definition, field: string, value: unknown): unknown;
@@ -1,3 +1,3 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { Frontmatter, Reference } from './types.js';
3
- export declare function references(document: Pick<Frontmatter, 'fields'>, definition: Definition): readonly Reference[];
2
+ import type { Document, Reference } from './types.js';
3
+ export declare function references(document: Pick<Document, 'fields'>, definition: Definition): readonly Reference[];
@@ -0,0 +1,5 @@
1
+ export declare const ROOM_DESCRIPTION = "ROOM.md";
2
+ export declare const CAPTURE_HOME = "capture";
3
+ export declare const RESERVED_NAMES: readonly string[];
4
+ export declare function isReservedName(name: string): boolean;
5
+ export declare function isDocumentPath(path: string): boolean;
@@ -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;
@@ -12,9 +12,16 @@ export type ModelVerification = {
12
12
  readonly rule: string;
13
13
  readonly location?: string;
14
14
  };
15
+ export type TypedPath = {
16
+ readonly path: string;
17
+ readonly type: string;
18
+ readonly named: boolean;
19
+ readonly body: boolean;
20
+ };
15
21
  export type ValidationContext = {
16
22
  readonly binaryTargets: readonly string[];
17
23
  readonly anyRoom?: true;
24
+ readonly typedPaths?: readonly TypedPath[];
18
25
  };
19
26
  export type ProjectionContext = {
20
27
  readonly documentTargets: readonly string[];
@@ -30,19 +37,22 @@ export type Extent = {
30
37
  export type Span = Extent & {
31
38
  readonly text: string;
32
39
  };
33
- export type Frontmatter = {
40
+ export type Document = {
34
41
  readonly content: string;
35
42
  readonly type: string | undefined;
36
43
  readonly fields: Readonly<Record<string, unknown>>;
37
- };
38
- export type Document = Frontmatter & {
39
44
  readonly preamble: string;
40
45
  readonly sections: Readonly<Record<string, string>>;
46
+ readonly text: string;
47
+ readonly ranges: Readonly<Record<string, Extent>>;
48
+ readonly listEnd: number;
41
49
  };
50
+ export type DefinitionOf = (type: string | undefined) => Definition | undefined;
42
51
  export type Refusal = {
43
52
  readonly file: string;
44
53
  readonly rule: string;
45
54
  readonly location?: string;
55
+ readonly line?: number;
46
56
  readonly referrers?: readonly string[];
47
57
  };
48
58
  export type Reached = {
@@ -80,13 +90,6 @@ export type Division = {
80
90
  readonly ok: false;
81
91
  readonly refusal: Refusal;
82
92
  };
83
- export type FrontmatterResult = {
84
- readonly ok: true;
85
- readonly frontmatter: Frontmatter;
86
- } | {
87
- readonly ok: false;
88
- readonly refusal: Refusal;
89
- };
90
93
  export type ParseResult = {
91
94
  readonly ok: true;
92
95
  readonly document: Document;
@@ -116,12 +119,6 @@ export type RoomReference = {
116
119
  readonly value: string;
117
120
  readonly to: readonly string[];
118
121
  readonly crossRoom?: true;
119
- } | {
120
- readonly kind: 'item';
121
- readonly section: string;
122
- readonly href: string;
123
- readonly to: readonly string[];
124
- readonly crossRoom?: true;
125
122
  });
126
123
  export type Change = {
127
124
  readonly kind: 'field';
@@ -132,11 +129,15 @@ export type Change = {
132
129
  readonly kind: 'section';
133
130
  readonly name: string;
134
131
  readonly value: string;
135
- readonly prior: string;
132
+ readonly prior: string | undefined;
136
133
  } | {
137
134
  readonly kind: 'preamble';
138
135
  readonly value: string;
139
136
  readonly prior: string;
137
+ } | {
138
+ readonly kind: 'text';
139
+ readonly value: string;
140
+ readonly prior: string;
140
141
  } | {
141
142
  readonly kind: 'link';
142
143
  readonly href: string;
@@ -165,3 +166,7 @@ export type BodyResult = {
165
166
  readonly outcome: 'refuse';
166
167
  readonly refusal: Refusal;
167
168
  };
169
+ export type UnlinkedBody = {
170
+ readonly body: string;
171
+ readonly links: ReadonlyMap<string, string>;
172
+ };
@@ -1,14 +1,19 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, 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
6
  export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
5
- export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
6
- export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
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;
7
10
  export declare function bodyRoomLinks(body: string): RoomReference[];
8
- export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
11
+ export declare function bodyKeyedLinks(body: string): KeyedLink[];
12
+ export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
9
13
  type Placed = {
10
14
  readonly reference: Reached;
11
15
  readonly location: string;
16
+ readonly line?: number;
12
17
  };
13
18
  export type Assessment = {
14
19
  readonly file: string;
@@ -18,9 +23,9 @@ export type Assessment = {
18
23
  readonly structured: Validation | null;
19
24
  readonly fields: readonly Placed[];
20
25
  readonly linked: boolean;
21
- readonly sections: readonly Placed[];
22
26
  };
23
- export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): Assessment;
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;
24
29
  export type Verdicts = {
25
30
  add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
26
31
  verdict(): Validation;
@@ -28,4 +33,5 @@ export type Verdicts = {
28
33
  export declare function verdicts(): Verdicts;
29
34
  export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
30
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;
31
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;