@agentshouse/app-bridge 0.1.0-c895bda3a3f6a → 0.1.0-c8a196c36dc76
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 +6 -6
- package/dist/index.d.ts +247 -407
- 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 +14 -9
- 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 -22
- 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 +161 -81
- 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 +36 -23
- package/dist/mdruntime/collection.d.ts +27 -4
- package/dist/mdruntime/compile.d.ts +9 -7
- package/dist/mdruntime/conversation-live.d.ts +151 -0
- package/dist/mdruntime/conversation-row.d.ts +39 -0
- package/dist/mdruntime/conversation.d.ts +67 -46
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +20 -0
- 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 +19 -2
- package/dist/mdruntime/messages.d.ts +35 -5
- package/dist/mdruntime/modal.d.ts +1 -0
- package/dist/mdruntime/model.d.ts +6 -12
- package/dist/mdruntime/observation.d.ts +30 -13
- package/dist/mdruntime/opened.d.ts +1 -1
- package/dist/mdruntime/outcome.d.ts +17 -2
- 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 +13 -211
- package/dist/mdruntime/reach.d.ts +25 -14
- package/dist/mdruntime/readiness.d.ts +20 -7
- package/dist/mdruntime/reads.d.ts +38 -0
- package/dist/mdruntime/recovery.d.ts +4 -1
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +11 -16
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +33 -9
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +34 -0
- package/dist/mdruntime/save.d.ts +42 -86
- 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 +0 -2
- 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 +116 -154
- package/dist/mdruntime/stored.d.ts +80 -69
- package/dist/mdruntime/surface.d.ts +93 -0
- package/dist/mdruntime/tables.d.ts +118 -93
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +4 -0
- package/dist/mdruntime/wire.d.ts +81 -7
- 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 -1
- package/dist/test-host.js +45 -2
- package/docs/families.md +78 -39
- package/package.json +2 -2
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -180
- package/dist/mdmodel/links.d.ts +0 -28
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/connection.d.ts +0 -153
- package/dist/mdruntime/fulltext.d.ts +0 -26
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SavedFacts, TypedPath, VerifiedModel } from '../mdmodel/index.js';
|
|
2
|
+
import type { Operation, SessionState } from '../session-content/index.js';
|
|
2
3
|
import type { ModelResult } from './model.js';
|
|
3
|
-
export type {
|
|
4
|
+
export type { SavedFacts, TypedPath };
|
|
4
5
|
import type { Open } from './open.js';
|
|
5
6
|
import type { ChangeBatch } from './change.js';
|
|
7
|
+
import type { QueryDocument, QueryGroup } from './query.js';
|
|
6
8
|
export type Authorization = object;
|
|
7
9
|
export type MdModelIdentity = {
|
|
8
10
|
identity: string;
|
|
@@ -13,22 +15,25 @@ export type TypedSelection = {
|
|
|
13
15
|
};
|
|
14
16
|
export type OperationScopes = {
|
|
15
17
|
write: readonly string[];
|
|
16
|
-
|
|
18
|
+
erase: readonly string[];
|
|
17
19
|
};
|
|
18
20
|
export type ReplicaAdmission = {
|
|
19
21
|
selection: string;
|
|
20
22
|
admission: Open<'admitted' | 'unavailable'>;
|
|
21
23
|
offline: Open<'locked' | 'open'>;
|
|
22
24
|
};
|
|
23
|
-
export type
|
|
24
|
-
name: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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;
|
|
32
37
|
};
|
|
33
38
|
export type Capability = {
|
|
34
39
|
name: string;
|
|
@@ -38,16 +43,16 @@ export type Capability = {
|
|
|
38
43
|
export type ListedConversation = {
|
|
39
44
|
conversation: string;
|
|
40
45
|
agent: string;
|
|
41
|
-
agentName: string;
|
|
42
|
-
agentRetired: boolean;
|
|
43
46
|
name: string;
|
|
44
47
|
created: string;
|
|
45
48
|
finished: string | null;
|
|
46
49
|
outcome: string | null;
|
|
47
50
|
waiting: boolean;
|
|
48
51
|
newest: string | null;
|
|
52
|
+
processEnded: string | null;
|
|
53
|
+
subject: string | null;
|
|
49
54
|
};
|
|
50
|
-
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
|
|
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';
|
|
51
56
|
export type ConversationMessage = {
|
|
52
57
|
identity: string;
|
|
53
58
|
turn: string;
|
|
@@ -56,6 +61,7 @@ export type ConversationMessage = {
|
|
|
56
61
|
};
|
|
57
62
|
export type AcceptedMessage = ConversationMessage & {
|
|
58
63
|
position: string;
|
|
64
|
+
change: string;
|
|
59
65
|
};
|
|
60
66
|
export type ConversationHistoryRequest = {
|
|
61
67
|
conversations: readonly {
|
|
@@ -71,37 +77,10 @@ export type ConversationHistoryPage = {
|
|
|
71
77
|
export type ConversationHistories = {
|
|
72
78
|
histories: readonly ConversationHistoryPage[];
|
|
73
79
|
};
|
|
74
|
-
export type TurnContext = {
|
|
75
|
-
used: number;
|
|
76
|
-
window: number;
|
|
77
|
-
};
|
|
78
80
|
export type TurnOperation = {
|
|
79
81
|
op: 'begin';
|
|
80
82
|
at: string;
|
|
81
|
-
} |
|
|
82
|
-
op: 'start';
|
|
83
|
-
index: number;
|
|
84
|
-
part: unknown;
|
|
85
|
-
} | {
|
|
86
|
-
op: 'append';
|
|
87
|
-
index: number;
|
|
88
|
-
text: string;
|
|
89
|
-
} | {
|
|
90
|
-
op: 'status';
|
|
91
|
-
index: number;
|
|
92
|
-
status: string;
|
|
93
|
-
result: unknown;
|
|
94
|
-
} | {
|
|
95
|
-
op: 'count';
|
|
96
|
-
index: number;
|
|
97
|
-
count: number;
|
|
98
|
-
} | {
|
|
99
|
-
op: 'plan';
|
|
100
|
-
index: number;
|
|
101
|
-
entries: readonly unknown[];
|
|
102
|
-
} | ({
|
|
103
|
-
op: 'context';
|
|
104
|
-
} & TurnContext);
|
|
83
|
+
} | Operation;
|
|
105
84
|
export type ProcessCommand = {
|
|
106
85
|
[field: string]: unknown;
|
|
107
86
|
name: string;
|
|
@@ -138,10 +117,6 @@ export type SessionOption = (SessionOptionNaming & {
|
|
|
138
117
|
type: 'boolean';
|
|
139
118
|
currentValue: boolean;
|
|
140
119
|
});
|
|
141
|
-
export type RunningSubagent = {
|
|
142
|
-
description: string;
|
|
143
|
-
activity: string | null;
|
|
144
|
-
};
|
|
145
120
|
export type ConversationEvent = {
|
|
146
121
|
kind: 'turn';
|
|
147
122
|
conversation: string;
|
|
@@ -168,9 +143,9 @@ export type ConversationEvent = {
|
|
|
168
143
|
conversation: string;
|
|
169
144
|
step: string | null;
|
|
170
145
|
} | {
|
|
171
|
-
kind: '
|
|
146
|
+
kind: 'state';
|
|
172
147
|
conversation: string;
|
|
173
|
-
|
|
148
|
+
state: SessionState | null;
|
|
174
149
|
} | {
|
|
175
150
|
kind: 'link';
|
|
176
151
|
conversation: string;
|
|
@@ -178,6 +153,7 @@ export type ConversationEvent = {
|
|
|
178
153
|
} | {
|
|
179
154
|
kind: 'deliveries';
|
|
180
155
|
conversation: string;
|
|
156
|
+
waiting: readonly string[];
|
|
181
157
|
unknown: readonly string[];
|
|
182
158
|
} | {
|
|
183
159
|
kind: 'accepted-message';
|
|
@@ -188,6 +164,7 @@ export type ConversationEvent = {
|
|
|
188
164
|
conversation: string;
|
|
189
165
|
} | {
|
|
190
166
|
kind: 'list';
|
|
167
|
+
agents: readonly ListedAgent[];
|
|
191
168
|
entries: readonly ListedConversation[];
|
|
192
169
|
whole: boolean;
|
|
193
170
|
more: boolean;
|
|
@@ -195,20 +172,68 @@ export type ConversationEvent = {
|
|
|
195
172
|
} | {
|
|
196
173
|
kind: 'listed';
|
|
197
174
|
entry: ListedConversation;
|
|
175
|
+
} | {
|
|
176
|
+
kind: 'agent';
|
|
177
|
+
agent: ListedAgent;
|
|
198
178
|
} | {
|
|
199
179
|
kind: 'unlisted';
|
|
200
180
|
conversation: string;
|
|
201
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
|
+
};
|
|
202
216
|
export type ListedAgent = {
|
|
203
|
-
|
|
217
|
+
id: string;
|
|
204
218
|
name: string;
|
|
205
|
-
|
|
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;
|
|
206
232
|
};
|
|
207
233
|
export type ConversationStream = {
|
|
208
234
|
replicate(conversations: readonly string[]): void;
|
|
209
235
|
hold(cursor: string | null): void;
|
|
210
236
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
211
|
-
agents?(): Promise<readonly ListedAgent[] | null>;
|
|
212
237
|
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
213
238
|
};
|
|
214
239
|
export type ActionDeclaration = {
|
|
@@ -229,9 +254,13 @@ export type HistoryRetention = {
|
|
|
229
254
|
};
|
|
230
255
|
export type Retention = {
|
|
231
256
|
history: HistoryRetention;
|
|
232
|
-
outcome: number;
|
|
233
257
|
refreshHorizon: number;
|
|
234
258
|
};
|
|
259
|
+
export type QueriedRoom = {
|
|
260
|
+
readonly locator: string;
|
|
261
|
+
readonly handle: string;
|
|
262
|
+
readonly name: string;
|
|
263
|
+
};
|
|
235
264
|
export type Discovery = {
|
|
236
265
|
kind: 'discovery';
|
|
237
266
|
rooms: readonly DiscoveredRoom[];
|
|
@@ -239,9 +268,13 @@ export type Discovery = {
|
|
|
239
268
|
providerLimits: readonly ProviderLimit[];
|
|
240
269
|
retention: Retention;
|
|
241
270
|
member?: Member;
|
|
271
|
+
timeZone?: string | null;
|
|
272
|
+
roomList?: RoomList;
|
|
273
|
+
queriesOnly?: readonly QueriedRoom[];
|
|
242
274
|
};
|
|
243
275
|
export type TransportUncertainty = {
|
|
244
276
|
kind: 'transport-uncertainty';
|
|
277
|
+
failure?: unknown;
|
|
245
278
|
};
|
|
246
279
|
export type RoomNotReadable = {
|
|
247
280
|
kind: 'room-not-readable';
|
|
@@ -285,26 +318,17 @@ export type BinaryFile = {
|
|
|
285
318
|
mediaType: string;
|
|
286
319
|
sha256: string;
|
|
287
320
|
};
|
|
288
|
-
export type HeldFile = {
|
|
289
|
-
readonly path: string;
|
|
290
|
-
readonly revision: string;
|
|
291
|
-
};
|
|
292
|
-
export type HeldContent = {
|
|
293
|
-
files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
|
|
294
|
-
contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
|
|
295
|
-
readonly content: string;
|
|
296
|
-
readonly revision: string;
|
|
297
|
-
}>>;
|
|
298
|
-
};
|
|
299
321
|
export type BootstrapRequest = {
|
|
300
322
|
locator: string;
|
|
301
323
|
selection: string;
|
|
302
|
-
path?: string;
|
|
303
324
|
pageToken?: PageToken;
|
|
304
|
-
held?: HeldContent;
|
|
305
325
|
arriving?: (bytes: number) => void;
|
|
306
326
|
signal?: AbortSignal;
|
|
307
327
|
};
|
|
328
|
+
export type BootstrapPart = {
|
|
329
|
+
readonly id: string;
|
|
330
|
+
readonly bytes: number;
|
|
331
|
+
};
|
|
308
332
|
export type BootstrapInventory = {
|
|
309
333
|
readonly bytes: number;
|
|
310
334
|
};
|
|
@@ -316,18 +340,23 @@ export type BootstrapPage = {
|
|
|
316
340
|
roomVersion: string;
|
|
317
341
|
models?: RoomModels;
|
|
318
342
|
documents: Readonly<Record<string, string>>;
|
|
319
|
-
|
|
343
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
320
344
|
revisions: Readonly<Record<string, string>>;
|
|
321
345
|
fileIds?: Readonly<Record<string, string>>;
|
|
346
|
+
created?: Readonly<Record<string, string>>;
|
|
322
347
|
changes: Readonly<Record<string, HeadChange>>;
|
|
323
348
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
324
349
|
folders?: readonly string[];
|
|
325
350
|
pageToken?: PageToken;
|
|
351
|
+
parts?: readonly BootstrapPart[];
|
|
326
352
|
bytes?: number;
|
|
327
353
|
};
|
|
354
|
+
export type NotReady = {
|
|
355
|
+
kind: 'not-ready';
|
|
356
|
+
};
|
|
328
357
|
export type BootstrapResult = BootstrapPage | {
|
|
329
358
|
kind: 'beyond-horizon';
|
|
330
|
-
} | AdapterFailure;
|
|
359
|
+
} | NotReady | AdapterFailure;
|
|
331
360
|
export type RefreshRequest = {
|
|
332
361
|
locator: string;
|
|
333
362
|
selection: string;
|
|
@@ -339,9 +368,10 @@ export type RefreshPage = {
|
|
|
339
368
|
roomVersion: string;
|
|
340
369
|
models?: RoomModels;
|
|
341
370
|
documents: Readonly<Record<string, string>>;
|
|
342
|
-
|
|
371
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
343
372
|
revisions: Readonly<Record<string, string>>;
|
|
344
373
|
fileIds?: Readonly<Record<string, string>>;
|
|
374
|
+
created?: Readonly<Record<string, string>>;
|
|
345
375
|
changes: Readonly<Record<string, HeadChange>>;
|
|
346
376
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
347
377
|
removals: readonly string[];
|
|
@@ -379,21 +409,15 @@ export type AcceptedRoom = {
|
|
|
379
409
|
};
|
|
380
410
|
export type MutationResult = (AcceptedRoom & {
|
|
381
411
|
kind: 'accepted';
|
|
382
|
-
author?: string;
|
|
383
|
-
time?: string;
|
|
384
412
|
destination?: AcceptedRoom;
|
|
385
413
|
}) | (ProviderRefusal & {
|
|
386
414
|
kind: 'conflicted';
|
|
387
|
-
roomVersion?: string;
|
|
388
415
|
affected: Readonly<Record<string, string>>;
|
|
389
416
|
}) | (ProviderRefusal & {
|
|
390
417
|
kind: 'rejected';
|
|
391
418
|
affected: Readonly<Record<string, string>>;
|
|
392
419
|
}) | RetryableRefusal | {
|
|
393
420
|
kind: 'write-halted';
|
|
394
|
-
} | {
|
|
395
|
-
kind: 'expired';
|
|
396
|
-
restored?: true;
|
|
397
421
|
} | AdapterFailure;
|
|
398
422
|
export type HistoryAuthor = {
|
|
399
423
|
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
@@ -429,6 +453,10 @@ export type BinaryRequest = {
|
|
|
429
453
|
path: string;
|
|
430
454
|
revision: string;
|
|
431
455
|
};
|
|
456
|
+
export type KeyedRequest = {
|
|
457
|
+
kind: 'key';
|
|
458
|
+
link: string;
|
|
459
|
+
};
|
|
432
460
|
export type BinaryResult = {
|
|
433
461
|
kind: 'binary';
|
|
434
462
|
body: ReadableStream<Uint8Array>;
|
|
@@ -446,7 +474,7 @@ export type BinaryLinkResult = {
|
|
|
446
474
|
kind: 'rejected';
|
|
447
475
|
}) | AdapterFailure;
|
|
448
476
|
export type AttachRequest = {
|
|
449
|
-
locator
|
|
477
|
+
locator?: string;
|
|
450
478
|
name: string;
|
|
451
479
|
mediaType: string;
|
|
452
480
|
byteLength: number;
|
|
@@ -457,6 +485,9 @@ export type AttachResult = {
|
|
|
457
485
|
kind: 'attached';
|
|
458
486
|
path: string;
|
|
459
487
|
revision: string;
|
|
488
|
+
} | {
|
|
489
|
+
kind: 'linked';
|
|
490
|
+
link: string;
|
|
460
491
|
} | (ProviderRefusal & {
|
|
461
492
|
kind: 'rejected';
|
|
462
493
|
}) | AdapterFailure;
|
|
@@ -474,15 +505,52 @@ export type ActionResult = {
|
|
|
474
505
|
at?: RoomVersionAt;
|
|
475
506
|
} | (ProviderRefusal & {
|
|
476
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';
|
|
477
545
|
}) | AdapterFailure;
|
|
478
546
|
export type HeldRoom = {
|
|
479
547
|
locator: string;
|
|
480
|
-
roomVersion: string;
|
|
548
|
+
roomVersion: string | null;
|
|
481
549
|
};
|
|
482
550
|
export type RoomChange = {
|
|
483
551
|
kind: 'room-change';
|
|
484
552
|
locator: string;
|
|
485
|
-
from: string;
|
|
553
|
+
from: string | null;
|
|
486
554
|
roomVersion: string;
|
|
487
555
|
read(): Promise<RefreshPage>;
|
|
488
556
|
};
|
|
@@ -491,6 +559,10 @@ export type AuthorityChange = {
|
|
|
491
559
|
rooms: readonly DiscoveredRoom[];
|
|
492
560
|
left: readonly string[];
|
|
493
561
|
member?: Member;
|
|
562
|
+
timeZone?: string | null;
|
|
563
|
+
roomList?: RoomList & {
|
|
564
|
+
readonly left: readonly string[];
|
|
565
|
+
};
|
|
494
566
|
};
|
|
495
567
|
export type RoomStreamEvent = {
|
|
496
568
|
kind: 'opened';
|
|
@@ -505,15 +577,21 @@ export type RoomStreamEvent = {
|
|
|
505
577
|
} | {
|
|
506
578
|
kind: 'caught-up';
|
|
507
579
|
expired: readonly string[];
|
|
580
|
+
} | {
|
|
581
|
+
kind: 'reported';
|
|
508
582
|
} | AuthorityChange | RoomChange;
|
|
509
583
|
export type RoomStream = {
|
|
510
584
|
hold(rooms: readonly HeldRoom[]): void;
|
|
511
585
|
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
512
586
|
};
|
|
587
|
+
export type PathRule = (path: string) => boolean;
|
|
513
588
|
export type Adapter = {
|
|
514
589
|
readonly localSaves?: true;
|
|
515
|
-
readonly roomTypes?:
|
|
516
|
-
readonly
|
|
590
|
+
readonly roomTypes?: VerifiedModel;
|
|
591
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
592
|
+
readonly pathRule?: PathRule;
|
|
593
|
+
readonly unkeptReads?: readonly string[];
|
|
594
|
+
readonly leadingReads?: readonly string[];
|
|
517
595
|
authorize(): Promise<Authorization>;
|
|
518
596
|
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
519
597
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
@@ -521,9 +599,11 @@ export type Adapter = {
|
|
|
521
599
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
522
600
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
523
601
|
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
524
|
-
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
602
|
+
link(authorization: Authorization, request: BinaryRequest | KeyedRequest): Promise<BinaryLinkResult>;
|
|
525
603
|
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
526
604
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
605
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
606
|
+
queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
|
|
527
607
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
528
608
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
529
609
|
roomStream?: RoomStream;
|
|
@@ -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 = {
|
|
@@ -12,6 +12,8 @@ export type ChangeSet = {
|
|
|
12
12
|
queues: readonly string[];
|
|
13
13
|
presentations: readonly string[];
|
|
14
14
|
conversations: readonly string[];
|
|
15
|
+
unindexed: readonly string[];
|
|
16
|
+
due: readonly string[];
|
|
15
17
|
};
|
|
16
18
|
type Changed = {
|
|
17
19
|
documents?: readonly string[] | null;
|
|
@@ -19,6 +21,8 @@ type Changed = {
|
|
|
19
21
|
room?: boolean;
|
|
20
22
|
queue?: boolean;
|
|
21
23
|
presentation?: string;
|
|
24
|
+
unindexed?: boolean;
|
|
25
|
+
due?: boolean;
|
|
22
26
|
};
|
|
23
27
|
export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
|
|
24
28
|
export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
|
|
@@ -50,8 +50,13 @@ type Arriving = {
|
|
|
50
50
|
readonly path: string;
|
|
51
51
|
readonly revision?: string;
|
|
52
52
|
readonly fileId?: string;
|
|
53
|
+
readonly created?: string;
|
|
53
54
|
readonly change?: HeadChange;
|
|
54
55
|
};
|
|
56
|
+
export type PartChange = Extract<Change, {
|
|
57
|
+
readonly kind: 'field' | 'section' | 'preamble';
|
|
58
|
+
}>;
|
|
59
|
+
export declare function isPart(change: Change): change is PartChange;
|
|
55
60
|
export type RoomMove = {
|
|
56
61
|
readonly source: {
|
|
57
62
|
readonly room: string;
|