@agentshouse/app-bridge 0.1.0-cd2d3edbf9805 → 0.1.0-cd2df7704a056
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 +826 -2
- package/dist/mdmodel/definition.d.ts +1 -1
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +17 -5
- package/dist/mdmodel/kinds.d.ts +18 -0
- package/dist/mdmodel/query/language.d.ts +222 -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 -0
- package/dist/mdmodel/validate.d.ts +4 -3
- package/dist/mdruntime/adapter.d.ts +39 -10
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/client.d.ts +9 -5
- package/dist/mdruntime/collection.d.ts +2 -1
- package/dist/mdruntime/compile.d.ts +1 -6
- package/dist/mdruntime/connection.d.ts +8 -6
- package/dist/mdruntime/conversation.d.ts +14 -8
- package/dist/mdruntime/durability.d.ts +6 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/messages.d.ts +2 -2
- package/dist/mdruntime/model.d.ts +2 -7
- package/dist/mdruntime/observation.d.ts +2 -2
- package/dist/mdruntime/query.d.ts +3 -208
- package/dist/mdruntime/reach.d.ts +6 -6
- package/dist/mdruntime/readiness.d.ts +0 -2
- package/dist/mdruntime/replica.d.ts +8 -5
- package/dist/mdruntime/room-draft.d.ts +4 -3
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/store.d.ts +5 -7
- package/dist/mdruntime/stored.d.ts +3 -4
- package/dist/mdruntime/tables.d.ts +8 -6
- package/dist/mdruntime/wire.d.ts +9 -4
- package/dist/test-host.js +1 -0
- package/docs/families.md +15 -2
- package/package.json +1 -1
- package/dist/calls.d.ts +0 -747
- package/dist/calls.js +0 -1
- package/dist/mdmodel/condition.d.ts +0 -167
- package/dist/mdruntime/fulltext.d.ts +0 -26
|
@@ -78,4 +78,4 @@ export type PointerFacts = {
|
|
|
78
78
|
export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
|
|
79
79
|
export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
|
|
80
80
|
export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
|
|
81
|
-
export declare function readSchema(text: string, provided?: VerifiedModel): VerifiedModel | Failure;
|
|
81
|
+
export declare function readSchema(text: string, provided?: VerifiedModel, checked?: boolean): VerifiedModel | Failure;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type Definition } from './definition.js';
|
|
2
|
+
import type { Candidate } from './query/match.js';
|
|
3
|
+
import type { Document, VerifiedModel } from './types.js';
|
|
4
|
+
export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
|
|
5
|
+
type Scalar = string | number | boolean;
|
|
6
|
+
export type Fact = {
|
|
7
|
+
readonly kind: FactKind;
|
|
8
|
+
readonly value: Scalar;
|
|
9
|
+
readonly member?: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'prose';
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'null';
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'unreadable';
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'list';
|
|
18
|
+
readonly items: readonly Fact[];
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: 'object';
|
|
21
|
+
readonly fields: Readonly<Record<string, Fact>>;
|
|
22
|
+
};
|
|
23
|
+
export type DocumentFacts = {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
readonly type: string | null;
|
|
27
|
+
readonly fields: Readonly<Record<string, Fact>>;
|
|
28
|
+
readonly sections: readonly string[];
|
|
29
|
+
};
|
|
30
|
+
export declare const TEXT_FIELD = "/text";
|
|
31
|
+
export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client', 'function'];
|
|
32
|
+
export type WriteDoor = (typeof WRITE_DOORS)[number];
|
|
33
|
+
export type Actor = {
|
|
34
|
+
readonly user?: string;
|
|
35
|
+
readonly site?: string;
|
|
36
|
+
readonly app?: string;
|
|
37
|
+
readonly door?: WriteDoor;
|
|
38
|
+
};
|
|
39
|
+
export type DocumentEvent = {
|
|
40
|
+
readonly before: DocumentFacts | null;
|
|
41
|
+
readonly after: DocumentFacts | null;
|
|
42
|
+
readonly changed: readonly string[];
|
|
43
|
+
readonly by: Actor;
|
|
44
|
+
readonly moved_between_rooms: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type ItemFacts = {
|
|
47
|
+
readonly delivery: string;
|
|
48
|
+
readonly source: string | null;
|
|
49
|
+
readonly address: string | null;
|
|
50
|
+
readonly container: string | null;
|
|
51
|
+
readonly author: string | null;
|
|
52
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
53
|
+
readonly json: {
|
|
54
|
+
readonly value: unknown;
|
|
55
|
+
} | null;
|
|
56
|
+
};
|
|
57
|
+
export type MessageFacts = {
|
|
58
|
+
readonly sender: string;
|
|
59
|
+
readonly agent_function: string | null;
|
|
60
|
+
readonly path: string | null;
|
|
61
|
+
};
|
|
62
|
+
export type Resolved = {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly member?: string;
|
|
65
|
+
};
|
|
66
|
+
export declare function facts(document: Pick<Document, 'type' | 'fields' | 'sections'>, at: {
|
|
67
|
+
readonly id: string;
|
|
68
|
+
readonly path: string;
|
|
69
|
+
}, model: VerifiedModel, resolve: (target: string) => Resolved | undefined): DocumentFacts;
|
|
70
|
+
export declare function prosePaths(facts: DocumentFacts): string[];
|
|
71
|
+
export declare function members(document: DocumentFacts, path: string): readonly string[];
|
|
72
|
+
export declare function pointed(value: unknown, pointer: string): unknown;
|
|
73
|
+
export declare function valuedChange(definition: Definition, pointer: string): boolean;
|
|
74
|
+
export declare function datePointers(definition: Definition): string[];
|
|
75
|
+
export declare function memberPointers(definition: Definition, memberType: string): string[];
|
|
76
|
+
export declare function candidateOf(document: DocumentFacts): Candidate;
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Document, VerifiedModel } from './types.js';
|
|
2
|
+
export type SavedFacts = {
|
|
3
|
+
readonly type: string;
|
|
4
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
5
|
+
readonly links: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
export type ReferenceTarget = {
|
|
8
|
+
readonly location: string;
|
|
9
|
+
readonly to: readonly string[];
|
|
10
|
+
readonly target: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function referenceTarget(file: string, value: string): string | null;
|
|
13
|
+
export declare function referenceTargets(document: Document, file: string, model: VerifiedModel): readonly ReferenceTarget[];
|
|
14
|
+
export declare function documentFacts(file: string, content: string, model: VerifiedModel): SavedFacts | null;
|
package/dist/mdmodel/index.d.ts
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { Actor,
|
|
1
|
+
export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
|
|
2
|
+
export type { Actor, DocumentEvent, DocumentFacts, Fact, FactKind, ItemFacts, MessageFacts, Resolved, WriteDoor, } from './event.js';
|
|
3
|
+
export { byCodePoint, compared, dated, fitsKind, instant, instantKey, KINDS, kindOf, kindWords, } from './kinds.js';
|
|
4
|
+
export type { Kind, Ordering } from './kinds.js';
|
|
5
|
+
export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
|
|
6
|
+
export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupQuery, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
|
|
7
|
+
export { heldAt, matches } from './query/match.js';
|
|
8
|
+
export type { Candidate } from './query/match.js';
|
|
9
|
+
export { heldKind, indexed } from './query/rows.js';
|
|
10
|
+
export type { HeldKind, HeldLink, HeldValue, Indexed, Reach } from './query/rows.js';
|
|
11
|
+
export * as sql from './query/sql.js';
|
|
3
12
|
export { headingLines } from './blocks.js';
|
|
4
13
|
export type { HeadingLine } from './blocks.js';
|
|
5
14
|
export { divide } from './divide.js';
|
|
6
15
|
export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
|
|
16
|
+
export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
|
|
17
|
+
export type { ReferenceTarget, SavedFacts } from './facts.js';
|
|
7
18
|
export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
8
19
|
export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
|
|
9
20
|
export type { RoomTarget } from './paths.js';
|
|
10
21
|
export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
|
|
11
22
|
export { project } from './project.js';
|
|
12
23
|
export { references } from './references.js';
|
|
24
|
+
export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
|
|
13
25
|
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
|
|
14
26
|
export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
|
|
15
|
-
export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
|
|
16
|
-
export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences,
|
|
27
|
+
export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
|
|
28
|
+
export { assess, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
|
|
17
29
|
export type { Assessment, Verdicts } from './validate.js';
|
|
18
30
|
export { VERSION } from './version.js';
|
|
19
|
-
export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
|
|
31
|
+
export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
|
|
20
32
|
export type { FrontmatterValue } from './yaml.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ValueFacts } from './definition.js';
|
|
2
|
+
export declare const KINDS: readonly ['string', 'number', 'integer', 'boolean', 'date', 'date-time', 'time', 'enum', 'reference'];
|
|
3
|
+
export type Kind = (typeof KINDS)[number];
|
|
4
|
+
export type Ordering = {
|
|
5
|
+
readonly direction: 'asc' | 'desc';
|
|
6
|
+
readonly nulls: 'first' | 'last';
|
|
7
|
+
readonly stringSort: 'lexical' | 'locale';
|
|
8
|
+
readonly locale: string | undefined;
|
|
9
|
+
readonly localeOptions: Intl.CollatorOptions | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare function kindOf(facts: ValueFacts): Kind | null;
|
|
12
|
+
export declare function fitsKind(kind: Kind, facts: ValueFacts, value: unknown): boolean;
|
|
13
|
+
export declare function kindWords(facts: ValueFacts | undefined): readonly string[];
|
|
14
|
+
export declare function dated(value: unknown): value is string;
|
|
15
|
+
export declare function instant(value: unknown): bigint | undefined;
|
|
16
|
+
export declare function instantKey(value: unknown): string | null;
|
|
17
|
+
export declare function byCodePoint(left: string, right: string): number;
|
|
18
|
+
export declare function compared(left: unknown, right: unknown, ordering: Ordering): number;
|
|
@@ -0,0 +1,222 @@
|
|
|
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
|
+
folder?: string;
|
|
41
|
+
paths?: readonly string[];
|
|
42
|
+
fileIds?: readonly string[];
|
|
43
|
+
hop?: Related & {
|
|
44
|
+
field: string;
|
|
45
|
+
};
|
|
46
|
+
backlinks?: Related & {
|
|
47
|
+
field?: string;
|
|
48
|
+
};
|
|
49
|
+
text?: string;
|
|
50
|
+
};
|
|
51
|
+
export type Key = 'room' | 'path' | 'type' | 'folder' | {
|
|
52
|
+
field: string;
|
|
53
|
+
};
|
|
54
|
+
export type Select = 'all' | {
|
|
55
|
+
fields?: 'all' | readonly string[];
|
|
56
|
+
sections?: 'all' | readonly string[];
|
|
57
|
+
preamble?: true;
|
|
58
|
+
markdown?: true;
|
|
59
|
+
backlinks?: true;
|
|
60
|
+
change?: true;
|
|
61
|
+
fileId?: true;
|
|
62
|
+
revision?: true;
|
|
63
|
+
};
|
|
64
|
+
export type OrderOptions = {
|
|
65
|
+
nulls?: 'first' | 'last';
|
|
66
|
+
stringSort?: 'lexical' | 'locale';
|
|
67
|
+
locale?: string;
|
|
68
|
+
localeOptions?: Readonly<Record<string, unknown>>;
|
|
69
|
+
};
|
|
70
|
+
export type Direction = 'asc' | 'desc';
|
|
71
|
+
export type DocumentQuery = Filter & {
|
|
72
|
+
select: Select;
|
|
73
|
+
orderBy?: readonly ({
|
|
74
|
+
by: Key;
|
|
75
|
+
direction?: Direction;
|
|
76
|
+
} & OrderOptions)[];
|
|
77
|
+
limit?: number;
|
|
78
|
+
after?: string;
|
|
79
|
+
total?: true;
|
|
80
|
+
};
|
|
81
|
+
export type GroupQuery = Filter & {
|
|
82
|
+
groupBy: readonly Exclude<Key, 'path'>[];
|
|
83
|
+
orderBy?: readonly {
|
|
84
|
+
by: 'count' | Exclude<Key, 'path'>;
|
|
85
|
+
direction?: Direction;
|
|
86
|
+
}[];
|
|
87
|
+
limit?: number;
|
|
88
|
+
after?: string;
|
|
89
|
+
total?: true;
|
|
90
|
+
};
|
|
91
|
+
export type LocalQuery = DocumentQuery | GroupQuery;
|
|
92
|
+
export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
|
|
93
|
+
export type RoomFacts = {
|
|
94
|
+
locator: string;
|
|
95
|
+
available: boolean;
|
|
96
|
+
types: readonly Definition[];
|
|
97
|
+
};
|
|
98
|
+
export type HeldRooms = {
|
|
99
|
+
listed: boolean;
|
|
100
|
+
rooms: readonly RoomFacts[];
|
|
101
|
+
};
|
|
102
|
+
export type Test = {
|
|
103
|
+
op: 'eq';
|
|
104
|
+
value: Value;
|
|
105
|
+
} | {
|
|
106
|
+
op: 'ne';
|
|
107
|
+
value: Value;
|
|
108
|
+
} | {
|
|
109
|
+
op: 'in';
|
|
110
|
+
values: readonly Value[];
|
|
111
|
+
} | {
|
|
112
|
+
op: 'nin';
|
|
113
|
+
values: readonly Value[];
|
|
114
|
+
} | {
|
|
115
|
+
op: 'range';
|
|
116
|
+
bounds: readonly (readonly ['gt' | 'gte' | 'lt' | 'lte', Value])[];
|
|
117
|
+
} | {
|
|
118
|
+
op: 'all';
|
|
119
|
+
values: readonly Value[];
|
|
120
|
+
} | {
|
|
121
|
+
op: 'size';
|
|
122
|
+
size: number;
|
|
123
|
+
} | {
|
|
124
|
+
op: 'exists';
|
|
125
|
+
exists: boolean;
|
|
126
|
+
} | {
|
|
127
|
+
op: 'prefix';
|
|
128
|
+
prefix: string;
|
|
129
|
+
};
|
|
130
|
+
export type Clause = {
|
|
131
|
+
every: readonly Clause[];
|
|
132
|
+
} | {
|
|
133
|
+
some: readonly Clause[];
|
|
134
|
+
} | {
|
|
135
|
+
field: string;
|
|
136
|
+
test: Test;
|
|
137
|
+
};
|
|
138
|
+
export type Scope = {
|
|
139
|
+
types: readonly string[] | null;
|
|
140
|
+
where: Clause | null;
|
|
141
|
+
pathPrefix: string | null;
|
|
142
|
+
};
|
|
143
|
+
export type KeyPlan = {
|
|
144
|
+
of: 'room';
|
|
145
|
+
} | {
|
|
146
|
+
of: 'path';
|
|
147
|
+
} | {
|
|
148
|
+
of: 'type';
|
|
149
|
+
} | {
|
|
150
|
+
of: 'folder';
|
|
151
|
+
} | {
|
|
152
|
+
of: 'field';
|
|
153
|
+
field: string;
|
|
154
|
+
};
|
|
155
|
+
export type DocumentShape = {
|
|
156
|
+
kind: 'documents';
|
|
157
|
+
fields: 'all' | readonly string[] | null;
|
|
158
|
+
sections: 'all' | readonly string[] | null;
|
|
159
|
+
preamble: boolean;
|
|
160
|
+
markdown: boolean;
|
|
161
|
+
backlinks: boolean;
|
|
162
|
+
change: boolean;
|
|
163
|
+
fileId: boolean;
|
|
164
|
+
revision: boolean;
|
|
165
|
+
orderBy: readonly {
|
|
166
|
+
key: KeyPlan;
|
|
167
|
+
options: OrderOptions & {
|
|
168
|
+
direction: Direction;
|
|
169
|
+
};
|
|
170
|
+
}[];
|
|
171
|
+
};
|
|
172
|
+
export type GroupShape = {
|
|
173
|
+
kind: 'groups';
|
|
174
|
+
groupBy: readonly KeyPlan[];
|
|
175
|
+
orderBy: readonly {
|
|
176
|
+
by: 'count' | number;
|
|
177
|
+
direction: Direction;
|
|
178
|
+
}[];
|
|
179
|
+
};
|
|
180
|
+
export type Continuation = {
|
|
181
|
+
text: string;
|
|
182
|
+
values: readonly unknown[] | null;
|
|
183
|
+
};
|
|
184
|
+
export type QueryPlan = {
|
|
185
|
+
key: string;
|
|
186
|
+
rooms: readonly string[] | null;
|
|
187
|
+
root: Scope;
|
|
188
|
+
folder: string | null;
|
|
189
|
+
paths: readonly string[] | null;
|
|
190
|
+
fileIds: readonly string[] | null;
|
|
191
|
+
hop: (Scope & {
|
|
192
|
+
field: string;
|
|
193
|
+
}) | null;
|
|
194
|
+
backlinks: (Scope & {
|
|
195
|
+
field: string | null;
|
|
196
|
+
}) | null;
|
|
197
|
+
text: string | null;
|
|
198
|
+
shape: DocumentShape | GroupShape;
|
|
199
|
+
limit: number | null;
|
|
200
|
+
after: Continuation | null;
|
|
201
|
+
total: boolean;
|
|
202
|
+
};
|
|
203
|
+
export type Place = readonly (string | number)[];
|
|
204
|
+
type At = Place | string;
|
|
205
|
+
export declare class QueryError extends Error {
|
|
206
|
+
readonly code: QueryErrorCode;
|
|
207
|
+
readonly place: Place;
|
|
208
|
+
readonly accepts: readonly string[];
|
|
209
|
+
readonly retryable = false;
|
|
210
|
+
constructor(code: QueryErrorCode, at: At, problem: string, accepts?: readonly string[]);
|
|
211
|
+
}
|
|
212
|
+
type Entries = Readonly<Record<string, unknown>>;
|
|
213
|
+
export declare function bodied(shape: DocumentShape): boolean;
|
|
214
|
+
export declare function invalid(at: At, problem: string, accepts?: readonly string[]): never;
|
|
215
|
+
export declare function placeText(at: Place): string;
|
|
216
|
+
export declare function known(value: Entries, allowed: readonly string[], at: At): void;
|
|
217
|
+
export declare function planOf(input: unknown, facts: HeldRooms): QueryPlan;
|
|
218
|
+
export declare function cursorOf(values: readonly unknown[]): string;
|
|
219
|
+
export declare function decodedCursor(text: string): readonly unknown[] | null;
|
|
220
|
+
export declare function queryKey(query: unknown): string;
|
|
221
|
+
export declare function identityOf(plan: QueryPlan): string;
|
|
222
|
+
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[];
|
|
@@ -2,8 +2,9 @@ import { type Definition } from './definition.js';
|
|
|
2
2
|
import type { DocumentCheck, Library, ModelVerification, 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
9
|
export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
|
|
9
10
|
type Placed = {
|
|
@@ -20,7 +21,7 @@ export type Assessment = {
|
|
|
20
21
|
readonly linked: boolean;
|
|
21
22
|
readonly sections: readonly Placed[];
|
|
22
23
|
};
|
|
23
|
-
export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?:
|
|
24
|
+
export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
|
|
24
25
|
export type Verdicts = {
|
|
25
26
|
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
26
27
|
verdict(): Validation;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
|
|
1
2
|
import type { ModelResult } from './model.js';
|
|
3
|
+
export type { SavedFacts, TypedPath };
|
|
2
4
|
import type { Open } from './open.js';
|
|
3
5
|
import type { ChangeBatch } from './change.js';
|
|
4
6
|
export type Authorization = object;
|
|
@@ -44,8 +46,9 @@ export type ListedConversation = {
|
|
|
44
46
|
outcome: string | null;
|
|
45
47
|
waiting: boolean;
|
|
46
48
|
newest: string | null;
|
|
49
|
+
processEnded: string | null;
|
|
47
50
|
};
|
|
48
|
-
export type ConversationAction = '
|
|
51
|
+
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
|
|
49
52
|
export type ConversationMessage = {
|
|
50
53
|
identity: string;
|
|
51
54
|
turn: string;
|
|
@@ -136,6 +139,10 @@ export type SessionOption = (SessionOptionNaming & {
|
|
|
136
139
|
type: 'boolean';
|
|
137
140
|
currentValue: boolean;
|
|
138
141
|
});
|
|
142
|
+
export type RunningSubagent = {
|
|
143
|
+
description: string;
|
|
144
|
+
activity: string | null;
|
|
145
|
+
};
|
|
139
146
|
export type ConversationEvent = {
|
|
140
147
|
kind: 'turn';
|
|
141
148
|
conversation: string;
|
|
@@ -161,6 +168,10 @@ export type ConversationEvent = {
|
|
|
161
168
|
kind: 'starting';
|
|
162
169
|
conversation: string;
|
|
163
170
|
step: string | null;
|
|
171
|
+
} | {
|
|
172
|
+
kind: 'subagents';
|
|
173
|
+
conversation: string;
|
|
174
|
+
subagents: readonly RunningSubagent[];
|
|
164
175
|
} | {
|
|
165
176
|
kind: 'link';
|
|
166
177
|
conversation: string;
|
|
@@ -179,6 +190,9 @@ export type ConversationEvent = {
|
|
|
179
190
|
} | {
|
|
180
191
|
kind: 'list';
|
|
181
192
|
entries: readonly ListedConversation[];
|
|
193
|
+
whole: boolean;
|
|
194
|
+
more: boolean;
|
|
195
|
+
cursor: string | null;
|
|
182
196
|
} | {
|
|
183
197
|
kind: 'listed';
|
|
184
198
|
entry: ListedConversation;
|
|
@@ -193,8 +207,10 @@ export type ListedAgent = {
|
|
|
193
207
|
};
|
|
194
208
|
export type ConversationStream = {
|
|
195
209
|
replicate(conversations: readonly string[]): void;
|
|
210
|
+
hold(cursor: string | null): void;
|
|
196
211
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
197
212
|
agents?(): Promise<readonly ListedAgent[] | null>;
|
|
213
|
+
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
198
214
|
};
|
|
199
215
|
export type ActionDeclaration = {
|
|
200
216
|
name: string;
|
|
@@ -214,7 +230,6 @@ export type HistoryRetention = {
|
|
|
214
230
|
};
|
|
215
231
|
export type Retention = {
|
|
216
232
|
history: HistoryRetention;
|
|
217
|
-
outcome: number;
|
|
218
233
|
refreshHorizon: number;
|
|
219
234
|
};
|
|
220
235
|
export type Discovery = {
|
|
@@ -300,6 +315,7 @@ export type BootstrapPage = {
|
|
|
300
315
|
roomVersion: string;
|
|
301
316
|
models?: RoomModels;
|
|
302
317
|
documents: Readonly<Record<string, string>>;
|
|
318
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
303
319
|
revisions: Readonly<Record<string, string>>;
|
|
304
320
|
fileIds?: Readonly<Record<string, string>>;
|
|
305
321
|
changes: Readonly<Record<string, HeadChange>>;
|
|
@@ -322,6 +338,7 @@ export type RefreshPage = {
|
|
|
322
338
|
roomVersion: string;
|
|
323
339
|
models?: RoomModels;
|
|
324
340
|
documents: Readonly<Record<string, string>>;
|
|
341
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
325
342
|
revisions: Readonly<Record<string, string>>;
|
|
326
343
|
fileIds?: Readonly<Record<string, string>>;
|
|
327
344
|
changes: Readonly<Record<string, HeadChange>>;
|
|
@@ -373,15 +390,9 @@ export type MutationResult = (AcceptedRoom & {
|
|
|
373
390
|
affected: Readonly<Record<string, string>>;
|
|
374
391
|
}) | RetryableRefusal | {
|
|
375
392
|
kind: 'write-halted';
|
|
376
|
-
} | {
|
|
377
|
-
kind: 'expired';
|
|
378
|
-
restored?: true;
|
|
379
393
|
} | AdapterFailure;
|
|
380
394
|
export type HistoryAuthor = {
|
|
381
|
-
kind: 'user';
|
|
382
|
-
id: string;
|
|
383
|
-
} | {
|
|
384
|
-
kind: 'site' | 'inbox' | 'app';
|
|
395
|
+
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
385
396
|
id: string;
|
|
386
397
|
name: string;
|
|
387
398
|
};
|
|
@@ -460,6 +471,22 @@ export type ActionResult = {
|
|
|
460
471
|
} | (ProviderRefusal & {
|
|
461
472
|
kind: 'rejected';
|
|
462
473
|
}) | AdapterFailure;
|
|
474
|
+
export type SearchHit = {
|
|
475
|
+
room: string;
|
|
476
|
+
path: string;
|
|
477
|
+
line?: number;
|
|
478
|
+
snippet?: string;
|
|
479
|
+
};
|
|
480
|
+
export type SearchAsk = {
|
|
481
|
+
text: string;
|
|
482
|
+
rooms: readonly string[] | null;
|
|
483
|
+
};
|
|
484
|
+
export type SearchAnswer = {
|
|
485
|
+
kind: 'found';
|
|
486
|
+
documents: readonly SearchHit[];
|
|
487
|
+
} | (ProviderRefusal & {
|
|
488
|
+
kind: 'rejected';
|
|
489
|
+
}) | AdapterFailure;
|
|
463
490
|
export type HeldRoom = {
|
|
464
491
|
locator: string;
|
|
465
492
|
roomVersion: string;
|
|
@@ -486,6 +513,7 @@ export type RoomStreamEvent = {
|
|
|
486
513
|
kind: 'closed';
|
|
487
514
|
revoked: boolean;
|
|
488
515
|
lost: boolean;
|
|
516
|
+
authorityChanged: boolean;
|
|
489
517
|
} | {
|
|
490
518
|
kind: 'caught-up';
|
|
491
519
|
expired: readonly string[];
|
|
@@ -498,6 +526,7 @@ export type Adapter = {
|
|
|
498
526
|
readonly localSaves?: true;
|
|
499
527
|
readonly roomTypes?: string;
|
|
500
528
|
readonly nameableRoomTypes?: readonly string[];
|
|
529
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
501
530
|
authorize(): Promise<Authorization>;
|
|
502
531
|
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
503
532
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
@@ -508,10 +537,10 @@ export type Adapter = {
|
|
|
508
537
|
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
509
538
|
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
510
539
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
540
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
511
541
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
512
542
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
513
543
|
roomStream?: RoomStream;
|
|
514
544
|
conversations?: ConversationStream;
|
|
515
545
|
serviceMode?: ServiceModeSignal;
|
|
516
546
|
};
|
|
517
|
-
export {};
|
|
@@ -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 = {
|