@kb-labs/mind-contracts 2.94.0 → 2.96.0

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/dist/index.d.ts CHANGED
@@ -1,95 +1,1947 @@
1
- export { A as ApiContract, a as ArtifactContractsMap, b as ArtifactExample, c as ArtifactKind, C as CommandContract, d as CommandContractsMap, P as PluginArtifactContract, e as PluginContracts, R as RestApiContract, f as RestRouteContract, S as SchemaReference, W as WorkflowContract, g as WorkflowContractsMap, h as WorkflowStepContract, i as contractsSchemaId, j as contractsVersion, p as pluginContractsManifest } from './contract-D29vlhme.js';
2
- export { MindFeedCommandInputSchema, MindFeedCommandOutputSchema, MindInitCommandInputSchema, MindPackCommandInputSchema, MindPackCommandOutputSchema, MindQueryCommandInputSchema, MindQueryCommandOutputSchema, MindQueryRequestSchema, MindQueryResponseSchema, MindUpdateCommandInputSchema, MindUpdateCommandOutputSchema, MindVerifyCommandInputSchema, MindVerifyCommandOutputSchema, MindVerifyResponseSchema, PluginContractsSchema, apiContractSchema, artifactContractSchema, artifactExampleSchema, artifactsContractMapSchema, commandContractMapSchema, commandContractSchema, parsePluginContracts, pluginContractsSchema, restApiContractSchema, restRouteContractSchema, schemaReferenceSchema, workflowContractMapSchema, workflowContractSchema, workflowStepSchema } from './schema.js';
3
- import 'zod';
1
+ import { z } from 'zod';
2
+ import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';
4
3
 
5
4
  /**
6
- * Registry configuration for Mind sync
5
+ * REST route constants for Mind.
6
+ *
7
+ * `BASE_PATH` is temporary (`/v1/plugins/mind`) for coexistence with the
8
+ * legacy plugin; it becomes `/v1/plugins/mind` at the Phase 6 rename.
7
9
  */
8
- interface MindSyncRegistryConfig {
9
- type: 'filesystem';
10
- path: string;
11
- }
10
+ declare const MIND_BASE_PATH: "/v1/plugins/mind";
11
+ declare const MIND_ROUTES: {
12
+ readonly INDEX: "/index";
13
+ readonly SEARCH: "/search";
14
+ readonly QUERY: "/query";
15
+ readonly EXPLORE: "/explore";
16
+ readonly DROP: "/index";
17
+ readonly SYNC_ADD: "/sync/add";
18
+ readonly SYNC_UPDATE: "/sync/update";
19
+ readonly SYNC_DELETE: "/sync/delete";
20
+ readonly SYNC_LIST: "/sync/list";
21
+ readonly SYNC_STATUS: "/sync/status";
22
+ readonly STATUS: "/status";
23
+ readonly HEALTH: "/health";
24
+ readonly REINDEX: "/reindex";
25
+ };
26
+ declare const MIND_FULL_ROUTES: {
27
+ readonly INDEX: "/v1/plugins/mind/index";
28
+ readonly SEARCH: "/v1/plugins/mind/search";
29
+ readonly QUERY: "/v1/plugins/mind/query";
30
+ readonly EXPLORE: "/v1/plugins/mind/explore";
31
+ readonly DROP: "/v1/plugins/mind/index";
32
+ readonly SYNC_ADD: "/v1/plugins/mind/sync/add";
33
+ readonly SYNC_UPDATE: "/v1/plugins/mind/sync/update";
34
+ readonly SYNC_DELETE: "/v1/plugins/mind/sync/delete";
35
+ readonly SYNC_LIST: "/v1/plugins/mind/sync/list";
36
+ readonly SYNC_STATUS: "/v1/plugins/mind/sync/status";
37
+ readonly STATUS: "/v1/plugins/mind/status";
38
+ readonly HEALTH: "/v1/plugins/mind/health";
39
+ readonly REINDEX: "/v1/plugins/mind/reindex";
40
+ };
41
+ /** Cache + vector-store namespace prefix; renamed to `mind:` at Phase 6. */
42
+ declare const MIND_NAMESPACE_PREFIX: "mind:";
43
+
12
44
  /**
13
- * Soft delete configuration for Mind sync
45
+ * Mind configuration (`configSection: 'mind'`).
46
+ *
47
+ * Pure wire/config types — no platform internals. `resolveMindConfig` merges a
48
+ * partial file config onto defaults so callers always get a complete config.
14
49
  */
15
- interface MindSyncSoftDeleteConfig {
16
- enabled: boolean;
17
- ttlDays: number;
18
- }
50
+
51
+ declare const ChunkConfigSchema: z.ZodObject<{
52
+ /** Target chunk size in tokens. */
53
+ maxTokens: z.ZodDefault<z.ZodNumber>;
54
+ /** Overlap between adjacent chunks, in tokens. */
55
+ overlapTokens: z.ZodDefault<z.ZodNumber>;
56
+ /** Use AST-aware chunking where a parser exists (falls back to sliding window). */
57
+ ast: z.ZodDefault<z.ZodBoolean>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ maxTokens: number;
60
+ overlapTokens: number;
61
+ ast: boolean;
62
+ }, {
63
+ maxTokens?: number | undefined;
64
+ overlapTokens?: number | undefined;
65
+ ast?: boolean | undefined;
66
+ }>;
67
+ /** Per-mode pipeline budget. Modes are configs of one pipeline, not code paths. */
68
+ declare const ModeBudgetSchema: z.ZodObject<{
69
+ /** Max chunks fed into the answer stage. */
70
+ maxChunks: z.ZodNumber;
71
+ /** Max sub-queries from decomposition (0 = no decomposition). */
72
+ maxSubqueries: z.ZodNumber;
73
+ /** Completeness-check iterations. */
74
+ maxIterations: z.ZodNumber;
75
+ /** Whether the synthesize stage calls the LLM. */
76
+ useLLM: z.ZodBoolean;
77
+ }, "strip", z.ZodTypeAny, {
78
+ maxChunks: number;
79
+ maxSubqueries: number;
80
+ maxIterations: number;
81
+ useLLM: boolean;
82
+ }, {
83
+ maxChunks: number;
84
+ maxSubqueries: number;
85
+ maxIterations: number;
86
+ useLLM: boolean;
87
+ }>;
88
+ declare const ModesConfigSchema: z.ZodObject<{
89
+ instant: z.ZodDefault<z.ZodObject<{
90
+ /** Max chunks fed into the answer stage. */
91
+ maxChunks: z.ZodNumber;
92
+ /** Max sub-queries from decomposition (0 = no decomposition). */
93
+ maxSubqueries: z.ZodNumber;
94
+ /** Completeness-check iterations. */
95
+ maxIterations: z.ZodNumber;
96
+ /** Whether the synthesize stage calls the LLM. */
97
+ useLLM: z.ZodBoolean;
98
+ }, "strip", z.ZodTypeAny, {
99
+ maxChunks: number;
100
+ maxSubqueries: number;
101
+ maxIterations: number;
102
+ useLLM: boolean;
103
+ }, {
104
+ maxChunks: number;
105
+ maxSubqueries: number;
106
+ maxIterations: number;
107
+ useLLM: boolean;
108
+ }>>;
109
+ auto: z.ZodDefault<z.ZodObject<{
110
+ /** Max chunks fed into the answer stage. */
111
+ maxChunks: z.ZodNumber;
112
+ /** Max sub-queries from decomposition (0 = no decomposition). */
113
+ maxSubqueries: z.ZodNumber;
114
+ /** Completeness-check iterations. */
115
+ maxIterations: z.ZodNumber;
116
+ /** Whether the synthesize stage calls the LLM. */
117
+ useLLM: z.ZodBoolean;
118
+ }, "strip", z.ZodTypeAny, {
119
+ maxChunks: number;
120
+ maxSubqueries: number;
121
+ maxIterations: number;
122
+ useLLM: boolean;
123
+ }, {
124
+ maxChunks: number;
125
+ maxSubqueries: number;
126
+ maxIterations: number;
127
+ useLLM: boolean;
128
+ }>>;
129
+ thinking: z.ZodDefault<z.ZodObject<{
130
+ /** Max chunks fed into the answer stage. */
131
+ maxChunks: z.ZodNumber;
132
+ /** Max sub-queries from decomposition (0 = no decomposition). */
133
+ maxSubqueries: z.ZodNumber;
134
+ /** Completeness-check iterations. */
135
+ maxIterations: z.ZodNumber;
136
+ /** Whether the synthesize stage calls the LLM. */
137
+ useLLM: z.ZodBoolean;
138
+ }, "strip", z.ZodTypeAny, {
139
+ maxChunks: number;
140
+ maxSubqueries: number;
141
+ maxIterations: number;
142
+ useLLM: boolean;
143
+ }, {
144
+ maxChunks: number;
145
+ maxSubqueries: number;
146
+ maxIterations: number;
147
+ useLLM: boolean;
148
+ }>>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ instant: {
151
+ maxChunks: number;
152
+ maxSubqueries: number;
153
+ maxIterations: number;
154
+ useLLM: boolean;
155
+ };
156
+ auto: {
157
+ maxChunks: number;
158
+ maxSubqueries: number;
159
+ maxIterations: number;
160
+ useLLM: boolean;
161
+ };
162
+ thinking: {
163
+ maxChunks: number;
164
+ maxSubqueries: number;
165
+ maxIterations: number;
166
+ useLLM: boolean;
167
+ };
168
+ }, {
169
+ instant?: {
170
+ maxChunks: number;
171
+ maxSubqueries: number;
172
+ maxIterations: number;
173
+ useLLM: boolean;
174
+ } | undefined;
175
+ auto?: {
176
+ maxChunks: number;
177
+ maxSubqueries: number;
178
+ maxIterations: number;
179
+ useLLM: boolean;
180
+ } | undefined;
181
+ thinking?: {
182
+ maxChunks: number;
183
+ maxSubqueries: number;
184
+ maxIterations: number;
185
+ useLLM: boolean;
186
+ } | undefined;
187
+ }>;
188
+ declare const RetrievalConfigSchema: z.ZodObject<{
189
+ /** Default number of results returned by `search`. */
190
+ limit: z.ZodDefault<z.ZodNumber>;
191
+ /** Reciprocal-rank-fusion constant. */
192
+ rrfK: z.ZodDefault<z.ZodNumber>;
193
+ /** Enable heuristic reranking of fused candidates. */
194
+ rerank: z.ZodDefault<z.ZodBoolean>;
195
+ /** Enable semantic dedup of retrieved chunks. */
196
+ dedup: z.ZodDefault<z.ZodBoolean>;
197
+ /**
198
+ * HyDE (Hypothetical Document Embeddings): embed an LLM-generated hypothetical
199
+ * answer instead of the raw query for the vector search (BM25 still uses the
200
+ * raw query). Trades one LLM call per query for better concept-query recall.
201
+ * Off by default — enable only where the bench A/B shows a lift.
202
+ */
203
+ hyde: z.ZodDefault<z.ZodBoolean>;
204
+ /**
205
+ * Query expansion: ask the LLM for related identifiers/synonyms and append
206
+ * them to the BM25 (lexical) query, so vocabulary mismatch between the query
207
+ * wording and the code/doc terms still surfaces lexical hits. Orthogonal to
208
+ * HyDE (which bridges the vector side). Trades one LLM call per query.
209
+ * Off by default — enable only where the bench A/B shows a lift.
210
+ */
211
+ expand: z.ZodDefault<z.ZodBoolean>;
212
+ }, "strip", z.ZodTypeAny, {
213
+ limit: number;
214
+ rrfK: number;
215
+ rerank: boolean;
216
+ dedup: boolean;
217
+ hyde: boolean;
218
+ expand: boolean;
219
+ }, {
220
+ limit?: number | undefined;
221
+ rrfK?: number | undefined;
222
+ rerank?: boolean | undefined;
223
+ dedup?: boolean | undefined;
224
+ hyde?: boolean | undefined;
225
+ expand?: boolean | undefined;
226
+ }>;
227
+ declare const ConfidenceConfigSchema: z.ZodObject<{
228
+ /** Below this, agent answers abstain in strict mode. */
229
+ floor: z.ZodDefault<z.ZodNumber>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ floor: number;
232
+ }, {
233
+ floor?: number | undefined;
234
+ }>;
19
235
  /**
20
- * Partial updates configuration for Mind sync
236
+ * Index scope. Either a single path/glob (shorthand) or an explicit
237
+ * include/exclude set. Paths are repo-relative; a bare dir means "everything
238
+ * under it". `exclude` globs are subtracted from `include` at discovery time.
239
+ *
240
+ * "core" just core/
241
+ * { include: ["core","plugins","sdk"] } those roots
242
+ * { include: ["."], exclude: ["sites/**"] } whole repo minus noise
21
243
  */
