abb-opencode-local-rag 0.1.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.
Files changed (233) hide show
  1. package/LICENSE +21 -0
  2. package/README.de.md +416 -0
  3. package/README.es.md +416 -0
  4. package/README.fr.md +416 -0
  5. package/README.md +491 -0
  6. package/README.pt-BR.md +416 -0
  7. package/README.zh-CN.md +416 -0
  8. package/dist/bin/install-skills.d.ts +20 -0
  9. package/dist/bin/install-skills.d.ts.map +1 -0
  10. package/dist/bin/install-skills.js +195 -0
  11. package/dist/bin/install-skills.js.map +1 -0
  12. package/dist/chunker/index.d.ts +24 -0
  13. package/dist/chunker/index.d.ts.map +1 -0
  14. package/dist/chunker/index.js +2 -0
  15. package/dist/chunker/index.js.map +1 -0
  16. package/dist/chunker/semantic-chunker.d.ts +97 -0
  17. package/dist/chunker/semantic-chunker.d.ts.map +1 -0
  18. package/dist/chunker/semantic-chunker.js +294 -0
  19. package/dist/chunker/semantic-chunker.js.map +1 -0
  20. package/dist/chunker/sentence-splitter.d.ts +28 -0
  21. package/dist/chunker/sentence-splitter.d.ts.map +1 -0
  22. package/dist/chunker/sentence-splitter.js +219 -0
  23. package/dist/chunker/sentence-splitter.js.map +1 -0
  24. package/dist/cli/common.d.ts +65 -0
  25. package/dist/cli/common.d.ts.map +1 -0
  26. package/dist/cli/common.js +138 -0
  27. package/dist/cli/common.js.map +1 -0
  28. package/dist/cli/delete.d.ts +8 -0
  29. package/dist/cli/delete.d.ts.map +1 -0
  30. package/dist/cli/delete.js +173 -0
  31. package/dist/cli/delete.js.map +1 -0
  32. package/dist/cli/file-collection.d.ts +2 -0
  33. package/dist/cli/file-collection.d.ts.map +1 -0
  34. package/dist/cli/file-collection.js +53 -0
  35. package/dist/cli/file-collection.js.map +1 -0
  36. package/dist/cli/ingest.d.ts +100 -0
  37. package/dist/cli/ingest.d.ts.map +1 -0
  38. package/dist/cli/ingest.js +363 -0
  39. package/dist/cli/ingest.js.map +1 -0
  40. package/dist/cli/list.d.ts +35 -0
  41. package/dist/cli/list.d.ts.map +1 -0
  42. package/dist/cli/list.js +210 -0
  43. package/dist/cli/list.js.map +1 -0
  44. package/dist/cli/options.d.ts +100 -0
  45. package/dist/cli/options.d.ts.map +1 -0
  46. package/dist/cli/options.js +241 -0
  47. package/dist/cli/options.js.map +1 -0
  48. package/dist/cli/query.d.ts +24 -0
  49. package/dist/cli/query.d.ts.map +1 -0
  50. package/dist/cli/query.js +191 -0
  51. package/dist/cli/query.js.map +1 -0
  52. package/dist/cli/read-neighbors.d.ts +11 -0
  53. package/dist/cli/read-neighbors.d.ts.map +1 -0
  54. package/dist/cli/read-neighbors.js +224 -0
  55. package/dist/cli/read-neighbors.js.map +1 -0
  56. package/dist/cli/status.d.ts +8 -0
  57. package/dist/cli/status.d.ts.map +1 -0
  58. package/dist/cli/status.js +80 -0
  59. package/dist/cli/status.js.map +1 -0
  60. package/dist/cli/sync.d.ts +8 -0
  61. package/dist/cli/sync.d.ts.map +1 -0
  62. package/dist/cli/sync.js +244 -0
  63. package/dist/cli/sync.js.map +1 -0
  64. package/dist/cli-main.d.ts +12 -0
  65. package/dist/cli-main.d.ts.map +1 -0
  66. package/dist/cli-main.js +63 -0
  67. package/dist/cli-main.js.map +1 -0
  68. package/dist/embedder/index.d.ts +85 -0
  69. package/dist/embedder/index.d.ts.map +1 -0
  70. package/dist/embedder/index.js +284 -0
  71. package/dist/embedder/index.js.map +1 -0
  72. package/dist/features/list.d.ts +37 -0
  73. package/dist/features/list.d.ts.map +1 -0
  74. package/dist/features/list.js +40 -0
  75. package/dist/features/list.js.map +1 -0
  76. package/dist/features/sync.d.ts +207 -0
  77. package/dist/features/sync.d.ts.map +1 -0
  78. package/dist/features/sync.js +380 -0
  79. package/dist/features/sync.js.map +1 -0
  80. package/dist/index.d.ts +3 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +53 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/ingest/compute.d.ts +86 -0
  85. package/dist/ingest/compute.d.ts.map +1 -0
  86. package/dist/ingest/compute.js +177 -0
  87. package/dist/ingest/compute.js.map +1 -0
  88. package/dist/ingest/file.d.ts +27 -0
  89. package/dist/ingest/file.d.ts.map +1 -0
  90. package/dist/ingest/file.js +67 -0
  91. package/dist/ingest/file.js.map +1 -0
  92. package/dist/ingest/visual.d.ts +45 -0
  93. package/dist/ingest/visual.d.ts.map +1 -0
  94. package/dist/ingest/visual.js +234 -0
  95. package/dist/ingest/visual.js.map +1 -0
  96. package/dist/parser/docx-parser.d.ts +12 -0
  97. package/dist/parser/docx-parser.d.ts.map +1 -0
  98. package/dist/parser/docx-parser.js +328 -0
  99. package/dist/parser/docx-parser.js.map +1 -0
  100. package/dist/parser/html-parser.d.ts +18 -0
  101. package/dist/parser/html-parser.d.ts.map +1 -0
  102. package/dist/parser/html-parser.js +102 -0
  103. package/dist/parser/html-parser.js.map +1 -0
  104. package/dist/parser/index.d.ts +214 -0
  105. package/dist/parser/index.d.ts.map +1 -0
  106. package/dist/parser/index.js +454 -0
  107. package/dist/parser/index.js.map +1 -0
  108. package/dist/parser/pdf-extract.d.ts +81 -0
  109. package/dist/parser/pdf-extract.d.ts.map +1 -0
  110. package/dist/parser/pdf-extract.js +112 -0
  111. package/dist/parser/pdf-extract.js.map +1 -0
  112. package/dist/parser/pdf-filter.d.ts +117 -0
  113. package/dist/parser/pdf-filter.d.ts.map +1 -0
  114. package/dist/parser/pdf-filter.js +528 -0
  115. package/dist/parser/pdf-filter.js.map +1 -0
  116. package/dist/parser/title-extractor.d.ts +69 -0
  117. package/dist/parser/title-extractor.d.ts.map +1 -0
  118. package/dist/parser/title-extractor.js +145 -0
  119. package/dist/parser/title-extractor.js.map +1 -0
  120. package/dist/pdf-visual/captioner.d.ts +16 -0
  121. package/dist/pdf-visual/captioner.d.ts.map +1 -0
  122. package/dist/pdf-visual/captioner.js +63 -0
  123. package/dist/pdf-visual/captioner.js.map +1 -0
  124. package/dist/pdf-visual/captioners/fast.d.ts +7 -0
  125. package/dist/pdf-visual/captioners/fast.d.ts.map +1 -0
  126. package/dist/pdf-visual/captioners/fast.js +103 -0
  127. package/dist/pdf-visual/captioners/fast.js.map +1 -0
  128. package/dist/pdf-visual/captioners/quality.d.ts +7 -0
  129. package/dist/pdf-visual/captioners/quality.d.ts.map +1 -0
  130. package/dist/pdf-visual/captioners/quality.js +127 -0
  131. package/dist/pdf-visual/captioners/quality.js.map +1 -0
  132. package/dist/pdf-visual/captioners/shared.d.ts +44 -0
  133. package/dist/pdf-visual/captioners/shared.d.ts.map +1 -0
  134. package/dist/pdf-visual/captioners/shared.js +104 -0
  135. package/dist/pdf-visual/captioners/shared.js.map +1 -0
  136. package/dist/pdf-visual/detector.d.ts +9 -0
  137. package/dist/pdf-visual/detector.d.ts.map +1 -0
  138. package/dist/pdf-visual/detector.js +234 -0
  139. package/dist/pdf-visual/detector.js.map +1 -0
  140. package/dist/pdf-visual/index.d.ts +13 -0
  141. package/dist/pdf-visual/index.d.ts.map +1 -0
  142. package/dist/pdf-visual/index.js +45 -0
  143. package/dist/pdf-visual/index.js.map +1 -0
  144. package/dist/pdf-visual/renderer.d.ts +9 -0
  145. package/dist/pdf-visual/renderer.d.ts.map +1 -0
  146. package/dist/pdf-visual/renderer.js +177 -0
  147. package/dist/pdf-visual/renderer.js.map +1 -0
  148. package/dist/pdf-visual/types.d.ts +62 -0
  149. package/dist/pdf-visual/types.d.ts.map +1 -0
  150. package/dist/pdf-visual/types.js +32 -0
  151. package/dist/pdf-visual/types.js.map +1 -0
  152. package/dist/server/error-utils.d.ts +79 -0
  153. package/dist/server/error-utils.d.ts.map +1 -0
  154. package/dist/server/error-utils.js +148 -0
  155. package/dist/server/error-utils.js.map +1 -0
  156. package/dist/server/index.d.ts +258 -0
  157. package/dist/server/index.d.ts.map +1 -0
  158. package/dist/server/index.js +1104 -0
  159. package/dist/server/index.js.map +1 -0
  160. package/dist/server/list-scanner.d.ts +52 -0
  161. package/dist/server/list-scanner.d.ts.map +1 -0
  162. package/dist/server/list-scanner.js +72 -0
  163. package/dist/server/list-scanner.js.map +1 -0
  164. package/dist/server/tool-definitions.d.ts +8 -0
  165. package/dist/server/tool-definitions.d.ts.map +1 -0
  166. package/dist/server/tool-definitions.js +181 -0
  167. package/dist/server/tool-definitions.js.map +1 -0
  168. package/dist/server/tool-input.d.ts +37 -0
  169. package/dist/server/tool-input.d.ts.map +1 -0
  170. package/dist/server/tool-input.js +216 -0
  171. package/dist/server/tool-input.js.map +1 -0
  172. package/dist/server/types.d.ts +331 -0
  173. package/dist/server/types.d.ts.map +1 -0
  174. package/dist/server/types.js +3 -0
  175. package/dist/server/types.js.map +1 -0
  176. package/dist/server-main.d.ts +46 -0
  177. package/dist/server-main.d.ts.map +1 -0
  178. package/dist/server-main.js +242 -0
  179. package/dist/server-main.js.map +1 -0
  180. package/dist/utils/base-dirs.d.ts +212 -0
  181. package/dist/utils/base-dirs.d.ts.map +1 -0
  182. package/dist/utils/base-dirs.js +422 -0
  183. package/dist/utils/base-dirs.js.map +1 -0
  184. package/dist/utils/errors.d.ts +24 -0
  185. package/dist/utils/errors.d.ts.map +1 -0
  186. package/dist/utils/errors.js +53 -0
  187. package/dist/utils/errors.js.map +1 -0
  188. package/dist/utils/limits.d.ts +26 -0
  189. package/dist/utils/limits.d.ts.map +1 -0
  190. package/dist/utils/limits.js +28 -0
  191. package/dist/utils/limits.js.map +1 -0
  192. package/dist/utils/list-sources.d.ts +47 -0
  193. package/dist/utils/list-sources.d.ts.map +1 -0
  194. package/dist/utils/list-sources.js +50 -0
  195. package/dist/utils/list-sources.js.map +1 -0
  196. package/dist/utils/raw-data-utils.d.ts +131 -0
  197. package/dist/utils/raw-data-utils.d.ts.map +1 -0
  198. package/dist/utils/raw-data-utils.js +255 -0
  199. package/dist/utils/raw-data-utils.js.map +1 -0
  200. package/dist/utils/scan.d.ts +126 -0
  201. package/dist/utils/scan.d.ts.map +1 -0
  202. package/dist/utils/scan.js +221 -0
  203. package/dist/utils/scan.js.map +1 -0
  204. package/dist/utils/scope-match.d.ts +43 -0
  205. package/dist/utils/scope-match.d.ts.map +1 -0
  206. package/dist/utils/scope-match.js +87 -0
  207. package/dist/utils/scope-match.js.map +1 -0
  208. package/dist/utils/sensitive-path.d.ts +23 -0
  209. package/dist/utils/sensitive-path.d.ts.map +1 -0
  210. package/dist/utils/sensitive-path.js +91 -0
  211. package/dist/utils/sensitive-path.js.map +1 -0
  212. package/dist/utils/sync-path-key.d.ts +20 -0
  213. package/dist/utils/sync-path-key.d.ts.map +1 -0
  214. package/dist/utils/sync-path-key.js +33 -0
  215. package/dist/utils/sync-path-key.js.map +1 -0
  216. package/dist/vectordb/index.d.ts +168 -0
  217. package/dist/vectordb/index.d.ts.map +1 -0
  218. package/dist/vectordb/index.js +619 -0
  219. package/dist/vectordb/index.js.map +1 -0
  220. package/dist/vectordb/search-filters.d.ts +39 -0
  221. package/dist/vectordb/search-filters.d.ts.map +1 -0
  222. package/dist/vectordb/search-filters.js +136 -0
  223. package/dist/vectordb/search-filters.js.map +1 -0
  224. package/dist/vectordb/types.d.ts +196 -0
  225. package/dist/vectordb/types.d.ts.map +1 -0
  226. package/dist/vectordb/types.js +224 -0
  227. package/dist/vectordb/types.js.map +1 -0
  228. package/package.json +105 -0
  229. package/skills/mcp-local-rag/SKILL.md +308 -0
  230. package/skills/mcp-local-rag/references/cli-reference.md +175 -0
  231. package/skills/mcp-local-rag/references/html-ingestion.md +78 -0
  232. package/skills/mcp-local-rag/references/query-optimization.md +57 -0
  233. package/skills/mcp-local-rag/references/result-refinement.md +56 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../src/pdf-visual/renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AA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AAE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC,CAAA;YAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,CAAA;YAC5D,OAAO,iBAAiB,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,KAAK,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CACxF,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,CACzC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;YAAS,CAAC;QACT,KAAK,EAAE,OAAO,EAAE,EAAE,CAAA;IACpB,CAAC;AACH,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { AppError } from '../utils/errors.js';
