@agentshouse/app-bridge 0.1.0-cdef4b9ba1d57 → 0.1.0-cdf1bbaf17a3f

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
@@ -16,18 +16,18 @@ export interface HouseMethods {
16
16
  readonly user_name: string;
17
17
  readonly entries: readonly {
18
18
  readonly namespace: string;
19
- readonly read: 'mcp' | 'online' | 'local' | null;
19
+ readonly level: 'search' | 'open' | 'keep' | null;
20
20
  readonly operations: readonly ('write' | 'delete' | 'export' | 'manageAccess')[];
21
21
  readonly sources: readonly {
22
22
  readonly kind: 'direct' | 'inherited';
23
23
  readonly namespace: string;
24
- readonly read: 'mcp' | 'online' | 'local' | null;
24
+ readonly level: 'search' | 'open' | 'keep' | null;
25
25
  readonly operations: readonly ('write' | 'delete' | 'export' | 'manageAccess')[];
26
26
  }[];
27
27
  }[];
28
28
  readonly direct: readonly {
29
29
  readonly namespace: string;
30
- readonly read: 'mcp' | 'online' | 'local' | null;
30
+ readonly level: 'search' | 'open' | 'keep' | null;
31
31
  readonly operations: readonly ('write' | 'delete' | 'export' | 'manageAccess')[];
32
32
  }[];
33
33
  readonly admitted_at: string | null;
@@ -346,7 +346,8 @@ export interface HouseMethods {
346
346
  readonly owner: boolean;
347
347
  readonly email?: string;
348
348
  readonly since: string | null;
349
- readonly access?: 'owner' | 'manage' | 'edit' | 'read';
349
+ readonly access?: 'owner' | 'manage' | 'edit' | 'keep' | 'open' | 'search';
350
+ readonly only_while_online?: true;
350
351
  readonly member_document: string | null;
351
352
  readonly schema_roles?: readonly string[];
352
353
  }[];
@@ -493,11 +494,7 @@ export interface HouseMethods {
493
494
  readonly reach: 'selected';
494
495
  readonly refs: readonly string[];
495
496
  };
496
- readonly accounts?: readonly {
497
- readonly id: string;
498
- readonly name: string;
499
- readonly origin: string;
500
- }[];
497
+ readonly key_origins?: readonly string[];
501
498
  readonly url: string;
502
499
  }[];
503
500
  };
@@ -610,16 +607,17 @@ export interface HouseMethods {
610
607
  readonly submitted: true;
611
608
  };
612
609
  };