22
- interface MindSyncPartialUpdatesConfig {
23
- enabled: boolean;
244
+ declare const IndexScopeSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
245
+ include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
246
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
247
+ }, "strict", z.ZodTypeAny, {
248
+ include?: string[] | undefined;
249
+ exclude?: string[] | undefined;
250
+ }, {
251
+ include?: string[] | undefined;
252
+ exclude?: string[] | undefined;
253
+ }>]>;
254
+ type IndexScope = z.infer<typeof IndexScopeSchema>;
255
+ /** Normalized scope the engine consumes. */
256
+ interface ResolvedScope {
257
+ /** Repo-relative roots/globs to index (default: whole repo). */
258
+ include: string[];
259
+ /** Globs subtracted from the include set. */
260
+ exclude: string[];
261
+ }
262
+ /** Normalize the config/shorthand scope into `{ include, exclude }`. */
263
+ declare function resolveScope(scope: IndexScope | undefined): ResolvedScope;
264
+ declare const IndexConfigSchema: z.ZodObject<{
265
+ /** Path/glob or include/exclude set indexed into this index (CLI `--scope` overrides). */
266
+ scope: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
267
+ include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
268
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
269
+ }, "strict", z.ZodTypeAny, {
270
+ include?: string[] | undefined;
271
+ exclude?: string[] | undefined;
272
+ }, {
273
+ include?: string[] | undefined;
274
+ exclude?: string[] | undefined;
275
+ }>]>>;
276
+ /** Human label (optional, for status/UX). */
277
+ label: z.ZodOptional<z.ZodString>;
278
+ /** Per-index chunk overrides; unset fields fall back to the global `chunk`. */
279
+ chunk: z.ZodOptional<z.ZodObject<{
280
+ maxTokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
281
+ overlapTokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
282
+ ast: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ maxTokens?: number | undefined;
285
+ overlapTokens?: number | undefined;
286
+ ast?: boolean | undefined;
287
+ }, {
288
+ maxTokens?: number | undefined;
289
+ overlapTokens?: number | undefined;
290
+ ast?: boolean | undefined;
291
+ }>>;
292
+ /** Per-index retrieval overrides; unset fields fall back to global `retrieval`. */
293
+ retrieval: z.ZodOptional<z.ZodObject<{
294
+ limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
295
+ rrfK: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
296
+ rerank: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
297
+ dedup: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
298
+ hyde: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
299
+ expand: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
300
+ }, "strip", z.ZodTypeAny, {
301
+ limit?: number | undefined;
302
+ rrfK?: number | undefined;
303
+ rerank?: boolean | undefined;
304
+ dedup?: boolean | undefined;
305
+ hyde?: boolean | undefined;
306
+ expand?: boolean | undefined;
307
+ }, {
308
+ limit?: number | undefined;
309
+ rrfK?: number | undefined;
310
+ rerank?: boolean | undefined;
311
+ dedup?: boolean | undefined;
312
+ hyde?: boolean | undefined;
313
+ expand?: boolean | undefined;
314
+ }>>;
315
+ }, "strip", z.ZodTypeAny, {
316
+ scope?: string | {
317
+ include?: string[] | undefined;
318
+ exclude?: string[] | undefined;
319
+ } | undefined;
320
+ label?: string | undefined;
321
+ chunk?: {
322
+ maxTokens?: number | undefined;
323
+ overlapTokens?: number | undefined;
324
+ ast?: boolean | undefined;
325
+ } | undefined;
326
+ retrieval?: {
327
+ limit?: number | undefined;
328
+ rrfK?: number | undefined;
329
+ rerank?: boolean | undefined;
330
+ dedup?: boolean | undefined;
331
+ hyde?: boolean | undefined;
332
+ expand?: boolean | undefined;
333
+ } | undefined;
334
+ }, {
335
+ scope?: string | {
336
+ include?: string[] | undefined;
337
+ exclude?: string[] | undefined;
338
+ } | undefined;
339
+ label?: string | undefined;
340
+ chunk?: {
341
+ maxTokens?: number | undefined;
342
+ overlapTokens?: number | undefined;
343
+ ast?: boolean | undefined;
344
+ } | undefined;
345
+ retrieval?: {
346
+ limit?: number | undefined;
347
+ rrfK?: number | undefined;
348
+ rerank?: boolean | undefined;
349
+ dedup?: boolean | undefined;
350
+ hyde?: boolean | undefined;
351
+ expand?: boolean | undefined;
352
+ } | undefined;
353
+ }>;
354
+ declare const MindConfigSchema: z.ZodObject<{
355
+ /** Default index used when a command omits `--index`. */
356
+ defaultIndex: z.ZodDefault<z.ZodString>;
357
+ /** Named indexes with per-index scope + overrides. */
358
+ indexes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
359
+ /** Path/glob or include/exclude set indexed into this index (CLI `--scope` overrides). */
360
+ scope: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
361
+ include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
362
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
363
+ }, "strict", z.ZodTypeAny, {
364
+ include?: string[] | undefined;
365
+ exclude?: string[] | undefined;
366
+ }, {
367
+ include?: string[] | undefined;
368
+ exclude?: string[] | undefined;
369
+ }>]>>;
370
+ /** Human label (optional, for status/UX). */
371
+ label: z.ZodOptional<z.ZodString>;
372
+ /** Per-index chunk overrides; unset fields fall back to the global `chunk`. */
373
+ chunk: z.ZodOptional<z.ZodObject<{
374
+ maxTokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
375
+ overlapTokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
376
+ ast: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
377
+ }, "strip", z.ZodTypeAny, {
378
+ maxTokens?: number | undefined;
379
+ overlapTokens?: number | undefined;
380
+ ast?: boolean | undefined;
381
+ }, {
382
+ maxTokens?: number | undefined;
383
+ overlapTokens?: number | undefined;
384
+ ast?: boolean | undefined;
385
+ }>>;
386
+ /** Per-index retrieval overrides; unset fields fall back to global `retrieval`. */
387
+ retrieval: z.ZodOptional<z.ZodObject<{
388
+ limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
389
+ rrfK: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
390
+ rerank: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
391
+ dedup: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
392
+ hyde: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
393
+ expand: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
394
+ }, "strip", z.ZodTypeAny, {
395
+ limit?: number | undefined;
396
+ rrfK?: number | undefined;
397
+ rerank?: boolean | undefined;
398
+ dedup?: boolean | undefined;
399
+ hyde?: boolean | undefined;
400
+ expand?: boolean | undefined;
401
+ }, {
402
+ limit?: number | undefined;
403
+ rrfK?: number | undefined;
404
+ rerank?: boolean | undefined;
405
+ dedup?: boolean | undefined;
406
+ hyde?: boolean | undefined;
407
+ expand?: boolean | undefined;
408
+ }>>;
409
+ }, "strip", z.ZodTypeAny, {
410
+ scope?: string | {
411
+ include?: string[] | undefined;
412
+ exclude?: string[] | undefined;
413
+ } | undefined;
414
+ label?: string | undefined;
415
+ chunk?: {
416
+ maxTokens?: number | undefined;
417
+ overlapTokens?: number | undefined;
418
+ ast?: boolean | undefined;
419
+ } | undefined;
420
+ retrieval?: {
421
+ limit?: number | undefined;
422
+ rrfK?: number | undefined;
423
+ rerank?: boolean | undefined;
424
+ dedup?: boolean | undefined;
425
+ hyde?: boolean | undefined;
426
+ expand?: boolean | undefined;
427
+ } | undefined;
428
+ }, {
429
+ scope?: string | {
430
+ include?: string[] | undefined;
431
+ exclude?: string[] | undefined;
432
+ } | undefined;
433
+ label?: string | undefined;
434
+ chunk?: {
435
+ maxTokens?: number | undefined;
436
+ overlapTokens?: number | undefined;
437
+ ast?: boolean | undefined;
438
+ } | undefined;
439
+ retrieval?: {
440
+ limit?: number | undefined;
441
+ rrfK?: number | undefined;
442
+ rerank?: boolean | undefined;
443
+ dedup?: boolean | undefined;
444
+ hyde?: boolean | undefined;
445
+ expand?: boolean | undefined;
446
+ } | undefined;
447
+ }>>>;
448
+ chunk: z.ZodDefault<z.ZodObject<{
449
+ /** Target chunk size in tokens. */
450
+ maxTokens: z.ZodDefault<z.ZodNumber>;
451
+ /** Overlap between adjacent chunks, in tokens. */
452
+ overlapTokens: z.ZodDefault<z.ZodNumber>;
453
+ /** Use AST-aware chunking where a parser exists (falls back to sliding window). */
454
+ ast: z.ZodDefault<z.ZodBoolean>;
455
+ }, "strip", z.ZodTypeAny, {
456
+ maxTokens: number;
457
+ overlapTokens: number;
458
+ ast: boolean;
459
+ }, {
460
+ maxTokens?: number | undefined;
461
+ overlapTokens?: number | undefined;
462
+ ast?: boolean | undefined;
463
+ }>>;
464
+ retrieval: z.ZodDefault<z.ZodObject<{
465
+ /** Default number of results returned by `search`. */
466
+ limit: z.ZodDefault<z.ZodNumber>;
467
+ /** Reciprocal-rank-fusion constant. */
468
+ rrfK: z.ZodDefault<z.ZodNumber>;
469
+ /** Enable heuristic reranking of fused candidates. */
470
+ rerank: z.ZodDefault<z.ZodBoolean>;
471
+ /** Enable semantic dedup of retrieved chunks. */
472
+ dedup: z.ZodDefault<z.ZodBoolean>;
473
+ /**
474
+ * HyDE (Hypothetical Document Embeddings): embed an LLM-generated hypothetical
475
+ * answer instead of the raw query for the vector search (BM25 still uses the
476
+ * raw query). Trades one LLM call per query for better concept-query recall.
477
+ * Off by default — enable only where the bench A/B shows a lift.
478
+ */
479
+ hyde: z.ZodDefault<z.ZodBoolean>;
480
+ /**
481
+ * Query expansion: ask the LLM for related identifiers/synonyms and append
482
+ * them to the BM25 (lexical) query, so vocabulary mismatch between the query
483
+ * wording and the code/doc terms still surfaces lexical hits. Orthogonal to
484
+ * HyDE (which bridges the vector side). Trades one LLM call per query.
485
+ * Off by default — enable only where the bench A/B shows a lift.
486
+ */
487
+ expand: z.ZodDefault<z.ZodBoolean>;
488
+ }, "strip", z.ZodTypeAny, {
489
+ limit: number;
490
+ rrfK: number;
491
+ rerank: boolean;
492
+ dedup: boolean;
493
+ hyde: boolean;
494
+ expand: boolean;
495
+ }, {
496
+ limit?: number | undefined;
497
+ rrfK?: number | undefined;
498
+ rerank?: boolean | undefined;
499
+ dedup?: boolean | undefined;
500
+ hyde?: boolean | undefined;
501
+ expand?: boolean | undefined;
502
+ }>>;
503
+ modes: z.ZodDefault<z.ZodObject<{
504
+ instant: z.ZodDefault<z.ZodObject<{
505
+ /** Max chunks fed into the answer stage. */
506
+ maxChunks: z.ZodNumber;
507
+ /** Max sub-queries from decomposition (0 = no decomposition). */
508
+ maxSubqueries: z.ZodNumber;
509
+ /** Completeness-check iterations. */
510
+ maxIterations: z.ZodNumber;
511
+ /** Whether the synthesize stage calls the LLM. */
512
+ useLLM: z.ZodBoolean;
513
+ }, "strip", z.ZodTypeAny, {
514
+ maxChunks: number;
515
+ maxSubqueries: number;
516
+ maxIterations: number;
517
+ useLLM: boolean;
518
+ }, {
519
+ maxChunks: number;
520
+ maxSubqueries: number;
521
+ maxIterations: number;
522
+ useLLM: boolean;
523
+ }>>;
524
+ auto: z.ZodDefault<z.ZodObject<{
525
+ /** Max chunks fed into the answer stage. */
526
+ maxChunks: z.ZodNumber;
527
+ /** Max sub-queries from decomposition (0 = no decomposition). */
528
+ maxSubqueries: z.ZodNumber;
529
+ /** Completeness-check iterations. */
530
+ maxIterations: z.ZodNumber;
531
+ /** Whether the synthesize stage calls the LLM. */
532
+ useLLM: z.ZodBoolean;
533
+ }, "strip", z.ZodTypeAny, {
534
+ maxChunks: number;
535
+ maxSubqueries: number;
536
+ maxIterations: number;
537
+ useLLM: boolean;
538
+ }, {
539
+ maxChunks: number;
540
+ maxSubqueries: number;
541
+ maxIterations: number;
542
+ useLLM: boolean;
543
+ }>>;
544
+ thinking: z.ZodDefault<z.ZodObject<{
545
+ /** Max chunks fed into the answer stage. */
546
+ maxChunks: z.ZodNumber;
547
+ /** Max sub-queries from decomposition (0 = no decomposition). */
548
+ maxSubqueries: z.ZodNumber;
549
+ /** Completeness-check iterations. */
550
+ maxIterations: z.ZodNumber;
551
+ /** Whether the synthesize stage calls the LLM. */
552
+ useLLM: z.ZodBoolean;
553
+ }, "strip", z.ZodTypeAny, {
554
+ maxChunks: number;
555
+ maxSubqueries: number;
556
+ maxIterations: number;
557
+ useLLM: boolean;
558
+ }, {
559
+ maxChunks: number;
560
+ maxSubqueries: number;
561
+ maxIterations: number;
562
+ useLLM: boolean;
563
+ }>>;
564
+ }, "strip", z.ZodTypeAny, {
565
+ instant: {
566
+ maxChunks: number;
567
+ maxSubqueries: number;
568
+ maxIterations: number;
569
+ useLLM: boolean;
570
+ };
571
+ auto: {
572
+ maxChunks: number;
573
+ maxSubqueries: number;
574
+ maxIterations: number;
575
+ useLLM: boolean;
576
+ };
577
+ thinking: {
578
+ maxChunks: number;
579
+ maxSubqueries: number;
580
+ maxIterations: number;
581
+ useLLM: boolean;
582
+ };
583
+ }, {
584
+ instant?: {
585
+ maxChunks: number;
586
+ maxSubqueries: number;
587
+ maxIterations: number;
588
+ useLLM: boolean;
589
+ } | undefined;
590
+ auto?: {
591
+ maxChunks: number;
592
+ maxSubqueries: number;
593
+ maxIterations: number;
594
+ useLLM: boolean;
595
+ } | undefined;
596
+ thinking?: {
597
+ maxChunks: number;
598
+ maxSubqueries: number;
599
+ maxIterations: number;
600
+ useLLM: boolean;
601
+ } | undefined;
602
+ }>>;
603
+ confidence: z.ZodDefault<z.ZodObject<{
604
+ /** Below this, agent answers abstain in strict mode. */
605
+ floor: z.ZodDefault<z.ZodNumber>;
606
+ }, "strip", z.ZodTypeAny, {
607
+ floor: number;
608
+ }, {
609
+ floor?: number | undefined;
610
+ }>>;
611
+ }, "strip", z.ZodTypeAny, {
612
+ chunk: {
613
+ maxTokens: number;
614
+ overlapTokens: number;
615
+ ast: boolean;
616
+ };
617
+ retrieval: {
618
+ limit: number;
619
+ rrfK: number;
620
+ rerank: boolean;
621
+ dedup: boolean;
622
+ hyde: boolean;
623
+ expand: boolean;
624
+ };
625
+ defaultIndex: string;
626
+ indexes: Record<string, {
627
+ scope?: string | {
628
+ include?: string[] | undefined;
629
+ exclude?: string[] | undefined;
630
+ } | undefined;
631
+ label?: string | undefined;
632
+ chunk?: {
633
+ maxTokens?: number | undefined;
634
+ overlapTokens?: number | undefined;
635
+ ast?: boolean | undefined;
636
+ } | undefined;
637
+ retrieval?: {
638
+ limit?: number | undefined;
639
+ rrfK?: number | undefined;
640
+ rerank?: boolean | undefined;
641
+ dedup?: boolean | undefined;
642
+ hyde?: boolean | undefined;
643
+ expand?: boolean | undefined;
644
+ } | undefined;
645
+ }>;
646
+ modes: {
647
+ instant: {
648
+ maxChunks: number;
649
+ maxSubqueries: number;
650
+ maxIterations: number;
651
+ useLLM: boolean;
652
+ };
653
+ auto: {
654
+ maxChunks: number;
655
+ maxSubqueries: number;
656
+ maxIterations: number;
657
+ useLLM: boolean;
658
+ };
659
+ thinking: {
660
+ maxChunks: number;
661
+ maxSubqueries: number;
662
+ maxIterations: number;
663
+ useLLM: boolean;
664
+ };
665
+ };
666
+ confidence: {
667
+ floor: number;
668
+ };
669
+ }, {
670
+ chunk?: {
671
+ maxTokens?: number | undefined;
672
+ overlapTokens?: number | undefined;
673
+ ast?: boolean | undefined;
674
+ } | undefined;
675
+ retrieval?: {
676
+ limit?: number | undefined;
677
+ rrfK?: number | undefined;
678
+ rerank?: boolean | undefined;
679
+ dedup?: boolean | undefined;
680
+ hyde?: boolean | undefined;
681
+ expand?: boolean | undefined;
682
+ } | undefined;
683
+ defaultIndex?: string | undefined;
684
+ indexes?: Record<string, {
685
+ scope?: string | {
686
+ include?: string[] | undefined;
687
+ exclude?: string[] | undefined;
688
+ } | undefined;
689
+ label?: string | undefined;
690
+ chunk?: {
691
+ maxTokens?: number | undefined;
692
+ overlapTokens?: number | undefined;
693
+ ast?: boolean | undefined;
694
+ } | undefined;
695
+ retrieval?: {
696
+ limit?: number | undefined;
697
+ rrfK?: number | undefined;
698
+ rerank?: boolean | undefined;
699
+ dedup?: boolean | undefined;
700
+ hyde?: boolean | undefined;
701
+ expand?: boolean | undefined;
702
+ } | undefined;
703
+ }> | undefined;
704
+ modes?: {
705
+ instant?: {
706
+ maxChunks: number;
707
+ maxSubqueries: number;
708
+ maxIterations: number;
709
+ useLLM: boolean;
710
+ } | undefined;
711
+ auto?: {
712
+ maxChunks: number;
713
+ maxSubqueries: number;
714
+ maxIterations: number;
715
+ useLLM: boolean;
716
+ } | undefined;
717
+ thinking?: {
718
+ maxChunks: number;
719
+ maxSubqueries: number;
720
+ maxIterations: number;
721
+ useLLM: boolean;
722
+ } | undefined;
723
+ } | undefined;
724
+ confidence?: {
725
+ floor?: number | undefined;
726
+ } | undefined;
727
+ }>;
728
+ type ChunkConfig = z.infer<typeof ChunkConfigSchema>;
729
+ type RetrievalConfig = z.infer<typeof RetrievalConfigSchema>;
730
+ type IndexConfig = z.infer<typeof IndexConfigSchema>;
731
+ type MindConfig = z.infer<typeof MindConfigSchema>;
732
+ type MindConfigInput = z.input<typeof MindConfigSchema>;
733
+ type ModeBudget = z.infer<typeof ModeBudgetSchema>;
734
+ /** Chunk + retrieval settings effective for a given index, overrides applied. */
735
+ interface EffectiveIndexConfig {
736
+ /** Normalized include/exclude the engine discovers against. */
737
+ scope: ResolvedScope;
738
+ chunk: ChunkConfig;
739
+ retrieval: RetrievalConfig;
24
740
  }
