@agentshouse/app-bridge 0.1.0-ca559eade7c19 → 0.1.0-ca6bf24eae119

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 (55) hide show
  1. package/README.md +9 -9
  2. package/dist/calls.d.ts +676 -69
  3. package/dist/index.d.ts +36 -18
  4. package/dist/mdmodel/condition.d.ts +23 -10
  5. package/dist/mdmodel/definition.d.ts +3 -1
  6. package/dist/mdmodel/document.d.ts +5 -5
  7. package/dist/mdmodel/index.d.ts +9 -7
  8. package/dist/mdmodel/links.d.ts +28 -0
  9. package/dist/mdmodel/paths.d.ts +9 -1
  10. package/dist/mdmodel/project.d.ts +1 -0
  11. package/dist/mdmodel/types.d.ts +28 -4
  12. package/dist/mdmodel/validate.d.ts +27 -3
  13. package/dist/mdruntime/adapter.d.ts +83 -48
  14. package/dist/mdruntime/binary.d.ts +0 -5
  15. package/dist/mdruntime/chain.d.ts +10 -0
  16. package/dist/mdruntime/change-set.d.ts +9 -16
  17. package/dist/mdruntime/change.d.ts +31 -1
  18. package/dist/mdruntime/client.d.ts +13 -5
  19. package/dist/mdruntime/collection.d.ts +10 -21
  20. package/dist/mdruntime/compile.d.ts +15 -0
  21. package/dist/mdruntime/connection.d.ts +25 -13
  22. package/dist/mdruntime/conversation.d.ts +19 -6
  23. package/dist/mdruntime/durability.d.ts +2 -5
  24. package/dist/mdruntime/fulltext.d.ts +26 -0
  25. package/dist/mdruntime/identity.d.ts +6 -0
  26. package/dist/mdruntime/media.d.ts +7 -0
  27. package/dist/mdruntime/messages.d.ts +27 -0
  28. package/dist/mdruntime/model.d.ts +6 -1
  29. package/dist/mdruntime/observation.d.ts +15 -0
  30. package/dist/mdruntime/opened.d.ts +21 -0
  31. package/dist/mdruntime/outcome.d.ts +45 -7
  32. package/dist/mdruntime/overlay.d.ts +2 -5
  33. package/dist/mdruntime/query.d.ts +32 -2
  34. package/dist/mdruntime/reach.d.ts +13 -4
  35. package/dist/mdruntime/readiness.d.ts +14 -15
  36. package/dist/mdruntime/recovery.d.ts +3 -2
  37. package/dist/mdruntime/replica.d.ts +55 -33
  38. package/dist/mdruntime/room-draft.d.ts +21 -3
  39. package/dist/mdruntime/save.d.ts +53 -14
  40. package/dist/mdruntime/search.d.ts +23 -42
  41. package/dist/mdruntime/status.d.ts +4 -3
  42. package/dist/mdruntime/store.d.ts +90 -97
  43. package/dist/mdruntime/stored.d.ts +129 -0
  44. package/dist/mdruntime/tables.d.ts +324 -0
  45. package/dist/mdruntime/wire.d.ts +33 -1
  46. package/dist/test-host.d.ts +7 -4
  47. package/dist/test-host.js +18 -28
  48. package/docs/families.md +50 -49
  49. package/package.json +8 -3
  50. package/dist/mdruntime/acquisition.d.ts +0 -13
  51. package/dist/mdruntime/file.d.ts +0 -19
  52. package/dist/mdruntime/rows.d.ts +0 -37
  53. package/dist/mdruntime/shared.d.ts +0 -10
  54. package/dist/mdruntime/transfer.d.ts +0 -9
  55. package/dist/mdruntime/turn.d.ts +0 -6
