@agentshouse/app-bridge 0.1.0-ca12d3a8d9ae5 → 0.1.0-ca2cc2cd99f13

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.
Files changed (47) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +827 -16
  3. package/dist/mdmodel/condition.d.ts +20 -4
  4. package/dist/mdmodel/document.d.ts +2 -1
  5. package/dist/mdmodel/index.d.ts +15 -5
  6. package/dist/mdmodel/kinds.d.ts +17 -0
  7. package/dist/mdmodel/query/language.d.ts +217 -0
  8. package/dist/mdmodel/query/match.d.ts +11 -0
  9. package/dist/mdmodel/query/rows.d.ts +31 -0
  10. package/dist/mdmodel/query/sql.d.ts +38 -0
  11. package/dist/mdmodel/reserved.d.ts +4 -0
  12. package/dist/mdmodel/types.d.ts +12 -0
  13. package/dist/mdmodel/validate.d.ts +3 -2
  14. package/dist/mdruntime/adapter.d.ts +72 -51
  15. package/dist/mdruntime/chain.d.ts +2 -1
  16. package/dist/mdruntime/client.d.ts +6 -5
  17. package/dist/mdruntime/collection.d.ts +2 -4
  18. package/dist/mdruntime/compile.d.ts +1 -6
  19. package/dist/mdruntime/connection.d.ts +5 -7
  20. package/dist/mdruntime/conversation.d.ts +15 -14
  21. package/dist/mdruntime/durability.d.ts +0 -1
  22. package/dist/mdruntime/media.d.ts +1 -1
  23. package/dist/mdruntime/messages.d.ts +2 -2
  24. package/dist/mdruntime/model.d.ts +1 -3
  25. package/dist/mdruntime/observation.d.ts +2 -2
  26. package/dist/mdruntime/outcome.d.ts +0 -3
  27. package/dist/mdruntime/query.d.ts +5 -209
  28. package/dist/mdruntime/reach.d.ts +7 -7
  29. package/dist/mdruntime/readiness.d.ts +3 -17
  30. package/dist/mdruntime/recovery.d.ts +1 -0
  31. package/dist/mdruntime/replica.d.ts +3 -3
  32. package/dist/mdruntime/room-draft.d.ts +2 -1
  33. package/dist/mdruntime/search.d.ts +12 -63
  34. package/dist/mdruntime/status.d.ts +0 -4
  35. package/dist/mdruntime/store.d.ts +18 -33
  36. package/dist/mdruntime/stored.d.ts +34 -26
  37. package/dist/mdruntime/tables.d.ts +35 -44
  38. package/dist/mdruntime/wire.d.ts +1 -4
  39. package/dist/test-host.d.ts +1 -4
  40. package/dist/test-host.js +2 -27
  41. package/docs/families.md +38 -44
  42. package/package.json +1 -1
  43. package/dist/calls.d.ts +0 -704
  44. package/dist/calls.js +0 -1
  45. package/dist/mdruntime/fulltext.d.ts +0 -26
  46. package/dist/mdruntime/shared.d.ts +0 -15
  47. package/dist/mdruntime/transfer.d.ts +0 -9
@@ -76,7 +76,15 @@ export type DateCondition = {
76
76
  readonly time_zone: string;
77
77
  readonly match?: ConditionTest;
78
78
  };
79
- export type Condition = DocumentCondition | ItemCondition | CronCondition | DateCondition;
79
+ export type NotificationCondition = {
80
+ readonly on: 'notifications';
81
+ readonly match?: ConditionTest;
82
+ };
83
+ export type MessageCondition = {
84
+ readonly on: 'messages';
85
+ readonly match?: ConditionTest;
86
+ };
87
+ export type Condition = DocumentCondition | ItemCondition | CronCondition | DateCondition | NotificationCondition | MessageCondition;
80
88
  export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
81
89
  type Scalar = string | number | boolean;
82
90
  export type Fact = {
@@ -130,13 +138,18 @@ export type ItemFacts = {
130
138
  readonly value: unknown;
131
139
  } | null;
132
140
  };
141
+ export type MessageFacts = {
142
+ readonly sender: string;
143
+ readonly agent_function: string | null;
144
+ readonly path: string | null;
145
+ };
133
146
  export type Resolved = {
134
147
  readonly id: string;
135
148
  readonly member?: string;
136
149
  };
137
150
  type Truth = boolean | undefined;
138
151
  export declare function factKind(facts: ValueFacts): FactKind | null;