2
+ /**
3
+ * Error raised by any module on the visual ingest path. Carries the offending
4
+ * 1-based page number so callers can correlate it with the page list.
5
+ */
6
+ export declare class VlmError extends AppError {
7
+ readonly pageNum: number;
8
+ constructor(message: string, options: {
9
+ cause?: Error;
10
+ pageNum: number;
11
+ });
12
+ }
13
+ /**
14
+ * Visual-quality profile selector. Each profile resolves to a self-contained
15
+ * captioner implementation under `captioners/`. `fast` ports the original
16
+ * SmolVLM-256M / IDEFICS3 captioner (lightweight default, ~250 MB cache);
17
+ * `quality` ports the Qwen2.5-VL-3B-Instruct-ONNX captioner (~2.9 GB cache,
18
+ * ~2× per-page inference, higher fidelity on figures with in-image text).
19
+ */
20
+ export declare const QUALITY_PROFILES: readonly ['fast', 'quality'];
21
+ export type QualityProfile = (typeof QUALITY_PROFILES)[number];
22
+ /**
23
+ * Captioner configuration. The model identifier is no longer caller-tunable;
24
+ * it is resolved inside the selected `profile` so that prompt, chat template,
25
+ * processor signature, generation options, and model class stay coherent per
26
+ * profile.
27
+ */
28
+ export interface CaptionerConfig {
29
+ /** Visual-quality profile — selects the underlying VLM family. */
30
+ profile: QualityProfile;
31
+ /** Model cache directory (shared with the embedder via `env.cacheDir`). */
32
+ cacheDir: string;
33
+ /** Execution device passed through to Transformers.js model loading. */
34
+ device?: string | undefined;
35
+ }
36
+ /**
37
+ * Captioner public surface. Returns the caption string or `null` when the
38
+ * model produced an empty result (after control-char stripping + whitespace
39
+ * trim). A `null` return signals the orchestrator to skip this page without
40
+ * raising — only model load / image decode / generation failures throw.
41
+ */
42
+ export interface Captioner {
43
+ caption(pngBytes: Uint8Array, pageNum: number): Promise<string | null>;
44
+ }
45
+ export type VisualBBox = [number, number, number, number];
46
+ export type VisualEvidence = 'raster' | 'vector';
47
+ export interface DetectedVisualRegion {
48
+ pageNum: number;
49
+ detectionIndex: number;
50
+ bbox: VisualBBox;
51
+ evidence: VisualEvidence;
52
+ }
53
+ export type VisualImageMimeType = 'image/png' | 'image/jpeg';
54
+ export interface ImageRendition {
55
+ bytes: Uint8Array;
56
+ mimeType: VisualImageMimeType;
57
+ }
58
+ export interface ProcessedVisualRegion extends DetectedVisualRegion {
59
+ caption: string | null;
60
+ rendition?: ImageRendition;
61
+ }
62
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pdf-visual/types.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C;;;GAGG;AACH,qBAAa,QAAS,SAAQ,QAAQ;IACpC,SAAgB,OAAO,EAAE,MAAM,CAAA;IAE/B,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAIvE;CACF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,YAAI,MAAM,EAAE,SAAS,CAAU,CAAA;AAC5D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,OAAO,EAAE,cAAc,CAAA;IACvB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAA;IAChB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CACvE;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAEzD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEhD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,cAAc,CAAA;CACzB;AAED,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,YAAY,CAAA;AAE5D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,UAAU,CAAA;IACjB,QAAQ,EAAE,mBAAmB,CAAA;CAC9B;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,CAAC,EAAE,cAAc,CAAA;CAC3B"}
@@ -0,0 +1,32 @@
1
+ // Shared types for the `pdf-visual` package.
2
+ //
3
+ // `VlmError` is the package-wide named error for the visual ingest path.
4
+ // `renderer.ts`, `captioner.ts`, and the orchestrator (`index.ts`) import it
5
+ // from this single source. It joins the shared `AppError` taxonomy (taxonomy
6
+ // only — name/message/cause behavior is unchanged) and additionally carries
7
+ // the offending page number.
8
+ //
9
+ // `CaptionerConfig` / `Captioner` are the captioner's public interface,
10
+ // shared across the visual ingest modules.
11
+ import { AppError } from '../utils/errors.js';
12
+ /**
13
+ * Error raised by any module on the visual ingest path. Carries the offending
14
+ * 1-based page number so callers can correlate it with the page list.
15
+ */
16
+ export class VlmError extends AppError {
17
+ pageNum;
18
+ constructor(message, options) {
19
+ super(message, 'pdf-visual', 'internal', options.cause);
20
+ this.name = 'VlmError';
21
+ this.pageNum = options.pageNum;
22
+ }
23
+ }
24
+ /**
25
+ * Visual-quality profile selector. Each profile resolves to a self-contained
26
+ * captioner implementation under `captioners/`. `fast` ports the original
27
+ * SmolVLM-256M / IDEFICS3 captioner (lightweight default, ~250 MB cache);
28
+ * `quality` ports the Qwen2.5-VL-3B-Instruct-ONNX captioner (~2.9 GB cache,
29
+ * ~2× per-page inference, higher fidelity on figures with in-image text).
30
+ */
31
+ export const QUALITY_PROFILES = ['fast', 'quality'];
32
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/pdf-visual/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,6BAA6B;AAC7B,EAAE;AACF,wEAAwE;AACxE,2CAA2C;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,QAAQ;IACpB,OAAO,CAAQ;IAE/B,YAAY,OAAe,EAAE,OAA2C;QACtE,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QACvD,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAChC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,CAAU,CAAA"}
@@ -0,0 +1,79 @@
1
+ import type { Annotations } from '@modelcontextprotocol/sdk/types.js';
2
+ import { McpError } from '@modelcontextprotocol/sdk/types.js';
3
+ /**
4
+ * Shape of a single MCP content block used by RAG server handlers. Mirrors
5
+ * only the SDK text/image shapes needed by this server — defined here rather
6
+ * than using the SDK's widely-imported content union so unrelated SDK
7
+ * additions do not widen handler signatures later.
8
+ */
9
+ export type RagTextContentBlock = {
10
+ type: 'text';
11
+ text: string;
12
+ annotations?: Annotations;
13
+ };
14
+ export type RagImageContentBlock = {
15
+ type: 'image';
16
+ data: string;
17
+ mimeType: 'image/png' | 'image/jpeg';
18
+ annotations?: Annotations;
19
+ };
20
+ export type RagContentBlock = RagTextContentBlock | RagImageContentBlock;
21
+ /**
22
+ * Append config-warning blocks to an existing content array. Returns the
23
+ * same `content` reference for chainability (handlers typically build the
24
+ * array first, then call this once before returning).
25
+ */
26
+ export declare function appendConfigWarnings<T extends RagContentBlock[]>(content: T, warnings: readonly string[]): T;
27
+ /**
28
+ * Build a diagnostic content block exposing the supplied config-error
29
+ * message. Used by `status` when the server is in degraded mode (invalid
30
+ * `BASE_DIRS`) so the user can read the error via the MCP response without
31
+ * inspecting stderr.
32
+ */
33
+ export declare function buildConfigErrorBlock(message: string): RagTextContentBlock;
34
+ /**
35
+ * Context supplied by each handler to {@link toMcpError}, encoding that
36
+ * handler's client-message policy. `prefix` is the operation prefix applied to
37
+ * the generic/native fallback message (e.g. `'Failed to ingest file'`).
38
+ * Prefix-less handlers (`query_documents`/`list_files`/`status`) omit it.
39
+ */
40
+ export type ToMcpErrorContext = {
41
+ prefix?: string;
42
+ };
43
+ /**
44
+ * Build the controlled, type-appropriate message sent to the MCP client.
45
+ *
46
+ * Returns only the error's `.message`, regardless of `NODE_ENV`: the client
47
+ * boundary never receives a stack trace or the raw `.cause` chain, so internal
48
+ * details cannot leak to the client even in development. Full diagnostics
49
+ * (stack + cause chain) belong in {@link formatErrorForLog} (stderr only).
50
+ */
51
+ export declare function formatErrorForClient(error: unknown): string;
52
+ /**
53
+ * Build the full diagnostic string for stderr logging: every link of the
54
+ * `.cause` chain (via {@link getCauseChain}) followed by its stack. Never sent
55
+ * to the client — this is the log-side counterpart of
56
+ * {@link formatErrorForClient}.
57
+ */
58
+ export declare function formatErrorForLog(error: unknown): string;
59
+ /**
60
+ * Log an error to stderr with its operation context and full cause chain.
61
+ * The only side-effecting boundary function — the formatters are pure so they
62
+ * can be composed without emitting logs.
63
+ */
64
+ export declare function logError(context: string, error: unknown): void;
65
+ /**
66
+ * Map an arbitrary handler error to an `McpError` for the client boundary.
67
+ *
68
+ * - An existing `McpError` passes through unchanged (preserves hand-built
69
+ * input-validation codes).
70
+ * - A recognized `AppError` maps by its `kind`: `validation`/`config` →
71
+ * `InvalidParams`, everything else → `InternalError`. Its own message is used
72
+ * raw — **no** operation prefix is applied, even when `context.prefix` is set
73
+ * (e.g. `DatabaseError` stays prefix-less).
74
+ * - Any other value (native `Error` or non-`Error`) maps to `InternalError`,
75
+ * and `context.prefix`, when present, is prepended to the controlled
76
+ * client message. The raw cause chain is never included.
77
+ */
78
+ export declare function toMcpError(error: unknown, context: ToMcpErrorContext): McpError;
79
+ //# sourceMappingURL=error-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../src/server/error-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AACrE,OAAO,EAAa,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AAGxE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,GAAG,YAAY,CAAA;IACpC,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,oBAAoB,CAAA;AA+CxE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,eAAe,EAAE,EAC9D,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,CAAC,CAIH;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAM1E;AAuBD;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQxD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAE9D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,GAAG,QAAQ,CAc/E"}
@@ -0,0 +1,148 @@
1
+ import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
2
+ import { getCauseChain, isAppError } from '../utils/errors.js';
3
+ /**
4
+ * Annotations applied to config-warning blocks. The audience covers both
5
+ * the assistant (so it can decide to mention the warning to the user) and
6
+ * the user (so MCP clients that render annotations visibly know to surface
7
+ * it). Priority 0.3 keeps the block secondary to the primary tool result.
8
+ */
9
+ const WARNING_ANNOTATIONS = {
10
+ audience: ['user', 'assistant'],
11
+ priority: 0.3,
12
+ };
13
+ /**
14
+ * Annotations applied to the config-error diagnostic block on `status`. The
15
+ * priority is raised relative to a warning because a config error means the
16
+ * server is degraded — `status` is the only tool still callable, and the
17
+ * user needs to see the error message to recover.
18
+ */
19
+ const CONFIG_ERROR_ANNOTATIONS = {
20
+ audience: ['user', 'assistant'],
21
+ priority: 0.9,
22
+ };
23
+ /**
24
+ * Build the (zero or one) warning content block for the supplied warnings.
25
+ *
26
+ * Returns `[]` when no warnings exist so the caller can spread the result
27
+ * unconditionally without producing a spurious block. The single emitted
28
+ * block joins all warnings with ` | ` so MCP clients display them together
29
+ * — the per-warning structured form lives in the configuration layer
30
+ * (`BaseDirsConfigWarning`); here we render a single user-facing string.
31
+ *
32
+ * Centralizing this in one helper keeps the warning content shape consistent
33
+ * across handlers. Every handler must use this helper.
34
+ */
35
+ function buildConfigWarningBlocks(warnings) {
36
+ if (warnings.length === 0)
37
+ return [];
38
+ return [
39
+ {
40
+ type: 'text',
41
+ text: `Warning: Tell the user about this configuration issue. ${warnings.join(' | ')}`,
42
+ annotations: WARNING_ANNOTATIONS,
43
+ },
44
+ ];
45
+ }
46
+ /**
47
+ * Append config-warning blocks to an existing content array. Returns the
48
+ * same `content` reference for chainability (handlers typically build the
49
+ * array first, then call this once before returning).
50
+ */
51
+ export function appendConfigWarnings(content, warnings) {
52
+ const blocks = content;
53
+ blocks.push(...buildConfigWarningBlocks(warnings));
54
+ return content;
55
+ }
56
+ /**
57
+ * Build a diagnostic content block exposing the supplied config-error
58
+ * message. Used by `status` when the server is in degraded mode (invalid
59
+ * `BASE_DIRS`) so the user can read the error via the MCP response without
60
+ * inspecting stderr.
61
+ */
62
+ export function buildConfigErrorBlock(message) {
63
+ return {
64
+ type: 'text',
65
+ text: `Configuration error: Tell the user to fix this. ${message}`,
66
+ annotations: CONFIG_ERROR_ANNOTATIONS,
67
+ };
68
+ }
69
+ /**
70
+ * Coerce an arbitrary thrown value into an `Error`. Preserves a real `Error`
71
+ * unchanged (so its `name`/`cause`/`stack` survive); reconstructs from a
72
+ * `{ message: string }` shape; otherwise stringifies. Centralized so every
73
+ * boundary function shares one normalization rule.
74
+ */
75
+ function toError(error) {
76
+ if (error instanceof Error) {
77
+ return error;
78
+ }
79
+ if (error !== null &&
80
+ typeof error === 'object' &&
81
+ 'message' in error &&
82
+ typeof error.message === 'string') {
83
+ return new Error(error.message);
84
+ }
85
+ return new Error(String(error));
86
+ }
87
+ /**
88
+ * Build the controlled, type-appropriate message sent to the MCP client.
89
+ *
90
+ * Returns only the error's `.message`, regardless of `NODE_ENV`: the client
91
+ * boundary never receives a stack trace or the raw `.cause` chain, so internal
92
+ * details cannot leak to the client even in development. Full diagnostics
93
+ * (stack + cause chain) belong in {@link formatErrorForLog} (stderr only).
94
+ */
95
+ export function formatErrorForClient(error) {
96
+ return toError(error).message;
97
+ }
98
+ /**
99
+ * Build the full diagnostic string for stderr logging: every link of the
100
+ * `.cause` chain (via {@link getCauseChain}) followed by its stack. Never sent
101
+ * to the client — this is the log-side counterpart of
102
+ * {@link formatErrorForClient}.
103
+ */
104
+ export function formatErrorForLog(error) {
105
+ const err = toError(error);
106
+ return getCauseChain(err)
107
+ .map((link, index) => {
108
+ const header = index === 0 ? '' : 'Caused by: ';
109
+ return `${header}${link.stack || `${link.name}: ${link.message}`}`;
110
+ })
111
+ .join('\n');
112
+ }
113
+ /**
114
+ * Log an error to stderr with its operation context and full cause chain.
115
+ * The only side-effecting boundary function — the formatters are pure so they
116
+ * can be composed without emitting logs.
117
+ */
118
+ export function logError(context, error) {
119
+ console.error(`[${context}] ${formatErrorForLog(error)}`);
120
+ }
121
+ /**
122
+ * Map an arbitrary handler error to an `McpError` for the client boundary.
123
+ *
124
+ * - An existing `McpError` passes through unchanged (preserves hand-built
125
+ * input-validation codes).
126
+ * - A recognized `AppError` maps by its `kind`: `validation`/`config` →
127
+ * `InvalidParams`, everything else → `InternalError`. Its own message is used
128
+ * raw — **no** operation prefix is applied, even when `context.prefix` is set
129
+ * (e.g. `DatabaseError` stays prefix-less).
130
+ * - Any other value (native `Error` or non-`Error`) maps to `InternalError`,
131
+ * and `context.prefix`, when present, is prepended to the controlled
132
+ * client message. The raw cause chain is never included.
133
+ */
134
+ export function toMcpError(error, context) {
135
+ if (error instanceof McpError) {
136
+ return error;
137
+ }
138
+ if (isAppError(error)) {
139
+ const code = error.kind === 'validation' || error.kind === 'config'
140
+ ? ErrorCode.InvalidParams
141
+ : ErrorCode.InternalError;
142
+ return new McpError(code, formatErrorForClient(error));
143
+ }
144
+ const message = formatErrorForClient(error);
145
+ const clientMessage = context.prefix !== undefined ? `${context.prefix}: ${message}` : message;
146
+ return new McpError(ErrorCode.InternalError, clientMessage);
147
+ }
148
+ //# sourceMappingURL=error-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-utils.js","sourceRoot":"","sources":["../../src/server/error-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAuB9D;;;;;GAKG;AACH,MAAM,mBAAmB,GAAgB;IACvC,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;IAC/B,QAAQ,EAAE,GAAG;CACd,CAAA;AAED;;;;;GAKG;AACH,MAAM,wBAAwB,GAAgB;IAC5C,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;IAC/B,QAAQ,EAAE,GAAG;CACd,CAAA;AAED;;;;;;;;;;;GAWG;AACH,SAAS,wBAAwB,CAAC,QAA2B;IAC3D,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACpC,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,0DAA0D,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACtF,WAAW,EAAE,mBAAmB;SACjC;KACF,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAU,EACV,QAA2B;IAE3B,MAAM,MAAM,GAAsB,OAAO,CAAA;IACzC,MAAM,CAAC,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CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,KAAc;IACtD,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAC3D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,OAA0B;IACnE,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,GACR,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;YACpD,CAAC,CAAC,SAAS,CAAC,aAAa;YACzB,CAAC,CAAC,SAAS,CAAC,aAAa,CAAA;QAC7B,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAA;IACxD,CAAC;IACD,MAAM,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAA;IAC3C,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAA;IAC9F,OAAO,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;AAC7D,CAAC"}
@@ -0,0 +1,258 @@
1
+ import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
2
+ import { type RagContentBlock, type RagTextContentBlock } from './error-utils.js';
3
+ import type { IngestDataInput, ListFilesInput, QueryDocumentsInput, RAGServerConfig, SyncStartInput, SyncStatusInput } from './types.js';
4
+ type QueryContent = [RagTextContentBlock, ...RagContentBlock[]];
5
+ /** RAG server compliant with MCP Protocol */
6
+ export declare class RAGServer {
7
+ private readonly server;
8
+ private readonly vectorStore;
9
+ private readonly embedder;
10
+ private readonly chunker;
11
+ private readonly parser;
12
+ private readonly dbPath;
13
+ /**
14
+ * One or more allowed document base directories — REALPATH-normalized
15
+ * (the validation/security domain). Passed to `DocumentParser` as the
16
+ * security boundary. NOT used for `list_files` scanning/display; that uses
17
+ * the NORMAL-path `rawBaseDirs` below. Normalized from either the legacy
18
+ * `{ baseDir }` config shape or the new `{ baseDirs }` shape so downstream
19
+ * readers do not need to branch on shape.
20
+ */
21
+ private readonly baseDirs;
22
+ /**
23
+ * Normal-path (resolve()) roots, index-aligned with `baseDirs`, for
24
+ * user-facing `list_files` scan/display. Falls back to `baseDirs` for legacy
25
+ * `{ baseDir }` callers. See {@link BaseDirsConfig} for the path policy.
26
+ */
27
+ private readonly rawBaseDirs;
28
+ /** Legacy single-root accessor for `rawBaseDirs`. Derived from `rawBaseDirs[0]`. */
29
+ private readonly rawBaseDir;
30
+ private readonly cacheDir;
31
+ private readonly excludePaths;
32
+ private readonly configWarnings;
33
+ /**
34
+ * Structured base-dirs resolution error. When non-null, the server is in
35
+ * degraded mode: `status` remains callable so the user can diagnose the
36
+ * problem via MCP, while root-dependent tools should surface this error
37
+ * before doing DB or filesystem work. See `resolveBaseDirs` for the error
38
+ * semantics.
39
+ */
40
+ private readonly configError;
41
+ private readonly minChunkLength;
42
+ /**
43
+ * Configured byte ceiling for one ingested file. The parser enforces it for
44
+ * parsing; sync also needs it before hashing, where nothing else bounds the
45
+ * read.
46
+ */
47
+ private readonly maxFileSize;
48
+ private readonly device;
49
+ private readonly storeImages;
50
+ /**
51
+ * The one current-or-latest sync job this process retains (SYNC-006). A new
52
+ * `sync_start` replaces a terminal record, so the older id becomes unknown,
53
+ * and process exit simply discards it: there is no history, persistence,
54
+ * eviction policy, or recovery.
55
+ */
56
+ private syncJob;
57
+ /**
58
+ * True while one external mutation is in flight (SYNC-007). A request-scoped
59
+ * mutation clears it when the request completes; a sync keeps it until its
60
+ * job reaches a terminal state.
61
+ */
62
+ private mutationInFlight;
63
+ constructor(config: RAGServerConfig);
64
+ /**
65
+ * Fail-fast guard for root-dependent tools. When a {@link BaseDirsConfigError}
66
+ * is stored on the instance the server is in degraded mode (invalid
67
+ * `BASE_DIRS` — see `resolveBaseDirs`) and every root-dependent tool MUST
68
+ * reject BEFORE any DB / embedder / parser access so the user sees the
69
+ * configuration problem unambiguously. Throws the stored
70
+ * {@link BaseDirsConfigError} (kind `config`) so the central dispatcher
71
+ * mapper renders it as `McpError(InvalidParams)` — error→code ownership
72
+ * stays in exactly one place instead of being hand-built here.
73
+ *
74
+ * `status` deliberately does NOT call this helper; it remains callable in
75
+ * degraded mode and exposes the error via a diagnostic content block so
76
+ * the user can recover via MCP without inspecting stderr.
77
+ */
78
+ private assertConfigOk;
79
+ /**
80
+ * Append the centralized config-warning blocks to a handler response.
81
+ * Every tool handler funnels through this method so the warning shape
82
+ * stays in exactly one place (design-doc-mandated countermeasure for the
83
+ * "warning shape changes touch many handlers" risk).
84
+ */
85
+ private withWarnings;
86
+ /**
87
+ * Take the single external-mutation slot, or describe the overlap.
88
+ *
89
+ * Returns `null` when the slot was free (the caller now holds it), otherwise
90
+ * the responsive overlap result: an ordinary tool result with `isError: true`
91
+ * rather than a thrown error, so it never passes through `toMcpError`. When a
92
+ * sync holds the guard the message names its job id and points at
93
+ * `sync_status`, which is the only way for the caller to learn when to retry.
94
+ */
95
+ private acquireMutation;
96
+ private releaseMutation;
97
+ /**
98
+ * Set up MCP handlers
99
+ */
100
+ private setupHandlers;
101
+ /**
102
+ * Initialization
103
+ */
104
+ initialize(): Promise<void>;
105
+ /**
106
+ * query_documents tool handler
107
+ */
108
+ handleQueryDocuments(args: QueryDocumentsInput): Promise<{
109
+ content: QueryContent;
110
+ }>;
111
+ /**
112
+ * ingest_file tool handler (re-ingestion support, transaction processing, rollback capability)
113
+ *
114
+ * `options.skipOptimize` is internal: sync compacts once per run, so its reuse
115
+ * of this handler must not compact once per file (a 100-file sync would
116
+ * otherwise perform 101 compactions). The `ingest_file` and `ingest_data` tools
117
+ * omit it and keep compacting per call, which is the behavior they always had.
118
+ */
119
+ handleIngestFile(raw: unknown, options?: {
120
+ skipOptimize?: boolean;
121
+ images?: boolean;
122
+ }): Promise<{
123
+ content: RagTextContentBlock[];
124
+ }>;
125
+ private ingestFile;
126
+ /**
127
+ * ingest_data tool handler
128
+ * Saves raw content to raw-data directory and calls handleIngestFile internally
129
+ *
130
+ * For HTML content:
131
+ * - Parses HTML and extracts main content using Readability
132
+ * - Converts to Markdown for better chunking
133
+ * - Saves as .md file
134
+ */
135
+ handleIngestData(args: IngestDataInput): Promise<{
136
+ content: RagTextContentBlock[];
137
+ }>;
138
+ /**
139
+ * list_files tool handler
140
+ *
141
+ * Scans the normal-path roots (`this.rawBaseDirs`) so scanned paths match the
142
+ * resolve()-stored DB keys (see {@link BaseDirsConfig} for the path policy).
143
+ *
144
+ * Scans every effective base directory (`this.rawBaseDirs`) for supported
145
+ * files and cross-references with ingested documents. Multi-root contract:
146
+ * - Returns top-level `baseDirs` (all effective roots in normal-path space,
147
+ * nested-root-pruned by `resolveBaseDirs`).
148
+ * - Preserves legacy top-level `baseDir = rawBaseDirs[0]` for clients written
149
+ * against the single-root shape.
150
+ * - Annotates each file entry with the producing `baseDir`.
151
+ * - De-duplicates exact duplicate file paths across roots (first occurrence
152
+ * wins, preserving root iteration order).
153
+ * - Preserves raw-data / orphaned DB entries under `sources` with no
154
+ * producing-root annotation.
155
+ * - Excludes `dbPath` and `cacheDir` uniformly across every root.
156
+ */
157
+ handleListFiles(input?: ListFilesInput): Promise<{
158
+ content: RagTextContentBlock[];
159
+ }>;
160
+ /**
161
+ * status tool handler
162
+ */
163
+ handleStatus(): Promise<{
164
+ content: RagTextContentBlock[];
165
+ }>;
166
+ /**
167
+ * delete_file tool handler
168
+ * Deletes chunks from VectorDB and physical raw-data files
169
+ * Supports both filePath (for ingest_file) and source (for ingest_data)
170
+ */
171
+ handleDeleteFile(raw: unknown): Promise<{
172
+ content: RagTextContentBlock[];
173
+ }>;
174
+ /**
175
+ * read_chunk_neighbors tool handler
176
+ * Returns chunks around a target chunkIndex within a single ingested document.
177
+ * Context-expansion utility — not a search tool. Mirrors handleDeleteFile's
178
+ * dual-input (filePath XOR source) resolution pattern.
179
+ */
180
+ handleReadChunkNeighbors(raw: unknown): Promise<{
181
+ content: RagTextContentBlock[];
182
+ }>;
183
+ /** Resolve the shared filePath/source reference without changing its DB-key spelling. */
184
+ private resolveDocumentTarget;
185
+ /**
186
+ * sync_start tool handler
187
+ *
188
+ * Registers the one current job, schedules the run, and answers with its id
189
+ * without waiting for any of it: the caller polls `sync_status` (SYNC-006).
190
+ * The scheduled promise is deliberately floating — an unexpected rejection is
191
+ * captured into the job record instead of escaping, and the run holds the
192
+ * external-mutation guard until it is terminal.
193
+ */
194
+ handleSyncStart(input: SyncStartInput): Promise<{
195
+ content: RagTextContentBlock[];
196
+ }>;
197
+ /**
198
+ * sync_status tool handler
199
+ *
200
+ * Read-only, so it stays callable while a sync holds the mutation guard. Any
201
+ * id other than the current one is unknown: the record was replaced by a newer
202
+ * `sync_start` or lost with a previous server process.
203
+ */
204
+ handleSyncStatus(input: SyncStatusInput): Promise<{
205
+ content: RagTextContentBlock[];
206
+ }>;
207
+ /** Patch the current job, ignoring a write aimed at a record already replaced. */
208
+ private updateSyncJob;
209
+ /**
210
+ * The scheduled body of one sync job: supply the real collaborators to the
211
+ * shared core (`src/features/sync.ts`) and fold its result into the pollable
212
+ * record. Planning, prune eligibility, and the stop-on-first-error policy stay
213
+ * in the core; path classification and depth therefore match the CLI exactly.
214
+ */
215
+ private runSyncJob;
216
+ /**
217
+ * Sync's `ingestFile` collaborator uses the same typed ingestion operation as
218
+ * `ingest_file`, preserving its backup and rollback semantics while returning
219
+ * only the chunk count the sync core needs. A zero-chunk file is reported as
220
+ * `empty`; the typed operation rejects it before delete, leaving prior rows
221
+ * unchanged.
222
+ *
223
+ * Compaction is the second difference: the sync core runs one `optimize()` for
224
+ * the whole run, so the per-file one is skipped here. A rollback still compacts
225
+ * — that path restores rows and then aborts the run, so no later `optimize()`
226
+ * follows it.
227
+ */
228
+ private ingestFileForSync;
229
+ /**
230
+ * Serve this instance's tool registration over `transport`.
231
+ *
232
+ * Exposed because the registration itself — not a re-registered copy of it —
233
+ * is what an MCP client talks to, and `this.server` is private. `run()` passes
234
+ * the stdio transport; a test passes an in-memory pair.
235
+ *
236
+ * One instance serves at most one client: the sync job record and the mutation
237
+ * slot are per-process, so a transport that multiplexed clients would share one
238
+ * caller's job state and one caller's write lock with every other caller.
239
+ */
240
+ connect(transport: Transport): Promise<void>;
241
+ /**
242
+ * Start the server
243
+ */
244
+ run(): Promise<void>;
245
+ /**
246
+ * Stop the server and release resources
247
+ */
248
+ close(): Promise<void>;
249
+ /**
250
+ * Generate MCP server instructions automatically based on the configured
251
+ * base directories. A single root equal to the current working directory
252
+ * means the server indexes the current project; any other roots mean it
253
+ * indexes shared/common directories.
254
+ */
255
+ private generateInstructions;
256
+ }
257
+ export {};
258
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAA;AAqD9E,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAGzB,MAAM,kBAAkB,CAAA;AAazB,OAAO,KAAK,EAIV,eAAe,EAGf,cAAc,EAEd,mBAAmB,EAEnB,eAAe,EAGf,cAAc,EACd,eAAe,EAEhB,MAAM,YAAY,CAAA;AA8BnB,KAAK,YAAY,GAAG,CAAC,mBAAmB,EAAE,GAAG,eAAe,EAAE,CAAC,CAAA;AA6E/D,6CAA6C;AAC7C,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW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