25
741
  /**
26
- * Batch processing configuration for Mind sync
742
+ * Resolve the effective settings for an index: global config with the named
743
+ * index's overrides layered on top. Unknown index → global defaults.
27
744
  */
28
- interface MindSyncBatchConfig {
29
- maxSize: number;
30
- }
745
+ declare function effectiveIndexConfig(config: MindConfig, indexId: string): EffectiveIndexConfig;
31
746
  /**
32
- * Mind synchronization configuration
747
+ * Merge a partial file config onto schema defaults. Always returns a fully
748
+ * populated, validated config.
33
749
  */
34
- interface MindSyncConfig {
35
- registry: MindSyncRegistryConfig;
36
- softDelete: MindSyncSoftDeleteConfig;
37
- partialUpdates: MindSyncPartialUpdatesConfig;
38
- batch: MindSyncBatchConfig;
39
- }
750
+ declare function resolveMindConfig(input: MindConfigInput | undefined): MindConfig;
751
+
40
752
  /**
41
- * Mind source configuration
753
+ * Pipeline trace types — emitted per stage for debugging and Studio
754
+ * visualization of how a query flowed through retrieve → fuse → … → synthesize.
42
755
  */
43
- interface MindSourceConfig {
44
- id: string;
45
- paths: string[];
46
- exclude?: string[];
47
- }
756
+
757
+ declare const StageTraceSchema: z.ZodObject<{
758
+ /** Stage name, e.g. 'retrieve', 'fuse', 'rerank', 'verify', 'synthesize'. */
759
+ stage: z.ZodString;
760
+ /** Wall-clock duration of the stage, in milliseconds. */
761
+ durationMs: z.ZodNumber;
762
+ /** Number of items the stage produced (chunks, candidates, …). */
763
+ outputCount: z.ZodOptional<z.ZodNumber>;
764
+ /** Free-form, stage-specific detail (scores, weights, decisions). */
765
+ detail: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
766
+ }, "strip", z.ZodTypeAny, {
767
+ stage: string;
768
+ durationMs: number;
769
+ outputCount?: number | undefined;
770
+ detail?: Record<string, unknown> | undefined;
771
+ }, {
772
+ stage: string;
773
+ durationMs: number;
774
+ outputCount?: number | undefined;
775
+ detail?: Record<string, unknown> | undefined;
776
+ }>;
777
+ type StageTrace = z.infer<typeof StageTraceSchema>;
778
+ declare const TraceSchema: z.ZodObject<{
779
+ requestId: z.ZodString;
780
+ mode: z.ZodString;
781
+ totalMs: z.ZodNumber;
782
+ stages: z.ZodArray<z.ZodObject<{
783
+ /** Stage name, e.g. 'retrieve', 'fuse', 'rerank', 'verify', 'synthesize'. */
784
+ stage: z.ZodString;
785
+ /** Wall-clock duration of the stage, in milliseconds. */
786
+ durationMs: z.ZodNumber;
787
+ /** Number of items the stage produced (chunks, candidates, …). */
788
+ outputCount: z.ZodOptional<z.ZodNumber>;
789
+ /** Free-form, stage-specific detail (scores, weights, decisions). */
790
+ detail: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
791
+ }, "strip", z.ZodTypeAny, {
792
+ stage: string;
793
+ durationMs: number;
794
+ outputCount?: number | undefined;
795
+ detail?: Record<string, unknown> | undefined;
796
+ }, {
797
+ stage: string;
798
+ durationMs: number;
799
+ outputCount?: number | undefined;
800
+ detail?: Record<string, unknown> | undefined;
801
+ }>, "many">;
802
+ }, "strip", z.ZodTypeAny, {
803
+ requestId: string;
804
+ mode: string;
805
+ totalMs: number;
806
+ stages: {
807
+ stage: string;
808
+ durationMs: number;
809
+ outputCount?: number | undefined;
810
+ detail?: Record<string, unknown> | undefined;
811
+ }[];
812
+ }, {
813
+ requestId: string;
814
+ mode: string;
815
+ totalMs: number;
816
+ stages: {
817
+ stage: string;
818
+ durationMs: number;
819
+ outputCount?: number | undefined;
820
+ detail?: Record<string, unknown> | undefined;
821
+ }[];
822
+ }>;
823
+ type Trace = z.infer<typeof TraceSchema>;
824
+
48
825
  /**
49
- * Mind engine configuration
826
+ * Declarative CLI flag definitions for Mind commands (`defineFlags` from
827
+ * `@kb-labs/sdk`). Shared between the manifest and command handlers.
50
828
  */
