@agentshouse/app-bridge 0.1.0-c895bda3a3f6a → 0.1.0-c8a7dd564e490
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 +91 -59
- package/dist/mdmodel/definition.d.ts +1 -1
- package/dist/mdmodel/document.d.ts +1 -2
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +19 -6
- package/dist/mdmodel/kinds.d.ts +18 -0
- package/dist/mdmodel/pattern.d.ts +9 -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 +7 -5
- package/dist/mdmodel/validate.d.ts +7 -5
- package/dist/mdruntime/adapter.d.ts +37 -25
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/change.d.ts +1 -0
- package/dist/mdruntime/client.d.ts +7 -3
- package/dist/mdruntime/collection.d.ts +2 -1
- package/dist/mdruntime/compile.d.ts +2 -7
- package/dist/mdruntime/connection.d.ts +7 -6
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +18 -9
- package/dist/mdruntime/durability.d.ts +6 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/job.d.ts +32 -0
- package/dist/mdruntime/messages.d.ts +27 -3
- package/dist/mdruntime/model.d.ts +2 -9
- package/dist/mdruntime/observation.d.ts +2 -2
- package/dist/mdruntime/overlay.d.ts +1 -0
- package/dist/mdruntime/query.d.ts +13 -210
- package/dist/mdruntime/reach.d.ts +11 -11
- package/dist/mdruntime/readiness.d.ts +0 -2
- package/dist/mdruntime/replica.d.ts +8 -5
- package/dist/mdruntime/room-draft.d.ts +3 -2
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +0 -2
- package/dist/mdruntime/store.d.ts +88 -41
- package/dist/mdruntime/stored.d.ts +58 -65
- package/dist/mdruntime/tables.d.ts +88 -51
- package/dist/mdruntime/wire.d.ts +8 -0
- package/dist/test-host.js +1 -1
- package/docs/families.md +17 -6
- package/package.json +1 -1
- package/dist/mdmodel/condition.d.ts +0 -180
- package/dist/mdruntime/fulltext.d.ts +0 -26
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { type Definition } from '../definition.js';
|
|
2
|
+
export type Value = string | number | boolean | null;
|
|
3
|
+
export type Predicate = Value | {
|
|
4
|
+
$eq: Value;
|
|
5
|
+
} | {
|
|
6
|
+
$ne: Value;
|
|
7
|
+
} | {
|
|
8
|
+
$in: readonly Value[];
|
|
9
|
+
} | {
|
|
10
|
+
$nin: readonly Value[];
|
|
11
|
+
} | {
|
|
12
|
+
$gt?: Value;
|
|
13
|
+
$gte?: Value;
|
|
14
|
+
$lt?: Value;
|
|
15
|
+
$lte?: Value;
|
|
16
|
+
} | {
|
|
17
|
+
$all: readonly Value[];
|
|
18
|
+
} | {
|
|
19
|
+
$size: number;
|
|
20
|
+
} | {
|
|
21
|
+
$exists: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
$prefix: string;
|
|
24
|
+
};
|
|
25
|
+
export type Where = {
|
|
26
|
+
$and?: readonly Where[];
|
|
27
|
+
$or?: readonly Where[];
|
|
28
|
+
[field: string]: Predicate | readonly Where[] | undefined;
|
|
29
|
+
};
|
|
30
|
+
export type Related = {
|
|
31
|
+
types?: readonly string[];
|
|
32
|
+
where?: Where;
|
|
33
|
+
pathPrefix?: string;
|
|
34
|
+
};
|
|
35
|
+
export type Filter = {
|
|
36
|
+
rooms?: readonly string[];
|
|
37
|
+
types?: readonly string[];
|
|
38
|
+
where?: Where;
|
|
39
|
+
pathPrefix?: string;
|
|
40
|
+
outside?: readonly string[];
|
|
41
|
+
folder?: string;
|
|
42
|
+
paths?: readonly string[];
|
|
43
|
+
fileIds?: readonly string[];
|
|
44
|
+
hop?: Related & {
|
|
45
|
+
field: string;
|
|
46
|
+
};
|
|
47
|
+
backlinks?: Related & {
|
|
48
|
+
field?: string;
|
|
49
|
+
};
|
|
50
|
+
text?: string;
|
|
51
|
+
};
|
|
52
|
+
export type Key = 'room' | 'path' | 'type' | 'folder' | 'size' | 'created' | 'updated' | {
|
|
53
|
+
field: string;
|
|
54
|
+
};
|
|
55
|
+
export type GroupKey = 'room' | 'type' | 'folder' | 'subfolder' | {
|
|
56
|
+
field: string;
|
|
57
|
+
};
|
|
58
|
+
export type Select = 'all' | {
|
|
59
|
+
fields?: 'all' | readonly string[];
|
|
60
|
+
sections?: 'all' | readonly string[];
|
|
61
|
+
preamble?: true;
|
|
62
|
+
markdown?: true;
|
|
63
|
+
backlinks?: true;
|
|
64
|
+
change?: true;
|
|
65
|
+
fileId?: true;
|
|
66
|
+
revision?: true;
|
|
67
|
+
size?: true;
|
|
68
|
+
created?: true;
|
|
69
|
+
};
|
|
70
|
+
export type GroupSelect = {
|
|
71
|
+
size?: true;
|
|
72
|
+
updated?: true;
|
|
73
|
+
greatest?: {
|
|
74
|
+
field: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export type GroupOrder = 'count' | 'size' | 'updated' | 'greatest';
|
|
78
|
+
export type OrderOptions = {
|
|
79
|
+
nulls?: 'first' | 'last';
|
|
80
|
+
stringSort?: 'lexical' | 'locale';
|
|
81
|
+
locale?: string;
|
|
82
|
+
localeOptions?: Readonly<Record<string, unknown>>;
|
|
83
|
+
};
|
|
84
|
+
export type Direction = 'asc' | 'desc';
|
|
85
|
+
export type DocumentQuery = Filter & {
|
|
86
|
+
select: Select;
|
|
87
|
+
orderBy?: readonly ({
|
|
88
|
+
by: Key;
|
|
89
|
+
direction?: Direction;
|
|
90
|
+
} & OrderOptions)[];
|
|
91
|
+
limit?: number;
|
|
92
|
+
after?: string;
|
|
93
|
+
total?: true;
|
|
94
|
+
};
|
|
95
|
+
export type GroupQuery = Filter & {
|
|
96
|
+
groupBy: readonly GroupKey[];
|
|
97
|
+
select?: GroupSelect;
|
|
98
|
+
orderBy?: readonly {
|
|
99
|
+
by: GroupOrder | GroupKey;
|
|
100
|
+
direction?: Direction;
|
|
101
|
+
nulls?: 'first' | 'last';
|
|
102
|
+
}[];
|
|
103
|
+
limit?: number;
|
|
104
|
+
after?: string;
|
|
105
|
+
total?: true;
|
|
106
|
+
};
|
|
107
|
+
export type LocalQuery = DocumentQuery | GroupQuery;
|
|
108
|
+
export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
|
|
109
|
+
export type RoomFacts = {
|
|
110
|
+
locator: string;
|
|
111
|
+
available: boolean;
|
|
112
|
+
types: readonly Definition[];
|
|
113
|
+
};
|
|
114
|
+
export type HeldRooms = {
|
|
115
|
+
listed: boolean;
|
|
116
|
+
rooms: readonly RoomFacts[];
|
|
117
|
+
};
|
|
118
|
+
export type Test = {
|
|
119
|
+
op: 'eq';
|
|
120
|
+
value: Value;
|
|
121
|
+
} | {
|
|
122
|
+
op: 'ne';
|
|
123
|
+
value: Value;
|
|
124
|
+
} | {
|
|
125
|
+
op: 'in';
|
|
126
|
+
values: readonly Value[];
|
|
127
|
+
} | {
|
|
128
|
+
op: 'nin';
|
|
129
|
+
values: readonly Value[];
|
|
130
|
+
} | {
|
|
131
|
+
op: 'range';
|
|
132
|
+
bounds: readonly (readonly ['gt' | 'gte' | 'lt' | 'lte', Value])[];
|
|
133
|
+
} | {
|
|
134
|
+
op: 'all';
|
|
135
|
+
values: readonly Value[];
|
|
136
|
+
} | {
|
|
137
|
+
op: 'size';
|
|
138
|
+
size: number;
|
|
139
|
+
} | {
|
|
140
|
+
op: 'exists';
|
|
141
|
+
exists: boolean;
|
|
142
|
+
} | {
|
|
143
|
+
op: 'prefix';
|
|
144
|
+
prefix: string;
|
|
145
|
+
};
|
|
146
|
+
export type Clause = {
|
|
147
|
+
every: readonly Clause[];
|
|
148
|
+
} | {
|
|
149
|
+
some: readonly Clause[];
|
|
150
|
+
} | {
|
|
151
|
+
field: string;
|
|
152
|
+
test: Test;
|
|
153
|
+
};
|
|
154
|
+
export type Scope = {
|
|
155
|
+
types: readonly string[] | null;
|
|
156
|
+
where: Clause | null;
|
|
157
|
+
pathPrefix: string | null;
|
|
158
|
+
};
|
|
159
|
+
export type KeyPlan = {
|
|
160
|
+
of: 'room';
|
|
161
|
+
} | {
|
|
162
|
+
of: 'path';
|
|
163
|
+
} | {
|
|
164
|
+
of: 'type';
|
|
165
|
+
} | {
|
|
166
|
+
of: 'folder';
|
|
167
|
+
} | {
|
|
168
|
+
of: 'subfolder';
|
|
169
|
+
} | {
|
|
170
|
+
of: 'size';
|
|
171
|
+
} | {
|
|
172
|
+
of: 'created';
|
|
173
|
+
} | {
|
|
174
|
+
of: 'updated';
|
|
175
|
+
} | {
|
|
176
|
+
of: 'field';
|
|
177
|
+
field: string;
|
|
178
|
+
};
|
|
179
|
+
export type DocumentShape = {
|
|
180
|
+
kind: 'documents';
|
|
181
|
+
fields: 'all' | readonly string[] | null;
|
|
182
|
+
sections: 'all' | readonly string[] | null;
|
|
183
|
+
preamble: boolean;
|
|
184
|
+
markdown: boolean;
|
|
185
|
+
backlinks: boolean;
|
|
186
|
+
change: boolean;
|
|
187
|
+
fileId: boolean;
|
|
188
|
+
revision: boolean;
|
|
189
|
+
size: boolean;
|
|
190
|
+
created: boolean;
|
|
191
|
+
orderBy: readonly {
|
|
192
|
+
key: KeyPlan;
|
|
193
|
+
options: OrderOptions & {
|
|
194
|
+
direction: Direction;
|
|
195
|
+
};
|
|
196
|
+
}[];
|
|
197
|
+
};
|
|
198
|
+
export type GroupShape = {
|
|
199
|
+
kind: 'groups';
|
|
200
|
+
groupBy: readonly KeyPlan[];
|
|
201
|
+
size: boolean;
|
|
202
|
+
updated: boolean;
|
|
203
|
+
greatest: string | null;
|
|
204
|
+
orderBy: readonly {
|
|
205
|
+
by: GroupOrder | number;
|
|
206
|
+
direction: Direction;
|
|
207
|
+
nulls: 'first' | 'last' | null;
|
|
208
|
+
}[];
|
|
209
|
+
};
|
|
210
|
+
export type Continuation = {
|
|
211
|
+
text: string;
|
|
212
|
+
values: readonly unknown[] | null;
|
|
213
|
+
};
|
|
214
|
+
export type QueryPlan = {
|
|
215
|
+
key: string;
|
|
216
|
+
rooms: readonly string[] | null;
|
|
217
|
+
root: Scope;
|
|
218
|
+
outside: readonly string[] | null;
|
|
219
|
+
folder: string | null;
|
|
220
|
+
paths: readonly string[] | null;
|
|
221
|
+
fileIds: readonly string[] | null;
|
|
222
|
+
hop: (Scope & {
|
|
223
|
+
field: string;
|
|
224
|
+
}) | null;
|
|
225
|
+
backlinks: (Scope & {
|
|
226
|
+
field: string | null;
|
|
227
|
+
}) | null;
|
|
228
|
+
text: string | null;
|
|
229
|
+
shape: DocumentShape | GroupShape;
|
|
230
|
+
limit: number | null;
|
|
231
|
+
after: Continuation | null;
|
|
232
|
+
total: boolean;
|
|
233
|
+
};
|
|
234
|
+
export type Place = readonly (string | number)[];
|
|
235
|
+
type At = Place | string;
|
|
236
|
+
export declare class QueryError extends Error {
|
|
237
|
+
readonly code: QueryErrorCode;
|
|
238
|
+
readonly place: Place;
|
|
239
|
+
readonly accepts: readonly string[];
|
|
240
|
+
readonly retryable = false;
|
|
241
|
+
constructor(code: QueryErrorCode, at: At, problem: string, accepts?: readonly string[]);
|
|
242
|
+
}
|
|
243
|
+
type Entries = Readonly<Record<string, unknown>>;
|
|
244
|
+
export declare function bodied(shape: DocumentShape): boolean;
|
|
245
|
+
export declare function invalid(at: At, problem: string, accepts?: readonly string[]): never;
|
|
246
|
+
export declare function placeText(at: Place): string;
|
|
247
|
+
export declare function known(value: Entries, allowed: readonly string[], at: At): void;
|
|
248
|
+
export declare function planOf(input: unknown, facts: HeldRooms): QueryPlan;
|
|
249
|
+
export declare function cursorOf(values: readonly unknown[]): string;
|
|
250
|
+
export declare function decodedCursor(text: string): readonly unknown[] | null;
|
|
251
|
+
export declare function queryKey(query: unknown): string;
|
|
252
|
+
export declare function identityOf(plan: QueryPlan): string;
|
|
253
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Definition } from '../definition.js';
|
|
2
|
+
import { type QueryPlan } from './language.js';
|
|
3
|
+
import { type HeldValue } from './rows.js';
|
|
4
|
+
export type Candidate = {
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly type: string | null;
|
|
7
|
+
readonly fileId: string | null;
|
|
8
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
9
|
+
readonly definition?: Pick<Definition, 'frontmatter'>;
|
|
10
|
+
readonly text: string | null;
|
|
11
|
+
};
|
|
12
|
+
export declare function heldAt(candidate: Candidate, field: string): readonly HeldValue[];
|
|
13
|
+
export declare function matches(plan: QueryPlan, candidate: Candidate): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Definition } from '../definition.js';
|
|
2
|
+
export type HeldKind = 'string' | 'number' | 'boolean' | 'null' | 'array' | 'object' | 'undefined';
|
|
3
|
+
export type HeldValue = {
|
|
4
|
+
readonly keys: string;
|
|
5
|
+
readonly places: string;
|
|
6
|
+
readonly item: number;
|
|
7
|
+
readonly kind: HeldKind;
|
|
8
|
+
readonly value: string | number | null;
|
|
9
|
+
readonly size: number | null;
|
|
10
|
+
readonly instant: string | null;
|
|
11
|
+
};
|
|
12
|
+
export type HeldLink = {
|
|
13
|
+
readonly kind: 'field';
|
|
14
|
+
readonly keys: string;
|
|
15
|
+
readonly places: string;
|
|
16
|
+
readonly target: string;
|
|
17
|
+
readonly field: string;
|
|
18
|
+
};
|
|
19
|
+
export type Indexed = {
|
|
20
|
+
readonly values: readonly HeldValue[];
|
|
21
|
+
readonly links: readonly HeldLink[];
|
|
22
|
+
};
|
|
23
|
+
export type Reach = 'exact' | 'value' | 'link';
|
|
24
|
+
export type Placed = {
|
|
25
|
+
readonly keys: string;
|
|
26
|
+
readonly places: string;
|
|
27
|
+
readonly glob: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function placedOf(pointer: string, reach: Reach): Placed;
|
|
30
|
+
export declare function heldKind(value: unknown): HeldKind;
|
|
31
|
+
export declare function indexed(path: string, fields: Readonly<Record<string, unknown>>, definition: Pick<Definition, 'frontmatter'> | undefined): Indexed;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Ordering } from '../kinds.js';
|
|
2
|
+
import type { QueryPlan, Scope } from './language.js';
|
|
3
|
+
import { type HeldValue, type Reach } from './rows.js';
|
|
4
|
+
export type SqlValue = string | number | bigint | Uint8Array | null;
|
|
5
|
+
export type Fragment = {
|
|
6
|
+
readonly sql: string;
|
|
7
|
+
readonly bind: readonly SqlValue[];
|
|
8
|
+
};
|
|
9
|
+
export type Collate = (ordering: Ordering, lists: boolean, total: boolean) => string | null;
|
|
10
|
+
export type Term = {
|
|
11
|
+
readonly ordering: Ordering;
|
|
12
|
+
readonly kind: Fragment;
|
|
13
|
+
readonly value: Fragment;
|
|
14
|
+
readonly instant?: Fragment;
|
|
15
|
+
readonly total?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type Following = {
|
|
18
|
+
readonly beyond: Fragment;
|
|
19
|
+
readonly equal: Fragment;
|
|
20
|
+
};
|
|
21
|
+
export declare const VALUE_TABLE = "CREATE TABLE replica_values (doc INTEGER NOT NULL, keys TEXT NOT NULL, places TEXT NOT NULL, item INTEGER NOT NULL, kind TEXT NOT NULL, value, size INTEGER, instant TEXT, PRIMARY KEY (doc, keys, places, item)) WITHOUT ROWID";
|
|
22
|
+
export declare const HOLDS_PHRASE = "holds_phrase";
|
|
23
|
+
export declare function holdsPhrase(_context: number, text: unknown, phrase: unknown): number;
|
|
24
|
+
export declare function fragment(sql: string, bind?: readonly SqlValue[]): Fragment;
|
|
25
|
+
export declare function joined(parts: readonly Fragment[], separator: string): Fragment;
|
|
26
|
+
export declare function all(parts: readonly Fragment[]): Fragment;
|
|
27
|
+
export declare function any(parts: readonly Fragment[]): Fragment;
|
|
28
|
+
export declare function grouped(part: Fragment): Fragment;
|
|
29
|
+
export declare function listed(values: readonly SqlValue[]): Fragment;
|
|
30
|
+
export declare function exists(part: Fragment): Fragment;
|
|
31
|
+
export declare function insertedValues(doc: number, values: readonly HeldValue[]): Fragment;
|
|
32
|
+
export declare function placed(alias: string, field: string, reach: Reach): Fragment;
|
|
33
|
+
export declare function scoped(alias: string, scope: Scope, byPaths?: boolean): Fragment;
|
|
34
|
+
export declare function tests(alias: string, plan: QueryPlan): Fragment;
|
|
35
|
+
export declare function sortValue(kind: SqlValue | undefined, value: unknown, instant: SqlValue | undefined): unknown;
|
|
36
|
+
export declare function sorted(collate: Collate, term: Term): Fragment;
|
|
37
|
+
export declare function beyond(collate: Collate, term: Term, value: unknown): Following;
|
|
38
|
+
export declare function following(parts: readonly Following[], tie: Fragment): Fragment;
|
package/dist/mdmodel/types.d.ts
CHANGED
|
@@ -12,9 +12,16 @@ export type ModelVerification = {
|
|
|
12
12
|
readonly rule: string;
|
|
13
13
|
readonly location?: string;
|
|
14
14
|
};
|
|
15
|
+
export type TypedPath = {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly named: boolean;
|
|
19
|
+
readonly body: boolean;
|
|
20
|
+
};
|
|
15
21
|
export type ValidationContext = {
|
|
16
22
|
readonly binaryTargets: readonly string[];
|
|
17
23
|
readonly anyRoom?: true;
|
|
24
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
18
25
|
};
|
|
19
26
|
export type ProjectionContext = {
|
|
20
27
|
readonly documentTargets: readonly string[];
|
|
@@ -98,11 +105,6 @@ export type Link = {
|
|
|
98
105
|
readonly href: string;
|
|
99
106
|
readonly target: string;
|
|
100
107
|
};
|
|
101
|
-
export type Outline = {
|
|
102
|
-
readonly type: string | null;
|
|
103
|
-
readonly fields: Readonly<Record<string, unknown>> | null;
|
|
104
|
-
readonly links: readonly string[];
|
|
105
|
-
};
|
|
106
108
|
export type Reference = {
|
|
107
109
|
readonly pointer: string;
|
|
108
110
|
readonly value: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, 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
4
|
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
5
|
-
export declare function
|
|
6
|
-
|
|
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;
|
|
7
8
|
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
8
|
-
export declare function roomReferences(
|
|
9
|
+
export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
|
|
9
10
|
type Placed = {
|
|
10
11
|
readonly reference: Reached;
|
|
11
12
|
readonly location: string;
|
|
@@ -20,7 +21,8 @@ export type Assessment = {
|
|
|
20
21
|
readonly linked: boolean;
|
|
21
22
|
readonly sections: readonly Placed[];
|
|
22
23
|
};
|
|
23
|
-
export declare function assess(file: string,
|
|
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;
|
|
24
26
|
export type Verdicts = {
|
|
25
27
|
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
26
28
|
verdict(): Validation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
|
|
2
2
|
import type { ModelResult } from './model.js';
|
|
3
|
-
export type {
|
|
3
|
+
export type { SavedFacts, TypedPath };
|
|
4
4
|
import type { Open } from './open.js';
|
|
5
5
|
import type { ChangeBatch } from './change.js';
|
|
6
6
|
export type Authorization = object;
|
|
@@ -13,7 +13,7 @@ export type TypedSelection = {
|
|
|
13
13
|
};
|
|
14
14
|
export type OperationScopes = {
|
|
15
15
|
write: readonly string[];
|
|
16
|
-
|
|
16
|
+
erase: readonly string[];
|
|
17
17
|
};
|
|
18
18
|
export type ReplicaAdmission = {
|
|
19
19
|
selection: string;
|
|
@@ -46,6 +46,7 @@ export type ListedConversation = {
|
|
|
46
46
|
outcome: string | null;
|
|
47
47
|
waiting: boolean;
|
|
48
48
|
newest: string | null;
|
|
49
|
+
processEnded: string | null;
|
|
49
50
|
};
|
|
50
51
|
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
|
|
51
52
|
export type ConversationMessage = {
|
|
@@ -229,7 +230,6 @@ export type HistoryRetention = {
|
|
|
229
230
|
};
|
|
230
231
|
export type Retention = {
|
|
231
232
|
history: HistoryRetention;
|
|
232
|
-
outcome: number;
|
|
233
233
|
refreshHorizon: number;
|
|
234
234
|
};
|
|
235
235
|
export type Discovery = {
|
|
@@ -285,26 +285,17 @@ export type BinaryFile = {
|
|
|
285
285
|
mediaType: string;
|
|
286
286
|
sha256: string;
|
|
287
287
|
};
|
|
288
|
-
export type HeldFile = {
|
|
289
|
-
readonly path: string;
|
|
290
|
-
readonly revision: string;
|
|
291
|
-
};
|
|
292
|
-
export type HeldContent = {
|
|
293
|
-
files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
|
|
294
|
-
contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
|
|
295
|
-
readonly content: string;
|
|
296
|
-
readonly revision: string;
|
|
297
|
-
}>>;
|
|
298
|
-
};
|
|
299
288
|
export type BootstrapRequest = {
|
|
300
289
|
locator: string;
|
|
301
290
|
selection: string;
|
|
302
|
-
path?: string;
|
|
303
291
|
pageToken?: PageToken;
|
|
304
|
-
held?: HeldContent;
|
|
305
292
|
arriving?: (bytes: number) => void;
|
|
306
293
|
signal?: AbortSignal;
|
|
307
294
|
};
|
|
295
|
+
export type BootstrapPart = {
|
|
296
|
+
readonly id: string;
|
|
297
|
+
readonly bytes: number;
|
|
298
|
+
};
|
|
308
299
|
export type BootstrapInventory = {
|
|
309
300
|
readonly bytes: number;
|
|
310
301
|
};
|
|
@@ -316,18 +307,23 @@ export type BootstrapPage = {
|
|
|
316
307
|
roomVersion: string;
|
|
317
308
|
models?: RoomModels;
|
|
318
309
|
documents: Readonly<Record<string, string>>;
|
|
319
|
-
|
|
310
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
320
311
|
revisions: Readonly<Record<string, string>>;
|
|
321
312
|
fileIds?: Readonly<Record<string, string>>;
|
|
313
|
+
created?: Readonly<Record<string, string>>;
|
|
322
314
|
changes: Readonly<Record<string, HeadChange>>;
|
|
323
315
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
324
316
|
folders?: readonly string[];
|
|
325
317
|
pageToken?: PageToken;
|
|
318
|
+
parts?: readonly BootstrapPart[];
|
|
326
319
|
bytes?: number;
|
|
327
320
|
};
|
|
321
|
+
export type NotReady = {
|
|
322
|
+
kind: 'not-ready';
|
|
323
|
+
};
|
|
328
324
|
export type BootstrapResult = BootstrapPage | {
|
|
329
325
|
kind: 'beyond-horizon';
|
|
330
|
-
} | AdapterFailure;
|
|
326
|
+
} | NotReady | AdapterFailure;
|
|
331
327
|
export type RefreshRequest = {
|
|
332
328
|
locator: string;
|
|
333
329
|
selection: string;
|
|
@@ -339,9 +335,10 @@ export type RefreshPage = {
|
|
|
339
335
|
roomVersion: string;
|
|
340
336
|
models?: RoomModels;
|
|
341
337
|
documents: Readonly<Record<string, string>>;
|
|
342
|
-
|
|
338
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
343
339
|
revisions: Readonly<Record<string, string>>;
|
|
344
340
|
fileIds?: Readonly<Record<string, string>>;
|
|
341
|
+
created?: Readonly<Record<string, string>>;
|
|
345
342
|
changes: Readonly<Record<string, HeadChange>>;
|
|
346
343
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
347
344
|
removals: readonly string[];
|
|
@@ -391,9 +388,6 @@ export type MutationResult = (AcceptedRoom & {
|
|
|
391
388
|
affected: Readonly<Record<string, string>>;
|
|
392
389
|
}) | RetryableRefusal | {
|
|
393
390
|
kind: 'write-halted';
|
|
394
|
-
} | {
|
|
395
|
-
kind: 'expired';
|
|
396
|
-
restored?: true;
|
|
397
391
|
} | AdapterFailure;
|
|
398
392
|
export type HistoryAuthor = {
|
|
399
393
|
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
@@ -475,14 +469,30 @@ export type ActionResult = {
|
|
|
475
469
|
} | (ProviderRefusal & {
|
|
476
470
|
kind: 'rejected';
|
|
477
471
|
}) | AdapterFailure;
|
|
472
|
+
export type SearchHit = {
|
|
473
|
+
room: string;
|
|
474
|
+
path: string;
|
|
475
|
+
line?: number;
|
|
476
|
+
snippet?: string;
|
|
477
|
+
};
|
|
478
|
+
export type SearchAsk = {
|
|
479
|
+
text: string;
|
|
480
|
+
rooms: readonly string[] | null;
|
|
481
|
+
};
|
|
482
|
+
export type SearchAnswer = {
|
|
483
|
+
kind: 'found';
|
|
484
|
+
documents: readonly SearchHit[];
|
|
485
|
+
} | (ProviderRefusal & {
|
|
486
|
+
kind: 'rejected';
|
|
487
|
+
}) | AdapterFailure;
|
|
478
488
|
export type HeldRoom = {
|
|
479
489
|
locator: string;
|
|
480
|
-
roomVersion: string;
|
|
490
|
+
roomVersion: string | null;
|
|
481
491
|
};
|
|
482
492
|
export type RoomChange = {
|
|
483
493
|
kind: 'room-change';
|
|
484
494
|
locator: string;
|
|
485
|
-
from: string;
|
|
495
|
+
from: string | null;
|
|
486
496
|
roomVersion: string;
|
|
487
497
|
read(): Promise<RefreshPage>;
|
|
488
498
|
};
|
|
@@ -514,6 +524,7 @@ export type Adapter = {
|
|
|
514
524
|
readonly localSaves?: true;
|
|
515
525
|
readonly roomTypes?: string;
|
|
516
526
|
readonly nameableRoomTypes?: readonly string[];
|
|
527
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
517
528
|
authorize(): Promise<Authorization>;
|
|
518
529
|
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
519
530
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
@@ -524,6 +535,7 @@ export type Adapter = {
|
|
|
524
535
|
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
525
536
|
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
526
537
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
538
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
527
539
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
528
540
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
529
541
|
roomStream?: RoomStream;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
1
2
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import type {
|
|
3
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
3
4
|
type Rows = DocumentResult | GroupResult;
|
|
4
5
|
export type WindowAnswer = Rows | PendingResult;
|
|
5
6
|
export type WindowChain = {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
1
2
|
import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
|
|
2
3
|
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
-
import type {
|
|
4
|
+
import type { UnsentWork } from './durability.js';
|
|
5
|
+
import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
|
|
4
6
|
import { type Observation } from './observation.js';
|
|
5
7
|
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
6
|
-
import type {
|
|
8
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
7
9
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
8
10
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
9
11
|
import type { Readiness } from './readiness.js';
|
|
@@ -32,7 +34,7 @@ export type MdRuntimeClient = {
|
|
|
32
34
|
};
|
|
33
35
|
conversation: {
|
|
34
36
|
list(): Promise<readonly ConversationEntry[]>;
|
|
35
|
-
read(conversation: string, options?:
|
|
37
|
+
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
36
38
|
create(input: unknown): Promise<CallResult>;
|
|
37
39
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
38
40
|
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
@@ -58,6 +60,8 @@ export type MdRuntimeClient = {
|
|
|
58
60
|
persistence(): Promise<boolean>;
|
|
59
61
|
retry(): Promise<void>;
|
|
60
62
|
cleanUp(): Promise<number>;
|
|
63
|
+
unsent(): Promise<readonly UnsentWork[]>;
|
|
64
|
+
reset(): Promise<void>;
|
|
61
65
|
observe: {
|
|
62
66
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
63
67
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Document } from '../mdmodel/index.js';
|
|
1
|
+
import { type Document, type TypedPath } from '../mdmodel/index.js';
|
|
2
2
|
import type { ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
4
|
export declare const MD_MODEL: MdModelIdentity;
|
|
@@ -13,6 +13,7 @@ export type Composition = {
|
|
|
13
13
|
roots: readonly string[];
|
|
14
14
|
model: ModelState;
|
|
15
15
|
} | null;
|
|
16
|
+
typedPaths: readonly TypedPath[];
|
|
16
17
|
};
|
|
17
18
|
export type Composed = {
|
|
18
19
|
readonly composition: Composition;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Connection
|
|
1
|
+
import type { Plan, QueryRows } from './query.js';
|
|
2
|
+
import type { Connection } from './tables.js';
|
|
3
3
|
export type QueryRoom = {
|
|
4
4
|
readonly locator: string;
|
|
5
5
|
readonly key: number;
|
|
6
6
|
};
|
|
7
|
-
export type Fragment = {
|
|
8
|
-
readonly sql: string;
|
|
9
|
-
readonly bind: readonly Value[];
|
|
10
|
-
};
|
|
11
7
|
export type QueryAnswer = QueryRows & {
|
|
12
8
|
readonly more?: string;
|
|
13
9
|
};
|
|
14
|
-
export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
|
|
15
10
|
export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
|