@agentshouse/app-bridge 0.1.0-c4999e714a13d → 0.1.0-c4eb6deb151a4

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
@@ -420,42 +420,20 @@ export interface HouseMethods {
420
420
  readonly order?: 'asc' | 'desc';
421
421
  };
422
422
  readonly result: {
423
- readonly attachments: readonly {
424
- readonly bytes: number;
425
- readonly file: string;
426
- readonly media_type: string | null;
427
- readonly name: string | null;
428
- readonly referrer: {
429
- readonly record: string;
430
- readonly room_ref: string;
431
- };
432
- readonly sha256: string;
433
- }[];
434
- readonly body: string | null;
435
- readonly claimed: unknown;
436
- readonly created_at: string;
437
423
  readonly record: string;
438
424
  readonly ref: string;
425
+ readonly created_at: string;
426
+ readonly body: string | null;
427
+ readonly claimed: unknown;
439
428
  } | {
440
- readonly next_cursor?: string;
441
429
  readonly records: readonly {
442
- readonly attachments: readonly {
443
- readonly bytes: number;
444
- readonly file: string;
445
- readonly media_type: string | null;
446
- readonly name: string | null;
447
- readonly referrer: {
448
- readonly record: string;
449
- readonly room_ref: string;
450
- };
451
- readonly sha256: string;
452
- }[];
453
- readonly body: string | null;
454
- readonly claimed: unknown;
455
- readonly created_at: string;
456
430
  readonly record: string;
457
431
  readonly ref: string;
432
+ readonly created_at: string;
433
+ readonly body: string | null;
434
+ readonly claimed: unknown;
458
435
  }[];
436
+ readonly next_cursor?: string;
459
437
  };
460
438
  };
