@agentxm/knowledge-query 0.28.11 → 0.28.13

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.
@@ -0,0 +1,349 @@
1
+ /**
2
+ * The typed outcome documents Knowledge discovery reports.
3
+ *
4
+ * These are the feature's contract with automation: every discovery operation
5
+ * decodes its result through the schema declared here, and the application
6
+ * only wraps them in its envelope.
7
+ *
8
+ * @experimental This API is unstable and may change without notice.
9
+ */
10
+ import * as Schema from "effect/Schema";
11
+ /** Preserve the core source mapping while validating JSON compatibility on encoding. */
12
+ export declare const FrontmatterDocumentSchema: Schema.decodeTo<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>, never, never>;
13
+ export declare const KnowledgeConceptResultSchema: Schema.Struct<{
14
+ readonly ref: Schema.Struct<{
15
+ readonly bundle: Schema.String;
16
+ readonly conceptId: Schema.String;
17
+ readonly bundleVersion: Schema.String;
18
+ readonly bundleFingerprint: Schema.String;
19
+ readonly contentRevision: Schema.String;
20
+ }>;
21
+ readonly orderingKey: Schema.String;
22
+ readonly matchedFields: Schema.$Array<Schema.String>;
23
+ readonly passages: Schema.$Array<Schema.Struct<{
24
+ readonly text: Schema.String;
25
+ readonly section: Schema.$Array<Schema.String>;
26
+ readonly startLine: Schema.Number;
27
+ readonly endLine: Schema.Number;
28
+ readonly spans: Schema.$Array<Schema.Struct<{
29
+ readonly clauseIndex: Schema.Number;
30
+ readonly field: Schema.String;
31
+ readonly start: Schema.Number;
32
+ readonly end: Schema.Number;
33
+ }>>;
34
+ }>>;
35
+ readonly kind: Schema.Literals<readonly ["concept", "index", "log"]>;
36
+ readonly title: Schema.optional<Schema.String>;
37
+ readonly description: Schema.optional<Schema.String>;
38
+ readonly status: Schema.optional<Schema.String>;
39
+ readonly staleAfter: Schema.optional<Schema.String>;
40
+ readonly generated: Schema.optional<Schema.Struct<{
41
+ readonly by: Schema.String;
42
+ readonly at: Schema.optional<Schema.String>;
43
+ }>>;
44
+ readonly verified: Schema.optional<Schema.$Array<Schema.Struct<{
45
+ readonly by: Schema.String;
46
+ readonly at: Schema.optional<Schema.String>;
47
+ }>>>;
48
+ readonly trust: Schema.optional<Schema.Literals<readonly ["unverified", "machine-confirmed", "human-reviewed"]>>;
49
+ readonly relativePath: Schema.String;
50
+ }>;
51
+ export declare const KnowledgeConceptQueryPageSchema: Schema.Struct<{
52
+ readonly query: Schema.Struct<{
53
+ readonly version: Schema.Literal<"axm-knowledge-query-v1">;
54
+ readonly scope: Schema.Literals<readonly ["project", "user"]>;
55
+ readonly clauses: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
56
+ readonly kind: Schema.Literal<"term">;
57
+ readonly value: Schema.NonEmptyString;
58
+ }>, Schema.Struct<{
59
+ readonly kind: Schema.Literal<"phrase">;
60
+ readonly value: Schema.NonEmptyString;
61
+ }>, Schema.Struct<{
62
+ readonly kind: Schema.Literal<"literal">;
63
+ readonly value: Schema.NonEmptyString;
64
+ }>]>, Schema.Struct<{
65
+ readonly kind: Schema.Literal<"field">;
66
+ readonly field: Schema.Literals<readonly ["bundle", "conceptId", "title", "description", "tag", "type", "body", "resource", "status", "staleAfter", "generated", "verified", "trust"]>;
67
+ readonly clause: Schema.Union<readonly [Schema.Struct<{
68
+ readonly kind: Schema.Literal<"term">;
69
+ readonly value: Schema.NonEmptyString;
70
+ }>, Schema.Struct<{
71
+ readonly kind: Schema.Literal<"phrase">;
72
+ readonly value: Schema.NonEmptyString;
73
+ }>, Schema.Struct<{
74
+ readonly kind: Schema.Literal<"literal">;
75
+ readonly value: Schema.NonEmptyString;
76
+ }>]>;
77
+ }>, Schema.Struct<{
78
+ readonly kind: Schema.Literal<"metadata">;
79
+ readonly field: Schema.Literals<readonly ["bundle", "conceptId", "kind", "title", "description", "tag", "type", "resource"]>;
80
+ readonly operator: Schema.Literals<readonly ["equals", "not-equals", "contains"]>;
81
+ readonly value: Schema.NonEmptyString;
82
+ }>, Schema.Struct<{
83
+ readonly kind: Schema.Literal<"lifecycle">;
84
+ readonly field: Schema.Literals<readonly ["status", "staleAfter", "generated", "verified", "trust"]>;
85
+ readonly operator: Schema.Literals<readonly ["equals", "not-equals"]>;
86
+ readonly value: Schema.NonEmptyString;
87
+ }>, Schema.Struct<{
88
+ readonly kind: Schema.Literal<"property">;
89
+ readonly pointer: Schema.NonEmptyString;
90
+ readonly operator: Schema.Literals<readonly ["equals", "not-equals", "contains"]>;
91
+ readonly value: Schema.NonEmptyString;
92
+ }>]>>;
93
+ readonly ordering: Schema.Literals<readonly ["relevance", "metadata"]>;
94
+ readonly resultLimit: Schema.Number;
95
+ readonly passageLimit: Schema.Number;
96
+ readonly passageLength: Schema.Number;
97
+ readonly cursor: Schema.optional<Schema.NonEmptyString>;
98
+ }>;
99
+ readonly corpusFingerprint: Schema.String;
100
+ readonly items: Schema.$Array<Schema.Struct<{
101
+ readonly ref: Schema.Struct<{
102
+ readonly bundle: Schema.String;
103
+ readonly conceptId: Schema.String;
104
+ readonly bundleVersion: Schema.String;
105
+ readonly bundleFingerprint: Schema.String;
106
+ readonly contentRevision: Schema.String;
107
+ }>;
108
+ readonly orderingKey: Schema.String;
109
+ readonly matchedFields: Schema.$Array<Schema.String>;
110
+ readonly passages: Schema.$Array<Schema.Struct<{
111
+ readonly text: Schema.String;
112
+ readonly section: Schema.$Array<Schema.String>;
113
+ readonly startLine: Schema.Number;
114
+ readonly endLine: Schema.Number;
115
+ readonly spans: Schema.$Array<Schema.Struct<{
116
+ readonly clauseIndex: Schema.Number;
117
+ readonly field: Schema.String;
118
+ readonly start: Schema.Number;
119
+ readonly end: Schema.Number;
120
+ }>>;
121
+ }>>;
122
+ readonly kind: Schema.Literals<readonly ["concept", "index", "log"]>;
123
+ readonly title: Schema.optional<Schema.String>;
124
+ readonly description: Schema.optional<Schema.String>;
125
+ readonly status: Schema.optional<Schema.String>;
126
+ readonly staleAfter: Schema.optional<Schema.String>;
127
+ readonly generated: Schema.optional<Schema.Struct<{
128
+ readonly by: Schema.String;
129
+ readonly at: Schema.optional<Schema.String>;
130
+ }>>;
131
+ readonly verified: Schema.optional<Schema.$Array<Schema.Struct<{
132
+ readonly by: Schema.String;
133
+ readonly at: Schema.optional<Schema.String>;
134
+ }>>>;
135
+ readonly trust: Schema.optional<Schema.Literals<readonly ["unverified", "machine-confirmed", "human-reviewed"]>>;
136
+ readonly relativePath: Schema.String;
137
+ }>>;
138
+ readonly count: Schema.Number;
139
+ readonly hasMore: Schema.Boolean;
140
+ readonly cursor: Schema.optional<Schema.String>;
141
+ readonly explanation: Schema.optional<Schema.Struct<{
142
+ readonly strategy: Schema.Literal<"lexical">;
143
+ readonly ordering: Schema.Literals<readonly ["relevance", "metadata"]>;
144
+ readonly rankFactors: Schema.$Array<Schema.Struct<{
145
+ readonly field: Schema.String;
146
+ readonly weight: Schema.Number;
147
+ }>>;
148
+ readonly tieBreak: Schema.String;
149
+ }>>;
150
+ }>;
151
+ export type KnowledgeConceptQueryPage = typeof KnowledgeConceptQueryPageSchema.Type;
152
+ export declare const KnowledgeConceptGetOutputSchema: Schema.Struct<{
153
+ readonly outcome: Schema.Literals<readonly ["found", "failed"]>;
154
+ readonly concept: Schema.optional<Schema.Struct<{
155
+ readonly ref: Schema.Struct<{
156
+ readonly bundle: Schema.String;
157
+ readonly conceptId: Schema.String;
158
+ readonly bundleVersion: Schema.String;
159
+ readonly bundleFingerprint: Schema.String;
160
+ readonly contentRevision: Schema.String;
161
+ }>;
162
+ readonly projectionRevision: Schema.String;
163
+ readonly kind: Schema.Literals<readonly ["concept", "index", "log"]>;
164
+ readonly title: Schema.optional<Schema.String>;
165
+ readonly type: Schema.optional<Schema.String>;
166
+ readonly description: Schema.optional<Schema.String>;
167
+ readonly tags: Schema.optional<Schema.$Array<Schema.String>>;
168
+ readonly resource: Schema.optional<Schema.String>;
169
+ readonly status: Schema.optional<Schema.String>;
170
+ readonly staleAfter: Schema.optional<Schema.String>;
171
+ readonly generated: Schema.optional<Schema.Struct<{
172
+ readonly by: Schema.String;
173
+ readonly at: Schema.optional<Schema.String>;
174
+ }>>;
175
+ readonly verified: Schema.optional<Schema.$Array<Schema.Struct<{
176
+ readonly by: Schema.String;
177
+ readonly at: Schema.optional<Schema.String>;
178
+ }>>>;
179
+ readonly trust: Schema.optional<Schema.Literals<readonly ["unverified", "machine-confirmed", "human-reviewed"]>>;
180
+ readonly frontmatter: Schema.optional<Schema.decodeTo<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>, never, never>>;
181
+ readonly relativePath: Schema.String;
182
+ readonly body: Schema.String;
183
+ readonly raw: Schema.optional<Schema.String>;
184
+ }>>;
185
+ readonly reason: Schema.optional<Schema.Literal<"revision-changed">>;
186
+ readonly ref: Schema.optional<Schema.Struct<{
187
+ readonly bundle: Schema.String;
188
+ readonly conceptId: Schema.String;
189
+ readonly bundleVersion: Schema.String;
190
+ readonly bundleFingerprint: Schema.String;
191
+ readonly contentRevision: Schema.String;
192
+ }>>;
193
+ readonly expectedRevision: Schema.optional<Schema.String>;
194
+ readonly currentRevision: Schema.optional<Schema.String>;
195
+ }>;
196
+ export type KnowledgeConceptGetOutput = typeof KnowledgeConceptGetOutputSchema.Type;
197
+ export declare const KnowledgeConceptResolveOutputSchema: Schema.Struct<{
198
+ readonly outcome: Schema.Literals<readonly ["resolved", "ambiguous", "not-found"]>;
199
+ readonly reason: Schema.optional<Schema.Literal<"ambiguous-reference">>;
200
+ readonly candidate: Schema.optional<Schema.Struct<{
201
+ readonly ref: Schema.Struct<{
202
+ readonly bundle: Schema.String;
203
+ readonly conceptId: Schema.String;
204
+ readonly bundleVersion: Schema.String;
205
+ readonly bundleFingerprint: Schema.String;
206
+ readonly contentRevision: Schema.String;
207
+ }>;
208
+ readonly title: Schema.optional<Schema.String>;
209
+ readonly reason: Schema.Literals<readonly ["exact-reference", "exact-concept-id", "exact-title", "token-match"]>;
210
+ readonly score: Schema.Number;
211
+ readonly orderingKey: Schema.String;
212
+ }>>;
213
+ readonly candidates: Schema.optional<Schema.$Array<Schema.Struct<{
214
+ readonly ref: Schema.Struct<{
215
+ readonly bundle: Schema.String;
216
+ readonly conceptId: Schema.String;
217
+ readonly bundleVersion: Schema.String;
218
+ readonly bundleFingerprint: Schema.String;
219
+ readonly contentRevision: Schema.String;
220
+ }>;
221
+ readonly title: Schema.optional<Schema.String>;
222
+ readonly reason: Schema.Literals<readonly ["exact-reference", "exact-concept-id", "exact-title", "token-match"]>;
223
+ readonly score: Schema.Number;
224
+ readonly orderingKey: Schema.String;
225
+ }>>>;
226
+ }>;
227
+ export type KnowledgeConceptResolveOutput = typeof KnowledgeConceptResolveOutputSchema.Type;
228
+ export declare const KnowledgeConceptRelatedOutputSchema: Schema.Struct<{
229
+ readonly ref: Schema.Struct<{
230
+ readonly bundle: Schema.String;
231
+ readonly conceptId: Schema.String;
232
+ readonly bundleVersion: Schema.String;
233
+ readonly bundleFingerprint: Schema.String;
234
+ readonly contentRevision: Schema.String;
235
+ }>;
236
+ readonly maximumDepth: Schema.Number;
237
+ readonly includesIndexBacklinks: Schema.Boolean;
238
+ readonly items: Schema.$Array<Schema.Struct<{
239
+ readonly ref: Schema.Struct<{
240
+ readonly bundle: Schema.String;
241
+ readonly conceptId: Schema.String;
242
+ readonly bundleVersion: Schema.String;
243
+ readonly bundleFingerprint: Schema.String;
244
+ readonly contentRevision: Schema.String;
245
+ }>;
246
+ readonly title: Schema.optional<Schema.String>;
247
+ readonly relation: Schema.Literals<readonly ["outgoing", "backlink"]>;
248
+ readonly depth: Schema.Number;
249
+ readonly via: Schema.Struct<{
250
+ readonly bundle: Schema.String;
251
+ readonly conceptId: Schema.String;
252
+ }>;
253
+ readonly evidence: Schema.Struct<{
254
+ readonly source: Schema.Struct<{
255
+ readonly bundle: Schema.String;
256
+ readonly conceptId: Schema.String;
257
+ }>;
258
+ readonly sourceRelativePath: Schema.String;
259
+ readonly line: Schema.Number;
260
+ }>;
261
+ readonly orderingKey: Schema.String;
262
+ }>>;
263
+ readonly count: Schema.Number;
264
+ readonly corpusFingerprint: Schema.String;
265
+ }>;
266
+ export type KnowledgeConceptRelatedOutput = typeof KnowledgeConceptRelatedOutputSchema.Type;
267
+ export declare const KnowledgeConceptStatusOutputSchema: Schema.Struct<{
268
+ readonly capabilities: Schema.Struct<{
269
+ readonly version: Schema.Literal<"axm-knowledge-discovery-capabilities-v1">;
270
+ readonly operations: Schema.$Array<Schema.Literals<readonly ["resolve", "search", "query", "get", "related", "status"]>>;
271
+ readonly queryContractVersion: Schema.Literal<"axm-knowledge-query-v1">;
272
+ readonly strategies: Schema.$Array<Schema.Literal<"lexical">>;
273
+ readonly operators: Schema.$Array<Schema.Literals<readonly ["term", "phrase", "literal", "equals", "not-equals", "contains"]>>;
274
+ readonly tokenizerProfile: Schema.Struct<{
275
+ readonly id: Schema.Literal<"axm-knowledge-lexical-v1">;
276
+ readonly unicodeNormalization: Schema.Literal<"NFKC">;
277
+ readonly caseNormalization: Schema.Literal<"unicode-case-fold">;
278
+ readonly termBoundary: Schema.Literal<"unicode-whitespace-punctuation-camel-code">;
279
+ readonly stemming: Schema.Literal<false>;
280
+ }>;
281
+ readonly searchableFields: Schema.$Array<Schema.Literals<readonly ["bundle", "conceptId", "title", "description", "tag", "type", "body", "resource", "status", "staleAfter", "generated", "verified", "trust"]>>;
282
+ readonly metadataFilterFields: Schema.$Array<Schema.Literals<readonly ["bundle", "conceptId", "kind", "title", "description", "tag", "type", "resource"]>>;
283
+ readonly lifecycleFilterFields: Schema.$Array<Schema.Literals<readonly ["status", "staleAfter", "generated", "verified", "trust"]>>;
284
+ readonly extensionProperties: Schema.Struct<{
285
+ readonly addressing: Schema.Literal<"rfc6901-json-pointer">;
286
+ readonly source: Schema.Literal<"preserved-frontmatter">;
287
+ }>;
288
+ readonly limits: Schema.Struct<{
289
+ readonly defaultPageSize: Schema.Number;
290
+ readonly maximumPageSize: Schema.Number;
291
+ readonly defaultPassagesPerResult: Schema.Number;
292
+ readonly maximumPassagesPerResult: Schema.Number;
293
+ readonly defaultPassageLength: Schema.Number;
294
+ readonly maximumPassageLength: Schema.Number;
295
+ readonly maximumTraversalDepth: Schema.Number;
296
+ readonly maximumFuzzyCandidates: Schema.Number;
297
+ }>;
298
+ readonly cursor: Schema.Struct<{
299
+ readonly mechanism: Schema.Literal<"stateless-opaque">;
300
+ readonly maximumAgeSeconds: Schema.Number;
301
+ readonly binds: Schema.$Array<Schema.Literals<readonly ["corpus-fingerprint", "canonical-query-digest", "ordering-position"]>>;
302
+ }>;
303
+ readonly output: Schema.Struct<{
304
+ readonly envelope: Schema.Literal<"axm.machine-output/result-envelope-v1">;
305
+ readonly resultLevel: Schema.Literal<"concept">;
306
+ readonly paginationKeys: Schema.$Array<Schema.Literals<readonly ["items", "count", "hasMore", "cursor"]>>;
307
+ }>;
308
+ }>;
309
+ readonly readiness: Schema.Literals<readonly ["ready", "changing", "unavailable"]>;
310
+ readonly health: Schema.Struct<{
311
+ readonly status: Schema.Literals<readonly ["healthy", "unhealthy"]>;
312
+ readonly diagnostics: Schema.$Array<Schema.String>;
313
+ }>;
314
+ readonly corpusFingerprint: Schema.optional<Schema.String>;
315
+ readonly bundleCount: Schema.Number;
316
+ readonly conceptCount: Schema.Number;
317
+ readonly scopeCollisions: Schema.Struct<{
318
+ readonly checkedScope: Schema.Literals<readonly ["project", "user"]>;
319
+ readonly state: Schema.Literals<readonly ["determined", "not-determined"]>;
320
+ readonly bundleNames: Schema.$Array<Schema.String>;
321
+ }>;
322
+ }>;
323
+ export type KnowledgeConceptStatusOutput = typeof KnowledgeConceptStatusOutputSchema.Type;
324
+ export declare const KnowledgeLintQueryResultSchema: Schema.Struct<{
325
+ readonly valid: Schema.Boolean;
326
+ readonly diagnostics: Schema.$Array<Schema.Struct<{
327
+ readonly bundle: Schema.String;
328
+ readonly code: Schema.String;
329
+ readonly severity: Schema.String;
330
+ readonly relativePath: Schema.String;
331
+ readonly line: Schema.optional<Schema.Number>;
332
+ readonly column: Schema.optional<Schema.Number>;
333
+ readonly message: Schema.String;
334
+ readonly details: Schema.optional<Schema.Struct<{
335
+ readonly kind: Schema.Literal<"frontmatter-parse">;
336
+ readonly reason: Schema.String;
337
+ }>>;
338
+ }>>;
339
+ }>;
340
+ export type KnowledgeLintQueryResult = typeof KnowledgeLintQueryResultSchema.Type;
341
+ export declare const KnowledgeConceptCursorFailureSchema: Schema.Struct<{
342
+ readonly outcome: Schema.Literal<"failed">;
343
+ readonly reason: Schema.Literal<"cursor-expired">;
344
+ }>;
345
+ export declare const KnowledgeConceptCorpusChangingFailureSchema: Schema.Struct<{
346
+ readonly outcome: Schema.Literal<"failed">;
347
+ readonly reason: Schema.Literal<"corpus-changing">;
348
+ }>;
349
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1,168 @@
1
+ /**
2
+ * The typed outcome documents Knowledge discovery reports.
3
+ *
4
+ * These are the feature's contract with automation: every discovery operation
5
+ * decodes its result through the schema declared here, and the application
6
+ * only wraps them in its envelope.
7
+ *
8
+ * @experimental This API is unstable and may change without notice.
9
+ */
10
+ import * as Effect from "effect/Effect";
11
+ import * as Schema from "effect/Schema";
12
+ import * as SchemaParser from "effect/SchemaParser";
13
+ import * as SchemaTransformation from "effect/SchemaTransformation";
14
+ import { ConceptRefSchema, KnowledgeRevisionSchema, ResolvedConceptRefSchema, } from "@agentxm/extension-model/unstable/knowledge";
15
+ import { KnowledgeDiscoveryCapabilitiesSchema } from "./knowledge-capabilities.js";
16
+ import { KnowledgeQuerySchema } from "./knowledge-query.js";
17
+ const FrontmatterWireSchema = Schema.Record(Schema.String, Schema.Json);
18
+ /** Preserve the core source mapping while validating JSON compatibility on encoding. */
19
+ export const FrontmatterDocumentSchema = FrontmatterWireSchema.pipe(Schema.decodeTo(Schema.toType(Schema.Record(Schema.String, Schema.Unknown)), SchemaTransformation.transformOrFail({
20
+ decode: (frontmatter) => Effect.succeed(frontmatter),
21
+ encode: (frontmatter) => SchemaParser.decodeUnknownEffect(FrontmatterWireSchema)(frontmatter),
22
+ })));
23
+ const KnowledgeActorSchema = Schema.Struct({
24
+ by: Schema.String,
25
+ at: Schema.optional(Schema.String),
26
+ });
27
+ const KnowledgeMatchSpanSchema = Schema.Struct({
28
+ clauseIndex: Schema.Number,
29
+ field: Schema.String,
30
+ start: Schema.Number,
31
+ end: Schema.Number,
32
+ });
33
+ const KnowledgePassageSchema = Schema.Struct({
34
+ text: Schema.String,
35
+ section: Schema.Array(Schema.String),
36
+ startLine: Schema.Number,
37
+ endLine: Schema.Number,
38
+ spans: Schema.Array(KnowledgeMatchSpanSchema),
39
+ });
40
+ export const KnowledgeConceptResultSchema = Schema.Struct({
41
+ ref: ResolvedConceptRefSchema,
42
+ orderingKey: Schema.String,
43
+ matchedFields: Schema.Array(Schema.String),
44
+ passages: Schema.Array(KnowledgePassageSchema),
45
+ kind: Schema.Literals(["concept", "index", "log"]),
46
+ title: Schema.optional(Schema.String),
47
+ description: Schema.optional(Schema.String),
48
+ status: Schema.optional(Schema.String),
49
+ staleAfter: Schema.optional(Schema.String),
50
+ generated: Schema.optional(KnowledgeActorSchema),
51
+ verified: Schema.optional(Schema.Array(KnowledgeActorSchema)),
52
+ trust: Schema.optional(Schema.Literals(["unverified", "machine-confirmed", "human-reviewed"])),
53
+ relativePath: Schema.String,
54
+ });
55
+ export const KnowledgeConceptQueryPageSchema = Schema.Struct({
56
+ query: KnowledgeQuerySchema,
57
+ corpusFingerprint: KnowledgeRevisionSchema,
58
+ items: Schema.Array(KnowledgeConceptResultSchema),
59
+ count: Schema.Number,
60
+ hasMore: Schema.Boolean,
61
+ cursor: Schema.optional(Schema.String),
62
+ explanation: Schema.optional(Schema.Struct({
63
+ strategy: Schema.Literal("lexical"),
64
+ ordering: Schema.Literals(["relevance", "metadata"]),
65
+ rankFactors: Schema.Array(Schema.Struct({ field: Schema.String, weight: Schema.Number })),
66
+ tieBreak: Schema.String,
67
+ })),
68
+ });
69
+ const KnowledgeConceptDocumentSchema = Schema.Struct({
70
+ ref: ResolvedConceptRefSchema,
71
+ projectionRevision: KnowledgeRevisionSchema,
72
+ kind: Schema.Literals(["concept", "index", "log"]),
73
+ title: Schema.optional(Schema.String),
74
+ type: Schema.optional(Schema.String),
75
+ description: Schema.optional(Schema.String),
76
+ tags: Schema.optional(Schema.Array(Schema.String)),
77
+ resource: Schema.optional(Schema.String),
78
+ status: Schema.optional(Schema.String),
79
+ staleAfter: Schema.optional(Schema.String),
80
+ generated: Schema.optional(KnowledgeActorSchema),
81
+ verified: Schema.optional(Schema.Array(KnowledgeActorSchema)),
82
+ trust: Schema.optional(Schema.Literals(["unverified", "machine-confirmed", "human-reviewed"])),
83
+ frontmatter: Schema.optional(FrontmatterDocumentSchema),
84
+ relativePath: Schema.String,
85
+ body: Schema.String,
86
+ raw: Schema.optional(Schema.String),
87
+ });
88
+ export const KnowledgeConceptGetOutputSchema = Schema.Struct({
89
+ outcome: Schema.Literals(["found", "failed"]),
90
+ concept: Schema.optional(KnowledgeConceptDocumentSchema),
91
+ reason: Schema.optional(Schema.Literal("revision-changed")),
92
+ ref: Schema.optional(ResolvedConceptRefSchema),
93
+ expectedRevision: Schema.optional(KnowledgeRevisionSchema),
94
+ currentRevision: Schema.optional(KnowledgeRevisionSchema),
95
+ });
96
+ const KnowledgeResolveCandidateSchema = Schema.Struct({
97
+ ref: ResolvedConceptRefSchema,
98
+ title: Schema.optional(Schema.String),
99
+ reason: Schema.Literals(["exact-reference", "exact-concept-id", "exact-title", "token-match"]),
100
+ score: Schema.Number,
101
+ orderingKey: Schema.String,
102
+ });
103
+ export const KnowledgeConceptResolveOutputSchema = Schema.Struct({
104
+ outcome: Schema.Literals(["resolved", "ambiguous", "not-found"]),
105
+ reason: Schema.optional(Schema.Literal("ambiguous-reference")),
106
+ candidate: Schema.optional(KnowledgeResolveCandidateSchema),
107
+ candidates: Schema.optional(Schema.Array(KnowledgeResolveCandidateSchema)),
108
+ });
109
+ const KnowledgeRelatedConceptSchema = Schema.Struct({
110
+ ref: ResolvedConceptRefSchema,
111
+ title: Schema.optional(Schema.String),
112
+ relation: Schema.Literals(["outgoing", "backlink"]),
113
+ depth: Schema.Number,
114
+ via: ConceptRefSchema,
115
+ evidence: Schema.Struct({
116
+ source: ConceptRefSchema,
117
+ sourceRelativePath: Schema.String,
118
+ line: Schema.Number,
119
+ }),
120
+ orderingKey: Schema.String,
121
+ });
122
+ export const KnowledgeConceptRelatedOutputSchema = Schema.Struct({
123
+ ref: ResolvedConceptRefSchema,
124
+ maximumDepth: Schema.Number,
125
+ includesIndexBacklinks: Schema.Boolean,
126
+ items: Schema.Array(KnowledgeRelatedConceptSchema),
127
+ count: Schema.Number,
128
+ corpusFingerprint: KnowledgeRevisionSchema,
129
+ });
130
+ export const KnowledgeConceptStatusOutputSchema = Schema.Struct({
131
+ capabilities: KnowledgeDiscoveryCapabilitiesSchema,
132
+ readiness: Schema.Literals(["ready", "changing", "unavailable"]),
133
+ health: Schema.Struct({
134
+ status: Schema.Literals(["healthy", "unhealthy"]),
135
+ diagnostics: Schema.Array(Schema.String),
136
+ }),
137
+ corpusFingerprint: Schema.optional(KnowledgeRevisionSchema),
138
+ bundleCount: Schema.Number,
139
+ conceptCount: Schema.Number,
140
+ scopeCollisions: Schema.Struct({
141
+ checkedScope: Schema.Literals(["project", "user"]),
142
+ state: Schema.Literals(["determined", "not-determined"]),
143
+ bundleNames: Schema.Array(Schema.String),
144
+ }),
145
+ });
146
+ const KnowledgeLintDiagnosticSchema = Schema.Struct({
147
+ bundle: Schema.String,
148
+ code: Schema.String,
149
+ severity: Schema.String,
150
+ relativePath: Schema.String,
151
+ line: Schema.optional(Schema.Number),
152
+ column: Schema.optional(Schema.Number),
153
+ message: Schema.String,
154
+ details: Schema.optional(Schema.Struct({ kind: Schema.Literal("frontmatter-parse"), reason: Schema.String })),
155
+ });
156
+ export const KnowledgeLintQueryResultSchema = Schema.Struct({
157
+ valid: Schema.Boolean,
158
+ diagnostics: Schema.Array(KnowledgeLintDiagnosticSchema),
159
+ });
160
+ export const KnowledgeConceptCursorFailureSchema = Schema.Struct({
161
+ outcome: Schema.Literal("failed"),
162
+ reason: Schema.Literal("cursor-expired"),
163
+ });
164
+ export const KnowledgeConceptCorpusChangingFailureSchema = Schema.Struct({
165
+ outcome: Schema.Literal("failed"),
166
+ reason: Schema.Literal("corpus-changing"),
167
+ });
168
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The typed failures Knowledge discovery reports to its caller.
3
+ *
4
+ * Every one carries the facts a caller needs to recover or render: what was
5
+ * refused, and why. The CLI maps them onto exit codes and envelopes; it never
6
+ * re-derives the decision.
7
+ *
8
+ * @experimental This API is unstable and may change without notice.
9
+ */
10
+ declare const KnowledgeRequestInvalid_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
11
+ readonly _tag: "KnowledgeRequestInvalid";
12
+ } & Readonly<A>;
13
+ /** A discovery request that the published grammar or bounds refuse. */
14
+ export declare class KnowledgeRequestInvalid extends KnowledgeRequestInvalid_base<{
15
+ readonly detail: string;
16
+ }> {
17
+ }
18
+ declare const KnowledgeCorpusUnavailable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
19
+ readonly _tag: "KnowledgeCorpusUnavailable";
20
+ } & Readonly<A>;
21
+ /** The selected installed corpus could not be captured. */
22
+ export declare class KnowledgeCorpusUnavailable extends KnowledgeCorpusUnavailable_base<{
23
+ readonly reason: "desired-state-incomplete" | "bundle-not-installed" | "source-unreadable";
24
+ readonly detail: string;
25
+ readonly bundle?: string;
26
+ readonly cause?: unknown;
27
+ }> {
28
+ }
29
+ declare const KnowledgeConceptNotFound_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
30
+ readonly _tag: "KnowledgeConceptNotFound";
31
+ } & Readonly<A>;
32
+ /** An exact concept reference named nothing in the selected corpus. */
33
+ export declare class KnowledgeConceptNotFound extends KnowledgeConceptNotFound_base<{
34
+ readonly reference: string;
35
+ }> {
36
+ }
37
+ export {};
38
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The typed failures Knowledge discovery reports to its caller.
3
+ *
4
+ * Every one carries the facts a caller needs to recover or render: what was
5
+ * refused, and why. The CLI maps them onto exit codes and envelopes; it never
6
+ * re-derives the decision.
7
+ *
8
+ * @experimental This API is unstable and may change without notice.
9
+ */
10
+ import * as Data from "effect/Data";
11
+ /** A discovery request that the published grammar or bounds refuse. */
12
+ export class KnowledgeRequestInvalid extends Data.TaggedError("KnowledgeRequestInvalid") {
13
+ }
14
+ /** The selected installed corpus could not be captured. */
15
+ export class KnowledgeCorpusUnavailable extends Data.TaggedError("KnowledgeCorpusUnavailable") {
16
+ }
17
+ /** An exact concept reference named nothing in the selected corpus. */
18
+ export class KnowledgeConceptNotFound extends Data.TaggedError("KnowledgeConceptNotFound") {
19
+ }
20
+ //# sourceMappingURL=errors.js.map
@@ -3,6 +3,13 @@ export { projectKnowledgeConcepts, resolveKnowledgeFrontmatterPointer, type Know
3
3
  export { captureKnowledgeCorpus, computeKnowledgeCorpusFingerprint, computeKnowledgeProjectionRevision, computeKnowledgeSourceRevision, KnowledgeCorpusChangingError, type CapturedKnowledgeCorpus, type CapturedKnowledgeSource, type KnowledgeCorpusSource, } from "./knowledge-revision.js";
4
4
  export { KNOWLEDGE_DISCOVERY_CAPABILITIES, KNOWLEDGE_DISCOVERY_CAPABILITIES_VERSION, KnowledgeDiscoveryCapabilitiesSchema, type KnowledgeDiscoveryCapabilities, } from "./knowledge-capabilities.js";
5
5
  export { knowledgeQueryIdentity, KnowledgeQueryClauseSchema, KnowledgeQuerySchema, KnowledgeTextClauseSchema, makeKnowledgeQuery, KNOWLEDGE_DISCOVERY_OPERATIONS, KNOWLEDGE_LIFECYCLE_FILTER_FIELDS, KNOWLEDGE_METADATA_FILTER_FIELDS, KNOWLEDGE_QUERY_CONTRACT_VERSION, KNOWLEDGE_QUERY_OPERATORS, KNOWLEDGE_SEARCHABLE_FIELDS, type KnowledgeQuery, type KnowledgeQueryClause, type KnowledgeTextClause, } from "./knowledge-query.js";
6
- export { getKnowledgeIndexConcept, KnowledgeCursorInvalidError, KnowledgeIndex, makeKnowledgeIndexSnapshot, queryKnowledgeIndex, queryKnowledgeIndexResult, type KnowledgeConceptResult, type KnowledgeCursorInvalidReason, type KnowledgeIndexBundleInput, type KnowledgeIndexedConcept, type KnowledgeIndexService, type KnowledgeIndexSnapshot, type KnowledgeMatchSpan, type KnowledgeQueryPage, type KnowledgeResultPassage, } from "./knowledge-index.js";
6
+ export { getKnowledgeIndexConcept, KnowledgeCursorInvalidError, KnowledgeIndex, KNOWLEDGE_RANK_FACTORS, KNOWLEDGE_RANK_TIE_BREAK, makeKnowledgeIndexSnapshot, queryKnowledgeIndex, queryKnowledgeIndexResult, type KnowledgeConceptResult, type KnowledgeCursorInvalidReason, type KnowledgeIndexBundleInput, type KnowledgeIndexedConcept, type KnowledgeIndexService, type KnowledgeIndexSnapshot, type KnowledgeMatchSpan, type KnowledgeQueryPage, type KnowledgeResultPassage, } from "./knowledge-index.js";
7
7
  export { captureKnowledgeIndexBundles, KnowledgeCapturedSourceMissingError, type KnowledgeBundleCaptureDescriptor, } from "./knowledge-capture.js";
8
+ export { KnowledgeConceptNotFound, KnowledgeCorpusUnavailable, KnowledgeRequestInvalid, } from "./errors.js";
9
+ export { FrontmatterDocumentSchema, KnowledgeConceptCorpusChangingFailureSchema, KnowledgeConceptCursorFailureSchema, KnowledgeConceptGetOutputSchema, KnowledgeConceptQueryPageSchema, KnowledgeConceptRelatedOutputSchema, KnowledgeConceptResolveOutputSchema, KnowledgeConceptResultSchema, KnowledgeConceptStatusOutputSchema, KnowledgeLintQueryResultSchema, type KnowledgeConceptGetOutput, type KnowledgeConceptQueryPage, type KnowledgeConceptRelatedOutput, type KnowledgeConceptResolveOutput, type KnowledgeConceptStatusOutput, type KnowledgeLintQueryResult, } from "./documents.js";
10
+ export { captureInstalledKnowledgeCorpus, type CapturedInstalledBundle, type InstalledKnowledgeCorpus, } from "./corpus/installed-corpus.js";
11
+ export { reportKnowledgeCorpusStatus } from "./corpus/corpus-status.js";
12
+ export { lintKnowledge, type LintKnowledgeRequest, type LintKnowledgeResult, } from "./lint/lint-knowledge.js";
13
+ export { checkTraversalDepth, explainKnowledgeQuery, makeKnowledgeQueryRequest, makeKnowledgeSearchRequest, type KnowledgeQueryExplanation, type KnowledgeQueryRequest, type KnowledgeSearchRequest, } from "./query/request.js";
14
+ export { KnowledgeDiscovery } from "./knowledge-discovery.js";
8
15
  //# sourceMappingURL=index.d.ts.map
package/dist/src/index.js CHANGED
@@ -3,6 +3,14 @@ export { projectKnowledgeConcepts, resolveKnowledgeFrontmatterPointer, } from ".
3
3
  export { captureKnowledgeCorpus, computeKnowledgeCorpusFingerprint, computeKnowledgeProjectionRevision, computeKnowledgeSourceRevision, KnowledgeCorpusChangingError, } from "./knowledge-revision.js";
4
4
  export { KNOWLEDGE_DISCOVERY_CAPABILITIES, KNOWLEDGE_DISCOVERY_CAPABILITIES_VERSION, KnowledgeDiscoveryCapabilitiesSchema, } from "./knowledge-capabilities.js";
5
5
  export { knowledgeQueryIdentity, KnowledgeQueryClauseSchema, KnowledgeQuerySchema, KnowledgeTextClauseSchema, makeKnowledgeQuery, KNOWLEDGE_DISCOVERY_OPERATIONS, KNOWLEDGE_LIFECYCLE_FILTER_FIELDS, KNOWLEDGE_METADATA_FILTER_FIELDS, KNOWLEDGE_QUERY_CONTRACT_VERSION, KNOWLEDGE_QUERY_OPERATORS, KNOWLEDGE_SEARCHABLE_FIELDS, } from "./knowledge-query.js";
6
- export { getKnowledgeIndexConcept, KnowledgeCursorInvalidError, KnowledgeIndex, makeKnowledgeIndexSnapshot, queryKnowledgeIndex, queryKnowledgeIndexResult, } from "./knowledge-index.js";
6
+ export { getKnowledgeIndexConcept, KnowledgeCursorInvalidError, KnowledgeIndex, KNOWLEDGE_RANK_FACTORS, KNOWLEDGE_RANK_TIE_BREAK, makeKnowledgeIndexSnapshot, queryKnowledgeIndex, queryKnowledgeIndexResult, } from "./knowledge-index.js";
7
7
  export { captureKnowledgeIndexBundles, KnowledgeCapturedSourceMissingError, } from "./knowledge-capture.js";
8
+ // Typed failures, outcome documents, and the read-only application API.
9
+ export { KnowledgeConceptNotFound, KnowledgeCorpusUnavailable, KnowledgeRequestInvalid, } from "./errors.js";
10
+ export { FrontmatterDocumentSchema, KnowledgeConceptCorpusChangingFailureSchema, KnowledgeConceptCursorFailureSchema, KnowledgeConceptGetOutputSchema, KnowledgeConceptQueryPageSchema, KnowledgeConceptRelatedOutputSchema, KnowledgeConceptResolveOutputSchema, KnowledgeConceptResultSchema, KnowledgeConceptStatusOutputSchema, KnowledgeLintQueryResultSchema, } from "./documents.js";
11
+ export { captureInstalledKnowledgeCorpus, } from "./corpus/installed-corpus.js";
12
+ export { reportKnowledgeCorpusStatus } from "./corpus/corpus-status.js";
13
+ export { lintKnowledge, } from "./lint/lint-knowledge.js";
14
+ export { checkTraversalDepth, explainKnowledgeQuery, makeKnowledgeQueryRequest, makeKnowledgeSearchRequest, } from "./query/request.js";
15
+ export { KnowledgeDiscovery } from "./knowledge-discovery.js";
8
16
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import * as Schema from "effect/Schema";
2
- import { KNOWLEDGE_SEARCH_TOKENIZER_PROFILE } from "@agentxm/registry-protocol/unstable/knowledge/knowledge-search";
2
+ import { KNOWLEDGE_SEARCH_TOKENIZER_PROFILE } from "@agentxm/extension-content/knowledge";
3
3
  import { KNOWLEDGE_DISCOVERY_OPERATIONS, KNOWLEDGE_LIFECYCLE_FILTER_FIELDS, KNOWLEDGE_METADATA_FILTER_FIELDS, KNOWLEDGE_QUERY_CONTRACT_VERSION, KNOWLEDGE_QUERY_OPERATORS, KNOWLEDGE_SEARCHABLE_FIELDS, } from "./knowledge-query.js";
4
4
  export const KNOWLEDGE_DISCOVERY_CAPABILITIES_VERSION = "axm-knowledge-discovery-capabilities-v1";
5
5
  export const KnowledgeDiscoveryCapabilitiesSchema = Schema.Struct({
@@ -4,7 +4,7 @@ import * as Effect from "effect/Effect";
4
4
  import * as FileSystem from "effect/FileSystem";
5
5
  import * as Path from "effect/Path";
6
6
  import { captureKnowledgeCorpus, } from "./knowledge-revision.js";
7
- import { collectKnowledgeBundleEntries, inspectKnowledgeEntries, } from "@agentxm/registry-protocol/unstable/knowledge/okf";
7
+ import { collectKnowledgeBundleEntries, inspectKnowledgeEntries, } from "@agentxm/extension-content/knowledge";
8
8
  export class KnowledgeCapturedSourceMissingError extends Data.TaggedError("KnowledgeCapturedSourceMissingError") {
9
9
  }
10
10
  const sourceKey = (bundle, relativePath) => `${bundle.length}:${bundle}${relativePath.length}:${relativePath}`;