@@ -0,0 +1,129 @@
1
+ import type { HeadChange } from './adapter.js';
2
+ import { type Composed, type Composition } from './collection.js';
3
+ import type { HeldBinary } from './overlay.js';
4
+ import type { Connection } from './tables.js';
5
+ export declare const REPLICA_TABLES: readonly string[];
6
+ export type View = 'confirmed' | 'visible' | 'refreshed';
7
+ export type StoredEntry = {
8
+ readonly path: string;
9
+ readonly content: string | null;
10
+ readonly binary: HeldBinary | null;
11
+ readonly revision: string | null;
12
+ readonly fileId: string | null;
13
+ readonly change: HeadChange | null;
14
+ readonly written: string | null;
15
+ };
16
+ export type OverlayEntry = StoredEntry & {
17
+ readonly present: boolean;
18
+ };
19
+ export type HeldEntry = StoredEntry & {
20
+ readonly type: string | null;
21
+ };
22
+ export type TypedEntry = {
23
+ readonly path: string;
24
+ readonly type: string | null;
25
+ readonly binary: boolean;
26
+ };
27
+ export type Referrer = {
28
+ readonly path: string;
29
+ readonly target: string;
30
+ readonly kind: string;
31
+ };
32
+ export type HeldKey = {
33
+ readonly key: number;
34
+ readonly locator: string;
35
+ readonly transfer: string;
36
+ readonly rederiving: number | null;
37
+ readonly searching: number | null;
38
+ };
39
+ export type ReplicaOpened = {
40
+ readonly rooms: readonly {
41
+ readonly locator: string;
42
+ readonly key: number;
43
+ readonly record: string;
44
+ }[];
45
+ readonly keys: readonly HeldKey[];
46
+ readonly facts: Readonly<Record<string, string>>;
47
+ readonly presentation: readonly {
48
+ readonly app: string;
49
+ readonly value: string;
50
+ }[];
51
+ readonly overlaid: readonly {
52
+ readonly key: number;
53
+ readonly path: string;
54
+ }[];
55
+ readonly erasing: readonly {
56
+ readonly key: number;
57
+ readonly locator: string;
58
+ }[];
59
+ readonly orphans: readonly number[];
60
+ };
61
+ export type RoomCommit = {
62
+ readonly locator: string;
63
+ readonly key: number;
64
+ readonly record?: string;
65
+ readonly roots?: readonly string[];
66
+ readonly published?: {
67
+ readonly from: number | null;
68
+ };
69
+ readonly refreshed?: true;
70
+ readonly composed: Composed;
71
+ readonly confirmed?: {
72
+ readonly set: readonly StoredEntry[];
73
+ readonly removed: readonly string[];
74
+ };
75
+ readonly overlay?: {
76
+ readonly set: readonly OverlayEntry[];
77
+ readonly cleared: readonly string[];
78
+ };
79
+ };
80
+ export type Committed = {
81
+ readonly counts: Readonly<Record<string, number>>;
82
+ readonly changed: Readonly<Record<string, readonly string[] | null>>;
83
+ readonly indexed: Readonly<Record<string, boolean>>;
84
+ };
85
+ export type CountedRoom = {
86
+ readonly key: number;
87
+ readonly roots: readonly string[];
88
+ };
89
+ export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
90
+ export declare function stage(connection: Connection, request: {
91
+ readonly locator: string;
92
+ readonly transfer: string;
93
+ readonly key: number | null;
94
+ readonly fingerprint: string;
95
+ readonly entries: readonly StoredEntry[];
96
+ readonly folders: readonly string[];
97
+ }): number;
98
+ export declare function refreshing(connection: Connection, request: {
99
+ readonly key: number;
100
+ readonly composed: Composed;
101
+ readonly entries: readonly StoredEntry[];
102
+ readonly removals: readonly string[];
103
+ readonly folders: readonly string[];
104
+ readonly folderRemovals: readonly string[];
105
+ }): null;
106
+ export declare function unrefresh(connection: Connection, key: number): null;
107
+ export declare function counts(connection: Connection, rooms: readonly CountedRoom[]): number[];
108
+ export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
109
+ export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
110
+ export declare function abandon(connection: Connection, locator: string): null;
111
+ export declare function release(connection: Connection, key: number): null;
112
+ export declare function erase(connection: Connection, locator: string | null, limit: number): {
113
+ readonly remaining: boolean;
114
+ };
115
+ export declare function rederive(connection: Connection, key: number, composed: Composed, bytes: number, ms: number, floor: number): {
116
+ readonly done: boolean;
117
+ readonly text: number;
118
+ };
119
+ export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
120
+ export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
121
+ export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[], kinds: readonly string[]): Referrer[];
122
+ export declare function files(connection: Connection, key: number, view: View, after: string | null, limit: number): {
123
+ readonly path: string;
124
+ readonly revision: string;
125
+ }[];
126
+ export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
127
+ export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
128
+ export declare function opened(connection: Connection): ReplicaOpened;
129
+ export declare function ended(connection: Connection): void;
@@ -0,0 +1,324 @@
1
+ import { type QueryAnswer, type QueryRoom } from './compile.js';
2
+ import type { Composed } from './collection.js';
3
+ import { type SearchAsk } from './fulltext.js';
4
+ import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
5
+ import type { Plan } from './query.js';
6
+ import type { SearchWindow } from './search.js';
7
+ import { type Committed, type CountedRoom, type HeldEntry, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
8
+ export type { Committed, CountedRoom, HeldEntry, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
9
+ export type { QueryAnswer, QueryRoom } from './compile.js';
10
+ export type { SearchAsk } from './fulltext.js';
11
+ export type { ConversationWrite, HeldConversation, MessageWindow } from './messages.js';
12
+ export type Value = string | number | bigint | Uint8Array | null;
13
+ export type Row = Readonly<Record<string, Value>>;
14
+ export interface Connection {
15
+ run(sql: string, bind?: readonly Value[]): void;
16
+ rows(sql: string, bind?: readonly Value[]): readonly Row[];
17
+ collate(name: string, compare: (left: string, right: string) => number): void;
18
+ }
19
+ export interface SqliteEngine {
20
+ readonly capi: {
21
+ readonly SQLITE_UTF8: number;
22
+ 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;
23
+ };
24
+ readonly wasm: {
25
+ heap8u(): Uint8Array;
26
+ };
27
+ }
28
+ export interface SqliteStatement {
29
+ readonly parameterCount: number;
30
+ bind(values: readonly Value[]): unknown;
31
+ step(): boolean;
32
+ get(values: Value[]): Value[];
33
+ getColumnNames(names: string[]): string[];
34
+ resetNoThrow(clearBindings: boolean): number;
35
+ finalize(): unknown;
36
+ }
37
+ export interface SqliteDatabase {
38
+ readonly pointer: number;
39
+ exec(options: {
40
+ readonly sql: string;
41
+ readonly bind: readonly Value[];
42
+ readonly rowMode?: 'object';
43
+ readonly returnValue?: 'resultRows';
44
+ }): Row[];
45
+ prepare(sql: string): SqliteStatement;
46
+ }
47
+ export declare function sqliteConnection(engine: SqliteEngine, database: SqliteDatabase): Connection;
48
+ export declare const FILE_PART_BYTES = 1048576;
49
+ export declare const RUNTIME_TABLES: readonly string[];
50
+ export type AuthoredFact = 'holder' | 'binding' | 'generation';
51
+ export type StoredFile = {
52
+ readonly key: string;
53
+ readonly blob: Blob;
54
+ };
55
+ export interface FileSpool {
56
+ held(): Iterable<string>;
57
+ spool(key: string, type: string, parts: Iterable<Uint8Array>): Promise<Blob>;
58
+ drop(key: string): Promise<void>;
59
+ probe(bytes: number): Promise<void>;
60
+ }
61
+ export type KeptPending = {
62
+ readonly id: string;
63
+ readonly batch: string;
64
+ readonly state: string;
65
+ readonly files: readonly string[];
66
+ };
67
+ export type KeptRecord = {
68
+ readonly record: string;
69
+ readonly files: readonly string[];
70
+ };
71
+ export type AuthoredRows = {
72
+ readonly locator: string;
73
+ readonly order?: readonly string[];
74
+ readonly added?: readonly KeptPending[];
75
+ readonly founded?: readonly Omit<KeptPending, 'state'>[];
76
+ readonly roomDrafts?: readonly (KeptRecord & {
77
+ readonly path: string;
78
+ })[];
79
+ readonly consumedRoomDrafts?: readonly string[];
80
+ };
81
+ export type HeldQueues = {
82
+ readonly queues: readonly {
83
+ readonly locator: string;
84
+ readonly ids: readonly string[];
85
+ }[];
86
+ readonly pending: readonly {
87
+ readonly locator: string;
88
+ readonly id: string;
89
+ readonly batch: string;
90
+ readonly state: string;
91
+ }[];
92
+ };
93
+ export type OpenedFile = {
94
+ readonly key: string;
95
+ readonly byteLength: number;
96
+ readonly mediaType: string;
97
+ };
98
+ type Asked<A, R> = {
99
+ readonly asked: A;
100
+ readonly answer: R;
101
+ };
102
+ type Nothing = Readonly<Record<never, never>>;
103
+ export type CommittedWrite = Committed & {
104
+ readonly fenced: string | null;
105
+ };
106
+ export type AuthoredWrite = {
107
+ readonly writes: readonly AuthoredRows[];
108
+ readonly files: readonly StoredFile[];
109
+ readonly whole: boolean;
110
+ readonly discards?: readonly string[];
111
+ };
112
+ export interface RuntimeRequests {
113
+ readonly 'authored.queues': Asked<Nothing, HeldQueues>;
114
+ readonly 'authored.roomDrafts': Asked<Nothing, readonly string[]>;
115
+ readonly 'authored.chatDrafts': Asked<Nothing, readonly string[]>;
116
+ readonly 'authored.calls': Asked<Nothing, readonly string[]>;
117
+ readonly 'authored.fences': Asked<Nothing, readonly string[]>;
118
+ readonly 'authored.fact': Asked<{
119
+ readonly name: AuthoredFact;
120
+ }, string | null>;
121
+ readonly 'authored.file': Asked<{
122
+ readonly key: string;
123
+ readonly type: string;
124
+ }, Blob>;
125
+ readonly 'authored.amend': Asked<{
126
+ readonly locator: string;
127
+ readonly id: string;
128
+ readonly amendment: string;
129
+ }, null>;
130
+ readonly 'authored.roomDraft': Asked<{
131
+ readonly locator: string;
132
+ readonly path: string;
133
+ readonly kept: KeptRecord | null;
134
+ readonly files: readonly StoredFile[];
135
+ }, string | null>;
136
+ readonly 'authored.chatDraft': Asked<{
137
+ readonly kept: readonly {
138
+ readonly conversation: string;
139
+ readonly record: string;
140
+ }[];
141
+ readonly dropped: readonly string[];
142
+ }, null>;
143
+ readonly 'authored.call': Asked<{
144
+ readonly operation: string;
145
+ readonly kept: KeptRecord | null;
146
+ readonly files: readonly StoredFile[];
147
+ }, null>;
148
+ readonly 'authored.remember': Asked<{
149
+ readonly name: AuthoredFact;
150
+ readonly value: string;
151
+ }, null>;
152
+ readonly 'authored.claim': Asked<{
153
+ readonly holder: string;
154
+ }, boolean>;
155
+ readonly 'authored.end': Asked<{
156
+ readonly holder: string | null;
157
+ }, boolean>;
158
+ readonly 'replica.open': Asked<Nothing, ReplicaOpened>;
159
+ readonly 'replica.query': Asked<{
160
+ readonly plan: Plan;
161
+ readonly rooms: readonly QueryRoom[];
162
+ readonly budget: number | null;
163
+ }, QueryAnswer>;
164
+ readonly 'replica.entries': Asked<{
165
+ readonly key: number;
166
+ readonly view: View;
167
+ readonly paths: readonly string[];
168
+ }, readonly HeldEntry[]>;
169
+ readonly 'replica.typed': Asked<{
170
+ readonly key: number;
171
+ readonly view: View;
172
+ readonly paths: readonly string[];
173
+ }, readonly TypedEntry[]>;
174
+ readonly 'replica.referrers': Asked<{
175
+ readonly key: number;
176
+ readonly view: View;
177
+ readonly targets: readonly string[];
178
+ readonly kinds: readonly string[];
179
+ }, readonly Referrer[]>;
180
+ readonly 'replica.files': Asked<{
181
+ readonly key: number;
182
+ readonly view: View;
183
+ readonly after: string | null;
184
+ readonly limit: number;
185
+ }, readonly {
186
+ readonly path: string;
187
+ readonly revision: string;
188
+ }[]>;
189
+ readonly 'replica.folders': Asked<{
190
+ readonly key: number;
191
+ readonly view: View;
192
+ readonly paths: readonly string[];
193
+ }, readonly string[]>;
194
+ readonly 'replica.typedWithin': Asked<{
195
+ readonly key: number;
196
+ readonly view: View;
197
+ readonly roots: readonly string[];
198
+ readonly within: boolean;
199
+ }, boolean>;
200
+ readonly 'replica.counts': Asked<{
201
+ readonly rooms: readonly CountedRoom[];
202
+ }, readonly number[]>;
203
+ readonly 'replica.search': Asked<SearchAsk, SearchWindow>;
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
+ }, MessageWindow>;
298
+ readonly 'conversation.count': Asked<{
299
+ readonly conversation: string;
300
+ }, number>;
301
+ readonly 'conversation.turn': Asked<{
302
+ readonly conversation: string;
303
+ readonly turn: string;
304
+ }, boolean>;
305
+ readonly 'conversation.drop': Asked<{
306
+ readonly conversations: readonly string[];
307
+ }, null>;
308
+ readonly 'space.probe': Asked<Nothing, null>;
309
+ }
310
+ export type RuntimeKind = keyof RuntimeRequests;
311
+ export type RuntimeRequest<K extends RuntimeKind = RuntimeKind> = {
312
+ readonly [Kind in K]: {
313
+ readonly kind: Kind;
314
+ } & RuntimeRequests[Kind]['asked'];
315
+ }[K];
316
+ export type RuntimeAnswer<K extends RuntimeKind> = RuntimeRequests[K]['answer'];
317
+ export interface RuntimeDatabase {
318
+ ask<K extends RuntimeKind>(request: RuntimeRequest<K>): Promise<RuntimeAnswer<K>>;
319
+ }
320
+ export declare function isRuntime(request: {
321
+ readonly kind: string;
322
+ }): request is RuntimeRequest;
323
+ export declare function readsRuntime(request: RuntimeRequest): boolean;
324
+ export declare function answerRuntime(connection: Connection, request: RuntimeRequest, spool: FileSpool): unknown;
@@ -34,15 +34,35 @@ declare const MEMBERS: {
34
34
  readonly reach: 'within';
35
35
  readonly effect: 'write';
36
36
  };
37
+ readonly saveParts: {
38
+ readonly reach: 'within';
39
+ readonly effect: 'write';
40
+ };
37
41
  readonly history: {
38
42
  readonly reach: 'within';
39
43
  readonly effect: 'read';
40
44
  };
45
+ readonly resolve: {
46
+ readonly reach: 'within';
47
+ readonly effect: 'read';
48
+ };
41
49
  readonly 'binaryFile.read': {
42
50
  readonly reach: 'within';
43
51
  readonly effect: 'read';
44
52
  };
45
- readonly 'binaryFile.readReference': {
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': {
46
66
  readonly reach: 'within';
47
67
  readonly effect: 'read';
48
68
  };
@@ -58,6 +78,10 @@ declare const MEMBERS: {
58
78
  readonly reach: 'whole';
59
79
  readonly effect: 'read';
60
80
  };
81
+ readonly cleanUp: {
82
+ readonly reach: 'whole';
83
+ readonly effect: 'write';
84
+ };
61
85
  readonly persistence: {
62
86
  readonly reach: 'runtime';
63
87
  readonly effect: 'read';
@@ -94,6 +118,10 @@ declare const MEMBERS: {
94
118
  readonly reach: 'app';
95
119
  readonly effect: 'write';
96
120
  };
121
+ readonly 'presentation.edit': {
122
+ readonly reach: 'app';
123
+ readonly effect: 'write';
124
+ };
97
125
  readonly 'conversation.list': {
98
126
  readonly reach: 'within';
99
127
  readonly effect: 'read';
@@ -134,6 +162,10 @@ declare const MEMBERS: {
134
162
  readonly reach: 'within';
135
163
  readonly effect: 'write';
136
164
  };
165
+ readonly 'chatDraft.prepend': {
166
+ readonly reach: 'within';
167
+ readonly effect: 'write';
168
+ };
137
169
  readonly 'chatDraft.discard': {
138
170
  readonly reach: 'within';
139
171
  readonly effect: 'write';
@@ -1,11 +1,17 @@
1
1
  import type { MdRuntimeClient } from './mdruntime/client.js';
2
- import type { HouseActivation, HouseAnalyticsChoice, HouseAppMessage, HouseExternalAnswer, HouseExternalRequest, HouseNavigationMode, HouseRefusal, HouseSourceDownload, HouseSourceTop, HouseStatus, HouseTab, HouseTask } 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[];
@@ -15,9 +21,6 @@ export interface HouseBridgeTestHost {
15
21
  publish(status: HouseStatus): void;
16
22
  message(message: HouseAppMessage): void;
17
23
  attachRuntime(runtime: MdRuntimeClient): void;
18
- checkpoint(): Promise<HouseTask>;
19
- restore(task: HouseTask | null): Promise<boolean>;
20
- settle(activation: HouseActivation): void;
21
24
  }
22
25
  export interface HouseBridgeTestHostOptions {
23
26
  readonly address?: string;
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();
@@ -57,7 +58,6 @@ export function createHouseBridgeTestHost(options = {}) {
57
58
  let published = options.status ?? null;
58
59
  let shown = null;
59
60
  let seen = null;
60
- let cooperation = null;
61
61
  let attached = () => { };
62
62
  const runtime = new Promise((resolve) => {
63
63
  attached = resolve;
@@ -99,7 +99,21 @@ export function createHouseBridgeTestHost(options = {}) {
99
99
  });
100
100
  }
101
101
  const bridge = {
102
- 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
+ },
103
117
  address: () => shown,
104
118
  onAddress(listener) {
105
119
  return followHeld(addressListeners, listener, () => shown);
@@ -145,25 +159,15 @@ export function createHouseBridgeTestHost(options = {}) {
145
159
  consents.push(choice);
146
160
  publish({ ...published, analytics: { measures: true, choice } });
147
161
  },
148
- cooperate(given) {
149
- cooperation = given;
150
- return () => {
151
- if (cooperation === given)
152
- cooperation = null;
153
- };
154
- },
162
+ cooperate: () => () => { },
155
163
  };
156
- function cooperating() {
157
- if (cooperation === null)
158
- throw new Error('the App registered no cooperation');
159
- return cooperation;
160
- }
161
164
  Object.defineProperty(globalThis, 'houseBridge', { value: bridge, configurable: true });
162
165
  if (published !== null)
163
166
  publish(published);
164
167
  arrive(current);
165
168
  return {
166
169
  navigations,
170
+ chats,
167
171
  ceremonies,
168
172
  consents,
169
173
  tabs,
@@ -182,19 +186,5 @@ export function createHouseBridgeTestHost(options = {}) {
182
186
  attachRuntime(client) {
183
187
  attached(client);
184
188
  },
185
- async checkpoint() {
186
- const held = cooperating();
187
- await held.checkpoint();
188
- await held.persist();
189
- return JSON.parse(JSON.stringify((await held.capture()) ?? null));
190
- },
191
- async restore(task) {
192
- const held = cooperating();
193
- await held.restore(task);
194
- return (await held.ready()) === true;
195
- },
196
- settle(activation) {
197
- cooperating().settle(activation);
198
- },
199
189
  };
200
190
  }