@agentshouse/app-bridge 0.1.0-caabde65fcc7f → 0.1.0-cac2ee656ded8

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.
Files changed (107) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +136 -406
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/built-in.d.ts +3 -0
  5. package/dist/mdmodel/crockford.d.ts +3 -0
  6. package/dist/mdmodel/definition.d.ts +20 -10
  7. package/dist/mdmodel/document.d.ts +14 -8
  8. package/dist/mdmodel/event.d.ts +76 -0
  9. package/dist/mdmodel/facts.d.ts +14 -0
  10. package/dist/mdmodel/fields.d.ts +1 -1
  11. package/dist/mdmodel/house-model.d.ts +826 -0
  12. package/dist/mdmodel/house-references.d.ts +3 -0
  13. package/dist/mdmodel/index.d.ts +34 -13
  14. package/dist/mdmodel/kinds.d.ts +17 -0
  15. package/dist/mdmodel/markdown.d.ts +74 -0
  16. package/dist/mdmodel/paths.d.ts +10 -1
  17. package/dist/mdmodel/pattern.d.ts +9 -0
  18. package/dist/mdmodel/query/language.d.ts +253 -0
  19. package/dist/mdmodel/query/match.d.ts +13 -0
  20. package/dist/mdmodel/query/rows.d.ts +31 -0
  21. package/dist/mdmodel/query/sql.d.ts +38 -0
  22. package/dist/mdmodel/reserved.d.ts +5 -0
  23. package/dist/mdmodel/room-types.d.ts +6 -0
  24. package/dist/mdmodel/types.d.ts +21 -12
  25. package/dist/mdmodel/validate.d.ts +10 -6
  26. package/dist/mdruntime/actions.d.ts +25 -0
  27. package/dist/mdruntime/adapter.d.ts +88 -79
  28. package/dist/mdruntime/attached-model.d.ts +6 -0
  29. package/dist/mdruntime/bootstrap.d.ts +43 -0
  30. package/dist/mdruntime/cell.d.ts +5 -0
  31. package/dist/mdruntime/chain.d.ts +2 -1
  32. package/dist/mdruntime/change-set.d.ts +4 -0
  33. package/dist/mdruntime/change.d.ts +1 -0
  34. package/dist/mdruntime/client.d.ts +28 -21
  35. package/dist/mdruntime/collection.d.ts +23 -4
  36. package/dist/mdruntime/compile.d.ts +9 -7
  37. package/dist/mdruntime/conversation-live.d.ts +146 -0
  38. package/dist/mdruntime/conversation-row.d.ts +32 -0
  39. package/dist/mdruntime/conversation.d.ts +62 -45
  40. package/dist/mdruntime/declaration.d.ts +9 -0
  41. package/dist/mdruntime/durability.d.ts +19 -0
  42. package/dist/mdruntime/failure.d.ts +3 -0
  43. package/dist/mdruntime/figures.d.ts +48 -0
  44. package/dist/mdruntime/holdings.d.ts +28 -0
  45. package/dist/mdruntime/identity.d.ts +0 -1
  46. package/dist/mdruntime/listing.d.ts +47 -0
  47. package/dist/mdruntime/live.d.ts +22 -0
  48. package/dist/mdruntime/media.d.ts +1 -1
  49. package/dist/mdruntime/messages.d.ts +33 -5
  50. package/dist/mdruntime/model.d.ts +2 -10
  51. package/dist/mdruntime/observation.d.ts +4 -3
  52. package/dist/mdruntime/opened.d.ts +1 -1
  53. package/dist/mdruntime/outcome.d.ts +7 -1
  54. package/dist/mdruntime/overlay.d.ts +6 -1
  55. package/dist/mdruntime/preparation.d.ts +19 -0
  56. package/dist/mdruntime/presence.d.ts +51 -0
  57. package/dist/mdruntime/query.d.ts +13 -211
  58. package/dist/mdruntime/reach.d.ts +14 -12
  59. package/dist/mdruntime/readiness.d.ts +1 -4
  60. package/dist/mdruntime/reads.d.ts +38 -0
  61. package/dist/mdruntime/recovery.d.ts +3 -1
  62. package/dist/mdruntime/refresh.d.ts +26 -0
  63. package/dist/mdruntime/replica.d.ts +11 -16
  64. package/dist/mdruntime/retried.d.ts +29 -0
  65. package/dist/mdruntime/room-draft.d.ts +6 -7
  66. package/dist/mdruntime/room-drafts.d.ts +23 -0
  67. package/dist/mdruntime/runtime.d.ts +33 -0
  68. package/dist/mdruntime/save.d.ts +42 -86
  69. package/dist/mdruntime/saves.d.ts +31 -0
  70. package/dist/mdruntime/search.d.ts +12 -63
  71. package/dist/mdruntime/seed.d.ts +11 -2
  72. package/dist/mdruntime/socket/admission.d.ts +6 -0
  73. package/dist/mdruntime/socket/answers.d.ts +5 -0
  74. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  75. package/dist/mdruntime/socket/session.d.ts +37 -0
  76. package/dist/mdruntime/socket.d.ts +66 -0
  77. package/dist/mdruntime/source.d.ts +53 -0
  78. package/dist/mdruntime/status.d.ts +0 -2
  79. package/dist/mdruntime/store/installs.d.ts +29 -0
  80. package/dist/mdruntime/store/readiness.d.ts +9 -0
  81. package/dist/mdruntime/store/records.d.ts +214 -0
  82. package/dist/mdruntime/store/room-held.d.ts +7 -0
  83. package/dist/mdruntime/store/space.d.ts +10 -0
  84. package/dist/mdruntime/store/watchers.d.ts +16 -0
  85. package/dist/mdruntime/store/writes.d.ts +23 -0
  86. package/dist/mdruntime/store.d.ts +112 -155
  87. package/dist/mdruntime/stored.d.ts +60 -66
  88. package/dist/mdruntime/surface.d.ts +88 -0
  89. package/dist/mdruntime/tables.d.ts +120 -56
  90. package/dist/mdruntime/tallies.d.ts +17 -0
  91. package/dist/mdruntime/transfer.d.ts +4 -0
  92. package/dist/mdruntime/wire.d.ts +67 -7
  93. package/dist/session-content/bounds.d.ts +7 -0
  94. package/dist/session-content/check.d.ts +18 -0
  95. package/dist/session-content/index.d.ts +7 -0
  96. package/dist/session-content/parts.d.ts +103 -0
  97. package/dist/session-content/state.d.ts +61 -0
  98. package/dist/session-content/turn.d.ts +328 -0
  99. package/dist/test-host.js +1 -1
  100. package/docs/families.md +22 -16
  101. package/package.json +2 -2
  102. package/dist/mdmodel/blocks.d.ts +0 -10
  103. package/dist/mdmodel/condition.d.ts +0 -180
  104. package/dist/mdmodel/links.d.ts +0 -28
  105. package/dist/mdmodel/profile.d.ts +0 -5
  106. package/dist/mdruntime/connection.d.ts +0 -153
  107. package/dist/mdruntime/fulltext.d.ts +0 -26
