@agentshouse/app-bridge 0.1.0-c895bda3a3f6a → 0.1.0-c8a196c36dc76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/index.d.ts +247 -407
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/built-in.d.ts +3 -0
- package/dist/mdmodel/definition.d.ts +24 -11
- package/dist/mdmodel/document.d.ts +14 -9
- package/dist/mdmodel/event.d.ts +76 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/fields.d.ts +1 -1
- package/dist/mdmodel/house-model.d.ts +869 -0
- package/dist/mdmodel/house-references/crockford.d.ts +3 -0
- package/dist/mdmodel/house-references/patterns.d.ts +8 -0
- package/dist/mdmodel/index.d.ts +44 -15
- package/dist/mdmodel/indexed.d.ts +8 -0
- package/dist/mdmodel/kinds.d.ts +20 -0
- package/dist/mdmodel/markdown.d.ts +74 -0
- package/dist/mdmodel/media-type.d.ts +71 -0
- package/dist/mdmodel/moment.d.ts +6 -0
- package/dist/mdmodel/not-ready.d.ts +1 -0
- package/dist/mdmodel/paths.d.ts +15 -1
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/query/language.d.ts +254 -0
- package/dist/mdmodel/query/match.d.ts +13 -0
- package/dist/mdmodel/query/rows.d.ts +31 -0
- package/dist/mdmodel/query/sql.d.ts +42 -0
- package/dist/mdmodel/query/walk.d.ts +62 -0
- package/dist/mdmodel/references.d.ts +2 -2
- package/dist/mdmodel/reserved.d.ts +5 -0
- package/dist/mdmodel/room-types.d.ts +6 -0
- package/dist/mdmodel/types.d.ts +22 -22
- package/dist/mdmodel/validate.d.ts +12 -6
- package/dist/mdmodel/yaml.d.ts +4 -4
- package/dist/mdruntime/actions.d.ts +25 -0
- package/dist/mdruntime/adapter.d.ts +161 -81
- package/dist/mdruntime/attached-model.d.ts +6 -0
- package/dist/mdruntime/authored.d.ts +87 -0
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/change-set.d.ts +4 -0
- package/dist/mdruntime/change.d.ts +5 -0
- package/dist/mdruntime/client.d.ts +36 -23
- package/dist/mdruntime/collection.d.ts +27 -4
- package/dist/mdruntime/compile.d.ts +9 -7
- package/dist/mdruntime/conversation-live.d.ts +151 -0
- package/dist/mdruntime/conversation-row.d.ts +39 -0
- package/dist/mdruntime/conversation.d.ts +67 -46
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +20 -0
- package/dist/mdruntime/failure.d.ts +3 -0
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/house-query.d.ts +14 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/install.d.ts +59 -0
- package/dist/mdruntime/listing.d.ts +59 -0
- package/dist/mdruntime/live.d.ts +24 -0
- package/dist/mdruntime/media.d.ts +19 -2
- package/dist/mdruntime/messages.d.ts +35 -5
- package/dist/mdruntime/modal.d.ts +1 -0
- package/dist/mdruntime/model.d.ts +6 -12
- package/dist/mdruntime/observation.d.ts +30 -13
- package/dist/mdruntime/opened.d.ts +1 -1
- package/dist/mdruntime/outcome.d.ts +17 -2
- package/dist/mdruntime/overlay.d.ts +7 -2
- package/dist/mdruntime/preparation.d.ts +45 -0
- package/dist/mdruntime/presence.d.ts +57 -0
- package/dist/mdruntime/query.d.ts +13 -211
- package/dist/mdruntime/reach.d.ts +25 -14
- package/dist/mdruntime/readiness.d.ts +20 -7
- package/dist/mdruntime/reads.d.ts +38 -0
- package/dist/mdruntime/recovery.d.ts +4 -1
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +11 -16
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +33 -9
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +34 -0
- package/dist/mdruntime/save.d.ts +42 -86
- package/dist/mdruntime/saves.d.ts +33 -0
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/seed.d.ts +11 -2
- package/dist/mdruntime/socket/admission.d.ts +6 -0
- package/dist/mdruntime/socket/answers.d.ts +5 -0
- package/dist/mdruntime/socket/lanes.d.ts +27 -0
- package/dist/mdruntime/socket/session.d.ts +40 -0
- package/dist/mdruntime/socket.d.ts +67 -0
- package/dist/mdruntime/source.d.ts +58 -0
- package/dist/mdruntime/status.d.ts +0 -2
- package/dist/mdruntime/store/installs.d.ts +29 -0
- package/dist/mdruntime/store/readiness.d.ts +10 -0
- package/dist/mdruntime/store/records.d.ts +226 -0
- package/dist/mdruntime/store/room-held.d.ts +7 -0
- package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
- package/dist/mdruntime/store/space.d.ts +10 -0
- package/dist/mdruntime/store/watchers.d.ts +16 -0
- package/dist/mdruntime/store/writes.d.ts +23 -0
- package/dist/mdruntime/store.d.ts +116 -154
- package/dist/mdruntime/stored.d.ts +80 -69
- package/dist/mdruntime/surface.d.ts +93 -0
- package/dist/mdruntime/tables.d.ts +118 -93
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +4 -0
- package/dist/mdruntime/wire.d.ts +81 -7
- package/dist/session-content/check.d.ts +17 -0
- package/dist/session-content/index.d.ts +6 -0
- package/dist/session-content/parts.d.ts +30 -0
- package/dist/session-content/state.d.ts +59 -0
- package/dist/session-content/turn.d.ts +137 -0
- package/dist/test-host.d.ts +8 -1
- package/dist/test-host.js +45 -2
- package/docs/families.md +78 -39
- package/package.json +2 -2
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -180
- package/dist/mdmodel/links.d.ts +0 -28
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/connection.d.ts +0 -153
- package/dist/mdruntime/fulltext.d.ts +0 -26
|
@@ -1,93 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type HeldRooms, type QueryPlan } from '../mdmodel/index.js';
|
|
2
2
|
import type { HeadChange } from './adapter.js';
|
|
3
3
|
import type { BinaryFileRecord } from './binary.js';
|
|
4
4
|
import type { Open } from './open.js';
|
|
5
|
-
export type Value = string | number | boolean | null;
|
|
6
|
-
export type Predicate = Value | {
|
|
7
|
-
$eq: Value;
|
|
8
|
-
} | {
|
|
9
|
-
$ne: Value;
|
|
10
|
-
} | {
|
|
11
|
-
$in: readonly Value[];
|
|
12
|
-
} | {
|
|
13
|
-
$nin: readonly Value[];
|
|
14
|
-
} | {
|
|
15
|
-
$gt?: Value;
|
|
16
|
-
$gte?: Value;
|
|
17
|
-
$lt?: Value;
|
|
18
|
-
$lte?: Value;
|
|
19
|
-
} | {
|
|
20
|
-
$all: readonly Value[];
|
|
21
|
-
} | {
|
|
22
|
-
$size: number;
|
|
23
|
-
} | {
|
|
24
|
-
$exists: boolean;
|
|
25
|
-
};
|
|
26
|
-
export type Where = {
|
|
27
|
-
$and?: readonly Where[];
|
|
28
|
-
$or?: readonly Where[];
|
|
29
|
-
[field: string]: Predicate | readonly Where[] | undefined;
|
|
30
|
-
};
|
|
31
|
-
export type Related = {
|
|
32
|
-
types?: readonly string[];
|
|
33
|
-
where?: Where;
|
|
34
|
-
pathPrefix?: string;
|
|
35
|
-
};
|
|
36
|
-
export type Filter = {
|
|
37
|
-
rooms?: readonly string[];
|
|
38
|
-
types?: readonly string[];
|
|
39
|
-
where?: Where;
|
|
40
|
-
pathPrefix?: string;
|
|
41
|
-
folder?: string;
|
|
42
|
-
paths?: readonly string[];
|
|
43
|
-
hop?: Related & {
|
|
44
|
-
field: string;
|
|
45
|
-
};
|
|
46
|
-
backlinks?: Related & {
|
|
47
|
-
field?: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export type Key = 'room' | 'path' | 'type' | 'folder' | {
|
|
51
|
-
field: string;
|
|
52
|
-
};
|
|
53
|
-
export type Select = 'all' | {
|
|
54
|
-
fields?: 'all' | readonly string[];
|
|
55
|
-
sections?: 'all' | readonly string[];
|
|
56
|
-
preamble?: true;
|
|
57
|
-
markdown?: true;
|
|
58
|
-
backlinks?: true;
|
|
59
|
-
change?: true;
|
|
60
|
-
fileId?: true;
|
|
61
|
-
revision?: true;
|
|
62
|
-
};
|
|
63
|
-
export type OrderOptions = {
|
|
64
|
-
nulls?: 'first' | 'last';
|
|
65
|
-
stringSort?: 'lexical' | 'locale';
|
|
66
|
-
locale?: string;
|
|
67
|
-
localeOptions?: Readonly<Record<string, unknown>>;
|
|
68
|
-
};
|
|
69
|
-
export type Direction = 'asc' | 'desc';
|
|
70
|
-
export type DocumentQuery = Filter & {
|
|
71
|
-
select: Select;
|
|
72
|
-
orderBy?: readonly ({
|
|
73
|
-
by: Key;
|
|
74
|
-
direction?: Direction;
|
|
75
|
-
} & OrderOptions)[];
|
|
76
|
-
limit?: number;
|
|
77
|
-
after?: string;
|
|
78
|
-
total?: true;
|
|
79
|
-
};
|
|
80
|
-
export type GroupQuery = Filter & {
|
|
81
|
-
groupBy: readonly Exclude<Key, 'path'>[];
|
|
82
|
-
orderBy?: readonly {
|
|
83
|
-
by: 'count' | Exclude<Key, 'path'>;
|
|
84
|
-
direction?: Direction;
|
|
85
|
-
}[];
|
|
86
|
-
limit?: number;
|
|
87
|
-
after?: string;
|
|
88
|
-
total?: true;
|
|
89
|
-
};
|
|
90
|
-
export type LocalQuery = DocumentQuery | GroupQuery;
|
|
91
5
|
export type Backlink = {
|
|
92
6
|
path: string;
|
|
93
7
|
type: string;
|
|
@@ -101,16 +15,25 @@ export type QueryDocument = {
|
|
|
101
15
|
sections?: Readonly<Record<string, string>>;
|
|
102
16
|
preamble?: string;
|
|
103
17
|
markdown?: string;
|
|
104
|
-
textHeld?: false;
|
|
105
18
|
backlinks?: readonly Backlink[];
|
|
106
19
|
change?: HeadChange | null;
|
|
107
20
|
fileId?: string | null;
|
|
108
21
|
revision?: string | null;
|
|
109
22
|
binaryFile?: BinaryFileRecord;
|
|
23
|
+
size?: number | null;
|
|
24
|
+
created?: string | null;
|
|
25
|
+
};
|
|
26
|
+
export type GroupTotal = {
|
|
27
|
+
count: number;
|
|
28
|
+
size: number;
|
|
110
29
|
};
|
|
111
30
|
export type QueryGroup = {
|
|
112
31
|
key: readonly unknown[];
|
|
113
32
|
count: number;
|
|
33
|
+
documents?: GroupTotal;
|
|
34
|
+
files?: GroupTotal;
|
|
35
|
+
updated?: string | null;
|
|
36
|
+
greatest?: unknown;
|
|
114
37
|
};
|
|
115
38
|
export type CoveredRoom = {
|
|
116
39
|
room: string;
|
|
@@ -119,7 +42,6 @@ export type CoveredRoom = {
|
|
|
119
42
|
};
|
|
120
43
|
export type QueryCoverage = {
|
|
121
44
|
rooms: readonly CoveredRoom[];
|
|
122
|
-
indexes: readonly string[];
|
|
123
45
|
overlay: readonly string[];
|
|
124
46
|
};
|
|
125
47
|
export type Awaits = Open<'acquisition' | 'preparation' | 'unlock'>;
|
|
@@ -148,92 +70,6 @@ export type GroupResult = GroupRows & {
|
|
|
148
70
|
coverage: QueryCoverage;
|
|
149
71
|
};
|
|
150
72
|
export type QueryResult = DocumentResult | GroupResult | PendingResult;
|
|
151
|
-
export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
|
|
152
|
-
export type RoomFacts = {
|
|
153
|
-
locator: string;
|
|
154
|
-
available: boolean;
|
|
155
|
-
types: readonly Definition[];
|
|
156
|
-
};
|
|
157
|
-
export type HeldRooms = {
|
|
158
|
-
listed: boolean;
|
|
159
|
-
rooms: readonly RoomFacts[];
|
|
160
|
-
};
|
|
161
|
-
export type Test = {
|
|
162
|
-
op: 'eq';
|
|
163
|
-
value: Value;
|
|
164
|
-
} | {
|
|
165
|
-
op: 'ne';
|
|
166
|
-
value: Value;
|
|
167
|
-
} | {
|
|
168
|
-
op: 'in';
|
|
169
|
-
values: readonly Value[];
|
|
170
|
-
} | {
|
|
171
|
-
op: 'nin';
|
|
172
|
-
values: readonly Value[];
|
|
173
|
-
} | {
|
|
174
|
-
op: 'range';
|
|
175
|
-
bounds: readonly (readonly ['gt' | 'gte' | 'lt' | 'lte', Value])[];
|
|
176
|
-
} | {
|
|
177
|
-
op: 'all';
|
|
178
|
-
values: readonly Value[];
|
|
179
|
-
} | {
|
|
180
|
-
op: 'size';
|
|
181
|
-
size: number;
|
|
182
|
-
} | {
|
|
183
|
-
op: 'exists';
|
|
184
|
-
exists: boolean;
|
|
185
|
-
};
|
|
186
|
-
export type Condition = {
|
|
187
|
-
every: readonly Condition[];
|
|
188
|
-
} | {
|
|
189
|
-
some: readonly Condition[];
|
|
190
|
-
} | {
|
|
191
|
-
field: string;
|
|
192
|
-
test: Test;
|
|
193
|
-
};
|
|
194
|
-
export type Scope = {
|
|
195
|
-
types: readonly string[] | null;
|
|
196
|
-
where: Condition | null;
|
|
197
|
-
pathPrefix: string | null;
|
|
198
|
-
};
|
|
199
|
-
export type KeyPlan = {
|
|
200
|
-
of: 'room';
|
|
201
|
-
} | {
|
|
202
|
-
of: 'path';
|
|
203
|
-
} | {
|
|
204
|
-
of: 'type';
|
|
205
|
-
} | {
|
|
206
|
-
of: 'folder';
|
|
207
|
-
} | {
|
|
208
|
-
of: 'field';
|
|
209
|
-
field: string;
|
|
210
|
-
};
|
|
211
|
-
export type DocumentShape = {
|
|
212
|
-
kind: 'documents';
|
|
213
|
-
fields: 'all' | readonly string[] | null;
|
|
214
|
-
sections: 'all' | readonly string[] | null;
|
|
215
|
-
preamble: boolean;
|
|
216
|
-
markdown: boolean;
|
|
217
|
-
backlinks: boolean;
|
|
218
|
-
change: boolean;
|
|
219
|
-
fileId: boolean;
|
|
220
|
-
revision: boolean;
|
|
221
|
-
orderBy: readonly {
|
|
222
|
-
key: KeyPlan;
|
|
223
|
-
options: OrderOptions & {
|
|
224
|
-
direction: Direction;
|
|
225
|
-
};
|
|
226
|
-
}[];
|
|
227
|
-
};
|
|
228
|
-
export declare function bodied(shape: DocumentShape): boolean;
|
|
229
|
-
export type GroupShape = {
|
|
230
|
-
kind: 'groups';
|
|
231
|
-
groupBy: readonly KeyPlan[];
|
|
232
|
-
orderBy: readonly {
|
|
233
|
-
by: 'count' | number;
|
|
234
|
-
direction: Direction;
|
|
235
|
-
}[];
|
|
236
|
-
};
|
|
237
73
|
export type PlanArea = {
|
|
238
74
|
room: string;
|
|
239
75
|
path: string;
|
|
@@ -244,42 +80,8 @@ export type PlanReach = {
|
|
|
244
80
|
documents: readonly string[];
|
|
245
81
|
areas: readonly PlanArea[];
|
|
246
82
|
};
|
|
247
|
-
export type
|
|
248
|
-
text: string;
|
|
249
|
-
values: readonly unknown[] | null;
|
|
250
|
-
};
|
|
251
|
-
export type Plan = {
|
|
252
|
-
key: string;
|
|
253
|
-
rooms: readonly string[] | null;
|
|
83
|
+
export type Plan = QueryPlan & {
|
|
254
84
|
reach: PlanReach | null;
|
|
255
85
|
locked: readonly string[];
|
|
256
|
-
root: Scope;
|
|
257
|
-
folder: string | null;
|
|
258
|
-
paths: readonly string[] | null;
|
|
259
|
-
hop: (Scope & {
|
|
260
|
-
field: string;
|
|
261
|
-
}) | null;
|
|
262
|
-
backlinks: (Scope & {
|
|
263
|
-
field: string | null;
|
|
264
|
-
}) | null;
|
|
265
|
-
shape: DocumentShape | GroupShape;
|
|
266
|
-
limit: number | null;
|
|
267
|
-
after: Continuation | null;
|
|
268
|
-
total: boolean;
|
|
269
86
|
};
|
|
270
|
-
export declare
|
|
271
|
-
readonly code: QueryErrorCode;
|
|
272
|
-
readonly retryable = false;
|
|
273
|
-
constructor(code: QueryErrorCode, at: string, problem: string);
|
|
274
|
-
}
|
|
275
|
-
type Entries = Readonly<Record<string, unknown>>;
|
|
276
|
-
export declare function invalid(at: string, problem: string): never;
|
|
277
|
-
export declare function plain(value: unknown): value is Entries;
|
|
278
|
-
export declare function known(value: Entries, allowed: readonly string[], at: string): void;
|
|
279
|
-
export declare function flag(input: unknown, at: string): boolean;
|
|
280
|
-
export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
281
|
-
export declare function limitOf(input: unknown): number | null;
|
|
282
|
-
export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
283
|
-
export declare function queryKey(query: unknown): string;
|
|
284
|
-
export declare function identityOf(plan: Plan): string;
|
|
285
|
-
export {};
|
|
87
|
+
export declare function planWithin(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ListedRoom } from './listing.js';
|
|
2
|
+
import type { ReadinessMessage, ReadinessPort } from './preparation.js';
|
|
3
|
+
import { type CodeAvailability } from './readiness.js';
|
|
4
|
+
import type { MdRuntime, RuntimeTopic } from './surface.js';
|
|
5
|
+
import type { QueriedRoom } from './adapter.js';
|
|
2
6
|
import type { Plan, PlanReach, QueryResult } from './query.js';
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
7
|
+
import type { SearchResult } from './search.js';
|
|
8
|
+
import type { HouseQueryResult } from './house-query.js';
|
|
5
9
|
export type ReachedDocument = {
|
|
6
10
|
readonly room: string;
|
|
7
11
|
readonly path: string;
|
|
@@ -15,30 +19,37 @@ export type PortReach = {
|
|
|
15
19
|
readonly rooms: readonly string[];
|
|
16
20
|
readonly documents: readonly ReachedDocument[];
|
|
17
21
|
readonly areas?: readonly ReachedArea[];
|
|
22
|
+
readonly queriesOnly?: readonly QueriedRoom[];
|
|
18
23
|
readonly conversations: boolean;
|
|
19
24
|
};
|
|
20
25
|
export type Deliver = (message: unknown) => void;
|
|
21
|
-
export type
|
|
26
|
+
export type Fail = (error: unknown) => void;
|
|
27
|
+
export type Watch = (topic: RuntimeTopic, input: readonly unknown[], deliver: Deliver, fail: Fail) => () => void;
|
|
22
28
|
export type RuntimeView = {
|
|
23
29
|
md: MdRuntime;
|
|
24
30
|
watch: Watch;
|
|
25
31
|
};
|
|
26
32
|
export type NarrowedView = RuntimeView & {
|
|
27
33
|
narrow(reach: PortReach | null): void;
|
|
28
|
-
|
|
34
|
+
code(code: CodeAvailability): void;
|
|
35
|
+
close(): void;
|
|
29
36
|
};
|
|
30
37
|
export type Reachable = RuntimeView & {
|
|
31
|
-
plan(input: unknown, reach: PortReach | null): Plan
|
|
38
|
+
plan(input: unknown, reach: PortReach | null): Promise<Plan>;
|
|
32
39
|
query(plan: Plan): Promise<QueryResult>;
|
|
33
|
-
watchPlan(plan: Plan, deliver:
|
|
34
|
-
search(input: unknown, reach: PortReach | null
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
watchPlan(plan: Plan, deliver: Deliver, fail: Fail): () => void;
|
|
41
|
+
search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
|
|
42
|
+
queryHouse(input: unknown, reach: PortReach | null): Promise<HouseQueryResult>;
|
|
43
|
+
queried(): readonly QueriedRoom[];
|
|
44
|
+
watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: ReadinessMessage) => void): () => void;
|
|
45
|
+
locked(room: string): Promise<boolean>;
|
|
46
|
+
lockedRooms(): Promise<readonly string[]>;
|
|
38
47
|
watchLocks(notify: () => void): () => void;
|
|
39
|
-
located(room: string, path: string, destination: string): ReachedDocument | null
|
|
40
|
-
room(locator: string):
|
|
48
|
+
located(room: string, path: string, destination: string): Promise<ReachedDocument | null>;
|
|
49
|
+
room(locator: string): Promise<ListedRoom | undefined>;
|
|
41
50
|
};
|
|
51
|
+
export declare function queriedOf(reach: PortReach | null, provided: readonly QueriedRoom[]): readonly QueriedRoom[];
|
|
52
|
+
export declare function queriedOnly(reach: PortReach | null, provided: readonly QueriedRoom[], room: string): boolean;
|
|
42
53
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
43
54
|
export declare function governs(reach: PortReach | null, room: {
|
|
44
55
|
readonly locator: string;
|
|
@@ -50,4 +61,4 @@ export declare function governs(reach: PortReach | null, room: {
|
|
|
50
61
|
readonly selection: boolean;
|
|
51
62
|
};
|
|
52
63
|
export declare function planReach(reach: PortReach | null): PlanReach | null;
|
|
53
|
-
export declare function narrowed(runtime: Reachable, given: PortReach | null,
|
|
64
|
+
export declare function narrowed(runtime: Reachable, given: PortReach | null, attached: ReadinessPort): NarrowedView;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import type { Open } from './open.js';
|
|
2
|
-
|
|
2
|
+
import type { ObservedRead } from './reads.js';
|
|
3
|
+
export type CodeAvailability = Open<'stored' | 'boot' | 'absent'>;
|
|
4
|
+
export type FirstTier = {
|
|
5
|
+
readonly handles: readonly string[];
|
|
6
|
+
readonly conversations: boolean;
|
|
7
|
+
readonly inboxes: boolean;
|
|
8
|
+
};
|
|
3
9
|
export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'unadmitted'>;
|
|
4
10
|
export type RoomCoverage = {
|
|
5
11
|
readonly room: string;
|
|
6
12
|
readonly state: RoomPreparation;
|
|
7
13
|
};
|
|
8
14
|
export type ConversationCoverage = Open<'complete' | 'acquiring' | 'undeclared'>;
|
|
9
|
-
export type SearchObligation = Open<'required' | 'unused'>;
|
|
10
15
|
export type TargetCoverage = {
|
|
11
16
|
readonly complete: boolean;
|
|
12
17
|
readonly listed: boolean;
|
|
13
18
|
readonly rooms: readonly RoomCoverage[];
|
|
14
19
|
readonly conversations: ConversationCoverage;
|
|
15
|
-
readonly search: SearchObligation;
|
|
16
20
|
};
|
|
17
|
-
export type Persistence = Open<'granted' | 'denied' | 'unavailable'>;
|
|
21
|
+
export type Persistence = Open<'granted' | 'denied' | 'unavailable' | 'memory'>;
|
|
18
22
|
export type Durability = Open<'persistent' | 'best-effort'>;
|
|
19
23
|
export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
|
|
20
24
|
export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
|
|
@@ -26,7 +30,6 @@ export type InstallationAmount = {
|
|
|
26
30
|
};
|
|
27
31
|
export type Installation = {
|
|
28
32
|
readonly step: InstallationStep | null;
|
|
29
|
-
readonly rooms: InstallationAmount;
|
|
30
33
|
readonly bytes: InstallationAmount;
|
|
31
34
|
};
|
|
32
35
|
export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
|
|
@@ -44,8 +47,18 @@ export type Readiness = {
|
|
|
44
47
|
readonly installation: Installation;
|
|
45
48
|
readonly lost: boolean;
|
|
46
49
|
};
|
|
50
|
+
export type ReadinessShown = Omit<Readiness, 'coverage'> & {
|
|
51
|
+
readonly coverage: Omit<TargetCoverage, 'rooms'>;
|
|
52
|
+
};
|
|
53
|
+
export type TierFacts = Omit<TargetCoverage, 'complete' | 'rooms'> & {
|
|
54
|
+
readonly unsettled: number;
|
|
55
|
+
};
|
|
47
56
|
export type ReadinessFacts = Omit<Readiness, 'status' | 'ready' | 'usable' | 'durability' | 'coverage'> & {
|
|
48
|
-
readonly coverage:
|
|
57
|
+
readonly coverage: TierFacts;
|
|
58
|
+
readonly first: TierFacts;
|
|
49
59
|
readonly established: boolean;
|
|
50
60
|
};
|
|
51
|
-
export declare
|
|
61
|
+
export declare const INBOXES_READ = "inboxes/list";
|
|
62
|
+
export declare const COMPLETE_ROOMS: ReadonlySet<string>;
|
|
63
|
+
export declare function inboxRooms({ answer }: ObservedRead): readonly string[] | null;
|
|
64
|
+
export declare function readinessOf(facts: ReadinessFacts): ReadinessShown;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type CallResult } from './outcome.js';
|
|
2
|
+
import type { Recovery } from './recovery.js';
|
|
3
|
+
import type { Attempt, Retries } from './retried.js';
|
|
4
|
+
import type { Connection, RuntimeDatabase } from './tables.js';
|
|
5
|
+
export declare const READ_TABLES: readonly string[];
|
|
6
|
+
export type ReadAt = {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly input: string;
|
|
9
|
+
readonly build: string;
|
|
10
|
+
};
|
|
11
|
+
export type ObservedRead = {
|
|
12
|
+
readonly answer: unknown;
|
|
13
|
+
readonly failure: CallResult | null;
|
|
14
|
+
readonly kept: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type ReadAnswers = {
|
|
17
|
+
watch(name: string, input: unknown, deliver: (read: ObservedRead) => void): () => void;
|
|
18
|
+
again(led?: Promise<unknown>): void;
|
|
19
|
+
reopened(): void;
|
|
20
|
+
};
|
|
21
|
+
export type ReadAnswersOptions = {
|
|
22
|
+
readonly database: RuntimeDatabase;
|
|
23
|
+
readonly build: string;
|
|
24
|
+
readonly unkept: readonly string[];
|
|
25
|
+
readonly leading: readonly string[];
|
|
26
|
+
readonly recovery: Recovery;
|
|
27
|
+
readonly retries: Retries;
|
|
28
|
+
call(name: string, input: unknown, attempt: Attempt): Promise<CallResult>;
|
|
29
|
+
online(): boolean;
|
|
30
|
+
streaming(): boolean;
|
|
31
|
+
closed(): boolean;
|
|
32
|
+
full(): boolean;
|
|
33
|
+
filled(): void;
|
|
34
|
+
};
|
|
35
|
+
export declare function storedRead(connection: Connection, { name, input, build }: ReadAt): string | null;
|
|
36
|
+
export declare function keptRead(connection: Connection, { name, input, build }: ReadAt, answer: string): null;
|
|
37
|
+
export declare function readsOfOtherBuildsForgotten(connection: Connection, build: string): null;
|
|
38
|
+
export declare function readAnswers(options: ReadAnswersOptions): ReadAnswers;
|
|
@@ -5,6 +5,7 @@ export type Attempt = (signal: AbortSignal) => Promise<Attempted>;
|
|
|
5
5
|
export type AttemptOptions = {
|
|
6
6
|
readonly at?: number;
|
|
7
7
|
readonly again?: boolean;
|
|
8
|
+
readonly attempts?: number;
|
|
8
9
|
};
|
|
9
10
|
export type RecoveryOptions = {
|
|
10
11
|
readonly firstMs?: number;
|
|
@@ -16,10 +17,12 @@ export type Recovery = {
|
|
|
16
17
|
attempt(intent: string, run: Attempt, options?: AttemptOptions): Promise<boolean>;
|
|
17
18
|
pending(intent: string): boolean;
|
|
18
19
|
resume(): void;
|
|
20
|
+
again(): void;
|
|
21
|
+
waits(wake: () => void): () => void;
|
|
19
22
|
cancel(intent: string): void;
|
|
20
23
|
scope(inFlight?: number): Recovery;
|
|
21
24
|
retire(): Promise<void>;
|
|
22
25
|
};
|
|
23
26
|
export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
|
|
24
|
-
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
|
|
27
|
+
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean, owner?: Recovery): Promise<T>;
|
|
25
28
|
export declare function createRecovery(options?: RecoveryOptions): Recovery;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AdapterFailure, Authorization, RefreshPage, RefreshRequest, RefreshResult, RetryableRefusal } from './adapter.js';
|
|
2
|
+
import type { Remodel } from './bootstrap.js';
|
|
3
|
+
import type { ReplicaRecord } from './replica.js';
|
|
4
|
+
import type { RefreshedPage } from './store.js';
|
|
5
|
+
import type { HeldEntry, StoredEntry } from './tables.js';
|
|
6
|
+
import { type Unconfirmed } from './transfer.js';
|
|
7
|
+
export type Advancement = {
|
|
8
|
+
kind: 'still-current';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'advanced';
|
|
11
|
+
record: ReplicaRecord;
|
|
12
|
+
changed: ReadonlySet<string>;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'beyond-horizon';
|
|
15
|
+
} | RetryableRefusal | Unconfirmed | AdapterFailure;
|
|
16
|
+
export type Refresher = (authorization: Authorization, request: RefreshRequest) => Promise<RefreshResult>;
|
|
17
|
+
export type Refreshing = {
|
|
18
|
+
turn(): void;
|
|
19
|
+
prior(paths: readonly string[]): Promise<ReadonlyMap<string, HeldEntry>>;
|
|
20
|
+
later(paths: readonly string[], roomVersion: string): Promise<ReadonlySet<string>>;
|
|
21
|
+
stage(page: RefreshedPage): Promise<boolean>;
|
|
22
|
+
};
|
|
23
|
+
type PageContent = Pick<RefreshPage, 'documents' | 'facts' | 'revisions' | 'fileIds' | 'created' | 'changes' | 'binaryFiles'>;
|
|
24
|
+
export declare function pageEntries(page: PageContent, removals: readonly string[], roomVersion: string, prior: (paths: readonly string[]) => Promise<ReadonlyMap<string, HeldEntry>>): Promise<StoredEntry[]>;
|
|
25
|
+
export declare function advancement(refresh: Refresher, authorization: Authorization, held: ReplicaRecord, remodel: Remodel, continuing: () => boolean, staging: Refreshing): Promise<Advancement>;
|
|
26
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type TypedPath } from '../mdmodel/index.js';
|
|
2
|
+
import type { BootstrapInventory, SavedFacts, MutationResult, RoomDeclaration, TypedSelection } from './adapter.js';
|
|
2
3
|
import { type ChangeBatch, type Precondition } from './change.js';
|
|
3
4
|
import { type Collection, type Composition } from './collection.js';
|
|
4
5
|
import { type ModelState } from './model.js';
|
|
@@ -6,13 +7,8 @@ import { type Layer } from './overlay.js';
|
|
|
6
7
|
import type { HeldEntry, OverlayEntry, StoredEntry } from './tables.js';
|
|
7
8
|
export type ReplicaRecord = {
|
|
8
9
|
readonly locator: string;
|
|
9
|
-
readonly
|
|
10
|
-
readonly handle: string;
|
|
11
|
-
readonly operations: OperationScopes;
|
|
12
|
-
readonly replica: ReplicaAdmission;
|
|
10
|
+
readonly declaration: RoomDeclaration;
|
|
13
11
|
readonly model: ModelState;
|
|
14
|
-
readonly typedSelection: TypedSelection | null;
|
|
15
|
-
readonly providerOwnedPaths: readonly string[];
|
|
16
12
|
readonly roomVersion: string;
|
|
17
13
|
readonly transfer: string;
|
|
18
14
|
readonly inventory: BootstrapInventory;
|
|
@@ -22,23 +18,22 @@ export type HeldReplica = {
|
|
|
22
18
|
readonly record: ReplicaRecord;
|
|
23
19
|
readonly queue: readonly ChangeBatch[];
|
|
24
20
|
readonly overlaid: ReadonlySet<string>;
|
|
25
|
-
readonly count: number;
|
|
26
|
-
readonly confirmed: number;
|
|
27
|
-
readonly indexed: boolean;
|
|
28
21
|
};
|
|
29
22
|
export type VisibleLayer = Layer & {
|
|
30
23
|
readonly collection: Collection;
|
|
31
24
|
};
|
|
32
25
|
export type Slice = Layer & {
|
|
33
26
|
readonly written: Readonly<Record<string, string>>;
|
|
27
|
+
readonly facts: Readonly<Record<string, SavedFacts>>;
|
|
34
28
|
readonly held: ReadonlySet<string>;
|
|
35
29
|
};
|
|
36
|
-
export declare function compositionOf(
|
|
30
|
+
export declare function compositionOf(model: ModelState, typedSelection: TypedSelection | null, builtIn: ModelState, typedPaths: readonly TypedPath[]): Composition;
|
|
37
31
|
export declare function storedRecord(record: ReplicaRecord): string;
|
|
38
32
|
export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
|
|
33
|
+
export type LayerEntry = Omit<StoredEntry, 'facts'>;
|
|
39
34
|
export declare function entryAt(layer: Layer & {
|
|
40
35
|
readonly written?: Readonly<Record<string, string>>;
|
|
41
|
-
}, path: string):
|
|
36
|
+
}, path: string): LayerEntry | null;
|
|
42
37
|
export declare function slicingWith(slice: Slice, set: readonly StoredEntry[], removed: readonly string[]): Generator<number, Slice, void>;
|
|
43
38
|
export declare function touchedBy(queue: readonly ChangeBatch[]): Set<string>;
|
|
44
39
|
export declare function movedBy(queue: readonly ChangeBatch[], locator: string): Set<string>;
|
|
@@ -47,9 +42,9 @@ export type Replayed = {
|
|
|
47
42
|
readonly touched: ReadonlySet<string>;
|
|
48
43
|
};
|
|
49
44
|
export declare function replaying(confirmed: Slice, queue: readonly ChangeBatch[], locator: string, composition: Composition): Generator<number, Replayed, void>;
|
|
50
|
-
export declare function overlayOf(visible:
|
|
51
|
-
export declare function holds(layer: Layer, preconditions: readonly Precondition[]): boolean;
|
|
52
|
-
export declare function landed(batch: ChangeBatch, confirmed: Layer, current?: Readonly<Record<string, string>>): boolean;
|
|
45
|
+
export declare function overlayOf(visible: VisibleLayer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
|
|
46
|
+
export declare function holds(layer: Layer, preconditions: readonly Precondition[], composition: Composition): boolean;
|
|
47
|
+
export declare function landed(batch: ChangeBatch, confirmed: Layer, composition: Composition, current?: Readonly<Record<string, string>>): boolean;
|
|
53
48
|
export type Standing = {
|
|
54
49
|
readonly withdrawn: readonly ChangeBatch[];
|
|
55
50
|
readonly kept: readonly ChangeBatch[];
|
|
@@ -63,5 +58,5 @@ export type Returned = {
|
|
|
63
58
|
readonly removed: readonly string[];
|
|
64
59
|
};
|
|
65
60
|
export declare function returnedPaths(submitted: ChangeBatch, accepted: Accepted): Set<string>;
|
|
66
|
-
export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string): Generator<number, Returned, void>;
|
|
61
|
+
export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string, composition: Composition): Generator<number, Returned, void>;
|
|
67
62
|
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type RuntimeShell } from './durability.js';
|
|
2
|
+
export declare const STEPS: readonly ['database', 'sign_in', 'connection', 'code', 'download', 'conversations', 'sending', 'reading'];
|
|
3
|
+
export type Step = (typeof STEPS)[number];
|
|
4
|
+
export type RetriedFailure = {
|
|
5
|
+
readonly step: Step;
|
|
6
|
+
readonly answered: false;
|
|
7
|
+
} | {
|
|
8
|
+
readonly step: Step;
|
|
9
|
+
readonly answered: true;
|
|
10
|
+
readonly error: unknown;
|
|
11
|
+
};
|
|
12
|
+
export type Uncertain = {
|
|
13
|
+
readonly failure?: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type Attempt = {
|
|
16
|
+
readonly step: Step;
|
|
17
|
+
readonly instance: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class Unanswered extends Error {
|
|
20
|
+
}
|
|
21
|
+
export declare function uncertainError(uncertainty: Uncertain): unknown;
|
|
22
|
+
export type Retries = {
|
|
23
|
+
failed(step: Step, instance: string, error: unknown): void;
|
|
24
|
+
unanswered(step: Step, instance: string): void;
|
|
25
|
+
uncertain(step: Step, instance: string, uncertainty: Uncertain): void;
|
|
26
|
+
succeeded(step: Step, instance: string): void;
|
|
27
|
+
};
|
|
28
|
+
export declare function createRetries(shell: Pick<RuntimeShell, 'retried' | 'succeeded'>): Retries;
|
|
29
|
+
export declare function retrying<T>(retries: Retries, step: Step, instance: string, ask: () => Promise<T>): () => Promise<T>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ApplyResult, type Definition, type DefinitionOf, type Document } from '../mdmodel/index.js';
|
|
2
|
+
import type { HeadChange, ProviderRefusal } from './adapter.js';
|
|
2
3
|
import type { Open } from './open.js';
|
|
3
|
-
import type { Change, Precondition } from './change.js';
|
|
4
|
+
import type { Change, PartChange, Precondition } from './change.js';
|
|
4
5
|
import type { VisibleLayer } from './replica.js';
|
|
5
6
|
export type FieldValue = {
|
|
6
7
|
readonly value: unknown;
|
|
@@ -90,15 +91,30 @@ type ChangedUnderneath = {
|
|
|
90
91
|
readonly file?: string | null;
|
|
91
92
|
};
|
|
92
93
|
export type ReturnReason = ProviderRefusal & {
|
|
93
|
-
readonly kind: Open<'conflicted' | 'rejected' | '
|
|
94
|
+
readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
|
|
95
|
+
};
|
|
96
|
+
export declare function returnedBy(): ReturnReason;
|
|
97
|
+
type Mark = {
|
|
98
|
+
readonly change: HeadChange | null;
|
|
99
|
+
};
|
|
100
|
+
export type Marks = {
|
|
101
|
+
readonly fields?: Readonly<Record<string, Mark & {
|
|
102
|
+
readonly current: FieldValue;
|
|
103
|
+
}>>;
|
|
104
|
+
readonly sections?: Readonly<Record<string, Mark>>;
|
|
105
|
+
readonly preamble?: Mark;
|
|
106
|
+
readonly markdown?: Mark;
|
|
107
|
+
readonly file?: Mark & {
|
|
108
|
+
readonly current: string;
|
|
109
|
+
};
|
|
94
110
|
};
|
|
95
|
-
export declare function returnedBy(kind: 'expired' | 'withdrawn'): ReturnReason;
|
|
96
111
|
export type RoomDraft = {
|
|
97
112
|
readonly room: string;
|
|
98
113
|
readonly path: string;
|
|
99
114
|
readonly revision: string;
|
|
100
115
|
readonly parts: HeldParts;
|
|
101
116
|
readonly changedUnderneath: ChangedUnderneath;
|
|
117
|
+
readonly marks: Marks;
|
|
102
118
|
readonly returned: ReturnReason | null;
|
|
103
119
|
};
|
|
104
120
|
export type RoomDraftWrite = {
|
|
@@ -106,8 +122,6 @@ export type RoomDraftWrite = {
|
|
|
106
122
|
readonly roomDraft: RoomDraft | null;
|
|
107
123
|
} | {
|
|
108
124
|
readonly outcome: 'stale';
|
|
109
|
-
readonly code: string;
|
|
110
|
-
readonly retryable: boolean;
|
|
111
125
|
readonly current: RoomDraft | null;
|
|
112
126
|
};
|
|
113
127
|
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
@@ -121,6 +135,7 @@ export type RoomDraftRecord = {
|
|
|
121
135
|
readonly path: string;
|
|
122
136
|
readonly revision: string;
|
|
123
137
|
readonly parts: HeldParts;
|
|
138
|
+
readonly marks: Marks;
|
|
124
139
|
readonly returned: ReturnReason | null;
|
|
125
140
|
};
|
|
126
141
|
export type SavedDraft = {
|
|
@@ -134,6 +149,16 @@ export declare function underneath(parts: HeldParts, path: string, visible: Visi
|
|
|
134
149
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
135
150
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
136
151
|
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
152
|
+
export declare function marksOver(kept: Marks, under: Marks): Marks;
|
|
153
|
+
export declare function heldMarks(marks: Marks, parts: HeldParts): Marks;
|
|
154
|
+
export declare function partsBetween(path: string, before: Document, after: Document): PartChange[];
|
|
155
|
+
export declare function applyParts(document: Document, changes: readonly Change[], definition: Definition | undefined): ApplyResult;
|
|
156
|
+
type Joined = {
|
|
157
|
+
readonly parts: HeldParts;
|
|
158
|
+
readonly marks: Marks;
|
|
159
|
+
};
|
|
160
|
+
export declare function joinedOver(parts: HeldParts, marks: Marks, path: string, visible: VisibleLayer): Joined | null;
|
|
161
|
+
export declare function lineEnded(text: string): string;
|
|
137
162
|
export type TextParts = {
|
|
138
163
|
readonly fields?: Readonly<Record<string, {
|
|
139
164
|
readonly value: unknown;
|
|
@@ -145,8 +170,8 @@ export type TextParts = {
|
|
|
145
170
|
readonly value: string;
|
|
146
171
|
};
|
|
147
172
|
};
|
|
148
|
-
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
149
|
-
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
173
|
+
export declare function partsAfter(markdown: string, parts: TextParts, definitions?: DefinitionOf): string | null;
|
|
174
|
+
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts, definitions?: DefinitionOf): HeldParts | null;
|
|
150
175
|
export declare function moveTarget(move: {
|
|
151
176
|
readonly to: string;
|
|
152
177
|
}): string;
|
|
@@ -168,6 +193,5 @@ export declare function changesOf(path: string, parts: HeldParts): {
|
|
|
168
193
|
changes: readonly Change[];
|
|
169
194
|
bases: readonly Precondition[];
|
|
170
195
|
};
|
|
171
|
-
export declare function joinedDraft(carried: SavedDraft, saved: readonly SavedDraft[]): SavedDraft;
|
|
172
196
|
export declare function withdrawnDrafts(drafts: readonly SavedDraft[], changes: readonly Change[]): readonly SavedDraft[];
|
|
173
197
|
export {};
|