51
- interface MindEngineConfig {
52
- id: string;
53
- type: string;
54
- options?: Record<string, unknown>;
55
- }
829
+ declare const indexFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
830
+ index: {
831
+ type: "string";
832
+ description: string;
833
+ examples: string[];
834
+ };
835
+ scope: {
836
+ type: "string";
837
+ description: string;
838
+ examples: string[];
839
+ };
840
+ root: {
841
+ type: "string";
842
+ description: string;
843
+ examples: string[];
844
+ };
845
+ full: {
846
+ type: "boolean";
847
+ description: string;
848
+ default: false;
849
+ };
850
+ json: {
851
+ type: "boolean";
852
+ description: string;
853
+ default: false;
854
+ };
855
+ }>;
856
+ declare const searchFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
857
+ text: {
858
+ type: "string";
859
+ description: string;
860
+ required: true;
861
+ };
862
+ index: {
863
+ type: "string";
864
+ description: string;
865
+ };
866
+ intent: {
867
+ type: "string";
868
+ description: string;
869
+ examples: string[];
870
+ };
871
+ limit: {
872
+ type: "number";
873
+ description: string;
874
+ };
875
+ snippet: {
876
+ type: "string";
877
+ description: string;
878
+ examples: string[];
879
+ };
880
+ format: {
881
+ type: "string";
882
+ description: string;
883
+ examples: string[];
884
+ };
885
+ json: {
886
+ type: "boolean";
887
+ description: string;
888
+ default: false;
889
+ };
890
+ }>;
891
+ declare const askFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
892
+ text: {
893
+ type: "string";
894
+ description: string;
895
+ required: true;
896
+ };
897
+ index: {
898
+ type: "string";
899
+ description: string;
900
+ };
901
+ mode: {
902
+ type: "string";
903
+ description: string;
904
+ examples: string[];
905
+ };
906
+ snippet: {
907
+ type: "string";
908
+ description: string;
909
+ examples: string[];
910
+ };
911
+ format: {
912
+ type: "string";
913
+ description: string;
914
+ examples: string[];
915
+ };
916
+ agent: {
917
+ type: "boolean";
918
+ description: string;
919
+ default: false;
920
+ };
921
+ json: {
922
+ type: "boolean";
923
+ description: string;
924
+ default: false;
925
+ };
926
+ }>;
927
+ declare const exploreFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
928
+ task: {
929
+ type: "string";
930
+ description: string;
931
+ required: true;
932
+ };
933
+ index: {
934
+ type: "string";
935
+ description: string;
936
+ };
937
+ limit: {
938
+ type: "number";
939
+ description: string;
940
+ };
941
+ format: {
942
+ type: "string";
943
+ description: string;
944
+ examples: string[];
945
+ };
946
+ json: {
947
+ type: "boolean";
948
+ description: string;
949
+ default: false;
950
+ };
951
+ }>;
952
+ declare const syncPathsFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
953
+ index: {
954
+ type: "string";
955
+ description: string;
956
+ };
957
+ json: {
958
+ type: "boolean";
959
+ description: string;
960
+ default: false;
961
+ };
962
+ }>;
963
+ declare const syncDeleteFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
964
+ index: {
965
+ type: "string";
966
+ description: string;
967
+ };
968
+ yes: {
969
+ type: "boolean";
970
+ description: string;
971
+ default: false;
972
+ };
973
+ json: {
974
+ type: "boolean";
975
+ description: string;
976
+ default: false;
977
+ };
978
+ }>;
979
+ declare const syncListFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
980
+ index: {
981
+ type: "string";
982
+ description: string;
983
+ };
984
+ json: {
985
+ type: "boolean";
986
+ description: string;
987
+ default: false;
988
+ };
989
+ }>;
990
+ declare const reindexFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
991
+ index: {
992
+ type: "string";
993
+ description: string;
994
+ };
995
+ full: {
996
+ type: "boolean";
997
+ description: string;
998
+ default: false;
999
+ };
1000
+ json: {
1001
+ type: "boolean";
1002
+ description: string;
1003
+ default: false;
1004
+ };
1005
+ }>;
1006
+ declare const statusFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
1007
+ index: {
1008
+ type: "string";
1009
+ description: string;
1010
+ };
1011
+ json: {
1012
+ type: "boolean";
1013
+ description: string;
1014
+ default: false;
1015
+ };
1016
+ }>;
1017
+ declare const dropFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
1018
+ index: {
1019
+ type: "string";
1020
+ description: string;
1021
+ required: true;
1022
+ };
1023
+ yes: {
1024
+ type: "boolean";
1025
+ description: string;
1026
+ default: false;
1027
+ };
1028
+ json: {
1029
+ type: "boolean";
1030
+ description: string;
1031
+ default: false;
1032
+ };
1033
+ }>;
1034
+ type IndexFlags = typeof indexFlags.infer;
1035
+ type SearchFlags = typeof searchFlags.infer;
1036
+ type AskFlags = typeof askFlags.infer;
1037
+ type ExploreFlags = typeof exploreFlags.infer;
1038
+ type SyncPathsFlags = typeof syncPathsFlags.infer;
1039
+ type SyncDeleteFlags = typeof syncDeleteFlags.infer;
1040
+ type SyncListFlags = typeof syncListFlags.infer;
1041
+ type ReindexFlags = typeof reindexFlags.infer;
1042
+ type StatusFlags = typeof statusFlags.infer;
1043
+ type DropFlags = typeof dropFlags.infer;
1044
+
56
1045
  /**
57
- * Mind scope configuration
1046
+ * Agent response contract — lean, pointers-not-payloads.
1047
+ *
1048
+ * Designed for an agent solving a task whose context must not be cluttered:
1049
+ * answer + source POINTERS (file + line range the agent can open itself) +
1050
+ * trust signals (confidence/abstained) + provenance (matchedBy) + freshness
1051
+ * (stale). Telemetry lives in `meta`. A snapshot test gates this shape.
58
1052
  */
