@agentshouse/app-bridge 0.1.0-cbdd0f22603b1 → 0.1.0-cbfba8eb42db9

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/index.d.ts CHANGED
@@ -271,11 +271,18 @@ export interface HouseMethods {
271
271
  readonly room_ref: string;
272
272
  };
273
273
  readonly result: {
274
- readonly history?: readonly {
274
+ readonly history?: readonly ({
275
+ readonly agent_name?: string;
276
+ readonly at: string;
277
+ readonly by?: string;
278
+ readonly kind: "role_given" | "role_taken";
279
+ readonly role: string;
280
+ readonly user: string;
281
+ } | {
275
282
  readonly at: string;
276
283
  readonly kind: "granted" | "revoked";
277
284
  readonly user: string;
278
- }[];
285
+ })[];
279
286
  readonly members: readonly {
280
287
  readonly access?: "manage" | "owner" | "read" | "write";
281
288
  readonly copies?: "online_only" | "search_only";
@@ -284,6 +291,12 @@ export interface HouseMethods {
284
291
  readonly member_document: null | string;
285
292
  readonly owner: boolean;
286
293
  readonly schema_roles?: readonly string[];
294
+ readonly schema_roles_given?: readonly {
295
+ readonly agent_name?: string;
296
+ readonly at: string;
297
+ readonly by?: string;
298
+ readonly role: string;
299
+ }[];
287
300
  readonly since: null | string;
288
301
  readonly through_space?: true;
289
302
  readonly user: string;
@@ -318,12 +331,24 @@ export interface HouseMethods {
318
331
  readonly policy: {
319
332
  readonly from: null | string;
320
333
  readonly origin: "default" | "explicit" | "inherited";
321
- readonly reason: null | "room_too_large" | "unfunded";
334
+ readonly reason: null | "full_house_required" | "room_too_large";
322
335
  readonly value: "Off" | "On";
323
336
  };
324
337
  readonly writable: boolean;
325
338
  };
326
339
  };
340
+ readonly "service-keys/signatures/check": {
341
+ readonly params: {
342
+ readonly operation_id?: string;
343
+ readonly origin: string;
344
+ readonly room_ref: string;
345
+ readonly signature: string;
346
+ readonly text: string;
347
+ };
348
+ readonly result: {
349
+ readonly matched: boolean;
350
+ };
351
+ };
327
352
  readonly "sites/submissions/create": {
328
353
  readonly params: {
329
354
  readonly content: string;
@@ -493,7 +518,12 @@ export interface HouseMethods {
493
518
  readonly outcome: "refused";
494
519
  readonly position: number;
495
520
  } | {
496
- readonly code: "agent_function_retired" | "environment_offline" | "no_recipient" | "not_found" | "target_agent_unavailable";
521
+ readonly code: "post_not_confirmed";
522
+ readonly final: true;
523
+ readonly outcome: "failed";
524
+ readonly position: number;
525
+ } | {
526
+ readonly code: "agent_function_retired" | "environment_offline" | "no_group" | "no_recipient" | "not_found" | "target_agent_unavailable";
497
527
  readonly outcome: "no_target";
498
528
  readonly position: number;
499
529
  } | {
@@ -511,6 +541,10 @@ export interface HouseMethods {
511
541
  readonly output?: string;
512
542
  readonly position: number;
513
543
  readonly run: string;
544
+ } | {
545
+ readonly mentioned: number;
546
+ readonly outcome: "posted";
547
+ readonly position: number;
514
548
  } | {
515
549
  readonly outcome: "continued";
516
550
  readonly position: number;
@@ -653,12 +687,26 @@ export interface HouseAppMessage {
653
687
  readonly body: unknown;
654
688
  }
655
689
  export type HouseInstallation = Open<'accepted' | 'dismissed' | 'manual'>;
690
+ export interface HouseBox {
691
+ readonly x: number;
692
+ readonly y: number;
693
+ readonly width: number;
694
+ readonly height: number;
695
+ }
696
+ export interface HouseTitleRow {
697
+ readonly height: number;
698
+ readonly controls: readonly HouseBox[];
699
+ }
656
700
  export type HouseNotifications = Open<'on' | 'off' | 'blocked' | 'unavailable'>;
657
701
  export interface HouseTelegram {
658
702
  readonly state: Open<'available' | 'linked' | 'unavailable'>;
659
703
  readonly name: string | null;
660
704
  readonly username: string | null;
661
705
  }
706
+ export interface HouseCeremonyEnded {
707
+ readonly said: string | null;
708
+ readonly done: boolean;
709
+ }
662
710
  export interface HouseCeremonyRefused extends Error {
663
711
  readonly name: 'HouseCeremonyRefused';
664
712
  readonly code: Open<'house_ceremony_refused'>;
@@ -696,6 +744,9 @@ export interface HouseChatButtonOptions {
696
744
  readonly onOpen?: (opened: HouseChatOpened) => void;
697
745
  readonly onLink?: (href: string) => void;
698
746
  }
747
+ export interface HouseChatButtonMount extends HouseChatButtonOptions {
748
+ readonly agent?: string | null;
749
+ }
699
750
  export interface HouseChatTarget {
700
751
  readonly conversation?: string | null;
701
752
  readonly agent?: string | null;
@@ -709,7 +760,7 @@ export interface HouseChatButton {
709
760
  }
710
761
  export interface HouseChat {
711
762
  mount(element: object, options?: HouseChatOptions): Promise<HouseMountedChat>;
712
- mountButton(options?: HouseChatButtonOptions): Promise<HouseChatButton>;
763
+ mountButton(options?: HouseChatButtonMount): Promise<HouseChatButton>;
713
764
  }
714
765
  export interface HouseBridge {
715
766
  readonly runtime: Promise<HouseRuntime>;
@@ -718,8 +769,11 @@ export interface HouseBridge {
718
769
  onAddress(listener: (address: string) => void): () => void;
719
770
  push(address: string): Promise<string>;
720
771
  replace(address: string): Promise<string>;
721
- ceremony(path: string): Promise<never>;
722
- install(): Promise<HouseInstallation>;
772
+ ceremony(path: string): Promise<HouseCeremonyEnded>;
773
+ install(app?: string): Promise<HouseInstallation>;
774
+ installed(): Promise<boolean>;
775
+ onTitleBar(listener: (area: HouseBox | null) => void): () => void;
776
+ setTitleBar(row: HouseTitleRow | null): void;
723
777
  notifications(on?: boolean): Promise<HouseNotifications>;
724
778
  telegram(link?: true): Promise<HouseTelegram>;
725
779
  setTab(tab: HouseTab): void;
@@ -14,6 +14,7 @@ export type ValueFacts = {
14
14
  readonly prefix?: readonly ValueFacts[];
15
15
  readonly items?: ValueFacts;
16
16
  readonly properties?: Readonly<Record<string, ValueFacts>>;
17
+ readonly required?: readonly string[];
17
18
  readonly patterns?: readonly PatternFacts[];
18
19
  readonly additional?: ValueFacts;
19
20
  };
@@ -43,7 +43,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
43
43
  readonly kind: {
44
44
  readonly title: 'Kind';
45
45
  readonly type: 'string';
46
- readonly enum: readonly ['share-offer', 'join-request', 'join-request-approved', 'room-ownership-offer', 'managed-environment-retention-opened', 'storage-full', 'sandbox-budget-spent', 'trigger-failed', 'room-telegram-chat-paused', 'break-glass-owner-disclosure', 'export-ready', 'export-failed', 'custom', 'agent-function-request-finished'];
46
+ readonly enum: readonly ['share-offer', 'join-request', 'join-request-approved', 'room-ownership-offer', 'managed-environment-retention-opened', 'storage-full', 'sandbox-budget-spent', 'trigger-failed', 'room-telegram-chat-paused', 'break-glass-owner-disclosure', 'export-ready', 'export-failed', 'custom', 'agent-function-request-finished', 'storage-past-included'];
47
47
  };
48
48
  readonly created: {
49
49
  readonly title: 'Created';
@@ -103,7 +103,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
103
103
  readonly format: 'email';
104
104
  };
105
105
  };
106
- readonly required: readonly ['name', 'email'];
106
+ readonly required: readonly ['name'];
107
107
  };
108
108
  readonly rooms: {
109
109
  readonly title: 'Rooms';
@@ -246,7 +246,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
246
246
  readonly format: 'email';
247
247
  };
248
248
  };
249
- readonly required: readonly ['name', 'email'];
249
+ readonly required: readonly ['name'];
250
250
  };
251
251
  readonly environment: {
252
252
  readonly title: 'Environment';
@@ -411,7 +411,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
411
411
  readonly code: {
412
412
  readonly title: 'Code';
413
413
  readonly type: 'string';
414
- readonly enum: readonly ['failed', 'internal_error', 'agent_function_unreadable', 'function_failed', 'function_not_started', 'agent_function_request_not_started'];
414
+ readonly enum: readonly ['failed', 'internal_error', 'agent_function_unreadable', 'function_failed', 'function_not_started', 'agent_function_request_not_started', 'post_not_confirmed'];
415
415
  };
416
416
  readonly action: {
417
417
  readonly title: 'Action';
@@ -465,6 +465,36 @@ export declare const HOUSE_MODEL_DECLARATION: {
465
465
  readonly type: 'integer';
466
466
  readonly minimum: 1;
467
467
  };
468
+ readonly meter: {
469
+ readonly title: 'Meter';
470
+ readonly type: 'string';
471
+ readonly enum: readonly ['indexed_text', 'blob'];
472
+ };
473
+ readonly average_bytes: {
474
+ readonly title: 'Average in bytes';
475
+ readonly type: 'integer';
476
+ readonly minimum: 0;
477
+ };
478
+ readonly included_bytes: {
479
+ readonly title: 'Included in bytes';
480
+ readonly type: 'integer';
481
+ readonly minimum: 1;
482
+ };
483
+ readonly block_bytes: {
484
+ readonly title: 'Block in bytes';
485
+ readonly type: 'integer';
486
+ readonly minimum: 1;
487
+ };
488
+ readonly block_usd: {
489
+ readonly title: 'Block price in USD';
490
+ readonly type: 'number';
491
+ readonly exclusiveMinimum: 0;
492
+ };
493
+ readonly amount_usd: {
494
+ readonly title: 'Amount in USD';
495
+ readonly type: 'number';
496
+ readonly exclusiveMinimum: 0;
497
+ };
468
498
  };
469
499
  readonly required: readonly ['notification', 'kind', 'created', 'way_in', 'subject'];
470
500
  };
@@ -473,7 +503,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
473
503
  readonly properties: {};
474
504
  };
475
505
  readonly 'house-agent-function': {
476
- readonly description: "One Agent function that serves this Room, which House alone writes from its owner's document in their Private Room: the `agent_function` by identifier, its `description`, the `input` a caller sends, empty when it takes nothing, and the `agent` it starts, by `agent` and the `name` that Agent had when this card was last written. The Agent function's instruction is never written here.";
506
+ readonly description: "One Agent function that serves this Room, which House alone writes from its owner's document in their Private Room and their Standing answer for it: the `agent_function` by identifier, its `description`, the `input` a caller sends, empty when it takes nothing, the `agent` it starts, by `agent` and the `name` that Agent had when this card was last written, and its `answer`, how a request from anyone but its owner starts: `at_once`, `ask_me`, which waits for its owner's approval, or `off`, which refuses it. The Agent function's instruction is never written here.";
477
507
  readonly properties: {
478
508
  readonly reflected: {
479
509
  readonly title: 'Reflected';
@@ -508,8 +538,13 @@ export declare const HOUSE_MODEL_DECLARATION: {
508
538
  };
509
539
  readonly required: readonly ['agent', 'name'];
510
540
  };
541
+ readonly answer: {
542
+ readonly title: 'Answer';
543
+ readonly type: 'string';
544
+ readonly enum: readonly ['at_once', 'ask_me', 'off'];
545
+ };
511
546
  };
512
- readonly required: readonly ['reflected', 'agent_function', 'description', 'input', 'agent'];
547
+ readonly required: readonly ['reflected', 'agent_function', 'description', 'input', 'agent', 'answer'];
513
548
  };
514
549
  readonly 'house-agent-function-document': {
515
550
  readonly description: 'One Agent function as its owner writes it in their Private Room at rooms/<room-handle>/agent-functions/<name>.md, a path that binds this type and a document that names no type: what it does as `description`, what a caller sends as `input`, empty when it takes nothing, the `agent` it starts, by identifier, and `afk`, true for a run nobody watches, off when absent. Its body is the instruction that Agent follows.';
@@ -536,7 +571,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
536
571
  readonly required: readonly ['description', 'input', 'agent'];
537
572
  };
538
573
  readonly 'house-trigger': {
539
- readonly description: "One Trigger of this Room as its acts wrote it, which House alone writes: its `description`, the `condition` it fires on, its `actions` in order, whether each action and the Trigger are `enabled`, `paused_by` `types` while a change of the Room's types paused it, its `creator` by `user` and the `name` they had then, and when it was `created`. A `notify` action reaches the `users` its `to` names, the members its `fields` name in the matched document and the holders of its `roles`; an `agent_function` action sends its `payload` to the Agent function whose card under this Room's `house/agent-functions/` its `card` names, absent while this Room holds no card of that Agent function; a `message` action puts its `text` into the active conversation that Agent function started for what the Event is about, or starts that Agent function when none is active; a `done` action marks Done every active conversation an Agent function request of this Room started for the Event's document; a `function` action runs the `function` its `app`'s latest release declares, on House's servers, or, naming no `app`, the Room owner's Environment function of that name on its Environment, which only a Trigger of their Private Room holds. Whether an action's target holds is not written: it follows from the Room's members, the Agent function's card, the App's latest release and the owner's functions.";
574
+ readonly description: "One Trigger of this Room as its acts wrote it, which House alone writes: its `description`, the `condition` it fires on, its `actions` in order, whether each action and the Trigger are `enabled`, `paused_by` `types` while a change of the Room's types paused it, its `creator` by `user` and the `name` they had then, and when it was `created`. A `notify` action reaches the `users` its `to` names, the members its `fields` name in the matched document and the holders of its `roles`, or, `in_group`, posts once in this Room's Telegram group in their place, mentioning each; an `agent_function` action sends its `payload` to the Agent function whose card under this Room's `house/agent-functions/` its `card` names, absent while this Room holds no card of that Agent function; a `message` action puts its `text` into the active conversation that Agent function started for what the Event is about, or starts that Agent function when none is active; a `done` action marks Done every active conversation an Agent function request of this Room started for the Event's document; a `function` action runs the `function` its `app`'s latest release declares, on House's servers, or, naming no `app`, the Room owner's Environment function of that name on its Environment, which only a Trigger of their Private Room holds. Whether an action's target holds is not written: it follows from the Room's members, the Agent function's card, the App's latest release and the owner's functions.";
540
575
  readonly properties: {
541
576
  readonly reflected: {
542
577
  readonly title: 'Reflected';
@@ -618,6 +653,10 @@ export declare const HOUSE_MODEL_DECLARATION: {
618
653
  };
619
654
  readonly required: readonly ['users', 'fields', 'roles'];
620
655
  };
656
+ readonly in_group: {
657
+ readonly title: 'In group';
658
+ readonly const: true;
659
+ };
621
660
  };
622
661
  readonly required: readonly ['kind', 'enabled', 'title', 'text', 'to'];
623
662
  }, {
@@ -12,6 +12,8 @@ export * as sql from './query/sql.js';
12
12
  export { headingLines } from './markdown.js';
13
13
  export type { HeadingLine } from './markdown.js';
14
14
  export { acceptsType, dataUrl, dataUrlPattern, declaresUtf8, FILE_MEDIA_TYPES, fileExtension, formDataType, gitMediaType, isAudioType, isImageType, isVideoType, MEDIA_TYPES, mediaTypeEssence, SCRIPT_MEDIA_TYPES, servedMediaType, UTF8_TEXT, withCharset, } from './media-type.js';
15
+ export { shownDay, shownMoment } from './moment.js';
16
+ export type { MomentReader } from './moment.js';
15
17
  export { labelAt, NAME_FIELD } from './body.js';
16
18
  export type { Naming } from './body.js';
17
19
  export { divide } from './divide.js';
@@ -27,7 +29,7 @@ export { APP_REFERENCE_PATTERN, APP_REFERENCE_PREFIX, ROOM_REFERENCE_PATTERN, RE
27
29
  export type { HouseDocumentFields, HouseModelType } from './house-model.js';
28
30
  export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES } from './room-types.js';
29
31
  export type { InboxChannelKind } from './room-types.js';
30
- export { linkedPath, relative, retarget, roomPath, roomTarget, target } from './paths.js';
32
+ export { keyedDestination, keyedLink, linkedPath, relative, retarget, roomPath, roomTarget, target, } from './paths.js';
31
33
  export { openPatternBudget } from './pattern.js';
32
34
  export type { LinkedPath, RoomTarget } from './paths.js';
33
35
  export { project } from './project.js';
@@ -36,7 +38,7 @@ export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESC
36
38
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
37
39
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, Shape, Transition, ValueFacts, } from './definition.js';
38
40
  export type { ApplyResult, BodyResult, Change, DefinitionOf, Division, DivisionContext, Document, DocumentCheck, Extent, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
39
- export { assess, assessReferences, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
41
+ export { assess, assessReferences, bodyKeyedLinks, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
40
42
  export type { Assessment, Verdicts } from './validate.js';
41
43
  export { VERSION } from './version.js';
42
44
  export { bodyAfterFrontmatter, documentValue, equalValue, plain } from './yaml.js';
@@ -0,0 +1,6 @@
1
+ export interface MomentReader {
2
+ readonly language: string;
3
+ readonly zone: string | null;
4
+ }
5
+ export declare function shownMoment(at: Date, reader: MomentReader): string;
6
+ export declare function shownDay(at: Date, reader: MomentReader): string;
@@ -26,6 +26,11 @@ export interface LinkedPath {
26
26
  readonly fragment: string | null;
27
27
  }
28
28
  export declare function linkedPath(from: string, href: string): LinkedPath | null;
29
+ export interface KeyedLink extends RoomTarget {
30
+ readonly key: string;
31
+ }
32
+ export declare function keyedLink(href: string): KeyedLink | null;
33
+ export declare function keyedDestination(path: string, key: string): string;
29
34
  export declare function retarget(href: string, to: string): string;
30
35
  export declare function relative(from: string, target: string): string;
31
36
  export declare const SHELL_ROOMS = "/rooms/";
@@ -1,4 +1,5 @@
1
1
  import { type Definition } from './definition.js';
2
+ import { type KeyedLink } from './paths.js';
2
3
  import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
4
  export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
4
5
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
@@ -7,6 +8,7 @@ export declare function readTypes(schema: string, provided?: VerifiedModel): Ver
7
8
  type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
8
9
  export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
9
10
  export declare function bodyRoomLinks(body: string): RoomReference[];
11
+ export declare function bodyKeyedLinks(body: string): KeyedLink[];
10
12
  export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
11
13
  type Placed = {
12
14
  readonly reference: Reached;
@@ -183,6 +183,35 @@ export type AgentEnvironment = {
183
183
  name: string;
184
184
  state: 'online' | 'offline';
185
185
  };
186
+ export type ListedOwner = {
187
+ readonly user: string;
188
+ readonly name: string;
189
+ };
190
+ export type ListedSpaceRef = {
191
+ readonly space_ref: string;
192
+ readonly name: string;
193
+ };
194
+ export type RoomListEntry = {
195
+ readonly room_ref: string;
196
+ readonly room_handle: string;
197
+ readonly name: string;
198
+ readonly level: 'search' | 'open' | 'keep';
199
+ readonly access: 'owner' | 'manage' | 'write' | 'read' | 'public';
200
+ readonly owner: ListedOwner;
201
+ readonly created: string;
202
+ readonly archived?: string;
203
+ readonly exportable?: true;
204
+ readonly space?: ListedSpaceRef;
205
+ };
206
+ export type SpaceListEntry = ListedSpaceRef & {
207
+ readonly owner: ListedOwner;
208
+ readonly created: string;
209
+ readonly manages?: true;
210
+ };
211
+ export type RoomList = {
212
+ readonly rooms: readonly RoomListEntry[];
213
+ readonly spaces: readonly SpaceListEntry[];
214
+ };
186
215
  export type ListedAgent = {
187
216
  id: string;
188
217
  name: string;
@@ -233,6 +262,8 @@ export type Discovery = {
233
262
  providerLimits: readonly ProviderLimit[];
234
263
  retention: Retention;
235
264
  member?: Member;
265
+ timeZone?: string | null;
266
+ roomList?: RoomList;
236
267
  };
237
268
  export type TransportUncertainty = {
238
269
  kind: 'transport-uncertainty';
@@ -415,6 +446,10 @@ export type BinaryRequest = {
415
446
  path: string;
416
447
  revision: string;
417
448
  };
449
+ export type KeyedRequest = {
450
+ kind: 'key';
451
+ link: string;
452
+ };
418
453
  export type BinaryResult = {
419
454
  kind: 'binary';
420
455
  body: ReadableStream<Uint8Array>;
@@ -432,7 +467,7 @@ export type BinaryLinkResult = {
432
467
  kind: 'rejected';
433
468
  }) | AdapterFailure;
434
469
  export type AttachRequest = {
435
- locator: string;
470
+ locator?: string;
436
471
  name: string;
437
472
  mediaType: string;
438
473
  byteLength: number;
@@ -443,6 +478,9 @@ export type AttachResult = {
443
478
  kind: 'attached';
444
479
  path: string;
445
480
  revision: string;
481
+ } | {
482
+ kind: 'linked';
483
+ link: string;
446
484
  } | (ProviderRefusal & {
447
485
  kind: 'rejected';
448
486
  }) | AdapterFailure;
@@ -494,6 +532,10 @@ export type AuthorityChange = {
494
532
  rooms: readonly DiscoveredRoom[];
495
533
  left: readonly string[];
496
534
  member?: Member;
535
+ timeZone?: string | null;
536
+ roomList?: RoomList & {
537
+ readonly left: readonly string[];
538
+ };
497
539
  };
498
540
  export type RoomStreamEvent = {
499
541
  kind: 'opened';
@@ -508,6 +550,8 @@ export type RoomStreamEvent = {
508
550
  } | {
509
551
  kind: 'caught-up';
510
552
  expired: readonly string[];
553
+ } | {
554
+ kind: 'reported';
511
555
  } | AuthorityChange | RoomChange;
512
556
  export type RoomStream = {
513
557
  hold(rooms: readonly HeldRoom[]): void;
@@ -528,7 +572,7 @@ export type Adapter = {
528
572
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
529
573
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
530
574
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
531
- link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
575
+ link(authorization: Authorization, request: BinaryRequest | KeyedRequest): Promise<BinaryLinkResult>;
532
576
  attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
533
577
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
534
578
  search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
@@ -0,0 +1,87 @@
1
+ import type { UnsentWork } from './durability.js';
2
+ import type { Connection, FileSpool, HeldStatus } from './tables.js';
3
+ export declare const FILE_PART_BYTES = 1048576;
4
+ export declare const AUTHORED_TABLES: readonly string[];
5
+ export type AuthoredFact = 'holder' | 'generation' | 'format';
6
+ export type StoredFile = {
7
+ readonly key: string;
8
+ readonly blob: Blob;
9
+ };
10
+ type KeptPending = {
11
+ readonly id: string;
12
+ readonly batch: string;
13
+ readonly state: string;
14
+ readonly files: readonly string[];
15
+ readonly paths: readonly string[];
16
+ readonly moving: boolean;
17
+ };
18
+ export type KeptRecord = {
19
+ readonly record: string;
20
+ readonly files: readonly string[];
21
+ };
22
+ export type AuthoredRows = {
23
+ readonly locator: string;
24
+ readonly order?: readonly string[];
25
+ readonly added?: readonly KeptPending[];
26
+ readonly founded?: readonly Omit<KeptPending, 'state'>[];
27
+ readonly roomDrafts?: readonly (KeptRecord & {
28
+ readonly path: string;
29
+ })[];
30
+ readonly consumedRoomDrafts?: readonly string[];
31
+ };
32
+ export type AuthoredWrite = {
33
+ readonly writes: readonly AuthoredRows[];
34
+ readonly files: readonly StoredFile[];
35
+ readonly whole: boolean;
36
+ };
37
+ export type HeldQueues = {
38
+ readonly queues: readonly {
39
+ readonly locator: string;
40
+ readonly ids: readonly string[];
41
+ }[];
42
+ readonly pending: readonly QueuedRow[];
43
+ };
44
+ type QueuedRow = {
45
+ readonly locator: string;
46
+ readonly id: string;
47
+ readonly batch: string;
48
+ readonly state: string;
49
+ };
50
+ export declare function authoredTable(name: string): boolean;
51
+ export declare function heldTables(connection: Connection): string[];
52
+ export declare function formatted(connection: Connection, format: string, tables: readonly string[]): void;
53
+ export declare function fact(connection: Connection, name: AuthoredFact): string | null;
54
+ export declare function remember(connection: Connection, name: AuthoredFact, value: string): null;
55
+ export declare function fenced(connection: Connection, locator: string): boolean;
56
+ export declare function authoredPart(connection: Connection, key: string, part: number): Uint8Array | null;
57
+ export declare function spooled(connection: Connection, spool: FileSpool, key: string, type: string): Promise<Blob>;
58
+ export declare function queues(connection: Connection): HeldQueues['queues'];
59
+ export declare function queuedLocators(connection: Connection): string[];
60
+ export declare function authoredLocators(connection: Connection): string[];
61
+ export declare function heldOrder(connection: Connection, locator: string): readonly string[];
62
+ export declare function queueOf(connection: Connection, locator: string): Omit<QueuedRow, 'locator'>[];
63
+ export declare function moving(connection: Connection): HeldQueues;
64
+ export declare function unsentStatus(connection: Connection): Omit<HeldStatus, 'lastCompleted'>;
65
+ export declare function pendingState(connection: Connection, locator: string, id: string): string | null;
66
+ export declare function pendingBatch(connection: Connection, locator: string, id: string): string | null;
67
+ export declare function roomDraftRecords(connection: Connection, locator: string | null, paths: readonly string[] | null): string[];
68
+ export declare function chatDraftRecord(connection: Connection, conversation: string): string | null;
69
+ export declare function chatDraftRecords(connection: Connection): string[];
70
+ export declare function chatDraftConversations(connection: Connection, conversations: readonly string[] | null): string[];
71
+ export declare function chatDraftsDropped(connection: Connection, conversations: readonly string[]): void;
72
+ export declare function callRecords(connection: Connection): string[];
73
+ export declare function fences(connection: Connection): string[];
74
+ export declare function kept(connection: Connection, { writes, files, whole }: AuthoredWrite): Promise<string | null>;
75
+ export declare function amended(connection: Connection, locator: string, id: string, amendment: string): null;
76
+ export declare function roomDraft(connection: Connection, locator: string, path: string, draft: KeptRecord | null, files: readonly StoredFile[]): Promise<string | null>;
77
+ export declare function chatDraft(connection: Connection, drafts: readonly {
78
+ readonly conversation: string;
79
+ readonly record: string;
80
+ }[], dropped: readonly string[]): null;
81
+ export declare function call(connection: Connection, operation: string, held: KeptRecord | null, files: readonly StoredFile[]): Promise<null>;
82
+ export declare function fencedWork(connection: Connection, locators: readonly string[]): void;
83
+ export declare function unfenced(connection: Connection, locators: readonly string[]): void;
84
+ export declare function claim(connection: Connection, holder: string): boolean;
85
+ export declare function authoredEmptied(connection: Connection): void;
86
+ export declare function unsent(connection: Connection): UnsentWork[];
87
+ export {};
@@ -4,7 +4,7 @@ import type { AppRoom } from './listing.js';
4
4
  import type { ConnectionRefusal } from './socket.js';
5
5
  import type { RoomSchemas } from './surface.js';
6
6
  import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
7
- import type { ListedAgent, Member, ServiceMode } from './adapter.js';
7
+ import type { ListedAgent, Member, RoomList, ServiceMode } from './adapter.js';
8
8
  import type { UnsentWork } from './durability.js';
9
9
  import type { ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView } from './conversation.js';
10
10
  import { type Observation } from './observation.js';
@@ -59,6 +59,7 @@ export type MdRuntimeClient = {
59
59
  retry(): Promise<void>;
60
60
  cleanUp(): Promise<number>;
61
61
  unsent(): Promise<readonly UnsentWork[]>;
62
+ sent(): Promise<void>;
62
63
  reset(): Promise<void>;
63
64
  readAgain(): Promise<void>;
64
65
  observe: {
@@ -70,6 +71,7 @@ export type MdRuntimeClient = {
70
71
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
71
72
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
72
73
  (topic: 'member'): Promise<Observation<Member | null>>;
74
+ (topic: 'time-zone'): Promise<Observation<string | null>>;
73
75
  (topic: 'authority-changes'): Promise<Observation<number>>;
74
76
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
75
77
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
@@ -80,6 +82,7 @@ export type MdRuntimeClient = {
80
82
  (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
81
83
  (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
82
84
  (topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
85
+ (topic: 'room-list'): Promise<Observation<RoomList | null>>;
83
86
  (topic: 'figures'): Promise<Observation<FiguresResult>>;
84
87
  (topic: 'holdings'): Promise<Observation<Holdings>>;
85
88
  (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
@@ -92,6 +95,7 @@ export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void
92
95
  export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
93
96
  export { roomDraftRevision } from './identity.js';
94
97
  export { defineRoomMedia, ROOM_MEDIA, viewFile } from './media.js';
98
+ export { shownModal } from './modal.js';
95
99
  export type { Observation } from './observation.js';
96
100
  export type { Open } from './open.js';
97
101
  export { unanswered, type RuntimePort, type WireMember } from './wire.js';
@@ -1,5 +1,5 @@
1
1
  import type { HeldRow } from './messages.js';
2
- import { type HouseSource } from './source.js';
2
+ import { type HouseSource, type RequestAnswer } from './source.js';
3
3
  export type ConversationLast = {
4
4
  readonly text: string;
5
5
  readonly by: 'owner' | 'agent' | 'house';
@@ -10,12 +10,17 @@ export type ConversationStart = Extract<HouseSource, {
10
10
  }>;
11
11
  export type ConversationAsk = {
12
12
  readonly who: string;
13
+ readonly fromRoom: boolean;
13
14
  readonly agent: string | null;
14
15
  readonly room: {
15
16
  readonly ref: string;
17
+ readonly handle: string;
16
18
  readonly name: string;
17
19
  };
18
20
  readonly prompt: string;
21
+ readonly agentFunction: string | null;
22
+ readonly answer: RequestAnswer | null;
23
+ readonly instruction: string | null;
19
24
  readonly at: string;
20
25
  readonly request: string;
21
26
  readonly message?: string;
@@ -4,7 +4,7 @@ import { type ChangeSet } from './change-set.js';
4
4
  import { type LiveConversations } from './conversation-live.js';
5
5
  import { type ConversationHeld } from './conversation-row.js';
6
6
  import type { Open } from './open.js';
7
- import { type CallResult, type Offline } from './outcome.js';
7
+ import { type BinaryLinkAnswer, type CallResult, type ConversationAttachAnswer, type Offline } from './outcome.js';
8
8
  import type { ChatRequest } from './source.js';
9
9
  import type { CycleProgress } from './status.js';
10
10
  import type { RuntimeStore } from './store.js';
@@ -96,7 +96,10 @@ export type ConversationSurface = {
96
96
  pin(figures: readonly string[]): Promise<void>;
97
97
  openTurn(conversation: string, turn: string): Promise<void>;
98
98
  dismissSuggestion(conversation: string, suggestion: string): Promise<void>;
99
+ attach(file: File): Promise<ConversationAttachAnswer>;
100
+ attachment(link: string): Promise<BinaryLinkAnswer>;
99
101
  };
102
+ export type ConversationFiles = Pick<ConversationSurface, 'attach' | 'attachment'>;
100
103
  export type ConversationAnswer = {
101
104
  interaction_id: string;
102
105
  response: unknown;
@@ -120,7 +123,7 @@ export type Asked = {
120
123
  };
121
124
  export declare function joinedDraft(first: string, second: string): string;
122
125
  export declare function conversationsLearned(alive: LiveConversations): void;
123
- export declare function conversationSurface(alive: LiveConversations): ConversationSurface;
126
+ export declare function conversationSurface(alive: LiveConversations, files: ConversationFiles): ConversationSurface;
124
127
  export declare function chatDraftSurface(alive: LiveConversations): ChatDraftSurface;
125
128
  export declare function conversationsOpened(alive: LiveConversations, local: RuntimeStore): Promise<void>;
126
129
  export declare function reconcileOpening(alive: LiveConversations): Promise<void>;
@@ -5,6 +5,7 @@ export type UnsentWork = {
5
5
  readonly kind: UnsentKind;
6
6
  readonly count: number;
7
7
  };
8
+ export declare function leftToSend(unsent: readonly UnsentWork[]): boolean;
8
9
  export type AppCode = {
9
10
  readonly running: number;
10
11
  readonly older: number;
@@ -1,10 +1,22 @@
1
1
  import type { MdRuntimeClient } from './client.js';
2
- import { type ShownAnswer } from './outcome.js';
2
+ import { type DownloadAnswer, type ShownAnswer } from './outcome.js';
3
3
  export declare const ROOM_MEDIA = "room-media";
4
+ export declare const KEYED_MEDIA = "ahc-attachment";
5
+ export declare const MEDIA = "room-media, ahc-attachment";
4
6
  export declare const DIAGRAM = "md-diagram";
5
7
  export declare const VIEWING = "ahc-viewer";
6
8
  type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
9
+ export type MediaAt = {
10
+ readonly link: string;
11
+ } | {
12
+ readonly room: string;
13
+ readonly path: string;
14
+ readonly revision: string | undefined;
15
+ };
7
16
  export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
17
+ export declare function mediaAt(media: Element): MediaAt | null;
18
+ export declare function mediaTag(at: MediaAt): string;
19
+ export declare function downloadAt(client: MdRuntimeClient, at: MediaAt): Promise<DownloadAnswer>;
8
20
  export declare function rendered(element: Element): boolean;
9
21
  export declare function viewable(element: Element): boolean;
10
22
  export declare function viewFile(client: MdRuntimeClient, media: Element): void;
@@ -0,0 +1 @@
1
+ export declare function shownModal(dialog: HTMLDialogElement): void;
@@ -40,6 +40,10 @@ export type AttachAnswer = {
40
40
  kind: 'attached';
41
41
  path: string;
42
42
  } | Offline | Refused<'rejected'> | Failure;
43
+ export type ConversationAttachAnswer = {
44
+ kind: 'attached';
45
+ link: string;
46
+ } | Offline | Refused<'rejected'> | Refused<'undeclared'> | Failure;
43
47
  export type DownloadAnswer = {
44
48
  kind: 'started';
45
49
  } | Refused<'rejected'> | Refused<'absent'> | Refused<'blocked'> | Failure;
@@ -64,6 +68,7 @@ export declare function blobOf(binary: Extract<BinaryAnswer, {
64
68
  export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
65
69
  export declare function binaryLinkAnswer(result: BinaryLinkResult, held?: string): BinaryLinkAnswer;
66
70
  export declare function attachAnswer(result: AttachResult): AttachAnswer;
71
+ export declare function linkedAnswer(result: AttachResult): ConversationAttachAnswer;
67
72
  export declare const ROOM_LOCKED = "room-locked";
68
73
  export declare function lockedRoom(locator: string): Refused<'room-locked'> & {
69
74
  locator: string;
@@ -74,7 +79,7 @@ export type Offline = {
74
79
  export declare const OFFLINE: Offline;
75
80
  export declare function answeredResult(value: unknown): boolean;
76
81
  export declare const UNCERTAIN: Failure;
77
- export declare function undeclared(name: string): CallResult;
82
+ export declare function undeclared(name: string): Refused<'undeclared'>;
78
83
  export declare function failure(result: AdapterFailure): Failure;
79
84
  export declare function calledResult(result: ActionResult): CallResult;
80
85
  export declare function historyAnswer(result: HistoryResult): HistoryAnswer;
@@ -15,7 +15,7 @@ export type ObservedRead = {
15
15
  };
16
16
  export type ReadAnswers = {
17
17
  watch(name: string, input: unknown, deliver: (read: ObservedRead) => void): () => void;
18
- again(): void;
18
+ again(led?: Promise<unknown>): void;
19
19
  reopened(): void;
20
20
  };
21
21
  export type ReadAnswersOptions = {
@@ -1,4 +1,5 @@
1
1
  import { type ChangeBatch, type WrittenBy } from './change.js';
2
+ import type { ConversationFiles } from './conversation.js';
2
3
  import { type AttachAnswer, type BinaryLinkAnswer, type HeldBinaryAnswer, type HeldShownAnswer } from './outcome.js';
3
4
  import { type RoomDraftParts } from './room-draft.js';
4
5
  import type { Runtime } from './runtime.js';
@@ -28,4 +29,5 @@ export type BinaryFileSurface = {
28
29
  export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
29
30
  export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
30
31
  export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
32
+ export declare function conversationFiles(runtime: Runtime): ConversationFiles;
31
33
  export declare function binaryFileSurface(runtime: Runtime): BinaryFileSurface;
@@ -1,3 +1,4 @@
1
+ export type RequestAnswer = 'at_once' | 'ask_me' | 'off';
1
2
  export type HouseSource = {
2
3
  readonly kind: 'request';
3
4
  readonly request: string;
@@ -8,8 +9,12 @@ export type HouseSource = {
8
9
  };
9
10
  readonly room: {
10
11
  readonly ref: string;
12
+ readonly handle: string;
11
13
  readonly name: string;
12
14
  };
15
+ readonly sent: string;
16
+ readonly instruction: string | null;
17
+ readonly answer: RequestAnswer | null;
13
18
  readonly approved: string | null;
14
19
  } | {
15
20
  readonly kind: 'mail';
@@ -1,4 +1,4 @@
1
- import type { BootstrapInventory, Capability, ListedAgent, ListedConversation, Member, ProviderLimit } from '../adapter.js';
1
+ import type { BootstrapInventory, Capability, ListedAgent, ListedConversation, Member, ProviderLimit, RoomList } 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';
@@ -8,6 +8,7 @@ import type { RoomDraftRecord, SavedDraft } from '../room-draft.js';
8
8
  import type { ModelState, StoredModel } from '../model.js';
9
9
  import type { CommittedWrite, ConversationWrite, HeldConversation, HeldFact, HeldRow, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, ReplicaOpened, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from '../tables.js';
10
10
  export type { ConversationFact, ConversationWrite, HeldConversation, MessageWindow, } from '../tables.js';
11
+ declare const FILE = "\0file";
11
12
  export type TransferRecord = {
12
13
  readonly locator: string;
13
14
  readonly transfer: string;
@@ -123,11 +124,13 @@ export type Facts = {
123
124
  readonly providerLimits: readonly ProviderLimit[];
124
125
  readonly capabilities: readonly Capability[];
125
126
  readonly member: Member | null;
127
+ readonly timeZone: string | null;
126
128
  readonly targets: Readonly<Record<string, TargetRecord>>;
127
129
  readonly conversationList: readonly ListedConversation[] | null;
128
130
  readonly agentList: readonly ListedAgent[] | null;
129
131
  readonly conversationCursor: string | null;
130
132
  readonly chatPins: readonly string[];
133
+ readonly roomList: RoomList | null;
131
134
  };
132
135
  export type Commit = {
133
136
  readonly rooms: readonly RoomCommit[];
@@ -213,4 +216,8 @@ export type RuntimeStore = {
213
216
  rememberGeneration(value: string): Promise<void>;
214
217
  file(key: string, type: string): Promise<Blob>;
215
218
  };
219
+ export type FileMark = {
220
+ readonly [FILE]: string;
221
+ readonly type: string;
222
+ };
216
223
  export declare function openRuntimeStore(database: RuntimeDatabase): RuntimeStore;
@@ -1,9 +1,9 @@
1
1
  import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
2
2
  import { type HistoryQuery } from './actions.js';
3
- import type { ListedAgent, Member, ServiceMode } from './adapter.js';
3
+ import type { ListedAgent, Member, RoomList, ServiceMode } from './adapter.js';
4
4
  import type { WrittenBy } from './change.js';
5
5
  import { type ChatDraftSurface, type ConversationEntry, type ConversationAgent, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
6
- import type { UnsentWork } from './durability.js';
6
+ import { type UnsentWork } from './durability.js';
7
7
  import type { FiguresResult } from './figures.js';
8
8
  import { type Holdings } from './holdings.js';
9
9
  import { type AppRoom } from './listing.js';
@@ -52,6 +52,7 @@ export type MdRuntime = {
52
52
  retry(): Promise<void>;
53
53
  cleanUp(): Promise<number>;
54
54
  unsent(): Promise<readonly UnsentWork[]>;
55
+ sent(): Promise<void>;
55
56
  reset(): Promise<void>;
56
57
  readAgain(): Promise<void>;
57
58
  observe: {
@@ -62,6 +63,7 @@ export type MdRuntime = {
62
63
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
63
64
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
64
65
  (topic: 'member'): Promise<Observation<Member | null>>;
66
+ (topic: 'time-zone'): Promise<Observation<string | null>>;
65
67
  (topic: 'authority-changes'): Promise<Observation<number>>;
66
68
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
67
69
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
@@ -72,13 +74,14 @@ export type MdRuntime = {
72
74
  (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
73
75
  (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
74
76
  (topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
77
+ (topic: 'room-list'): Promise<Observation<RoomList | null>>;
75
78
  (topic: 'figures'): Promise<Observation<FiguresResult>>;
76
79
  (topic: 'holdings'): Promise<Observation<Holdings>>;
77
80
  (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
78
81
  };
79
82
  reauthorize(): Promise<void>;
80
83
  };
81
- export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents' | 'listed-agents' | 'figures' | 'holdings' | 'read';
84
+ export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'time-zone' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents' | 'listed-agents' | 'room-list' | 'figures' | 'holdings' | 'read';
82
85
  export type ComposedRuntime = RuntimeView & {
83
86
  seed(entry: EntrySeed): void;
84
87
  stop(): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import { type QueryAnswer, type QueryRoom } from './compile.js';
2
2
  import type { Composed } from './collection.js';
3
+ import { type AuthoredFact, type AuthoredWrite, type HeldQueues, type KeptRecord, type StoredFile } from './authored.js';
3
4
  import type { UnsentWork } from './durability.js';
4
5
  import { type ConversationWrite, type HeldConversation, type HeldFact, type HeldRow, type MessageWindow } from './messages.js';
5
6
  import type { GroupTotal, Plan } from './query.js';
@@ -7,6 +8,7 @@ import { type ReadAt } from './reads.js';
7
8
  import { type ConversationTally, type RoomTally } from './tallies.js';
8
9
  import { type Committed, type CoverLog, type Covering, type HeldEntry, type HeldLocators, type HeldRoomRow, type HeldRoomWork, type ReplicaOpened, type Referrer, type Resumed, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
9
10
  export type { Committed, CoverLog, Covering, HeldEntry, HeldLocators, HeldRoomRow, HeldRoomWork, OverlayEntry, ReplicaOpened, Referrer, Resumed, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
11
+ export { authoredEmptied, authoredTable, FILE_PART_BYTES, formatted, heldTables, type AuthoredFact, type AuthoredRows, type KeptRecord, type StoredFile, } from './authored.js';
10
12
  export type { QueryAnswer, QueryRoom } from './compile.js';
11
13
  export type { ConversationFact, ConversationWrite, HeldConversation, HeldFact, HeldRow, MessageWindow, } from './messages.js';
12
14
  export type { ConversationTally, RoomTally } from './tallies.js';
@@ -50,53 +52,13 @@ export interface SqliteDatabase {
50
52
  prepare(sql: string): SqliteStatement;
51
53
  }
52
54
  export declare function sqliteConnection(engine: SqliteEngine, database: SqliteDatabase): Connection;
53
- export declare const FILE_PART_BYTES = 1048576;
54
55
  export declare const RUNTIME_TABLES: readonly string[];
55
- export type AuthoredFact = 'holder' | 'generation';
56
- export type StoredFile = {
57
- readonly key: string;
58
- readonly blob: Blob;
59
- };
60
56
  export interface FileSpool {
61
57
  held(): Iterable<string>;
62
58
  spool(key: string, type: string, parts: Iterable<Uint8Array>): Promise<Blob>;
63
59
  drop(key: string): Promise<void>;
64
60
  probe(bytes: number): Promise<void>;
65
61
  }
66
- export type KeptPending = {
67
- readonly id: string;
68
- readonly batch: string;
69
- readonly state: string;
70
- readonly files: readonly string[];
71
- readonly paths: readonly string[];
72
- readonly moving: boolean;
73
- };
74
- export type KeptRecord = {
75
- readonly record: string;
76
- readonly files: readonly string[];
77
- };
78
- export type AuthoredRows = {
79
- readonly locator: string;
80
- readonly order?: readonly string[];
81
- readonly added?: readonly KeptPending[];
82
- readonly founded?: readonly Omit<KeptPending, 'state'>[];
83
- readonly roomDrafts?: readonly (KeptRecord & {
84
- readonly path: string;
85
- })[];
86
- readonly consumedRoomDrafts?: readonly string[];
87
- };
88
- export type HeldQueues = {
89
- readonly queues: readonly {
90
- readonly locator: string;
91
- readonly ids: readonly string[];
92
- }[];
93
- readonly pending: readonly {
94
- readonly locator: string;
95
- readonly id: string;
96
- readonly batch: string;
97
- readonly state: string;
98
- }[];
99
- };
100
62
  export type HeldStatus = {
101
63
  readonly queued: readonly string[];
102
64
  readonly lastCompleted: string | null;
@@ -130,11 +92,6 @@ type Nothing = Readonly<Record<never, never>>;
130
92
  export type CommittedWrite = Committed & {
131
93
  readonly fenced: string | null;
132
94
  };
133
- export type AuthoredWrite = {
134
- readonly writes: readonly AuthoredRows[];
135
- readonly files: readonly StoredFile[];
136
- readonly whole: boolean;
137
- };
138
95
  export interface RuntimeRequests {
139
96
  readonly 'authored.status': Asked<Nothing, HeldStatus>;
140
97
  readonly 'authored.moving': Asked<Nothing, HeldQueues>;
@@ -86,6 +86,10 @@ declare const MEMBERS: {
86
86
  readonly reach: 'whole';
87
87
  readonly effect: 'read';
88
88
  };
89
+ readonly sent: {
90
+ readonly reach: 'whole';
91
+ readonly effect: 'read';
92
+ };
89
93
  readonly reset: {
90
94
  readonly reach: 'whole';
91
95
  readonly effect: 'write';
@@ -198,6 +202,14 @@ declare const MEMBERS: {
198
202
  readonly reach: 'within';
199
203
  readonly effect: 'write';
200
204
  };
205
+ readonly 'conversation.attach': {
206
+ readonly reach: 'within';
207
+ readonly effect: 'action';
208
+ };
209
+ readonly 'conversation.attachment': {
210
+ readonly reach: 'within';
211
+ readonly effect: 'read';
212
+ };
201
213
  readonly 'chatDraft.write': {
202
214
  readonly reach: 'within';
203
215
  readonly effect: 'write';
@@ -224,6 +236,7 @@ declare const TOPICS: {
224
236
  readonly 'sync-status': 'within';
225
237
  readonly 'service-mode': 'runtime';
226
238
  readonly member: 'runtime';
239
+ readonly 'time-zone': 'runtime';
227
240
  readonly 'authority-changes': 'runtime';
228
241
  readonly query: 'within';
229
242
  readonly queue: 'within';
@@ -233,6 +246,7 @@ declare const TOPICS: {
233
246
  readonly conversations: 'within';
234
247
  readonly agents: 'within';
235
248
  readonly 'listed-agents': 'whole';
249
+ readonly 'room-list': 'whole';
236
250
  readonly figures: 'whole';
237
251
  readonly holdings: 'whole';
238
252
  readonly read: 'whole';
@@ -1,5 +1,5 @@
1
1
  import type { MdRuntimeClient } from './mdruntime/client.js';
2
- import type { HouseAnalyticsChoice, HouseAppMessage, HouseChatButtonOptions, HouseChatOptions, HouseChatTarget, HouseExternalAnswer, HouseExternalRequest, HouseNavigationMode, HouseRefusal, HouseSourceDownload, HouseSourceTop, HouseStatus, HouseTab } from './index.js';
2
+ import type { HouseAnalyticsChoice, HouseAppMessage, HouseChatButtonMount, HouseChatOptions, HouseChatTarget, 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;
@@ -10,7 +10,7 @@ export interface HouseBridgeChat {
10
10
  readonly mounted: boolean;
11
11
  }
12
12
  export interface HouseBridgeChatButton {
13
- readonly options: HouseChatButtonOptions;
13
+ readonly options: HouseChatButtonMount;
14
14
  readonly shown: boolean;
15
15
  readonly target: HouseChatTarget | null;
16
16
  readonly mounted: boolean;
package/dist/test-host.js CHANGED
@@ -153,6 +153,12 @@ export function createHouseBridgeTestHost(options = {}) {
153
153
  return new Promise(() => { });
154
154
  },
155
155
  install: () => Promise.resolve('manual'),
156
+ installed: () => Promise.resolve(false),
157
+ onTitleBar(listener) {
158
+ queueMicrotask(() => listener(null));
159
+ return () => { };
160
+ },
161
+ setTitleBar() { },
156
162
  notifications: () => Promise.resolve('unavailable'),
157
163
  telegram: () => Promise.resolve({ state: 'unavailable', name: null, username: null }),
158
164
  setTab(tab) {
package/docs/families.md CHANGED
@@ -14,15 +14,41 @@
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
16
  its Rooms, with `?slot=<name>` to open at one slot, and `/sign-out`, which
17
- signs the User out and opens sign-in.
17
+ signs the User out and opens sign-in. A decision House asks over the App, a
18
+ prepared act's approval at `/approve/<ref>` and a secret or a CLI's sign-in
19
+ at `/secret-input/<id>`, stays in the App: the shell draws House's page as
20
+ its own dialog over the App, which the App cannot reach, and `ceremony()`
21
+ resolves once it closes, with `said`, what the page said it ended with, or
22
+ `null` when it closed with nothing said, and `done`, whether the decision was
23
+ carried out.
18
24
  - **Installation** - `install()` offers the page as a Home-screen app. Where the
19
- browser has an install prompt ready the shell shows it and the call resolves
20
- `'accepted'` or `'dismissed'` with the User's choice, spending that prompt;
21
- otherwise, as on every iPhone and iPad, it resolves `'manual'` and the App
22
- shows its own instructions. A prompt the browser refuses to show, as for a
23
- call made without a click, rejects with an error named and coded by the
24
- browser's own error name, with `retryable` false, and stays ready. Call it from a click. The standard
25
- `display-mode: standalone` media query tells the App it runs installed.
25
+ browser can start the install itself the shell starts it, and otherwise,
26
+ where the browser has an install prompt ready, the shell shows it; the call
27
+ resolves `'accepted'` or `'dismissed'` with the User's choice, spending that
28
+ prompt. Otherwise, as on every iPhone and iPad, it resolves `'manual'` and
29
+ the App shows its own instructions. A start or a prompt the browser refuses,
30
+ as for a call made without a click, rejects with an error named and coded by
31
+ the browser's own error name, with `retryable` false, and a prompt stays
32
+ ready. Call it from a click. `installed()` resolves `true` where the browser
33
+ lists one of the related applications the page's manifest names as installed,
34
+ and `false` otherwise; an App's manifest names none. The standard
35
+ `display-mode` media query, `standalone`, `fullscreen` on an iPhone or
36
+ iPad, or `window-controls-overlay` in a desktop window with its title-bar
37
+ overlay on, and `navigator.standalone` tell the App it runs installed.
38
+ `install(app)` installs another App, named by its reference, from House's
39
+ own panel alone, where the browser can start the install itself, and
40
+ resolves `'manual'` elsewhere; an App's or a Site's call rejects with an
41
+ error named `HouseCeremonyRefused`.
42
+ - **Title bar** - `onTitleBar(listener)` tells the listener the box of the
43
+ window's title bar in the page, `{ x, y, width, height }`, once the shell
44
+ knows it and at each change, or `null` while the window draws its own;
45
+ only House's own panel asks an installed window to let it draw the row, so
46
+ an App's and a Site's listener hears `null`; an App shown in the installed
47
+ House's window with the overlay on starts below a bar of its top colour
48
+ that drags the window. `setTitleBar({ height,
49
+ controls })` names the page's top row, its height from the top and the box
50
+ of each control in it; the shell lets the person drag the window by the
51
+ rest of the row, and `setTitleBar(null)` ends that.
26
52
  - **Notifications** - House's own panel alone; an App's or a Site's call
27
53
  rejects with an error named `HouseCeremonyRefused`, carrying `code` and `retryable`. `notifications()` answers this browser
28
54
  storage's push state: `'on'`, `'off'`, `'blocked'` where the browser refuses
@@ -56,8 +82,8 @@
56
82
  `onAddress(listener)` hand a listener the status and the address the bridge
57
83
  already holds, then each change.
58
84
  The App reports the visitor's choice with `analyticsConsent('accept')` or
59
- `analyticsConsent('decline')`; the shell hands it to House's analytics loader, and
60
- the choice never reaches House.
85
+ `analyticsConsent('decline')`; a Site's shell that measures hands it to House's
86
+ analytics loader, every other shell drops it, and the choice never reaches House.
61
87
  - **Releases and builds** - an open App keeps the release it loaded: a newer
62
88
  release, or a newer House build, takes effect at the App's next load, offline
63
89
  too once the browser stored it. When one tab loads a newer House build, the
@@ -128,7 +154,9 @@
128
154
  resolves to a handle: `open(target)` shows the sheet, on `target.conversation` or a new
129
155
  chat with `target.agent` when it names one, docked at full height when `target.docked` is
130
156
  `true`, `hide()` hides it, keeping its chat, scroll and typed text, and `update(options)` and
131
- `unmount()` work as above, with `onOpen` and `onLink`. The page's Presentation State
157
+ `unmount()` work as above, with `onOpen` and `onLink`. `agent` among the mount's options
158
+ names the Agent the dot first opens the sheet on, a new chat with it in place of the chat the
159
+ sheet kept, and leaves the sheet hidden. The page's Presentation State
132
160
  keeps the sheet's size, place, list and open chat. A Site and the House panel have none: both calls reject with
133
161
  an error named and coded `NotSupportedError`, with `retryable` false.
134
162
 
@@ -160,7 +188,9 @@ records in `tabs` each `setTab`, answers a release code read from the
160
188
  `externalCalls`, answers `readScreenshot` from the `screenshots` it was given
161
189
  by App reference and `readSiteScreenshot` from the `siteScreenshots` it was
162
190
  given by Site identifier, answers every `install()` `'manual'`, as a browser
163
- with no install prompt does, answers every `notifications()` `'unavailable'`,
191
+ with no install prompt does, and every `installed()` `false`, tells every `onTitleBar` listener
192
+ `null`, as a window that draws its own title bar does, and takes every `setTitleBar` as such a
193
+ window does, answers every `notifications()` `'unavailable'`,
164
194
  as a browser without push does, records in `chats`
165
195
  each Chat `chat.mount` places, with its `element`, the `options` it was last
166
196
  given and whether it is still `mounted`, and in `chatButtons` each Chat button
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-cbdd0f22603b1",
3
+ "version": "0.1.0-cbfba8eb42db9",
4
4
  "description": "Types of the agents.house App bridge House hands every App: navigation, the tab title and icon, ceremonies, installation, notifications, status, 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",