@agentshouse/app-bridge 0.1.0-cc916a0fcfdc4 → 0.1.0-ccabf1b730c99

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.
package/dist/calls.d.ts CHANGED
@@ -64,6 +64,19 @@ export interface HouseMethods {
64
64
  readonly url: string;
65
65
  };
66
66
  };
67
+ readonly 'conversation.attach': {
68
+ readonly params: {
69
+ readonly blob: Blob;
70
+ readonly byteLength: number;
71
+ readonly contentHash: string;
72
+ readonly mediaType: string;
73
+ readonly name: string;
74
+ readonly room: string;
75
+ };
76
+ readonly result: {
77
+ readonly path: string;
78
+ };
79
+ };
67
80
  readonly 'conversation.create': {
68
81
  readonly params: {
69
82
  readonly agent_id: string;
@@ -192,40 +205,13 @@ export interface HouseMethods {
192
205
  readonly 'conversation.send': {
193
206
  readonly params: {
194
207
  readonly conversation: string;
195
- readonly files?: readonly {
196
- readonly blob: Blob;
197
- readonly byteLength: number;
198
- readonly contentHash: string;
199
- readonly height?: number;
200
- readonly mediaType: string;
201
- readonly name: string;
202
- readonly width?: number;
203
- }[];
204
208
  readonly operation_id: string;
205
- readonly text?: string;
209
+ readonly text: string;
206
210
  };
207
211
  readonly result: {
208
212
  readonly agent_id: string;
209
213
  readonly authority: string;
210
214
  readonly conversation_id: string;
211
- readonly files: readonly {
212
- readonly name: string;
213
- readonly media_type: string | null;
214
- readonly dimensions: {
215
- readonly width: number;
216
- readonly height: number;
217
- } | null;
218
- readonly bytes: number;
219
- readonly sha256: string;
220
- readonly file: string | null;
221
- readonly page: string;
222
- readonly upload?: {
223
- readonly method: 'POST';
224
- readonly operation: string;
225
- readonly url: string;
226
- readonly expires_at: string;
227
- };
228
- }[];
229
215
  readonly log_epoch: string;
230
216
  readonly message_id: string;
231
217
  readonly position: string;
@@ -278,6 +264,86 @@ export interface HouseMethods {
278
264
  readonly log_epoch: string;
279
265
  };
280
266
  };
267
+ readonly 'inboxChat.assign': {
268
+ readonly params: {
269
+ readonly room_ref: string;
270
+ readonly path: string;
271
+ readonly assignee: {
272
+ readonly user: string;
273
+ } | {
274
+ readonly agent: string;
275
+ } | null;
276
+ };
277
+ readonly result: {
278
+ readonly room_ref: string;
279
+ readonly path: string;
280
+ readonly assignee: {
281
+ readonly user: string;
282
+ readonly name: string;
283
+ } | {
284
+ readonly agent: string;
285
+ readonly name: string;
286
+ } | null;
287
+ readonly return_to: {
288
+ readonly agent: string;
289
+ readonly name: string;
290
+ } | null;
291
+ readonly authority: string;
292
+ readonly position: string;
293
+ readonly log_epoch: string;
294
+ readonly url: string;
295
+ };
296
+ };
297
+ readonly 'inboxChat.return': {
298
+ readonly params: {
299
+ readonly room_ref: string;
300
+ readonly path: string;
301
+ };
302
+ readonly result: {
303
+ readonly room_ref: string;
304
+ readonly path: string;
305
+ readonly assignee: {
306
+ readonly user: string;
307
+ readonly name: string;
308
+ } | {
309
+ readonly agent: string;
310
+ readonly name: string;
311
+ } | null;
312
+ readonly return_to: {
313
+ readonly agent: string;
314
+ readonly name: string;
315
+ } | null;
316
+ readonly authority: string;
317
+ readonly position: string;
318
+ readonly log_epoch: string;
319
+ readonly url: string;
320
+ };
321
+ };
322
+ readonly 'inboxChat.takeControl': {
323
+ readonly params: {
324
+ readonly room_ref: string;
325
+ readonly path: string;
326
+ };
327
+ readonly result: {
328
+ readonly room_ref: string;
329
+ readonly path: string;
330
+ readonly assignee: {
331
+ readonly user: string;
332
+ readonly name: string;
333
+ } | {
334
+ readonly agent: string;
335
+ readonly name: string;
336
+ } | null;
337
+ readonly return_to: {
338
+ readonly agent: string;
339
+ readonly name: string;
340
+ } | null;
341
+ readonly authority: string;
342
+ readonly position: string;
343
+ readonly log_epoch: string;
344
+ readonly url: string;
345
+ };
346
+ };
281
347
  readonly 'member.list': {
282
348
  readonly params: {
283
349
  readonly room_ref: string;
@@ -865,11 +931,6 @@ export interface HouseMethods {
865
931
  readonly enabled: boolean;
866
932
  readonly access?: string;
867
933
  readonly payload: string;
868
- readonly references: readonly {
869
- readonly room_ref: string;
870
- readonly ref: string;
871
- readonly url: string;
872
- }[];
873
934
  readonly holds: boolean;
874
935
  })[];
875
936
  }[];
@@ -899,6 +960,10 @@ export interface HouseMethods {
899
960
  readonly position: number;
900
961
  readonly outcome: 'requested';
901
962
  readonly request: string;
963
+ } | {
964
+ readonly position: number;
965
+ readonly outcome: 'continued';
966
+ readonly request: string;
902
967
  } | {
903
968
  readonly position: number;
904
969
  readonly outcome: 'refused';
@@ -907,12 +972,12 @@ export interface HouseMethods {
907
972
  readonly position: number;
908
973
  readonly outcome: 'refused';
909
974
  readonly code: 'limit_reached';
910
- readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'external_calls' | 'routine_requests' | 'routine_mail';
975
+ readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'mcp_reads' | 'mcp_downloads' | 'external_calls' | 'routine_requests' | 'routine_mail';
911
976
  } | {
912
977
  readonly position: number;
913
978
  readonly outcome: 'refused';
914
979
  readonly code: 'limit_reached';
915
- readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'external_calls' | 'routine_requests' | 'routine_mail';
980
+ readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'mcp_reads' | 'mcp_downloads' | 'external_calls' | 'routine_requests' | 'routine_mail';
916
981
  readonly retry_at: string;
917
982
  } | {
918
983
  readonly position: number;
@@ -936,23 +1001,16 @@ export interface HouseMethods {
936
1001
  readonly limit: 'writes';
937
1002
  readonly period: 'minute' | 'day';
938
1003
  readonly retry_at: string;
939
- } | {
940
- readonly position: number;
941
- readonly outcome: 'refused';
942
- readonly code: 'limit_reached';
943
- readonly limit: 'mcp_reads' | 'mcp_downloads';
944
- readonly value: string;
945
- readonly retry_at: string;
946
1004
  } | {
947
1005
  readonly position: number;
948
1006
  readonly outcome: 'refused';
949
1007
  readonly code: 'cap_reached';
950
- readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'external_accounts' | 'export_starts' | 'share_creations' | 'share_room_creations' | 'live_shares' | 'ownership_offers' | 'site_rooms' | 'slot_rooms' | 'room_triggers' | 'app_sockets' | 'kit_connections';
1008
+ readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'external_accounts' | 'shared_schemas' | 'export_starts' | 'share_creations' | 'share_room_creations' | 'live_shares' | 'ownership_offers' | 'site_rooms' | 'slot_rooms' | 'room_triggers' | 'app_sockets' | 'kit_connections' | 'open_uploads' | 'waiting_web_wizards';
951
1009
  } | {
952
1010
  readonly position: number;
953
1011
  readonly outcome: 'refused';
954
1012
  readonly code: 'cap_reached';
955
- readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'external_accounts' | 'export_starts' | 'share_creations' | 'share_room_creations' | 'live_shares' | 'ownership_offers' | 'site_rooms' | 'slot_rooms' | 'room_triggers' | 'app_sockets' | 'kit_connections';
1013
+ readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'external_accounts' | 'shared_schemas' | 'export_starts' | 'share_creations' | 'share_room_creations' | 'live_shares' | 'ownership_offers' | 'site_rooms' | 'slot_rooms' | 'room_triggers' | 'app_sockets' | 'kit_connections' | 'open_uploads' | 'waiting_web_wizards';
956
1014
  readonly retry_at: string;
957
1015
  } | {
958
1016
  readonly position: number;
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export interface HouseCredentialState {
21
21
  readonly state: Open<'none' | 'held' | 'rejected'>;
22
22
  readonly expiresAt: number | null;
23
23
  }
24
+ export type HouseDatabaseFailure = 'unsupported' | 'damaged' | 'update-required';
24
25
  export type HouseAnalyticsChoice = 'accept' | 'decline';
25
26
  export interface HouseAnalytics {
26
27
  readonly measures: boolean;
@@ -40,6 +41,7 @@ export interface HouseStatus {
40
41
  readonly retryable: boolean;
41
42
  } | null;
42
43
  readonly loss: string | null;
44
+ readonly database: Open<HouseDatabaseFailure> | null;
43
45
  readonly analytics: HouseAnalytics;
44
46
  readonly serviceMode: Open<'open' | 'write-halted'> | null;
45
47
  readonly offline: boolean;
@@ -77,4 +77,4 @@ export type PointerFacts = {
77
77
  export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
78
78
  export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
79
79
  export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
80
- export declare function readSchema(text: string): VerifiedModel | Failure;
80
+ export declare function readSchema(text: string, provided?: VerifiedModel): VerifiedModel | Failure;
@@ -1,6 +1,6 @@
1
1
  import { type Definition } from './definition.js';
2
2
  import { type LinkInventory } from './links.js';
3
- import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, LinkOccurrence, ParseResult } from './types.js';
3
+ import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult } from './types.js';
4
4
  import { type YamlMap } from './yaml.js';
5
5
  export declare function inventoryOf(document: Document): LinkInventory;
6
6
  export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
@@ -9,9 +9,7 @@ export declare function relativize(document: Document, file: string, handle: str
9
9
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
10
10
  export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
11
11
  export declare function links(document: Document, file: string): readonly Link[];
12
- export declare function linkOccurrences(document: Document, file: string): readonly LinkOccurrence[];
13
12
  export declare function bodyLinks(body: string, file: string): readonly Link[];
14
13
  export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
15
14
  export declare function serialize(document: Document): string;
16
- export declare function fieldStart(document: Document, pointer: string): number | undefined;
17
15
  export declare function frontmatter(document: Document): YamlMap | null;
@@ -3,7 +3,7 @@ export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest
3
3
  export { headingLines } from './blocks.js';
4
4
  export type { HeadingLine } from './blocks.js';
5
5
  export { divide } from './divide.js';
6
- export { apply, bodyLinks, fieldStart, linkOccurrences, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
6
+ export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
7
7
  export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
8
8
  export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
9
9
  export type { RoomTarget } from './paths.js';
@@ -12,8 +12,9 @@ export { project } from './project.js';
12
12
  export { references } from './references.js';
13
13
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
14
14
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
15
- export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, LinkOccurrence, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
16
- export { bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verify, } from './validate.js';
15
+ export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
16
+ export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.js';
17
+ export type { Assessment, Verdicts } from './validate.js';
17
18
  export { VERSION } from './version.js';
18
19
  export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
19
20
  export type { FrontmatterValue } from './yaml.js';
@@ -97,9 +97,6 @@ export type Link = {
97
97
  readonly href: string;
98
98
  readonly target: string;
99
99
  };
100
- export type LinkOccurrence = Link & {
101
- readonly start: number;
102
- };
103
100
  export type Reference = {
104
101
  readonly pointer: string;
105
102
  readonly value: string;
@@ -1,10 +1,31 @@
1
1
  import { type Definition } from './definition.js';
2
2
  import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
3
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
4
- export declare function verify(schema: string): ModelVerification;
4
+ export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
5
5
  export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
6
6
  export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
7
7
  export declare function bodyRoomLinks(body: string): RoomReference[];
8
8
  export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
9
+ type Placed = {
10
+ readonly reference: Reached;
11
+ readonly location: string;
12
+ };
13
+ export type Assessment = {
14
+ readonly file: string;
15
+ readonly type: string | undefined;
16
+ readonly targets: readonly string[];
17
+ readonly read: Validation | null;
18
+ readonly structured: Validation | null;
19
+ readonly fields: readonly Placed[];
20
+ readonly linked: boolean;
21
+ readonly sections: readonly Placed[];
22
+ };
23
+ export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): Assessment;
24
+ export type Verdicts = {
25
+ add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
26
+ verdict(): Validation;
27
+ };
28
+ export declare function verdicts(): Verdicts;
9
29
  export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
10
30
  export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
31
+ export {};
@@ -50,7 +50,7 @@ export type ListedConversation = {
50
50
  outcome: string | null;
51
51
  waiting: boolean;
52
52
  };
53
- export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
53
+ export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.attach' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
54
54
  export type ConversationMessage = {
55
55
  identity: string;
56
56
  turn: string;
@@ -255,7 +255,7 @@ export type ContractUnavailable = ProviderRefusal & {
255
255
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
256
256
  export type PageToken = string;
257
257
  export type ChangeAuthor = {
258
- kind: Open<'user' | 'site'>;
258
+ kind: Open<'user' | 'site' | 'inbox'>;
259
259
  id: string;
260
260
  name: string;
261
261
  };
@@ -274,9 +274,16 @@ export type BinaryFile = {
274
274
  mediaType: string;
275
275
  sha256: string;
276
276
  };
277
+ export type HeldFile = {
278
+ readonly path: string;
279
+ readonly revision: string;
280
+ };
277
281
  export type HeldContent = {
278
- documents: Readonly<Record<string, string>>;
279
- revisions: Readonly<Record<string, string>>;
282
+ files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
283
+ contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
284
+ readonly content: string;
285
+ readonly revision: string;
286
+ }>>;
280
287
  };
281
288
  export type BootstrapRequest = {
282
289
  locator: string;
@@ -297,6 +304,7 @@ export type BootstrapPage = {
297
304
  fileIds?: Readonly<Record<string, string>>;
298
305
  changes: Readonly<Record<string, HeadChange>>;
299
306
  binaryFiles: Readonly<Record<string, BinaryFile>>;
307
+ folders?: readonly string[];
300
308
  pageToken?: PageToken;
301
309
  };
302
310
  export type BootstrapResult = BootstrapPage | {
@@ -318,6 +326,8 @@ export type RefreshPage = {
318
326
  changes: Readonly<Record<string, HeadChange>>;
319
327
  binaryFiles: Readonly<Record<string, BinaryFile>>;
320
328
  removals: readonly string[];
329
+ folders?: readonly string[];
330
+ folderRemovals?: readonly string[];
321
331
  pageToken?: PageToken;
322
332
  };
323
333
  export type RefreshResult = {
@@ -328,6 +338,7 @@ export type RefreshResult = {
328
338
  export type MutationRequest = {
329
339
  locator: string;
330
340
  changeBatch: ChangeBatch;
341
+ file(localId: string): Promise<Blob>;
331
342
  upload?: unknown;
332
343
  };
333
344
  export type RetryableRefusal = ProviderRefusal & {
@@ -369,7 +380,7 @@ export type HistoryAuthor = {
369
380
  kind: 'user';
370
381
  id: string;
371
382
  } | {
372
- kind: 'site';
383
+ kind: 'site' | 'inbox';
373
384
  id: string;
374
385
  name: string;
375
386
  };
@@ -408,15 +419,14 @@ export type BinaryRequest = {
408
419
  referrer: unknown;
409
420
  };
410
421
  export type ReferrerScope = {
411
- kind: 'room';
412
422
  locator: string;
413
423
  path?: string;
414
- } | {
415
- kind: 'conversations';
416
424
  };
417
425
  export type BinaryResult = {
418
426
  kind: 'binary';
419
- blob: Blob;
427
+ body: ReadableStream<Uint8Array>;
428
+ mediaType: string;
429
+ sha256?: string;
420
430
  } | (ProviderRefusal & {
421
431
  kind: 'rejected';
422
432
  }) | AdapterFailure;
@@ -445,9 +455,8 @@ export type ActionResult = {
445
455
  export type HeldRoom = {
446
456
  locator: string;
447
457
  roomVersion: string;
448
- documents: Readonly<Record<string, string>>;
449
- revisions: Readonly<Record<string, string>>;
450
458
  };
459
+ export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
451
460
  export type RoomStreamEvent = {
452
461
  kind: 'opened';
453
462
  } | {
@@ -482,11 +491,12 @@ export type RoomStream = {
482
491
  hold(rooms: readonly HeldRoom[]): void;
483
492
  reopen(): void;
484
493
  published(locator: string, roomVersion: string): void;
485
- observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
494
+ observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
486
495
  };
487
496
  export type Adapter = {
488
497
  readonly localSaves?: true;
489
498
  readonly exhaustiveDiscovery?: true;
499
+ readonly roomTypes?: string;
490
500
  authorize(): Promise<Authorization>;
491
501
  discover(authorization: Authorization, scope?: DiscoveryScope): Promise<DiscoverResult>;
492
502
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
@@ -0,0 +1,10 @@
1
+ import type { MdRuntimeClient } from './client.js';
2
+ import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
3
+ type Rows = DocumentResult | GroupResult;
4
+ export type WindowAnswer = Rows | PendingResult;
5
+ export type WindowChain = {
6
+ want(count: number): void;
7
+ close(): void;
8
+ };
9
+ export declare function chainedWindows(runtime: MdRuntimeClient, query: DocumentQuery | GroupQuery, count: number, publish: (answers: readonly (WindowAnswer | null)[], settled: boolean) => void): WindowChain;
10
+ export {};
@@ -1,10 +1,6 @@
1
- import { type Replica } from './replica.js';
2
- import { type Row } from './rows.js';
3
1
  export type DocumentChange = {
4
- locator: string;
5
- path: string;
6
- before: readonly Row[];
7
- after: readonly Row[];
2
+ readonly locator: string;
3
+ readonly path: string | null;
8
4
  };
9
5
  export type MessageChange = {
10
6
  conversation: string;
@@ -24,14 +20,14 @@ export type ChangeSet = {
24
20
  conversations: readonly string[];
25
21
  };
26
22
  type Changed = {
23
+ documents?: readonly string[] | null;
27
24
  drafts?: readonly string[];
28
25
  room?: boolean;
29
26
  queue?: boolean;
30
27
  presentation?: string;
31
28
  };
32
- export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: Changed): ChangeSet;
33
- export declare function changing(locator: string, before: Replica | null, after: Replica | null, changed?: Changed): Generator<number, ChangeSet, void>;
34
- export declare function entering(locator: string, replica: Replica, paths: readonly string[]): ChangeSet;
29
+ export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
35
30
  export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
36
31
  export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
32
+ export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
37
33
  export {};
@@ -30,7 +30,6 @@ export type Change = {
30
30
  readonly kind: 'binary';
31
31
  readonly path: string;
32
32
  readonly localId: string;
33
- readonly blob: Blob;
34
33
  readonly byteLength: number;
35
34
  readonly mediaType: string;
36
35
  readonly sha256: string;
@@ -3,6 +3,7 @@ import type { Member, ServiceMode } from './adapter.js';
3
3
  import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
4
4
  import { type Observation } from './observation.js';
5
5
  import type { BinaryReference } from './binary.js';
6
+ import type { ChosenFile } from './file.js';
6
7
  import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
7
8
  import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
8
9
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
@@ -36,6 +37,7 @@ export type MdRuntimeClient = {
36
37
  read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
37
38
  create(input: unknown): Promise<CallResult>;
38
39
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
40
+ attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
39
41
  answer(conversation: string, answer: unknown): Promise<CallResult>;
40
42
  interrupt(conversation: string): Promise<CallResult>;
41
43
  kill(conversation: string): Promise<CallResult>;
@@ -59,6 +61,7 @@ export type MdRuntimeClient = {
59
61
  log(): Promise<string>;
60
62
  persistence(): Promise<boolean>;
61
63
  retry(): Promise<void>;
64
+ cleanUp(): Promise<number>;
62
65
  observe: {
63
66
  (topic: 'deployment-facts'): Promise<Observation<unknown>>;
64
67
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
@@ -82,6 +85,7 @@ export type MdRuntimeClient = {
82
85
  };
83
86
  export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
84
87
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
88
+ export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
85
89
  export type { Observation } from './observation.js';
86
90
  export type { Open } from './open.js';
87
91
  export { unanswered, type RuntimePort, type WireMember } from './wire.js';
@@ -1,9 +1,8 @@
1
- import { type Document, type Frontmatter, type Validation } from '../mdmodel/index.js';
2
- import { type ModelState } from './model.js';
1
+ import { type Document } from '../mdmodel/index.js';
2
+ import type { ModelState } from './model.js';
3
3
  import type { MdModelIdentity } from './adapter.js';
4
4
  import { type Paths } from './shared.js';
5
5
  import type { Refused } from './transfer.js';
6
- import { type Later } from './turn.js';
7
6
  export declare const MD_MODEL: MdModelIdentity;
8
7
  export type Collection = {
9
8
  text: Readonly<Record<string, string>>;
@@ -17,23 +16,10 @@ export type Composition = {
17
16
  model: ModelState;
18
17
  } | null;
19
18
  };
19
+ export declare function selected(composition: Composition, path: string): boolean;
20
20
  export declare function governing(composition: Composition, path: string): ModelState;
21
- export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Collection;
22
- export declare function collecting(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Generator<number, Collection, void>;
23
- export declare function passingFrontmatter(collection: Collection, path: string): Frontmatter | undefined;
21
+ export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
24
22
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
25
- export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Generator<number, Refused | null, void>;
23
+ export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
26
24
  export declare function validRoot(root: unknown): root is string;
27
- export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Generator<number, Validation, void>;
28
- type Held = {
29
- text: Paths<string>;
30
- binaries: Paths<unknown>;
31
- };
32
- export declare function indexReferrers(held: Held, composition: Composition): Later<void>;
33
- export declare function referencesIndexed(held: Held, composition: Composition): boolean;
34
- export declare function referring(held: Held, composition: Composition, targets: Iterable<string>): Generator<number, ReadonlySet<string> | null, void>;
35
25
  export declare function available(composition: Composition): boolean;
36
- export declare function changedCleanly(next: Held, previous: Held & {
37
- composition: Composition;
38
- }, composition: Composition): Generator<number, boolean, void>;
39
- export {};
@@ -0,0 +1,10 @@
1
+ import type { Plan, QueryRows } from './query.js';
2
+ import type { Connection } from './tables.js';
3
+ export type QueryRoom = {
4
+ readonly locator: string;
5
+ readonly key: number;
6
+ };
7
+ export type QueryAnswer = QueryRows & {
8
+ readonly more?: string;
9
+ };
10
+ export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
@@ -8,13 +8,14 @@ import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry,
8
8
  import { type WrittenBy } from './change.js';
9
9
  import type { Open } from './open.js';
10
10
  import { type BinaryReference } from './binary.js';
11
- import { type BinaryAnswer, type BinaryLinkAnswer, type CallResult, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
11
+ import { type BinaryLinkAnswer, type CallResult, type HeldBinaryAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
12
12
  import { type Recovery } from './recovery.js';
13
13
  import { type SaveRefusal } from './save.js';
14
14
  import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
15
15
  import { type SyncStatus } from './status.js';
16
16
  import { type RuntimeShell } from './durability.js';
17
17
  import { type CapacityCause, type CodeAvailability, type Persistence, type Readiness, type SearchObligation } from './readiness.js';
18
+ import type { RuntimeDatabase } from './tables.js';
18
19
  import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
19
20
  export type AppTypedSelection = {
20
21
  roots: readonly string[];
@@ -50,6 +51,7 @@ export type ConnectionRefusal = {
50
51
  export type MdRuntimeOptions = {
51
52
  adapter: Adapter;
52
53
  shell: RuntimeShell;
54
+ database: RuntimeDatabase;
53
55
  authorization?: Authorization;
54
56
  signal?: AbortSignal;
55
57
  recovery?: Recovery;
@@ -70,7 +72,7 @@ export type SavedParts = {
70
72
  };
71
73
  export type RoomDraftSurface = {
72
74
  list(): Promise<readonly RoomDraft[]>;
73
- read(room: string, path: string): RoomDraft | null;
75
+ read(room: string, path: string): Promise<RoomDraft | null>;
74
76
  write(room: string, path: string, revision: string | null, parts: unknown): Promise<RoomDraftWrite>;
75
77
  discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
76
78
  };
@@ -80,9 +82,10 @@ export type PresentationSurface = {
80
82
  edit(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
81
83
  };
82
84
  export type BinaryFileSurface = {
83
- read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
85
+ read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
84
86
  link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
85
- readReference(reference: BinaryReference): Promise<BinaryAnswer>;
87
+ readReference(reference: BinaryReference): Promise<HeldBinaryAnswer>;
88
+ part(file: string, part: number): Promise<Uint8Array | null>;
86
89
  };
87
90
  export type HistoryQuery = {
88
91
  revision?: string;
@@ -107,10 +110,11 @@ export type MdRuntime = {
107
110
  resolve(room: string, path: string, destination: string): Promise<Resolution>;
108
111
  binaryFile: BinaryFileSurface;
109
112
  call(name: string, input: unknown): Promise<CallResult>;
110
- reached(locator: string, roomVersion: string, path?: string): boolean;
113
+ reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
111
114
  log(): string;
112
115
  persistence(): boolean;
113
116
  retry(): Promise<void>;
117
+ cleanUp(): Promise<number>;
114
118
  observe: {
115
119
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
116
120
  (topic: 'readiness'): Promise<Observation<Readiness>>;