@agentshouse/app-bridge 0.1.0-ccf413b4e709d → 0.1.0-cd2d3edbf9805
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 +9 -7
- package/dist/calls.d.ts +747 -0
- package/dist/calls.js +1 -0
- package/dist/index.d.ts +44 -6
- package/dist/mdmodel/blocks.d.ts +10 -0
- package/dist/mdmodel/condition.d.ts +167 -0
- package/dist/mdmodel/definition.d.ts +81 -0
- package/dist/mdmodel/divide.d.ts +2 -0
- package/dist/mdmodel/document.d.ts +15 -0
- package/dist/mdmodel/fields.d.ts +5 -0
- package/dist/mdmodel/index.d.ts +20 -0
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +25 -0
- package/dist/mdmodel/profile.d.ts +5 -0
- package/dist/mdmodel/project.d.ts +21 -0
- package/dist/mdmodel/references.d.ts +3 -0
- package/dist/mdmodel/types.d.ts +167 -0
- package/dist/mdmodel/validate.d.ts +31 -0
- package/dist/mdmodel/version.d.ts +1 -0
- package/dist/mdmodel/yaml.d.ts +55 -0
- package/dist/mdruntime/adapter.d.ts +517 -0
- package/dist/mdruntime/binary.d.ts +17 -0
- package/dist/mdruntime/chain.d.ts +10 -0
- package/dist/mdruntime/change-set.d.ts +27 -0
- package/dist/mdruntime/change.d.ts +118 -0
- package/dist/mdruntime/client.d.ts +90 -0
- package/dist/mdruntime/collection.d.ts +27 -0
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/connection.d.ts +152 -0
- package/dist/mdruntime/conversation.d.ts +113 -0
- package/dist/mdruntime/durability.d.ts +11 -0
- package/dist/mdruntime/failure.d.ts +12 -0
- package/dist/mdruntime/fulltext.d.ts +26 -0
- package/dist/mdruntime/identity.d.ts +6 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +27 -0
- package/dist/mdruntime/model.d.ts +62 -0
- package/dist/mdruntime/observation.d.ts +44 -0
- package/dist/mdruntime/open.d.ts +1 -0
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +84 -0
- package/dist/mdruntime/overlay.d.ts +24 -0
- package/dist/mdruntime/query.d.ts +283 -0
- package/dist/mdruntime/reach.d.ts +53 -0
- package/dist/mdruntime/readiness.d.ts +51 -0
- package/dist/mdruntime/recovery.d.ts +25 -0
- package/dist/mdruntime/replica.d.ts +67 -0
- package/dist/mdruntime/room-draft.d.ts +173 -0
- package/dist/mdruntime/save.d.ts +102 -0
- package/dist/mdruntime/search.d.ts +72 -0
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/status.d.ts +27 -0
- package/dist/mdruntime/store.d.ts +153 -0
- package/dist/mdruntime/stored.d.ts +129 -0
- package/dist/mdruntime/tables.d.ts +324 -0
- package/dist/mdruntime/wire.d.ts +238 -0
- package/dist/test-host.d.ts +8 -2
- package/dist/test-host.js +47 -11
- package/docs/families.md +55 -12
- package/package.json +8 -6
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Definition } from './definition.js';
|
|
2
|
+
import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
|
|
3
|
+
export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
|
|
4
|
+
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
5
|
+
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
|
|
6
|
+
export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
|
|
7
|
+
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
8
|
+
export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
|
|
9
|
+
type Placed = {
|
|
10
|
+
readonly reference: Reached;
|
|
11
|
+
readonly location: string;
|
|
12
|
+
};
|
|
13
|
+
export type Assessment = {
|
|
14
|
+
readonly file: string;
|
|
15
|
+
readonly type: string | undefined;
|
|
16
|
+
readonly targets: readonly string[];
|
|
17
|
+
readonly read: Validation | null;
|
|
18
|
+
readonly structured: Validation | null;
|
|
19
|
+
readonly fields: readonly Placed[];
|
|
20
|
+
readonly linked: boolean;
|
|
21
|
+
readonly sections: readonly Placed[];
|
|
22
|
+
};
|
|
23
|
+
export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): Assessment;
|
|
24
|
+
export type Verdicts = {
|
|
25
|
+
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
26
|
+
verdict(): Validation;
|
|
27
|
+
};
|
|
28
|
+
export declare function verdicts(): Verdicts;
|
|
29
|
+
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
30
|
+
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "0.1.0-alpha.19";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare class YamlError extends Error {
|
|
2
|
+
readonly offset: number;
|
|
3
|
+
constructor(offset: number);
|
|
4
|
+
}
|
|
5
|
+
export type YamlScalar = {
|
|
6
|
+
readonly kind: 'scalar';
|
|
7
|
+
readonly value: string | number | boolean | null;
|
|
8
|
+
readonly start: number;
|
|
9
|
+
readonly end: number;
|
|
10
|
+
};
|
|
11
|
+
export type YamlSeq = {
|
|
12
|
+
readonly kind: 'seq';
|
|
13
|
+
readonly items: readonly YamlNode[];
|
|
14
|
+
readonly start: number;
|
|
15
|
+
readonly end: number;
|
|
16
|
+
};
|
|
17
|
+
export type YamlEntry = {
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly after: number;
|
|
20
|
+
readonly value: YamlNode;
|
|
21
|
+
};
|
|
22
|
+
export type YamlMap = {
|
|
23
|
+
readonly kind: 'map';
|
|
24
|
+
readonly entries: readonly YamlEntry[];
|
|
25
|
+
readonly start: number;
|
|
26
|
+
readonly end: number;
|
|
27
|
+
};
|
|
28
|
+
export type YamlNode = YamlScalar | YamlSeq | YamlMap;
|
|
29
|
+
export declare function interpretPlain(text: string): string | number | boolean | null;
|
|
30
|
+
export declare function parseYamlMapping(text: string, start: number, end: number): YamlMap;
|
|
31
|
+
export declare function jsValue(node: YamlNode): unknown;
|
|
32
|
+
export declare function mapEntry(map: YamlMap, key: string): YamlEntry | undefined;
|
|
33
|
+
export declare function isPlainSafe(text: string): boolean;
|
|
34
|
+
export type FrontmatterValue = string | number | boolean | null | readonly FrontmatterValue[] | {
|
|
35
|
+
readonly [name: string]: FrontmatterValue;
|
|
36
|
+
};
|
|
37
|
+
export declare function plain(value: unknown): value is Record<string, unknown>;
|
|
38
|
+
export declare function frontmatterValue(value: unknown): value is FrontmatterValue;
|
|
39
|
+
export declare function serializeJs(value: FrontmatterValue): string;
|
|
40
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
41
|
+
export declare function serializeKey(name: string): string;
|
|
42
|
+
export declare function bodyStartAfterYaml(content: string, yamlEnd: number): number;
|
|
43
|
+
export declare function bodyStartOf(content: string): number;
|
|
44
|
+
export declare function bodyAfterFrontmatter(content: string): string;
|
|
45
|
+
export declare function extractFrontmatter(content: string): {
|
|
46
|
+
kind: 'none';
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'unclosed';
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'ok';
|
|
51
|
+
yamlStart: number;
|
|
52
|
+
yamlEnd: number;
|
|
53
|
+
};
|
|
54
|
+
export declare function equalValue(left: unknown, right: unknown): boolean;
|
|
55
|
+
export declare function lineEnding(content: string): '\n' | '\r\n';
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
import type { ModelResult } from './model.js';
|
|
2
|
+
import type { Open } from './open.js';
|
|
3
|
+
import type { ChangeBatch } from './change.js';
|
|
4
|
+
export type Authorization = object;
|
|
5
|
+
export type MdModelIdentity = {
|
|
6
|
+
identity: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
export type TypedSelection = {
|
|
10
|
+
roots: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
export type OperationScopes = {
|
|
13
|
+
write: readonly string[];
|
|
14
|
+
delete: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
export type ReplicaAdmission = {
|
|
17
|
+
selection: string;
|
|
18
|
+
admission: Open<'admitted' | 'unavailable'>;
|
|
19
|
+
offline: Open<'locked' | 'open'>;
|
|
20
|
+
};
|
|
21
|
+
export type DiscoveredRoom = {
|
|
22
|
+
name: string;
|
|
23
|
+
locator: string;
|
|
24
|
+
handle: string;
|
|
25
|
+
roomVersion: string;
|
|
26
|
+
operations: OperationScopes;
|
|
27
|
+
replica: ReplicaAdmission;
|
|
28
|
+
typedSelection?: TypedSelection;
|
|
29
|
+
providerOwnedPaths: readonly string[];
|
|
30
|
+
};
|
|
31
|
+
export type Capability = {
|
|
32
|
+
name: string;
|
|
33
|
+
limits?: readonly ProviderLimit[];
|
|
34
|
+
actions?: readonly ActionDeclaration[];
|
|
35
|
+
};
|
|
36
|
+
export type ListedConversation = {
|
|
37
|
+
conversation: string;
|
|
38
|
+
agent: string;
|
|
39
|
+
agentName: string;
|
|
40
|
+
agentRetired: boolean;
|
|
41
|
+
name: string;
|
|
42
|
+
created: string;
|
|
43
|
+
finished: string | null;
|
|
44
|
+
outcome: string | null;
|
|
45
|
+
waiting: boolean;
|
|
46
|
+
newest: string | null;
|
|
47
|
+
};
|
|
48
|
+
export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
|
|
49
|
+
export type ConversationMessage = {
|
|
50
|
+
identity: string;
|
|
51
|
+
turn: string;
|
|
52
|
+
text: string;
|
|
53
|
+
message: unknown;
|
|
54
|
+
};
|
|
55
|
+
export type AcceptedMessage = ConversationMessage & {
|
|
56
|
+
position: string;
|
|
57
|
+
};
|
|
58
|
+
export type ConversationHistoryRequest = {
|
|
59
|
+
conversations: readonly {
|
|
60
|
+
conversation: string;
|
|
61
|
+
after?: string;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
export type ConversationHistoryPage = {
|
|
65
|
+
conversation: string;
|
|
66
|
+
messages: readonly AcceptedMessage[];
|
|
67
|
+
next?: string;
|
|
68
|
+
};
|
|
69
|
+
export type ConversationHistories = {
|
|
70
|
+
histories: readonly ConversationHistoryPage[];
|
|
71
|
+
};
|
|
72
|
+
export type TurnContext = {
|
|
73
|
+
used: number;
|
|
74
|
+
window: number;
|
|
75
|
+
};
|
|
76
|
+
export type TurnOperation = {
|
|
77
|
+
op: 'begin';
|
|
78
|
+
at: string;
|
|
79
|
+
} | {
|
|
80
|
+
op: 'start';
|
|
81
|
+
index: number;
|
|
82
|
+
part: unknown;
|
|
83
|
+
} | {
|
|
84
|
+
op: 'append';
|
|
85
|
+
index: number;
|
|
86
|
+
text: string;
|
|
87
|
+
} | {
|
|
88
|
+
op: 'status';
|
|
89
|
+
index: number;
|
|
90
|
+
status: string;
|
|
91
|
+
result: unknown;
|
|
92
|
+
} | {
|
|
93
|
+
op: 'count';
|
|
94
|
+
index: number;
|
|
95
|
+
count: number;
|
|
96
|
+
} | {
|
|
97
|
+
op: 'plan';
|
|
98
|
+
index: number;
|
|
99
|
+
entries: readonly unknown[];
|
|
100
|
+
} | ({
|
|
101
|
+
op: 'context';
|
|
102
|
+
} & TurnContext);
|
|
103
|
+
export type ProcessCommand = {
|
|
104
|
+
[field: string]: unknown;
|
|
105
|
+
name: string;
|
|
106
|
+
description: string;
|
|
107
|
+
input?: {
|
|
108
|
+
[field: string]: unknown;
|
|
109
|
+
hint: string;
|
|
110
|
+
} | null;
|
|
111
|
+
};
|
|
112
|
+
type SelectValue = {
|
|
113
|
+
[field: string]: unknown;
|
|
114
|
+
value: string;
|
|
115
|
+
name: string;
|
|
116
|
+
description?: string | null;
|
|
117
|
+
};
|
|
118
|
+
type SelectGroup = {
|
|
119
|
+
[field: string]: unknown;
|
|
120
|
+
group: string;
|
|
121
|
+
name: string;
|
|
122
|
+
options: readonly SelectValue[];
|
|
123
|
+
};
|
|
124
|
+
type SessionOptionNaming = {
|
|
125
|
+
[field: string]: unknown;
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
description?: string | null;
|
|
129
|
+
category?: string | null;
|
|
130
|
+
};
|
|
131
|
+
export type SessionOption = (SessionOptionNaming & {
|
|
132
|
+
type: 'select';
|
|
133
|
+
currentValue: string;
|
|
134
|
+
options: readonly SelectValue[] | readonly SelectGroup[];
|
|
135
|
+
}) | (SessionOptionNaming & {
|
|
136
|
+
type: 'boolean';
|
|
137
|
+
currentValue: boolean;
|
|
138
|
+
});
|
|
139
|
+
export type ConversationEvent = {
|
|
140
|
+
kind: 'turn';
|
|
141
|
+
conversation: string;
|
|
142
|
+
turn: string;
|
|
143
|
+
operation: TurnOperation;
|
|
144
|
+
} | {
|
|
145
|
+
kind: 'questions';
|
|
146
|
+
conversation: string;
|
|
147
|
+
questions: readonly unknown[];
|
|
148
|
+
} | {
|
|
149
|
+
kind: 'process';
|
|
150
|
+
conversation: string;
|
|
151
|
+
running: boolean;
|
|
152
|
+
} | {
|
|
153
|
+
kind: 'commands';
|
|
154
|
+
conversation: string;
|
|
155
|
+
commands: readonly ProcessCommand[];
|
|
156
|
+
} | {
|
|
157
|
+
kind: 'options';
|
|
158
|
+
conversation: string;
|
|
159
|
+
options: readonly SessionOption[];
|
|
160
|
+
} | {
|
|
161
|
+
kind: 'starting';
|
|
162
|
+
conversation: string;
|
|
163
|
+
step: string | null;
|
|
164
|
+
} | {
|
|
165
|
+
kind: 'link';
|
|
166
|
+
conversation: string;
|
|
167
|
+
connected: boolean;
|
|
168
|
+
} | {
|
|
169
|
+
kind: 'deliveries';
|
|
170
|
+
conversation: string;
|
|
171
|
+
unknown: readonly string[];
|
|
172
|
+
} | {
|
|
173
|
+
kind: 'accepted-message';
|
|
174
|
+
conversation: string;
|
|
175
|
+
message: AcceptedMessage;
|
|
176
|
+
} | {
|
|
177
|
+
kind: 'gap';
|
|
178
|
+
conversation: string;
|
|
179
|
+
} | {
|
|
180
|
+
kind: 'list';
|
|
181
|
+
entries: readonly ListedConversation[];
|
|
182
|
+
} | {
|
|
183
|
+
kind: 'listed';
|
|
184
|
+
entry: ListedConversation;
|
|
185
|
+
} | {
|
|
186
|
+
kind: 'unlisted';
|
|
187
|
+
conversation: string;
|
|
188
|
+
};
|
|
189
|
+
export type ListedAgent = {
|
|
190
|
+
agent: string;
|
|
191
|
+
name: string;
|
|
192
|
+
retired: boolean;
|
|
193
|
+
};
|
|
194
|
+
export type ConversationStream = {
|
|
195
|
+
replicate(conversations: readonly string[]): void;
|
|
196
|
+
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
197
|
+
agents?(): Promise<readonly ListedAgent[] | null>;
|
|
198
|
+
};
|
|
199
|
+
export type ActionDeclaration = {
|
|
200
|
+
name: string;
|
|
201
|
+
inputShape: unknown;
|
|
202
|
+
resultKind: unknown;
|
|
203
|
+
room?: string;
|
|
204
|
+
};
|
|
205
|
+
export type ProviderLimit = {
|
|
206
|
+
name: string;
|
|
207
|
+
value?: number | string;
|
|
208
|
+
};
|
|
209
|
+
export type HistoryRetention = {
|
|
210
|
+
kind: 'duration';
|
|
211
|
+
seconds: number;
|
|
212
|
+
} | {
|
|
213
|
+
kind: 'no-declared-time-bound';
|
|
214
|
+
};
|
|
215
|
+
export type Retention = {
|
|
216
|
+
history: HistoryRetention;
|
|
217
|
+
outcome: number;
|
|
218
|
+
refreshHorizon: number;
|
|
219
|
+
};
|
|
220
|
+
export type Discovery = {
|
|
221
|
+
kind: 'discovery';
|
|
222
|
+
rooms: readonly DiscoveredRoom[];
|
|
223
|
+
capabilities: readonly Capability[];
|
|
224
|
+
providerLimits: readonly ProviderLimit[];
|
|
225
|
+
retention: Retention;
|
|
226
|
+
member?: Member;
|
|
227
|
+
};
|
|
228
|
+
export type TransportUncertainty = {
|
|
229
|
+
kind: 'transport-uncertainty';
|
|
230
|
+
};
|
|
231
|
+
export type RoomNotReadable = {
|
|
232
|
+
kind: 'room-not-readable';
|
|
233
|
+
locator: string;
|
|
234
|
+
};
|
|
235
|
+
export type RevokedAuthorization = {
|
|
236
|
+
kind: 'revoked-authorization';
|
|
237
|
+
};
|
|
238
|
+
export type ProviderRefusal = {
|
|
239
|
+
code: string;
|
|
240
|
+
fields: Readonly<Record<string, unknown>>;
|
|
241
|
+
retryable: boolean;
|
|
242
|
+
};
|
|
243
|
+
export type ScopedRefusal = ProviderRefusal & {
|
|
244
|
+
kind: 'scoped-refusal';
|
|
245
|
+
locator: string;
|
|
246
|
+
scope: Open<'content' | 'model' | 'operation' | 'undisclosed'>;
|
|
247
|
+
};
|
|
248
|
+
export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
|
|
249
|
+
export type ContractUnavailable = ProviderRefusal & {
|
|
250
|
+
kind: 'contract-unavailable';
|
|
251
|
+
};
|
|
252
|
+
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
253
|
+
export type PageToken = string;
|
|
254
|
+
export type ChangeAuthor = {
|
|
255
|
+
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
256
|
+
id: string;
|
|
257
|
+
name: string;
|
|
258
|
+
};
|
|
259
|
+
export type Member = {
|
|
260
|
+
kind: Open<'user'>;
|
|
261
|
+
id: string;
|
|
262
|
+
name: string;
|
|
263
|
+
};
|
|
264
|
+
export type HeadChange = {
|
|
265
|
+
author: ChangeAuthor | null;
|
|
266
|
+
time: string;
|
|
267
|
+
};
|
|
268
|
+
export type BinaryFile = {
|
|
269
|
+
byteLength: number;
|
|
270
|
+
mediaType: string;
|
|
271
|
+
sha256: string;
|
|
272
|
+
};
|
|
273
|
+
export type HeldFile = {
|
|
274
|
+
readonly path: string;
|
|
275
|
+
readonly revision: string;
|
|
276
|
+
};
|
|
277
|
+
export type HeldContent = {
|
|
278
|
+
files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
|
|
279
|
+
contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
|
|
280
|
+
readonly content: string;
|
|
281
|
+
readonly revision: string;
|
|
282
|
+
}>>;
|
|
283
|
+
};
|
|
284
|
+
export type BootstrapRequest = {
|
|
285
|
+
locator: string;
|
|
286
|
+
selection: string;
|
|
287
|
+
pageToken?: PageToken;
|
|
288
|
+
held?: HeldContent;
|
|
289
|
+
arriving?: (bytes: number) => void;
|
|
290
|
+
signal?: AbortSignal;
|
|
291
|
+
};
|
|
292
|
+
export type BootstrapInventory = {
|
|
293
|
+
readonly bytes: number;
|
|
294
|
+
};
|
|
295
|
+
export type RoomModels = {
|
|
296
|
+
collection?: ModelResult;
|
|
297
|
+
};
|
|
298
|
+
export type BootstrapPage = {
|
|
299
|
+
kind: 'bootstrap';
|
|
300
|
+
roomVersion: string;
|
|
301
|
+
models?: RoomModels;
|
|
302
|
+
documents: Readonly<Record<string, string>>;
|
|
303
|
+
revisions: Readonly<Record<string, string>>;
|
|
304
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
305
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
306
|
+
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
307
|
+
folders?: readonly string[];
|
|
308
|
+
pageToken?: PageToken;
|
|
309
|
+
bytes?: number;
|
|
310
|
+
};
|
|
311
|
+
export type BootstrapResult = BootstrapPage | {
|
|
312
|
+
kind: 'beyond-horizon';
|
|
313
|
+
} | AdapterFailure;
|
|
314
|
+
export type RefreshRequest = {
|
|
315
|
+
locator: string;
|
|
316
|
+
selection: string;
|
|
317
|
+
fromRoomVersion: string;
|
|
318
|
+
pageToken?: PageToken;
|
|
319
|
+
};
|
|
320
|
+
export type RefreshPage = {
|
|
321
|
+
kind: 'net-advancement';
|
|
322
|
+
roomVersion: string;
|
|
323
|
+
models?: RoomModels;
|
|
324
|
+
documents: Readonly<Record<string, string>>;
|
|
325
|
+
revisions: Readonly<Record<string, string>>;
|
|
326
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
327
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
328
|
+
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
329
|
+
removals: readonly string[];
|
|
330
|
+
folders?: readonly string[];
|
|
331
|
+
folderRemovals?: readonly string[];
|
|
332
|
+
pageToken?: PageToken;
|
|
333
|
+
};
|
|
334
|
+
export type RefreshResult = {
|
|
335
|
+
kind: 'still-current';
|
|
336
|
+
} | RefreshPage | {
|
|
337
|
+
kind: 'beyond-horizon';
|
|
338
|
+
} | RetryableRefusal | AdapterFailure;
|
|
339
|
+
export type MutationRequest = {
|
|
340
|
+
locator: string;
|
|
341
|
+
changeBatch: ChangeBatch;
|
|
342
|
+
file(localId: string): Promise<Blob>;
|
|
343
|
+
upload?: unknown;
|
|
344
|
+
};
|
|
345
|
+
export type RetryableRefusal = ProviderRefusal & {
|
|
346
|
+
kind: 'retryable-refusal';
|
|
347
|
+
reset?: string;
|
|
348
|
+
};
|
|
349
|
+
export type ServiceMode = Open<'open' | 'write-halted'>;
|
|
350
|
+
export type ServiceModeSignal = {
|
|
351
|
+
observe(notify: (mode: ServiceMode) => void): () => void;
|
|
352
|
+
};
|
|
353
|
+
export type AcceptedRoom = {
|
|
354
|
+
roomVersion: string;
|
|
355
|
+
documents: Readonly<Record<string, string>>;
|
|
356
|
+
revisions: Readonly<Record<string, string>>;
|
|
357
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
358
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
359
|
+
removals: readonly string[];
|
|
360
|
+
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
361
|
+
};
|
|
362
|
+
export type MutationResult = (AcceptedRoom & {
|
|
363
|
+
kind: 'accepted';
|
|
364
|
+
author?: string;
|
|
365
|
+
time?: string;
|
|
366
|
+
destination?: AcceptedRoom;
|
|
367
|
+
}) | (ProviderRefusal & {
|
|
368
|
+
kind: 'conflicted';
|
|
369
|
+
roomVersion?: string;
|
|
370
|
+
affected: Readonly<Record<string, string>>;
|
|
371
|
+
}) | (ProviderRefusal & {
|
|
372
|
+
kind: 'rejected';
|
|
373
|
+
affected: Readonly<Record<string, string>>;
|
|
374
|
+
}) | RetryableRefusal | {
|
|
375
|
+
kind: 'write-halted';
|
|
376
|
+
} | {
|
|
377
|
+
kind: 'expired';
|
|
378
|
+
restored?: true;
|
|
379
|
+
} | AdapterFailure;
|
|
380
|
+
export type HistoryAuthor = {
|
|
381
|
+
kind: 'user';
|
|
382
|
+
id: string;
|
|
383
|
+
} | {
|
|
384
|
+
kind: 'site' | 'inbox' | 'app';
|
|
385
|
+
id: string;
|
|
386
|
+
name: string;
|
|
387
|
+
};
|
|
388
|
+
export type HistoryRevision = {
|
|
389
|
+
revision: string;
|
|
390
|
+
author: HistoryAuthor;
|
|
391
|
+
time: string;
|
|
392
|
+
binaryFile?: BinaryFile;
|
|
393
|
+
};
|
|
394
|
+
export type HistoryRequest = {
|
|
395
|
+
locator: string;
|
|
396
|
+
path: string;
|
|
397
|
+
revision?: string;
|
|
398
|
+
pageToken?: PageToken;
|
|
399
|
+
};
|
|
400
|
+
export type HistoryResult = {
|
|
401
|
+
kind: 'history';
|
|
402
|
+
revisions: readonly HistoryRevision[];
|
|
403
|
+
pageToken?: PageToken;
|
|
404
|
+
deleted?: true;
|
|
405
|
+
} | {
|
|
406
|
+
kind: 'revision';
|
|
407
|
+
content: string;
|
|
408
|
+
} | {
|
|
409
|
+
kind: 'no-history';
|
|
410
|
+
} | AdapterFailure;
|
|
411
|
+
export type BinaryRequest = {
|
|
412
|
+
kind: 'path';
|
|
413
|
+
locator: string;
|
|
414
|
+
path: string;
|
|
415
|
+
revision: string;
|
|
416
|
+
};
|
|
417
|
+
export type BinaryResult = {
|
|
418
|
+
kind: 'binary';
|
|
419
|
+
body: ReadableStream<Uint8Array>;
|
|
420
|
+
mediaType: string;
|
|
421
|
+
sha256?: string;
|
|
422
|
+
} | (ProviderRefusal & {
|
|
423
|
+
kind: 'rejected';
|
|
424
|
+
}) | AdapterFailure;
|
|
425
|
+
export type BinaryLinkResult = {
|
|
426
|
+
kind: 'link';
|
|
427
|
+
url: string;
|
|
428
|
+
name: string;
|
|
429
|
+
mediaType?: string;
|
|
430
|
+
} | (ProviderRefusal & {
|
|
431
|
+
kind: 'rejected';
|
|
432
|
+
}) | AdapterFailure;
|
|
433
|
+
export type AttachRequest = {
|
|
434
|
+
locator: string;
|
|
435
|
+
name: string;
|
|
436
|
+
mediaType: string;
|
|
437
|
+
byteLength: number;
|
|
438
|
+
sha256: string;
|
|
439
|
+
blob: Blob;
|
|
440
|
+
};
|
|
441
|
+
export type AttachResult = {
|
|
442
|
+
kind: 'attached';
|
|
443
|
+
path: string;
|
|
444
|
+
revision: string;
|
|
445
|
+
} | (ProviderRefusal & {
|
|
446
|
+
kind: 'rejected';
|
|
447
|
+
}) | AdapterFailure;
|
|
448
|
+
export type ActionRequest = {
|
|
449
|
+
name: string;
|
|
450
|
+
input: unknown;
|
|
451
|
+
};
|
|
452
|
+
export type RoomVersionAt = {
|
|
453
|
+
locator: string;
|
|
454
|
+
roomVersion: string;
|
|
455
|
+
};
|
|
456
|
+
export type ActionResult = {
|
|
457
|
+
kind: 'action';
|
|
458
|
+
result: unknown;
|
|
459
|
+
at?: RoomVersionAt;
|
|
460
|
+
} | (ProviderRefusal & {
|
|
461
|
+
kind: 'rejected';
|
|
462
|
+
}) | AdapterFailure;
|
|
463
|
+
export type HeldRoom = {
|
|
464
|
+
locator: string;
|
|
465
|
+
roomVersion: string;
|
|
466
|
+
};
|
|
467
|
+
export type RoomChange = {
|
|
468
|
+
kind: 'room-change';
|
|
469
|
+
locator: string;
|
|
470
|
+
from: string;
|
|
471
|
+
roomVersion: string;
|
|
472
|
+
read(): Promise<RefreshPage>;
|
|
473
|
+
};
|
|
474
|
+
export type AuthorityChange = {
|
|
475
|
+
kind: 'authority-changed';
|
|
476
|
+
rooms: readonly DiscoveredRoom[];
|
|
477
|
+
left: readonly string[];
|
|
478
|
+
member?: Member;
|
|
479
|
+
};
|
|
480
|
+
export type RoomStreamEvent = {
|
|
481
|
+
kind: 'opened';
|
|
482
|
+
} | {
|
|
483
|
+
kind: 'discovered';
|
|
484
|
+
discovery: Discovery;
|
|
485
|
+
} | {
|
|
486
|
+
kind: 'closed';
|
|
487
|
+
revoked: boolean;
|
|
488
|
+
lost: boolean;
|
|
489
|
+
} | {
|
|
490
|
+
kind: 'caught-up';
|
|
491
|
+
expired: readonly string[];
|
|
492
|
+
} | AuthorityChange | RoomChange;
|
|
493
|
+
export type RoomStream = {
|
|
494
|
+
hold(rooms: readonly HeldRoom[]): void;
|
|
495
|
+
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
496
|
+
};
|
|
497
|
+
export type Adapter = {
|
|
498
|
+
readonly localSaves?: true;
|
|
499
|
+
readonly roomTypes?: string;
|
|
500
|
+
readonly nameableRoomTypes?: readonly string[];
|
|
501
|
+
authorize(): Promise<Authorization>;
|
|
502
|
+
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
503
|
+
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
504
|
+
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
505
|
+
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
506
|
+
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
507
|
+
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
508
|
+
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
509
|
+
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
510
|
+
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
511
|
+
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
512
|
+
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
513
|
+
roomStream?: RoomStream;
|
|
514
|
+
conversations?: ConversationStream;
|
|
515
|
+
serviceMode?: ServiceModeSignal;
|
|
516
|
+
};
|
|
517
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HeldBinary } from './overlay.js';
|
|
2
|
+
export type BinaryFileRecord = {
|
|
3
|
+
readonly state: 'accepted';
|
|
4
|
+
readonly revision: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly byteLength: number;
|
|
7
|
+
readonly mediaType: string;
|
|
8
|
+
readonly sha256: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly state: 'pending';
|
|
11
|
+
readonly localId: string;
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly byteLength: number;
|
|
14
|
+
readonly mediaType: string;
|
|
15
|
+
readonly sha256: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function binaryRecord(path: string, held: HeldBinary, revision: string | undefined): BinaryFileRecord;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MdRuntimeClient } from './client.js';
|
|
2
|
+
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
|
|
3
|
+
type Rows = DocumentResult | GroupResult;
|
|
4
|
+
export type WindowAnswer = Rows | PendingResult;
|
|
5
|
+
export type WindowChain = {
|
|
6
|
+
want(count: number): void;
|
|
7
|
+
close(): void;
|
|
8
|
+
};
|
|
9
|
+
export declare function chainedWindows(runtime: MdRuntimeClient, query: DocumentQuery | GroupQuery, count: number, publish: (answers: readonly (WindowAnswer | null)[], settled: boolean) => void): WindowChain;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type DocumentChange = {
|
|
2
|
+
readonly locator: string;
|
|
3
|
+
readonly path: string | null;
|
|
4
|
+
};
|
|
5
|
+
export type ChangeSet = {
|
|
6
|
+
documents: readonly DocumentChange[];
|
|
7
|
+
drafts: readonly {
|
|
8
|
+
locator: string;
|
|
9
|
+
path: string;
|
|
10
|
+
}[];
|
|
11
|
+
rooms: readonly string[];
|
|
12
|
+
queues: readonly string[];
|
|
13
|
+
presentations: readonly string[];
|
|
14
|
+
conversations: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
type Changed = {
|
|
17
|
+
documents?: readonly string[] | null;
|
|
18
|
+
drafts?: readonly string[];
|
|
19
|
+
room?: boolean;
|
|
20
|
+
queue?: boolean;
|
|
21
|
+
presentation?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
|
|
24
|
+
export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
|
|
25
|
+
export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
|
|
26
|
+
export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
|
|
27
|
+
export {};
|