@agentshouse/app-bridge 0.1.0-c69b16d4f072a → 0.1.0-c785df2285fb2

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
@@ -72,6 +72,7 @@ export interface HouseExternalRequest {
72
72
  readonly body_base64?: string;
73
73
  readonly account?: string;
74
74
  readonly slot?: string;
75
+ readonly room_ref?: string;
75
76
  }
76
77
  export type HouseExternalAnswer = {
77
78
  readonly status: number;
@@ -120,7 +120,6 @@ export type ItemFacts = {
120
120
  readonly source: string | null;
121
121
  readonly address: string | null;
122
122
  readonly has_attachment: boolean;
123
- readonly provider: string | null;
124
123
  readonly container: string | null;
125
124
  readonly author: string | null;
126
125
  readonly headers: Readonly<Record<string, string>>;
@@ -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,7 +10,7 @@ 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';
@@ -400,6 +400,13 @@ export type BinaryResult = {
400
400
  } | (ProviderRefusal & {
401
401
  kind: 'rejected';
402
402
  }) | AdapterFailure;
403
+ export type BinaryLinkResult = {
404
+ kind: 'link';
405
+ url: string;
406
+ name: string;
407
+ } | (ProviderRefusal & {
408
+ kind: 'rejected';
409
+ }) | AdapterFailure;
403
410
  export type ActionRequest = {
404
411
  name: string;
405
412
  input: unknown;
@@ -426,9 +433,12 @@ export type RoomStreamEvent = {
426
433
  } | {
427
434
  kind: 'closed';
428
435
  revoked: boolean;
436
+ lost: boolean;
429
437
  } | {
430
438
  kind: 'opening';
431
439
  expired: readonly string[];
440
+ } | {
441
+ kind: 'authority-changed';
432
442
  } | {
433
443
  kind: 'room-version';
434
444
  locator: string;
@@ -467,6 +477,9 @@ export type Adapter = {
467
477
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
468
478
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
469
479
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
480
+ link(authorization: Authorization, request: Extract<BinaryRequest, {
481
+ kind: 'path';
482
+ }>): Promise<BinaryLinkResult>;
470
483
  referrerScope(referrer: unknown): ReferrerScope | null;
471
484
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
472
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>;
@@ -8,7 +8,7 @@ import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry,
8
8
  import { type WrittenBy } from './change.js';
9
9
  import type { Open } from './open.js';
10
10
  import { type BinaryReference } from './binary.js';
11
- 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';
12
12
  import { type Recovery } from './recovery.js';
13
13
  import { type SaveRefusal } from './save.js';
14
14
  import { type RoomDraft, type RoomDraftWrite } from './room-draft.js';
@@ -73,9 +73,11 @@ export type RoomDraftSurface = {
73
73
  export type PresentationSurface = {
74
74
  read(app: string): Promise<unknown>;
75
75
  write(app: string, value: unknown): Promise<void>;
76
+ edit(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
76
77
  };
77
78
  export type BinaryFileSurface = {
78
79
  read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
80
+ link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
79
81
  readReference(reference: BinaryReference): Promise<BinaryAnswer>;
80
82
  };
81
83
  export type HistoryQuery = {
@@ -36,10 +36,14 @@ export type ChatDraft = {
36
36
  };
37
37
  export type ConversationOptions = {
38
38
  limit?: number;
39
+ after?: string;
40
+ total?: true;
39
41
  };
40
42
  export type ConversationView = {
41
43
  conversation: string;
42
44
  messages: readonly ConversationMessage[];
45
+ next?: string;
46
+ total?: number;
43
47
  turn: RunningTurn | null;
44
48
  questions: readonly unknown[];
45
49
  process: {
@@ -89,6 +93,7 @@ export type ConversationStore = {
89
93
  known(): boolean;
90
94
  reconnected(): void;
91
95
  reopened(): void;
96
+ lost(): void;
92
97
  watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
93
98
  watchList(deliver: (entries: readonly ConversationEntry[]) => void): () => void;
94
99
  watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
@@ -14,6 +14,8 @@ export type QueryChange = {
14
14
  removed: readonly RowKey[];
15
15
  order: readonly RowKey[] | null;
16
16
  coverage?: QueryCoverage;
17
+ next?: string | null;
18
+ total?: number;
17
19
  };
18
20
  export type QueryMessage = KeyedResult | QueryChange;
19
21
  export type Observed = {
@@ -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
  };
@@ -38,6 +38,7 @@ export type Filter = {
38
38
  types?: readonly string[];
39
39
  where?: Where;
40
40
  pathPrefix?: string;
41
+ paths?: readonly string[];
41
42
  hop?: Related & {
42
43
  field: string;
43
44
  };
@@ -71,6 +72,8 @@ export type DocumentQuery = Filter & {
71
72
  direction?: Direction;
72
73
  } & OrderOptions)[];
73
74
  limit?: number;
75
+ after?: string;
76
+ total?: true;
74
77
  };
75
78
  export type GroupQuery = Filter & {
76
79
  groupBy: readonly Exclude<Key, 'path'>[];
@@ -79,6 +82,8 @@ export type GroupQuery = Filter & {
79
82
  direction?: Direction;
80
83
  }[];
81
84
  limit?: number;
85
+ after?: string;
86
+ total?: true;
82
87
  };
83
88
  export type LocalQuery = DocumentQuery | GroupQuery;
84
89
  export type Backlink = {
@@ -123,9 +128,13 @@ export type PendingResult = {
123
128
  };
124
129
  export type DocumentRows = {
125
130
  documents: readonly QueryDocument[];
131
+ next?: string;
132
+ total?: number;
126
133
  };
127
134
  export type GroupRows = {
128
135
  groups: readonly QueryGroup[];
136
+ next?: string;
137
+ total?: number;
129
138
  };
130
139
  export type QueryRows = DocumentRows | GroupRows;
131
140
  export type DocumentResult = DocumentRows & {
@@ -221,11 +230,16 @@ export type PlanReach = {
221
230
  rooms: readonly string[];
222
231
  documents: readonly string[];
223
232
  };
233
+ export type Continuation = {
234
+ text: string;
235
+ values: readonly unknown[] | null;
236
+ };
224
237
  export type Plan = {
225
238
  key: string;
226
239
  rooms: readonly string[] | null;
227
240
  reach: PlanReach | null;
228
241
  root: Scope;
242
+ paths: readonly string[] | null;
229
243
  hop: (Scope & {
230
244
  field: string;
231
245
  }) | null;
@@ -234,6 +248,8 @@ export type Plan = {
234
248
  }) | null;
235
249
  shape: DocumentShape | GroupShape;
236
250
  limit: number | null;
251
+ after: Continuation | null;
252
+ total: boolean;
237
253
  };
238
254
  export declare class QueryError extends Error {
239
255
  readonly code: QueryErrorCode;
@@ -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 {};
@@ -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[];
@@ -9,6 +9,8 @@ export type SearchRequest = {
9
9
  collection?: true;
10
10
  conversations?: readonly string[];
11
11
  limit?: number;
12
+ after?: string;
13
+ total?: true;
12
14
  };
13
15
  export type DocumentHit = {
14
16
  room: string;
@@ -37,6 +39,13 @@ export type SearchHits = {
37
39
  documents: readonly DocumentHit[];
38
40
  messages: readonly MessageHit[];
39
41
  };
42
+ export type SearchWindow = SearchHits & {
43
+ next?: string;
44
+ total?: {
45
+ documents: number;
46
+ messages: number;
47
+ };
48
+ };
40
49
  export type SearchPending = SearchHits & {
41
50
  pending: readonly (PendingRoom | PendingConversation)[];
42
51
  coverage: SearchCoverage;
@@ -44,7 +53,7 @@ export type SearchPending = SearchHits & {
44
53
  export type SearchUndeclared = ProviderRefusal & {
45
54
  kind: 'undeclared';
46
55
  };
47
- export type SearchResult = (SearchHits & {
56
+ export type SearchResult = (SearchWindow & {
48
57
  coverage: SearchCoverage;
49
58
  }) | SearchPending | SearchUndeclared;
50
59
  export declare function undeclaredSearch(): SearchUndeclared;
@@ -65,12 +74,15 @@ export type SearchSource = {
65
74
  room(room: string): readonly string[];
66
75
  document(room: string, path: string): SearchedDocument | null;
67
76
  };
77
+ type HitCursor = readonly [number, string, string] | readonly [] | null;
68
78
  export type SearchPlan = {
69
79
  text: string;
70
80
  documents: unknown;
71
81
  collection: boolean;
72
82
  conversations: readonly string[] | null;
73
83
  limit: number | null;
84
+ after: readonly [HitCursor, HitCursor] | null;
85
+ total: boolean;
74
86
  };
75
87
  export type SearchIndex = {
76
88
  generation(): string;
@@ -85,7 +97,8 @@ export type SearchIndex = {
85
97
  search(plan: SearchPlan, documents: readonly {
86
98
  room: string;
87
99
  path: string;
88
- }[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null, selections: ReadonlyMap<string, readonly string[]> | null): SearchHits;
100
+ }[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null, selections: ReadonlyMap<string, readonly string[]> | null): SearchWindow;
89
101
  };
90
102
  export declare function searchPlanOf(input: unknown): SearchPlan;
91
103
  export declare function createSearchIndex(source: SearchSource): SearchIndex;
104
+ export {};
@@ -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;
@@ -66,6 +66,10 @@ export type HeldConversation = {
66
66
  read: string | null | undefined;
67
67
  partial: boolean;
68
68
  };
69
+ export type MessageWindow = {
70
+ messages: AcceptedMessage[];
71
+ more: boolean;
72
+ };
69
73
  export type ConversationWrite = {
70
74
  conversation: string;
71
75
  messages: readonly AcceptedMessage[];
@@ -88,6 +92,11 @@ export type ChatDraftRecord = {
88
92
  submitted?: readonly ChatSubmission[];
89
93
  moves?: readonly string[];
90
94
  };
95
+ export type CallRecord = {
96
+ readonly operation: string;
97
+ readonly name: string;
98
+ readonly input: unknown;
99
+ };
91
100
  export type RecordWrite = {
92
101
  next: ReplicaRecord;
93
102
  previous: ReplicaRecord | null;
@@ -96,6 +105,7 @@ export type RecordWrite = {
96
105
  export type AuthoredWrite = {
97
106
  locator: string;
98
107
  queue: readonly ChangeBatch[];
108
+ founded?: readonly ChangeBatch[];
99
109
  saved?: ReadonlyMap<string, readonly SavedDraft[]>;
100
110
  roomDrafts?: readonly RoomDraftRecord[];
101
111
  consumedRoomDrafts?: readonly string[];
@@ -123,7 +133,8 @@ export type RuntimeStore = {
123
133
  present(record: PresentationRecord): Promise<void>;
124
134
  conversations(): Promise<readonly HeldConversation[]>;
125
135
  keepMessages(write: ConversationWrite): Promise<void>;
126
- messageWindow(conversation: string, limit: number | undefined): Promise<AcceptedMessage[]>;
136
+ messageWindow(conversation: string, limit: number | undefined, before: readonly [string, string] | null): Promise<MessageWindow>;
137
+ messageCount(conversation: string): Promise<number>;
127
138
  messagesAfter(conversation: string, identity: string | null): Promise<AcceptedMessage[]>;
128
139
  messageIdentities(conversation: string): Promise<readonly string[]>;
129
140
  turnArrived(conversation: string, turn: string): Promise<boolean>;
@@ -131,6 +142,9 @@ export type RuntimeStore = {
131
142
  chatDrafts(): Promise<readonly ChatDraftRecord[]>;
132
143
  keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
133
144
  dropChatDraft(conversation: string): Promise<void>;
145
+ calls(): Promise<readonly CallRecord[]>;
146
+ keepCall(record: CallRecord): Promise<void>;
147
+ dropCall(operation: string): Promise<void>;
134
148
  keepRoomDraft(record: RoomDraftRecord): Promise<void>;
135
149
  discardRoomDraft(locator: string, path: string): Promise<void>;
136
150
  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`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-c69b16d4f072a",
3
+ "version": "0.1.0-c785df2285fb2",
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",