@agentshouse/app-bridge 0.1.0-cfb240c3fb89d → 0.1.0-cfbb2e428ff88

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 (63) hide show
  1. package/README.md +11 -11
  2. package/dist/index.d.ts +865 -8
  3. package/dist/mdmodel/definition.d.ts +17 -1
  4. package/dist/mdmodel/document.d.ts +5 -5
  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 +23 -9
  8. package/dist/mdmodel/kinds.d.ts +18 -0
  9. package/dist/mdmodel/links.d.ts +28 -0
  10. package/dist/mdmodel/paths.d.ts +9 -1
  11. package/dist/mdmodel/project.d.ts +1 -0
  12. package/dist/mdmodel/query/language.d.ts +222 -0
  13. package/dist/mdmodel/query/match.d.ts +13 -0
  14. package/dist/mdmodel/query/rows.d.ts +31 -0
  15. package/dist/mdmodel/query/sql.d.ts +38 -0
  16. package/dist/mdmodel/reserved.d.ts +4 -0
  17. package/dist/mdmodel/types.d.ts +35 -4
  18. package/dist/mdmodel/validate.d.ts +29 -4
  19. package/dist/mdruntime/adapter.d.ts +147 -74
  20. package/dist/mdruntime/binary.d.ts +0 -5
  21. package/dist/mdruntime/chain.d.ts +11 -0
  22. package/dist/mdruntime/change-set.d.ts +9 -16
  23. package/dist/mdruntime/change.d.ts +31 -1
  24. package/dist/mdruntime/client.d.ts +27 -11
  25. package/dist/mdruntime/collection.d.ts +11 -21
  26. package/dist/mdruntime/compile.d.ts +10 -0
  27. package/dist/mdruntime/connection.d.ts +41 -14
  28. package/dist/mdruntime/conversation.d.ts +32 -15
  29. package/dist/mdruntime/durability.d.ts +10 -1
  30. package/dist/mdruntime/identity.d.ts +5 -0
  31. package/dist/mdruntime/media.d.ts +7 -0
  32. package/dist/mdruntime/messages.d.ts +27 -0
  33. package/dist/mdruntime/model.d.ts +11 -10
  34. package/dist/mdruntime/observation.d.ts +17 -2
  35. package/dist/mdruntime/opened.d.ts +21 -0
  36. package/dist/mdruntime/outcome.d.ts +45 -7
  37. package/dist/mdruntime/overlay.d.ts +3 -5
  38. package/dist/mdruntime/query.d.ts +17 -185
  39. package/dist/mdruntime/reach.d.ts +18 -6
  40. package/dist/mdruntime/readiness.d.ts +49 -0
  41. package/dist/mdruntime/recovery.d.ts +3 -2
  42. package/dist/mdruntime/replica.d.ts +58 -33
  43. package/dist/mdruntime/room-draft.d.ts +37 -6
  44. package/dist/mdruntime/save.d.ts +53 -14
  45. package/dist/mdruntime/search.d.ts +15 -77
  46. package/dist/mdruntime/seed.d.ts +15 -0
  47. package/dist/mdruntime/status.d.ts +5 -0
  48. package/dist/mdruntime/store.d.ts +93 -94
  49. package/dist/mdruntime/stored.d.ts +128 -0
  50. package/dist/mdruntime/tables.d.ts +326 -0
  51. package/dist/mdruntime/wire.d.ts +173 -32
  52. package/dist/test-host.d.ts +7 -1
  53. package/dist/test-host.js +19 -1
  54. package/docs/families.md +66 -12
  55. package/package.json +8 -3
  56. package/dist/calls.d.ts +0 -117
  57. package/dist/calls.js +0 -1
  58. package/dist/mdmodel/condition.d.ts +0 -149
  59. package/dist/mdruntime/file.d.ts +0 -19
  60. package/dist/mdruntime/rows.d.ts +0 -36
  61. package/dist/mdruntime/shared.d.ts +0 -10
  62. package/dist/mdruntime/transfer.d.ts +0 -9
  63. package/dist/mdruntime/turn.d.ts +0 -6
