@agentshouse/app-bridge 0.1.0-c646d0da70608 → 0.1.0-c64bbf5cda7ef
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 +943 -19
- package/dist/mdmodel/definition.d.ts +17 -1
- package/dist/mdmodel/document.d.ts +6 -5
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +24 -9
- package/dist/mdmodel/kinds.d.ts +18 -0
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +9 -1
- 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/reserved.d.ts +4 -0
- package/dist/mdmodel/types.d.ts +39 -4
- package/dist/mdmodel/validate.d.ts +30 -4
- package/dist/mdruntime/actions.d.ts +19 -0
- package/dist/mdruntime/adapter.d.ts +151 -79
- package/dist/mdruntime/attached-model.d.ts +7 -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 +9 -16
- package/dist/mdruntime/change.d.ts +32 -1
- package/dist/mdruntime/client.d.ts +33 -10
- package/dist/mdruntime/collection.d.ts +11 -21
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +43 -18
- package/dist/mdruntime/durability.d.ts +16 -4
- package/dist/mdruntime/figures.d.ts +47 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +5 -0
- package/dist/mdruntime/install.d.ts +55 -0
- package/dist/mdruntime/job.d.ts +32 -0
- package/dist/mdruntime/listing.d.ts +52 -0
- package/dist/mdruntime/live.d.ts +22 -0
- package/dist/mdruntime/log.d.ts +5 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +51 -0
- package/dist/mdruntime/model.d.ts +8 -10
- package/dist/mdruntime/observation.d.ts +17 -2
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +49 -8
- package/dist/mdruntime/overlay.d.ts +4 -5
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/query.d.ts +26 -185
- package/dist/mdruntime/reach.d.ts +19 -9
- package/dist/mdruntime/readiness.d.ts +14 -17
- package/dist/mdruntime/reads.d.ts +35 -0
- package/dist/mdruntime/recovery.d.ts +3 -2
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +55 -33
- package/dist/mdruntime/room-draft.d.ts +37 -6
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +41 -0
- package/dist/mdruntime/save.d.ts +53 -14
- package/dist/mdruntime/saves.d.ts +69 -0
- package/dist/mdruntime/search.d.ts +15 -78
- package/dist/mdruntime/seed.d.ts +24 -0
- 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 +19 -0
- package/dist/mdruntime/socket/rooms.d.ts +42 -0
- package/dist/mdruntime/socket/session.d.ts +38 -0
- package/dist/mdruntime/socket.d.ts +69 -0
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +4 -5
- package/dist/mdruntime/store/fences.d.ts +15 -0
- package/dist/mdruntime/store/installs.d.ts +29 -0
- package/dist/mdruntime/store/readiness.d.ts +9 -0
- package/dist/mdruntime/store/records.d.ts +211 -0
- package/dist/mdruntime/store/room-held.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 +106 -150
- package/dist/mdruntime/stored.d.ts +155 -0
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +414 -0
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/turn.d.ts +5 -3
- package/dist/mdruntime/wire.d.ts +50 -6
- package/dist/test-host.d.ts +7 -4
- package/dist/test-host.js +19 -29
- package/docs/families.md +69 -53
- package/package.json +8 -3
- package/dist/calls.d.ts +0 -117
- package/dist/calls.js +0 -1
- package/dist/mdmodel/condition.d.ts +0 -149
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/connection.d.ts +0 -138
- package/dist/mdruntime/file.d.ts +0 -19
- package/dist/mdruntime/rows.d.ts +0 -36
- package/dist/mdruntime/shared.d.ts +0 -10
package/dist/mdmodel/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Definition } from './definition.js';
|
|
|
2
2
|
export type Library = Readonly<Record<string, string>>;
|
|
3
3
|
export type VerifiedModel = {
|
|
4
4
|
readonly types: Readonly<Record<string, Definition>>;
|
|
5
|
+
readonly nameable?: readonly string[];
|
|
5
6
|
};
|
|
6
7
|
export type ModelVerification = {
|
|
7
8
|
readonly verdict: 'accept';
|
|
@@ -11,15 +12,23 @@ export type ModelVerification = {
|
|
|
11
12
|
readonly rule: string;
|
|
12
13
|
readonly location?: string;
|
|
13
14
|
};
|
|
15
|
+
export type TypedPath = {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly named: boolean;
|
|
19
|
+
readonly body: boolean;
|
|
20
|
+
};
|
|
14
21
|
export type ValidationContext = {
|
|
15
22
|
readonly binaryTargets: readonly string[];
|
|
23
|
+
readonly anyRoom?: true;
|
|
24
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
16
25
|
};
|
|
17
26
|
export type ProjectionContext = {
|
|
18
27
|
readonly documentTargets: readonly string[];
|
|
19
28
|
readonly definition?: Definition;
|
|
20
29
|
};
|
|
21
30
|
export type DivisionContext = ProjectionContext & {
|
|
22
|
-
readonly
|
|
31
|
+
readonly bound: number;
|
|
23
32
|
};
|
|
24
33
|
export type Extent = {
|
|
25
34
|
readonly start: number;
|
|
@@ -60,6 +69,10 @@ export type Validation = {
|
|
|
60
69
|
} | ({
|
|
61
70
|
readonly verdict: 'refuse';
|
|
62
71
|
} & Refusal);
|
|
72
|
+
export type ValidationStep = {
|
|
73
|
+
readonly path: string;
|
|
74
|
+
readonly resolved: number;
|
|
75
|
+
};
|
|
63
76
|
export type Projection = {
|
|
64
77
|
readonly ok: true;
|
|
65
78
|
readonly text: string;
|
|
@@ -92,14 +105,31 @@ export type Link = {
|
|
|
92
105
|
readonly href: string;
|
|
93
106
|
readonly target: string;
|
|
94
107
|
};
|
|
95
|
-
export type LinkOccurrence = Link & {
|
|
96
|
-
readonly start: number;
|
|
97
|
-
};
|
|
98
108
|
export type Reference = {
|
|
99
109
|
readonly pointer: string;
|
|
100
110
|
readonly value: string;
|
|
101
111
|
readonly to: readonly string[];
|
|
112
|
+
readonly crossRoom?: true;
|
|
102
113
|
};
|
|
114
|
+
export type RoomReference = {
|
|
115
|
+
readonly handle: string;
|
|
116
|
+
readonly path: string;
|
|
117
|
+
} & ({
|
|
118
|
+
readonly kind: 'link';
|
|
119
|
+
readonly href: string;
|
|
120
|
+
} | {
|
|
121
|
+
readonly kind: 'field';
|
|
122
|
+
readonly pointer: string;
|
|
123
|
+
readonly value: string;
|
|
124
|
+
readonly to: readonly string[];
|
|
125
|
+
readonly crossRoom?: true;
|
|
126
|
+
} | {
|
|
127
|
+
readonly kind: 'item';
|
|
128
|
+
readonly section: string;
|
|
129
|
+
readonly href: string;
|
|
130
|
+
readonly to: readonly string[];
|
|
131
|
+
readonly crossRoom?: true;
|
|
132
|
+
});
|
|
103
133
|
export type Change = {
|
|
104
134
|
readonly kind: 'field';
|
|
105
135
|
readonly name: string;
|
|
@@ -130,6 +160,7 @@ export type ApplyResult = {
|
|
|
130
160
|
} | {
|
|
131
161
|
readonly outcome: 'stale';
|
|
132
162
|
readonly document: Document;
|
|
163
|
+
readonly stale: readonly number[];
|
|
133
164
|
} | {
|
|
134
165
|
readonly outcome: 'refuse';
|
|
135
166
|
readonly refusal: Refusal;
|
|
@@ -141,3 +172,7 @@ export type BodyResult = {
|
|
|
141
172
|
readonly outcome: 'refuse';
|
|
142
173
|
readonly refusal: Refusal;
|
|
143
174
|
};
|
|
175
|
+
export type UnlinkedBody = {
|
|
176
|
+
readonly body: string;
|
|
177
|
+
readonly links: ReadonlyMap<string, string>;
|
|
178
|
+
};
|
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type { DocumentCheck, Library, ModelVerification, Reached, Validation, ValidationContext, VerifiedModel } from './types.js';
|
|
2
|
+
import type { Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
|
|
3
3
|
export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
|
|
4
|
-
export declare function verify(schema: string): ModelVerification;
|
|
5
|
-
export declare function
|
|
6
|
-
|
|
4
|
+
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
5
|
+
export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
|
|
6
|
+
type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
|
|
7
|
+
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
|
|
8
|
+
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
9
|
+
export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
|
|
10
|
+
type Placed = {
|
|
11
|
+
readonly reference: Reached;
|
|
12
|
+
readonly location: string;
|
|
13
|
+
};
|
|
14
|
+
export type Assessment = {
|
|
15
|
+
readonly file: string;
|
|
16
|
+
readonly type: string | undefined;
|
|
17
|
+
readonly targets: readonly string[];
|
|
18
|
+
readonly read: Validation | null;
|
|
19
|
+
readonly structured: Validation | null;
|
|
20
|
+
readonly fields: readonly Placed[];
|
|
21
|
+
readonly linked: boolean;
|
|
22
|
+
readonly sections: readonly Placed[];
|
|
23
|
+
};
|
|
24
|
+
export declare function assess(file: string, parsed: ParseResult, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
|
|
25
|
+
export declare function assessReferences(file: string, parsed: ParseResult, changed: ReadonlySet<string>, model?: VerifiedModel, context?: Placing): Assessment;
|
|
26
|
+
export type Verdicts = {
|
|
27
|
+
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
28
|
+
verdict(): Validation;
|
|
29
|
+
};
|
|
30
|
+
export declare function verdicts(): Verdicts;
|
|
31
|
+
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
7
32
|
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConversationHistoryRequest } from './adapter.js';
|
|
2
|
+
import { type CallResult, type HistoryAnswer, type Resolution } from './outcome.js';
|
|
3
|
+
import type { Attempted } from './recovery.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
export type HistoryQuery = {
|
|
6
|
+
revision?: string;
|
|
7
|
+
pageToken?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function readHistory(runtime: Runtime, locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
10
|
+
export declare function located(runtime: Runtime, room: string, path: string, destination: string): Promise<{
|
|
11
|
+
room: string;
|
|
12
|
+
path: string;
|
|
13
|
+
} | null>;
|
|
14
|
+
export declare function resolveReference(runtime: Runtime, room: string, path: string, destination: string): Promise<Resolution>;
|
|
15
|
+
export declare function invokeAction(runtime: Runtime, name: string, input: unknown, dispatching?: () => Promise<void>): Promise<CallResult>;
|
|
16
|
+
export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): Promise<CallResult>;
|
|
17
|
+
export declare function called(runtime: Runtime, name: string, input: unknown): Promise<CallResult>;
|
|
18
|
+
export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
|
|
19
|
+
export declare function resendLater(runtime: Runtime): void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
|
|
1
2
|
import type { ModelResult } from './model.js';
|
|
3
|
+
export type { SavedFacts, TypedPath };
|
|
2
4
|
import type { Open } from './open.js';
|
|
3
5
|
import type { ChangeBatch } from './change.js';
|
|
4
6
|
export type Authorization = object;
|
|
@@ -10,14 +12,13 @@ export type TypedSelection = {
|
|
|
10
12
|
roots: readonly string[];
|
|
11
13
|
};
|
|
12
14
|
export type OperationScopes = {
|
|
13
|
-
read: readonly string[];
|
|
14
|
-
sync: readonly string[];
|
|
15
15
|
write: readonly string[];
|
|
16
|
-
|
|
16
|
+
erase: readonly string[];
|
|
17
17
|
};
|
|
18
18
|
export type ReplicaAdmission = {
|
|
19
19
|
selection: string;
|
|
20
20
|
admission: Open<'admitted' | 'unavailable'>;
|
|
21
|
+
offline: Open<'locked' | 'open'>;
|
|
21
22
|
};
|
|
22
23
|
export type DiscoveredRoom = {
|
|
23
24
|
name: string;
|
|
@@ -33,24 +34,21 @@ export type Capability = {
|
|
|
33
34
|
name: string;
|
|
34
35
|
limits?: readonly ProviderLimit[];
|
|
35
36
|
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
37
|
};
|
|
45
38
|
export type ListedConversation = {
|
|
46
39
|
conversation: string;
|
|
47
40
|
agent: string;
|
|
41
|
+
agentName: string;
|
|
42
|
+
agentRetired: boolean;
|
|
48
43
|
name: string;
|
|
49
44
|
created: string;
|
|
50
45
|
finished: string | null;
|
|
51
46
|
outcome: string | null;
|
|
47
|
+
waiting: boolean;
|
|
48
|
+
newest: string | null;
|
|
49
|
+
processEnded: string | null;
|
|
52
50
|
};
|
|
53
|
-
export type ConversationAction = '
|
|
51
|
+
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
|
|
54
52
|
export type ConversationMessage = {
|
|
55
53
|
identity: string;
|
|
56
54
|
turn: string;
|
|
@@ -141,6 +139,10 @@ export type SessionOption = (SessionOptionNaming & {
|
|
|
141
139
|
type: 'boolean';
|
|
142
140
|
currentValue: boolean;
|
|
143
141
|
});
|
|
142
|
+
export type RunningSubagent = {
|
|
143
|
+
description: string;
|
|
144
|
+
activity: string | null;
|
|
145
|
+
};
|
|
144
146
|
export type ConversationEvent = {
|
|
145
147
|
kind: 'turn';
|
|
146
148
|
conversation: string;
|
|
@@ -162,6 +164,22 @@ export type ConversationEvent = {
|
|
|
162
164
|
kind: 'options';
|
|
163
165
|
conversation: string;
|
|
164
166
|
options: readonly SessionOption[];
|
|
167
|
+
} | {
|
|
168
|
+
kind: 'starting';
|
|
169
|
+
conversation: string;
|
|
170
|
+
step: string | null;
|
|
171
|
+
} | {
|
|
172
|
+
kind: 'subagents';
|
|
173
|
+
conversation: string;
|
|
174
|
+
subagents: readonly RunningSubagent[];
|
|
175
|
+
} | {
|
|
176
|
+
kind: 'link';
|
|
177
|
+
conversation: string;
|
|
178
|
+
connected: boolean;
|
|
179
|
+
} | {
|
|
180
|
+
kind: 'deliveries';
|
|
181
|
+
conversation: string;
|
|
182
|
+
unknown: readonly string[];
|
|
165
183
|
} | {
|
|
166
184
|
kind: 'accepted-message';
|
|
167
185
|
conversation: string;
|
|
@@ -172,6 +190,9 @@ export type ConversationEvent = {
|
|
|
172
190
|
} | {
|
|
173
191
|
kind: 'list';
|
|
174
192
|
entries: readonly ListedConversation[];
|
|
193
|
+
whole: boolean;
|
|
194
|
+
more: boolean;
|
|
195
|
+
cursor: string | null;
|
|
175
196
|
} | {
|
|
176
197
|
kind: 'listed';
|
|
177
198
|
entry: ListedConversation;
|
|
@@ -179,14 +200,23 @@ export type ConversationEvent = {
|
|
|
179
200
|
kind: 'unlisted';
|
|
180
201
|
conversation: string;
|
|
181
202
|
};
|
|
203
|
+
export type ListedAgent = {
|
|
204
|
+
agent: string;
|
|
205
|
+
name: string;
|
|
206
|
+
retired: boolean;
|
|
207
|
+
};
|
|
182
208
|
export type ConversationStream = {
|
|
183
209
|
replicate(conversations: readonly string[]): void;
|
|
210
|
+
hold(cursor: string | null): void;
|
|
184
211
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
212
|
+
agents?(): Promise<readonly ListedAgent[] | null>;
|
|
213
|
+
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
185
214
|
};
|
|
186
215
|
export type ActionDeclaration = {
|
|
187
216
|
name: string;
|
|
188
217
|
inputShape: unknown;
|
|
189
218
|
resultKind: unknown;
|
|
219
|
+
room?: string;
|
|
190
220
|
};
|
|
191
221
|
export type ProviderLimit = {
|
|
192
222
|
name: string;
|
|
@@ -200,7 +230,6 @@ export type HistoryRetention = {
|
|
|
200
230
|
};
|
|
201
231
|
export type Retention = {
|
|
202
232
|
history: HistoryRetention;
|
|
203
|
-
outcome: number;
|
|
204
233
|
refreshHorizon: number;
|
|
205
234
|
};
|
|
206
235
|
export type Discovery = {
|
|
@@ -229,7 +258,7 @@ export type ProviderRefusal = {
|
|
|
229
258
|
export type ScopedRefusal = ProviderRefusal & {
|
|
230
259
|
kind: 'scoped-refusal';
|
|
231
260
|
locator: string;
|
|
232
|
-
scope: Open<'content' | '
|
|
261
|
+
scope: Open<'content' | 'model' | 'operation' | 'undisclosed'>;
|
|
233
262
|
};
|
|
234
263
|
export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
|
|
235
264
|
export type ContractUnavailable = ProviderRefusal & {
|
|
@@ -238,7 +267,7 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
238
267
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
239
268
|
export type PageToken = string;
|
|
240
269
|
export type ChangeAuthor = {
|
|
241
|
-
kind: Open<'user' | 'site'>;
|
|
270
|
+
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
242
271
|
id: string;
|
|
243
272
|
name: string;
|
|
244
273
|
};
|
|
@@ -252,38 +281,49 @@ export type HeadChange = {
|
|
|
252
281
|
time: string;
|
|
253
282
|
};
|
|
254
283
|
export type BinaryFile = {
|
|
255
|
-
fileRef: string;
|
|
256
284
|
byteLength: number;
|
|
257
285
|
mediaType: string;
|
|
258
286
|
sha256: string;
|
|
259
287
|
};
|
|
260
|
-
export type HeldContent = {
|
|
261
|
-
documents: Readonly<Record<string, string>>;
|
|
262
|
-
revisions: Readonly<Record<string, string>>;
|
|
263
|
-
};
|
|
264
288
|
export type BootstrapRequest = {
|
|
265
289
|
locator: string;
|
|
266
290
|
selection: string;
|
|
267
291
|
pageToken?: PageToken;
|
|
268
|
-
|
|
292
|
+
arriving?: (bytes: number) => void;
|
|
293
|
+
signal?: AbortSignal;
|
|
294
|
+
};
|
|
295
|
+
export type BootstrapPart = {
|
|
296
|
+
readonly id: string;
|
|
297
|
+
readonly bytes: number;
|
|
298
|
+
};
|
|
299
|
+
export type BootstrapInventory = {
|
|
300
|
+
readonly bytes: number;
|
|
269
301
|
};
|
|
270
302
|
export type RoomModels = {
|
|
271
303
|
collection?: ModelResult;
|
|
272
|
-
selection?: ModelResult;
|
|
273
304
|
};
|
|
274
305
|
export type BootstrapPage = {
|
|
275
306
|
kind: 'bootstrap';
|
|
276
307
|
roomVersion: string;
|
|
277
308
|
models?: RoomModels;
|
|
278
309
|
documents: Readonly<Record<string, string>>;
|
|
310
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
279
311
|
revisions: Readonly<Record<string, string>>;
|
|
312
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
313
|
+
created?: Readonly<Record<string, string>>;
|
|
280
314
|
changes: Readonly<Record<string, HeadChange>>;
|
|
281
315
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
316
|
+
folders?: readonly string[];
|
|
282
317
|
pageToken?: PageToken;
|
|
318
|
+
parts?: readonly BootstrapPart[];
|
|
319
|
+
bytes?: number;
|
|
320
|
+
};
|
|
321
|
+
export type NotReady = {
|
|
322
|
+
kind: 'not-ready';
|
|
283
323
|
};
|
|
284
324
|
export type BootstrapResult = BootstrapPage | {
|
|
285
325
|
kind: 'beyond-horizon';
|
|
286
|
-
} | AdapterFailure;
|
|
326
|
+
} | NotReady | AdapterFailure;
|
|
287
327
|
export type RefreshRequest = {
|
|
288
328
|
locator: string;
|
|
289
329
|
selection: string;
|
|
@@ -295,10 +335,15 @@ export type RefreshPage = {
|
|
|
295
335
|
roomVersion: string;
|
|
296
336
|
models?: RoomModels;
|
|
297
337
|
documents: Readonly<Record<string, string>>;
|
|
338
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
298
339
|
revisions: Readonly<Record<string, string>>;
|
|
340
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
341
|
+
created?: Readonly<Record<string, string>>;
|
|
299
342
|
changes: Readonly<Record<string, HeadChange>>;
|
|
300
343
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
301
344
|
removals: readonly string[];
|
|
345
|
+
folders?: readonly string[];
|
|
346
|
+
folderRemovals?: readonly string[];
|
|
302
347
|
pageToken?: PageToken;
|
|
303
348
|
};
|
|
304
349
|
export type RefreshResult = {
|
|
@@ -309,6 +354,7 @@ export type RefreshResult = {
|
|
|
309
354
|
export type MutationRequest = {
|
|
310
355
|
locator: string;
|
|
311
356
|
changeBatch: ChangeBatch;
|
|
357
|
+
file(localId: string): Promise<Blob>;
|
|
312
358
|
upload?: unknown;
|
|
313
359
|
};
|
|
314
360
|
export type RetryableRefusal = ProviderRefusal & {
|
|
@@ -319,17 +365,21 @@ export type ServiceMode = Open<'open' | 'write-halted'>;
|
|
|
319
365
|
export type ServiceModeSignal = {
|
|
320
366
|
observe(notify: (mode: ServiceMode) => void): () => void;
|
|
321
367
|
};
|
|
322
|
-
export type
|
|
323
|
-
kind: 'accepted';
|
|
368
|
+
export type AcceptedRoom = {
|
|
324
369
|
roomVersion: string;
|
|
325
370
|
documents: Readonly<Record<string, string>>;
|
|
326
371
|
revisions: Readonly<Record<string, string>>;
|
|
372
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
327
373
|
changes: Readonly<Record<string, HeadChange>>;
|
|
328
374
|
removals: readonly string[];
|
|
329
375
|
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
376
|
+
};
|
|
377
|
+
export type MutationResult = (AcceptedRoom & {
|
|
378
|
+
kind: 'accepted';
|
|
330
379
|
author?: string;
|
|
331
380
|
time?: string;
|
|
332
|
-
|
|
381
|
+
destination?: AcceptedRoom;
|
|
382
|
+
}) | (ProviderRefusal & {
|
|
333
383
|
kind: 'conflicted';
|
|
334
384
|
roomVersion?: string;
|
|
335
385
|
affected: Readonly<Record<string, string>>;
|
|
@@ -338,15 +388,9 @@ export type MutationResult = {
|
|
|
338
388
|
affected: Readonly<Record<string, string>>;
|
|
339
389
|
}) | RetryableRefusal | {
|
|
340
390
|
kind: 'write-halted';
|
|
341
|
-
} | {
|
|
342
|
-
kind: 'expired';
|
|
343
|
-
restored?: true;
|
|
344
391
|
} | AdapterFailure;
|
|
345
392
|
export type HistoryAuthor = {
|
|
346
|
-
kind: 'user';
|
|
347
|
-
id: string;
|
|
348
|
-
} | {
|
|
349
|
-
kind: 'site';
|
|
393
|
+
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
350
394
|
id: string;
|
|
351
395
|
name: string;
|
|
352
396
|
};
|
|
@@ -378,22 +422,35 @@ export type BinaryRequest = {
|
|
|
378
422
|
locator: string;
|
|
379
423
|
path: string;
|
|
380
424
|
revision: string;
|
|
381
|
-
fileRef?: string;
|
|
382
|
-
} | {
|
|
383
|
-
kind: 'reference';
|
|
384
|
-
fileRef: string;
|
|
385
|
-
referrer: unknown;
|
|
386
|
-
};
|
|
387
|
-
export type ReferrerScope = {
|
|
388
|
-
kind: 'room';
|
|
389
|
-
locator: string;
|
|
390
|
-
path?: string;
|
|
391
|
-
} | {
|
|
392
|
-
kind: 'conversations';
|
|
393
425
|
};
|
|
394
426
|
export type BinaryResult = {
|
|
395
427
|
kind: 'binary';
|
|
428
|
+
body: ReadableStream<Uint8Array>;
|
|
429
|
+
mediaType: string;
|
|
430
|
+
sha256?: string;
|
|
431
|
+
} | (ProviderRefusal & {
|
|
432
|
+
kind: 'rejected';
|
|
433
|
+
}) | AdapterFailure;
|
|
434
|
+
export type BinaryLinkResult = {
|
|
435
|
+
kind: 'link';
|
|
436
|
+
url: string;
|
|
437
|
+
name: string;
|
|
438
|
+
mediaType?: string;
|
|
439
|
+
} | (ProviderRefusal & {
|
|
440
|
+
kind: 'rejected';
|
|
441
|
+
}) | AdapterFailure;
|
|
442
|
+
export type AttachRequest = {
|
|
443
|
+
locator: string;
|
|
444
|
+
name: string;
|
|
445
|
+
mediaType: string;
|
|
446
|
+
byteLength: number;
|
|
447
|
+
sha256: string;
|
|
396
448
|
blob: Blob;
|
|
449
|
+
};
|
|
450
|
+
export type AttachResult = {
|
|
451
|
+
kind: 'attached';
|
|
452
|
+
path: string;
|
|
453
|
+
revision: string;
|
|
397
454
|
} | (ProviderRefusal & {
|
|
398
455
|
kind: 'rejected';
|
|
399
456
|
}) | AdapterFailure;
|
|
@@ -409,67 +466,82 @@ export type ActionResult = {
|
|
|
409
466
|
kind: 'action';
|
|
410
467
|
result: unknown;
|
|
411
468
|
at?: RoomVersionAt;
|
|
469
|
+
} | (ProviderRefusal & {
|
|
470
|
+
kind: 'rejected';
|
|
471
|
+
reset?: string;
|
|
472
|
+
}) | AdapterFailure;
|
|
473
|
+
export type SearchHit = {
|
|
474
|
+
room: string;
|
|
475
|
+
path: string;
|
|
476
|
+
line?: number;
|
|
477
|
+
snippet?: string;
|
|
478
|
+
};
|
|
479
|
+
export type SearchAsk = {
|
|
480
|
+
text: string;
|
|
481
|
+
rooms: readonly string[] | null;
|
|
482
|
+
};
|
|
483
|
+
export type SearchAnswer = {
|
|
484
|
+
kind: 'found';
|
|
485
|
+
documents: readonly SearchHit[];
|
|
412
486
|
} | (ProviderRefusal & {
|
|
413
487
|
kind: 'rejected';
|
|
414
488
|
}) | AdapterFailure;
|
|
415
489
|
export type HeldRoom = {
|
|
416
490
|
locator: string;
|
|
491
|
+
roomVersion: string | null;
|
|
492
|
+
};
|
|
493
|
+
export type RoomChange = {
|
|
494
|
+
kind: 'room-change';
|
|
495
|
+
locator: string;
|
|
496
|
+
from: string | null;
|
|
417
497
|
roomVersion: string;
|
|
418
|
-
|
|
419
|
-
|
|
498
|
+
read(): Promise<RefreshPage>;
|
|
499
|
+
};
|
|
500
|
+
export type AuthorityChange = {
|
|
501
|
+
kind: 'authority-changed';
|
|
502
|
+
rooms: readonly DiscoveredRoom[];
|
|
503
|
+
left: readonly string[];
|
|
504
|
+
member?: Member;
|
|
420
505
|
};
|
|
421
506
|
export type RoomStreamEvent = {
|
|
422
507
|
kind: 'opened';
|
|
508
|
+
} | {
|
|
509
|
+
kind: 'discovered';
|
|
510
|
+
discovery: Discovery;
|
|
423
511
|
} | {
|
|
424
512
|
kind: 'closed';
|
|
425
513
|
revoked: boolean;
|
|
514
|
+
lost: boolean;
|
|
515
|
+
authorityChanged: boolean;
|
|
426
516
|
} | {
|
|
427
|
-
kind: '
|
|
517
|
+
kind: 'caught-up';
|
|
428
518
|
expired: readonly string[];
|
|
429
|
-
} |
|
|
430
|
-
kind: 'room-version';
|
|
431
|
-
locator: string;
|
|
432
|
-
roomVersion: string;
|
|
433
|
-
};
|
|
434
|
-
export type KeptReceipt = {
|
|
435
|
-
key: string;
|
|
436
|
-
head: unknown;
|
|
437
|
-
};
|
|
438
|
-
export type StreamReceipts = {
|
|
439
|
-
heads(): Promise<readonly KeptReceipt[]>;
|
|
440
|
-
parts(key: string, count: number): Promise<readonly unknown[]>;
|
|
441
|
-
keep(key: string, head: unknown, part?: {
|
|
442
|
-
index: number;
|
|
443
|
-
value: unknown;
|
|
444
|
-
}): Promise<void>;
|
|
445
|
-
drop(keys: readonly string[]): Promise<void>;
|
|
446
|
-
};
|
|
447
|
-
export type AcquiredDemand = {
|
|
448
|
-
rooms: readonly string[];
|
|
449
|
-
conversations: boolean;
|
|
450
|
-
};
|
|
519
|
+
} | AuthorityChange | RoomChange;
|
|
451
520
|
export type RoomStream = {
|
|
452
|
-
hold(rooms: readonly HeldRoom[]
|
|
453
|
-
|
|
454
|
-
published(locator: string, roomVersion: string): void;
|
|
455
|
-
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
|
|
521
|
+
hold(rooms: readonly HeldRoom[]): void;
|
|
522
|
+
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
456
523
|
};
|
|
457
524
|
export type Adapter = {
|
|
458
525
|
readonly localSaves?: true;
|
|
459
|
-
readonly
|
|
526
|
+
readonly roomTypes?: string;
|
|
527
|
+
readonly nameableRoomTypes?: readonly string[];
|
|
528
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
529
|
+
readonly unkeptReads?: readonly string[];
|
|
530
|
+
readonly leadingReads?: readonly string[];
|
|
460
531
|
authorize(): Promise<Authorization>;
|
|
461
|
-
discover(authorization: Authorization): Promise<DiscoverResult>;
|
|
532
|
+
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
462
533
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
463
|
-
refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
534
|
+
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
464
535
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
465
536
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
466
537
|
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
467
|
-
|
|
538
|
+
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
539
|
+
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
468
540
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
541
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
469
542
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
470
543
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
471
544
|
roomStream?: RoomStream;
|
|
472
545
|
conversations?: ConversationStream;
|
|
473
546
|
serviceMode?: ServiceModeSignal;
|
|
474
547
|
};
|
|
475
|
-
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
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 roomTypesOf(schema: string | undefined, nameable?: readonly string[]): VerifiedModel;
|
|
5
|
+
export declare function builtInModel(roomTypes: VerifiedModel): ModelState;
|
|
6
|
+
export declare function schemaTypes(schema: string | null, roomTypes: VerifiedModel): VerifiedModel['types'];
|
|
7
|
+
export declare function attachedModel(answer: ModelResult, roomTypes: VerifiedModel): ModelState;
|
|
@@ -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;
|
|
@@ -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>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
2
|
+
import type { MdRuntimeClient } from './client.js';
|
|
3
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
4
|
+
type Rows = DocumentResult | GroupResult;
|
|
5
|
+
export type WindowAnswer = Rows | PendingResult;
|
|
6
|
+
export type WindowChain = {
|
|
7
|
+
want(count: number): void;
|
|
8
|
+
close(): void;
|
|
9
|
+
};
|
|
10
|
+
export declare function chainedWindows(runtime: MdRuntimeClient, query: DocumentQuery | GroupQuery, count: number, publish: (answers: readonly (WindowAnswer | null)[], settled: boolean) => void): WindowChain;
|
|
11
|
+
export {};
|