59
- interface MindScopeConfig {
60
- id: string;
61
- sourceIds?: string[];
62
- defaultEngine?: string;
63
- include?: string[];
64
- exclude?: string[];
65
- }
1053
+
1054
+ declare const AgentQueryModeSchema: z.ZodEnum<["instant", "auto", "thinking"]>;
1055
+ type AgentQueryMode = z.infer<typeof AgentQueryModeSchema>;
1056
+ declare const AgentSourceKindSchema: z.ZodEnum<["file", "doc", "adr", "repo", "code", "config", "external"]>;
1057
+ type AgentSourceKind = z.infer<typeof AgentSourceKindSchema>;
1058
+ /** Which retrieval signal surfaced a result — the "why" + proof-of-value vs grep. */
1059
+ declare const MatchedBySchema: z.ZodEnum<["lexical", "semantic", "both"]>;
1060
+ type MatchedBy = z.infer<typeof MatchedBySchema>;
1061
+ declare const AgentWarningSchema: z.ZodObject<{
1062
+ code: z.ZodString;
1063
+ message: z.ZodString;
1064
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1065
+ }, "strip", z.ZodTypeAny, {
1066
+ code: string;
1067
+ message: string;
1068
+ details?: Record<string, unknown> | undefined;
1069
+ }, {
1070
+ code: string;
1071
+ message: string;
1072
+ details?: Record<string, unknown> | undefined;
1073
+ }>;
1074
+ type AgentWarning = z.infer<typeof AgentWarningSchema>;
1075
+ /** A source pointer. `snippet` rides only when the caller asks (`--snippet`). */
1076
+ declare const AgentSourceSchema: z.ZodObject<{
1077
+ file: z.ZodString;
1078
+ lines: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
1079
+ kind: z.ZodEnum<["file", "doc", "adr", "repo", "code", "config", "external"]>;
1080
+ matchedBy: z.ZodEnum<["lexical", "semantic", "both"]>;
1081
+ /** On-disk content drifted from the index → agent should re-read the live file. */
1082
+ stale: z.ZodBoolean;
1083
+ snippet: z.ZodOptional<z.ZodString>;
1084
+ }, "strip", z.ZodTypeAny, {
1085
+ file: string;
1086
+ lines: [number, number];
1087
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1088
+ matchedBy: "lexical" | "semantic" | "both";
1089
+ stale: boolean;
1090
+ snippet?: string | undefined;
1091
+ }, {
1092
+ file: string;
1093
+ lines: [number, number];
1094
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1095
+ matchedBy: "lexical" | "semantic" | "both";
1096
+ stale: boolean;
1097
+ snippet?: string | undefined;
1098
+ }>;
1099
+ type AgentSource = z.infer<typeof AgentSourceSchema>;
1100
+ /** Telemetry container — agents ignore it; humans/observability use it. */
1101
+ declare const AgentMetaSchema: z.ZodObject<{
1102
+ requestId: z.ZodString;
1103
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1104
+ timingMs: z.ZodNumber;
1105
+ indexId: z.ZodString;
1106
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1107
+ requestId: z.ZodString;
1108
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1109
+ timingMs: z.ZodNumber;
1110
+ indexId: z.ZodString;
1111
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1112
+ requestId: z.ZodString;
1113
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1114
+ timingMs: z.ZodNumber;
1115
+ indexId: z.ZodString;
1116
+ }, z.ZodTypeAny, "passthrough">>;
1117
+ type AgentMeta = z.infer<typeof AgentMetaSchema>;
1118
+ declare const AgentResponseSchema: z.ZodObject<{
1119
+ answer: z.ZodString;
1120
+ confidence: z.ZodNumber;
1121
+ /** True when confidence is below floor / no usable sources — do not trust the answer. */
1122
+ abstained: z.ZodBoolean;
1123
+ sources: z.ZodArray<z.ZodObject<{
1124
+ file: z.ZodString;
1125
+ lines: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
1126
+ kind: z.ZodEnum<["file", "doc", "adr", "repo", "code", "config", "external"]>;
1127
+ matchedBy: z.ZodEnum<["lexical", "semantic", "both"]>;
1128
+ /** On-disk content drifted from the index → agent should re-read the live file. */
1129
+ stale: z.ZodBoolean;
1130
+ snippet: z.ZodOptional<z.ZodString>;
1131
+ }, "strip", z.ZodTypeAny, {
1132
+ file: string;
1133
+ lines: [number, number];
1134
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1135
+ matchedBy: "lexical" | "semantic" | "both";
1136
+ stale: boolean;
1137
+ snippet?: string | undefined;
1138
+ }, {
1139
+ file: string;
1140
+ lines: [number, number];
1141
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1142
+ matchedBy: "lexical" | "semantic" | "both";
1143
+ stale: boolean;
1144
+ snippet?: string | undefined;
1145
+ }>, "many">;
1146
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
1147
+ code: z.ZodString;
1148
+ message: z.ZodString;
1149
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1150
+ }, "strip", z.ZodTypeAny, {
1151
+ code: string;
1152
+ message: string;
1153
+ details?: Record<string, unknown> | undefined;
1154
+ }, {
1155
+ code: string;
1156
+ message: string;
1157
+ details?: Record<string, unknown> | undefined;
1158
+ }>, "many">>;
1159
+ meta: z.ZodObject<{
1160
+ requestId: z.ZodString;
1161
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1162
+ timingMs: z.ZodNumber;
1163
+ indexId: z.ZodString;
1164
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1165
+ requestId: z.ZodString;
1166
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1167
+ timingMs: z.ZodNumber;
1168
+ indexId: z.ZodString;
1169
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1170
+ requestId: z.ZodString;
1171
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1172
+ timingMs: z.ZodNumber;
1173
+ indexId: z.ZodString;
1174
+ }, z.ZodTypeAny, "passthrough">>;
1175
+ }, "strip", z.ZodTypeAny, {
1176
+ confidence: number;
1177
+ answer: string;
1178
+ abstained: boolean;
1179
+ sources: {
1180
+ file: string;
1181
+ lines: [number, number];
1182
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1183
+ matchedBy: "lexical" | "semantic" | "both";
1184
+ stale: boolean;
1185
+ snippet?: string | undefined;
1186
+ }[];
1187
+ meta: {
1188
+ requestId: string;
1189
+ mode: "instant" | "auto" | "thinking";
1190
+ timingMs: number;
1191
+ indexId: string;
1192
+ } & {
1193
+ [k: string]: unknown;
1194
+ };
1195
+ warnings?: {
1196
+ code: string;
1197
+ message: string;
1198
+ details?: Record<string, unknown> | undefined;
1199
+ }[] | undefined;
1200
+ }, {
1201
+ confidence: number;
1202
+ answer: string;
1203
+ abstained: boolean;
1204
+ sources: {
1205
+ file: string;
1206
+ lines: [number, number];
1207
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1208
+ matchedBy: "lexical" | "semantic" | "both";
1209
+ stale: boolean;
1210
+ snippet?: string | undefined;
1211
+ }[];
1212
+ meta: {
1213
+ requestId: string;
1214
+ mode: "instant" | "auto" | "thinking";
1215
+ timingMs: number;
1216
+ indexId: string;
1217
+ } & {
1218
+ [k: string]: unknown;
1219
+ };
1220
+ warnings?: {
1221
+ code: string;
1222
+ message: string;
1223
+ details?: Record<string, unknown> | undefined;
1224
+ }[] | undefined;
1225
+ }>;
1226
+ type AgentResponse = z.infer<typeof AgentResponseSchema>;
1227
+ declare const AgentErrorResponseSchema: z.ZodObject<{
1228
+ error: z.ZodObject<{
1229
+ code: z.ZodString;
1230
+ message: z.ZodString;
1231
+ recoverable: z.ZodBoolean;
1232
+ }, "strip", z.ZodTypeAny, {
1233
+ code: string;
1234
+ message: string;
1235
+ recoverable: boolean;
1236
+ }, {
1237
+ code: string;
1238
+ message: string;
1239
+ recoverable: boolean;
1240
+ }>;
1241
+ meta: z.ZodObject<{
1242
+ requestId: z.ZodString;
1243
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1244
+ timingMs: z.ZodNumber;
1245
+ indexId: z.ZodString;
1246
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1247
+ requestId: z.ZodString;
1248
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1249
+ timingMs: z.ZodNumber;
1250
+ indexId: z.ZodString;
1251
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1252
+ requestId: z.ZodString;
1253
+ mode: z.ZodEnum<["instant", "auto", "thinking"]>;
1254
+ timingMs: z.ZodNumber;
1255
+ indexId: z.ZodString;
1256
+ }, z.ZodTypeAny, "passthrough">>;
1257
+ }, "strip", z.ZodTypeAny, {
1258
+ meta: {
1259
+ requestId: string;
1260
+ mode: "instant" | "auto" | "thinking";
1261
+ timingMs: number;
1262
+ indexId: string;
1263
+ } & {
1264
+ [k: string]: unknown;
1265
+ };
1266
+ error: {
1267
+ code: string;
1268
+ message: string;
1269
+ recoverable: boolean;
1270
+ };
1271
+ }, {
1272
+ meta: {
1273
+ requestId: string;
1274
+ mode: "instant" | "auto" | "thinking";
1275
+ timingMs: number;
1276
+ indexId: string;
1277
+ } & {
1278
+ [k: string]: unknown;
1279
+ };
1280
+ error: {
1281
+ code: string;
1282
+ message: string;
1283
+ recoverable: boolean;
1284
+ };
1285
+ }>;
1286
+ type AgentErrorResponse = z.infer<typeof AgentErrorResponseSchema>;
1287
+ /** Confidence bands (used by the task-rag skill to decide trust). */
1288
+ declare const CONFIDENCE_THRESHOLDS: {
1289
+ readonly high: 0.8;
1290
+ readonly medium: 0.6;
1291
+ readonly low: 0.3;
1292
+ };
1293
+
66
1294
  /**
67
- * Mind defaults configuration
1295
+ * `search` wire contract (CLI `mind search` / REST `POST /search`).
1296
+ *
1297
+ * Lean, sources-first: ordered pointers (no raw score — order is the rank),
1298
+ * with provenance (`matchedBy`) and freshness (`stale`). Telemetry in `meta`.
68
1299
  */