613
- readonly 'triggerOccurrence.list': {
610
+ readonly 'triggerEvent.list': {
614
611
  readonly params: {
615
612
  readonly room_ref: string;
616
613
  };
617
614
  readonly result: {
618
- readonly occurrences: readonly {
615
+ readonly events: readonly {
619
616
  readonly trigger: string;
620
617
  readonly path?: string;
621
618
  readonly moment?: string;
622
619
  readonly missed?: 'skipped' | 'failed';
620
+ readonly code?: 'cap_reached';
623
621
  readonly created_at: string;
624
622
  readonly actions: readonly ({
625
623
  readonly position: number;
@@ -628,7 +626,7 @@ export interface HouseMethods {
628
626
  } | {
629
627
  readonly position: number;
630
628
  readonly outcome: 'no_target';
631
- readonly code: 'no_recipient' | 'routine_access_not_found' | 'routine_retired' | 'target_agent_unavailable';
629
+ readonly code: 'no_recipient' | 'routine_access_not_found' | 'routine_retired' | 'target_agent_unavailable' | 'app_not_found' | 'app_function_not_found';
632
630
  } | {
633
631
  readonly position: number;
634
632
  readonly outcome: 'requested';
@@ -678,12 +676,12 @@ export interface HouseMethods {
678
676
  readonly position: number;
679
677
  readonly outcome: 'refused';
680
678
  readonly code: 'cap_reached';
681
- 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';
679
+ readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'service_keys' | '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' | 'environment_functions' | 'folder_subscriptions';
682
680
  } | {
683
681
  readonly position: number;
684
682
  readonly outcome: 'refused';
685
683
  readonly code: 'cap_reached';
686
- 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';
684
+ readonly cap: 'address_submissions' | 'writes' | 'push_addresses' | 'push_deliveries' | 'service_keys' | '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' | 'environment_functions' | 'folder_subscriptions';
687
685
  readonly retry_at: string;
688
686
  } | {
689
687
  readonly position: number;
@@ -693,6 +691,27 @@ export interface HouseMethods {
693
691
  readonly position: number;
694
692
  readonly outcome: 'failed';
695
693
  readonly code: 'internal_error' | 'routine_request_not_started';
694
+ } | {
695
+ readonly position: number;
696
+ readonly outcome: 'failed';
697
+ readonly code: 'function_failed';
698
+ readonly error: string;
699
+ readonly release: string;
700
+ readonly final: true;
701
+ } | {
702
+ readonly position: number;
703
+ readonly outcome: 'failed';
704
+ readonly code: 'function_not_started';
705
+ readonly tries: number;
706
+ readonly final?: true;
707
+ } | {
708
+ readonly position: number;
709
+ readonly outcome: 'running';
710
+ readonly release: string;
711
+ } | {
712
+ readonly position: number;
713
+ readonly outcome: 'ran';
714
+ readonly release: string;
696
715
  } | {
697
716
  readonly position: number;
698
717
  readonly outcome: 'waiting';
package/dist/index.d.ts CHANGED
@@ -80,8 +80,6 @@ export interface HouseExternalRequest {
80
80
  readonly headers?: Readonly<Record<string, string>>;
81
81
  readonly body?: string;
82
82
  readonly body_base64?: string;
83
- readonly account?: string;
84
- readonly slot?: string;
85
83
  readonly room_ref?: string;
86
84
  }
87
85
  export type HouseExternalAnswer = {
@@ -120,20 +118,8 @@ export interface HouseBrowserRefused extends Error {
120
118
  readonly code: string;
121
119
  readonly retryable: boolean;
122
120
  }
123
- export interface HouseTrialWithheld {
124
- readonly code: Open<'house_trial_withheld'>;
125
- readonly retryable: true;
126
- }
127
- export type HouseTask = unknown;
128
- export type HouseActivation = Open<'committed' | 'abandoned'>;
129
121
  export interface HouseCooperation {
130
- checkpoint(): Promise<void> | void;
131
- persist(): Promise<void> | void;
132
- capture(): Promise<HouseTask> | HouseTask;
133
- restore(task: HouseTask | null): Promise<void> | void;
134
- ready(): Promise<boolean> | boolean;
135
- placed?(): Promise<void> | void;
136
- settle(activation: HouseActivation): void;
122
+ placed(): Promise<void> | void;
137
123
  }
138
124
  export type HouseChatWidth = 'full' | '3/4' | '1/2' | '1/3';
139
125
  export interface HouseChatOpened {
@@ -76,7 +76,11 @@ export type DateCondition = {
76
76
  readonly time_zone: string;
77
77
  readonly match?: ConditionTest;
78
78
  };
79
- export type Condition = DocumentCondition | ItemCondition | CronCondition | DateCondition;
79
+ export type NotificationCondition = {
80
+ readonly on: 'notifications';
81
+ readonly match?: ConditionTest;
82
+ };
83
+ export type Condition = DocumentCondition | ItemCondition | CronCondition | DateCondition | NotificationCondition;
80
84
  export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
81
85
  type Scalar = string | number | boolean;
82
86
  export type Fact = {
@@ -103,11 +107,13 @@ export type DocumentFacts = {
103
107
  readonly fields: Readonly<Record<string, Fact>>;
104
108
  readonly sections: readonly string[];
105
109
  };
106
- export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client'];
110
+ export declare const TEXT_FIELD = "/text";
111
+ export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client', 'function'];
107
112
  export type WriteDoor = (typeof WRITE_DOORS)[number];
108
113
  export type Actor = {
109
114
  readonly user?: string;
110
115
  readonly site?: string;
116
+ readonly app?: string;
111
117
  readonly door?: WriteDoor;
112
118
  };
113
119
  export type DocumentEvent = {
@@ -157,4 +163,5 @@ export declare function members(document: DocumentFacts, path: string): readonly
157
163
  export declare function holds(test: ConditionTest, document: DocumentFacts): Truth;
158
164
  export declare function fires(condition: DocumentCondition, event: DocumentEvent): boolean;
159
165
  export declare function itemFires(condition: ItemCondition, item: ItemFacts): boolean;
166
+ export declare function notificationFires(condition: NotificationCondition, notification: DocumentFacts): boolean;
160
167
  export {};
@@ -1,5 +1,5 @@
1
- export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, pointed, prosePaths, testOperators, valuedChange, WRITE_DOORS, } from './condition.js';
2
- export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, Resolved, WriteDoor, } from './condition.js';
1
+ export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, notificationFires, pointed, prosePaths, testOperators, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './condition.js';
2
+ export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, NotificationCondition, Resolved, WriteDoor, } from './condition.js';
3
3
  export { headingLines } from './blocks.js';
4
4
  export type { HeadingLine } from './blocks.js';
5
5
  export { divide } from './divide.js';
@@ -49,6 +49,7 @@ export type ListedConversation = {
49
49
  finished: string | null;
50
50
  outcome: string | null;
51
51
  waiting: boolean;
52
+ newest: string | null;
52
53
  };
53
54
  export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
54
55
  export type ConversationMessage = {
@@ -255,7 +256,7 @@ export type ContractUnavailable = ProviderRefusal & {
255
256
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
256
257
  export type PageToken = string;
257
258
  export type ChangeAuthor = {
258
- kind: Open<'user' | 'site' | 'inbox'>;
259
+ kind: Open<'user' | 'site' | 'inbox' | 'app'>;
259
260
  id: string;
260
261
  name: string;
261
262
  };
@@ -289,11 +290,10 @@ export type BootstrapRequest = {
289
290
  selection: string;
290
291
  pageToken?: PageToken;
291
292
  held?: HeldContent;
292
- received?: Uint8Array;
293
293
  arriving?: (bytes: number) => void;
294
+ signal?: AbortSignal;
294
295
  };
295
296
  export type BootstrapInventory = {
296
- readonly parts: number;
297
297
  readonly bytes: number;
298
298
  };
299
299
  export type RoomModels = {
@@ -310,8 +310,7 @@ export type BootstrapPage = {
310
310
  binaryFiles: Readonly<Record<string, BinaryFile>>;
311
311
  folders?: readonly string[];
312
312
  pageToken?: PageToken;
313
- inventory?: BootstrapInventory;
314
- received?: Uint8Array;
313
+ bytes?: number;
315
314
  };
316
315
  export type BootstrapResult = BootstrapPage | {
317
316
  kind: 'beyond-horizon';
@@ -386,7 +385,7 @@ export type HistoryAuthor = {
386
385
  kind: 'user';
387
386
  id: string;
388
387
  } | {
389
- kind: 'site' | 'inbox';
388
+ kind: 'site' | 'inbox' | 'app';
390
389
  id: string;
391
390
  name: string;
392
391
  };
@@ -469,7 +468,13 @@ export type HeldRoom = {
469
468
  locator: string;
470
469
  roomVersion: string;
471
470
  };
472
- export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
471
+ export type RoomChange = {
472
+ kind: 'room-change';
473
+ locator: string;
474
+ from: string;
475
+ roomVersion: string;
476
+ read(): Promise<RefreshPage>;
477
+ };
473
478
  export type RoomStreamEvent = {
474
479
  kind: 'opened';
475
480
  } | {
@@ -482,29 +487,11 @@ export type RoomStreamEvent = {
482
487
  } | {
483
488
  kind: 'authority-changed';
484
489
  scope?: DiscoveryScope;
485
- } | {
486
- kind: 'room-version';
487
- locator: string;
488
- roomVersion: string;
489
- };
490
- export type KeptReceipt = {
491
- key: string;
492
- head: unknown;
493
- };
494
- export type StreamReceipts = {
495
- heads(): Promise<readonly KeptReceipt[]>;
496
- parts(key: string, count: number): Promise<readonly unknown[]>;
497
- keep(key: string, head: unknown, part?: {
498
- index: number;
499
- value: unknown;
500
- }): Promise<void>;
501
- drop(keys: readonly string[]): Promise<void>;
502
- };
490
+ } | RoomChange;
503
491
  export type RoomStream = {
504
492
  hold(rooms: readonly HeldRoom[]): void;
505
493
  reopen(): void;
506
- published(locator: string, roomVersion: string): void;
507
- observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
494
+ observe(notify: (event: RoomStreamEvent) => void): () => void;
508
495
  };
509
496
  export type Adapter = {
510
497
  readonly localSaves?: true;
@@ -514,7 +501,7 @@ export type Adapter = {
514
501
  authorize(): Promise<Authorization>;
515
502
  discover(authorization: Authorization, scope?: DiscoveryScope): Promise<DiscoverResult>;
516
503
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
517
- refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
504
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
518
505
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
519
506
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
520
507
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
@@ -1,8 +1,6 @@
1
1
  import { type Document } from '../mdmodel/index.js';
2
2
  import type { ModelState } from './model.js';
3
3
  import type { MdModelIdentity } from './adapter.js';
4
- import { type Paths } from './shared.js';
5
- import type { Refused } from './transfer.js';
6
4
  export declare const MD_MODEL: MdModelIdentity;
7
5
  export type Collection = {
8
6
  text: Readonly<Record<string, string>>;
@@ -25,6 +23,5 @@ export declare function selected(composition: Composition, path: string): boolea
25
23
  export declare function governing(composition: Composition, path: string): ModelState;
26
24
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
27
25
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
28
- export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
29
26
  export declare function validRoot(root: unknown): root is string;
30
27
  export declare function available(composition: Composition): boolean;
@@ -94,7 +94,7 @@ export type HistoryQuery = {
94
94
  };
95
95
  export type MdRuntime = {
96
96
  loaded(): Promise<void>;
97
- rooms(): readonly AppRoom[];
97
+ rooms(): Promise<readonly AppRoom[]>;
98
98
  query: {
99
99
  (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
100
100
  (query: GroupQuery): Promise<GroupResult | PendingResult>;
@@ -147,7 +147,6 @@ export type ComposedRuntime = RuntimeView & {
147
147
  stop(): Promise<void>;
148
148
  lose(locators: readonly string[]): Promise<void>;
149
149
  persisted(answer: Persistence): void;
150
- shown(onScreen: boolean): void;
151
150
  within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
152
151
  };
153
152
  export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
@@ -1,4 +1,4 @@
1
- import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
1
+ import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ListedConversation, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
2
2
  import { type ChangeSet } from './change-set.js';
3
3
  import type { Open } from './open.js';
4
4
  import { type CallResult, type Offline } from './outcome.js';
@@ -83,6 +83,7 @@ export type ConversationDependencies = {
83
83
  stream(): ConversationStream | undefined;
84
84
  publish(set: ChangeSet): void;
85
85
  online(): boolean;
86
+ listed(): boolean;
86
87
  full(): boolean;
87
88
  closed(): boolean;
88
89
  unanswered(): void;
@@ -91,13 +92,14 @@ export type ConversationDependencies = {
91
92
  export type ConversationStore = {
92
93
  surface: ConversationSurface;
93
94
  chatDraft: ChatDraftSurface;
94
- hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[]): void;
95
+ hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[], list: readonly ListedConversation[] | null): void;
95
96
  reconcile(): Promise<void>;
96
97
  catchUp(progress: CycleProgress): Promise<void>;
97
98
  resend(progress: CycleProgress): Promise<void>;
98
99
  current(): boolean;
99
100
  known(): boolean;
100
- reconnected(): void;
101
+ learned(): void;
102
+ declared(): void;
101
103
  reopened(): void;
102
104
  lost(): void;
103
105
  watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
@@ -2,7 +2,6 @@ import type { Persistence } from './readiness.js';
2
2
  export type RuntimeShell = {
3
3
  persistence: Persistence;
4
4
  generation: string | null;
5
- onScreen: boolean;
6
5
  keepGeneration(value: string): void | Promise<void>;
7
6
  dropGeneration(): void | Promise<void>;
8
7
  cleanUp?(): Promise<number>;
@@ -1,5 +1,5 @@
1
1
  import type { MdRuntimeClient } from './client.js';
2
- import type { ShownAnswer } from './outcome.js';
2
+ import { type ShownAnswer } from './outcome.js';
3
3
  export declare const ROOM_MEDIA = "room-media";
4
4
  type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
5
5
  export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
@@ -59,5 +59,4 @@ export declare function modelTypes(state: ModelState): TypesResult;
59
59
  export declare function storedModel(state: ModelState): StoredModel;
60
60
  export declare function cached(state: ModelState): ModelState;
61
61
  export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
62
- export declare function sameTyping(left: ModelState, right: ModelState): boolean;
63
62
  export declare function referenceField(facts: ValueFacts | undefined): boolean;
@@ -80,8 +80,5 @@ export type QueueEntry = {
80
80
  readonly batch: ChangeBatch;
81
81
  } & (Submission | {
82
82
  readonly state: 'local';
83
- } | {
84
- readonly state: 'accepted';
85
- readonly roomVersion: string;
86
83
  });
87
84
  export {};
@@ -1,4 +1,4 @@
1
- import type { MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
1
+ import type { AppRoom, MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
2
2
  import type { Plan, PlanReach, QueryResult } from './query.js';
3
3
  import type { Readiness } from './readiness.js';
4
4
  import { type SearchResult } from './search.js';
@@ -37,6 +37,7 @@ export type Reachable = RuntimeView & {
37
37
  lockedRooms(): readonly string[];
38
38
  watchLocks(notify: () => void): () => void;
39
39
  located(room: string, path: string, destination: string): ReachedDocument | null;
40
+ room(locator: string): AppRoom | undefined;
40
41
  };
41
42
  export declare function holds(reach: PortReach | null, room: string): boolean;
42
43
  export declare function governs(reach: PortReach | null, room: {
@@ -1,6 +1,6 @@
1
1
  import type { Open } from './open.js';
2
2
  export type CodeAvailability = Open<'stored' | 'absent'>;
3
- export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'refused' | 'unadmitted'>;
3
+ export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'unadmitted'>;
4
4
  export type RoomCoverage = {
5
5
  readonly room: string;
6
6
  readonly state: RoomPreparation;
@@ -19,28 +19,17 @@ export type Durability = Open<'persistent' | 'best-effort'>;
19
19
  export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
20
20
  export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
21
21
  export type Space = Open<'full'>;
22
- export type RefusedRoom = {
23
- readonly room: string;
24
- readonly name: string;
25
- readonly file: string;
26
- readonly rule: string;
27
- readonly location: string | null;
28
- };
29
- export type InstallationStep = Open<'listing' | 'downloading' | 'writing' | 'replaying'>;
30
- export type InstallationPause = Open<'hidden'>;
22
+ export type InstallationStep = Open<'downloading' | 'writing' | 'replaying'>;
31
23
  export type InstallationAmount = {
32
24
  readonly done: number;
33
25
  readonly total: number;
34
26
  };
35
27
  export type Installation = {
36
28
  readonly step: InstallationStep | null;
37
- readonly paused: InstallationPause | null;
38
29
  readonly rooms: InstallationAmount;
39
- readonly parts: InstallationAmount;
40
30
  readonly bytes: InstallationAmount;
41
- readonly received: InstallationAmount;
42
31
  };
43
- export type ReadinessStatus = Open<'preparing' | 'paused' | 'refused' | 'ready' | 'lost'>;
32
+ export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
44
33
  export type Readiness = {
45
34
  readonly status: ReadinessStatus;
46
35
  readonly ready: boolean;
@@ -53,7 +42,6 @@ export type Readiness = {
53
42
  readonly house: HouseOutcome;
54
43
  readonly space: Space | null;
55
44
  readonly installation: Installation;
56
- readonly refused: readonly RefusedRoom[];
57
45
  readonly lost: boolean;
58
46
  };
59
47
  export type ReadinessFacts = Omit<Readiness, 'status' | 'ready' | 'usable' | 'durability' | 'coverage'> & {
@@ -21,4 +21,5 @@ export type Recovery = {
21
21
  retire(): Promise<void>;
22
22
  };
23
23
  export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
24
+ export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
24
25
  export declare function createRecovery(options?: RecoveryOptions): Recovery;
@@ -15,7 +15,7 @@ export type ReplicaRecord = {
15
15
  readonly providerOwnedPaths: readonly string[];
16
16
  readonly roomVersion: string;
17
17
  readonly transfer: string;
18
- readonly inventory: BootstrapInventory | null;
18
+ readonly inventory: BootstrapInventory;
19
19
  readonly key: number;
20
20
  };
21
21
  export type HeldReplica = {
@@ -34,7 +34,6 @@ export type Slice = Layer & {
34
34
  readonly held: ReadonlySet<string>;
35
35
  };
36
36
  export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState): Composition;
37
- export declare function sameMembership(record: Pick<ReplicaRecord, 'typedSelection'>, other: Pick<ReplicaRecord, 'typedSelection'>): boolean;
38
37
  export declare function storedRecord(record: ReplicaRecord): string;
39
38
  export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
40
39
  export declare function entryAt(layer: Layer & {
@@ -40,6 +40,7 @@ export type RoomDraftParts = {
40
40
  };
41
41
  readonly file?: {
42
42
  readonly blob: Blob;
43
+ readonly base?: string | null;
43
44
  };
44
45
  };
45
46
  export type HeldFile = {
@@ -112,7 +113,7 @@ export type RoomDraftWrite = {
112
113
  export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
113
114
  export type ChangedPart = {
114
115
  readonly path: string;
115
- readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'creation' | 'move' | 'removal' | 'file'>;
116
+ readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'move' | 'removal' | 'file'>;
116
117
  readonly name?: string;
117
118
  };
118
119
  export type RoomDraftRecord = {
@@ -132,7 +133,7 @@ export declare function held(current: HeldParts | undefined, parts: RoomDraftPar
132
133
  export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
133
134
  export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
134
135
  export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
135
- export declare function changedParts(path: string, report: ChangedUnderneath): readonly ChangedPart[];
136
+ export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
136
137
  export type TextParts = {
137
138
  readonly fields?: Readonly<Record<string, {
138
139
  readonly value: unknown;
@@ -149,6 +150,20 @@ export declare function returnedInto(existing: HeldParts | undefined, returned:
149
150
  export declare function moveTarget(move: {
150
151
  readonly to: string;
151
152
  }): string;
153
+ export declare function readSavedParts(named: readonly {
154
+ readonly path: string;
155
+ readonly parts: unknown;
156
+ }[]): readonly {
157
+ readonly path: string;
158
+ readonly parts: RoomDraftParts;
159
+ }[];
160
+ export declare function partsChanges(named: readonly {
161
+ readonly path: string;
162
+ readonly parts: unknown;
163
+ }[]): {
164
+ readonly changes: readonly Change[];
165
+ readonly preconditions: readonly Precondition[];
166
+ };
152
167
  export declare function changesOf(path: string, parts: HeldParts): {
153
168
  changes: readonly Change[];
154
169
  bases: readonly Precondition[];
@@ -1,19 +1,20 @@
1
1
  import type { Open } from './open.js';
2
- import type { ProviderRefusal } from './adapter.js';
3
2
  import type { ReturnReason } from './room-draft.js';
4
3
  export type AttentionEntry = {
5
4
  room: string;
6
5
  path: string;
7
6
  returned: ReturnReason;
8
- } | {
7
+ };
8
+ export type UnsentChange = {
9
9
  room: string;
10
- refusal: ProviderRefusal;
10
+ path: string;
11
11
  };
12
12
  export type SyncStatus = {
13
13
  state: Open<'pending' | 'syncing' | 'synced'>;
14
14
  lastCompleted: string | null;
15
15
  providerUnreachable: boolean;
16
16
  attentionRequired: readonly AttentionEntry[];
17
+ unsent: readonly UnsentChange[];
17
18
  reset: string | null;
18
19
  };
19
20
  export type CycleProgress = {
@@ -1,13 +1,13 @@
1
- import type { BootstrapInventory, Capability, KeptReceipt, Member, ProviderLimit } from './adapter.js';
1
+ import type { BootstrapInventory, Capability, ListedConversation, Member, ProviderLimit } from './adapter.js';
2
2
  import type { ChangeBatch } from './change.js';
3
3
  import { type Composition } from './collection.js';
4
4
  import type { Plan } from './query.js';
5
5
  import type { ReplicaRecord } from './replica.js';
6
6
  import type { Submission } from './outcome.js';
7
7
  import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
8
- import { type ModelState, type StoredModel } from './model.js';
8
+ import type { ModelState, StoredModel } from './model.js';
9
9
  import type { SearchWindow } from './search.js';
10
- import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, KeptPart, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View, Walked } from './tables.js';
10
+ import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
11
11
  export type { ConversationWrite, HeldConversation, MessageWindow } from './tables.js';
12
12
  export type TransferRecord = {
13
13
  readonly locator: string;
@@ -15,8 +15,6 @@ export type TransferRecord = {
15
15
  readonly selection: string;
16
16
  readonly from: string;
17
17
  readonly last: string;
18
- readonly pageToken: string | null;
19
- readonly inventory: BootstrapInventory | null;
20
18
  readonly done: BootstrapInventory;
21
19
  readonly models: {
22
20
  readonly collection: ModelState;
@@ -26,17 +24,11 @@ export type TransferRecord = {
26
24
  export type StoredReplica = Omit<ReplicaRecord, 'model'> & {
27
25
  readonly model: StoredModel;
28
26
  };
29
- export type StoredTransfer = Omit<TransferRecord, 'models'> & {
30
- readonly models: {
31
- readonly collection: StoredModel;
32
- };
33
- };
34
27
  export type PendingState = {
35
28
  readonly drafts: readonly SavedDraft[];
36
29
  readonly submission: Submission;
37
30
  readonly lost: boolean;
38
31
  readonly upload?: unknown;
39
- readonly accepted?: string;
40
32
  };
41
33
  export type TargetRecord = {
42
34
  established: boolean;
@@ -76,10 +68,6 @@ export type AuthoredWrite = {
76
68
  saved?: ReadonlyMap<string, readonly SavedDraft[]>;
77
69
  roomDrafts?: readonly RoomDraftRecord[];
78
70
  consumedRoomDrafts?: readonly string[];
79
- accepted?: readonly {
80
- readonly id: string;
81
- readonly roomVersion: string;
82
- }[];
83
71
  };
84
72
  export type StagedPage = {
85
73
  readonly entries: readonly StoredEntry[];
@@ -91,8 +79,6 @@ export type RefreshedPage = StagedPage & {
91
79
  };
92
80
  export type Opened = {
93
81
  readonly rooms: ReadonlyMap<string, StoredReplica>;
94
- readonly transfers: ReadonlyMap<string, StoredTransfer>;
95
- readonly kept: ReadonlyMap<string, ReadonlyMap<string, number>>;
96
82
  readonly unindexed: ReadonlySet<number>;
97
83
  readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
98
84
  readonly erasing: boolean;
@@ -103,6 +89,7 @@ export type Opened = {
103
89
  readonly member: Member | null;
104
90
  readonly targets: Readonly<Record<string, TargetRecord>>;
105
91
  readonly presentation: readonly PresentationRecord[];
92
+ readonly conversationList: readonly ListedConversation[] | null;
106
93
  };
107
94
  export type Commit = {
108
95
  readonly rooms: readonly RoomCommit[];
@@ -119,7 +106,6 @@ export type RuntimeStore = {
119
106
  entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
120
107
  typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
121
108
  referrers(key: number, view: View, targets: readonly string[], kinds: readonly string[]): Promise<readonly Referrer[]>;
122
- walk(key: number, view: View, after: string | null, bytes: number): Promise<Walked>;
123
109
  files(key: number, view: View, after: string | null, limit: number): Promise<readonly {
124
110
  readonly path: string;
125
111
  readonly revision: string;
@@ -127,17 +113,18 @@ export type RuntimeStore = {
127
113
  folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
128
114
  typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
129
115
  search(ask: SearchAsk): Promise<SearchWindow>;
130
- stage(record: TransferRecord, composition: Composition, page: StagedPage, written?: string): Promise<number | null>;
131
- transferPart(locator: string, token: string): Promise<Uint8Array | null>;
132
- keepParts(parts: readonly KeptPart[]): Promise<void>;
116
+ stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
133
117
  refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
134
118
  unrefresh(key: number): Promise<void>;
135
119
  commit(commit: Commit): Promise<CommittedWrite>;
136
120
  fence(locators: readonly string[]): Promise<void>;
137
121
  erase(locator: string | null, limit: number): Promise<boolean>;
138
- abandon(locator: string, kept?: boolean): Promise<number | null>;
122
+ abandon(locator: string): Promise<void>;
139
123
  release(key: number): Promise<void>;
140
- rederive(key: number, composition: Composition, bytes: number): Promise<boolean>;
124
+ rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
125
+ readonly done: boolean;
126
+ readonly text: number;
127
+ }>;
141
128
  fact(name: string, value: unknown): Promise<void>;
142
129
  queues(): Promise<readonly QueueRecord[]>;
143
130
  submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
@@ -159,13 +146,6 @@ export type RuntimeStore = {
159
146
  keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
160
147
  discardRoomDraft(locator: string, path: string): Promise<void>;
161
148
  fences(): Promise<readonly string[]>;
162
- receivedHeads(): Promise<readonly KeptReceipt[]>;
163
- receivedParts(key: string, count: number): Promise<readonly unknown[]>;
164
- keepReceived(key: string, head: unknown, part?: {
165
- index: number;
166
- value: unknown;
167
- }): Promise<void>;
168
- dropReceived(keys: readonly string[]): Promise<void>;
169
149
  generation(): Promise<string | null>;
170
150
  rememberGeneration(value: string): Promise<void>;
171
151
  file(key: string, type: string): Promise<Blob>;
@@ -42,16 +42,6 @@ export type ReplicaOpened = {
42
42
  readonly key: number;
43
43
  readonly record: string;
44
44
  }[];
45
- readonly transfers: readonly {
46
- readonly locator: string;
47
- readonly key: number;
48
- readonly record: string;
49
- }[];
50
- readonly kept: readonly {
51
- readonly locator: string;
52
- readonly token: string;
53
- readonly bytes: number;
54
- }[];
55
45
  readonly keys: readonly HeldKey[];
56
46
  readonly facts: Readonly<Record<string, string>>;
57
47
  readonly presentation: readonly {
@@ -96,20 +86,14 @@ export type CountedRoom = {
96
86
  readonly key: number;
97
87
  readonly roots: readonly string[];
98
88
  };
99
- export type Walked = {
100
- readonly entries: readonly HeldEntry[];
101
- readonly next: string | null;
102
- };
103
89
  export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
104
90
  export declare function stage(connection: Connection, request: {
105
91
  readonly locator: string;
106
92
  readonly transfer: string;
107
- readonly record: string;
108
93
  readonly key: number | null;
109
94
  readonly fingerprint: string;
110
95
  readonly entries: readonly StoredEntry[];
111
96
  readonly folders: readonly string[];
112
- readonly written?: string;
113
97
  }): number;
114
98
  export declare function refreshing(connection: Connection, request: {
115
99
  readonly key: number;
@@ -123,30 +107,23 @@ export declare function unrefresh(connection: Connection, key: number): null;
123
107
  export declare function counts(connection: Connection, rooms: readonly CountedRoom[]): number[];
124
108
  export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
125
109
  export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
126
- export declare function abandon(connection: Connection, locator: string, kept: boolean): number | null;
110
+ export declare function abandon(connection: Connection, locator: string): null;
127
111
  export declare function release(connection: Connection, key: number): null;
128
112
  export declare function erase(connection: Connection, locator: string | null, limit: number): {
129
113
  readonly remaining: boolean;
130
114
  };
131
- export declare function rederive(connection: Connection, key: number, composed: Composed, bytes: number): {
115
+ export declare function rederive(connection: Connection, key: number, composed: Composed, bytes: number, ms: number, floor: number): {
132
116
  readonly done: boolean;
117
+ readonly text: number;
133
118
  };
134
119
  export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
135
120
  export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
136
121
  export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[], kinds: readonly string[]): Referrer[];
137
- export declare function walk(connection: Connection, key: number, view: View, after: string | null, bytes: number): Walked;
138
122
  export declare function files(connection: Connection, key: number, view: View, after: string | null, limit: number): {
139
123
  readonly path: string;
140
124
  readonly revision: string;
141
125
  }[];
142
126
  export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
143
127
  export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
144
- export declare function transferPart(connection: Connection, locator: string, token: string): Uint8Array | null;
145
- export type KeptPart = {
146
- readonly locator: string;
147
- readonly token: string;
148
- readonly part: Uint8Array;
149
- };
150
- export declare function keepParts(connection: Connection, parts: readonly KeptPart[]): null;
151
128
  export declare function opened(connection: Connection): ReplicaOpened;
152
129
  export declare function ended(connection: Connection): void;
@@ -1,12 +1,11 @@
1
1
  import { type QueryAnswer, type QueryRoom } from './compile.js';
2
- import type { KeptReceipt } from './adapter.js';
3
2
  import type { Composed } from './collection.js';
4
3
  import { type SearchAsk } from './fulltext.js';
5
4
  import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
6
5
  import type { Plan } from './query.js';
7
6
  import type { SearchWindow } from './search.js';
8
- import { type Committed, type CountedRoom, type HeldEntry, type KeptPart, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View, type Walked } from './stored.js';
9
- export type { Committed, CountedRoom, HeldEntry, KeptPart, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, Walked, } from './stored.js';
7
+ import { type Committed, type CountedRoom, type HeldEntry, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
8
+ export type { Committed, CountedRoom, HeldEntry, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
10
9
  export type { QueryAnswer, QueryRoom } from './compile.js';
11
10
  export type { SearchAsk } from './fulltext.js';
12
11
  export type { ConversationWrite, HeldConversation, MessageWindow } from './messages.js';
@@ -78,10 +77,6 @@ export type AuthoredRows = {
78
77
  readonly path: string;
79
78
  })[];
80
79
  readonly consumedRoomDrafts?: readonly string[];
81
- readonly amendments?: readonly {
82
- readonly id: string;
83
- readonly amendment: string;
84
- }[];
85
80
  };
86
81
  export type HeldQueues = {
87
82
  readonly queues: readonly {
@@ -182,12 +177,6 @@ export interface RuntimeRequests {
182
177
  readonly targets: readonly string[];
183
178
  readonly kinds: readonly string[];
184
179
  }, readonly Referrer[]>;
185
- readonly 'replica.walk': Asked<{
186
- readonly key: number;
187
- readonly view: View;
188
- readonly after: string | null;
189
- readonly bytes: number;
190
- }, Walked>;
191
180
  readonly 'replica.files': Asked<{
192
181
  readonly key: number;
193
182
  readonly view: View;
@@ -212,28 +201,14 @@ export interface RuntimeRequests {
212
201
  readonly rooms: readonly CountedRoom[];
213
202
  }, readonly number[]>;
214
203
  readonly 'replica.search': Asked<SearchAsk, SearchWindow>;
215
- readonly 'replica.received': Asked<Nothing, readonly KeptReceipt[]>;
216
- readonly 'replica.receivedParts': Asked<{
217
- readonly key: string;
218
- readonly count: number;
219
- }, readonly unknown[]>;
220
204
  readonly 'replica.stage': Asked<{
221
205
  readonly locator: string;
222
206
  readonly transfer: string;
223
- readonly record: string;
224
207
  readonly key: number | null;
225
208
  readonly fingerprint: string;
226
209
  readonly entries: readonly StoredEntry[];
227
210
  readonly folders: readonly string[];
228
- readonly written?: string;
229
211
  }, number | null>;
230
- readonly 'replica.transferPart': Asked<{
231
- readonly locator: string;
232
- readonly token: string;
233
- }, Uint8Array | null>;
234
- readonly 'replica.keepParts': Asked<{
235
- readonly parts: readonly KeptPart[];
236
- }, null>;
237
212
  readonly 'replica.refresh': Asked<{
238
213
  readonly key: number;
239
214
  readonly composed: Composed;
@@ -260,8 +235,7 @@ export interface RuntimeRequests {
260
235
  }>;
261
236
  readonly 'replica.abandon': Asked<{
262
237
  readonly locator: string;
263
- readonly kept: boolean;
264
- }, number | null>;
238
+ }, null>;
265
239
  readonly 'replica.release': Asked<{
266
240
  readonly key: number;
267
241
  }, null>;
@@ -269,8 +243,11 @@ export interface RuntimeRequests {
269
243
  readonly key: number;
270
244
  readonly composed: Composed;
271
245
  readonly bytes: number;
246
+ readonly ms: number;
247
+ readonly floor: number;
272
248
  }, {
273
249
  readonly done: boolean;
250
+ readonly text: number;
274
251
  }>;
275
252
  readonly 'replica.fact': Asked<{
276
253
  readonly name: string;
@@ -280,17 +257,6 @@ export interface RuntimeRequests {
280
257
  readonly app: string;
281
258
  readonly value: string;
282
259
  }, null>;
283
- readonly 'replica.receive': Asked<{
284
- readonly key: string;
285
- readonly head: string;
286
- readonly part?: {
287
- readonly index: number;
288
- readonly value: string;
289
- };
290
- }, null>;
291
- readonly 'replica.unreceive': Asked<{
292
- readonly keys: readonly string[];
293
- }, null>;
294
260
  readonly 'opened.find': Asked<{
295
261
  readonly locator: string;
296
262
  readonly path: string;
@@ -1,5 +1,5 @@
1
1
  import type { MdRuntimeClient } from './mdruntime/client.js';
2
- import type { HouseActivation, HouseAnalyticsChoice, HouseAppMessage, HouseChatOptions, HouseExternalAnswer, HouseExternalRequest, HouseNavigationMode, HouseRefusal, HouseSourceDownload, HouseSourceTop, HouseStatus, HouseTab, HouseTask } from './index.js';
2
+ import type { HouseAnalyticsChoice, HouseAppMessage, HouseChatOptions, HouseExternalAnswer, HouseExternalRequest, HouseNavigationMode, HouseRefusal, HouseSourceDownload, HouseSourceTop, HouseStatus, HouseTab } from './index.js';
3
3
  export interface HouseBridgeNavigation {
4
4
  readonly mode: HouseNavigationMode;
5
5
  readonly address: string;
@@ -21,9 +21,6 @@ export interface HouseBridgeTestHost {
21
21
  publish(status: HouseStatus): void;
22
22
  message(message: HouseAppMessage): void;
23
23
  attachRuntime(runtime: MdRuntimeClient): void;
24
- checkpoint(): Promise<HouseTask>;
25
- restore(task: HouseTask | null): Promise<boolean>;
26
- settle(activation: HouseActivation): void;
27
24
  }
28
25
  export interface HouseBridgeTestHostOptions {
29
26
  readonly address?: string;
package/dist/test-host.js CHANGED
@@ -58,7 +58,6 @@ export function createHouseBridgeTestHost(options = {}) {
58
58
  let published = options.status ?? null;
59
59
  let shown = null;
60
60
  let seen = null;
61
- let cooperation = null;
62
61
  let attached = () => { };
63
62
  const runtime = new Promise((resolve) => {
64
63
  attached = resolve;
@@ -160,19 +159,8 @@ export function createHouseBridgeTestHost(options = {}) {
160
159
  consents.push(choice);
161
160
  publish({ ...published, analytics: { measures: true, choice } });
162
161
  },
163
- cooperate(given) {
164
- cooperation = given;
165
- return () => {
166
- if (cooperation === given)
167
- cooperation = null;
168
- };
169
- },
162
+ cooperate: () => () => { },
170
163
  };
171
- function cooperating() {
172
- if (cooperation === null)
173
- throw new Error('the App registered no cooperation');
174
- return cooperation;
175
- }
176
164
  Object.defineProperty(globalThis, 'houseBridge', { value: bridge, configurable: true });
177
165
  if (published !== null)
178
166
  publish(published);
@@ -198,19 +186,5 @@ export function createHouseBridgeTestHost(options = {}) {
198
186
  attachRuntime(client) {
199
187
  attached(client);
200
188
  },
201
- async checkpoint() {
202
- const held = cooperating();
203
- await held.checkpoint();
204
- await held.persist();
205
- return JSON.parse(JSON.stringify((await held.capture()) ?? null));
206
- },
207
- async restore(task) {
208
- const held = cooperating();
209
- await held.restore(task);
210
- return (await held.ready()) === true;
211
- },
212
- settle(activation) {
213
- cooperating().settle(activation);
214
- },
215
189
  };
216
190
  }
package/docs/families.md CHANGED
@@ -13,8 +13,7 @@
13
13
  absolute path, carries its current address as the return target, and the page
14
14
  returns there when it completes. An App names an address House gave it in a
15
15
  reading and composes one only for `/bind/<app_ref>`, where the User binds
16
- its Rooms and connects its account slots, with `?slot=<name>` to open at one
17
- slot.
16
+ its Rooms, with `?slot=<name>` to open at one slot.
18
17
  - **Installation** - `install()` offers the page as a Home-screen app. Where the
19
18
  browser has an install prompt ready the shell shows it and the call resolves
20
19
  `'accepted'` or `'dismissed'` with the User's choice, spending that prompt;
@@ -47,15 +46,19 @@
47
46
  The App reports the visitor's choice with `analyticsConsent('accept')` or
48
47
  `analyticsConsent('decline')`; the shell hands it to House's analytics loader, and
49
48
  the choice never reaches House.
50
- - **Handoff** - when House hands its runtime over to a newer build, the App keeps
51
- running, its `runtime` client and observations included: a call it makes
52
- meanwhile waits for the newer runtime, however long that takes, and is
53
- answered once, by it; each observation goes on with the newer runtime's
54
- values; and the status and the address arrive again. A runtime that ended
55
- before answering has its reads answered by the next one; since it may have
56
- applied any other call, an act on House is answered the outcome
57
- `transport-uncertainty`, and every other call, a Save or a draft write among
58
- them, fails with the retryable code `transport-uncertainty`.
49
+ - **Releases and builds** - an open App keeps the release it loaded: a newer
50
+ release, or a newer House build, takes effect at the App's next load, offline
51
+ too once the browser stored it. When one tab loads a newer House build, the
52
+ other House tabs reload into it; Room Drafts, chat drafts and unsent changes
53
+ survive the reload.
54
+ - **A runtime that ends** - when the browser ends House's runtime under an open
55
+ App, the App keeps running, its `runtime` client and observations included:
56
+ each observation goes on with the next runtime's values, and the status and
57
+ the address arrive again. A runtime that ended before answering has its reads
58
+ answered by the next one; since it may have applied any other call, an act on
59
+ House is answered the outcome `transport-uncertainty`, and every other call,
60
+ a Save or a draft write among them, fails with the retryable code
61
+ `transport-uncertainty`.
59
62
  - **Site image read** - given a Published Room and the Path of one of its
60
63
  binary entries, it answers the web copy's path and metadata, or `null` when no
61
64
  copy exists. The original bytes never cross this bridge at a Site.
@@ -69,16 +72,15 @@
69
72
  refusal is House's `{ error: { code, retryable } }`, `app_release_not_found` for an
70
73
  App with no release; a read House does not answer, or one that outlived
71
74
  the browser's signed-in User, is `null`.
72
- - **External calls** - `callExternal({ url, method, headers, body, slot, room_ref })`
75
+ - **External calls** - `callExternal({ url, method, headers, body, room_ref })`
73
76
  has House's server send an HTTPS request to one of the release's declared
74
77
  external origins and resolves with the service's `status`, `headers` and its
75
78
  body as `body` text or `body_base64`, or a refusal as House's
76
79
  `{ error: { code, retryable } }`, or `null` when House does not answer. House fills in the
77
- App and its running release; naming an account slot and one of the App's
78
- bound Rooms places the key of the account that Room connects to the slot,
79
- when the User holds one of the account's roles there, which the App never
80
- sees, and naming neither sends no key. A Site's call names no slot, and the House panel names an
81
- `account` instead. `body_base64` replaces `body` for bytes.
80
+ App and its running release. A `room_ref` names a Room the signed-in User binds to the App
81
+ in a `write` slot, and House adds that Room's Service key for the URL's origin, which App
82
+ code never sees; a call naming no Room carries no key, and a Site's call names no Room.
83
+ `body_base64` replaces `body` for bytes.
82
84
  - **App messages** - `messages(listener)` hands the listener each message
83
85
  another holder of this App sends to this User's running copies, as `from`,
84
86
  the sender's User id, and `body`, the JSON value they sent, until the
@@ -111,35 +113,14 @@
111
113
  declares them. A Site and the House panel have none: their call rejects with
112
114
  an error named and coded `NotSupportedError`, with `retryable` false.
113
115
 
114
- - **Cooperation** - `cooperate({ checkpoint, persist, capture, restore,
115
- ready, settle })` lets House activate a newer release of the App while it
116
- runs, keeping the User's task; the function it returns withdraws it.
117
- Register it in the entry script, before the first draw, or House treats the
118
- page as not cooperating and the newer release waits for the App's next
119
- open. When a newer release is stored, House calls `checkpoint()`, which
120
- resolves at the App's next safe checkpoint and may never resolve, then
121
- `persist()`, which makes authored work durable, then `capture()`, which
122
- answers the meaningful task the App owns, such as the selected record,
123
- filters, cursor, selection and scroll position, as JSON of at most 65,536
124
- characters; House keeps the address itself. In the newer release House
125
- calls `restore(task)` once its document has drawn, so the scroll position
126
- and focus it sets hold, or `restore(null)` when it opens the release without
127
- a task, then `ready()`, the App's own check that its local data and
128
- capabilities work, and finally `settle('committed')` once the release is
129
- active or `settle('abandoned')` when House returns to the release before
130
- it, restoring the same task there. A release House opens already active is
131
- settled `'committed'` at once, after `restore(task)` when House hands it a
132
- task, and a cooperation registered after House settled is settled at its
133
- registration. Until `settle('committed')` House fails the release's outside
134
- calls at once, as offline, those of the workers it starts included, and
135
- refuses its Saves, write acts and external calls with the retryable code
136
- `house_trial_withheld`, so a start-up effect is not repeated; run start-up
137
- effects after `settle('committed')`. An optional `placed()` resolves once
138
- the page has drawn the place it opened on with what that place shows:
139
- House keeps its first-preparation surface over a page registered by its
140
- first draw until then, and lifts it at the first draw of a page whose
141
- cooperation defines none, so the User goes from the surface to a drawn
142
- place in one change; a release's readiness check never waits for it.
116
+ - **First place** - `cooperate({ placed })` tells House when the page has
117
+ drawn the place it opened on; the function it returns withdraws it. Register
118
+ it in the entry script, before the first draw. `placed()` resolves once the
119
+ page has drawn that place with what it shows: House keeps its
120
+ first-preparation surface over a page registered by its first draw until
121
+ then, and lifts it at the first draw of a page that registered none, so the
122
+ User goes from the surface to a drawn place in one change. House asks the
123
+ page for nothing else.
143
124
 
144
125
  ## The test host
145
126
 
@@ -165,7 +146,5 @@ as a browser without push does, settles every `setBadge`, records in `chats`
165
146
  each Chat `chat.mount` places, with its `element`, the `options` it was last
166
147
  given and whether it is still `mounted`, drawing nothing, delivers each App
167
148
  message `message({ from, body })` plays, and hands `bridge.runtime` the MD
168
- Runtime client `attachRuntime(client)` gives it. `checkpoint()` runs the
169
- registered cooperation's checkpoint, persist and capture and answers the task,
170
- `restore(task)` runs its restore and answers its readiness check, and
171
- `settle(activation)` hands it the outcome.
149
+ Runtime client `attachRuntime(client)` gives it. It takes a `cooperate` and
150
+ never calls `placed()`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-cdef4b9ba1d57",
3
+ "version": "0.1.0-cdf1bbaf17a3f",
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, App messages and the Chat, with an accessor and an in-page test host.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,15 +0,0 @@
1
- export type Paths<V> = Readonly<Record<string, V>>;
2
- export declare function entriesIn<V>(map: Paths<V>): Generator<readonly [string, V]>;
3
- export declare function keysIn(...maps: readonly Paths<unknown>[]): Generator<number, Set<string>, void>;
4
- export declare function sortedKeys(map: Paths<unknown>): Generator<number, readonly string[], void>;
5
- export declare function sorting(keys: Iterable<string>): Generator<number, readonly string[], void>;
6
- export declare function sharing<V>(map: Paths<V>): Generator<number, Paths<V>, void>;
7
- export declare function shared<V>(map: Paths<V>): Paths<V>;
8
- export declare function patched<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Paths<V>;
9
- export declare function patching<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Generator<number, Paths<V>, void>;
10
- export declare function sizeOf<V>(map: Paths<V>): number;
11
- export declare function differences<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): Generator<number, ReadonlySet<string>, void>;
12
- export declare function differing<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): ReadonlySet<string>;
13
- export declare function drafted<V>(base: Paths<V>): Record<string, V>;
14
- export declare function settled<V>(draft: Record<string, V>): Paths<V>;
15
- export declare function settling<V>(draft: Record<string, V>): Generator<number, Paths<V>, void>;
@@ -1,9 +0,0 @@
1
- import type { Refusal } from '../mdmodel/index.js';
2
- export type Unconfirmed = {
3
- kind: 'unconfirmed';
4
- };
5
- export type Refused = {
6
- kind: 'refused';
7
- refusal: Refusal;
8
- };
9
- export declare const unconfirmed: Unconfirmed;