package/docs/families.md CHANGED
@@ -29,11 +29,22 @@
29
29
  notifications, or `'unavailable'` where it has no push, as on an iPhone or
30
30
  iPad outside a Home-screen app. `notifications(true)` asks the browser's
31
31
  permission and subscribes, `notifications(false)` unsubscribes, and each
32
- answers the state it leaves; a failure of the browser's push service, and
33
- of `setBadge`, rejects the same way. Call `notifications(true)` from a
34
- click. `setBadge(unread)` takes the identifiers of the Human Notifications
35
- unread in this storage and sets the icon's badge to their number, or clears
36
- it at none, where the browser shows one.
32
+ answers the state it leaves; a failure of the browser's push service
33
+ rejects the same way. Call `notifications(true)` from a click. House's
34
+ service worker counts the icon's badge itself, as pushes arrive and as
35
+ read marks reach this storage.
36
+ - **Telegram** - House's own panel alone, refused to an App or a Site the same
37
+ way. `telegram()` answers `{ state, name, username }`: `state` is
38
+ `'available'` where the page runs inside a House bot's Mini App that gave it
39
+ Telegram's launch data naming an account, with that account's `name` and its
40
+ `username` or `null`, and `'unavailable'` with both `null` elsewhere.
41
+ `telegram(true)` links the signed-in User to that account and answers
42
+ `'linked'` with it; where the User's sign-in is
43
+ not recent, the page goes to sign in again, and nothing links until a later
44
+ `telegram(true)`.
45
+ Telegram's refusal rejects with an error coded `linked_elsewhere`,
46
+ `rate_limited` or `refused`, and a failed request with the browser's own
47
+ error name.
37
48
  - **Status** - the App reference the runtime client is attached under,