139
- export declare function facts(document: Document, at: {
152
+ export declare function facts(document: Pick<Document, 'type' | 'fields' | 'sections'>, at: {
140
153
  readonly id: string;
141
154
  readonly path: string;
142
155
  }, model: VerifiedModel, resolve: (target: string) => Resolved | undefined): DocumentFacts;
@@ -148,15 +161,18 @@ export declare function memberPointers(definition: Definition, memberType: strin
148
161
  export declare const DOCUMENT_PATHS: readonly string[];
149
162
  export declare const ACTOR_PATHS: readonly string[];
150
163
  export declare const ITEM_PATHS: readonly string[];
164
+ export declare const MESSAGE_PATHS: readonly string[];
151
165
  export declare function testOperators(definitions: readonly Definition[], path: string, memberType: string | null): readonly ConditionOperator[];
152
166
  export declare function actorOperators(path: string): readonly ConditionOperator[];
153
167
  export declare function itemOperators(path: string): readonly ConditionOperator[];
168
+ export declare function messageOperators(path: string): readonly ConditionOperator[];
154
169
  export declare function itemKind(path: string): FactKind | null;
155
- export declare function dated(value: unknown): value is string;
156
- export declare function instant(value: unknown): bigint | undefined;
157
170
  export declare function pointed(value: unknown, pointer: string): unknown;
158
171
  export declare function members(document: DocumentFacts, path: string): readonly string[];
159
172
  export declare function holds(test: ConditionTest, document: DocumentFacts): Truth;
173
+ export declare function inScope(scope: ConditionScope, document: Pick<DocumentFacts, 'id' | 'path' | 'type'> | null): boolean;
160
174
  export declare function fires(condition: DocumentCondition, event: DocumentEvent): boolean;
161
175
  export declare function itemFires(condition: ItemCondition, item: ItemFacts): boolean;
176
+ export declare function notificationFires(condition: NotificationCondition, notification: DocumentFacts): boolean;
177
+ export declare function messageFires(condition: MessageCondition, message: MessageFacts): boolean;
162
178
  export {};
@@ -1,9 +1,10 @@
1
1
  import { type Definition } from './definition.js';
2
2
  import { type LinkInventory } from './links.js';
3
- import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult } from './types.js';
3
+ import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, Outline, ParseResult } from './types.js';
4
4
  import { type YamlMap } from './yaml.js';
5
5
  export declare function inventoryOf(document: Document): LinkInventory;
6
6
  export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
7
+ export declare function outline(content: string, file: string): Outline;
7
8
  export declare function parse(content: string, file?: string): ParseResult;
8
9
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
9
10
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
@@ -1,20 +1,30 @@
1
- export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, pointed, prosePaths, testOperators, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './condition.js';
2
- export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, Resolved, WriteDoor, } from './condition.js';
1
+ export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, inScope, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, MESSAGE_PATHS, messageFires, messageOperators, notificationFires, pointed, prosePaths, testOperators, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './condition.js';
2
+ export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, MessageCondition, MessageFacts, NotificationCondition, Resolved, WriteDoor, } from './condition.js';
3
+ export { byCodePoint, compared, dated, fitsKind, instant, instantKey, KINDS, kindOf, } from './kinds.js';
4
+ export type { Kind, Ordering } from './kinds.js';
5
+ export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, planOf, QueryError, queryKey, } from './query/language.js';
6
+ export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupQuery, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
7
+ export { 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
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
15
+ export { apply, bodyLinks, links, outline, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
7
16
  export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
8
17
  export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
9
18
  export type { RoomTarget } from './paths.js';
10
19
  export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
11
20
  export { project } from './project.js';
12
21
  export { references } from './references.js';
22
+ export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
13
23
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
14
24
  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';
25
+ export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, Outline, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
16
26
  export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.js';
17
27
  export type { Assessment, Verdicts } from './validate.js';
18
28
  export { VERSION } from './version.js';
19
- export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
29
+ export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
20
30
  export type { FrontmatterValue } from './yaml.js';
@@ -0,0 +1,17 @@
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 dated(value: unknown): value is string;
14
+ export declare function instant(value: unknown): bigint | undefined;
15
+ export declare function instantKey(value: unknown): string | null;
16
+ export declare function byCodePoint(left: string, right: string): number;
17
+ export declare function compared(left: unknown, right: unknown, ordering: Ordering): number;
@@ -0,0 +1,217 @@
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 declare class QueryError extends Error {
204
+ readonly code: QueryErrorCode;
205
+ readonly retryable = false;
206
+ constructor(code: QueryErrorCode, at: string, problem: string);
207
+ }
208
+ type Entries = Readonly<Record<string, unknown>>;
209
+ export declare function bodied(shape: DocumentShape): boolean;
210
+ export declare function invalid(at: string, problem: string): never;
211
+ export declare function known(value: Entries, allowed: readonly string[], at: string): void;
212
+ export declare function planOf(input: unknown, facts: HeldRooms): QueryPlan;
213
+ export declare function cursorOf(values: readonly unknown[]): string;
214
+ export declare function decodedCursor(text: string): readonly unknown[] | null;
215
+ export declare function queryKey(query: unknown): string;
216
+ export declare function identityOf(plan: QueryPlan): string;
217
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Definition } from '../definition.js';
2
+ import { type QueryPlan } from './language.js';
3
+ export type Candidate = {
4
+ readonly path: string;
5
+ readonly type: string | null;
6
+ readonly fileId: string | null;
7
+ readonly fields: Readonly<Record<string, unknown>>;
8
+ readonly definition?: Definition;
9
+ readonly text: string | null;
10
+ };
11
+ 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: Definition | 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;
@@ -0,0 +1,4 @@
1
+ export declare const ROOM_DESCRIPTION = "ROOM.md";
2
+ export declare const RESERVED_NAMES: readonly string[];
3
+ export declare function isReservedName(name: string): boolean;
4
+ export declare function isDocumentPath(path: string): boolean;
@@ -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,6 +105,11 @@ export type Link = {
98
105
  readonly href: string;
99
106
  readonly target: string;
100
107
  };
108
+ export type Outline = {
109
+ readonly type: string | null;
110
+ readonly fields: Readonly<Record<string, unknown>> | null;
111
+ readonly links: readonly string[];
112
+ };
101
113
  export type Reference = {
102
114
  readonly pointer: string;
103
115
  readonly value: string;
@@ -2,7 +2,8 @@ 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 checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
5
+ type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
6
+ export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
6
7
  export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
7
8
  export declare function bodyRoomLinks(body: string): RoomReference[];
8
9
  export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
@@ -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?: Pick<ValidationContext, 'anyRoom'>): Assessment;
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;