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.
- package/LICENSE +21 -0
- package/README.de.md +416 -0
- package/README.es.md +416 -0
- package/README.fr.md +416 -0
- package/README.md +491 -0
- package/README.pt-BR.md +416 -0
- package/README.zh-CN.md +416 -0
- package/dist/bin/install-skills.d.ts +20 -0
- package/dist/bin/install-skills.d.ts.map +1 -0
- package/dist/bin/install-skills.js +195 -0
- package/dist/bin/install-skills.js.map +1 -0
- package/dist/chunker/index.d.ts +24 -0
- package/dist/chunker/index.d.ts.map +1 -0
- package/dist/chunker/index.js +2 -0
- package/dist/chunker/index.js.map +1 -0
- package/dist/chunker/semantic-chunker.d.ts +97 -0
- package/dist/chunker/semantic-chunker.d.ts.map +1 -0
- package/dist/chunker/semantic-chunker.js +294 -0
- package/dist/chunker/semantic-chunker.js.map +1 -0
- package/dist/chunker/sentence-splitter.d.ts +28 -0
- package/dist/chunker/sentence-splitter.d.ts.map +1 -0
- package/dist/chunker/sentence-splitter.js +219 -0
- package/dist/chunker/sentence-splitter.js.map +1 -0
- package/dist/cli/common.d.ts +65 -0
- package/dist/cli/common.d.ts.map +1 -0
- package/dist/cli/common.js +138 -0
- package/dist/cli/common.js.map +1 -0
- package/dist/cli/delete.d.ts +8 -0
- package/dist/cli/delete.d.ts.map +1 -0
- package/dist/cli/delete.js +173 -0
- package/dist/cli/delete.js.map +1 -0
- package/dist/cli/file-collection.d.ts +2 -0
- package/dist/cli/file-collection.d.ts.map +1 -0
- package/dist/cli/file-collection.js +53 -0
- package/dist/cli/file-collection.js.map +1 -0
- package/dist/cli/ingest.d.ts +100 -0
- package/dist/cli/ingest.d.ts.map +1 -0
- package/dist/cli/ingest.js +363 -0
- package/dist/cli/ingest.js.map +1 -0
- package/dist/cli/list.d.ts +35 -0
- package/dist/cli/list.d.ts.map +1 -0
- package/dist/cli/list.js +210 -0
- package/dist/cli/list.js.map +1 -0
- package/dist/cli/options.d.ts +100 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +241 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli/query.d.ts +24 -0
- package/dist/cli/query.d.ts.map +1 -0
- package/dist/cli/query.js +191 -0
- package/dist/cli/query.js.map +1 -0
- package/dist/cli/read-neighbors.d.ts +11 -0
- package/dist/cli/read-neighbors.d.ts.map +1 -0
- package/dist/cli/read-neighbors.js +224 -0
- package/dist/cli/read-neighbors.js.map +1 -0
- package/dist/cli/status.d.ts +8 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +80 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/sync.d.ts +8 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +244 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli-main.d.ts +12 -0
- package/dist/cli-main.d.ts.map +1 -0
- package/dist/cli-main.js +63 -0
- package/dist/cli-main.js.map +1 -0
- package/dist/embedder/index.d.ts +85 -0
- package/dist/embedder/index.d.ts.map +1 -0
- package/dist/embedder/index.js +284 -0
- package/dist/embedder/index.js.map +1 -0
- package/dist/features/list.d.ts +37 -0
- package/dist/features/list.d.ts.map +1 -0
- package/dist/features/list.js +40 -0
- package/dist/features/list.js.map +1 -0
- package/dist/features/sync.d.ts +207 -0
- package/dist/features/sync.d.ts.map +1 -0
- package/dist/features/sync.js +380 -0
- package/dist/features/sync.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/compute.d.ts +86 -0
- package/dist/ingest/compute.d.ts.map +1 -0
- package/dist/ingest/compute.js +177 -0
- package/dist/ingest/compute.js.map +1 -0
- package/dist/ingest/file.d.ts +27 -0
- package/dist/ingest/file.d.ts.map +1 -0
- package/dist/ingest/file.js +67 -0
- package/dist/ingest/file.js.map +1 -0
- package/dist/ingest/visual.d.ts +45 -0
- package/dist/ingest/visual.d.ts.map +1 -0
- package/dist/ingest/visual.js +234 -0
- package/dist/ingest/visual.js.map +1 -0
- package/dist/parser/docx-parser.d.ts +12 -0
- package/dist/parser/docx-parser.d.ts.map +1 -0
- package/dist/parser/docx-parser.js +328 -0
- package/dist/parser/docx-parser.js.map +1 -0
- package/dist/parser/html-parser.d.ts +18 -0
- package/dist/parser/html-parser.d.ts.map +1 -0
- package/dist/parser/html-parser.js +102 -0
- package/dist/parser/html-parser.js.map +1 -0
- package/dist/parser/index.d.ts +214 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +454 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/pdf-extract.d.ts +81 -0
- package/dist/parser/pdf-extract.d.ts.map +1 -0
- package/dist/parser/pdf-extract.js +112 -0
- package/dist/parser/pdf-extract.js.map +1 -0
- package/dist/parser/pdf-filter.d.ts +117 -0
- package/dist/parser/pdf-filter.d.ts.map +1 -0
- package/dist/parser/pdf-filter.js +528 -0
- package/dist/parser/pdf-filter.js.map +1 -0
- package/dist/parser/title-extractor.d.ts +69 -0
- package/dist/parser/title-extractor.d.ts.map +1 -0
- package/dist/parser/title-extractor.js +145 -0
- package/dist/parser/title-extractor.js.map +1 -0
- package/dist/pdf-visual/captioner.d.ts +16 -0
- package/dist/pdf-visual/captioner.d.ts.map +1 -0
- package/dist/pdf-visual/captioner.js +63 -0
- package/dist/pdf-visual/captioner.js.map +1 -0
- package/dist/pdf-visual/captioners/fast.d.ts +7 -0
- package/dist/pdf-visual/captioners/fast.d.ts.map +1 -0
- package/dist/pdf-visual/captioners/fast.js +103 -0
- package/dist/pdf-visual/captioners/fast.js.map +1 -0
- package/dist/pdf-visual/captioners/quality.d.ts +7 -0
- package/dist/pdf-visual/captioners/quality.d.ts.map +1 -0
- package/dist/pdf-visual/captioners/quality.js +127 -0
- package/dist/pdf-visual/captioners/quality.js.map +1 -0
- package/dist/pdf-visual/captioners/shared.d.ts +44 -0
- package/dist/pdf-visual/captioners/shared.d.ts.map +1 -0
- package/dist/pdf-visual/captioners/shared.js +104 -0
- package/dist/pdf-visual/captioners/shared.js.map +1 -0
- package/dist/pdf-visual/detector.d.ts +9 -0
- package/dist/pdf-visual/detector.d.ts.map +1 -0
- package/dist/pdf-visual/detector.js +234 -0
- package/dist/pdf-visual/detector.js.map +1 -0
- package/dist/pdf-visual/index.d.ts +13 -0
- package/dist/pdf-visual/index.d.ts.map +1 -0
- package/dist/pdf-visual/index.js +45 -0
- package/dist/pdf-visual/index.js.map +1 -0
- package/dist/pdf-visual/renderer.d.ts +9 -0
- package/dist/pdf-visual/renderer.d.ts.map +1 -0
- package/dist/pdf-visual/renderer.js +177 -0
- package/dist/pdf-visual/renderer.js.map +1 -0
- package/dist/pdf-visual/types.d.ts +62 -0
- package/dist/pdf-visual/types.d.ts.map +1 -0
- package/dist/pdf-visual/types.js +32 -0
- package/dist/pdf-visual/types.js.map +1 -0
- package/dist/server/error-utils.d.ts +79 -0
- package/dist/server/error-utils.d.ts.map +1 -0
- package/dist/server/error-utils.js +148 -0
- package/dist/server/error-utils.js.map +1 -0
- package/dist/server/index.d.ts +258 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +1104 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/list-scanner.d.ts +52 -0
- package/dist/server/list-scanner.d.ts.map +1 -0
- package/dist/server/list-scanner.js +72 -0
- package/dist/server/list-scanner.js.map +1 -0
- package/dist/server/tool-definitions.d.ts +8 -0
- package/dist/server/tool-definitions.d.ts.map +1 -0
- package/dist/server/tool-definitions.js +181 -0
- package/dist/server/tool-definitions.js.map +1 -0
- package/dist/server/tool-input.d.ts +37 -0
- package/dist/server/tool-input.d.ts.map +1 -0
- package/dist/server/tool-input.js +216 -0
- package/dist/server/tool-input.js.map +1 -0
- package/dist/server/types.d.ts +331 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +3 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server-main.d.ts +46 -0
- package/dist/server-main.d.ts.map +1 -0
- package/dist/server-main.js +242 -0
- package/dist/server-main.js.map +1 -0
- package/dist/utils/base-dirs.d.ts +212 -0
- package/dist/utils/base-dirs.d.ts.map +1 -0
- package/dist/utils/base-dirs.js +422 -0
- package/dist/utils/base-dirs.js.map +1 -0
- package/dist/utils/errors.d.ts +24 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +53 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/limits.d.ts +26 -0
- package/dist/utils/limits.d.ts.map +1 -0
- package/dist/utils/limits.js +28 -0
- package/dist/utils/limits.js.map +1 -0
- package/dist/utils/list-sources.d.ts +47 -0
- package/dist/utils/list-sources.d.ts.map +1 -0
- package/dist/utils/list-sources.js +50 -0
- package/dist/utils/list-sources.js.map +1 -0
- package/dist/utils/raw-data-utils.d.ts +131 -0
- package/dist/utils/raw-data-utils.d.ts.map +1 -0
- package/dist/utils/raw-data-utils.js +255 -0
- package/dist/utils/raw-data-utils.js.map +1 -0
- package/dist/utils/scan.d.ts +126 -0
- package/dist/utils/scan.d.ts.map +1 -0
- package/dist/utils/scan.js +221 -0
- package/dist/utils/scan.js.map +1 -0
- package/dist/utils/scope-match.d.ts +43 -0
- package/dist/utils/scope-match.d.ts.map +1 -0
- package/dist/utils/scope-match.js +87 -0
- package/dist/utils/scope-match.js.map +1 -0
- package/dist/utils/sensitive-path.d.ts +23 -0
- package/dist/utils/sensitive-path.d.ts.map +1 -0
- package/dist/utils/sensitive-path.js +91 -0
- package/dist/utils/sensitive-path.js.map +1 -0
- package/dist/utils/sync-path-key.d.ts +20 -0
- package/dist/utils/sync-path-key.d.ts.map +1 -0
- package/dist/utils/sync-path-key.js +33 -0
- package/dist/utils/sync-path-key.js.map +1 -0
- package/dist/vectordb/index.d.ts +168 -0
- package/dist/vectordb/index.d.ts.map +1 -0
- package/dist/vectordb/index.js +619 -0
- package/dist/vectordb/index.js.map +1 -0
- package/dist/vectordb/search-filters.d.ts +39 -0
- package/dist/vectordb/search-filters.d.ts.map +1 -0
- package/dist/vectordb/search-filters.js +136 -0
- package/dist/vectordb/search-filters.js.map +1 -0
- package/dist/vectordb/types.d.ts +196 -0
- package/dist/vectordb/types.d.ts.map +1 -0
- package/dist/vectordb/types.js +224 -0
- package/dist/vectordb/types.js.map +1 -0
- package/package.json +105 -0
- package/skills/mcp-local-rag/SKILL.md +308 -0
- package/skills/mcp-local-rag/references/cli-reference.md +175 -0
- package/skills/mcp-local-rag/references/html-ingestion.md +78 -0
- package/skills/mcp-local-rag/references/query-optimization.md +57 -0
- package/skills/mcp-local-rag/references/result-refinement.md +56 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// Runtime validation for MCP tool arguments.
|
|
2
|
+
//
|
|
3
|
+
// MCP tool arguments arrive as `unknown` from the SDK: TypeScript types are
|
|
4
|
+
// erased at runtime, so the previous `as unknown as XxxInput` casts let
|
|
5
|
+
// malformed input flow into the handlers (non-string query, negative limit,
|
|
6
|
+
// missing metadata, enum-violating format). These validators reject malformed
|
|
7
|
+
// input at the entry boundary with `McpError(InvalidParams)` — the same
|
|
8
|
+
// structured failure shape `read_chunk_neighbors` already uses — without
|
|
9
|
+
// leaking internal diagnostics to the client.
|
|
10
|
+
import { isAbsolute } from 'node:path';
|
|
11
|
+
import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
12
|
+
import { QUALITY_PROFILES } from '../pdf-visual/types.js';
|
|
13
|
+
import { MAX_NEIGHBOR_COUNT, MAX_QUERY_LIMIT, MIN_QUERY_LIMIT } from '../utils/limits.js';
|
|
14
|
+
import { CONTENT_FORMATS } from '../utils/raw-data-utils.js';
|
|
15
|
+
const SCOPE_ERROR = 'scope must be a non-empty string or a non-empty array of non-empty strings';
|
|
16
|
+
/**
|
|
17
|
+
* Normalize the optional `scope` to a trimmed `string[]`, rejecting any other
|
|
18
|
+
* shape with `McpError(InvalidParams)`. Mirrors the `limit` boundary check.
|
|
19
|
+
*/
|
|
20
|
+
function normalizeScope(scope) {
|
|
21
|
+
const isNonEmptyString = (value) => typeof value === 'string' && value.trim().length > 0;
|
|
22
|
+
// Trim so whitespace-padded prefixes don't silently match nothing.
|
|
23
|
+
if (isNonEmptyString(scope)) {
|
|
24
|
+
return [scope.trim()];
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(scope) && scope.length > 0 && scope.every(isNonEmptyString)) {
|
|
27
|
+
return scope.map((value) => value.trim());
|
|
28
|
+
}
|
|
29
|
+
throw new McpError(ErrorCode.InvalidParams, SCOPE_ERROR);
|
|
30
|
+
}
|
|
31
|
+
function asRecord(raw, label) {
|
|
32
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
|
|
33
|
+
throw new McpError(ErrorCode.InvalidParams, `${label} arguments must be an object`);
|
|
34
|
+
}
|
|
35
|
+
return raw;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validate `query_documents` arguments. `query` must be a non-empty string;
|
|
39
|
+
* `limit`, when provided, must be a positive integer (the handler defaults it
|
|
40
|
+
* to 10 when absent).
|
|
41
|
+
*/
|
|
42
|
+
export function parseQueryDocumentsInput(raw) {
|
|
43
|
+
const obj = asRecord(raw, 'query_documents');
|
|
44
|
+
const { query, limit, scope } = obj;
|
|
45
|
+
if (typeof query !== 'string' || query.trim().length === 0) {
|
|
46
|
+
throw new McpError(ErrorCode.InvalidParams, 'query must be a non-empty string');
|
|
47
|
+
}
|
|
48
|
+
const input = { query };
|
|
49
|
+
if (limit !== undefined) {
|
|
50
|
+
// Bound to 1-20 at the entry boundary — the same range VectorStore.search
|
|
51
|
+
// enforces and the CLI `--limit` accepts. Rejecting here returns a clean
|
|
52
|
+
// McpError(InvalidParams) instead of letting an out-of-range value reach
|
|
53
|
+
// search() and surface as a DatabaseError.
|
|
54
|
+
if (typeof limit !== 'number' ||
|
|
55
|
+
!Number.isInteger(limit) ||
|
|
56
|
+
limit < MIN_QUERY_LIMIT ||
|
|
57
|
+
limit > MAX_QUERY_LIMIT) {
|
|
58
|
+
throw new McpError(ErrorCode.InvalidParams, 'limit must be an integer between 1 and 20');
|
|
59
|
+
}
|
|
60
|
+
input.limit = limit;
|
|
61
|
+
}
|
|
62
|
+
if (scope !== undefined) {
|
|
63
|
+
input.scope = normalizeScope(scope);
|
|
64
|
+
}
|
|
65
|
+
return input;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Validate `list_files` arguments. The tool historically takes no arguments, so
|
|
69
|
+
* an omitted `arguments` (`undefined`) or `{}` is accepted as "no scope". When
|
|
70
|
+
* `scope` is present, it is normalized the same way as `query_documents`.
|
|
71
|
+
*/
|
|
72
|
+
export function parseListFilesInput(raw) {
|
|
73
|
+
// Preserve the no-argument contract: `asRecord` rejects `undefined`, so
|
|
74
|
+
// short-circuit before it to avoid a spurious McpError on no-arg calls.
|
|
75
|
+
if (raw === undefined) {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
const { scope } = asRecord(raw, 'list_files');
|
|
79
|
+
if (scope === undefined) {
|
|
80
|
+
return {};
|
|
81
|
+
}
|
|
82
|
+
return { scope: normalizeScope(scope) };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Validate `ingest_data` arguments. `content` must be a non-empty string;
|
|
86
|
+
* `metadata` must be an object with a non-empty `source` string and a `format`
|
|
87
|
+
* in the supported set.
|
|
88
|
+
*/
|
|
89
|
+
export function parseIngestDataInput(raw) {
|
|
90
|
+
const obj = asRecord(raw, 'ingest_data');
|
|
91
|
+
const { content, metadata } = obj;
|
|
92
|
+
if (typeof content !== 'string' || content.length === 0) {
|
|
93
|
+
throw new McpError(ErrorCode.InvalidParams, 'content must be a non-empty string');
|
|
94
|
+
}
|
|
95
|
+
const meta = asRecord(metadata, 'ingest_data metadata');
|
|
96
|
+
const { source, format } = meta;
|
|
97
|
+
if (typeof source !== 'string' || source.trim().length === 0) {
|
|
98
|
+
throw new McpError(ErrorCode.InvalidParams, 'metadata.source must be a non-empty string');
|
|
99
|
+
}
|
|
100
|
+
if (typeof format !== 'string' || !CONTENT_FORMATS.includes(format)) {
|
|
101
|
+
throw new McpError(ErrorCode.InvalidParams, `metadata.format must be one of: ${CONTENT_FORMATS.join(', ')}`);
|
|
102
|
+
}
|
|
103
|
+
return { content, metadata: { source, format: format } };
|
|
104
|
+
}
|
|
105
|
+
export function parseIngestFileInput(raw) {
|
|
106
|
+
const { filePath, visual, visualQuality } = asRecord(raw, 'ingest_file');
|
|
107
|
+
if (typeof filePath !== 'string' || filePath.trim().length === 0) {
|
|
108
|
+
throw new McpError(ErrorCode.InvalidParams, 'filePath must be a non-empty string');
|
|
109
|
+
}
|
|
110
|
+
if (visual !== undefined && typeof visual !== 'boolean') {
|
|
111
|
+
throw new McpError(ErrorCode.InvalidParams, "'visual' must be a boolean if provided");
|
|
112
|
+
}
|
|
113
|
+
if (visualQuality !== undefined &&
|
|
114
|
+
visualQuality !== '' &&
|
|
115
|
+
!QUALITY_PROFILES.includes(visualQuality)) {
|
|
116
|
+
throw new McpError(ErrorCode.InvalidParams, "'visualQuality' must be 'fast' or 'quality' if provided");
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
filePath,
|
|
120
|
+
...(visual !== undefined ? { visual } : {}),
|
|
121
|
+
...(QUALITY_PROFILES.includes(visualQuality)
|
|
122
|
+
? { visualQuality: visualQuality }
|
|
123
|
+
: {}),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function nonEmptyString(value) {
|
|
127
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
128
|
+
}
|
|
129
|
+
export function parseDeleteFileInput(raw) {
|
|
130
|
+
const { filePath, source } = asRecord(raw, 'delete_file');
|
|
131
|
+
const hasFilePath = nonEmptyString(filePath);
|
|
132
|
+
const hasSource = nonEmptyString(source);
|
|
133
|
+
if (hasFilePath === hasSource) {
|
|
134
|
+
throw new McpError(ErrorCode.InvalidParams, hasFilePath
|
|
135
|
+
? 'Provide either filePath or source, not both'
|
|
136
|
+
: 'Either filePath or source must be provided');
|
|
137
|
+
}
|
|
138
|
+
return hasFilePath ? { filePath } : { source: source };
|
|
139
|
+
}
|
|
140
|
+
export function parseReadChunkNeighborsInput(raw) {
|
|
141
|
+
const { filePath, source, chunkIndex, before, after } = asRecord(raw, 'read_chunk_neighbors');
|
|
142
|
+
if (!Number.isInteger(chunkIndex) || chunkIndex < 0) {
|
|
143
|
+
throw new McpError(ErrorCode.InvalidParams, 'chunkIndex must be a non-negative integer');
|
|
144
|
+
}
|
|
145
|
+
for (const [label, value] of [
|
|
146
|
+
['before', before],
|
|
147
|
+
['after', after],
|
|
148
|
+
]) {
|
|
149
|
+
if (value !== undefined && (!Number.isInteger(value) || value < 0)) {
|
|
150
|
+
throw new McpError(ErrorCode.InvalidParams, `${label} must be a non-negative integer`);
|
|
151
|
+
}
|
|
152
|
+
if (typeof value === 'number' && value > MAX_NEIGHBOR_COUNT) {
|
|
153
|
+
throw new McpError(ErrorCode.InvalidParams, `${label} must be between 0 and 50 (got ${value})`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const ref = parseDeleteFileInput({ filePath, source });
|
|
157
|
+
return {
|
|
158
|
+
...ref,
|
|
159
|
+
chunkIndex: chunkIndex,
|
|
160
|
+
...(before !== undefined ? { before: before } : {}),
|
|
161
|
+
...(after !== undefined ? { after: after } : {}),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Validate `sync_start` arguments. The tool is legitimately callable with no
|
|
166
|
+
* arguments — an omitted `path` means "every configured base directory" — so
|
|
167
|
+
* both `undefined` and `{}` are accepted, the same contract `list_files` has.
|
|
168
|
+
*
|
|
169
|
+
* Root containment is deliberately not checked here: the sync core owns that
|
|
170
|
+
* rule so the CLI and MCP surfaces cannot drift apart.
|
|
171
|
+
*/
|
|
172
|
+
export function parseSyncStartInput(raw) {
|
|
173
|
+
if (raw === undefined) {
|
|
174
|
+
return {};
|
|
175
|
+
}
|
|
176
|
+
const { path } = asRecord(raw, 'sync_start');
|
|
177
|
+
if (path === undefined) {
|
|
178
|
+
return {};
|
|
179
|
+
}
|
|
180
|
+
if (!nonEmptyString(path)) {
|
|
181
|
+
throw new McpError(ErrorCode.InvalidParams, 'path must be a non-empty string');
|
|
182
|
+
}
|
|
183
|
+
// Trimmed for the same reason as `scope`: a whitespace-padded path would
|
|
184
|
+
// otherwise be resolved verbatim and silently match nothing on disk.
|
|
185
|
+
const trimmed = path.trim();
|
|
186
|
+
// A relative path would be resolved against the server process's working
|
|
187
|
+
// directory, which the caller cannot see. `ingest_file` and `delete_file`
|
|
188
|
+
// already require absolute paths, and the tool description promises one.
|
|
189
|
+
if (!isAbsolute(trimmed)) {
|
|
190
|
+
throw new McpError(ErrorCode.InvalidParams, 'path must be an absolute path');
|
|
191
|
+
}
|
|
192
|
+
return { path: trimmed };
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* A job id is a `randomUUID()` this server handed out: 36 characters of
|
|
196
|
+
* hexadecimal and dashes. The cap and the alphabet are enforced because the value
|
|
197
|
+
* is echoed into the "unknown sync job" message and into a stderr log line — an
|
|
198
|
+
* unbounded id with a newline in it would forge a log line for the operator.
|
|
199
|
+
*/
|
|
200
|
+
const JOB_ID_PATTERN = /^[0-9a-fA-F-]{1,128}$/;
|
|
201
|
+
/**
|
|
202
|
+
* Validate `sync_status` arguments. `jobId` is required; an unknown but
|
|
203
|
+
* well-formed id is the handler's concern, not this boundary's.
|
|
204
|
+
*/
|
|
205
|
+
export function parseSyncStatusInput(raw) {
|
|
206
|
+
const { jobId } = asRecord(raw, 'sync_status');
|
|
207
|
+
if (!nonEmptyString(jobId)) {
|
|
208
|
+
throw new McpError(ErrorCode.InvalidParams, 'jobId must be a non-empty string');
|
|
209
|
+
}
|
|
210
|
+
const trimmed = jobId.trim();
|
|
211
|
+
if (!JOB_ID_PATTERN.test(trimmed)) {
|
|
212
|
+
throw new McpError(ErrorCode.InvalidParams, 'jobId must be at most 128 characters of hexadecimal digits and dashes');
|
|
213
|
+
}
|
|
214
|
+
return { jobId: trimmed };
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=tool-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-input.js","sourceRoot":"","sources":["../../src/server/tool-input.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,8EAA8E;AAC9E,wEAAwE;AACxE,yEAAyE;AACzE,8CAA8C;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAA;AAC9E,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzF,OAAO,EAAE,eAAe,EAAsB,MAAM,4BAA4B,CAAA;AAYhF,MAAM,WAAW,GAAG,4EAA4E,CAAA;AAEhG;;;GAGG;AACH,SAAS,cAAc,CAAC,KAAc;IACpC,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAmB,EAAE,CAC3D,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAA;IAEtD,mEAAmE;IACnE,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IACvB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC9E,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,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,SAAS,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAA;IAChF,CAAC;IAED,yEAAyE;IACzE,qEAAqE;IACrE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAE3B,yEAAyE;IACzE,0EAA0E;IAC1E,yEAAyE;IACzE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,+BAA+B,CAAC,CAAA;IAC9E,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,cAAc,GAAG,uBAAuB,CAAA;AAE9C;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC/C,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC,CAAA;IAE9C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,kCAAkC,CAAC,CAAA;IACjF,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAE5B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,aAAa,EACvB,uEAAuE,CACxE,CAAA;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import type { QualityProfile } from '../pdf-visual/types.js';
|
|
2
|
+
import type { BaseDirsConfigError } from '../utils/base-dirs.js';
|
|
3
|
+
import type { ContentFormat } from '../utils/raw-data-utils.js';
|
|
4
|
+
import type { GroupingMode } from '../vectordb/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Fields shared by both `RAGServerConfig` shapes (legacy single-root and
|
|
7
|
+
* multi-root). Extracted so the union below only needs to describe the
|
|
8
|
+
* `baseDir` / `baseDirs` axis.
|
|
9
|
+
*/
|
|
10
|
+
interface RAGServerConfigBase {
|
|
11
|
+
/** LanceDB database path */
|
|
12
|
+
dbPath: string;
|
|
13
|
+
/** Transformers.js model path */
|
|
14
|
+
modelName: string;
|
|
15
|
+
/** Model cache directory */
|
|
16
|
+
cacheDir: string;
|
|
17
|
+
/** Maximum file size (100MB) */
|
|
18
|
+
maxFileSize: number;
|
|
19
|
+
/** Compute device (cpu, webgpu, dml, etc) */
|
|
20
|
+
device?: string;
|
|
21
|
+
/** Embedding quantization dtype (fp32, fp16, q8, int8, ...). Unset → fp32. */
|
|
22
|
+
dtype?: string;
|
|
23
|
+
/** Maximum distance threshold for quality filtering (optional) */
|
|
24
|
+
maxDistance?: number;
|
|
25
|
+
/** Grouping mode for quality filtering (optional) */
|
|
26
|
+
grouping?: GroupingMode;
|
|
27
|
+
/** Hybrid search weight for BM25 (0.0 = vector only, 1.0 = BM25 only, default 0.6) */
|
|
28
|
+
hybridWeight?: number;
|
|
29
|
+
/** Maximum number of files to keep in search results (optional) */
|
|
30
|
+
maxFiles?: number;
|
|
31
|
+
/** Minimum chunk length in characters (optional, default: 50) */
|
|
32
|
+
chunkMinLength?: number;
|
|
33
|
+
/** Store bounded PDF regions and Mammoth-produced DOCX images. */
|
|
34
|
+
storeImages?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Normal-path (resolve()) roots, index-aligned with the realpath'd `baseDirs`
|
|
37
|
+
* security boundary; used for user-facing `list_files` scan/display so paths
|
|
38
|
+
* match the resolve()-stored DB keys. From `BaseDirsConfig.rawBaseDirs` (see
|
|
39
|
+
* it for the path policy). Optional: legacy `{ baseDir }` callers fall back to
|
|
40
|
+
* `baseDirs`.
|
|
41
|
+
*/
|
|
42
|
+
rawBaseDirs?: readonly string[];
|
|
43
|
+
/** Configuration validation warnings to surface to users via MCP annotations */
|
|
44
|
+
configWarnings?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Structured base-dirs resolution error. When present, the server is in
|
|
47
|
+
* degraded mode: `status` remains callable so the user can diagnose the
|
|
48
|
+
* problem via MCP, while root-dependent tools surface the error before
|
|
49
|
+
* doing DB or filesystem work. See `resolveBaseDirs` for the error
|
|
50
|
+
* semantics.
|
|
51
|
+
*/
|
|
52
|
+
configError?: BaseDirsConfigError;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* RAGServer configuration.
|
|
56
|
+
*
|
|
57
|
+
* Accepts either a single `baseDir` (legacy shape — preserved so existing
|
|
58
|
+
* direct callers and tests that pass `{ baseDir }` continue to work) or
|
|
59
|
+
* `baseDirs` (multi-root shape produced by `resolveBaseDirs`). Exactly one
|
|
60
|
+
* of the two MUST be supplied. The constructor normalizes both into a single
|
|
61
|
+
* `baseDirs: string[]` internally and derives the legacy `baseDir` accessor
|
|
62
|
+
* as `baseDirs[0]`.
|
|
63
|
+
*/
|
|
64
|
+
export type RAGServerConfig = (RAGServerConfigBase & {
|
|
65
|
+
/** Document base directory (legacy single-root shape). */
|
|
66
|
+
baseDir: string;
|
|
67
|
+
baseDirs?: undefined;
|
|
68
|
+
}) | (RAGServerConfigBase & {
|
|
69
|
+
/** One or more allowed document base directories (multi-root shape). */
|
|
70
|
+
baseDirs: string[];
|
|
71
|
+
baseDir?: undefined;
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* query_documents tool input
|
|
75
|
+
*/
|
|
76
|
+
export interface QueryDocumentsInput {
|
|
77
|
+
/** Natural language query */
|
|
78
|
+
query: string;
|
|
79
|
+
/** Number of results to retrieve (default 10) */
|
|
80
|
+
limit?: number;
|
|
81
|
+
/** Path prefix scope (one or a list); the parser normalizes to `string[]`. */
|
|
82
|
+
scope?: string | string[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* list_files tool input
|
|
86
|
+
*/
|
|
87
|
+
export interface ListFilesInput {
|
|
88
|
+
/** Path prefix scope (one or a list); the parser normalizes to `string[]`. */
|
|
89
|
+
scope?: string | string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* ingest_file tool input
|
|
93
|
+
*/
|
|
94
|
+
export interface IngestFileInput {
|
|
95
|
+
/** File path */
|
|
96
|
+
filePath: string;
|
|
97
|
+
/**
|
|
98
|
+
* When true and `filePath` is a PDF, the visual enrichment path runs
|
|
99
|
+
* (VLM captioning of figure-heavy pages). For non-PDF files this flag is
|
|
100
|
+
* silently coerced to the default text-only path. The runtime check at the
|
|
101
|
+
* handler boundary stays in place because MCP arguments arrive as `unknown`
|
|
102
|
+
* from the SDK.
|
|
103
|
+
*/
|
|
104
|
+
visual?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Visual-quality profile when `visual` is true. Some MCP clients send the
|
|
107
|
+
* empty string for unspecified optional parameters; the transport decoder
|
|
108
|
+
* normalizes it before this type reaches the handler.
|
|
109
|
+
*/
|
|
110
|
+
visualQuality?: QualityProfile;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* ingest_data tool input metadata
|
|
114
|
+
*/
|
|
115
|
+
interface IngestDataMetadata {
|
|
116
|
+
/** Source identifier: URL ("https://...") or custom ID ("clipboard://2024-12-30") */
|
|
117
|
+
source: string;
|
|
118
|
+
/** Content format */
|
|
119
|
+
format: ContentFormat;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* ingest_data tool input
|
|
123
|
+
*/
|
|
124
|
+
export interface IngestDataInput {
|
|
125
|
+
/** Content to ingest (text, HTML, or Markdown) */
|
|
126
|
+
content: string;
|
|
127
|
+
/** Content metadata */
|
|
128
|
+
metadata: IngestDataMetadata;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* delete_file tool input
|
|
132
|
+
* Either filePath or source must be provided
|
|
133
|
+
*/
|
|
134
|
+
export type DeleteFileInput = {
|
|
135
|
+
filePath: string;
|
|
136
|
+
source?: never;
|
|
137
|
+
} | {
|
|
138
|
+
source: string;
|
|
139
|
+
filePath?: never;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* delete_file tool output
|
|
143
|
+
*/
|
|
144
|
+
export interface DeleteFileResult {
|
|
145
|
+
/** Resolved file path used for the delete operation */
|
|
146
|
+
filePath: string;
|
|
147
|
+
/** True when the delete operation completed (idempotent; not "something was removed") */
|
|
148
|
+
deleted: true;
|
|
149
|
+
/** Number of vector chunks removed from the database */
|
|
150
|
+
removedChunks: number;
|
|
151
|
+
/** True when ingested chunks and/or raw-data artifacts existed before delete */
|
|
152
|
+
existed: boolean;
|
|
153
|
+
/** Timestamp */
|
|
154
|
+
timestamp: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* ingest_file tool output
|
|
158
|
+
*/
|
|
159
|
+
export interface IngestResult {
|
|
160
|
+
/** File path */
|
|
161
|
+
filePath: string;
|
|
162
|
+
/** Chunk count */
|
|
163
|
+
chunkCount: number;
|
|
164
|
+
/** Timestamp */
|
|
165
|
+
timestamp: string;
|
|
166
|
+
/** Document title extracted from file content (display-only, not used for scoring) */
|
|
167
|
+
fileTitle: string | null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* list_files tool output — entry for a file found under one of the effective
|
|
171
|
+
* base directories.
|
|
172
|
+
*
|
|
173
|
+
* `baseDir` identifies the producing root (one of `ListFilesResult.baseDirs`).
|
|
174
|
+
* Always present, including in single-root configurations — the field is
|
|
175
|
+
* additive over the legacy shape, so existing clients that ignore it continue
|
|
176
|
+
* to work.
|
|
177
|
+
*/
|
|
178
|
+
export type FileEntry = {
|
|
179
|
+
filePath: string;
|
|
180
|
+
baseDir: string;
|
|
181
|
+
ingested: true;
|
|
182
|
+
chunkCount: number;
|
|
183
|
+
timestamp: string;
|
|
184
|
+
} | {
|
|
185
|
+
filePath: string;
|
|
186
|
+
baseDir: string;
|
|
187
|
+
ingested: false;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* list_files tool output — entry for content ingested via ingest_data,
|
|
191
|
+
* or an orphaned DB entry whose file no longer exists on disk
|
|
192
|
+
*/
|
|
193
|
+
export type SourceEntry = {
|
|
194
|
+
source: string;
|
|
195
|
+
chunkCount: number;
|
|
196
|
+
timestamp: string;
|
|
197
|
+
} | {
|
|
198
|
+
filePath: string;
|
|
199
|
+
chunkCount: number;
|
|
200
|
+
timestamp: string;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* list_files tool output.
|
|
204
|
+
*
|
|
205
|
+
* Multi-root contract:
|
|
206
|
+
* - `baseDirs`: all effective roots (normal resolve() form, nested-root pruned).
|
|
207
|
+
* - `baseDir`: the first effective root (`baseDirs[0]`). Preserved as a
|
|
208
|
+
* legacy field so clients written against the single-root shape continue to
|
|
209
|
+
* work.
|
|
210
|
+
* - `files`: union across roots, each annotated with its producing `baseDir`.
|
|
211
|
+
* Exact duplicate paths across roots are de-duplicated (first occurrence
|
|
212
|
+
* wins, preserving root iteration order).
|
|
213
|
+
* - `sources`: raw-data entries (from `ingest_data`) and orphaned DB entries
|
|
214
|
+
* whose files no longer exist on disk. Sources are not produced by any
|
|
215
|
+
* root, so they carry no `baseDir` annotation.
|
|
216
|
+
*/
|
|
217
|
+
export interface ListFilesResult {
|
|
218
|
+
baseDir: string;
|
|
219
|
+
baseDirs: string[];
|
|
220
|
+
files: FileEntry[];
|
|
221
|
+
sources: SourceEntry[];
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* query_documents tool output
|
|
225
|
+
*/
|
|
226
|
+
export interface QueryResult {
|
|
227
|
+
/** File path */
|
|
228
|
+
filePath: string;
|
|
229
|
+
/** Chunk index */
|
|
230
|
+
chunkIndex: number;
|
|
231
|
+
/** Text */
|
|
232
|
+
text: string;
|
|
233
|
+
/** Similarity score */
|
|
234
|
+
score: number;
|
|
235
|
+
/** Original source (only for raw-data files, e.g., URLs ingested via ingest_data) */
|
|
236
|
+
source?: string;
|
|
237
|
+
/** Document title extracted from file content (display-only, not used for scoring) */
|
|
238
|
+
fileTitle: string | null;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* read_chunk_neighbors tool input.
|
|
242
|
+
* Exactly one of filePath / source must be provided (XOR).
|
|
243
|
+
*/
|
|
244
|
+
export type ReadChunkNeighborsInput = DeleteFileInput & {
|
|
245
|
+
/** Target chunk index (zero-based, required, non-negative integer). */
|
|
246
|
+
chunkIndex: number;
|
|
247
|
+
/** Number of chunks before the target to include (default 2, non-negative integer). */
|
|
248
|
+
before?: number;
|
|
249
|
+
/** Number of chunks after the target to include (default 2, non-negative integer). */
|
|
250
|
+
after?: number;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* read_chunk_neighbors tool output item.
|
|
254
|
+
* Core fields are {filePath, chunkIndex, text}. `isTarget` is true only for
|
|
255
|
+
* the requested target when it exists, and `source` is present only on
|
|
256
|
+
* raw-data rows.
|
|
257
|
+
* fileTitle mirrors QueryResult for drop-in consistency with query_documents results.
|
|
258
|
+
*/
|
|
259
|
+
export interface ReadChunkNeighborsResultItem {
|
|
260
|
+
/** File path */
|
|
261
|
+
filePath: string;
|
|
262
|
+
/** Chunk index */
|
|
263
|
+
chunkIndex: number;
|
|
264
|
+
/** Text */
|
|
265
|
+
text: string;
|
|
266
|
+
/** True iff this chunk's chunkIndex matches the requested target. */
|
|
267
|
+
isTarget: boolean;
|
|
268
|
+
/** Original source (only for raw-data files, e.g., URLs ingested via ingest_data). */
|
|
269
|
+
source?: string;
|
|
270
|
+
/** Document title extracted from file content (display-only, not used for scoring) */
|
|
271
|
+
fileTitle: string | null;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* sync_start tool input
|
|
275
|
+
*/
|
|
276
|
+
export interface SyncStartInput {
|
|
277
|
+
/** Absolute path inside a configured root. Omitted means every configured root. */
|
|
278
|
+
path?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* sync_status tool input
|
|
282
|
+
*/
|
|
283
|
+
export interface SyncStatusInput {
|
|
284
|
+
/** Identifier returned by sync_start. */
|
|
285
|
+
jobId: string;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Lifecycle of the one process-local sync job the server retains. There is no
|
|
289
|
+
* cancelled, queued, or recovered state: the record lives only for the server
|
|
290
|
+
* process and a new job replaces a terminal one.
|
|
291
|
+
*/
|
|
292
|
+
export type SyncJobState = 'running' | 'succeeded' | 'failed';
|
|
293
|
+
/**
|
|
294
|
+
* Per-file outcome counters of a sync job. Structurally identical to the sync
|
|
295
|
+
* core's counters, restated here because `server/` does not depend on
|
|
296
|
+
* `features/`.
|
|
297
|
+
*/
|
|
298
|
+
export interface SyncSummary {
|
|
299
|
+
/** Files re-ingested because they were new, changed, or stored inconsistently. */
|
|
300
|
+
upserted: number;
|
|
301
|
+
/** Files whose stored content identity already matched the disk bytes. */
|
|
302
|
+
skipped: number;
|
|
303
|
+
/** Present files that produced zero chunks; their prior rows and hash are kept. */
|
|
304
|
+
empty: number;
|
|
305
|
+
/** Indexed files removed from the index. Counts files, not rows, and is outside `completed`. */
|
|
306
|
+
pruned: number;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* sync_status tool output — the whole pollable record for one job.
|
|
310
|
+
*
|
|
311
|
+
* `total` stays `null` until scanning has counted the supported files on disk,
|
|
312
|
+
* and `completed` (`upserted + skipped + empty`) never exceeds a non-null
|
|
313
|
+
* `total`. `error` is `null` unless the job failed; a failed job carries one
|
|
314
|
+
* controlled message that names the file for a per-file failure. A job succeeds
|
|
315
|
+
* only when `error` is `null`.
|
|
316
|
+
*/
|
|
317
|
+
export interface SyncStatusResult {
|
|
318
|
+
jobId: string;
|
|
319
|
+
state: SyncJobState;
|
|
320
|
+
total: number | null;
|
|
321
|
+
completed: number;
|
|
322
|
+
summary: SyncSummary;
|
|
323
|
+
/**
|
|
324
|
+
* Scanner coverage warnings, carried as JSON rather than as the content
|
|
325
|
+
* blocks `list_files` uses, because status is a single pollable record.
|
|
326
|
+
*/
|
|
327
|
+
warnings: string[];
|
|
328
|
+
error: string | null;
|
|
329
|
+
}
|
|
330
|
+
export {};
|
|
331
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD;;;;GAIG;AACH,UAAU,mBAAmB;IAC3B,4BAA4B;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kEAAkE;IAClE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB;;;;;;OAMG;IACH,WAA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D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAA;IAChB,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAA;IACf,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAA;IACb,gGAAgG;IAChG,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,YAAY,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,WAAW,CAAA;IACpB;;;OAGG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,iCAAiC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RAGServer } from './server/index.js';
|
|
2
|
+
import type { GroupingMode } from './vectordb/index.js';
|
|
3
|
+
/** Result of parsing an environment variable */
|
|
4
|
+
export interface ParseResult<T> {
|
|
5
|
+
value: T | undefined;
|
|
6
|
+
warning?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parse grouping mode from environment variable
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseGroupingMode(value: string | undefined): ParseResult<GroupingMode>;
|
|
12
|
+
/**
|
|
13
|
+
* Parse max distance from environment variable
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseMaxDistance(value: string | undefined): ParseResult<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Parse max files from environment variable
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseMaxFiles(value: string | undefined): ParseResult<number>;
|
|
20
|
+
/**
|
|
21
|
+
* Parse hybrid weight from environment variable
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseHybridWeight(value: string | undefined): ParseResult<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Parse chunk minimum length from environment variable
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseChunkMinLength(value: string | undefined): ParseResult<number>;
|
|
28
|
+
/** Parse the independent PDF image-storage toggle. */
|
|
29
|
+
export declare function parseStoreImages(value: string | undefined): ParseResult<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Resolve the full RAGServer configuration from environment variables.
|
|
32
|
+
*
|
|
33
|
+
* Pure (no process.exit, no transport): `env` and `cwd` are passed in so the
|
|
34
|
+
* entry-point wiring can be exercised directly in tests instead of via a copy.
|
|
35
|
+
* Single source of truth for BASE_DIRS / BASE_DIR / cwd precedence, the
|
|
36
|
+
* sensitive-path policy on both raw and realpath-normalized roots, and the
|
|
37
|
+
* never-fall-back-to-cwd-on-error rule.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveServerConfig(env: NodeJS.ProcessEnv, cwd: string): Promise<ConstructorParameters<typeof RAGServer>[0]>;
|
|
40
|
+
/**
|
|
41
|
+
* Start the RAG MCP Server
|
|
42
|
+
* Configuration is read from environment variables only (no CLI flags).
|
|
43
|
+
* This ensures the bare `mcp-local-rag` launch is suitable for MCP clients.
|
|
44
|
+
*/
|
|
45
|
+
export declare function startServer(): Promise<void>;
|
|
46
|
+
//# sourceMappingURL=server-main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-main.d.ts","sourceRoot":"","sources":["../src/server-main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAI7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAMvD,gDAAgD;AAChD,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,EAAE,CAAC,GAAG,SAAS,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB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