38
49
  `preferences`: the `roomRef` and Path of the App's own preferences document,
39
50
  or `null` until the runtime holds that Room, sync
@@ -60,9 +71,6 @@
60
71
  House is answered the outcome `transport-uncertainty`, and every other call,
61
72
  a Save or a draft write among them, fails with the retryable code
62
73
  `transport-uncertainty`.
63
- - **Site image read** - given a Published Room and the Path of one of its
64
- binary entries, it answers the web copy's path and metadata, or `null` when no
65
- copy exists. The original bytes never cross this bridge at a Site.
66
74
  - **App release code** - `sourceTop(app, release)` answers the top level of
67
75
  the latest successful release of an App the User may use: its folders, its
68
76
  files with their sizes and its root README's text, or `null` for none;
@@ -70,7 +78,7 @@
70
78
  path, its size and its `text`, or its bytes as `base64`. The browser keeps
71
79
  each answer per App and release: a read naming a release it holds answers
72
80
  without asking House, and keeping a newer release drops the earlier one. A
73
- refusal is House's `{ error: { code, retryable } }`, `app_release_not_found` for an
81
+ refusal is House's `{ error: { code, retryable } }`, `not_found` for an
74
82
  App with no release; a read House does not answer, or one that outlived
75
83
  the browser's signed-in User, is `null`.
76
84
  - **External calls** - `callExternal({ url, method, headers, body, room_ref })`
@@ -104,12 +112,10 @@
104
112
  `runtime` client, and resolves to a handle: `update(options)` replaces its
105
113
  options and `unmount()` removes it. House serves the Chat with the page and
106
114
  keeps it current, so the App installs and bundles nothing for it. The
107
- options: `conversation` opens one, `null` for a new chat, `agent` is the
108
- Agent a new chat goes to, `showChats` adds its conversation list, `width` is
109
- `full`, the element, or `3/4`, `1/2` or `1/3` of the window docked at its
110
- right edge, `onOpen` hears each conversation it opens as
111
- `{ conversation, agent }`, and `onLink` takes a link without a scheme in
112
- place of the browser. CSS custom properties named `--chat-*` on the element
115
+ options: the Chat fills the element with one chat, `conversation` opens one,
116
+ `null` for a new chat with `agent`, the Agent it goes to, `onOpen` hears
117
+ each conversation it opens as `{ conversation, agent }`, and `onLink` takes
118
+ a link without a scheme in place of the browser. CSS custom properties named `--chat-*` on the element
113
119
  or an ancestor set its look. It shows conversations only to a release that
114
120
  declares them. A Site and the House panel have none: their call rejects with
115
121
  an error named and coded `NotSupportedError`, with `retryable` false.
@@ -143,7 +149,7 @@ records in `tabs` each `setTab`, answers a release code read from the
143
149
  by App reference and `readSiteScreenshot` from the `siteScreenshots` it was
144
150
  given by Site identifier, answers every `install()` `'manual'`, as a browser
145
151
  with no install prompt does, answers every `notifications()` `'unavailable'`,
146
- as a browser without push does, settles every `setBadge`, records in `chats`
152
+ as a browser without push does, records in `chats`
147
153
  each Chat `chat.mount` places, with its `element`, the `options` it was last
148
154
  given and whether it is still `mounted`, drawing nothing, delivers each App
149
155
  message `message({ from, body })` plays, and hands `bridge.runtime` the MD
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-caabde65fcc7f",
4
- "description": "Types of the agents.house App bridge House hands every App: navigation, the tab title and icon, ceremonies, installation, notifications and the icon badge, status, Site image reads, App release code, App and Site screenshot reads, App messages and the Chat, with an accessor and an in-page test host.",
3
+ "version": "0.1.0-cac2ee656ded8",
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",
7
7
  "sideEffects": false,