69
- interface MindDefaultsConfig {
70
- fallbackEngineId?: string;
71
- }
1300
+
1301
+ /** How much source text rides in the response (context-economy knob). */
1302
+ declare const SnippetModeSchema: z.ZodEnum<["none", "line", "full"]>;
1303
+ type SnippetMode = z.infer<typeof SnippetModeSchema>;
1304
+ declare const SearchRequestSchema: z.ZodObject<{
1305
+ text: z.ZodString;
1306
+ indexId: z.ZodOptional<z.ZodString>;
1307
+ /** Optional query-intent hint for adaptive fusion weights. */
1308
+ intent: z.ZodOptional<z.ZodEnum<["lookup", "concept", "architecture"]>>;
1309
+ limit: z.ZodOptional<z.ZodNumber>;
1310
+ snippet: z.ZodOptional<z.ZodEnum<["none", "line", "full"]>>;
1311
+ }, "strip", z.ZodTypeAny, {
1312
+ text: string;
1313
+ limit?: number | undefined;
1314
+ intent?: "lookup" | "concept" | "architecture" | undefined;
1315
+ snippet?: "full" | "none" | "line" | undefined;
1316
+ indexId?: string | undefined;
1317
+ }, {
1318
+ text: string;
1319
+ limit?: number | undefined;
1320
+ intent?: "lookup" | "concept" | "architecture" | undefined;
1321
+ snippet?: "full" | "none" | "line" | undefined;
1322
+ indexId?: string | undefined;
1323
+ }>;
1324
+ type SearchRequest = z.infer<typeof SearchRequestSchema>;
1325
+ declare const SearchResultSchema: z.ZodObject<{
1326
+ file: z.ZodString;
1327
+ lines: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
1328
+ kind: z.ZodEnum<["file", "doc", "adr", "repo", "code", "config", "external"]>;
1329
+ matchedBy: z.ZodEnum<["lexical", "semantic", "both"]>;
1330
+ stale: z.ZodBoolean;
1331
+ snippet: z.ZodOptional<z.ZodString>;
1332
+ }, "strip", z.ZodTypeAny, {
1333
+ file: string;
1334
+ lines: [number, number];
1335
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1336
+ matchedBy: "lexical" | "semantic" | "both";
1337
+ stale: boolean;
1338
+ snippet?: string | undefined;
1339
+ }, {
1340
+ file: string;
1341
+ lines: [number, number];
1342
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1343
+ matchedBy: "lexical" | "semantic" | "both";
1344
+ stale: boolean;
1345
+ snippet?: string | undefined;
1346
+ }>;
1347
+ type SearchResult = z.infer<typeof SearchResultSchema>;
1348
+ declare const SearchMetaSchema: z.ZodObject<{
1349
+ requestId: z.ZodString;
1350
+ timingMs: z.ZodNumber;
1351
+ /** Share of results found semantic-only (grep would miss) — proof of value. */
1352
+ semanticWinRate: z.ZodNumber;
1353
+ /** How many returned results have drifted on disk since indexing. */
1354
+ staleCount: z.ZodNumber;
1355
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1356
+ requestId: z.ZodString;
1357
+ timingMs: z.ZodNumber;
1358
+ /** Share of results found semantic-only (grep would miss) — proof of value. */
1359
+ semanticWinRate: z.ZodNumber;
1360
+ /** How many returned results have drifted on disk since indexing. */
1361
+ staleCount: z.ZodNumber;
1362
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1363
+ requestId: z.ZodString;
1364
+ timingMs: z.ZodNumber;
1365
+ /** Share of results found semantic-only (grep would miss) — proof of value. */
1366
+ semanticWinRate: z.ZodNumber;
1367
+ /** How many returned results have drifted on disk since indexing. */
1368
+ staleCount: z.ZodNumber;
1369
+ }, z.ZodTypeAny, "passthrough">>;
1370
+ type SearchMeta = z.infer<typeof SearchMetaSchema>;
1371
+ declare const SearchResponseSchema: z.ZodObject<{
1372
+ results: z.ZodArray<z.ZodObject<{
1373
+ file: z.ZodString;
1374
+ lines: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
1375
+ kind: z.ZodEnum<["file", "doc", "adr", "repo", "code", "config", "external"]>;
1376
+ matchedBy: z.ZodEnum<["lexical", "semantic", "both"]>;
1377
+ stale: z.ZodBoolean;
1378
+ snippet: z.ZodOptional<z.ZodString>;
1379
+ }, "strip", z.ZodTypeAny, {
1380
+ file: string;
1381
+ lines: [number, number];
1382
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1383
+ matchedBy: "lexical" | "semantic" | "both";
1384
+ stale: boolean;
1385
+ snippet?: string | undefined;
1386
+ }, {
1387
+ file: string;
1388
+ lines: [number, number];
1389
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1390
+ matchedBy: "lexical" | "semantic" | "both";
1391
+ stale: boolean;
1392
+ snippet?: string | undefined;
1393
+ }>, "many">;
1394
+ /** Overall retrieval relevance (0..1) — "did this index have anything for me". */
1395
+ confidence: z.ZodNumber;
1396
+ indexId: z.ZodString;
1397
+ meta: z.ZodObject<{
1398
+ requestId: z.ZodString;
1399
+ timingMs: z.ZodNumber;
1400
+ /** Share of results found semantic-only (grep would miss) — proof of value. */
1401
+ semanticWinRate: z.ZodNumber;
1402
+ /** How many returned results have drifted on disk since indexing. */
1403
+ staleCount: z.ZodNumber;
1404
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1405
+ requestId: z.ZodString;
1406
+ timingMs: z.ZodNumber;
1407
+ /** Share of results found semantic-only (grep would miss) — proof of value. */
1408
+ semanticWinRate: z.ZodNumber;
1409
+ /** How many returned results have drifted on disk since indexing. */
1410
+ staleCount: z.ZodNumber;
1411
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1412
+ requestId: z.ZodString;
1413
+ timingMs: z.ZodNumber;
1414
+ /** Share of results found semantic-only (grep would miss) — proof of value. */
1415
+ semanticWinRate: z.ZodNumber;
1416
+ /** How many returned results have drifted on disk since indexing. */
1417
+ staleCount: z.ZodNumber;
1418
+ }, z.ZodTypeAny, "passthrough">>;
1419
+ }, "strip", z.ZodTypeAny, {
1420
+ confidence: number;
1421
+ indexId: string;
1422
+ meta: {
1423
+ requestId: string;
1424
+ timingMs: number;
1425
+ semanticWinRate: number;
1426
+ staleCount: number;
1427
+ } & {
1428
+ [k: string]: unknown;
1429
+ };
1430
+ results: {
1431
+ file: string;
1432
+ lines: [number, number];
1433
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1434
+ matchedBy: "lexical" | "semantic" | "both";
1435
+ stale: boolean;
1436
+ snippet?: string | undefined;
1437
+ }[];
1438
+ }, {
1439
+ confidence: number;
1440
+ indexId: string;
1441
+ meta: {
1442
+ requestId: string;
1443
+ timingMs: number;
1444
+ semanticWinRate: number;
1445
+ staleCount: number;
1446
+ } & {
1447
+ [k: string]: unknown;
1448
+ };
1449
+ results: {
1450
+ file: string;
1451
+ lines: [number, number];
1452
+ kind: "code" | "file" | "doc" | "adr" | "repo" | "config" | "external";
1453
+ matchedBy: "lexical" | "semantic" | "both";
1454
+ stale: boolean;
1455
+ snippet?: string | undefined;
1456
+ }[];
1457
+ }>;
1458
+ type SearchResponse = z.infer<typeof SearchResponseSchema>;
1459
+
72
1460
  /**
73
- * Canonical Mind configuration input
1461
+ * `index` and `reindex` wire contracts.
74
1462
  */
75
- interface MindConfigInput {
76
- sources: MindSourceConfig[];
77
- scopes: MindScopeConfig[];
78
- engines: MindEngineConfig[];
79
- defaults?: MindDefaultsConfig;
80
- }
1463
+
1464
+ declare const IndexRequestSchema: z.ZodObject<{
1465
+ /** Index/corpus id; defaults to config.defaultIndex. */
1466
+ indexId: z.ZodOptional<z.ZodString>;
1467
+ /** Glob/path scope to index; defaults to the whole workspace. */
1468
+ scope: z.ZodOptional<z.ZodString>;
1469
+ /** Full rebuild instead of incremental delta. */
1470
+ full: z.ZodOptional<z.ZodBoolean>;
1471
+ }, "strip", z.ZodTypeAny, {
1472
+ scope?: string | undefined;
1473
+ full?: boolean | undefined;
1474
+ indexId?: string | undefined;
1475
+ }, {
1476
+ scope?: string | undefined;
1477
+ full?: boolean | undefined;
1478
+ indexId?: string | undefined;
1479
+ }>;
1480
+ type IndexRequest = z.infer<typeof IndexRequestSchema>;
1481
+ declare const IndexResponseSchema: z.ZodObject<{
1482
+ indexId: z.ZodString;
1483
+ filesIndexed: z.ZodNumber;
1484
+ chunks: z.ZodNumber;
1485
+ durationMs: z.ZodNumber;
1486
+ }, "strip", z.ZodTypeAny, {
1487
+ durationMs: number;
1488
+ indexId: string;
1489
+ filesIndexed: number;
1490
+ chunks: number;
1491
+ }, {
1492
+ durationMs: number;
1493
+ indexId: string;
1494
+ filesIndexed: number;
1495
+ chunks: number;
1496
+ }>;
1497
+ type IndexResponse = z.infer<typeof IndexResponseSchema>;
1498
+ declare const ReindexRequestSchema: z.ZodObject<{
1499
+ indexId: z.ZodOptional<z.ZodString>;
1500
+ full: z.ZodOptional<z.ZodBoolean>;
1501
+ }, "strip", z.ZodTypeAny, {
1502
+ full?: boolean | undefined;
1503
+ indexId?: string | undefined;
1504
+ }, {
1505
+ full?: boolean | undefined;
1506
+ indexId?: string | undefined;
1507
+ }>;
1508
+ type ReindexRequest = z.infer<typeof ReindexRequestSchema>;
1509
+
81
1510
  /**
82
- * Mind configuration with sync section
1511
+ * `query` (agent) wire contract. Response is the frozen `AgentResponse`.
83
1512
  */