461
439
  readonly 'relay.read': {
@@ -1006,12 +984,12 @@ export interface HouseMethods {
1006
984
  readonly position: number;
1007
985
  readonly outcome: 'refused';
1008
986
  readonly code: 'cap_reached';
1009
- 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';
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';
1010
988
  } | {
1011
989
  readonly position: number;
1012
990
  readonly outcome: 'refused';
1013
991
  readonly code: 'cap_reached';
1014
- 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';
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';
1015
993
  readonly retry_at: string;
1016
994
  } | {
1017
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,7 +10,7 @@ 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
16
  export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.js';
@@ -290,6 +290,12 @@ export type BootstrapRequest = {
290
290
  selection: string;
291
291
  pageToken?: PageToken;
292
292
  held?: HeldContent;
293
+ received?: Uint8Array;
294
+ arriving?: (bytes: number) => void;
295
+ };
296
+ export type BootstrapInventory = {
297
+ readonly parts: number;
298
+ readonly bytes: number;
293
299
  };
294
300
  export type RoomModels = {
295
301
  collection?: ModelResult;
@@ -306,6 +312,8 @@ export type BootstrapPage = {
306
312
  binaryFiles: Readonly<Record<string, BinaryFile>>;
307
313
  folders?: readonly string[];
308
314
  pageToken?: PageToken;
315
+ inventory?: BootstrapInventory;
316
+ received?: Uint8Array;
309
317
  };
310
318
  export type BootstrapResult = BootstrapPage | {
311
319
  kind: 'beyond-horizon';
@@ -2,11 +2,6 @@ export type DocumentChange = {
2
2
  readonly locator: string;
3
3
  readonly path: string | null;
4
4
  };
5
- export type MessageChange = {
6
- conversation: string;
7
- identity: string;
8
- text: string | null;
9
- };
10
5
  export type ChangeSet = {
11
6
  documents: readonly DocumentChange[];
12
7
  drafts: readonly {
@@ -16,7 +11,6 @@ export type ChangeSet = {
16
11
  rooms: readonly string[];
17
12
  queues: readonly string[];
18
13
  presentations: readonly string[];
19
- messages: readonly MessageChange[];
20
14
  conversations: readonly string[];
21
15
  };
22
16
  type Changed = {
@@ -27,7 +21,7 @@ type Changed = {
27
21
  presentation?: string;
28
22
  };
29
23
  export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
30
- export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
24
+ export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
31
25
  export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
32
26
  export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
33
27
  export {};
@@ -1,10 +1,15 @@
1
1
  import type { Plan, QueryRows } from './query.js';
2
- import type { Connection } from './tables.js';
2
+ import type { Connection, Value } from './tables.js';
3
3
  export type QueryRoom = {
4
4
  readonly locator: string;
5
5
  readonly key: number;
6
6
  };
7
+ export type Fragment = {
8
+ readonly sql: string;
9
+ readonly bind: readonly Value[];
10
+ };
7
11
  export type QueryAnswer = QueryRows & {
8
12
  readonly more?: string;
9
13
  };
14
+ export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
10
15
  export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
@@ -146,6 +146,7 @@ export type ComposedRuntime = RuntimeView & {
146
146
  stop(): Promise<void>;
147
147
  lose(locators: readonly string[]): Promise<void>;
148
148
  persisted(answer: Persistence): void;
149
+ shown(onScreen: boolean): void;
149
150
  within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
150
151
  };
151
152
  export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
@@ -6,6 +6,7 @@ export type StorageEstimate = {
6
6
  export type RuntimeShell = {
7
7
  persistence: Persistence;
8
8
  generation: string | null;
9
+ onScreen: boolean;
9
10
  keepGeneration(value: string): void | Promise<void>;
10
11
  dropGeneration(): void | Promise<void>;
11
12
  estimate?(): Promise<StorageEstimate | null>;
@@ -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;
@@ -58,6 +58,7 @@ export type Select = 'all' | {
58
58
  backlinks?: true;
59
59
  change?: true;
60
60
  fileId?: true;
61
+ revision?: true;
61
62
  };
62
63
  export type OrderOptions = {
63
64
  nulls?: 'first' | 'last';
@@ -103,6 +104,7 @@ export type QueryDocument = {
103
104
  backlinks?: readonly Backlink[];
104
105
  change?: HeadChange | null;
105
106
  fileId?: string | null;
107
+ revision?: string | null;
106
108
  binaryFile?: BinaryFileRecord;
107
109
  };
108
110
  export type QueryGroup = {
@@ -119,7 +121,7 @@ export type QueryCoverage = {
119
121
  indexes: readonly string[];
120
122
  overlay: readonly string[];
121
123
  };
122
- export type Awaits = Open<'acquisition' | 'preparation' | 'index' | 'unlock'>;
124
+ export type Awaits = Open<'acquisition' | 'preparation' | 'unlock'>;
123
125
  export type PendingRoom = {
124
126
  room: string;
125
127
  awaits: Awaits;
@@ -214,6 +216,7 @@ export type DocumentShape = {
214
216
  backlinks: boolean;
215
217
  change: boolean;
216
218
  fileId: boolean;
219
+ revision: boolean;
217
220
  orderBy: readonly {
218
221
  key: KeyPlan;
219
222
  options: OrderOptions & {
@@ -1,11 +1,11 @@
1
1
  import type { Open } from './open.js';
2
2
  export type CodeAvailability = Open<'stored' | 'absent'>;
3
- export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'indexing' | 'refused' | 'unadmitted'>;
3
+ export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'refused' | 'unadmitted'>;
4
4
  export type RoomCoverage = {
5
5
  readonly room: string;
6
6
  readonly state: RoomPreparation;
7
7
  };
8
- export type ConversationCoverage = Open<'complete' | 'acquiring' | 'indexing' | 'undeclared'>;
8
+ export type ConversationCoverage = Open<'complete' | 'acquiring' | 'undeclared'>;
9
9
  export type SearchObligation = Open<'required' | 'unused'>;
10
10
  export type TargetCoverage = {
11
11
  readonly complete: boolean;
@@ -29,6 +29,20 @@ export type RefusedRoom = {
29
29
  readonly rule: string;
30
30
  readonly location: string | null;
31
31
  };
32
+ export type InstallationStep = Open<'listing' | 'downloading' | 'writing' | 'replaying'>;
33
+ export type InstallationPause = Open<'hidden'>;
34
+ export type InstallationAmount = {
35
+ readonly done: number;
36
+ readonly total: number;
37
+ };
38
+ export type Installation = {
39
+ readonly step: InstallationStep | null;
40
+ readonly paused: InstallationPause | null;
41
+ readonly rooms: InstallationAmount;
42
+ readonly parts: InstallationAmount;
43
+ readonly bytes: InstallationAmount;
44
+ readonly received: InstallationAmount;
45
+ };
32
46
  export type ReadinessStatus = Open<'preparing' | 'paused' | 'refused' | 'ready' | 'lost'>;
33
47
  export type Readiness = {
34
48
  readonly status: ReadinessStatus;
@@ -41,6 +55,7 @@ export type Readiness = {
41
55
  readonly connection: ConnectionAvailability;
42
56
  readonly house: HouseOutcome;
43
57
  readonly capacity: CapacityCause | null;
58
+ readonly installation: Installation;
44
59
  readonly refused: readonly RefusedRoom[];
45
60
  readonly lost: boolean;
46
61
  };
@@ -1,4 +1,4 @@
1
- import type { MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
1
+ import type { BootstrapInventory, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
2
2
  import { type ChangeBatch, type Precondition } from './change.js';
3
3
  import { type Collection, type Composition } from './collection.js';
4
4
  import type { ModelState } from './model.js';
@@ -16,6 +16,7 @@ export type ReplicaRecord = {
16
16
  readonly providerOwnedPaths: readonly string[];
17
17
  readonly roomVersion: string;
18
18
  readonly transfer: string;
19
+ readonly inventory: BootstrapInventory | null;
19
20
  readonly key: number;
20
21
  };
21
22
  export type HeldReplica = {
@@ -24,6 +25,7 @@ export type HeldReplica = {
24
25
  readonly overlaid: ReadonlySet<string>;
25
26
  readonly count: number;
26
27
  readonly confirmed: number;
28
+ readonly indexed: boolean;
27
29
  };
28
30
  export type VisibleLayer = Layer & {
29
31
  readonly collection: Collection;
@@ -1,5 +1,4 @@
1
1
  import type { ProviderRefusal } from './adapter.js';
2
- import type { ChangeSet } from './change-set.js';
3
2
  import { type CoveredRoom, type Filter, type PendingRoom } from './query.js';
4
3
  import type { Open } from './open.js';
5
4
  export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
@@ -12,29 +11,32 @@ export type SearchRequest = {
12
11
  after?: string;
13
12
  total?: true;
14
13
  };
14
+ export type MessagePart = Open<'text'>;
15
+ export type Snippet<Part extends string> = {
16
+ part: Part;
17
+ text: string;
18
+ at: readonly [number, number];
19
+ };
15
20
  export type DocumentHit = {
16
21
  room: string;
17
22
  path: string;
18
23
  type: string;
19
24
  score: number;
20
25
  matches: Readonly<Record<string, readonly DocumentPart[]>>;
26
+ snippet?: Snippet<DocumentPart>;
21
27
  };
22
28
  export type MessageHit = {
23
29
  conversation: string;
24
30
  identity: string;
25
31
  score: number;
26
- matches: Readonly<Record<string, readonly Open<'text'>[]>>;
32
+ matches: Readonly<Record<string, readonly MessagePart[]>>;
33
+ snippet?: Snippet<MessagePart>;
27
34
  };
28
35
  export type SearchCoverage = {
29
36
  rooms: readonly CoveredRoom[];
30
37
  conversations: readonly string[];
31
- index: string;
32
38
  overlay: readonly string[];
33
39
  };
34
- export type PendingConversation = {
35
- conversation: string;
36
- awaits: Open<'index'>;
37
- };
38
40
  export type SearchHits = {
39
41
  documents: readonly DocumentHit[];
40
42
  messages: readonly MessageHit[];
@@ -47,7 +49,7 @@ export type SearchWindow = SearchHits & {
47
49
  };
48
50
  };
49
51
  export type SearchPending = SearchHits & {
50
- pending: readonly (PendingRoom | PendingConversation)[];
52
+ pending: readonly PendingRoom[];
51
53
  coverage: SearchCoverage;
52
54
  };
53
55
  export type SearchUndeclared = ProviderRefusal & {
@@ -57,24 +59,7 @@ export type SearchResult = (SearchWindow & {
57
59
  coverage: SearchCoverage;
58
60
  }) | SearchPending | SearchUndeclared;
59
61
  export declare function undeclaredSearch(): SearchUndeclared;
60
- export type SearchedDocument = {
61
- room: string;
62
- path: string;
63
- type: string;
64
- fields: Readonly<Record<string, unknown>>;
65
- preamble: string;
66
- sections: Readonly<Record<string, string>>;
67
- };
68
- export type SearchedMessage = {
69
- conversation: string;
70
- identity: string;
71
- text: string;
72
- };
73
- export type SearchSource = {
74
- room(room: string): AsyncIterable<readonly SearchedDocument[]>;
75
- documents(room: string, paths: readonly string[]): Promise<readonly SearchedDocument[]>;
76
- };
77
- type HitCursor = readonly [number, string, string] | readonly [] | null;
62
+ export type HitCursor = readonly [number, string, string] | readonly [] | null;
78
63
  export type SearchPlan = {
79
64
  text: string;
80
65
  documents: unknown;
@@ -84,21 +69,4 @@ export type SearchPlan = {
84
69
  after: readonly [HitCursor, HitCursor] | null;
85
70
  total: boolean;
86
71
  };
87
- export type SearchIndex = {
88
- generation(): string;
89
- rooms(): ReadonlySet<string>;
90
- conversations(): ReadonlySet<string>;
91
- indexRoom(room: string): Promise<void>;
92
- indexMessages(conversation: string, messages: readonly SearchedMessage[], whole: boolean): void;
93
- forget(rooms: readonly string[]): void;
94
- changed(set: ChangeSet): void;
95
- changes(): number;
96
- caughtUp(): Promise<void>;
97
- search(plan: SearchPlan, documents: readonly {
98
- room: string;
99
- path: string;
100
- }[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null, selections: ReadonlyMap<string, readonly string[]> | null): SearchWindow;
101
- };
102
72
  export declare function searchPlanOf(input: unknown): SearchPlan;
103
- export declare function createSearchIndex(source: SearchSource): SearchIndex;
104
- export {};
@@ -1,16 +1,18 @@
1
- import type { Capability, Member, ProviderLimit } from './adapter.js';
2
- import type { AcceptedMessage, KeptReceipt } from './adapter.js';
1
+ import type { BootstrapInventory, Capability, KeptReceipt, Member, ProviderLimit } from './adapter.js';
3
2
  import type { ChangeBatch } from './change.js';
4
3
  import type { Composition } from './collection.js';
5
4
  import type { Plan } from './query.js';
6
5
  import type { ReplicaRecord } from './replica.js';
7
- import type { Later } from './turn.js';
8
6
  import type { Submission } from './outcome.js';
9
7
  import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
10
8
  import type { ModelState } from './model.js';
11
- import type { SearchedDocument } from './search.js';
12
- import type { CommittedWrite, CountedRoom, HeldEntry, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View, Walked } from './tables.js';
13
- export declare const STORE_SCHEMA = 26;
9
+ import type { SearchWindow } from './search.js';
10
+ import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View, Walked } from './tables.js';
11
+ export type { ConversationWrite, HeldConversation, MessageWindow } from './tables.js';
12
+ export type TransferWriting = {
13
+ readonly token: string | null;
14
+ readonly written: number;
15
+ };
14
16
  export type TransferRecord = {
15
17
  readonly locator: string;
16
18
  readonly transfer: string;
@@ -18,6 +20,9 @@ export type TransferRecord = {
18
20
  readonly from: string;
19
21
  readonly last: string;
20
22
  readonly pageToken: string | null;
23
+ readonly writing: TransferWriting | null;
24
+ readonly inventory: BootstrapInventory | null;
25
+ readonly done: BootstrapInventory;
21
26
  readonly models: {
22
27
  readonly collection: ModelState;
23
28
  readonly selection: ModelState;
@@ -45,23 +50,6 @@ export type PresentationRecord = {
45
50
  app: string;
46
51
  value: unknown;
47
52
  };
48
- export type HeldConversation = {
49
- conversation: string;
50
- read: string | null | undefined;
51
- partial: boolean;
52
- };
53
- export type MessageWindow = {
54
- messages: AcceptedMessage[];
55
- more: boolean;
56
- };
57
- export type ConversationWrite = {
58
- conversation: string;
59
- messages: readonly AcceptedMessage[];
60
- read?: {
61
- at: string | null;
62
- partial: boolean;
63
- };
64
- };
65
53
  export type ChatSubmission = {
66
54
  readonly operation: string;
67
55
  readonly text: string;
@@ -102,7 +90,7 @@ export type RefreshedPage = StagedPage & {
102
90
  export type Opened = {
103
91
  readonly rooms: ReadonlyMap<string, ReplicaRecord>;
104
92
  readonly transfers: ReadonlyMap<string, TransferRecord>;
105
- readonly unprepared: ReadonlySet<number>;
93
+ readonly unindexed: ReadonlySet<number>;
106
94
  readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
107
95
  readonly erasing: boolean;
108
96
  readonly orphans: readonly number[];
@@ -134,11 +122,10 @@ export type RuntimeStore = {
134
122
  readonly revision: string;
135
123
  }[]>;
136
124
  typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
137
- searched(key: number, locator: string, after: string | null, limit: number, paths: readonly string[] | null): Promise<{
138
- readonly documents: readonly SearchedDocument[];
139
- readonly next: string | null;
140
- }>;
141
- stage(record: TransferRecord, composition: Composition, page: StagedPage, key: number | null, last: boolean): Promise<number | null>;
125
+ search(ask: SearchAsk): Promise<SearchWindow>;
126
+ stage(record: TransferRecord, composition: Composition, page: StagedPage, written?: string): Promise<number | null>;
127
+ transferPart(locator: string, token: string): Promise<Uint8Array | null>;
128
+ keepPart(locator: string, token: string, part: Uint8Array): Promise<void>;
142
129
  refresh(key: number, page: RefreshedPage): Promise<void>;
143
130
  unrefresh(key: number): Promise<void>;
144
131
  commit(commit: Commit): Promise<CommittedWrite>;
@@ -157,8 +144,6 @@ export type RuntimeStore = {
157
144
  keepMessages(write: ConversationWrite): Promise<void>;
158
145
  messageWindow(conversation: string, limit: number, before: readonly [string, string] | null): Promise<MessageWindow>;
159
146
  messageCount(conversation: string): Promise<number>;
160
- messagesAfter(conversation: string, identity: string | null): Promise<AcceptedMessage[]>;
161
- messageIdentities(conversation: string): Promise<readonly string[]>;
162
147
  turnArrived(conversation: string, turn: string): Promise<boolean>;
163
148
  dropConversations(conversations: readonly string[]): Promise<void>;
164
149
  chatDrafts(): Promise<readonly ChatDraftRecord[]>;
@@ -180,9 +165,5 @@ export type RuntimeStore = {
180
165
  generation(): Promise<string | null>;
181
166
  rememberGeneration(value: string): Promise<void>;
182
167
  file(key: string, type: string): Promise<Blob>;
183
- close(): void;
184
168
  };
185
- export declare function transacted<T>(database: IDBDatabase, stores: string | readonly string[], mode: IDBTransactionMode, work: (transaction: IDBTransaction) => Later<T>): Promise<T>;
186
- export declare function endRuntimeStore(database: RuntimeDatabase, holder: string | undefined): Promise<boolean>;
187
- export declare function openDatabase(name: string, version: number, upgrade: (opening: IDBOpenDBRequest, oldVersion: number) => void): Promise<IDBDatabase>;
188
- export declare function openRuntimeStore(fenced: (locator: string) => boolean, authored: RuntimeDatabase): Promise<RuntimeStore>;
169
+ export declare function openRuntimeStore(fenced: (locator: string) => boolean, authored: RuntimeDatabase): RuntimeStore;
@@ -1,7 +1,6 @@
1
1
  import type { HeadChange } from './adapter.js';
2
2
  import type { Composition } from './collection.js';
3
3
  import type { HeldBinary } from './overlay.js';
4
- import type { SearchedDocument } from './search.js';
5
4
  import type { Connection } from './tables.js';
6
5
  export declare const REPLICA_TABLES: readonly string[];
7
6
  export type View = 'confirmed' | 'visible' | 'refreshed';
@@ -85,7 +84,7 @@ export type RoomCommit = {
85
84
  export type Committed = {
86
85
  readonly counts: Readonly<Record<string, number>>;
87
86
  readonly changed: Readonly<Record<string, readonly string[] | null>>;
88
- readonly prepared: Readonly<Record<string, boolean>>;
87
+ readonly indexed: Readonly<Record<string, boolean>>;
89
88
  };
90
89
  export type CountedRoom = {
91
90
  readonly key: number;
@@ -100,11 +99,12 @@ export declare function entered(connection: Connection, locator: string, composi
100
99
  export declare function stage(connection: Connection, request: {
101
100
  readonly locator: string;
102
101
  readonly transfer: string;
103
- readonly record: string | null;
102
+ readonly record: string;
104
103
  readonly key: number | null;
105
104
  readonly composition: Composition;
106
105
  readonly entries: readonly StoredEntry[];
107
106
  readonly folders: readonly string[];
107
+ readonly written?: string;
108
108
  }): number;
109
109
  export declare function refreshing(connection: Connection, request: {
110
110
  readonly key: number;
@@ -134,9 +134,11 @@ export declare function files(connection: Connection, key: number, view: View, a
134
134
  readonly revision: string;
135
135
  }[];
136
136
  export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
137
- export declare function searched(connection: Connection, key: number, locator: string, after: string | null, limit: number, only: readonly string[] | null): {
138
- readonly documents: readonly SearchedDocument[];
139
- readonly next: string | null;
140
- };
137
+ export declare function transferPart(connection: Connection, locator: string, token: string): Uint8Array | null;
138
+ export declare function keepPart(connection: Connection, request: {
139
+ readonly locator: string;
140
+ readonly token: string;
141
+ readonly part: Uint8Array;
142
+ }): null;
141
143
  export declare function opened(connection: Connection): ReplicaOpened;
142
144
  export declare function ended(connection: Connection): void;
@@ -1,11 +1,15 @@
1
1
  import { type QueryAnswer, type QueryRoom } from './compile.js';
2
2
  import type { KeptReceipt } from './adapter.js';
3
3
  import type { Composition } from './collection.js';
4
+ import { type SearchAsk } from './fulltext.js';
5
+ import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
4
6
  import type { Plan } from './query.js';
5
- import type { SearchedDocument } from './search.js';
7
+ import type { SearchWindow } from './search.js';
6
8
  import { type Committed, type CountedRoom, type HeldEntry, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View, type Walked } from './stored.js';
7
9
  export type { Committed, CountedRoom, HeldEntry, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, Walked, } from './stored.js';
8
10
  export type { QueryAnswer, QueryRoom } from './compile.js';
11
+ export type { SearchAsk } from './fulltext.js';
12
+ export type { ConversationWrite, HeldConversation, MessageWindow } from './messages.js';
9
13
  export type Value = string | number | bigint | Uint8Array | null;
10
14
  export type Row = Readonly<Record<string, Value>>;
11
15
  export interface Connection {
@@ -191,16 +195,7 @@ export interface RuntimeRequests {
191
195
  readonly 'replica.counts': Asked<{
192
196
  readonly rooms: readonly CountedRoom[];
193
197
  }, readonly number[]>;
194
- readonly 'replica.searched': Asked<{
195
- readonly key: number;
196
- readonly locator: string;
197
- readonly after: string | null;
198
- readonly limit: number;
199
- readonly paths: readonly string[] | null;
200
- }, {
201
- readonly documents: readonly SearchedDocument[];
202
- readonly next: string | null;
203
- }>;
198
+ readonly 'replica.search': Asked<SearchAsk, SearchWindow>;
204
199
  readonly 'replica.received': Asked<Nothing, readonly KeptReceipt[]>;
205
200
  readonly 'replica.receivedParts': Asked<{
206
201
  readonly key: string;
@@ -209,12 +204,22 @@ export interface RuntimeRequests {
209
204
  readonly 'replica.stage': Asked<{
210
205
  readonly locator: string;
211
206
  readonly transfer: string;
212
- readonly record: string | null;
207
+ readonly record: string;
213
208
  readonly key: number | null;
214
209
  readonly composition: Composition;
215
210
  readonly entries: readonly StoredEntry[];
216
211
  readonly folders: readonly string[];
212
+ readonly written?: string;
217
213
  }, number | null>;
214
+ readonly 'replica.transferPart': Asked<{
215
+ readonly locator: string;
216
+ readonly token: string;
217
+ }, Uint8Array | null>;
218
+ readonly 'replica.keepPart': Asked<{
219
+ readonly locator: string;
220
+ readonly token: string;
221
+ readonly part: Uint8Array;
222
+ }, null>;
218
223
  readonly 'replica.refresh': Asked<{
219
224
  readonly key: number;
220
225
  readonly entries: readonly StoredEntry[];
@@ -301,6 +306,23 @@ export interface RuntimeRequests {
301
306
  readonly key: string;
302
307
  readonly part: number;
303
308
  }, Uint8Array | null>;
309
+ readonly 'conversation.held': Asked<Nothing, readonly HeldConversation[]>;
310
+ readonly 'conversation.keep': Asked<ConversationWrite, null>;
311
+ readonly 'conversation.window': Asked<{
312
+ readonly conversation: string;
313
+ readonly limit: number;
314
+ readonly before: readonly [string, string] | null;
315
+ }, MessageWindow>;
316
+ readonly 'conversation.count': Asked<{
317
+ readonly conversation: string;
318
+ }, number>;
319
+ readonly 'conversation.turn': Asked<{
320
+ readonly conversation: string;
321
+ readonly turn: string;
322
+ }, boolean>;
323
+ readonly 'conversation.drop': Asked<{
324
+ readonly conversations: readonly string[];
325
+ }, null>;
304
326
  }
305
327
  export type RuntimeKind = keyof RuntimeRequests;
306
328
  export type RuntimeRequest<K extends RuntimeKind = RuntimeKind> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-c4999e714a13d",
3
+ "version": "0.1.0-c4eb6deb151a4",
4
4
  "description": "Types of the agents.house App bridge House hands every App: navigation, the tab title and icon, ceremonies, installation, notifications and the icon badge, status, Site image reads, App release code, App and Site screenshot reads, and App messages, with an accessor and an in-page test host.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,8 +0,0 @@
1
- export declare function yielded(): Promise<void>;
2
- export declare const ROW_WEIGHT = 256;
3
- export type Later<T> = T | Promise<T>;
4
- export declare function after<T, R>(value: Later<T>, next: (value: T) => Later<R>): Later<R>;
5
- export declare function paced(): (weight: number) => Later<void>;
6
- export declare function inUnits<T>(items: Iterable<T>, each: (item: T) => number, ended?: () => void, paused?: () => Promise<void>): Later<void>;
7
- export declare function finished<R>(steps: Generator<number, R, void>): R;
8
- export declare function stepped<R>(steps: Generator<number, R, void>): Later<R>;