@agentshouse/app-bridge 0.1.0-cd2f88c8097d7 → 0.1.0-cd44fa24fb809
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 +11 -11
- package/dist/index.d.ts +626 -21
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/built-in.d.ts +3 -0
- package/dist/mdmodel/definition.d.ts +22 -11
- package/dist/mdmodel/document.d.ts +15 -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 +41 -14
- package/dist/mdmodel/kinds.d.ts +17 -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 +24 -2
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/project.d.ts +1 -0
- package/dist/mdmodel/query/language.d.ts +253 -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 +38 -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 +44 -15
- package/dist/mdmodel/validate.d.ts +34 -4
- package/dist/mdmodel/yaml.d.ts +4 -4
- package/dist/mdruntime/actions.d.ts +25 -0
- package/dist/mdruntime/adapter.d.ts +216 -123
- package/dist/mdruntime/attached-model.d.ts +6 -0
- package/dist/mdruntime/authored.d.ts +87 -0
- package/dist/mdruntime/binary.d.ts +0 -5
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +11 -0
- package/dist/mdruntime/change-set.d.ts +13 -16
- package/dist/mdruntime/change.d.ts +36 -1
- package/dist/mdruntime/client.d.ts +41 -25
- package/dist/mdruntime/collection.d.ts +32 -21
- package/dist/mdruntime/compile.d.ts +17 -0
- package/dist/mdruntime/conversation-live.d.ts +149 -0
- package/dist/mdruntime/conversation-row.d.ts +39 -0
- package/dist/mdruntime/conversation.d.ts +84 -50
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +21 -4
- 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/identity.d.ts +5 -0
- package/dist/mdruntime/install.d.ts +59 -0
- package/dist/mdruntime/listing.d.ts +51 -0
- package/dist/mdruntime/live.d.ts +24 -0
- package/dist/mdruntime/media.d.ts +24 -0
- package/dist/mdruntime/messages.d.ts +57 -0
- package/dist/mdruntime/model.d.ts +8 -11
- package/dist/mdruntime/observation.d.ts +40 -10
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +57 -10
- package/dist/mdruntime/overlay.d.ts +8 -6
- package/dist/mdruntime/preparation.d.ts +40 -0
- package/dist/mdruntime/presence.d.ts +57 -0
- package/dist/mdruntime/query.d.ts +25 -191
- package/dist/mdruntime/reach.d.ts +21 -11
- package/dist/mdruntime/readiness.d.ts +22 -20
- package/dist/mdruntime/reads.d.ts +38 -0
- package/dist/mdruntime/recovery.d.ts +5 -2
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +50 -33
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +55 -13
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +33 -0
- package/dist/mdruntime/save.d.ts +43 -48
- package/dist/mdruntime/saves.d.ts +33 -0
- package/dist/mdruntime/search.d.ts +12 -82
- 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 +37 -0
- package/dist/mdruntime/socket.d.ts +66 -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 +223 -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 -157
- package/dist/mdruntime/stored.d.ts +166 -0
- package/dist/mdruntime/surface.d.ts +91 -0
- package/dist/mdruntime/tables.d.ts +375 -0
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/wire.d.ts +96 -9
- package/dist/session-content/bounds.d.ts +7 -0
- package/dist/session-content/check.d.ts +18 -0
- package/dist/session-content/index.d.ts +7 -0
- package/dist/session-content/parts.d.ts +103 -0
- package/dist/session-content/state.d.ts +61 -0
- package/dist/session-content/turn.d.ts +328 -0
- package/dist/test-host.d.ts +14 -4
- package/dist/test-host.js +45 -29
- package/docs/families.md +90 -59
- package/package.json +8 -3
- package/dist/calls.d.ts +0 -118
- package/dist/calls.js +0 -1
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -149
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/connection.d.ts +0 -143
- package/dist/mdruntime/file.d.ts +0 -19
- package/dist/mdruntime/rows.d.ts +0 -37
- package/dist/mdruntime/shared.d.ts +0 -10
- package/dist/mdruntime/turn.d.ts +0 -6
|
@@ -1,4 +1,7 @@
|
|
|
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';
|
|
4
7
|
export type Authorization = object;
|
|
@@ -10,37 +13,31 @@ export type TypedSelection = {
|
|
|
10
13
|
roots: readonly string[];
|
|
11
14
|
};
|
|
12
15
|
export type OperationScopes = {
|
|
13
|
-
read: readonly string[];
|
|
14
|
-
sync: readonly string[];
|
|
15
16
|
write: readonly string[];
|
|
16
|
-
|
|
17
|
+
erase: readonly string[];
|
|
17
18
|
};
|
|
18
19
|
export type ReplicaAdmission = {
|
|
19
20
|
selection: string;
|
|
20
21
|
admission: Open<'admitted' | 'unavailable'>;
|
|
22
|
+
offline: Open<'locked' | 'open'>;
|
|
21
23
|
};
|
|
22
|
-
export type
|
|
23
|
-
name: string;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
export type RoomDeclaration = {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly handle: string;
|
|
27
|
+
readonly operations: OperationScopes;
|
|
28
|
+
readonly replica: ReplicaAdmission;
|
|
29
|
+
readonly typedSelection: TypedSelection | null;
|
|
30
|
+
readonly providerOwnedPaths: readonly string[];
|
|
31
|
+
readonly authoredPaths: readonly string[];
|
|
32
|
+
};
|
|
33
|
+
export type DiscoveredRoom = RoomDeclaration & {
|
|
34
|
+
readonly locator: string;
|
|
35
|
+
readonly roomVersion: string;
|
|
31
36
|
};
|
|
32
37
|
export type Capability = {
|
|
33
38
|
name: string;
|
|
34
39
|
limits?: readonly ProviderLimit[];
|
|
35
40
|
actions?: readonly ActionDeclaration[];
|
|
36
|
-
conversationAgents?: ConversationAgents;
|
|
37
|
-
};
|
|
38
|
-
export type ConversationAgents = {
|
|
39
|
-
locator: string;
|
|
40
|
-
type: string;
|
|
41
|
-
identity: string;
|
|
42
|
-
name: string;
|
|
43
|
-
retired?: string;
|
|
44
41
|
};
|
|
45
42
|
export type ListedConversation = {
|
|
46
43
|
conversation: string;
|
|
@@ -49,8 +46,12 @@ export type ListedConversation = {
|
|
|
49
46
|
created: string;
|
|
50
47
|
finished: string | null;
|
|
51
48
|
outcome: string | null;
|
|
49
|
+
waiting: boolean;
|
|
50
|
+
newest: string | null;
|
|
51
|
+
processEnded: string | null;
|
|
52
|
+
subject: string | null;
|
|
52
53
|
};
|
|
53
|
-
export type ConversationAction = '
|
|
54
|
+
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
55
|
export type ConversationMessage = {
|
|
55
56
|
identity: string;
|
|
56
57
|
turn: string;
|
|
@@ -59,6 +60,7 @@ export type ConversationMessage = {
|
|
|
59
60
|
};
|
|
60
61
|
export type AcceptedMessage = ConversationMessage & {
|
|
61
62
|
position: string;
|
|
63
|
+
change: string;
|
|
62
64
|
};
|
|
63
65
|
export type ConversationHistoryRequest = {
|
|
64
66
|
conversations: readonly {
|
|
@@ -74,37 +76,10 @@ export type ConversationHistoryPage = {
|
|
|
74
76
|
export type ConversationHistories = {
|
|
75
77
|
histories: readonly ConversationHistoryPage[];
|
|
76
78
|
};
|
|
77
|
-
export type TurnContext = {
|
|
78
|
-
used: number;
|
|
79
|
-
window: number;
|
|
80
|
-
};
|
|
81
79
|
export type TurnOperation = {
|
|
82
80
|
op: 'begin';
|
|
83
81
|
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);
|
|
82
|
+
} | Operation;
|
|
108
83
|
export type ProcessCommand = {
|
|
109
84
|
[field: string]: unknown;
|
|
110
85
|
name: string;
|
|
@@ -162,6 +137,23 @@ export type ConversationEvent = {
|
|
|
162
137
|
kind: 'options';
|
|
163
138
|
conversation: string;
|
|
164
139
|
options: readonly SessionOption[];
|
|
140
|
+
} | {
|
|
141
|
+
kind: 'starting';
|
|
142
|
+
conversation: string;
|
|
143
|
+
step: string | null;
|
|
144
|
+
} | {
|
|
145
|
+
kind: 'state';
|
|
146
|
+
conversation: string;
|
|
147
|
+
state: SessionState | null;
|
|
148
|
+
} | {
|
|
149
|
+
kind: 'link';
|
|
150
|
+
conversation: string;
|
|
151
|
+
connected: boolean;
|
|
152
|
+
} | {
|
|
153
|
+
kind: 'deliveries';
|
|
154
|
+
conversation: string;
|
|
155
|
+
waiting: readonly string[];
|
|
156
|
+
unknown: readonly string[];
|
|
165
157
|
} | {
|
|
166
158
|
kind: 'accepted-message';
|
|
167
159
|
conversation: string;
|
|
@@ -171,22 +163,83 @@ export type ConversationEvent = {
|
|
|
171
163
|
conversation: string;
|
|
172
164
|
} | {
|
|
173
165
|
kind: 'list';
|
|
166
|
+
agents: readonly ListedAgent[];
|
|
174
167
|
entries: readonly ListedConversation[];
|
|
168
|
+
whole: boolean;
|
|
169
|
+
more: boolean;
|
|
170
|
+
cursor: string | null;
|
|
175
171
|
} | {
|
|
176
172
|
kind: 'listed';
|
|
177
173
|
entry: ListedConversation;
|
|
174
|
+
} | {
|
|
175
|
+
kind: 'agent';
|
|
176
|
+
agent: ListedAgent;
|
|
178
177
|
} | {
|
|
179
178
|
kind: 'unlisted';
|
|
180
179
|
conversation: string;
|
|
181
180
|
};
|
|
181
|
+
export type AgentEnvironment = {
|
|
182
|
+
identity: string;
|
|
183
|
+
name: string;
|
|
184
|
+
state: 'online' | 'offline';
|
|
185
|
+
};
|
|
186
|
+
export type ListedOwner = {
|
|
187
|
+
readonly user: string;
|
|
188
|
+
readonly name: string;
|
|
189
|
+
};
|
|
190
|
+
export type ListedSpaceRef = {
|
|
191
|
+
readonly space_ref: string;
|
|
192
|
+
readonly name: string;
|
|
193
|
+
};
|
|
194
|
+
export type RoomListEntry = {
|
|
195
|
+
readonly room_ref: string;
|
|
196
|
+
readonly room_handle: string;
|
|
197
|
+
readonly name: string;
|
|
198
|
+
readonly level: 'search' | 'open' | 'keep';
|
|
199
|
+
readonly access: 'owner' | 'manage' | 'write' | 'read' | 'public';
|
|
200
|
+
readonly owner: ListedOwner;
|
|
201
|
+
readonly created: string;
|
|
202
|
+
readonly archived?: string;
|
|
203
|
+
readonly exportable?: true;
|
|
204
|
+
readonly space?: ListedSpaceRef;
|
|
205
|
+
};
|
|
206
|
+
export type SpaceListEntry = ListedSpaceRef & {
|
|
207
|
+
readonly owner: ListedOwner;
|
|
208
|
+
readonly created: string;
|
|
209
|
+
readonly manages?: true;
|
|
210
|
+
};
|
|
211
|
+
export type RoomList = {
|
|
212
|
+
readonly rooms: readonly RoomListEntry[];
|
|
213
|
+
readonly spaces: readonly SpaceListEntry[];
|
|
214
|
+
};
|
|
215
|
+
export type ListedAgent = {
|
|
216
|
+
id: string;
|
|
217
|
+
name: string;
|
|
218
|
+
revision: number;
|
|
219
|
+
environment: string;
|
|
220
|
+
environment_name: string;
|
|
221
|
+
environment_connected: boolean;
|
|
222
|
+
launch_directory: string;
|
|
223
|
+
cli: string;
|
|
224
|
+
model: string | null;
|
|
225
|
+
effort: string | null;
|
|
226
|
+
mode: string | null;
|
|
227
|
+
base_instructions: string;
|
|
228
|
+
in_telegram: boolean;
|
|
229
|
+
created: string;
|
|
230
|
+
retired_at: string | null;
|
|
231
|
+
};
|
|
182
232
|
export type ConversationStream = {
|
|
183
233
|
replicate(conversations: readonly string[]): void;
|
|
234
|
+
hold(cursor: string | null): void;
|
|
184
235
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
236
|
+
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
185
237
|
};
|
|
186
238
|
export type ActionDeclaration = {
|
|
187
239
|
name: string;
|
|
188
240
|
inputShape: unknown;
|
|
189
241
|
resultKind: unknown;
|
|
242
|
+
room?: string;
|
|
190
243
|
};
|
|
191
244
|
export type ProviderLimit = {
|
|
192
245
|
name: string;
|
|
@@ -200,7 +253,6 @@ export type HistoryRetention = {
|
|
|
200
253
|
};
|
|
201
254
|
export type Retention = {
|
|
202
255
|
history: HistoryRetention;
|
|
203
|
-
outcome: number;
|
|
204
256
|
refreshHorizon: number;
|
|
205
257
|
};
|
|
206
258
|
export type Discovery = {
|
|
@@ -210,9 +262,12 @@ export type Discovery = {
|
|
|
210
262
|
providerLimits: readonly ProviderLimit[];
|
|
211
263
|
retention: Retention;
|
|
212
264
|
member?: Member;
|
|
265
|
+
timeZone?: string | null;
|
|
266
|
+
roomList?: RoomList;
|
|
213
267
|
};
|
|
214
268
|
export type TransportUncertainty = {
|
|
215
269
|
kind: 'transport-uncertainty';
|
|
270
|
+
failure?: unknown;
|
|
216
271
|
};
|
|
217
272
|
export type RoomNotReadable = {
|
|
218
273
|
kind: 'room-not-readable';
|
|
@@ -229,7 +284,7 @@ export type ProviderRefusal = {
|
|
|
229
284
|
export type ScopedRefusal = ProviderRefusal & {
|
|
230
285
|
kind: 'scoped-refusal';
|
|
231
286
|
locator: string;
|
|
232
|
-
scope: Open<'content' | '
|
|
287
|
+
scope: Open<'content' | 'model' | 'operation' | 'undisclosed'>;
|
|
233
288
|
};
|
|
234
289
|
export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
|
|
235
290
|
export type ContractUnavailable = ProviderRefusal & {
|
|
@@ -238,7 +293,7 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
238
293
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
239
294
|
export type PageToken = string;
|
|
240
295
|
export type ChangeAuthor = {
|
|
241
|
-
kind: Open<'user' | 'site'>;
|
|
296
|
+
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
242
297
|
id: string;
|
|
243
298
|
name: string;
|
|
244
299
|
};
|
|
@@ -252,39 +307,49 @@ export type HeadChange = {
|
|
|
252
307
|
time: string;
|
|
253
308
|
};
|
|
254
309
|
export type BinaryFile = {
|
|
255
|
-
fileRef: string;
|
|
256
310
|
byteLength: number;
|
|
257
311
|
mediaType: string;
|
|
258
312
|
sha256: string;
|
|
259
313
|
};
|
|
260
|
-
export type HeldContent = {
|
|
261
|
-
documents: Readonly<Record<string, string>>;
|
|
262
|
-
revisions: Readonly<Record<string, string>>;
|
|
263
|
-
};
|
|
264
314
|
export type BootstrapRequest = {
|
|
265
315
|
locator: string;
|
|
266
316
|
selection: string;
|
|
267
317
|
pageToken?: PageToken;
|
|
268
|
-
|
|
318
|
+
arriving?: (bytes: number) => void;
|
|
319
|
+
signal?: AbortSignal;
|
|
320
|
+
};
|
|
321
|
+
export type BootstrapPart = {
|
|
322
|
+
readonly id: string;
|
|
323
|
+
readonly bytes: number;
|
|
324
|
+
};
|
|
325
|
+
export type BootstrapInventory = {
|
|
326
|
+
readonly bytes: number;
|
|
269
327
|
};
|
|
270
328
|
export type RoomModels = {
|
|
271
329
|
collection?: ModelResult;
|
|
272
|
-
selection?: ModelResult;
|
|
273
330
|
};
|
|
274
331
|
export type BootstrapPage = {
|
|
275
332
|
kind: 'bootstrap';
|
|
276
333
|
roomVersion: string;
|
|
277
334
|
models?: RoomModels;
|
|
278
335
|
documents: Readonly<Record<string, string>>;
|
|
336
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
279
337
|
revisions: Readonly<Record<string, string>>;
|
|
280
338
|
fileIds?: Readonly<Record<string, string>>;
|
|
339
|
+
created?: Readonly<Record<string, string>>;
|
|
281
340
|
changes: Readonly<Record<string, HeadChange>>;
|
|
282
341
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
342
|
+
folders?: readonly string[];
|
|
283
343
|
pageToken?: PageToken;
|
|
344
|
+
parts?: readonly BootstrapPart[];
|
|
345
|
+
bytes?: number;
|
|
346
|
+
};
|
|
347
|
+
export type NotReady = {
|
|
348
|
+
kind: 'not-ready';
|
|
284
349
|
};
|
|
285
350
|
export type BootstrapResult = BootstrapPage | {
|
|
286
351
|
kind: 'beyond-horizon';
|
|
287
|
-
} | AdapterFailure;
|
|
352
|
+
} | NotReady | AdapterFailure;
|
|
288
353
|
export type RefreshRequest = {
|
|
289
354
|
locator: string;
|
|
290
355
|
selection: string;
|
|
@@ -296,11 +361,15 @@ export type RefreshPage = {
|
|
|
296
361
|
roomVersion: string;
|
|
297
362
|
models?: RoomModels;
|
|
298
363
|
documents: Readonly<Record<string, string>>;
|
|
364
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
299
365
|
revisions: Readonly<Record<string, string>>;
|
|
300
366
|
fileIds?: Readonly<Record<string, string>>;
|
|
367
|
+
created?: Readonly<Record<string, string>>;
|
|
301
368
|
changes: Readonly<Record<string, HeadChange>>;
|
|
302
369
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
303
370
|
removals: readonly string[];
|
|
371
|
+
folders?: readonly string[];
|
|
372
|
+
folderRemovals?: readonly string[];
|
|
304
373
|
pageToken?: PageToken;
|
|
305
374
|
};
|
|
306
375
|
export type RefreshResult = {
|
|
@@ -311,6 +380,7 @@ export type RefreshResult = {
|
|
|
311
380
|
export type MutationRequest = {
|
|
312
381
|
locator: string;
|
|
313
382
|
changeBatch: ChangeBatch;
|
|
383
|
+
file(localId: string): Promise<Blob>;
|
|
314
384
|
upload?: unknown;
|
|
315
385
|
};
|
|
316
386
|
export type RetryableRefusal = ProviderRefusal & {
|
|
@@ -321,8 +391,7 @@ export type ServiceMode = Open<'open' | 'write-halted'>;
|
|
|
321
391
|
export type ServiceModeSignal = {
|
|
322
392
|
observe(notify: (mode: ServiceMode) => void): () => void;
|
|
323
393
|
};
|
|
324
|
-
export type
|
|
325
|
-
kind: 'accepted';
|
|
394
|
+
export type AcceptedRoom = {
|
|
326
395
|
roomVersion: string;
|
|
327
396
|
documents: Readonly<Record<string, string>>;
|
|
328
397
|
revisions: Readonly<Record<string, string>>;
|
|
@@ -330,26 +399,21 @@ export type MutationResult = {
|
|
|
330
399
|
changes: Readonly<Record<string, HeadChange>>;
|
|
331
400
|
removals: readonly string[];
|
|
332
401
|
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
402
|
+
};
|
|
403
|
+
export type MutationResult = (AcceptedRoom & {
|
|
404
|
+
kind: 'accepted';
|
|
405
|
+
destination?: AcceptedRoom;
|
|
406
|
+
}) | (ProviderRefusal & {
|
|
336
407
|
kind: 'conflicted';
|
|
337
|
-
roomVersion?: string;
|
|
338
408
|
affected: Readonly<Record<string, string>>;
|
|
339
409
|
}) | (ProviderRefusal & {
|
|
340
410
|
kind: 'rejected';
|
|
341
411
|
affected: Readonly<Record<string, string>>;
|
|
342
412
|
}) | RetryableRefusal | {
|
|
343
413
|
kind: 'write-halted';
|
|
344
|
-
} | {
|
|
345
|
-
kind: 'expired';
|
|
346
|
-
restored?: true;
|
|
347
414
|
} | AdapterFailure;
|
|
348
415
|
export type HistoryAuthor = {
|
|
349
|
-
kind: 'user';
|
|
350
|
-
id: string;
|
|
351
|
-
} | {
|
|
352
|
-
kind: 'site';
|
|
416
|
+
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
353
417
|
id: string;
|
|
354
418
|
name: string;
|
|
355
419
|
};
|
|
@@ -381,22 +445,16 @@ export type BinaryRequest = {
|
|
|
381
445
|
locator: string;
|
|
382
446
|
path: string;
|
|
383
447
|
revision: string;
|
|
384
|
-
fileRef?: string;
|
|
385
|
-
} | {
|
|
386
|
-
kind: 'reference';
|
|
387
|
-
fileRef: string;
|
|
388
|
-
referrer: unknown;
|
|
389
448
|
};
|
|
390
|
-
export type
|
|
391
|
-
kind: '
|
|
392
|
-
|
|
393
|
-
path?: string;
|
|
394
|
-
} | {
|
|
395
|
-
kind: 'conversations';
|
|
449
|
+
export type KeyedRequest = {
|
|
450
|
+
kind: 'key';
|
|
451
|
+
link: string;
|
|
396
452
|
};
|
|
397
453
|
export type BinaryResult = {
|
|
398
454
|
kind: 'binary';
|
|
399
|
-
|
|
455
|
+
body: ReadableStream<Uint8Array>;
|
|
456
|
+
mediaType: string;
|
|
457
|
+
sha256?: string;
|
|
400
458
|
} | (ProviderRefusal & {
|
|
401
459
|
kind: 'rejected';
|
|
402
460
|
}) | AdapterFailure;
|
|
@@ -404,6 +462,25 @@ export type BinaryLinkResult = {
|
|
|
404
462
|
kind: 'link';
|
|
405
463
|
url: string;
|
|
406
464
|
name: string;
|
|
465
|
+
mediaType?: string;
|
|
466
|
+
} | (ProviderRefusal & {
|
|
467
|
+
kind: 'rejected';
|
|
468
|
+
}) | AdapterFailure;
|
|
469
|
+
export type AttachRequest = {
|
|
470
|
+
locator?: string;
|
|
471
|
+
name: string;
|
|
472
|
+
mediaType: string;
|
|
473
|
+
byteLength: number;
|
|
474
|
+
sha256: string;
|
|
475
|
+
blob: Blob;
|
|
476
|
+
};
|
|
477
|
+
export type AttachResult = {
|
|
478
|
+
kind: 'attached';
|
|
479
|
+
path: string;
|
|
480
|
+
revision: string;
|
|
481
|
+
} | {
|
|
482
|
+
kind: 'linked';
|
|
483
|
+
link: string;
|
|
407
484
|
} | (ProviderRefusal & {
|
|
408
485
|
kind: 'rejected';
|
|
409
486
|
}) | AdapterFailure;
|
|
@@ -419,73 +496,89 @@ export type ActionResult = {
|
|
|
419
496
|
kind: 'action';
|
|
420
497
|
result: unknown;
|
|
421
498
|
at?: RoomVersionAt;
|
|
499
|
+
} | (ProviderRefusal & {
|
|
500
|
+
kind: 'rejected';
|
|
501
|
+
reset?: string;
|
|
502
|
+
}) | AdapterFailure;
|
|
503
|
+
export type SearchHit = {
|
|
504
|
+
room: string;
|
|
505
|
+
path: string;
|
|
506
|
+
line?: number;
|
|
507
|
+
snippet?: string;
|
|
508
|
+
};
|
|
509
|
+
export type SearchAsk = {
|
|
510
|
+
text: string;
|
|
511
|
+
rooms: readonly string[] | null;
|
|
512
|
+
};
|
|
513
|
+
export type SearchAnswer = {
|
|
514
|
+
kind: 'found';
|
|
515
|
+
documents: readonly SearchHit[];
|
|
422
516
|
} | (ProviderRefusal & {
|
|
423
517
|
kind: 'rejected';
|
|
424
518
|
}) | AdapterFailure;
|
|
425
519
|
export type HeldRoom = {
|
|
426
520
|
locator: string;
|
|
521
|
+
roomVersion: string | null;
|
|
522
|
+
};
|
|
523
|
+
export type RoomChange = {
|
|
524
|
+
kind: 'room-change';
|
|
525
|
+
locator: string;
|
|
526
|
+
from: string | null;
|
|
427
527
|
roomVersion: string;
|
|
428
|
-
|
|
429
|
-
|
|
528
|
+
read(): Promise<RefreshPage>;
|
|
529
|
+
};
|
|
530
|
+
export type AuthorityChange = {
|
|
531
|
+
kind: 'authority-changed';
|
|
532
|
+
rooms: readonly DiscoveredRoom[];
|
|
533
|
+
left: readonly string[];
|
|
534
|
+
member?: Member;
|
|
535
|
+
timeZone?: string | null;
|
|
536
|
+
roomList?: RoomList & {
|
|
537
|
+
readonly left: readonly string[];
|
|
538
|
+
};
|
|
430
539
|
};
|
|
431
540
|
export type RoomStreamEvent = {
|
|
432
541
|
kind: 'opened';
|
|
542
|
+
} | {
|
|
543
|
+
kind: 'discovered';
|
|
544
|
+
discovery: Discovery;
|
|
433
545
|
} | {
|
|
434
546
|
kind: 'closed';
|
|
435
547
|
revoked: boolean;
|
|
436
548
|
lost: boolean;
|
|
549
|
+
authorityChanged: boolean;
|
|
437
550
|
} | {
|
|
438
|
-
kind: '
|
|
551
|
+
kind: 'caught-up';
|
|
439
552
|
expired: readonly string[];
|
|
440
553
|
} | {
|
|
441
|
-
kind: '
|
|
442
|
-
} |
|
|
443
|
-
kind: 'room-version';
|
|
444
|
-
locator: string;
|
|
445
|
-
roomVersion: string;
|
|
446
|
-
};
|
|
447
|
-
export type KeptReceipt = {
|
|
448
|
-
key: string;
|
|
449
|
-
head: unknown;
|
|
450
|
-
};
|
|
451
|
-
export type StreamReceipts = {
|
|
452
|
-
heads(): Promise<readonly KeptReceipt[]>;
|
|
453
|
-
parts(key: string, count: number): Promise<readonly unknown[]>;
|
|
454
|
-
keep(key: string, head: unknown, part?: {
|
|
455
|
-
index: number;
|
|
456
|
-
value: unknown;
|
|
457
|
-
}): Promise<void>;
|
|
458
|
-
drop(keys: readonly string[]): Promise<void>;
|
|
459
|
-
};
|
|
460
|
-
export type AcquiredDemand = {
|
|
461
|
-
rooms: readonly string[];
|
|
462
|
-
conversations: boolean;
|
|
463
|
-
};
|
|
554
|
+
kind: 'reported';
|
|
555
|
+
} | AuthorityChange | RoomChange;
|
|
464
556
|
export type RoomStream = {
|
|
465
|
-
hold(rooms: readonly HeldRoom[]
|
|
466
|
-
|
|
467
|
-
published(locator: string, roomVersion: string): void;
|
|
468
|
-
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
|
|
557
|
+
hold(rooms: readonly HeldRoom[]): void;
|
|
558
|
+
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
469
559
|
};
|
|
560
|
+
export type PathRule = (path: string) => boolean;
|
|
470
561
|
export type Adapter = {
|
|
471
562
|
readonly localSaves?: true;
|
|
472
|
-
readonly
|
|
563
|
+
readonly roomTypes?: VerifiedModel;
|
|
564
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
565
|
+
readonly pathRule?: PathRule;
|
|
566
|
+
readonly unkeptReads?: readonly string[];
|
|
567
|
+
readonly leadingReads?: readonly string[];
|
|
473
568
|
authorize(): Promise<Authorization>;
|
|
474
|
-
discover(authorization: Authorization): Promise<DiscoverResult>;
|
|
569
|
+
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
475
570
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
476
|
-
refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
571
|
+
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
477
572
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
478
573
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
479
574
|
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
480
|
-
link(authorization: Authorization, request:
|
|
481
|
-
|
|
482
|
-
}>): Promise<BinaryLinkResult>;
|
|
483
|
-
referrerScope(referrer: unknown): ReferrerScope | null;
|
|
575
|
+
link(authorization: Authorization, request: BinaryRequest | KeyedRequest): Promise<BinaryLinkResult>;
|
|
576
|
+
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
484
577
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
578
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
485
579
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
486
580
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
487
581
|
roomStream?: RoomStream;
|
|
488
582
|
conversations?: ConversationStream;
|
|
489
583
|
serviceMode?: ServiceModeSignal;
|
|
490
584
|
};
|
|
491
|
-
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 {};
|
|
@@ -3,7 +3,6 @@ export type BinaryFileRecord = {
|
|
|
3
3
|
readonly state: 'accepted';
|
|
4
4
|
readonly revision: string;
|
|
5
5
|
readonly path: string;
|
|
6
|
-
readonly fileRef: string;
|
|
7
6
|
readonly byteLength: number;
|
|
8
7
|
readonly mediaType: string;
|
|
9
8
|
readonly sha256: string;
|
|
@@ -15,8 +14,4 @@ export type BinaryFileRecord = {
|
|
|
15
14
|
readonly mediaType: string;
|
|
16
15
|
readonly sha256: string;
|
|
17
16
|
};
|
|
18
|
-
export type BinaryReference = {
|
|
19
|
-
readonly fileRef: string;
|
|
20
|
-
readonly referrer: unknown;
|
|
21
|
-
};
|
|
22
17
|
export declare function binaryRecord(path: string, held: HeldBinary, revision: string | undefined): BinaryFileRecord;
|