84
- interface MindConfig extends MindConfigInput {
85
- /**
86
- * Synchronization settings for Mind
87
- */
88
- sync?: MindSyncConfig;
89
- }
1513
+
1514
+ declare const QueryRequestSchema: z.ZodObject<{
1515
+ text: z.ZodString;
1516
+ indexId: z.ZodOptional<z.ZodString>;
1517
+ mode: z.ZodOptional<z.ZodEnum<["instant", "auto", "thinking"]>>;
1518
+ snippet: z.ZodOptional<z.ZodEnum<["none", "line", "full"]>>;
1519
+ }, "strip", z.ZodTypeAny, {
1520
+ text: string;
1521
+ mode?: "instant" | "auto" | "thinking" | undefined;
1522
+ snippet?: "full" | "none" | "line" | undefined;
1523
+ indexId?: string | undefined;
1524
+ }, {
1525
+ text: string;
1526
+ mode?: "instant" | "auto" | "thinking" | undefined;
1527
+ snippet?: "full" | "none" | "line" | undefined;
1528
+ indexId?: string | undefined;
1529
+ }>;
1530
+ type QueryRequest = z.infer<typeof QueryRequestSchema>;
1531
+
1532
+ /**
1533
+ * `explore` wire contract (CLI `mind explore` / REST `POST /explore`).
1534
+ *
1535
+ * Task-orientation: given a task, return the relevant files (ranked, grounded by
1536
+ * retrieval) plus an LLM-synthesized orientation — "where to start / how
1537
+ * involved this is". No hardcoded role heuristics: ranking comes from retrieval,
1538
+ * the orientation comes from the model, structure (`spread`) from the paths.
1539
+ */
1540
+
1541
+ declare const ExploreRequestSchema: z.ZodObject<{
1542
+ task: z.ZodString;
1543
+ indexId: z.ZodOptional<z.ZodString>;
1544
+ limit: z.ZodOptional<z.ZodNumber>;
1545
+ }, "strip", z.ZodTypeAny, {
1546
+ task: string;
1547
+ limit?: number | undefined;
1548
+ indexId?: string | undefined;
1549
+ }, {
1550
+ task: string;
1551
+ limit?: number | undefined;
1552
+ indexId?: string | undefined;
1553
+ }>;
1554
+ type ExploreRequest = z.infer<typeof ExploreRequestSchema>;
1555
+ declare const ExploreEntrySchema: z.ZodObject<{
1556
+ file: z.ZodString;
1557
+ lines: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
1558
+ /** What was matched here — the representative line (from retrieval, not rules). */
1559
+ why: z.ZodString;
1560
+ matchedBy: z.ZodEnum<["lexical", "semantic", "both"]>;
1561
+ stale: z.ZodBoolean;
1562
+ }, "strip", z.ZodTypeAny, {
1563
+ file: string;
1564
+ lines: [number, number];
1565
+ matchedBy: "lexical" | "semantic" | "both";
1566
+ stale: boolean;
1567
+ why: string;
1568
+ }, {
1569
+ file: string;
1570
+ lines: [number, number];
1571
+ matchedBy: "lexical" | "semantic" | "both";
1572
+ stale: boolean;
1573
+ why: string;
1574
+ }>;
1575
+ type ExploreEntry = z.infer<typeof ExploreEntrySchema>;
1576
+ declare const ExploreMetaSchema: z.ZodObject<{
1577
+ requestId: z.ZodString;
1578
+ timingMs: z.ZodNumber;
1579
+ /** Distinct files in the map. */
1580
+ filesTouched: z.ZodNumber;
1581
+ /** Distinct directories the files span — a structural "how spread out" hint. */
1582
+ spread: z.ZodNumber;
1583
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1584
+ requestId: z.ZodString;
1585
+ timingMs: z.ZodNumber;
1586
+ /** Distinct files in the map. */
1587
+ filesTouched: z.ZodNumber;
1588
+ /** Distinct directories the files span — a structural "how spread out" hint. */
1589
+ spread: z.ZodNumber;
1590
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1591
+ requestId: z.ZodString;
1592
+ timingMs: z.ZodNumber;
1593
+ /** Distinct files in the map. */
1594
+ filesTouched: z.ZodNumber;
1595
+ /** Distinct directories the files span — a structural "how spread out" hint. */
1596
+ spread: z.ZodNumber;
1597
+ }, z.ZodTypeAny, "passthrough">>;
1598
+ type ExploreMeta = z.infer<typeof ExploreMetaSchema>;
1599
+ declare const ExploreResponseSchema: z.ZodObject<{
1600
+ task: z.ZodString;
1601
+ indexId: z.ZodString;
1602
+ confidence: z.ZodNumber;
1603
+ /** Model-synthesized orientation: where to start + how involved (empty if no LLM). */
1604
+ summary: z.ZodString;
1605
+ /** Relevant files, best-ranked first. */
1606
+ files: z.ZodArray<z.ZodObject<{
1607
+ file: z.ZodString;
1608
+ lines: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
1609
+ /** What was matched here — the representative line (from retrieval, not rules). */
1610
+ why: z.ZodString;
1611
+ matchedBy: z.ZodEnum<["lexical", "semantic", "both"]>;
1612
+ stale: z.ZodBoolean;
1613
+ }, "strip", z.ZodTypeAny, {
1614
+ file: string;
1615
+ lines: [number, number];
1616
+ matchedBy: "lexical" | "semantic" | "both";
1617
+ stale: boolean;
1618
+ why: string;
1619
+ }, {
1620
+ file: string;
1621
+ lines: [number, number];
1622
+ matchedBy: "lexical" | "semantic" | "both";
1623
+ stale: boolean;
1624
+ why: string;
1625
+ }>, "many">;
1626
+ meta: z.ZodObject<{
1627
+ requestId: z.ZodString;
1628
+ timingMs: z.ZodNumber;
1629
+ /** Distinct files in the map. */
1630
+ filesTouched: z.ZodNumber;
1631
+ /** Distinct directories the files span — a structural "how spread out" hint. */
1632
+ spread: z.ZodNumber;
1633
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1634
+ requestId: z.ZodString;
1635
+ timingMs: z.ZodNumber;
1636
+ /** Distinct files in the map. */
1637
+ filesTouched: z.ZodNumber;
1638
+ /** Distinct directories the files span — a structural "how spread out" hint. */
1639
+ spread: z.ZodNumber;
1640
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1641
+ requestId: z.ZodString;
1642
+ timingMs: z.ZodNumber;
1643
+ /** Distinct files in the map. */
1644
+ filesTouched: z.ZodNumber;
1645
+ /** Distinct directories the files span — a structural "how spread out" hint. */
1646
+ spread: z.ZodNumber;
1647
+ }, z.ZodTypeAny, "passthrough">>;
1648
+ }, "strip", z.ZodTypeAny, {
1649
+ confidence: number;
1650
+ task: string;
1651
+ indexId: string;
1652
+ meta: {
1653
+ requestId: string;
1654
+ timingMs: number;
1655
+ filesTouched: number;
1656
+ spread: number;
1657
+ } & {
1658
+ [k: string]: unknown;
1659
+ };
1660
+ summary: string;
1661
+ files: {
1662
+ file: string;
1663
+ lines: [number, number];
1664
+ matchedBy: "lexical" | "semantic" | "both";
1665
+ stale: boolean;
1666
+ why: string;
1667
+ }[];
1668
+ }, {
1669
+ confidence: number;
1670
+ task: string;
1671
+ indexId: string;
1672
+ meta: {
1673
+ requestId: string;
1674
+ timingMs: number;
1675
+ filesTouched: number;
1676
+ spread: number;
1677
+ } & {
1678
+ [k: string]: unknown;
1679
+ };
1680
+ summary: string;
1681
+ files: {
1682
+ file: string;
1683
+ lines: [number, number];
1684
+ matchedBy: "lexical" | "semantic" | "both";
1685
+ stale: boolean;
1686
+ why: string;
1687
+ }[];
1688
+ }>;
1689
+ type ExploreResponse = z.infer<typeof ExploreResponseSchema>;
1690
+
1691
+ /**
1692
+ * `drop` wire contract (CLI `mind drop` / REST `DELETE /index`).
1693
+ *
1694
+ * Removes an entire index: all its vectors (by namespace=indexId) plus its
1695
+ * manifest. Distinct from `sync delete` (which removes specific documents) and
1696
+ * from `reindex --full` (which rebuilds in place).
1697
+ */
1698
+
1699
+ declare const DropRequestSchema: z.ZodObject<{
1700
+ indexId: z.ZodString;
1701
+ }, "strip", z.ZodTypeAny, {
1702
+ indexId: string;
1703
+ }, {
1704
+ indexId: string;
1705
+ }>;
1706
+ type DropRequest = z.infer<typeof DropRequestSchema>;
1707
+ declare const DropResponseSchema: z.ZodObject<{
1708
+ indexId: z.ZodString;
1709
+ /** Vectors removed from the store. */
1710
+ droppedChunks: z.ZodNumber;
1711
+ /** Documents that were in the manifest. */
1712
+ droppedFiles: z.ZodNumber;
1713
+ }, "strip", z.ZodTypeAny, {
1714
+ indexId: string;
1715
+ droppedChunks: number;
1716
+ droppedFiles: number;
1717
+ }, {
1718
+ indexId: string;
1719
+ droppedChunks: number;
1720
+ droppedFiles: number;
1721
+ }>;
1722
+ type DropResponse = z.infer<typeof DropResponseSchema>;
1723
+
90
1724
  /**
91
- * Default sync configuration
1725
+ * `sync` wire contracts (add / update / delete / list / status).
92
1726
  */
93
- declare const defaultMindSyncConfig: MindSyncConfig;
94
1727
 