@@ -1,10 +0,0 @@
1
- import type { Extent } from './types.js';
2
- export type HeadingLine = {
3
- readonly level: number;
4
- readonly name: string;
5
- readonly start: number;
6
- readonly textEnd: number;
7
- readonly next: number;
8
- };
9
- export declare function headingLines(content: string, from: number, to: number): HeadingLine[];
10
- export declare function blockRanges(content: string, from: number, to: number): Extent[];
@@ -1,180 +0,0 @@
1
- import { type Definition, type ValueFacts } from './definition.js';
2
- import type { Document, VerifiedModel } from './types.js';
3
- export type ConditionValue = string | number | boolean;
4
- export declare const CONDITION_OPERATORS: readonly ['eq', 'in', 'exists', 'contains', 'gt', 'gte', 'lt', 'lte', 'prefix'];
5
- export type ConditionOperator = (typeof CONDITION_OPERATORS)[number];
6
- export type ConditionTest = {
7
- readonly all: readonly ConditionTest[];
8
- } | {
9
- readonly any: readonly ConditionTest[];
10
- } | {
11
- readonly not: ConditionTest;
12
- } | ({
13
- readonly path: string;
14
- } & ({
15
- readonly eq: ConditionValue;
16
- } | {
17
- readonly in: readonly ConditionValue[];
18
- } | {
19
- readonly exists: boolean;
20
- } | {
21
- readonly contains: ConditionValue;
22
- } | {
23
- readonly gt: number | string;
24
- } | {
25
- readonly gte: number | string;
26
- } | {
27
- readonly lt: number | string;
28
- } | {
29
- readonly lte: number | string;
30
- } | {
31
- readonly prefix: string;
32
- }));
33
- export type ConditionScope = {
34
- readonly type: string;
35
- } | {
36
- readonly folder: string;
37
- } | {
38
- readonly document: string;
39
- };
40
- type DocumentEventBase = {
41
- readonly on: 'documents';
42
- readonly scope: ConditionScope;
43
- readonly by?: ConditionTest;
44
- readonly moved_between_rooms?: boolean;
45
- };
46
- export type DocumentCondition = (DocumentEventBase & {
47
- readonly mode: 'starts_matching';
48
- readonly new_documents: boolean;
49
- readonly match: ConditionTest;
50
- }) | (DocumentEventBase & {
51
- readonly mode: 'field_changes';
52
- readonly field: string;
53
- readonly from?: readonly ConditionValue[] | 'new';
54
- readonly to?: readonly ConditionValue[] | 'deleted';
55
- readonly match?: ConditionTest;
56
- });
57
- export type ItemCondition = {
58
- readonly on: 'items';
59
- readonly source?: string;
60
- readonly address?: string;
61
- readonly match?: ConditionTest;
62
- };
63
- export type CronCondition = {
64
- readonly on: 'clock';
65
- readonly cron: string;
66
- readonly time_zone: string;
67
- };
68
- export type DateCondition = {
69
- readonly on: 'clock';
70
- readonly scope: {
71
- readonly type: string;
72
- };
73
- readonly date: string;
74
- readonly days: number;
75
- readonly at: string;
76
- readonly time_zone: string;
77
- readonly match?: ConditionTest;
78
- };
79
- export type NotificationCondition = {
80
- readonly on: 'notifications';
81
- readonly match?: ConditionTest;
82
- };
83
- export type MessageCondition = {
84
- readonly on: 'messages';
85
- readonly match?: ConditionTest;
86
- };
87
- export type Condition = DocumentCondition | ItemCondition | CronCondition | DateCondition | NotificationCondition | MessageCondition;
88
- export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
89
- type Scalar = string | number | boolean;
90
- export type Fact = {
91
- readonly kind: FactKind;
92
- readonly value: Scalar;
93
- readonly member?: string;
94
- } | {
95
- readonly kind: 'prose';
96
- } | {
97
- readonly kind: 'null';
98
- } | {
99
- readonly kind: 'unreadable';
100
- } | {
101
- readonly kind: 'list';
102
- readonly items: readonly Fact[];
103
- } | {
104
- readonly kind: 'object';
105
- readonly fields: Readonly<Record<string, Fact>>;
106
- };
107
- export type DocumentFacts = {
108
- readonly id: string;
109
- readonly path: string;
110
- readonly type: string | null;
111
- readonly fields: Readonly<Record<string, Fact>>;
112
- readonly sections: readonly string[];
113
- };
114
- export declare const TEXT_FIELD = "/text";
115
- export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client', 'function'];
116
- export type WriteDoor = (typeof WRITE_DOORS)[number];
117
- export type Actor = {
118
- readonly user?: string;
119
- readonly site?: string;
120
- readonly app?: string;
121
- readonly door?: WriteDoor;
122
- };
123
- export type DocumentEvent = {
124
- readonly before: DocumentFacts | null;
125
- readonly after: DocumentFacts | null;
126
- readonly changed: readonly string[];
127
- readonly by: Actor;
128
- readonly moved_between_rooms: boolean;
129
- };
130
- export type ItemFacts = {
131
- readonly delivery: string;
132
- readonly source: string | null;
133
- readonly address: string | null;
134
- readonly container: string | null;
135
- readonly author: string | null;
136
- readonly headers: Readonly<Record<string, string>>;
137
- readonly json: {
138
- readonly value: unknown;
139
- } | null;
140
- };
141
- export type MessageFacts = {
142
- readonly sender: string;
143
- readonly routine: string | null;
144
- readonly path: string | null;
145
- };
146
- export type Resolved = {
147
- readonly id: string;
148
- readonly member?: string;
149
- };
150
- type Truth = boolean | undefined;
151
- export declare function factKind(facts: ValueFacts): FactKind | null;
152
- export declare function facts(document: Document, at: {
153
- readonly id: string;
154
- readonly path: string;
155
- }, model: VerifiedModel, resolve: (target: string) => Resolved | undefined): DocumentFacts;
156
- export declare function prosePaths(facts: DocumentFacts): string[];
157
- export declare function datePointers(fields: Readonly<Record<string, ValueFacts>>): string[];
158
- export declare function valuedChange(definition: Definition, field: string): boolean;
159
- export declare function changeFields(definition: Definition): string[];
160
- export declare function memberPointers(definition: Definition, memberType: string): string[];
161
- export declare const DOCUMENT_PATHS: readonly string[];
162
- export declare const ACTOR_PATHS: readonly string[];
163
- export declare const ITEM_PATHS: readonly string[];
164
- export declare const MESSAGE_PATHS: readonly string[];
165
- export declare function testOperators(definitions: readonly Definition[], path: string, memberType: string | null): readonly ConditionOperator[];
166
- export declare function actorOperators(path: string): readonly ConditionOperator[];
167
- export declare function itemOperators(path: string): readonly ConditionOperator[];
168
- export declare function messageOperators(path: string): readonly ConditionOperator[];
169
- export declare function itemKind(path: string): FactKind | null;
170
- export declare function dated(value: unknown): value is string;
171
- export declare function instant(value: unknown): bigint | undefined;
172
- export declare function pointed(value: unknown, pointer: string): unknown;
173
- export declare function members(document: DocumentFacts, path: string): readonly string[];
174
- export declare function holds(test: ConditionTest, document: DocumentFacts): Truth;
175
- export declare function inScope(scope: ConditionScope, document: Pick<DocumentFacts, 'id' | 'path' | 'type'> | null): boolean;
176
- export declare function fires(condition: DocumentCondition, event: DocumentEvent): boolean;
177
- export declare function itemFires(condition: ItemCondition, item: ItemFacts): boolean;
178
- export declare function notificationFires(condition: NotificationCondition, notification: DocumentFacts): boolean;
179
- export declare function messageFires(condition: MessageCondition, message: MessageFacts): boolean;
180
- export {};
@@ -1,28 +0,0 @@
1
- export declare function escapes(text: string, index: number): boolean;
2
- export declare function spanCursor(spans: readonly (readonly [number, number])[]): (index: number) => number | undefined;
3
- export type HrefOccurrence = {
4
- readonly href: string;
5
- readonly start: number;
6
- readonly end: number;
7
- readonly bracketed: boolean;
8
- };
9
- export type LinkUse = {
10
- readonly start: number;
11
- readonly end: number;
12
- readonly labelStart: number;
13
- readonly labelEnd: number;
14
- readonly destination: HrefOccurrence;
15
- };
16
- export type DefinitionBlock = {
17
- readonly start: number;
18
- readonly end: number;
19
- readonly destination: HrefOccurrence;
20
- };
21
- export type LinkInventory = {
22
- readonly uses: readonly LinkUse[];
23
- readonly blocks: readonly DefinitionBlock[];
24
- };
25
- export declare function fenceSpans(text: string): readonly (readonly [number, number])[];
26
- export declare function linkInventory(body: string): LinkInventory;
27
- export declare function destinations(inventory: LinkInventory): readonly HrefOccurrence[];
28
- export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
@@ -1,5 +0,0 @@
1
- export declare const MARKDOWN_SYNTAX_PROFILE: {
2
- readonly name: 'GitHub Flavored Markdown';
3
- readonly spec: '0.29';
4
- readonly url: 'https://github.github.com/gfm/';
5
- };
@@ -1,153 +0,0 @@
1
- import { type TypesResult } from './model.js';
2
- import { type Observation } from './observation.js';
3
- import { type DocumentQuery, type DocumentResult, type GroupQuery, type GroupResult, type PendingResult } from './query.js';
4
- import { type EntrySeed } from './seed.js';
5
- import { type SearchRequest, type SearchResult } from './search.js';
6
- import { type Adapter, type Authorization, type Member, type ProviderRefusal, type ServiceMode } from './adapter.js';
7
- import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
8
- import { type WrittenBy } from './change.js';
9
- import type { Open } from './open.js';
10
- import { type AttachAnswer, type BinaryLinkAnswer, type CallResult, type HeldBinaryAnswer, type HeldShownAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
11
- import { type Recovery } from './recovery.js';
12
- import { type SaveRefusal } from './save.js';
13
- import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
14
- import { type SyncStatus } from './status.js';
15
- import { type RuntimeShell } from './durability.js';
16
- import { type CodeAvailability, type Persistence, type Readiness, type SearchObligation, type Space } from './readiness.js';
17
- import type { RuntimeDatabase } from './tables.js';
18
- import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
19
- export type AppTypedSelection = {
20
- roots: readonly string[];
21
- model: TypesResult;
22
- };
23
- export type AppRoom = {
24
- name: string;
25
- locator: string;
26
- handle: string;
27
- operations: import('./adapter.js').OperationScopes;
28
- replica: import('./adapter.js').ReplicaAdmission;
29
- model: TypesResult;
30
- typedSelection: AppTypedSelection | null;
31
- providerOwnedPaths: readonly string[];
32
- roomVersion: string | null;
33
- documents: number;
34
- synchronizationAvailable: boolean;
35
- refusal: ProviderRefusal | null;
36
- locked: boolean;
37
- };
38
- export type RoomSchemas = {
39
- collection: TypesResult;
40
- typedSelection: TypesResult | null;
41
- };
42
- type RefusalReason = 'missing-required-guarantee' | 'revoked-authorization';
43
- export type ConnectionRefusalCode = Open<RefusalReason>;
44
- export type ConnectionRefusal = {
45
- code: ConnectionRefusalCode;
46
- retryable: boolean;
47
- reauthorizationOffered: boolean;
48
- refusal: ProviderRefusal | null;
49
- };
50
- export type MdRuntimeOptions = {
51
- adapter: Adapter;
52
- shell: RuntimeShell;
53
- database: RuntimeDatabase;
54
- authorization?: Authorization;
55
- signal?: AbortSignal;
56
- recovery?: Recovery;
57
- usableWhenHeld?: readonly string[];
58
- };
59
- export type SaveResult = {
60
- outcome: 'saved';
61
- identifier: string;
62
- } | ({
63
- outcome: 'refused';
64
- } & SaveRefusal);
65
- export type SavedRoomDraft = {
66
- readonly path: string;
67
- readonly revision: string;
68
- };
69
- export type SavedParts = {
70
- readonly path: string;
71
- readonly parts: RoomDraftParts;
72
- };
73
- export type RoomDraftSurface = {
74
- list(): Promise<readonly RoomDraft[]>;
75
- read(room: string, path: string): Promise<RoomDraft | null>;
76
- write(room: string, path: string, revision: string | null, parts: unknown, next?: string): Promise<RoomDraftWrite>;
77
- discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
78
- };
79
- export type PresentationSurface = {
80
- read(app: string): Promise<unknown>;
81
- write(app: string, value: unknown): Promise<void>;
82
- edit(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
83
- };
84
- export type BinaryFileSurface = {
85
- read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
86
- link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
87
- show(room: string, path: string, revision?: string): Promise<HeldShownAnswer>;
88
- attach(room: string, file: File): Promise<AttachAnswer>;
89
- part(file: string, part: number): Promise<Uint8Array | null>;
90
- };
91
- export type HistoryQuery = {
92
- revision?: string;
93
- pageToken?: string;
94
- };
95
- export type MdRuntime = {
96
- loaded(): Promise<void>;
97
- rooms(): Promise<readonly AppRoom[]>;
98
- query: {
99
- (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
100
- (query: GroupQuery): Promise<GroupResult | PendingResult>;
101
- };
102
- search(request: SearchRequest): Promise<SearchResult>;
103
- types(locator: string): RoomSchemas;
104
- roomDraft: RoomDraftSurface;
105
- conversation: ConversationSurface;
106
- chatDraft: ChatDraftSurface;
107
- presentation: PresentationSurface;
108
- save(room: string, roomDrafts: readonly SavedRoomDraft[], writtenBy?: WrittenBy): Promise<SaveResult>;
109
- saveParts(room: string, parts: readonly SavedParts[], writtenBy?: WrittenBy): Promise<SaveResult>;
110
- history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
111
- resolve(room: string, path: string, destination: string): Promise<Resolution>;
112
- binaryFile: BinaryFileSurface;
113
- call(name: string, input: unknown): Promise<CallResult>;
114
- reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
115
- log(): string;
116
- persistence(): boolean;
117
- retry(): Promise<void>;
118
- cleanUp(): Promise<number>;
119
- observe: {
120
- (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
121
- (topic: 'readiness'): Promise<Observation<Readiness>>;
122
- (topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
123
- (topic: 'storage-loss'): Promise<Observation<string | null>>;
124
- (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
125
- (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
126
- (topic: 'member'): Promise<Observation<Member | null>>;
127
- (topic: 'authority-changes'): Promise<Observation<number>>;
128
- (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
129
- (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
130
- (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
131
- (topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
132
- (topic: 'presentation', app: string): Promise<Observation<unknown>>;
133
- (topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
134
- (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
135
- (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
136
- };
137
- reauthorize(): Promise<void>;
138
- };
139
- export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
140
- export type ReadinessPort = {
141
- readonly target: string;
142
- readonly code: CodeAvailability;
143
- readonly space: Space | null;
144
- readonly search: SearchObligation;
145
- };
146
- export type ComposedRuntime = RuntimeView & {
147
- seed(entry: EntrySeed): void;
148
- stop(): Promise<void>;
149
- persisted(answer: Persistence): void;
150
- within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
151
- };
152
- export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
153
- export {};
@@ -1,26 +0,0 @@
1
- import { type QueryRoom } from './compile.js';
2
- import type { Plan } from './query.js';
3
- import type { HitCursor, SearchWindow } from './search.js';
4
- import type { Connection } from './tables.js';
5
- export declare const SEARCH_TABLES: readonly string[];
6
- export type SearchAsk = {
7
- readonly text: string;
8
- readonly limit: number;
9
- readonly after: readonly [HitCursor, HitCursor] | null;
10
- readonly total: boolean;
11
- readonly documents: {
12
- readonly plan: Plan;
13
- readonly rooms: readonly QueryRoom[];
14
- readonly beneath: readonly {
15
- readonly key: number;
16
- readonly roots: readonly string[];
17
- }[];
18
- } | null;
19
- readonly conversations: readonly string[];
20
- };
21
- export declare function indexDocument(connection: Connection, id: number, path: string, content: string): void;
22
- export declare function indexMessage(connection: Connection, id: number, text: string): void;
23
- export declare function unindexDocuments(connection: Connection, ids: Iterable<number>): void;
24
- export declare function unindexMessages(connection: Connection, ids: Iterable<number>): void;
25
- export declare function unindexAll(connection: Connection): void;
26
- export declare function searched(connection: Connection, ask: SearchAsk): SearchWindow;