@agentshouse/app-bridge 0.1.0-cdb88c540d78b → 0.1.0-cdb9036945d35

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
@@ -1,6 +1,7 @@
1
1
  export interface HouseCalls {
2
2
  readonly 'access.read': {
3
3
  readonly room_ref: string;
4
+ readonly statistics?: boolean;
4
5
  };
5
6
  readonly 'conversation.answer': {
6
7
  readonly answer: {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import type { MdRuntimeClient } from './mdruntime/client.js';
1
+ import type { MdRuntimeClient, Open } from './mdruntime/client.js';
2
2
  import type { HouseCalls } from './calls.js';
3
3
  export type { HouseCalls } from './calls.js';
4
- type Open<Value extends string> = Value | (string & {});
5
4
  export type HouseCallInput<Name extends string> = Name extends keyof HouseCalls ? HouseCalls[Name] : unknown;
6
5
  export interface HouseRuntime extends Omit<MdRuntimeClient, 'call'> {
7
6
  call<Name extends Open<keyof HouseCalls>>(name: Name, input: HouseCallInput<Name>): ReturnType<MdRuntimeClient['call']>;
@@ -73,6 +72,7 @@ export interface HouseExternalRequest {
73
72
  readonly body_base64?: string;
74
73
  readonly account?: string;
75
74
  readonly slot?: string;
75
+ readonly room_ref?: string;
76
76
  }
77
77
  export type HouseExternalAnswer = {
78
78
  readonly status: number;
@@ -29,12 +29,26 @@ export type Shape = {
29
29
  readonly schema: Readonly<Record<string, unknown>>;
30
30
  readonly defs: Readonly<Record<string, unknown>>;
31
31
  };
32
+ export type RuleValue = string | number | boolean | null;
33
+ export type Transition = {
34
+ readonly from: RuleValue;
35
+ readonly to: RuleValue;
36
+ readonly roles?: readonly string[];
37
+ };
38
+ export type FieldRules = {
39
+ readonly changeRoles?: readonly string[];
40
+ readonly initialRoles?: readonly string[];
41
+ readonly transitions?: readonly Transition[];
42
+ };
32
43
  export type Definition = {
33
44
  readonly name: string;
34
45
  readonly memberDocument: boolean;
35
46
  readonly frontmatter: ValueFacts;
36
47
  readonly fields: Readonly<Record<string, ValueFacts>>;
37
48
  readonly sections: Readonly<Record<string, SectionSpec>>;
49
+ readonly rules: Readonly<Record<string, FieldRules>>;
50
+ readonly createRoles?: readonly string[];
51
+ readonly deleteRoles?: readonly string[];
38
52
  readonly shape: Shape;
39
53
  };
40
54
  export type Failure = {
@@ -10,9 +10,9 @@ export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
10
10
  export { project } from './project.js';
11
11
  export { references } from './references.js';
12
12
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
13
- export type { Definition, JsonType, PatternFacts, PointerFacts, SectionSpec, Shape, ValueFacts, } from './definition.js';
13
+ export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
14
14
  export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, LinkOccurrence, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, Span, Validation, ValidationContext, VerifiedModel, } from './types.js';
15
15
  export { checkDocument, resolves, sectionReferences, validate, verify } from './validate.js';
16
16
  export { VERSION } from './version.js';
17
- export { equalValue, frontmatterValue } from './yaml.js';
17
+ export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
18
18
  export type { FrontmatterValue } from './yaml.js';
@@ -238,17 +238,15 @@ export type ContractUnavailable = ProviderRefusal & {
238
238
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
239
239
  export type PageToken = string;
240
240
  export type ChangeAuthor = {
241
- kind: 'user';
241
+ kind: Open<'user' | 'site'>;
242
242
  id: string;
243
243
  name: string;
244
- } | {
245
- kind: 'site';
244
+ };
245
+ export type Member = {
246
+ kind: Open<'user'>;
246
247
  id: string;
247
248
  name: string;
248
249
  };
249
- export type Member = Extract<ChangeAuthor, {
250
- kind: 'user';
251
- }>;
252
250
  export type HeadChange = {
253
251
  author: ChangeAuthor | null;
254
252
  time: string;
@@ -279,6 +277,7 @@ export type BootstrapPage = {
279
277
  models?: RoomModels;
280
278
  documents: Readonly<Record<string, string>>;
281
279
  revisions: Readonly<Record<string, string>>;
280
+ fileIds?: Readonly<Record<string, string>>;
282
281
  changes: Readonly<Record<string, HeadChange>>;
283
282
  binaryFiles: Readonly<Record<string, BinaryFile>>;
284
283
  pageToken?: PageToken;
@@ -298,6 +297,7 @@ export type RefreshPage = {
298
297
  models?: RoomModels;
299
298
  documents: Readonly<Record<string, string>>;
300
299
  revisions: Readonly<Record<string, string>>;
300
+ fileIds?: Readonly<Record<string, string>>;
301
301
  changes: Readonly<Record<string, HeadChange>>;
302
302
  binaryFiles: Readonly<Record<string, BinaryFile>>;
303
303
  removals: readonly string[];
@@ -326,6 +326,7 @@ export type MutationResult = {
326
326
  roomVersion: string;
327
327
  documents: Readonly<Record<string, string>>;
328
328
  revisions: Readonly<Record<string, string>>;
329
+ fileIds?: Readonly<Record<string, string>>;
329
330
  changes: Readonly<Record<string, HeadChange>>;
330
331
  removals: readonly string[];
331
332
  binaryFiles?: Readonly<Record<string, BinaryFile>>;
@@ -399,6 +400,13 @@ export type BinaryResult = {
399
400
  } | (ProviderRefusal & {
400
401
  kind: 'rejected';
401
402
  }) | AdapterFailure;
403
+ export type BinaryLinkResult = {
404
+ kind: 'link';
405
+ url: string;
406
+ name: string;
407
+ } | (ProviderRefusal & {
408
+ kind: 'rejected';
409
+ }) | AdapterFailure;
402
410
  export type ActionRequest = {
403
411
  name: string;
404
412
  input: unknown;
@@ -425,9 +433,12 @@ export type RoomStreamEvent = {
425
433
  } | {
426
434
  kind: 'closed';
427
435
  revoked: boolean;
436
+ lost: boolean;
428
437
  } | {
429
438
  kind: 'opening';
430
439
  expired: readonly string[];
440
+ } | {
441
+ kind: 'authority-changed';
431
442
  } | {
432
443
  kind: 'room-version';
433
444
  locator: string;
@@ -466,6 +477,9 @@ export type Adapter = {
466
477
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
467
478
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
468
479
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
480
+ link(authorization: Authorization, request: Extract<BinaryRequest, {
481
+ kind: 'path';
482
+ }>): Promise<BinaryLinkResult>;
469
483
  referrerScope(referrer: unknown): ReferrerScope | null;
470
484
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
471
485
  reached(locator: string, roomVersion: string, target: string): boolean;
@@ -3,7 +3,7 @@ import type { Member, ServiceMode } from './adapter.js';
3
3
  import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
4
4
  import { type Observation } from './observation.js';
5
5
  import type { BinaryReference } from './binary.js';
6
- import type { BinaryAnswer, CallResult, HistoryAnswer, Offline, QueueEntry } from './outcome.js';
6
+ import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry } from './outcome.js';
7
7
  import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
8
8
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
9
9
  import type { SearchRequest, SearchResult } from './search.js';
@@ -28,6 +28,7 @@ export type MdRuntimeClient = {
28
28
  presentation: {
29
29
  read(): Promise<unknown>;
30
30
  write(value: unknown): Promise<void>;
31
+ edit(members: Readonly<Record<string, unknown>>): Promise<void>;
31
32
  };
32
33
  conversation: {
33
34
  list(): Promise<readonly ConversationEntry[]>;
@@ -47,6 +48,7 @@ export type MdRuntimeClient = {
47
48
  history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
48
49
  binaryFile: {
49
50
  read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
51
+ link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
50
52
  readReference(reference: BinaryReference): Promise<BinaryAnswer>;
51
53
  };
52
54
  call(name: string, input: unknown): Promise<CallResult>;
@@ -78,4 +80,5 @@ export type MdRuntimeClient = {
78
80
  export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
79
81
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
80
82
  export type { Observation } from './observation.js';
83
+ export type { Open } from './open.js';
81
84
  export { unanswered, type RuntimePort, type WireMember } from './wire.js';
@@ -1,20 +1,21 @@
1
1
  import { type TypesResult } from './model.js';
2
2
  import { type Observation } from './observation.js';
3
3
  import { type DocumentQuery, type DocumentResult, type GroupQuery, type GroupResult, type PendingResult } from './query.js';
4
+ import { type EntrySeed } from './seed.js';
4
5
  import { type SearchRequest, type SearchResult } from './search.js';
5
6
  import { type Adapter, type Authorization, type Member, type ProviderRefusal, type ServiceMode } from './adapter.js';
6
7
  import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
7
8
  import { type WrittenBy } from './change.js';
8
9
  import type { Open } from './open.js';
9
10
  import { type BinaryReference } from './binary.js';
10
- import { type BinaryAnswer, type CallResult, type HistoryAnswer, type QueueEntry } from './outcome.js';
11
+ import { type BinaryAnswer, type BinaryLinkAnswer, type CallResult, type HistoryAnswer, type QueueEntry } from './outcome.js';
11
12
  import { type Recovery } from './recovery.js';
12
13
  import { type SaveRefusal } from './save.js';
13
14
  import { type RoomDraft, type RoomDraftWrite } from './room-draft.js';
14
15
  import { type SyncStatus } from './status.js';
15
16
  import { type RuntimeShell } from './durability.js';
16
17
  import { type RuntimeDemand } from './acquisition.js';
17
- import { type CapacityCause, type CodeAvailability, type Persistence, type Readiness } from './readiness.js';
18
+ import { type CapacityCause, type CodeAvailability, type Persistence, type Readiness, type SearchObligation } from './readiness.js';
18
19
  import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
19
20
  export type AppTypedSelection = {
20
21
  roots: readonly string[];
@@ -72,9 +73,11 @@ export type RoomDraftSurface = {
72
73
  export type PresentationSurface = {
73
74
  read(app: string): Promise<unknown>;
74
75
  write(app: string, value: unknown): Promise<void>;
76
+ edit(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
75
77
  };
76
78
  export type BinaryFileSurface = {
77
79
  read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
80
+ link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
78
81
  readReference(reference: BinaryReference): Promise<BinaryAnswer>;
79
82
  };
80
83
  export type HistoryQuery = {
@@ -126,8 +129,10 @@ export type ReadinessPort = {
126
129
  readonly target: string;
127
130
  readonly code: CodeAvailability;
128
131
  readonly capacity: CapacityCause | null;
132
+ readonly search: SearchObligation;
129
133
  };
130
134
  export type ComposedRuntime = RuntimeView & {
135
+ seed(entry: EntrySeed): void;
131
136
  stop(): Promise<void>;
132
137
  lose(locators: readonly string[]): Promise<void>;
133
138
  acquire(demand: RuntimeDemand): void;
@@ -89,6 +89,7 @@ export type ConversationStore = {
89
89
  known(): boolean;
90
90
  reconnected(): void;
91
91
  reopened(): void;
92
+ lost(): void;
92
93
  watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
93
94
  watchList(deliver: (entries: readonly ConversationEntry[]) => void): () => void;
94
95
  watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
@@ -100,4 +101,5 @@ export type ConversationStore = {
100
101
  };
101
102
  export declare function unheldView(conversation: string): ConversationView;
102
103
  export declare const SESSION_STARTED = "Session started";
104
+ export declare function newChat(agent: string): string;
103
105
  export declare function createConversationStore(deps: ConversationDependencies): ConversationStore;
@@ -29,12 +29,13 @@ export type ModelState = {
29
29
  types: VerifiedModel['types'];
30
30
  };
31
31
  export type TypesResult = {
32
- status: 'unavailable';
32
+ status: Open<'unavailable'>;
33
33
  reason: ModelUnavailableReason;
34
+ types: null;
34
35
  schema?: string | null;
35
36
  revision?: string | null;
36
37
  } | {
37
- status: 'current' | 'cached';
38
+ status: Open<'current' | 'cached'>;
38
39
  identity: string;
39
40
  version: string;
40
41
  verifiedWith: ModelIdentity;
@@ -1,4 +1,4 @@
1
- import type { ActionResult, AdapterFailure, BinaryResult, HistoryResult, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
1
+ import type { ActionResult, AdapterFailure, BinaryLinkResult, BinaryResult, HistoryResult, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
2
2
  import type { ChangeBatch } from './change.js';
3
3
  type Refused<Kind extends string> = ProviderRefusal & {
4
4
  kind: Kind;
@@ -18,8 +18,14 @@ export type BinaryAnswer = {
18
18
  kind: 'binary';
19
19
  blob: Blob;
20
20
  } | Refused<'rejected'> | Refused<'absent'> | Failure;
21
- export declare function absentBinary(path: string): BinaryAnswer;
21
+ export type BinaryLinkAnswer = {
22
+ kind: 'link';
23
+ url: string;
24
+ name: string;
25
+ } | Refused<'rejected'> | Refused<'absent'> | Failure;
26
+ export declare function absentBinary(path: string): Refused<'absent'>;
22
27
  export declare function binaryAnswer(result: BinaryResult): BinaryAnswer;
28
+ export declare function binaryLinkAnswer(result: BinaryLinkResult): BinaryLinkAnswer;
23
29
  export type Offline = {
24
30
  readonly kind: 'offline';
25
31
  };
@@ -2,6 +2,7 @@ import type { BinaryFile, HeadChange } from './adapter.js';
2
2
  import type { ChangeBatch } from './change.js';
3
3
  export type Heads = {
4
4
  revisions: Readonly<Record<string, string>>;
5
+ fileIds: Readonly<Record<string, string>>;
5
6
  changes: Readonly<Record<string, HeadChange>>;
6
7
  };
7
8
  export type HeldBinary = ({
@@ -1,6 +1,7 @@
1
1
  import { type Definition } from '../mdmodel/index.js';
2
2
  import type { HeadChange } from './adapter.js';
3
3
  import type { BinaryFileRecord } from './binary.js';
4
+ import type { Open } from './open.js';
4
5
  export type Value = string | number | boolean | null;
5
6
  export type Predicate = Value | {
6
7
  $eq: Value;
@@ -54,6 +55,7 @@ export type Select = 'all' | {
54
55
  markdown?: true;
55
56
  backlinks?: true;
56
57
  change?: true;
58
+ fileId?: true;
57
59
  };
58
60
  export type OrderOptions = {
59
61
  nulls?: 'first' | 'last';
@@ -94,6 +96,7 @@ export type QueryDocument = {
94
96
  markdown?: string;
95
97
  backlinks?: readonly Backlink[];
96
98
  change?: HeadChange | null;
99
+ fileId?: string | null;
97
100
  binaryFile?: BinaryFileRecord;
98
101
  };
99
102
  export type QueryGroup = {
@@ -110,7 +113,7 @@ export type QueryCoverage = {
110
113
  indexes: readonly string[];
111
114
  overlay: readonly string[];
112
115
  };
113
- export type Awaits = 'acquisition' | 'preparation' | 'index';
116
+ export type Awaits = Open<'acquisition' | 'preparation' | 'index'>;
114
117
  export type PendingRoom = {
115
118
  room: string;
116
119
  awaits: Awaits;
@@ -198,6 +201,7 @@ export type DocumentShape = {
198
201
  markdown: boolean;
199
202
  backlinks: boolean;
200
203
  change: boolean;
204
+ fileId: boolean;
201
205
  orderBy: readonly {
202
206
  key: KeyPlan;
203
207
  options: OrderOptions & {
@@ -218,6 +222,7 @@ export type PlanReach = {
218
222
  documents: readonly string[];
219
223
  };
220
224
  export type Plan = {
225
+ key: string;
221
226
  rooms: readonly string[] | null;
222
227
  reach: PlanReach | null;
223
228
  root: Scope;
@@ -239,8 +244,10 @@ type Entries = Readonly<Record<string, unknown>>;
239
244
  export declare function invalid(at: string, problem: string): never;
240
245
  export declare function plain(value: unknown): value is Entries;
241
246
  export declare function known(value: Entries, allowed: readonly string[], at: string): void;
247
+ export declare function flag(input: unknown, at: string): boolean;
242
248
  export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
243
249
  export declare function limitOf(input: unknown): number | null;
244
250
  export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
251
+ export declare function queryKey(query: unknown): string;
245
252
  export declare function identityOf(plan: Plan): string;
246
253
  export {};
@@ -2,7 +2,7 @@ import type { ReferrerScope } from './adapter.js';
2
2
  import type { MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
3
3
  import type { Plan, PlanReach, QueryResult } from './query.js';
4
4
  import type { Readiness } from './readiness.js';
5
- import type { SearchResult } from './search.js';
5
+ import { type SearchResult } from './search.js';
6
6
  export type ReachedDocument = {
7
7
  readonly room: string;
8
8
  readonly path: string;
@@ -27,7 +27,6 @@ export type Reachable = RuntimeView & {
27
27
  query(plan: Plan): Promise<QueryResult>;
28
28
  watchPlan(plan: Plan, deliver: (message: unknown) => void): () => void;
29
29
  search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
30
- searching(target: string): void;
31
30
  watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
32
31
  referrerScope(referrer: unknown): ReferrerScope | null;
33
32
  };
@@ -41,5 +41,9 @@ type Accepted = Extract<MutationResult, {
41
41
  export declare function applyReturned(confirmed: ConfirmedLayer, submitted: ChangeBatch, accepted: Accepted, roomVersion: string, writtenAt: string): Staged;
42
42
  export declare function replicaOf(confirmed: ConfirmedLayer, queue: readonly ChangeBatch[], previous?: Replica): Replica;
43
43
  export declare function landed(batch: ChangeBatch, confirmed: ConfirmedLayer, current?: Readonly<Record<string, string>>): boolean;
44
- export declare function withdrawals(confirmed: ConfirmedLayer, queue: readonly ChangeBatch[], withdrawable: (batch: ChangeBatch) => boolean, local: boolean): readonly ChangeBatch[];
44
+ export type Standing = {
45
+ readonly withdrawn: readonly ChangeBatch[];
46
+ readonly kept: readonly ChangeBatch[];
47
+ };
48
+ export declare function standing(confirmed: ConfirmedLayer, queue: readonly ChangeBatch[], withdrawable: (batch: ChangeBatch) => boolean, local: boolean): Standing;
45
49
  export {};
@@ -87,7 +87,7 @@ type ChangedUnderneath = {
87
87
  readonly file?: string | null;
88
88
  };
89
89
  export type ReturnReason = ProviderRefusal & {
90
- readonly kind: 'conflicted' | 'rejected' | 'expired' | 'withdrawn';
90
+ readonly kind: Open<'conflicted' | 'rejected' | 'expired' | 'withdrawn'>;
91
91
  };
92
92
  export declare function returnedBy(kind: 'expired' | 'withdrawn'): ReturnReason;
93
93
  export type RoomDraft = {
@@ -130,6 +130,18 @@ export declare function underneath(parts: HeldParts, path: string, visible: Visi
130
130
  export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
131
131
  export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
132
132
  export declare function changedParts(path: string, report: ChangedUnderneath): readonly ChangedPart[];
133
+ export type TextParts = {
134
+ readonly fields?: Readonly<Record<string, {
135
+ readonly value: unknown;
136
+ }>>;
137
+ readonly sections?: Readonly<Record<string, {
138
+ readonly value: string;
139
+ }>>;
140
+ readonly preamble?: {
141
+ readonly value: string;
142
+ };
143
+ };
144
+ export declare function partsAfter(markdown: string, parts: TextParts): string;
133
145
  export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
134
146
  export declare function moveTarget(move: {
135
147
  readonly to: string;
@@ -15,6 +15,7 @@ export type DocumentRow = {
15
15
  directories: readonly string[];
16
16
  text: string | null;
17
17
  change: HeadChange | null;
18
+ fileId: string | null;
18
19
  binary: BinaryFileRecord | null;
19
20
  };
20
21
  export type ReferenceRow = {
@@ -32,5 +33,5 @@ export type Row = DocumentRow | ReferenceRow;
32
33
  export declare function documentKey(room: string, path: string): string;
33
34
  export declare function roomOfKey(key: string): string;
34
35
  export declare function markdownPath(path: string): boolean;
35
- export declare function rowsOf(room: string, path: string, document: Frontmatter | null, composition: Composition, change: HeadChange | null, binary: BinaryFileRecord | null): readonly Row[];
36
+ export declare function rowsOf(room: string, path: string, document: Frontmatter | null, composition: Composition, change: HeadChange | null, fileId: string | null, binary: BinaryFileRecord | null): readonly Row[];
36
37
  export {};
@@ -38,6 +38,7 @@ export type BatchResult = {
38
38
  refusal: SaveRefusal;
39
39
  };
40
40
  export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): ChangeBatch;
41
+ export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
41
42
  export type Requeued = {
42
43
  kind: 'requeued';
43
44
  queue: readonly ChangeBatch[];
@@ -1,3 +1,4 @@
1
+ import type { ProviderRefusal } from './adapter.js';
1
2
  import type { ChangeSet } from './change-set.js';
2
3
  import { type CoveredRoom, type Filter, type PendingRoom } from './query.js';
3
4
  import type { Open } from './open.js';
@@ -5,6 +6,7 @@ export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
5
6
  export type SearchRequest = {
6
7
  text: string;
7
8
  documents?: Filter;
9
+ collection?: true;
8
10
  conversations?: readonly string[];
9
11
  limit?: number;
10
12
  };
@@ -29,18 +31,23 @@ export type SearchCoverage = {
29
31
  };
30
32
  export type PendingConversation = {
31
33
  conversation: string;
32
- awaits: 'index';
33
- };
34
- export type SearchPending = {
35
- pending: readonly (PendingRoom | PendingConversation)[];
34
+ awaits: Open<'index'>;
36
35
  };
37
36
  export type SearchHits = {
38
37
  documents: readonly DocumentHit[];
39
38
  messages: readonly MessageHit[];
40
39
  };
40
+ export type SearchPending = SearchHits & {
41
+ pending: readonly (PendingRoom | PendingConversation)[];
42
+ coverage: SearchCoverage;
43
+ };
44
+ export type SearchUndeclared = ProviderRefusal & {
45
+ kind: 'undeclared';
46
+ };
41
47
  export type SearchResult = (SearchHits & {
42
48
  coverage: SearchCoverage;
43
- }) | SearchPending;
49
+ }) | SearchPending | SearchUndeclared;
50
+ export declare function undeclaredSearch(): SearchUndeclared;
44
51
  export type SearchedDocument = {
45
52
  room: string;
46
53
  path: string;
@@ -61,6 +68,7 @@ export type SearchSource = {
61
68
  export type SearchPlan = {
62
69
  text: string;
63
70
  documents: unknown;
71
+ collection: boolean;
64
72
  conversations: readonly string[] | null;
65
73
  limit: number | null;
66
74
  };
@@ -77,7 +85,7 @@ export type SearchIndex = {
77
85
  search(plan: SearchPlan, documents: readonly {
78
86
  room: string;
79
87
  path: string;
80
- }[] | null, conversations: readonly string[]): SearchHits;
88
+ }[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null, selections: ReadonlyMap<string, readonly string[]> | null): SearchHits;
81
89
  };
82
90
  export declare function searchPlanOf(input: unknown): SearchPlan;
83
91
  export declare function createSearchIndex(source: SearchSource): SearchIndex;
@@ -0,0 +1,15 @@
1
+ import type { KeyedResult } from './observation.js';
2
+ import type { QueryRows } from './query.js';
3
+ export type EntrySeed = {
4
+ readonly at: Readonly<Record<string, string>>;
5
+ readonly queries: readonly {
6
+ readonly query: unknown;
7
+ readonly rows: QueryRows;
8
+ }[];
9
+ };
10
+ export type Seeded = {
11
+ readonly rows: QueryRows;
12
+ readonly at: Readonly<Record<string, string>>;
13
+ };
14
+ export declare function entrySeedOf(value: unknown): EntrySeed | null;
15
+ export declare function seededResult(seed: Seeded): KeyedResult;
@@ -7,7 +7,7 @@ import type { ChatDraftFile } from './file.js';
7
7
  import type { Submission } from './outcome.js';
8
8
  import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
9
9
  export declare const STORE_SCHEMA = 25;
10
- export declare const AUTHORED_SCHEMA = 2;
10
+ export declare const AUTHORED_SCHEMA = 3;
11
11
  export type ReplicaRecord = {
12
12
  locator: string;
13
13
  name: string;
@@ -23,10 +23,11 @@ export type ReplicaRecord = {
23
23
  documents: Readonly<Record<string, string>>;
24
24
  binaries: Readonly<Record<string, HeldBinary>>;
25
25
  revisions: Readonly<Record<string, string>>;
26
+ fileIds: Readonly<Record<string, string>>;
26
27
  changes: Readonly<Record<string, HeadChange>>;
27
28
  written: Readonly<Record<string, string>>;
28
29
  };
29
- export type StagedLayer = Pick<ReplicaRecord, 'documents' | 'binaries' | 'revisions' | 'changes' | 'written'>;
30
+ export type StagedLayer = Pick<ReplicaRecord, 'documents' | 'binaries' | 'revisions' | 'fileIds' | 'changes' | 'written'>;
30
31
  export type TransferRecord = {
31
32
  locator: string;
32
33
  transfer: string;
@@ -48,7 +49,6 @@ export type PendingState = {
48
49
  };
49
50
  export type TargetRecord = {
50
51
  established: boolean;
51
- search: boolean;
52
52
  };
53
53
  export type QueueRecord = {
54
54
  locator: string;
@@ -86,6 +86,12 @@ export type ChatDraftRecord = {
86
86
  files: readonly ChatDraftFile[];
87
87
  revision: string;
88
88
  submitted?: readonly ChatSubmission[];
89
+ moves?: readonly string[];
90
+ };
91
+ export type CallRecord = {
92
+ readonly operation: string;
93
+ readonly name: string;
94
+ readonly input: unknown;
89
95
  };
90
96
  export type RecordWrite = {
91
97
  next: ReplicaRecord;
@@ -95,6 +101,7 @@ export type RecordWrite = {
95
101
  export type AuthoredWrite = {
96
102
  locator: string;
97
103
  queue: readonly ChangeBatch[];
104
+ founded?: readonly ChangeBatch[];
98
105
  saved?: ReadonlyMap<string, readonly SavedDraft[]>;
99
106
  roomDrafts?: readonly RoomDraftRecord[];
100
107
  consumedRoomDrafts?: readonly string[];
@@ -128,8 +135,11 @@ export type RuntimeStore = {
128
135
  turnArrived(conversation: string, turn: string): Promise<boolean>;
129
136
  dropConversations(conversations: readonly string[]): Promise<void>;
130
137
  chatDrafts(): Promise<readonly ChatDraftRecord[]>;
131
- keepChatDraft(record: ChatDraftRecord): Promise<void>;
138
+ keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
132
139
  dropChatDraft(conversation: string): Promise<void>;
140
+ calls(): Promise<readonly CallRecord[]>;
141
+ keepCall(record: CallRecord): Promise<void>;
142
+ dropCall(operation: string): Promise<void>;
133
143
  keepRoomDraft(record: RoomDraftRecord): Promise<void>;
134
144
  discardRoomDraft(locator: string, path: string): Promise<void>;
135
145
  fences(): Promise<readonly string[]>;
@@ -42,6 +42,10 @@ declare const MEMBERS: {
42
42
  readonly reach: 'within';
43
43
  readonly effect: 'read';
44
44
  };
45
+ readonly 'binaryFile.link': {
46
+ readonly reach: 'within';
47
+ readonly effect: 'read';
48
+ };
45
49
  readonly 'binaryFile.readReference': {
46
50
  readonly reach: 'within';
47
51
  readonly effect: 'read';
@@ -94,6 +98,10 @@ declare const MEMBERS: {
94
98
  readonly reach: 'app';
95
99
  readonly effect: 'write';
96
100
  };
101
+ readonly 'presentation.edit': {
102
+ readonly reach: 'app';
103
+ readonly effect: 'write';
104
+ };
97
105
  readonly 'conversation.list': {
98
106
  readonly reach: 'within';
99
107
  readonly effect: 'read';
package/docs/families.md CHANGED
@@ -12,7 +12,9 @@
12
12
  purpose-bound authenticated pages. The shell navigates only to a same-origin
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
- reading and composes none.
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
18
  - **Installation** - `install()` offers the page as a Home-screen app. Where the
17
19
  browser has an install prompt ready the shell shows it and the call resolves
18
20
  `'accepted'` or `'dismissed'` with the User's choice, spending that prompt;
@@ -67,14 +69,15 @@
67
69
  refusal is House's `{ error: { code, retryable } }`, `app_release_not_found` for an
68
70
  App with no release; a read House does not answer, or one that outlived
69
71
  the browser's signed-in User, is `null`.
70
- - **External calls** - `callExternal({ url, method, headers, body, slot })`
72
+ - **External calls** - `callExternal({ url, method, headers, body, slot, room_ref })`
71
73
  has House's server send an HTTPS request to one of the release's declared
72
74
  external origins and resolves with the service's `status`, `headers` and its
73
75
  body as `body` text or `body_base64`, or a refusal as House's
74
76
  `{ error: { code, retryable } }`, or `null` when House does not answer. House fills in the
75
- App and its running release; naming an account slot places the key of the
76
- account the User connected to it, which the App never sees, and naming none
77
- sends no key. A Site's call names no slot, and the House panel names an
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
78
81
  `account` instead. `body_base64` replaces `body` for bytes.
79
82
  - **App messages** - `messages(listener)` hands the listener each message
80
83
  another holder of this App sends to this User's running copies, as `from`,
@@ -104,7 +107,8 @@ ready, settle })` lets House activate a newer release of the App while it
104
107
  answers the meaningful task the App owns, such as the selected record,
105
108
  filters, cursor, selection and scroll position, as JSON of at most 65,536
106
109
  characters; House keeps the address itself. In the newer release House
107
- calls `restore(task)`, or `restore(null)` when it opens the release without
110
+ calls `restore(task)` once its document has drawn, so the scroll position
111
+ and focus it sets hold, or `restore(null)` when it opens the release without
108
112
  a task, then `ready()`, the App's own check that its local data and
109
113
  capabilities work, and finally `settle('committed')` once the release is
110
114
  active or `settle('abandoned')` when House returns to the release before
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-cdb88c540d78b",
3
+ "version": "0.1.0-cdb9036945d35",
4
4
  "description": "Types of the agents.house App bridge House hands every App: navigation, the tab title and icon, ceremonies, installation, notifications and the icon badge, status, Site image reads, App release code, App and Site screenshot reads, and App messages, with an accessor and an in-page test host.",
5
5
  "license": "MIT",
6
6
  "type": "module",