@agentshouse/app-bridge 0.1.0-c3ebb08f5de71 → 0.1.0-c3ee7fcd01608
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/README.md +7 -7
- package/dist/index.d.ts +669 -26
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/built-in.d.ts +3 -0
- package/dist/mdmodel/definition.d.ts +24 -11
- package/dist/mdmodel/document.d.ts +15 -8
- package/dist/mdmodel/event.d.ts +76 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/fields.d.ts +1 -1
- package/dist/mdmodel/house-model.d.ts +869 -0
- package/dist/mdmodel/house-references/crockford.d.ts +3 -0
- package/dist/mdmodel/house-references/patterns.d.ts +8 -0
- package/dist/mdmodel/index.d.ts +44 -15
- package/dist/mdmodel/indexed.d.ts +8 -0
- package/dist/mdmodel/kinds.d.ts +20 -0
- package/dist/mdmodel/markdown.d.ts +74 -0
- package/dist/mdmodel/media-type.d.ts +71 -0
- package/dist/mdmodel/moment.d.ts +6 -0
- package/dist/mdmodel/not-ready.d.ts +1 -0
- package/dist/mdmodel/paths.d.ts +15 -1
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/query/language.d.ts +254 -0
- package/dist/mdmodel/query/match.d.ts +13 -0
- package/dist/mdmodel/query/rows.d.ts +31 -0
- package/dist/mdmodel/query/sql.d.ts +42 -0
- package/dist/mdmodel/query/walk.d.ts +62 -0
- package/dist/mdmodel/references.d.ts +2 -2
- package/dist/mdmodel/reserved.d.ts +5 -0
- package/dist/mdmodel/room-types.d.ts +6 -0
- package/dist/mdmodel/types.d.ts +22 -17
- package/dist/mdmodel/validate.d.ts +12 -6
- package/dist/mdmodel/yaml.d.ts +4 -4
- package/dist/mdruntime/actions.d.ts +25 -0
- package/dist/mdruntime/adapter.d.ts +211 -112
- package/dist/mdruntime/attached-model.d.ts +6 -0
- package/dist/mdruntime/authored.d.ts +87 -0
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/change-set.d.ts +4 -0
- package/dist/mdruntime/change.d.ts +5 -0
- package/dist/mdruntime/client.d.ts +39 -26
- package/dist/mdruntime/collection.d.ts +32 -7
- package/dist/mdruntime/compile.d.ts +8 -6
- package/dist/mdruntime/conversation-live.d.ts +151 -0
- package/dist/mdruntime/conversation-row.d.ts +39 -0
- package/dist/mdruntime/conversation.d.ts +72 -51
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +20 -1
- package/dist/mdruntime/failure.d.ts +3 -0
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/house-query.d.ts +14 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/install.d.ts +59 -0
- package/dist/mdruntime/listing.d.ts +59 -0
- package/dist/mdruntime/live.d.ts +24 -0
- package/dist/mdruntime/media.d.ts +24 -0
- package/dist/mdruntime/messages.d.ts +35 -5
- package/dist/mdruntime/modal.d.ts +1 -0
- package/dist/mdruntime/model.d.ts +12 -13
- package/dist/mdruntime/observation.d.ts +31 -13
- package/dist/mdruntime/opened.d.ts +1 -1
- package/dist/mdruntime/outcome.d.ts +30 -7
- package/dist/mdruntime/overlay.d.ts +7 -2
- package/dist/mdruntime/preparation.d.ts +45 -0
- package/dist/mdruntime/presence.d.ts +57 -0
- package/dist/mdruntime/query.d.ts +14 -210
- package/dist/mdruntime/reach.d.ts +26 -14
- package/dist/mdruntime/readiness.d.ts +23 -22
- package/dist/mdruntime/reads.d.ts +38 -0
- package/dist/mdruntime/recovery.d.ts +4 -0
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +13 -19
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +51 -12
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +34 -0
- package/dist/mdruntime/save.d.ts +42 -84
- package/dist/mdruntime/saves.d.ts +33 -0
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/seed.d.ts +11 -2
- package/dist/mdruntime/socket/admission.d.ts +6 -0
- package/dist/mdruntime/socket/answers.d.ts +5 -0
- package/dist/mdruntime/socket/lanes.d.ts +27 -0
- package/dist/mdruntime/socket/session.d.ts +40 -0
- package/dist/mdruntime/socket.d.ts +67 -0
- package/dist/mdruntime/source.d.ts +58 -0
- package/dist/mdruntime/status.d.ts +4 -5
- package/dist/mdruntime/store/installs.d.ts +29 -0
- package/dist/mdruntime/store/readiness.d.ts +10 -0
- package/dist/mdruntime/store/records.d.ts +226 -0
- package/dist/mdruntime/store/room-held.d.ts +7 -0
- package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
- package/dist/mdruntime/store/space.d.ts +10 -0
- package/dist/mdruntime/store/watchers.d.ts +16 -0
- package/dist/mdruntime/store/writes.d.ts +23 -0
- package/dist/mdruntime/store.d.ts +114 -156
- package/dist/mdruntime/stored.d.ts +87 -58
- package/dist/mdruntime/surface.d.ts +93 -0
- package/dist/mdruntime/tables.d.ts +129 -107
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/wire.d.ts +88 -13
- package/dist/session-content/check.d.ts +17 -0
- package/dist/session-content/index.d.ts +6 -0
- package/dist/session-content/parts.d.ts +30 -0
- package/dist/session-content/state.d.ts +59 -0
- package/dist/session-content/turn.d.ts +137 -0
- package/dist/test-host.d.ts +8 -4
- package/dist/test-host.js +46 -29
- package/docs/families.md +108 -84
- package/package.json +2 -2
- package/dist/calls.d.ts +0 -1007
- package/dist/calls.js +0 -1
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -160
- package/dist/mdmodel/links.d.ts +0 -28
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/connection.d.ts +0 -151
- package/dist/mdruntime/file.d.ts +0 -11
- package/dist/mdruntime/fulltext.d.ts +0 -26
- package/dist/mdruntime/shared.d.ts +0 -15
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import type { SavedFacts, TypedPath, VerifiedModel } from '../mdmodel/index.js';
|
|
2
|
+
import type { Operation, SessionState } from '../session-content/index.js';
|
|
1
3
|
import type { ModelResult } from './model.js';
|
|
4
|
+
export type { SavedFacts, TypedPath };
|
|
2
5
|
import type { Open } from './open.js';
|
|
3
6
|
import type { ChangeBatch } from './change.js';
|
|
7
|
+
import type { QueryDocument, QueryGroup } from './query.js';
|
|
4
8
|
export type Authorization = object;
|
|
5
9
|
export type MdModelIdentity = {
|
|
6
10
|
identity: string;
|
|
@@ -11,35 +15,30 @@ export type TypedSelection = {
|
|
|
11
15
|
};
|
|
12
16
|
export type OperationScopes = {
|
|
13
17
|
write: readonly string[];
|
|
14
|
-
|
|
18
|
+
erase: readonly string[];
|
|
15
19
|
};
|
|
16
20
|
export type ReplicaAdmission = {
|
|
17
21
|
selection: string;
|
|
18
22
|
admission: Open<'admitted' | 'unavailable'>;
|
|
19
23
|
offline: Open<'locked' | 'open'>;
|
|
20
24
|
};
|
|
21
|
-
export type
|
|
22
|
-
name: string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
export type RoomDeclaration = {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly handle: string;
|
|
28
|
+
readonly operations: OperationScopes;
|
|
29
|
+
readonly replica: ReplicaAdmission;
|
|
30
|
+
readonly typedSelection: TypedSelection | null;
|
|
31
|
+
readonly providerOwnedPaths: readonly string[];
|
|
32
|
+
readonly authoredPaths: readonly string[];
|
|
33
|
+
};
|
|
34
|
+
export type DiscoveredRoom = RoomDeclaration & {
|
|
35
|
+
readonly locator: string;
|
|
36
|
+
readonly roomVersion: string;
|
|
30
37
|
};
|
|
31
38
|
export type Capability = {
|
|
32
39
|
name: string;
|
|
33
40
|
limits?: readonly ProviderLimit[];
|
|
34
41
|
actions?: readonly ActionDeclaration[];
|
|
35
|
-
conversationAgents?: ConversationAgents;
|
|
36
|
-
};
|
|
37
|
-
export type ConversationAgents = {
|
|
38
|
-
locator: string;
|
|
39
|
-
type: string;
|
|
40
|
-
identity: string;
|
|
41
|
-
name: string;
|
|
42
|
-
retired?: string;
|
|
43
42
|
};
|
|
44
43
|
export type ListedConversation = {
|
|
45
44
|
conversation: string;
|
|
@@ -49,8 +48,11 @@ export type ListedConversation = {
|
|
|
49
48
|
finished: string | null;
|
|
50
49
|
outcome: string | null;
|
|
51
50
|
waiting: boolean;
|
|
51
|
+
newest: string | null;
|
|
52
|
+
processEnded: string | null;
|
|
53
|
+
subject: string | null;
|
|
52
54
|
};
|
|
53
|
-
export type ConversationAction = '
|
|
55
|
+
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/option/set' | 'conversations/retry' | 'agent-functions/decide';
|
|
54
56
|
export type ConversationMessage = {
|
|
55
57
|
identity: string;
|
|
56
58
|
turn: string;
|
|
@@ -59,6 +61,7 @@ export type ConversationMessage = {
|
|
|
59
61
|
};
|
|
60
62
|
export type AcceptedMessage = ConversationMessage & {
|
|
61
63
|
position: string;
|
|
64
|
+
change: string;
|
|
62
65
|
};
|
|
63
66
|
export type ConversationHistoryRequest = {
|
|
64
67
|
conversations: readonly {
|
|
@@ -74,37 +77,10 @@ export type ConversationHistoryPage = {
|
|
|
74
77
|
export type ConversationHistories = {
|
|
75
78
|
histories: readonly ConversationHistoryPage[];
|
|
76
79
|
};
|
|
77
|
-
export type TurnContext = {
|
|
78
|
-
used: number;
|
|
79
|
-
window: number;
|
|
80
|
-
};
|
|
81
80
|
export type TurnOperation = {
|
|
82
81
|
op: 'begin';
|
|
83
82
|
at: string;
|
|
84
|
-
} |
|
|
85
|
-
op: 'start';
|
|
86
|
-
index: number;
|
|
87
|
-
part: unknown;
|
|
88
|
-
} | {
|
|
89
|
-
op: 'append';
|
|
90
|
-
index: number;
|
|
91
|
-
text: string;
|
|
92
|
-
} | {
|
|
93
|
-
op: 'status';
|
|
94
|
-
index: number;
|
|
95
|
-
status: string;
|
|
96
|
-
result: unknown;
|
|
97
|
-
} | {
|
|
98
|
-
op: 'count';
|
|
99
|
-
index: number;
|
|
100
|
-
count: number;
|
|
101
|
-
} | {
|
|
102
|
-
op: 'plan';
|
|
103
|
-
index: number;
|
|
104
|
-
entries: readonly unknown[];
|
|
105
|
-
} | ({
|
|
106
|
-
op: 'context';
|
|
107
|
-
} & TurnContext);
|
|
83
|
+
} | Operation;
|
|
108
84
|
export type ProcessCommand = {
|
|
109
85
|
[field: string]: unknown;
|
|
110
86
|
name: string;
|
|
@@ -166,6 +142,10 @@ export type ConversationEvent = {
|
|
|
166
142
|
kind: 'starting';
|
|
167
143
|
conversation: string;
|
|
168
144
|
step: string | null;
|
|
145
|
+
} | {
|
|
146
|
+
kind: 'state';
|
|
147
|
+
conversation: string;
|
|
148
|
+
state: SessionState | null;
|
|
169
149
|
} | {
|
|
170
150
|
kind: 'link';
|
|
171
151
|
conversation: string;
|
|
@@ -173,6 +153,7 @@ export type ConversationEvent = {
|
|
|
173
153
|
} | {
|
|
174
154
|
kind: 'deliveries';
|
|
175
155
|
conversation: string;
|
|
156
|
+
waiting: readonly string[];
|
|
176
157
|
unknown: readonly string[];
|
|
177
158
|
} | {
|
|
178
159
|
kind: 'accepted-message';
|
|
@@ -183,17 +164,77 @@ export type ConversationEvent = {
|
|
|
183
164
|
conversation: string;
|
|
184
165
|
} | {
|
|
185
166
|
kind: 'list';
|
|
167
|
+
agents: readonly ListedAgent[];
|
|
186
168
|
entries: readonly ListedConversation[];
|
|
169
|
+
whole: boolean;
|
|
170
|
+
more: boolean;
|
|
171
|
+
cursor: string | null;
|
|
187
172
|
} | {
|
|
188
173
|
kind: 'listed';
|
|
189
174
|
entry: ListedConversation;
|
|
175
|
+
} | {
|
|
176
|
+
kind: 'agent';
|
|
177
|
+
agent: ListedAgent;
|
|
190
178
|
} | {
|
|
191
179
|
kind: 'unlisted';
|
|
192
180
|
conversation: string;
|
|
193
181
|
};
|
|
182
|
+
export type AgentEnvironment = {
|
|
183
|
+
identity: string;
|
|
184
|
+
name: string;
|
|
185
|
+
state: 'online' | 'offline';
|
|
186
|
+
};
|
|
187
|
+
export type ListedOwner = {
|
|
188
|
+
readonly user: string;
|
|
189
|
+
readonly name: string;
|
|
190
|
+
};
|
|
191
|
+
export type ListedSpaceRef = {
|
|
192
|
+
readonly space_ref: string;
|
|
193
|
+
readonly name: string;
|
|
194
|
+
};
|
|
195
|
+
export type RoomListEntry = {
|
|
196
|
+
readonly room_ref: string;
|
|
197
|
+
readonly room_handle: string;
|
|
198
|
+
readonly name: string;
|
|
199
|
+
readonly level: 'search' | 'open' | 'keep';
|
|
200
|
+
readonly access: 'owner' | 'manage' | 'write' | 'read' | 'public';
|
|
201
|
+
readonly owner: ListedOwner;
|
|
202
|
+
readonly created: string;
|
|
203
|
+
readonly archived?: string;
|
|
204
|
+
readonly exportable?: true;
|
|
205
|
+
readonly space?: ListedSpaceRef;
|
|
206
|
+
};
|
|
207
|
+
export type SpaceListEntry = ListedSpaceRef & {
|
|
208
|
+
readonly owner: ListedOwner;
|
|
209
|
+
readonly created: string;
|
|
210
|
+
readonly manages?: true;
|
|
211
|
+
};
|
|
212
|
+
export type RoomList = {
|
|
213
|
+
readonly rooms: readonly RoomListEntry[];
|
|
214
|
+
readonly spaces: readonly SpaceListEntry[];
|
|
215
|
+
};
|
|
216
|
+
export type ListedAgent = {
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
revision: number;
|
|
220
|
+
environment: string;
|
|
221
|
+
environment_name: string;
|
|
222
|
+
environment_connected: boolean;
|
|
223
|
+
launch_directory: string;
|
|
224
|
+
cli: string;
|
|
225
|
+
model: string | null;
|
|
226
|
+
effort: string | null;
|
|
227
|
+
mode: string | null;
|
|
228
|
+
base_instructions: string;
|
|
229
|
+
in_telegram: boolean;
|
|
230
|
+
created: string;
|
|
231
|
+
retired_at: string | null;
|
|
232
|
+
};
|
|
194
233
|
export type ConversationStream = {
|
|
195
234
|
replicate(conversations: readonly string[]): void;
|
|
235
|
+
hold(cursor: string | null): void;
|
|
196
236
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
237
|
+
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
197
238
|
};
|
|
198
239
|
export type ActionDeclaration = {
|
|
199
240
|
name: string;
|
|
@@ -213,9 +254,13 @@ export type HistoryRetention = {
|
|
|
213
254
|
};
|
|
214
255
|
export type Retention = {
|
|
215
256
|
history: HistoryRetention;
|
|
216
|
-
outcome: number;
|
|
217
257
|
refreshHorizon: number;
|
|
218
258
|
};
|
|
259
|
+
export type QueriedRoom = {
|
|
260
|
+
readonly locator: string;
|
|
261
|
+
readonly handle: string;
|
|
262
|
+
readonly name: string;
|
|
263
|
+
};
|
|
219
264
|
export type Discovery = {
|
|
220
265
|
kind: 'discovery';
|
|
221
266
|
rooms: readonly DiscoveredRoom[];
|
|
@@ -223,13 +268,13 @@ export type Discovery = {
|
|
|
223
268
|
providerLimits: readonly ProviderLimit[];
|
|
224
269
|
retention: Retention;
|
|
225
270
|
member?: Member;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
readonly authorities: readonly string[];
|
|
271
|
+
timeZone?: string | null;
|
|
272
|
+
roomList?: RoomList;
|
|
273
|
+
queriesOnly?: readonly QueriedRoom[];
|
|
230
274
|
};
|
|
231
275
|
export type TransportUncertainty = {
|
|
232
276
|
kind: 'transport-uncertainty';
|
|
277
|
+
failure?: unknown;
|
|
233
278
|
};
|
|
234
279
|
export type RoomNotReadable = {
|
|
235
280
|
kind: 'room-not-readable';
|
|
@@ -255,7 +300,7 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
255
300
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
256
301
|
export type PageToken = string;
|
|
257
302
|
export type ChangeAuthor = {
|
|
258
|
-
kind: Open<'user' | 'site' | 'inbox'>;
|
|
303
|
+
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
259
304
|
id: string;
|
|
260
305
|
name: string;
|
|
261
306
|
};
|
|
@@ -273,27 +318,18 @@ export type BinaryFile = {
|
|
|
273
318
|
mediaType: string;
|
|
274
319
|
sha256: string;
|
|
275
320
|
};
|
|
276
|
-
export type HeldFile = {
|
|
277
|
-
readonly path: string;
|
|
278
|
-
readonly revision: string;
|
|
279
|
-
};
|
|
280
|
-
export type HeldContent = {
|
|
281
|
-
files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
|
|
282
|
-
contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
|
|
283
|
-
readonly content: string;
|
|
284
|
-
readonly revision: string;
|
|
285
|
-
}>>;
|
|
286
|
-
};
|
|
287
321
|
export type BootstrapRequest = {
|
|
288
322
|
locator: string;
|
|
289
323
|
selection: string;
|
|
290
324
|
pageToken?: PageToken;
|
|
291
|
-
held?: HeldContent;
|
|
292
|
-
received?: Uint8Array;
|
|
293
325
|
arriving?: (bytes: number) => void;
|
|
326
|
+
signal?: AbortSignal;
|
|
327
|
+
};
|
|
328
|
+
export type BootstrapPart = {
|
|
329
|
+
readonly id: string;
|
|
330
|
+
readonly bytes: number;
|
|
294
331
|
};
|
|
295
332
|
export type BootstrapInventory = {
|
|
296
|
-
readonly parts: number;
|
|
297
333
|
readonly bytes: number;
|
|
298
334
|
};
|
|
299
335
|
export type RoomModels = {
|
|
@@ -304,18 +340,23 @@ export type BootstrapPage = {
|
|
|
304
340
|
roomVersion: string;
|
|
305
341
|
models?: RoomModels;
|
|
306
342
|
documents: Readonly<Record<string, string>>;
|
|
343
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
307
344
|
revisions: Readonly<Record<string, string>>;
|
|
308
345
|
fileIds?: Readonly<Record<string, string>>;
|
|
346
|
+
created?: Readonly<Record<string, string>>;
|
|
309
347
|
changes: Readonly<Record<string, HeadChange>>;
|
|
310
348
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
311
349
|
folders?: readonly string[];
|
|
312
350
|
pageToken?: PageToken;
|
|
313
|
-
|
|
314
|
-
|
|
351
|
+
parts?: readonly BootstrapPart[];
|
|
352
|
+
bytes?: number;
|
|
353
|
+
};
|
|
354
|
+
export type NotReady = {
|
|
355
|
+
kind: 'not-ready';
|
|
315
356
|
};
|
|
316
357
|
export type BootstrapResult = BootstrapPage | {
|
|
317
358
|
kind: 'beyond-horizon';
|
|
318
|
-
} | AdapterFailure;
|
|
359
|
+
} | NotReady | AdapterFailure;
|
|
319
360
|
export type RefreshRequest = {
|
|
320
361
|
locator: string;
|
|
321
362
|
selection: string;
|
|
@@ -327,8 +368,10 @@ export type RefreshPage = {
|
|
|
327
368
|
roomVersion: string;
|
|
328
369
|
models?: RoomModels;
|
|
329
370
|
documents: Readonly<Record<string, string>>;
|
|
371
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
330
372
|
revisions: Readonly<Record<string, string>>;
|
|
331
373
|
fileIds?: Readonly<Record<string, string>>;
|
|
374
|
+
created?: Readonly<Record<string, string>>;
|
|
332
375
|
changes: Readonly<Record<string, HeadChange>>;
|
|
333
376
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
334
377
|
removals: readonly string[];
|
|
@@ -366,27 +409,18 @@ export type AcceptedRoom = {
|
|
|
366
409
|
};
|
|
367
410
|
export type MutationResult = (AcceptedRoom & {
|
|
368
411
|
kind: 'accepted';
|
|
369
|
-
author?: string;
|
|
370
|
-
time?: string;
|
|
371
412
|
destination?: AcceptedRoom;
|
|
372
413
|
}) | (ProviderRefusal & {
|
|
373
414
|
kind: 'conflicted';
|
|
374
|
-
roomVersion?: string;
|
|
375
415
|
affected: Readonly<Record<string, string>>;
|
|
376
416
|
}) | (ProviderRefusal & {
|
|
377
417
|
kind: 'rejected';
|
|
378
418
|
affected: Readonly<Record<string, string>>;
|
|
379
419
|
}) | RetryableRefusal | {
|
|
380
420
|
kind: 'write-halted';
|
|
381
|
-
} | {
|
|
382
|
-
kind: 'expired';
|
|
383
|
-
restored?: true;
|
|
384
421
|
} | AdapterFailure;
|
|
385
422
|
export type HistoryAuthor = {
|
|
386
|
-
kind: 'user';
|
|
387
|
-
id: string;
|
|
388
|
-
} | {
|
|
389
|
-
kind: 'site' | 'inbox';
|
|
423
|
+
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
390
424
|
id: string;
|
|
391
425
|
name: string;
|
|
392
426
|
};
|
|
@@ -419,6 +453,10 @@ export type BinaryRequest = {
|
|
|
419
453
|
path: string;
|
|
420
454
|
revision: string;
|
|
421
455
|
};
|
|
456
|
+
export type KeyedRequest = {
|
|
457
|
+
kind: 'key';
|
|
458
|
+
link: string;
|
|
459
|
+
};
|
|
422
460
|
export type BinaryResult = {
|
|
423
461
|
kind: 'binary';
|
|
424
462
|
body: ReadableStream<Uint8Array>;
|
|
@@ -431,6 +469,25 @@ export type BinaryLinkResult = {
|
|
|
431
469
|
kind: 'link';
|
|
432
470
|
url: string;
|
|
433
471
|
name: string;
|
|
472
|
+
mediaType?: string;
|
|
473
|
+
} | (ProviderRefusal & {
|
|
474
|
+
kind: 'rejected';
|
|
475
|
+
}) | AdapterFailure;
|
|
476
|
+
export type AttachRequest = {
|
|
477
|
+
locator?: string;
|
|
478
|
+
name: string;
|
|
479
|
+
mediaType: string;
|
|
480
|
+
byteLength: number;
|
|
481
|
+
sha256: string;
|
|
482
|
+
blob: Blob;
|
|
483
|
+
};
|
|
484
|
+
export type AttachResult = {
|
|
485
|
+
kind: 'attached';
|
|
486
|
+
path: string;
|
|
487
|
+
revision: string;
|
|
488
|
+
} | {
|
|
489
|
+
kind: 'linked';
|
|
490
|
+
link: string;
|
|
434
491
|
} | (ProviderRefusal & {
|
|
435
492
|
kind: 'rejected';
|
|
436
493
|
}) | AdapterFailure;
|
|
@@ -448,66 +505,108 @@ export type ActionResult = {
|
|
|
448
505
|
at?: RoomVersionAt;
|
|
449
506
|
} | (ProviderRefusal & {
|
|
450
507
|
kind: 'rejected';
|
|
508
|
+
reset?: string;
|
|
509
|
+
}) | AdapterFailure;
|
|
510
|
+
export type SearchHit = {
|
|
511
|
+
room: string;
|
|
512
|
+
path: string;
|
|
513
|
+
line?: number;
|
|
514
|
+
snippet?: string;
|
|
515
|
+
};
|
|
516
|
+
export type SearchAsk = {
|
|
517
|
+
text: string;
|
|
518
|
+
rooms: readonly string[] | null;
|
|
519
|
+
};
|
|
520
|
+
export type SearchAnswer = {
|
|
521
|
+
kind: 'found';
|
|
522
|
+
documents: readonly SearchHit[];
|
|
523
|
+
} | (ProviderRefusal & {
|
|
524
|
+
kind: 'rejected';
|
|
525
|
+
}) | AdapterFailure;
|
|
526
|
+
export type HouseQueryAsk = {
|
|
527
|
+
room: string;
|
|
528
|
+
query: Readonly<Record<string, unknown>>;
|
|
529
|
+
};
|
|
530
|
+
export type HouseQueryRows = {
|
|
531
|
+
kind: 'rows';
|
|
532
|
+
documents: readonly QueryDocument[];
|
|
533
|
+
next?: string;
|
|
534
|
+
total?: number;
|
|
535
|
+
totalCapped?: true;
|
|
536
|
+
};
|
|
537
|
+
export type HouseQueryGroups = {
|
|
538
|
+
kind: 'groups';
|
|
539
|
+
groups: readonly QueryGroup[];
|
|
540
|
+
next?: string;
|
|
541
|
+
capped?: true;
|
|
542
|
+
};
|
|
543
|
+
export type HouseQueryAnswer = HouseQueryRows | HouseQueryGroups | (ProviderRefusal & {
|
|
544
|
+
kind: 'rejected';
|
|
451
545
|
}) | AdapterFailure;
|
|
452
546
|
export type HeldRoom = {
|
|
453
547
|
locator: string;
|
|
548
|
+
roomVersion: string | null;
|
|
549
|
+
};
|
|
550
|
+
export type RoomChange = {
|
|
551
|
+
kind: 'room-change';
|
|
552
|
+
locator: string;
|
|
553
|
+
from: string | null;
|
|
454
554
|
roomVersion: string;
|
|
555
|
+
read(): Promise<RefreshPage>;
|
|
556
|
+
};
|
|
557
|
+
export type AuthorityChange = {
|
|
558
|
+
kind: 'authority-changed';
|
|
559
|
+
rooms: readonly DiscoveredRoom[];
|
|
560
|
+
left: readonly string[];
|
|
561
|
+
member?: Member;
|
|
562
|
+
timeZone?: string | null;
|
|
563
|
+
roomList?: RoomList & {
|
|
564
|
+
readonly left: readonly string[];
|
|
565
|
+
};
|
|
455
566
|
};
|
|
456
|
-
export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
|
|
457
567
|
export type RoomStreamEvent = {
|
|
458
568
|
kind: 'opened';
|
|
569
|
+
} | {
|
|
570
|
+
kind: 'discovered';
|
|
571
|
+
discovery: Discovery;
|
|
459
572
|
} | {
|
|
460
573
|
kind: 'closed';
|
|
461
574
|
revoked: boolean;
|
|
462
575
|
lost: boolean;
|
|
576
|
+
authorityChanged: boolean;
|
|
463
577
|
} | {
|
|
464
|
-
kind: '
|
|
578
|
+
kind: 'caught-up';
|
|
465
579
|
expired: readonly string[];
|
|
466
580
|
} | {
|
|
467
|
-
kind: '
|
|
468
|
-
|
|
469
|
-
} | {
|
|
470
|
-
kind: 'room-version';
|
|
471
|
-
locator: string;
|
|
472
|
-
roomVersion: string;
|
|
473
|
-
};
|
|
474
|
-
export type KeptReceipt = {
|
|
475
|
-
key: string;
|
|
476
|
-
head: unknown;
|
|
477
|
-
};
|
|
478
|
-
export type StreamReceipts = {
|
|
479
|
-
heads(): Promise<readonly KeptReceipt[]>;
|
|
480
|
-
parts(key: string, count: number): Promise<readonly unknown[]>;
|
|
481
|
-
keep(key: string, head: unknown, part?: {
|
|
482
|
-
index: number;
|
|
483
|
-
value: unknown;
|
|
484
|
-
}): Promise<void>;
|
|
485
|
-
drop(keys: readonly string[]): Promise<void>;
|
|
486
|
-
};
|
|
581
|
+
kind: 'reported';
|
|
582
|
+
} | AuthorityChange | RoomChange;
|
|
487
583
|
export type RoomStream = {
|
|
488
584
|
hold(rooms: readonly HeldRoom[]): void;
|
|
489
|
-
|
|
490
|
-
published(locator: string, roomVersion: string): void;
|
|
491
|
-
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
|
|
585
|
+
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
492
586
|
};
|
|
587
|
+
export type PathRule = (path: string) => boolean;
|
|
493
588
|
export type Adapter = {
|
|
494
589
|
readonly localSaves?: true;
|
|
495
|
-
readonly
|
|
496
|
-
readonly
|
|
497
|
-
readonly
|
|
590
|
+
readonly roomTypes?: VerifiedModel;
|
|
591
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
592
|
+
readonly pathRule?: PathRule;
|
|
593
|
+
readonly unkeptReads?: readonly string[];
|
|
594
|
+
readonly leadingReads?: readonly string[];
|
|
498
595
|
authorize(): Promise<Authorization>;
|
|
499
|
-
discover(authorization: Authorization
|
|
596
|
+
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
500
597
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
501
|
-
refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
598
|
+
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
502
599
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
503
600
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
504
601
|
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
505
|
-
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
602
|
+
link(authorization: Authorization, request: BinaryRequest | KeyedRequest): Promise<BinaryLinkResult>;
|
|
603
|
+
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
506
604
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
605
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
606
|
+
queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
|
|
507
607
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
508
608
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
509
609
|
roomStream?: RoomStream;
|
|
510
610
|
conversations?: ConversationStream;
|
|
511
611
|
serviceMode?: ServiceModeSignal;
|
|
512
612
|
};
|
|
513
|
-
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type VerifiedModel } from '../mdmodel/index.js';
|
|
2
|
+
import type { ModelResult, ModelState } from './model.js';
|
|
3
|
+
export declare const NO_ROOM_TYPES: VerifiedModel;
|
|
4
|
+
export declare function builtInModel(roomTypes: VerifiedModel): ModelState;
|
|
5
|
+
export declare function schemaTypes(schema: string | null, roomTypes: VerifiedModel): VerifiedModel['types'];
|
|
6
|
+
export declare function attachedModel(answer: ModelResult, roomTypes: VerifiedModel): ModelState;
|
|
@@ -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 {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ModelState } from './model.js';
|
|
2
|
+
import type { Adapter, TypedPath, AdapterFailure, Authorization, BootstrapPart, DiscoveredRoom, NotReady, RetryableRefusal, RoomModels } from './adapter.js';
|
|
3
|
+
import type { Composition } from './collection.js';
|
|
4
|
+
import type { InstallationStep } from './readiness.js';
|
|
5
|
+
import { type Refreshing } from './refresh.js';
|
|
6
|
+
import { type ReplicaRecord } from './replica.js';
|
|
7
|
+
import type { StagedPage, TransferRecord } from './store.js';
|
|
8
|
+
import { type Unconfirmed } from './transfer.js';
|
|
9
|
+
export type Bootstrapped = {
|
|
10
|
+
kind: 'staged';
|
|
11
|
+
record: ReplicaRecord;
|
|
12
|
+
refreshed: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type BootstrapOutcome = Bootstrapped | Unconfirmed | NotReady | RetryableRefusal | AdapterFailure;
|
|
15
|
+
export type HeldModels = {
|
|
16
|
+
collection: ModelState;
|
|
17
|
+
};
|
|
18
|
+
export type Remodel = (models: RoomModels | undefined, held: HeldModels) => HeldModels;
|
|
19
|
+
export type Reads = Pick<Adapter, 'bootstrap' | 'refresh' | 'reached'>;
|
|
20
|
+
export type Arriving = {
|
|
21
|
+
at(bytes: number): void;
|
|
22
|
+
end(): void;
|
|
23
|
+
};
|
|
24
|
+
export type Resumed = {
|
|
25
|
+
readonly record: TransferRecord | null;
|
|
26
|
+
readonly staged: ReadonlySet<string>;
|
|
27
|
+
};
|
|
28
|
+
export type Staging = {
|
|
29
|
+
held(locator: string): TransferRecord | null;
|
|
30
|
+
turn(locator: string, step: InstallationStep): Promise<() => void>;
|
|
31
|
+
unqueued(): Promise<void>;
|
|
32
|
+
queued(text: number): () => void;
|
|
33
|
+
arriving(locator: string): Arriving;
|
|
34
|
+
readonly streamed: boolean;
|
|
35
|
+
stage(record: TransferRecord, page: StagedPage, composition: Composition): Promise<TransferRecord | null>;
|
|
36
|
+
resume(record: TransferRecord, parts: readonly BootstrapPart[], composition: Composition): Promise<Resumed | null>;
|
|
37
|
+
derive(locator: string, key: number, composition: Composition): Promise<boolean>;
|
|
38
|
+
refreshing(locator: string, key: number, composition: Composition): Promise<Refreshing>;
|
|
39
|
+
abandon(locator: string): Promise<void>;
|
|
40
|
+
setAside(locator: string): Promise<void>;
|
|
41
|
+
release(key: number): Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
export declare function bootstrapRoom(adapter: Reads, authorization: Authorization, room: DiscoveredRoom, held: HeldModels, builtIn: ModelState, typedPaths: readonly TypedPath[], remodel: Remodel, continuing: () => boolean, staging: Staging): Promise<BootstrapOutcome>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
1
2
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import type {
|
|
3
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
3
4
|
type Rows = DocumentResult | GroupResult;
|
|
4
5
|
export type WindowAnswer = Rows | PendingResult;
|
|
5
6
|
export type WindowChain = {
|