95
- export { type MindConfig, type MindConfigInput, type MindDefaultsConfig, type MindEngineConfig, type MindScopeConfig, type MindSourceConfig, type MindSyncBatchConfig, type MindSyncConfig, type MindSyncPartialUpdatesConfig, type MindSyncRegistryConfig, type MindSyncSoftDeleteConfig, defaultMindSyncConfig };
1728
+ declare const SyncAddRequestSchema: z.ZodObject<{
1729
+ paths: z.ZodArray<z.ZodString, "many">;
1730
+ indexId: z.ZodOptional<z.ZodString>;
1731
+ }, "strip", z.ZodTypeAny, {
1732
+ paths: string[];
1733
+ indexId?: string | undefined;
1734
+ }, {
1735
+ paths: string[];
1736
+ indexId?: string | undefined;
1737
+ }>;
1738
+ type SyncAddRequest = z.infer<typeof SyncAddRequestSchema>;
1739
+ declare const SyncUpdateRequestSchema: z.ZodObject<{
1740
+ paths: z.ZodArray<z.ZodString, "many">;
1741
+ indexId: z.ZodOptional<z.ZodString>;
1742
+ }, "strip", z.ZodTypeAny, {
1743
+ paths: string[];
1744
+ indexId?: string | undefined;
1745
+ }, {
1746
+ paths: string[];
1747
+ indexId?: string | undefined;
1748
+ }>;
1749
+ type SyncUpdateRequest = z.infer<typeof SyncUpdateRequestSchema>;
1750
+ declare const SyncDeleteRequestSchema: z.ZodObject<{
1751
+ paths: z.ZodArray<z.ZodString, "many">;
1752
+ indexId: z.ZodOptional<z.ZodString>;
1753
+ }, "strip", z.ZodTypeAny, {
1754
+ paths: string[];
1755
+ indexId?: string | undefined;
1756
+ }, {
1757
+ paths: string[];
1758
+ indexId?: string | undefined;
1759
+ }>;
1760
+ type SyncDeleteRequest = z.infer<typeof SyncDeleteRequestSchema>;
1761
+ declare const SyncResponseSchema: z.ZodObject<{
1762
+ indexId: z.ZodString;
1763
+ added: z.ZodNumber;
1764
+ updated: z.ZodNumber;
1765
+ deleted: z.ZodNumber;
1766
+ }, "strip", z.ZodTypeAny, {
1767
+ indexId: string;
1768
+ added: number;
1769
+ updated: number;
1770
+ deleted: number;
1771
+ }, {
1772
+ indexId: string;
1773
+ added: number;
1774
+ updated: number;
1775
+ deleted: number;
1776
+ }>;
1777
+ type SyncResponse = z.infer<typeof SyncResponseSchema>;
1778
+ declare const SyncedDocumentSchema: z.ZodObject<{
1779
+ path: z.ZodString;
1780
+ chunks: z.ZodNumber;
1781
+ indexedAt: z.ZodString;
1782
+ }, "strip", z.ZodTypeAny, {
1783
+ path: string;
1784
+ chunks: number;
1785
+ indexedAt: string;
1786
+ }, {
1787
+ path: string;
1788
+ chunks: number;
1789
+ indexedAt: string;
1790
+ }>;
1791
+ type SyncedDocument = z.infer<typeof SyncedDocumentSchema>;
1792
+ declare const SyncListResponseSchema: z.ZodObject<{
1793
+ indexId: z.ZodString;
1794
+ documents: z.ZodArray<z.ZodObject<{
1795
+ path: z.ZodString;
1796
+ chunks: z.ZodNumber;
1797
+ indexedAt: z.ZodString;
1798
+ }, "strip", z.ZodTypeAny, {
1799
+ path: string;
1800
+ chunks: number;
1801
+ indexedAt: string;
1802
+ }, {
1803
+ path: string;
1804
+ chunks: number;
1805
+ indexedAt: string;
1806
+ }>, "many">;
1807
+ }, "strip", z.ZodTypeAny, {
1808
+ indexId: string;
1809
+ documents: {
1810
+ path: string;
1811
+ chunks: number;
1812
+ indexedAt: string;
1813
+ }[];
1814
+ }, {
1815
+ indexId: string;
1816
+ documents: {
1817
+ path: string;
1818
+ chunks: number;
1819
+ indexedAt: string;
1820
+ }[];
1821
+ }>;
1822
+ type SyncListResponse = z.infer<typeof SyncListResponseSchema>;
1823
+ declare const SyncStatusResponseSchema: z.ZodObject<{
1824
+ indexId: z.ZodString;
1825
+ documents: z.ZodNumber;
1826
+ chunks: z.ZodNumber;
1827
+ lastIndexedAt: z.ZodNullable<z.ZodString>;
1828
+ stale: z.ZodBoolean;
1829
+ }, "strip", z.ZodTypeAny, {
1830
+ stale: boolean;
1831
+ indexId: string;
1832
+ chunks: number;
1833
+ documents: number;
1834
+ lastIndexedAt: string | null;
1835
+ }, {
1836
+ stale: boolean;
1837
+ indexId: string;
1838
+ chunks: number;
1839
+ documents: number;
1840
+ lastIndexedAt: string | null;
1841
+ }>;
1842
+ type SyncStatusResponse = z.infer<typeof SyncStatusResponseSchema>;
1843
+
1844
+ /**
1845
+ * `status` and `health` wire contracts.
1846
+ */
1847
+
1848
+ declare const IndexSummarySchema: z.ZodObject<{
1849
+ indexId: z.ZodString;
1850
+ /** Human label + what the index covers (scope) — lets an agent pick the right corpus. */
1851
+ label: z.ZodOptional<z.ZodString>;
1852
+ coverage: z.ZodOptional<z.ZodString>;
1853
+ documents: z.ZodNumber;
1854
+ chunks: z.ZodNumber;
1855
+ lastIndexedAt: z.ZodNullable<z.ZodString>;
1856
+ /** How many indexed files have drifted on disk since indexing. */
1857
+ staleCount: z.ZodNumber;
1858
+ }, "strip", z.ZodTypeAny, {
1859
+ indexId: string;
1860
+ staleCount: number;
1861
+ chunks: number;
1862
+ documents: number;
1863
+ lastIndexedAt: string | null;
1864
+ label?: string | undefined;
1865
+ coverage?: string | undefined;
1866
+ }, {
1867
+ indexId: string;
1868
+ staleCount: number;
1869
+ chunks: number;
1870
+ documents: number;
1871
+ lastIndexedAt: string | null;
1872
+ label?: string | undefined;
1873
+ coverage?: string | undefined;
1874
+ }>;
1875
+ type IndexSummary = z.infer<typeof IndexSummarySchema>;
1876
+ declare const StatusResponseSchema: z.ZodObject<{
1877
+ indexes: z.ZodArray<z.ZodObject<{
1878
+ indexId: z.ZodString;
1879
+ /** Human label + what the index covers (scope) — lets an agent pick the right corpus. */
1880
+ label: z.ZodOptional<z.ZodString>;
1881
+ coverage: z.ZodOptional<z.ZodString>;
1882
+ documents: z.ZodNumber;
1883
+ chunks: z.ZodNumber;
1884
+ lastIndexedAt: z.ZodNullable<z.ZodString>;
1885
+ /** How many indexed files have drifted on disk since indexing. */
1886
+ staleCount: z.ZodNumber;
1887
+ }, "strip", z.ZodTypeAny, {
1888
+ indexId: string;
1889
+ staleCount: number;
1890
+ chunks: number;
1891
+ documents: number;
1892
+ lastIndexedAt: string | null;
1893
+ label?: string | undefined;
1894
+ coverage?: string | undefined;
1895
+ }, {
1896
+ indexId: string;
1897
+ staleCount: number;
1898
+ chunks: number;
1899
+ documents: number;
1900
+ lastIndexedAt: string | null;
1901
+ label?: string | undefined;
1902
+ coverage?: string | undefined;
1903
+ }>, "many">;
1904
+ healthy: z.ZodBoolean;
1905
+ }, "strip", z.ZodTypeAny, {
1906
+ indexes: {
1907
+ indexId: string;
1908
+ staleCount: number;
1909
+ chunks: number;
1910
+ documents: number;
1911
+ lastIndexedAt: string | null;
1912
+ label?: string | undefined;
1913
+ coverage?: string | undefined;
1914
+ }[];
1915
+ healthy: boolean;
1916
+ }, {
1917
+ indexes: {
1918
+ indexId: string;
1919
+ staleCount: number;
1920
+ chunks: number;
1921
+ documents: number;
1922
+ lastIndexedAt: string | null;
1923
+ label?: string | undefined;
1924
+ coverage?: string | undefined;
1925
+ }[];
1926
+ healthy: boolean;
1927
+ }>;
1928
+ type StatusResponse = z.infer<typeof StatusResponseSchema>;
1929
+ declare const HealthResponseSchema: z.ZodObject<{
1930
+ ok: z.ZodBoolean;
1931
+ vectorStore: z.ZodBoolean;
1932
+ embeddings: z.ZodBoolean;
1933
+ llm: z.ZodBoolean;
1934
+ }, "strip", z.ZodTypeAny, {
1935
+ ok: boolean;
1936
+ vectorStore: boolean;
1937
+ embeddings: boolean;
1938
+ llm: boolean;
1939
+ }, {
1940
+ ok: boolean;
1941
+ vectorStore: boolean;
1942
+ embeddings: boolean;
1943
+ llm: boolean;
1944
+ }>;
1945
+ type HealthResponse = z.infer<typeof HealthResponseSchema>;
1946
+
1947
+ export { type AgentErrorResponse, AgentErrorResponseSchema, type AgentMeta, AgentMetaSchema, type AgentQueryMode, AgentQueryModeSchema, type AgentResponse, AgentResponseSchema, type AgentSource, type AgentSourceKind, AgentSourceKindSchema, AgentSourceSchema, type AgentWarning, AgentWarningSchema, type AskFlags, CONFIDENCE_THRESHOLDS, type ChunkConfig, ChunkConfigSchema, ConfidenceConfigSchema, type DropFlags, type DropRequest, DropRequestSchema, type DropResponse, DropResponseSchema, type EffectiveIndexConfig, type ExploreEntry, ExploreEntrySchema, type ExploreFlags, type ExploreMeta, ExploreMetaSchema, type ExploreRequest, ExploreRequestSchema, type ExploreResponse, ExploreResponseSchema, type HealthResponse, HealthResponseSchema, type IndexConfig, IndexConfigSchema, type IndexFlags, type IndexRequest, IndexRequestSchema, type IndexResponse, IndexResponseSchema, type IndexScope, IndexScopeSchema, type IndexSummary, IndexSummarySchema, MIND_BASE_PATH, MIND_FULL_ROUTES, MIND_NAMESPACE_PREFIX, MIND_ROUTES, type MatchedBy, MatchedBySchema, type MindConfig, type MindConfigInput, MindConfigSchema, type ModeBudget, ModeBudgetSchema, ModesConfigSchema, type QueryRequest, QueryRequestSchema, type ReindexFlags, type ReindexRequest, ReindexRequestSchema, type ResolvedScope, type RetrievalConfig, RetrievalConfigSchema, type SearchFlags, type SearchMeta, SearchMetaSchema, type SearchRequest, SearchRequestSchema, type SearchResponse, SearchResponseSchema, type SearchResult, SearchResultSchema, type SnippetMode, SnippetModeSchema, type StageTrace, StageTraceSchema, type StatusFlags, type StatusResponse, StatusResponseSchema, type SyncAddRequest, SyncAddRequestSchema, type SyncDeleteFlags, type SyncDeleteRequest, SyncDeleteRequestSchema, type SyncListFlags, type SyncListResponse, SyncListResponseSchema, type SyncPathsFlags, type SyncResponse, SyncResponseSchema, type SyncStatusResponse, SyncStatusResponseSchema, type SyncUpdateRequest, SyncUpdateRequestSchema, type SyncedDocument, SyncedDocumentSchema, type Trace, TraceSchema, askFlags, dropFlags, effectiveIndexConfig, exploreFlags, indexFlags, reindexFlags, resolveMindConfig, resolveScope, searchFlags, statusFlags, syncDeleteFlags, syncListFlags, syncPathsFlags };