@agentshouse/app-bridge 0.1.0-c7704ffcd24b7 → 0.1.0-c772e800e468d

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
@@ -81,6 +81,7 @@ export interface HouseMethods {
81
81
  readonly params: {
82
82
  readonly agent_id: string;
83
83
  readonly operation_id?: string;
84
+ readonly replaces?: string;
84
85
  };
85
86
  readonly result: {
86
87
  readonly agent_id: string;
@@ -264,6 +265,86 @@ export interface HouseMethods {
264
265
  readonly log_epoch: string;
265
266
  };
266
267
  };
268
+ readonly 'inboxChat.assign': {
269
+ readonly params: {
270
+ readonly room_ref: string;
271
+ readonly path: string;
272
+ readonly assignee: {
273
+ readonly user: string;
274
+ } | {
275
+ readonly agent: string;
276
+ } | null;
277
+ };
278
+ readonly result: {
279
+ readonly room_ref: string;
280
+ readonly path: string;
281
+ readonly assignee: {
282
+ readonly user: string;
283
+ readonly name: string;
284
+ } | {
285
+ readonly agent: string;
286
+ readonly name: string;
287
+ } | null;
288
+ readonly return_to: {
289
+ readonly agent: string;
290
+ readonly name: string;
291
+ } | null;
292
+ readonly authority: string;
293
+ readonly position: string;
294
+ readonly log_epoch: string;
295
+ readonly url: string;
296
+ };
297
+ };
298
+ readonly 'inboxChat.return': {
299
+ readonly params: {
300
+ readonly room_ref: string;
301
+ readonly path: string;
302
+ };
303
+ readonly result: {
304
+ readonly room_ref: string;
305
+ readonly path: string;
306
+ readonly assignee: {
307
+ readonly user: string;
308
+ readonly name: string;
309
+ } | {
310
+ readonly agent: string;
311
+ readonly name: string;
312
+ } | null;
313
+ readonly return_to: {
314
+ readonly agent: string;
315
+ readonly name: string;
316
+ } | null;
317
+ readonly authority: string;
318
+ readonly position: string;
319
+ readonly log_epoch: string;
320
+ readonly url: string;
321
+ };
322
+ };
323
+ readonly 'inboxChat.takeControl': {
324
+ readonly params: {
325
+ readonly room_ref: string;
326
+ readonly path: string;
327
+ };
328
+ readonly result: {
329
+ readonly room_ref: string;
330
+ readonly path: string;
331
+ readonly assignee: {
332
+ readonly user: string;
333
+ readonly name: string;
334
+ } | {
335
+ readonly agent: string;
336
+ readonly name: string;
337
+ } | null;
338
+ readonly return_to: {
339
+ readonly agent: string;
340
+ readonly name: string;
341
+ } | null;
342
+ readonly authority: string;
343
+ readonly position: string;
344
+ readonly log_epoch: string;
345
+ readonly url: string;
346
+ };
347
+ };
267
348
  readonly 'member.list': {
268
349
  readonly params: {
269
350
  readonly room_ref: string;
@@ -339,42 +420,20 @@ export interface HouseMethods {
339
420
  readonly order?: 'asc' | 'desc';
340
421
  };
341
422
  readonly result: {
342
- readonly attachments: readonly {
343
- readonly bytes: number;
344
- readonly file: string;
345
- readonly media_type: string | null;
346
- readonly name: string | null;
347
- readonly referrer: {
348
- readonly record: string;
349
- readonly room_ref: string;
350
- };
351
- readonly sha256: string;
352
- }[];
353
- readonly body: string | null;
354
- readonly claimed: unknown;
355
- readonly created_at: string;
356
423
  readonly record: string;
357
424
  readonly ref: string;
425
+ readonly created_at: string;
426
+ readonly body: string | null;
427
+ readonly claimed: unknown;
358
428
  } | {
359
- readonly next_cursor?: string;
360
429
  readonly records: readonly {
361
- readonly attachments: readonly {
362
- readonly bytes: number;
363
- readonly file: string;
364
- readonly media_type: string | null;
365
- readonly name: string | null;
366
- readonly referrer: {
367
- readonly record: string;
368
- readonly room_ref: string;
369
- };
370
- readonly sha256: string;
371
- }[];
372
- readonly body: string | null;
373
- readonly claimed: unknown;
374
- readonly created_at: string;
375
430
  readonly record: string;
376
431
  readonly ref: string;
432
+ readonly created_at: string;
433
+ readonly body: string | null;
434
+ readonly claimed: unknown;
377
435
  }[];
436
+ readonly next_cursor?: string;
378
437
  };
379
438
  };
380
439
  readonly 'relay.read': {
@@ -880,6 +939,10 @@ export interface HouseMethods {
880
939
  readonly position: number;
881
940
  readonly outcome: 'requested';
882
941
  readonly request: string;
942
+ } | {
943
+ readonly position: number;
944
+ readonly outcome: 'continued';
945
+ readonly request: string;
883
946
  } | {
884
947
  readonly position: number;
885
948
  readonly outcome: 'refused';
@@ -888,12 +951,12 @@ export interface HouseMethods {
888
951
  readonly position: number;
889
952
  readonly outcome: 'refused';
890
953
  readonly code: 'limit_reached';
891
- readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'external_calls' | 'routine_requests' | 'routine_mail';
954
+ readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'mcp_reads' | 'mcp_downloads' | 'external_calls' | 'routine_requests' | 'routine_mail';
892
955
  } | {
893
956
  readonly position: number;
894
957
  readonly outcome: 'refused';
895
958
  readonly code: 'limit_reached';
896
- readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'external_calls' | 'routine_requests' | 'routine_mail';
959
+ readonly limit: 'sites' | 'custom_domains' | 'publish_data' | 'site_submissions' | 'mcp_reads' | 'mcp_downloads' | 'external_calls' | 'routine_requests' | 'routine_mail';
897
960
  readonly retry_at: string;
898
961
  } | {
899
962
  readonly position: number;
@@ -917,23 +980,16 @@ export interface HouseMethods {
917
980
  readonly limit: 'writes';
918
981
  readonly period: 'minute' | 'day';
919
982
  readonly retry_at: string;
920
- } | {
921
- readonly position: number;
922
- readonly outcome: 'refused';
923
- readonly code: 'limit_reached';
924
- readonly limit: 'mcp_reads' | 'mcp_downloads';
925
- readonly value: string;
926
- readonly retry_at: string;
927
983
  } | {
928
984
  readonly position: number;
929
985
  readonly outcome: 'refused';
930
986
  readonly code: 'cap_reached';
931
- 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' | 'open_uploads';
987
+ 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' | 'folder_subscriptions';
932
988
  } | {
933
989
  readonly position: number;
934
990
  readonly outcome: 'refused';
935
991
  readonly code: 'cap_reached';
936
- 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' | 'open_uploads';
992
+ 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' | 'folder_subscriptions';
937
993
  readonly retry_at: string;
938
994
  } | {
939
995
  readonly position: number;
@@ -121,7 +121,6 @@ export type ItemFacts = {
121
121
  readonly delivery: string;
122
122
  readonly source: string | null;
123
123
  readonly address: string | null;
124
- readonly has_attachment: boolean;
125
124
  readonly container: string | null;
126
125
  readonly author: string | null;
127
126
  readonly headers: Readonly<Record<string, string>>;
@@ -60,6 +60,7 @@ export declare const JSON_TYPES: readonly JsonType[];
60
60
  export declare const BUILT_IN_TYPE = "any";
61
61
  export declare const ATTACHMENT = "attachment";
62
62
  export declare const ARRAY_INDEX: RegExp;
63
+ export declare const JSON_POINTER: RegExp;
63
64
  export declare function escapePointer(key: string): string;
64
65
  export declare function pointerSegments(pointer: string): string[];
65
66
  export declare function refTarget(reference: string, defs: Readonly<Record<string, unknown>>): {
@@ -10,10 +10,11 @@ export type { RoomTarget } from './paths.js';
10
10
  export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
11
11
  export { project } from './project.js';
12
12
  export { references } from './references.js';
13
- export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
13
+ export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
14
14
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
15
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 { bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verify, } from './validate.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';
@@ -6,5 +6,26 @@ export declare function checkDocument(file: string, content: string, model: Veri
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 {};
@@ -269,20 +269,32 @@ export type HeadChange = {
269
269
  time: string;
270
270
  };
271
271
  export type BinaryFile = {
272
- fileRef: string;
273
272
  byteLength: number;
274
273
  mediaType: string;
275
274
  sha256: string;
276
275
  };
276
+ export type HeldFile = {
277
+ readonly path: string;
278
+ readonly revision: string;
279
+ };
277
280
  export type HeldContent = {
278
- documents: Readonly<Record<string, string>>;
279
- revisions: Readonly<Record<string, string>>;
281
+ files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
282
+ contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
283
+ readonly content: string;
284
+ readonly revision: string;
285
+ }>>;
280
286
  };
281
287
  export type BootstrapRequest = {
282
288
  locator: string;
283
289
  selection: string;
284
290
  pageToken?: PageToken;
285
291
  held?: HeldContent;
292
+ received?: Uint8Array;
293
+ arriving?: (bytes: number) => void;
294
+ };
295
+ export type BootstrapInventory = {
296
+ readonly parts: number;
297
+ readonly bytes: number;
286
298
  };
287
299
  export type RoomModels = {
288
300
  collection?: ModelResult;
@@ -297,7 +309,10 @@ export type BootstrapPage = {
297
309
  fileIds?: Readonly<Record<string, string>>;
298
310
  changes: Readonly<Record<string, HeadChange>>;
299
311
  binaryFiles: Readonly<Record<string, BinaryFile>>;
312
+ folders?: readonly string[];
300
313
  pageToken?: PageToken;
314
+ inventory?: BootstrapInventory;
315
+ received?: Uint8Array;
301
316
  };
302
317
  export type BootstrapResult = BootstrapPage | {
303
318
  kind: 'beyond-horizon';
@@ -318,6 +333,8 @@ export type RefreshPage = {
318
333
  changes: Readonly<Record<string, HeadChange>>;
319
334
  binaryFiles: Readonly<Record<string, BinaryFile>>;
320
335
  removals: readonly string[];
336
+ folders?: readonly string[];
337
+ folderRemovals?: readonly string[];
321
338
  pageToken?: PageToken;
322
339
  };
323
340
  export type RefreshResult = {
@@ -402,15 +419,6 @@ export type BinaryRequest = {
402
419
  locator: string;
403
420
  path: string;
404
421
  revision: string;
405
- fileRef?: string;
406
- } | {
407
- kind: 'reference';
408
- fileRef: string;
409
- referrer: unknown;
410
- };
411
- export type ReferrerScope = {
412
- locator: string;
413
- path?: string;
414
422
  };
415
423
  export type BinaryResult = {
416
424
  kind: 'binary';
@@ -445,9 +453,8 @@ export type ActionResult = {
445
453
  export type HeldRoom = {
446
454
  locator: string;
447
455
  roomVersion: string;
448
- documents: Readonly<Record<string, string>>;
449
- revisions: Readonly<Record<string, string>>;
450
456
  };
457
+ export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
451
458
  export type RoomStreamEvent = {
452
459
  kind: 'opened';
453
460
  } | {
@@ -482,7 +489,7 @@ export type RoomStream = {
482
489
  hold(rooms: readonly HeldRoom[]): void;
483
490
  reopen(): void;
484
491
  published(locator: string, roomVersion: string): void;
485
- observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
492
+ observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
486
493
  };
487
494
  export type Adapter = {
488
495
  readonly localSaves?: true;
@@ -495,10 +502,7 @@ export type Adapter = {
495
502
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
496
503
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
497
504
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
498
- link(authorization: Authorization, request: Extract<BinaryRequest, {
499
- kind: 'path';
500
- }>): Promise<BinaryLinkResult>;
501
- referrerScope(referrer: unknown): ReferrerScope | null;
505
+ link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
502
506
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
503
507
  reached(locator: string, roomVersion: string, target: string): boolean;
504
508
  follows(locator: string, roomVersion: string, next: string): boolean;
@@ -3,7 +3,6 @@ export type BinaryFileRecord = {
3
3
  readonly state: 'accepted';
4
4
  readonly revision: string;
5
5
  readonly path: string;
6
- readonly fileRef: string;
7
6
  readonly byteLength: number;
8
7
  readonly mediaType: string;
9
8
  readonly sha256: string;
@@ -15,8 +14,4 @@ export type BinaryFileRecord = {
15
14
  readonly mediaType: string;
16
15
  readonly sha256: string;
17
16
  };
18
- export type BinaryReference = {
19
- readonly fileRef: string;
20
- readonly referrer: unknown;
21
- };
22
17
  export declare function binaryRecord(path: string, held: HeldBinary, revision: string | undefined): BinaryFileRecord;
@@ -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,15 +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[];
8
- };
9
- export type MessageChange = {
10
- conversation: string;
11
- identity: string;
12
- text: string | null;
2
+ readonly locator: string;
3
+ readonly path: string | null;
13
4
  };
14
5
  export type ChangeSet = {
15
6
  documents: readonly DocumentChange[];
@@ -20,18 +11,17 @@ export type ChangeSet = {
20
11
  rooms: readonly string[];
21
12
  queues: readonly string[];
22
13
  presentations: readonly string[];
23
- messages: readonly MessageChange[];
24
14
  conversations: readonly string[];
25
15
  };
26
16
  type Changed = {
17
+ documents?: readonly string[] | null;
27
18
  drafts?: readonly string[];
28
19
  room?: boolean;
29
20
  queue?: boolean;
30
21
  presentation?: string;
31
22
  };
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;
35
- export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
23
+ export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
24
+ export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
36
25
  export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
26
+ export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
37
27
  export {};
@@ -2,7 +2,6 @@ import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts,
2
2
  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
- import type { BinaryReference } from './binary.js';
6
5
  import type { ChosenFile } from './file.js';
7
6
  import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
8
7
  import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
@@ -54,7 +53,6 @@ export type MdRuntimeClient = {
54
53
  binaryFile: {
55
54
  read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
56
55
  link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
57
- readReference(reference: BinaryReference): Promise<BinaryAnswer>;
58
56
  };
59
57
  call(name: string, input: unknown): Promise<CallResult>;
60
58
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
@@ -85,6 +83,7 @@ export type MdRuntimeClient = {
85
83
  };
86
84
  export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
87
85
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
86
+ export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
88
87
  export type { Observation } from './observation.js';
89
88
  export type { Open } from './open.js';
90
89
  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,15 @@
1
+ import type { Plan, QueryRows } from './query.js';
2
+ import type { Connection, Value } from './tables.js';
3
+ export type QueryRoom = {
4
+ readonly locator: string;
5
+ readonly key: number;
6
+ };
7
+ export type Fragment = {
8
+ readonly sql: string;
9
+ readonly bind: readonly Value[];
10
+ };
11
+ export type QueryAnswer = QueryRows & {
12
+ readonly more?: string;
13
+ };
14
+ export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
15
+ export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
@@ -7,14 +7,13 @@ import { type Adapter, type Authorization, type Member, type ProviderRefusal, ty
7
7
  import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
8
8
  import { type WrittenBy } from './change.js';
9
9
  import type { Open } from './open.js';
10
- import { type BinaryReference } from './binary.js';
11
10
  import { type BinaryLinkAnswer, type CallResult, type HeldBinaryAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
12
11
  import { type Recovery } from './recovery.js';
13
12
  import { type SaveRefusal } from './save.js';
14
13
  import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
15
14
  import { type SyncStatus } from './status.js';
16
15
  import { type RuntimeShell } from './durability.js';
17
- import { type CapacityCause, type CodeAvailability, type Persistence, type Readiness, type SearchObligation } from './readiness.js';
16
+ import { type CodeAvailability, type Persistence, type Readiness, type SearchObligation, type Space } from './readiness.js';
18
17
  import type { RuntimeDatabase } from './tables.js';
19
18
  import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
20
19
  export type AppTypedSelection = {
@@ -72,7 +71,7 @@ export type SavedParts = {
72
71
  };
73
72
  export type RoomDraftSurface = {
74
73
  list(): Promise<readonly RoomDraft[]>;
75
- read(room: string, path: string): RoomDraft | null;
74
+ read(room: string, path: string): Promise<RoomDraft | null>;
76
75
  write(room: string, path: string, revision: string | null, parts: unknown): Promise<RoomDraftWrite>;
77
76
  discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
78
77
  };
@@ -84,7 +83,6 @@ export type PresentationSurface = {
84
83
  export type BinaryFileSurface = {
85
84
  read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
86
85
  link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
87
- readReference(reference: BinaryReference): Promise<HeldBinaryAnswer>;
88
86
  part(file: string, part: number): Promise<Uint8Array | null>;
89
87
  };
90
88
  export type HistoryQuery = {
@@ -110,7 +108,7 @@ export type MdRuntime = {
110
108
  resolve(room: string, path: string, destination: string): Promise<Resolution>;
111
109
  binaryFile: BinaryFileSurface;
112
110
  call(name: string, input: unknown): Promise<CallResult>;
113
- reached(locator: string, roomVersion: string, path?: string): boolean;
111
+ reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
114
112
  log(): string;
115
113
  persistence(): boolean;
116
114
  retry(): Promise<void>;
@@ -138,7 +136,7 @@ export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'stora
138
136
  export type ReadinessPort = {
139
137
  readonly target: string;
140
138
  readonly code: CodeAvailability;
141
- readonly capacity: CapacityCause | null;
139
+ readonly space: Space | null;
142
140
  readonly search: SearchObligation;
143
141
  };
144
142
  export type ComposedRuntime = RuntimeView & {
@@ -146,6 +144,7 @@ export type ComposedRuntime = RuntimeView & {
146
144
  stop(): Promise<void>;
147
145
  lose(locators: readonly string[]): Promise<void>;
148
146
  persisted(answer: Persistence): void;
147
+ shown(onScreen: boolean): void;
149
148
  within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
150
149
  };
151
150
  export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
@@ -79,12 +79,13 @@ export type ChatDraftSurface = {
79
79
  };
80
80
  export type ConversationDependencies = {
81
81
  agents(): ConversationAgents | undefined;
82
- documents(agents: ConversationAgents): Promise<DocumentResult | PendingResult>;
82
+ documents(agents: ConversationAgents, after: string | undefined): Promise<DocumentResult | PendingResult>;
83
83
  call(name: ConversationAction, input: unknown): Promise<CallResult>;
84
84
  durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
85
85
  stream(): ConversationStream | undefined;
86
86
  publish(set: ChangeSet): void;
87
87
  online(): boolean;
88
+ full(): boolean;
88
89
  closed(): boolean;
89
90
  unanswered(): void;
90
91
  expired(operation: string): boolean;
@@ -1,15 +1,12 @@
1
1
  import type { Persistence } from './readiness.js';
2
- export type StorageEstimate = {
3
- readonly usage: number;
4
- readonly total: number;
5
- };
6
2
  export type RuntimeShell = {
7
3
  persistence: Persistence;
8
4
  generation: string | null;
5
+ onScreen: boolean;
9
6
  keepGeneration(value: string): void | Promise<void>;
10
7
  dropGeneration(): void | Promise<void>;
11
- estimate?(): Promise<StorageEstimate | null>;
12
8
  cleanUp?(): Promise<number>;
13
9
  };
10
+ export declare function refusedForSpace(error: unknown): boolean;
14
11
  export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
15
12
  export declare function nextGeneration(stored: string | null, reported: string | null): string;
@@ -0,0 +1,26 @@
1
+ import { type QueryRoom } from './compile.js';
2
+ import type { Plan } from './query.js';
3
+ import type { HitCursor, SearchWindow } from './search.js';
4
+ import type { Connection } from './tables.js';
5
+ export declare const SEARCH_TABLES: readonly string[];
6
+ export type SearchAsk = {
7
+ readonly text: string;
8
+ readonly limit: number;
9
+ readonly after: readonly [HitCursor, HitCursor] | null;
10
+ readonly total: boolean;
11
+ readonly documents: {
12
+ readonly plan: Plan;
13
+ readonly rooms: readonly QueryRoom[];
14
+ readonly beneath: readonly {
15
+ readonly key: number;
16
+ readonly roots: readonly string[];
17
+ }[];
18
+ } | null;
19
+ readonly conversations: readonly string[];
20
+ };
21
+ export declare function indexDocument(connection: Connection, id: number, path: string, content: string): void;
22
+ export declare function indexMessage(connection: Connection, id: number, text: string): void;
23
+ export declare function unindexDocuments(connection: Connection, ids: Iterable<number>): void;
24
+ export declare function unindexMessages(connection: Connection, ids: Iterable<number>): void;
25
+ export declare function unindexAll(connection: Connection): void;
26
+ export declare function searched(connection: Connection, ask: SearchAsk): SearchWindow;
@@ -0,0 +1,27 @@
1
+ import type { AcceptedMessage } from './adapter.js';
2
+ import type { Connection } from './tables.js';
3
+ export declare const MESSAGE_TABLES: readonly string[];
4
+ export type HeldConversation = {
5
+ readonly conversation: string;
6
+ readonly read: string | null | undefined;
7
+ readonly partial: boolean;
8
+ };
9
+ export type MessageWindow = {
10
+ readonly messages: AcceptedMessage[];
11
+ readonly more: boolean;
12
+ };
13
+ export type ConversationWrite = {
14
+ readonly conversation: string;
15
+ readonly messages: readonly AcceptedMessage[];
16
+ readonly read?: {
17
+ readonly at: string | null;
18
+ readonly partial: boolean;
19
+ };
20
+ };
21
+ export declare function heldConversations(connection: Connection): HeldConversation[];
22
+ export declare function keptMessages(connection: Connection, { conversation, messages, read }: ConversationWrite): null;
23
+ export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null): MessageWindow;
24
+ export declare function messageCount(connection: Connection, conversation: string): number;
25
+ export declare function turnArrived(connection: Connection, conversation: string, turn: string): boolean;
26
+ export declare function droppedMessages(connection: Connection, conversations: readonly string[]): void;
27
+ export declare function forgottenMessages(connection: Connection): void;