@@ -0,0 +1,326 @@
1
+ import { type QueryAnswer, type QueryRoom } from './compile.js';
2
+ import type { Composed } from './collection.js';
3
+ import type { UnsentWork } from './durability.js';
4
+ import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
5
+ import type { Plan } from './query.js';
6
+ import { type Committed, type CountedRoom, type HeldEntry, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
7
+ export type { Committed, CountedRoom, HeldEntry, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
8
+ export type { QueryAnswer, QueryRoom } from './compile.js';
9
+ export type { ConversationWrite, HeldConversation, MessageWindow } from './messages.js';
10
+ export type Value = string | number | bigint | Uint8Array | null;
11
+ export type Row = Readonly<Record<string, Value>>;
12
+ export interface Connection {
13
+ run(sql: string, bind?: readonly Value[]): void;
14
+ rows(sql: string, bind?: readonly Value[]): readonly Row[];
15
+ collate(name: string, compare: (left: string, right: string) => number): void;
16
+ }
17
+ export interface SqliteEngine {
18
+ readonly capi: {
19
+ readonly SQLITE_UTF8: number;
20
+ sqlite3_create_collation_v2(database: number, name: string, encoding: number, argument: number, compare: (argument: number, leftLength: number, left: number, rightLength: number, right: number) => number, destroy: number): number;
21
+ };
22
+ readonly wasm: {
23
+ heap8u(): Uint8Array;
24
+ };
25
+ }
26
+ export interface SqliteStatement {
27
+ readonly parameterCount: number;
28
+ bind(values: readonly Value[]): unknown;
29
+ step(): boolean;
30
+ get(values: Value[]): Value[];
31
+ getColumnNames(names: string[]): string[];
32
+ resetNoThrow(clearBindings: boolean): number;
33
+ finalize(): unknown;
34
+ }
35
+ export interface SqliteDatabase {
36
+ readonly pointer: number;
37
+ createFunction(name: string, run: (context: number, ...values: Value[]) => Value, options: {
38
+ readonly arity: number;
39
+ readonly deterministic: true;
40
+ }): unknown;
41
+ exec(options: {
42
+ readonly sql: string;
43
+ readonly bind: readonly Value[];
44
+ readonly rowMode?: 'object';
45
+ readonly returnValue?: 'resultRows';
46
+ }): Row[];
47
+ prepare(sql: string): SqliteStatement;
48
+ }
49
+ export declare function sqliteConnection(engine: SqliteEngine, database: SqliteDatabase): Connection;
50
+ export declare const FILE_PART_BYTES = 1048576;
51
+ export declare const RUNTIME_TABLES: readonly string[];
52
+ export type AuthoredFact = 'holder' | 'binding' | 'generation';
53
+ export type StoredFile = {
54
+ readonly key: string;
55
+ readonly blob: Blob;
56
+ };
57
+ export interface FileSpool {
58
+ held(): Iterable<string>;
59
+ spool(key: string, type: string, parts: Iterable<Uint8Array>): Promise<Blob>;
60
+ drop(key: string): Promise<void>;
61
+ probe(bytes: number): Promise<void>;
62
+ }
63
+ export type KeptPending = {
64
+ readonly id: string;
65
+ readonly batch: string;
66
+ readonly state: string;
67
+ readonly files: readonly string[];
68
+ };
69
+ export type KeptRecord = {
70
+ readonly record: string;
71
+ readonly files: readonly string[];
72
+ };
73
+ export type AuthoredRows = {
74
+ readonly locator: string;
75
+ readonly order?: readonly string[];
76
+ readonly added?: readonly KeptPending[];
77
+ readonly founded?: readonly Omit<KeptPending, 'state'>[];
78
+ readonly roomDrafts?: readonly (KeptRecord & {
79
+ readonly path: string;
80
+ })[];
81
+ readonly consumedRoomDrafts?: readonly string[];
82
+ };
83
+ export type HeldQueues = {
84
+ readonly queues: readonly {
85
+ readonly locator: string;
86
+ readonly ids: readonly string[];
87
+ }[];
88
+ readonly pending: readonly {
89
+ readonly locator: string;
90
+ readonly id: string;
91
+ readonly batch: string;
92
+ readonly state: string;
93
+ }[];
94
+ };
95
+ export type OpenedFile = {
96
+ readonly key: string;
97
+ readonly byteLength: number;
98
+ readonly mediaType: string;
99
+ };
100
+ type Asked<A, R> = {
101
+ readonly asked: A;
102
+ readonly answer: R;
103
+ };
104
+ type Nothing = Readonly<Record<never, never>>;
105
+ export type CommittedWrite = Committed & {
106
+ readonly fenced: string | null;
107
+ };
108
+ export type AuthoredWrite = {
109
+ readonly writes: readonly AuthoredRows[];
110
+ readonly files: readonly StoredFile[];
111
+ readonly whole: boolean;
112
+ };
113
+ export interface RuntimeRequests {
114
+ readonly 'authored.queues': Asked<Nothing, HeldQueues>;
115
+ readonly 'authored.roomDrafts': Asked<Nothing, readonly string[]>;
116
+ readonly 'authored.chatDrafts': Asked<Nothing, readonly string[]>;
117
+ readonly 'authored.calls': Asked<Nothing, readonly string[]>;
118
+ readonly 'authored.fences': Asked<Nothing, readonly string[]>;
119
+ readonly 'authored.unsent': Asked<Nothing, readonly UnsentWork[]>;
120
+ readonly 'authored.fact': Asked<{
121
+ readonly name: AuthoredFact;
122
+ }, string | null>;
123
+ readonly 'authored.file': Asked<{
124
+ readonly key: string;
125
+ readonly type: string;
126
+ }, Blob>;
127
+ readonly 'authored.amend': Asked<{
128
+ readonly locator: string;
129
+ readonly id: string;
130
+ readonly amendment: string;
131
+ }, null>;
132
+ readonly 'authored.roomDraft': Asked<{
133
+ readonly locator: string;
134
+ readonly path: string;
135
+ readonly kept: KeptRecord | null;
136
+ readonly files: readonly StoredFile[];
137
+ }, string | null>;
138
+ readonly 'authored.chatDraft': Asked<{
139
+ readonly kept: readonly {
140
+ readonly conversation: string;
141
+ readonly record: string;
142
+ }[];
143
+ readonly dropped: readonly string[];
144
+ }, null>;
145
+ readonly 'authored.call': Asked<{
146
+ readonly operation: string;
147
+ readonly kept: KeptRecord | null;
148
+ readonly files: readonly StoredFile[];
149
+ }, null>;
150
+ readonly 'authored.remember': Asked<{
151
+ readonly name: AuthoredFact;
152
+ readonly value: string;
153
+ }, null>;
154
+ readonly 'authored.claim': Asked<{
155
+ readonly holder: string;
156
+ }, boolean>;
157
+ readonly 'authored.end': Asked<{
158
+ readonly holder: string | null;
159
+ }, boolean>;
160
+ readonly 'replica.open': Asked<Nothing, ReplicaOpened>;
161
+ readonly 'replica.query': Asked<{
162
+ readonly plan: Plan;
163
+ readonly rooms: readonly QueryRoom[];
164
+ readonly budget: number | null;
165
+ }, QueryAnswer>;
166
+ readonly 'replica.entries': Asked<{
167
+ readonly key: number;
168
+ readonly view: View;
169
+ readonly paths: readonly string[];
170
+ }, readonly HeldEntry[]>;
171
+ readonly 'replica.typed': Asked<{
172
+ readonly key: number;
173
+ readonly view: View;
174
+ readonly paths: readonly string[];
175
+ }, readonly TypedEntry[]>;
176
+ readonly 'replica.referrers': Asked<{
177
+ readonly key: number;
178
+ readonly view: View;
179
+ readonly targets: readonly string[];
180
+ }, readonly Referrer[]>;
181
+ readonly 'replica.files': Asked<{
182
+ readonly key: number;
183
+ readonly view: View;
184
+ readonly after: string | null;
185
+ readonly limit: number;
186
+ }, readonly {
187
+ readonly path: string;
188
+ readonly revision: string;
189
+ }[]>;
190
+ readonly 'replica.folders': Asked<{
191
+ readonly key: number;
192
+ readonly view: View;
193
+ readonly paths: readonly string[];
194
+ }, readonly string[]>;
195
+ readonly 'replica.typedWithin': Asked<{
196
+ readonly key: number;
197
+ readonly view: View;
198
+ readonly roots: readonly string[];
199
+ readonly within: boolean;
200
+ }, boolean>;
201
+ readonly 'replica.counts': Asked<{
202
+ readonly rooms: readonly CountedRoom[];
203
+ }, readonly number[]>;
204
+ readonly 'replica.stage': Asked<{
205
+ readonly locator: string;
206
+ readonly transfer: string;
207
+ readonly key: number | null;
208
+ readonly fingerprint: string;
209
+ readonly entries: readonly StoredEntry[];
210
+ readonly folders: readonly string[];
211
+ }, number | null>;
212
+ readonly 'replica.refresh': Asked<{
213
+ readonly key: number;
214
+ readonly composed: Composed;
215
+ readonly entries: readonly StoredEntry[];
216
+ readonly removals: readonly string[];
217
+ readonly folders: readonly string[];
218
+ readonly folderRemovals: readonly string[];
219
+ }, null>;
220
+ readonly 'replica.unrefresh': Asked<{
221
+ readonly key: number;
222
+ }, null>;
223
+ readonly 'replica.commit': Asked<{
224
+ readonly authored?: AuthoredWrite;
225
+ readonly rooms: readonly RoomCommit[];
226
+ }, CommittedWrite>;
227
+ readonly 'replica.fence': Asked<{
228
+ readonly locators: readonly string[];
229
+ }, null>;
230
+ readonly 'replica.erase': Asked<{
231
+ readonly locator: string | null;
232
+ readonly limit: number;
233
+ }, {
234
+ readonly remaining: boolean;
235
+ }>;
236
+ readonly 'replica.abandon': Asked<{
237
+ readonly locator: string;
238
+ }, null>;
239
+ readonly 'replica.release': Asked<{
240
+ readonly key: number;
241
+ }, null>;
242
+ readonly 'replica.rederive': Asked<{
243
+ readonly key: number;
244
+ readonly composed: Composed;
245
+ readonly bytes: number;
246
+ readonly ms: number;
247
+ readonly floor: number;
248
+ }, {
249
+ readonly done: boolean;
250
+ readonly text: number;
251
+ }>;
252
+ readonly 'replica.fact': Asked<{
253
+ readonly name: string;
254
+ readonly value: string;
255
+ }, null>;
256
+ readonly 'replica.present': Asked<{
257
+ readonly app: string;
258
+ readonly value: string;
259
+ }, null>;
260
+ readonly 'opened.find': Asked<{
261
+ readonly locator: string;
262
+ readonly path: string;
263
+ readonly revision: string;
264
+ }, OpenedFile | null>;
265
+ readonly 'opened.begin': Asked<{
266
+ readonly key: string;
267
+ readonly locator: string;
268
+ readonly path: string;
269
+ readonly revision: string;
270
+ readonly mediaType: string;
271
+ }, boolean>;
272
+ readonly 'opened.part': Asked<{
273
+ readonly key: string;
274
+ readonly part: number;
275
+ readonly bytes: Uint8Array;
276
+ }, boolean>;
277
+ readonly 'opened.keep': Asked<{
278
+ readonly key: string;
279
+ readonly sha256: string;
280
+ readonly byteLength: number;
281
+ readonly parts: number;
282
+ }, boolean>;
283
+ readonly 'opened.drop': Asked<{
284
+ readonly key: string;
285
+ }, null>;
286
+ readonly 'opened.clean': Asked<Nothing, number>;
287
+ readonly 'file.part': Asked<{
288
+ readonly key: string;
289
+ readonly part: number;
290
+ }, Uint8Array | null>;
291
+ readonly 'conversation.held': Asked<Nothing, readonly HeldConversation[]>;
292
+ readonly 'conversation.keep': Asked<ConversationWrite, null>;
293
+ readonly 'conversation.window': Asked<{
294
+ readonly conversation: string;
295
+ readonly limit: number;
296
+ readonly before: readonly [string, string] | null;
297
+ readonly phrase: string | null;
298
+ }, MessageWindow>;
299
+ readonly 'conversation.count': Asked<{
300
+ readonly conversation: string;
301
+ readonly phrase: string | null;
302
+ }, number>;
303
+ readonly 'conversation.turn': Asked<{
304
+ readonly conversation: string;
305
+ readonly turn: string;
306
+ }, boolean>;
307
+ readonly 'conversation.drop': Asked<{
308
+ readonly conversations: readonly string[];
309
+ }, null>;
310
+ readonly 'space.probe': Asked<Nothing, null>;
311
+ }
312
+ export type RuntimeKind = keyof RuntimeRequests;
313
+ export type RuntimeRequest<K extends RuntimeKind = RuntimeKind> = {
314
+ readonly [Kind in K]: {
315
+ readonly kind: Kind;
316
+ } & RuntimeRequests[Kind]['asked'];
317
+ }[K];
318
+ export type RuntimeAnswer<K extends RuntimeKind> = RuntimeRequests[K]['answer'];
319
+ export interface RuntimeDatabase {
320
+ ask<K extends RuntimeKind>(request: RuntimeRequest<K>): Promise<RuntimeAnswer<K>>;
321
+ }
322
+ export declare function isRuntime(request: {
323
+ readonly kind: string;
324
+ }): request is RuntimeRequest;
325
+ export declare function readsRuntime(request: RuntimeRequest): boolean;
326
+ export declare function answerRuntime(connection: Connection, request: RuntimeRequest, spool: FileSpool): unknown;
@@ -8,46 +8,183 @@ export type RuntimePort = {
8
8
  start(): void;
9
9
  };
10
10
  export type WireReach = 'within' | 'app' | 'runtime' | 'actions' | 'whole';
11
+ export type WireEffect = 'read' | 'write' | 'action';
12
+ export type WireCall = {
13
+ readonly reach: WireReach;
14
+ readonly effect: WireEffect;
15
+ };
11
16
  declare const MEMBERS: {
12
- readonly rooms: 'within';
13
- readonly query: 'within';
14
- readonly search: 'within';
15
- readonly types: 'within';
16
- readonly save: 'within';
17
- readonly history: 'within';
18
- readonly 'binaryFile.read': 'within';
19
- readonly 'binaryFile.readReference': 'within';
20
- readonly call: 'actions';
21
- readonly reached: 'within';
22
- readonly log: 'whole';
23
- readonly persistence: 'runtime';
24
- readonly reauthorize: 'runtime';
25
- readonly 'roomDraft.list': 'within';
26
- readonly 'roomDraft.read': 'within';
27
- readonly 'roomDraft.write': 'within';
28
- readonly 'roomDraft.discard': 'within';
29
- readonly 'presentation.read': 'app';
30
- readonly 'presentation.write': 'app';
31
- readonly 'conversation.list': 'within';
32
- readonly 'conversation.read': 'within';
33
- readonly 'conversation.create': 'within';
34
- readonly 'conversation.send': 'within';
35
- readonly 'conversation.answer': 'within';
36
- readonly 'conversation.interrupt': 'within';
37
- readonly 'conversation.kill': 'within';
38
- readonly 'conversation.cancel': 'within';
39
- readonly 'conversation.delete': 'within';
40
- readonly 'chatDraft.write': 'within';
41
- readonly 'chatDraft.discard': 'within';
17
+ readonly rooms: {
18
+ readonly reach: 'within';
19
+ readonly effect: 'read';
20
+ };
21
+ readonly query: {
22
+ readonly reach: 'within';
23
+ readonly effect: 'read';
24
+ };
25
+ readonly search: {
26
+ readonly reach: 'within';
27
+ readonly effect: 'read';
28
+ };
29
+ readonly types: {
30
+ readonly reach: 'within';
31
+ readonly effect: 'read';
32
+ };
33
+ readonly save: {
34
+ readonly reach: 'within';
35
+ readonly effect: 'write';
36
+ };
37
+ readonly saveParts: {
38
+ readonly reach: 'within';
39
+ readonly effect: 'write';
40
+ };
41
+ readonly history: {
42
+ readonly reach: 'within';
43
+ readonly effect: 'read';
44
+ };
45
+ readonly resolve: {
46
+ readonly reach: 'within';
47
+ readonly effect: 'read';
48
+ };
49
+ readonly 'binaryFile.read': {
50
+ readonly reach: 'within';
51
+ readonly effect: 'read';
52
+ };
53
+ readonly 'binaryFile.link': {
54
+ readonly reach: 'within';
55
+ readonly effect: 'read';
56
+ };
57
+ readonly 'binaryFile.show': {
58
+ readonly reach: 'within';
59
+ readonly effect: 'read';
60
+ };
61
+ readonly 'binaryFile.attach': {
62
+ readonly reach: 'within';
63
+ readonly effect: 'action';
64
+ };
65
+ readonly 'binaryFile.part': {
66
+ readonly reach: 'within';
67
+ readonly effect: 'read';
68
+ };
69
+ readonly call: {
70
+ readonly reach: 'actions';
71
+ readonly effect: 'action';
72
+ };
73
+ readonly reached: {
74
+ readonly reach: 'within';
75
+ readonly effect: 'read';
76
+ };
77
+ readonly log: {
78
+ readonly reach: 'whole';
79
+ readonly effect: 'read';
80
+ };
81
+ readonly cleanUp: {
82
+ readonly reach: 'whole';
83
+ readonly effect: 'write';
84
+ };
85
+ readonly unsent: {
86
+ readonly reach: 'whole';
87
+ readonly effect: 'read';
88
+ };
89
+ readonly reset: {
90
+ readonly reach: 'whole';
91
+ readonly effect: 'write';
92
+ };
93
+ readonly persistence: {
94
+ readonly reach: 'runtime';
95
+ readonly effect: 'read';
96
+ };
97
+ readonly retry: {
98
+ readonly reach: 'runtime';
99
+ readonly effect: 'write';
100
+ };
101
+ readonly reauthorize: {
102
+ readonly reach: 'runtime';
103
+ readonly effect: 'write';
104
+ };
105
+ readonly 'roomDraft.list': {
106
+ readonly reach: 'within';
107
+ readonly effect: 'read';
108
+ };
109
+ readonly 'roomDraft.read': {
110
+ readonly reach: 'within';
111
+ readonly effect: 'read';
112
+ };
113
+ readonly 'roomDraft.write': {
114
+ readonly reach: 'within';
115
+ readonly effect: 'write';
116
+ };
117
+ readonly 'roomDraft.discard': {
118
+ readonly reach: 'within';
119
+ readonly effect: 'write';
120
+ };
121
+ readonly 'presentation.read': {
122
+ readonly reach: 'app';
123
+ readonly effect: 'read';
124
+ };
125
+ readonly 'presentation.write': {
126
+ readonly reach: 'app';
127
+ readonly effect: 'write';
128
+ };
129
+ readonly 'presentation.edit': {
130
+ readonly reach: 'app';
131
+ readonly effect: 'write';
132
+ };
133
+ readonly 'conversation.list': {
134
+ readonly reach: 'within';
135
+ readonly effect: 'read';
136
+ };
137
+ readonly 'conversation.read': {
138
+ readonly reach: 'within';
139
+ readonly effect: 'read';
140
+ };
141
+ readonly 'conversation.create': {
142
+ readonly reach: 'within';
143
+ readonly effect: 'action';
144
+ };
145
+ readonly 'conversation.send': {
146
+ readonly reach: 'within';
147
+ readonly effect: 'action';
148
+ };
149
+ readonly 'conversation.answer': {
150
+ readonly reach: 'within';
151
+ readonly effect: 'action';
152
+ };
153
+ readonly 'conversation.interrupt': {
154
+ readonly reach: 'within';
155
+ readonly effect: 'action';
156
+ };
157
+ readonly 'conversation.kill': {
158
+ readonly reach: 'within';
159
+ readonly effect: 'action';
160
+ };
161
+ readonly 'conversation.delete': {
162
+ readonly reach: 'within';
163
+ readonly effect: 'action';
164
+ };
165
+ readonly 'chatDraft.write': {
166
+ readonly reach: 'within';
167
+ readonly effect: 'write';
168
+ };
169
+ readonly 'chatDraft.prepend': {
170
+ readonly reach: 'within';
171
+ readonly effect: 'write';
172
+ };
173
+ readonly 'chatDraft.discard': {
174
+ readonly reach: 'within';
175
+ readonly effect: 'write';
176
+ };
42
177
  };
43
178
  declare const TOPICS: {
44
179
  readonly rooms: 'within';
180
+ readonly readiness: 'within';
45
181
  readonly 'connection-refusal': 'runtime';
46
182
  readonly 'storage-loss': 'runtime';
47
183
  readonly 'deployment-facts': 'runtime';
48
184
  readonly 'sync-status': 'within';
49
185
  readonly 'service-mode': 'runtime';
50
186
  readonly member: 'runtime';
187
+ readonly 'authority-changes': 'runtime';
51
188
  readonly query: 'within';
52
189
  readonly queue: 'within';
53
190
  readonly 'room-drafts': 'within';
@@ -56,8 +193,8 @@ declare const TOPICS: {
56
193
  readonly conversations: 'within';
57
194
  readonly agents: 'within';
58
195
  };
59
- export declare const WIRE_REACH: {
60
- readonly members: Readonly<Record<string, WireReach>>;
196
+ export declare const WIRE: {
197
+ readonly members: Readonly<Record<string, WireCall>>;
61
198
  readonly topics: Readonly<Record<string, WireReach>>;
62
199
  };
63
200
  export type WireMember = keyof typeof MEMBERS;
@@ -95,6 +232,10 @@ export type WireAnswer = {
95
232
  } | {
96
233
  kind: 'ended';
97
234
  };
235
+ export declare function unanswered(call: {
236
+ readonly id: number;
237
+ readonly member: WireMember;
238
+ }): WireAnswer | null;
98
239
  export declare const AUTHORIZATION_ENDED = "the host authorization ended";
99
240
  export declare const PORT_CLOSED = "the port closed";
100
241
  export declare function request(message: unknown): WireRequest | null;
@@ -1,11 +1,17 @@
1
1
  import type { MdRuntimeClient } from './mdruntime/client.js';
2
- import type { HouseAnalyticsChoice, HouseAppMessage, HouseExternalAnswer, HouseExternalRequest, HouseNavigationMode, HouseRefusal, HouseSourceDownload, HouseSourceTop, HouseStatus, HouseTab } from './index.js';
2
+ import type { HouseAnalyticsChoice, HouseAppMessage, HouseChatOptions, HouseExternalAnswer, HouseExternalRequest, HouseNavigationMode, HouseRefusal, HouseSourceDownload, HouseSourceTop, HouseStatus, HouseTab } from './index.js';
3
3
  export interface HouseBridgeNavigation {
4
4
  readonly mode: HouseNavigationMode;
5
5
  readonly address: string;
6
6
  }
7
+ export interface HouseBridgeChat {
8
+ readonly element: object;
9
+ readonly options: HouseChatOptions;
10
+ readonly mounted: boolean;
11
+ }
7
12
  export interface HouseBridgeTestHost {
8
13
  readonly navigations: readonly HouseBridgeNavigation[];
14
+ readonly chats: readonly HouseBridgeChat[];
9
15
  readonly ceremonies: readonly string[];
10
16
  readonly consents: readonly HouseAnalyticsChoice[];
11
17
  readonly tabs: readonly HouseTab[];
package/dist/test-host.js CHANGED
@@ -50,6 +50,7 @@ export function createHouseBridgeTestHost(options = {}) {
50
50
  const consents = [];
51
51
  const tabs = [];
52
52
  const externalCalls = [];
53
+ const chats = [];
53
54
  const addressListeners = new Set();
54
55
  const statusListeners = new Set();
55
56
  const messageListeners = new Set();
@@ -98,7 +99,21 @@ export function createHouseBridgeTestHost(options = {}) {
98
99
  });
99
100
  }
100
101
  const bridge = {
101
- runtime,
102
+ runtime: runtime,
103
+ chat: {
104
+ mount(element, options = {}) {
105
+ const chat = { element, options, mounted: true };
106
+ chats.push(chat);
107
+ return Promise.resolve({
108
+ update(next) {
109
+ chat.options = next;
110
+ },
111
+ unmount() {
112
+ chat.mounted = false;
113
+ },
114
+ });
115
+ },
116
+ },
102
117
  address: () => shown,
103
118
  onAddress(listener) {
104
119
  return followHeld(addressListeners, listener, () => shown);
@@ -114,6 +129,7 @@ export function createHouseBridgeTestHost(options = {}) {
114
129
  },
115
130
  install: () => Promise.resolve('manual'),
116
131
  notifications: () => Promise.resolve('unavailable'),
132
+ telegram: () => Promise.resolve({ state: 'unavailable', name: null, username: null }),
117
133
  setBadge: () => Promise.resolve(),
118
134
  setTab(tab) {
119
135
  tabs.push(tab);
@@ -144,6 +160,7 @@ export function createHouseBridgeTestHost(options = {}) {
144
160
  consents.push(choice);
145
161
  publish({ ...published, analytics: { measures: true, choice } });
146
162
  },
163
+ cooperate: () => () => { },
147
164
  };
148
165
  Object.defineProperty(globalThis, 'houseBridge', { value: bridge, configurable: true });
149
166
  if (published !== null)
@@ -151,6 +168,7 @@ export function createHouseBridgeTestHost(options = {}) {
151
168
  arrive(current);
152
169
  return {
153
170
  navigations,
171
+ chats,
154
172
  ceremonies,
155
173
  consents,
156
174
  tabs,