@jcode.labs/ragmir 2.17.2 → 2.18.1
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/README.md +53 -43
- package/dist/access-log.d.ts +10 -0
- package/dist/access-log.d.ts.map +1 -1
- package/dist/access-log.js +119 -49
- package/dist/access-log.js.map +1 -1
- package/dist/chunking.d.ts +5 -1
- package/dist/chunking.d.ts.map +1 -1
- package/dist/chunking.js +102 -16
- package/dist/chunking.js.map +1 -1
- package/dist/citation.d.ts +18 -0
- package/dist/citation.d.ts.map +1 -0
- package/dist/citation.js +54 -0
- package/dist/citation.js.map +1 -0
- package/dist/cli-entry.d.ts +3 -0
- package/dist/cli-entry.d.ts.map +1 -0
- package/dist/cli-entry.js +16 -0
- package/dist/cli-entry.js.map +1 -0
- package/dist/cli-fast.d.ts +13 -0
- package/dist/cli-fast.d.ts.map +1 -0
- package/dist/cli-fast.js +145 -0
- package/dist/cli-fast.js.map +1 -0
- package/dist/cli-options.d.ts +3 -0
- package/dist/cli-options.d.ts.map +1 -1
- package/dist/cli-options.js +7 -0
- package/dist/cli-options.js.map +1 -1
- package/dist/cli-stdin.d.ts +3 -0
- package/dist/cli-stdin.d.ts.map +1 -0
- package/dist/cli-stdin.js +15 -0
- package/dist/cli-stdin.js.map +1 -0
- package/dist/cli.js +251 -44
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +13 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +155 -10
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +227 -49
- package/dist/config.js.map +1 -1
- package/dist/context-resources.d.ts +4 -2
- package/dist/context-resources.d.ts.map +1 -1
- package/dist/context-resources.js +55 -24
- package/dist/context-resources.js.map +1 -1
- package/dist/defaults.d.ts +27 -0
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +42 -2
- package/dist/defaults.js.map +1 -1
- package/dist/destroy.d.ts +2 -2
- package/dist/destroy.d.ts.map +1 -1
- package/dist/destroy.js +34 -20
- package/dist/destroy.js.map +1 -1
- package/dist/doctor.d.ts +3 -2
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +86 -41
- package/dist/doctor.js.map +1 -1
- package/dist/durable-file.d.ts +13 -0
- package/dist/durable-file.d.ts.map +1 -0
- package/dist/durable-file.js +56 -0
- package/dist/durable-file.js.map +1 -0
- package/dist/embeddings.d.ts +14 -3
- package/dist/embeddings.d.ts.map +1 -1
- package/dist/embeddings.js +233 -95
- package/dist/embeddings.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/evaluate.d.ts +4 -3
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +611 -110
- package/dist/evaluate.js.map +1 -1
- package/dist/files.d.ts +4 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +119 -33
- package/dist/files.js.map +1 -1
- package/dist/generation-retention.d.ts +52 -0
- package/dist/generation-retention.d.ts.map +1 -0
- package/dist/generation-retention.js +318 -0
- package/dist/generation-retention.js.map +1 -0
- package/dist/index-diagnostics.d.ts +3 -2
- package/dist/index-diagnostics.d.ts.map +1 -1
- package/dist/index-diagnostics.js +32 -3
- package/dist/index-diagnostics.js.map +1 -1
- package/dist/index-policy.d.ts.map +1 -1
- package/dist/index-policy.js +3 -0
- package/dist/index-policy.js.map +1 -1
- package/dist/index-write-lock.d.ts +16 -1
- package/dist/index-write-lock.d.ts.map +1 -1
- package/dist/index-write-lock.js +392 -13
- package/dist/index-write-lock.js.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/ingest.d.ts +11 -2
- package/dist/ingest.d.ts.map +1 -1
- package/dist/ingest.js +680 -165
- package/dist/ingest.js.map +1 -1
- package/dist/ingestion-metrics.d.ts +58 -0
- package/dist/ingestion-metrics.d.ts.map +1 -0
- package/dist/ingestion-metrics.js +216 -0
- package/dist/ingestion-metrics.js.map +1 -0
- package/dist/ingestion-state.d.ts +11 -2
- package/dist/ingestion-state.d.ts.map +1 -1
- package/dist/ingestion-state.js +480 -49
- package/dist/ingestion-state.js.map +1 -1
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +11 -1
- package/dist/limits.js.map +1 -1
- package/dist/mcp-output.d.ts +44 -4
- package/dist/mcp-output.d.ts.map +1 -1
- package/dist/mcp-output.js +132 -159
- package/dist/mcp-output.js.map +1 -1
- package/dist/mcp-summaries.d.ts +32 -0
- package/dist/mcp-summaries.d.ts.map +1 -0
- package/dist/mcp-summaries.js +227 -0
- package/dist/mcp-summaries.js.map +1 -0
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +85 -46
- package/dist/mcp.js.map +1 -1
- package/dist/ocr-cache.d.ts +15 -0
- package/dist/ocr-cache.d.ts.map +1 -0
- package/dist/ocr-cache.js +90 -0
- package/dist/ocr-cache.js.map +1 -0
- package/dist/ocr.d.ts +31 -0
- package/dist/ocr.d.ts.map +1 -1
- package/dist/ocr.js +193 -17
- package/dist/ocr.js.map +1 -1
- package/dist/parsing.d.ts.map +1 -1
- package/dist/parsing.js +482 -85
- package/dist/parsing.js.map +1 -1
- package/dist/permissions.js +2 -2
- package/dist/permissions.js.map +1 -1
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +10 -11
- package/dist/preview.js.map +1 -1
- package/dist/quality-report.d.ts +12 -0
- package/dist/quality-report.d.ts.map +1 -0
- package/dist/quality-report.js +146 -0
- package/dist/quality-report.js.map +1 -0
- package/dist/query.d.ts +7 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +371 -284
- package/dist/query.js.map +1 -1
- package/dist/ranking.d.ts +38 -0
- package/dist/ranking.d.ts.map +1 -0
- package/dist/ranking.js +278 -0
- package/dist/ranking.js.map +1 -0
- package/dist/redaction.d.ts +6 -1
- package/dist/redaction.d.ts.map +1 -1
- package/dist/redaction.js +118 -4
- package/dist/redaction.js.map +1 -1
- package/dist/research.d.ts +6 -1
- package/dist/research.d.ts.map +1 -1
- package/dist/research.js +330 -130
- package/dist/research.js.map +1 -1
- package/dist/runtime-info.d.ts +3 -0
- package/dist/runtime-info.d.ts.map +1 -0
- package/dist/runtime-info.js +81 -0
- package/dist/runtime-info.js.map +1 -0
- package/dist/security.d.ts +3 -2
- package/dist/security.d.ts.map +1 -1
- package/dist/security.js +242 -45
- package/dist/security.js.map +1 -1
- package/dist/semantic-config.d.ts +7 -1
- package/dist/semantic-config.d.ts.map +1 -1
- package/dist/semantic-config.js +30 -4
- package/dist/semantic-config.js.map +1 -1
- package/dist/setup.js +6 -3
- package/dist/setup.js.map +1 -1
- package/dist/skill.js +34 -12
- package/dist/skill.js.map +1 -1
- package/dist/source-fingerprint-cache.d.ts +20 -0
- package/dist/source-fingerprint-cache.d.ts.map +1 -0
- package/dist/source-fingerprint-cache.js +133 -0
- package/dist/source-fingerprint-cache.js.map +1 -0
- package/dist/storage-maintenance.d.ts +46 -0
- package/dist/storage-maintenance.d.ts.map +1 -0
- package/dist/storage-maintenance.js +329 -0
- package/dist/storage-maintenance.js.map +1 -0
- package/dist/store.d.ts +39 -2
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +559 -24
- package/dist/store.js.map +1 -1
- package/dist/text.d.ts +1 -1
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +12 -2
- package/dist/text.js.map +1 -1
- package/dist/types.d.ts +414 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/vector-index.d.ts +42 -0
- package/dist/vector-index.d.ts.map +1 -0
- package/dist/vector-index.js +249 -0
- package/dist/vector-index.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workload.d.ts +22 -0
- package/dist/workload.d.ts.map +1 -0
- package/dist/workload.js +181 -0
- package/dist/workload.js.map +1 -0
- package/examples/document-evidence-benchmark/README.md +25 -63
- package/examples/document-evidence-benchmark/golden-queries.json +1 -1
- package/examples/library-api-demo/README.md +17 -57
- package/examples/sovereign-rag-demo/README.md +37 -97
- package/package.json +36 -11
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { loadConfig } from "./config.js";
|
|
2
|
-
import {
|
|
3
|
-
import { audit } from "./ingest.js";
|
|
2
|
+
import { doctorWithConfig } from "./doctor.js";
|
|
4
3
|
import { knowledgeBaseIdentity } from "./knowledge-bases.js";
|
|
5
4
|
import { operationSignal, throwIfAborted } from "./operation.js";
|
|
5
|
+
import { readIndexManifestFilePage, readIndexManifestHeader } from "./store.js";
|
|
6
6
|
const SOURCE_CATALOG_LIMIT = 50;
|
|
7
|
+
const MAX_SOURCE_CATALOG_LIMIT = 100;
|
|
7
8
|
const RAGMIR_MCP_TOOLS = [
|
|
8
9
|
"ragmir_status",
|
|
9
10
|
"ragmir_route_prompt",
|
|
@@ -21,8 +22,12 @@ export async function getKnowledgeBaseContext(cwd = process.cwd(), options = {})
|
|
|
21
22
|
const signal = operationSignal(options);
|
|
22
23
|
throwIfAborted(signal);
|
|
23
24
|
const config = await loadConfig(cwd);
|
|
25
|
+
return getKnowledgeBaseContextWithConfig(config, options);
|
|
26
|
+
}
|
|
27
|
+
export async function getKnowledgeBaseContextWithConfig(config, options = {}) {
|
|
28
|
+
const signal = operationSignal(options);
|
|
24
29
|
throwIfAborted(signal);
|
|
25
|
-
const report = await
|
|
30
|
+
const report = await doctorWithConfig(config, signal ? { signal } : {});
|
|
26
31
|
throwIfAborted(signal);
|
|
27
32
|
const identity = knowledgeBaseIdentity(config.projectRoot);
|
|
28
33
|
return {
|
|
@@ -31,6 +36,7 @@ export async function getKnowledgeBaseContext(cwd = process.cwd(), options = {})
|
|
|
31
36
|
privacyProfile: config.privacyProfile,
|
|
32
37
|
retrievalProfile: config.retrievalProfile,
|
|
33
38
|
embeddingProvider: config.embeddingProvider,
|
|
39
|
+
corpusFingerprint: report.corpusFingerprint,
|
|
34
40
|
ready: report.ready,
|
|
35
41
|
coverage: {
|
|
36
42
|
supportedFiles: report.supportedFiles,
|
|
@@ -55,42 +61,67 @@ export async function getKnowledgeBaseSourceCatalog(cwd = process.cwd(), options
|
|
|
55
61
|
const signal = operationSignal(options);
|
|
56
62
|
throwIfAborted(signal);
|
|
57
63
|
const config = await loadConfig(cwd);
|
|
64
|
+
return getKnowledgeBaseSourceCatalogWithConfig(config, options);
|
|
65
|
+
}
|
|
66
|
+
export async function getKnowledgeBaseSourceCatalogWithConfig(config, options = {}) {
|
|
67
|
+
const signal = operationSignal(options);
|
|
58
68
|
throwIfAborted(signal);
|
|
59
|
-
const
|
|
69
|
+
const offset = sourceCatalogOffset(options.offset);
|
|
70
|
+
const limit = sourceCatalogLimit(options.limit);
|
|
71
|
+
const [manifest, filePage] = await Promise.all([
|
|
72
|
+
readIndexManifestHeader(config),
|
|
73
|
+
readIndexManifestFilePage(config, offset, limit),
|
|
74
|
+
]);
|
|
60
75
|
throwIfAborted(signal);
|
|
61
76
|
const identity = knowledgeBaseIdentity(config.projectRoot);
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
const health = manifest?.health;
|
|
78
|
+
const indexedFiles = (filePage?.files ?? []).map((file) => ({
|
|
79
|
+
source: file.relativePath,
|
|
80
|
+
chunks: file.chunkCount,
|
|
81
|
+
}));
|
|
82
|
+
const missingFromIndex = health?.previews.missingFromIndex.slice(0, limit) ?? [];
|
|
83
|
+
const staleInIndex = health?.previews.staleInIndex.slice(0, limit) ?? [];
|
|
84
|
+
const emptyTextFiles = health?.previews.emptyTextFiles.slice(0, limit) ?? [];
|
|
66
85
|
return {
|
|
67
86
|
knowledgeBaseId: identity?.id ?? null,
|
|
68
87
|
totals: {
|
|
69
|
-
indexedFiles:
|
|
70
|
-
chunks:
|
|
71
|
-
missingFromIndex:
|
|
72
|
-
staleInIndex:
|
|
73
|
-
emptyTextFiles:
|
|
74
|
-
skippedFiles:
|
|
88
|
+
indexedFiles: manifest?.fileCount ?? 0,
|
|
89
|
+
chunks: manifest?.chunkCount ?? 0,
|
|
90
|
+
missingFromIndex: health?.missingFromIndex ?? 0,
|
|
91
|
+
staleInIndex: health?.staleInIndex ?? 0,
|
|
92
|
+
emptyTextFiles: health?.emptyTextFiles ?? 0,
|
|
93
|
+
skippedFiles: health?.skippedFiles ?? 0,
|
|
75
94
|
},
|
|
76
95
|
indexedFiles,
|
|
77
96
|
missingFromIndex,
|
|
78
97
|
staleInIndex,
|
|
79
98
|
emptyTextFiles,
|
|
80
|
-
skippedByReason:
|
|
99
|
+
skippedByReason: health?.skippedByReason ?? {},
|
|
81
100
|
omitted: {
|
|
82
|
-
indexedFiles:
|
|
83
|
-
missingFromIndex:
|
|
84
|
-
staleInIndex:
|
|
85
|
-
emptyTextFiles:
|
|
101
|
+
indexedFiles: Math.max(0, (manifest?.fileCount ?? 0) - indexedFiles.length),
|
|
102
|
+
missingFromIndex: Math.max(0, (health?.missingFromIndex ?? 0) - missingFromIndex.length),
|
|
103
|
+
staleInIndex: Math.max(0, (health?.staleInIndex ?? 0) - staleInIndex.length),
|
|
104
|
+
emptyTextFiles: Math.max(0, (health?.emptyTextFiles ?? 0) - emptyTextFiles.length),
|
|
105
|
+
},
|
|
106
|
+
page: {
|
|
107
|
+
offset,
|
|
108
|
+
limit,
|
|
109
|
+
nextOffset: filePage?.nextOffset ?? null,
|
|
86
110
|
},
|
|
87
111
|
};
|
|
88
112
|
}
|
|
89
|
-
function
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
113
|
+
function sourceCatalogOffset(value) {
|
|
114
|
+
const offset = value ?? 0;
|
|
115
|
+
if (!Number.isSafeInteger(offset) || offset < 0) {
|
|
116
|
+
throw new Error("Source catalog offset must be a non-negative integer.");
|
|
117
|
+
}
|
|
118
|
+
return offset;
|
|
119
|
+
}
|
|
120
|
+
function sourceCatalogLimit(value) {
|
|
121
|
+
const limit = value ?? SOURCE_CATALOG_LIMIT;
|
|
122
|
+
if (!Number.isSafeInteger(limit) || limit <= 0 || limit > MAX_SOURCE_CATALOG_LIMIT) {
|
|
123
|
+
throw new Error(`Source catalog limit must be a positive integer no greater than ${MAX_SOURCE_CATALOG_LIMIT}.`);
|
|
93
124
|
}
|
|
94
|
-
return
|
|
125
|
+
return limit;
|
|
95
126
|
}
|
|
96
127
|
//# sourceMappingURL=context-resources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-resources.js","sourceRoot":"","sources":["../src/context-resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"context-resources.js","sourceRoot":"","sources":["../src/context-resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAS/E,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAC/B,MAAM,wBAAwB,GAAG,GAAG,CAAA;AACpC,MAAM,gBAAgB,GAAG;IACvB,eAAe;IACf,qBAAqB;IACrB,eAAe;IACf,YAAY;IACZ,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,qBAAqB;IACrB,uBAAuB;CACxB,CAAA;AACD,MAAM,oBAAoB,GAAG,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAA;AAErE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EACnB,UAA4B,EAAE;IAE9B,MAAM,MAAM,G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AgB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,IAAI,CAAC,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC;YACxF,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;YAC5E,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,IAAI,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;SACnF;QACD,IAAI,EAAE;YACJ,MAAM;YACN,KAAK;YACL,UAAU,EAAE,QAAQ,EAAE,UAAU,IAAI,IAAI;SACzC;KACF,CAAA;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAyB;IACpD,MAAM,MAAM,GAAG,KAAK,IAAI,CAAC,CAAA;IACzB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAC1E,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAyB;IACnD,MAAM,KAAK,GAAG,KAAK,IAAI,oBAAoB,CAAA;IAC3C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,wBAAwB,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CACb,mEAAmE,wBAAwB,GAAG,CAC/F,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/defaults.d.ts
CHANGED
|
@@ -9,6 +9,33 @@ export declare const DEFAULT_SKILL_TARGET_DIR = ".ragmir/skills";
|
|
|
9
9
|
export declare const INDEX_MANIFEST_FILENAME = "index-manifest.json";
|
|
10
10
|
export declare const RAGMIR_PROJECT_ROOT_ENV = "RAGMIR_PROJECT_ROOT";
|
|
11
11
|
export declare const VECTOR_DISTANCE_METRIC = "l2";
|
|
12
|
+
export declare const MAX_CONFIGURED_FILE_BYTES = 50000000;
|
|
13
|
+
export declare const MAX_INGEST_CONCURRENCY = 8;
|
|
14
|
+
export declare const MAX_EMBEDDING_BATCH_SIZE = 128;
|
|
15
|
+
export declare const MAX_INGEST_FILE_BATCH_SIZE = 128;
|
|
16
|
+
export declare const MAX_INGEST_SOURCE_WINDOW_BYTES = 50000000;
|
|
17
|
+
export declare const MAX_INGEST_CHUNK_WINDOW = 8192;
|
|
18
|
+
export declare const MAX_INGEST_CHUNKS_PER_FILE = 65536;
|
|
19
|
+
export declare const MAX_INGEST_VECTOR_BYTES_PER_FILE: number;
|
|
20
|
+
export declare const MAX_SEARCH_TOP_K = 100;
|
|
21
|
+
export declare const MAX_HYBRID_TEXT_SCAN_LIMIT = 10000;
|
|
22
|
+
export declare const MAX_CONFIG_ARRAY_ITEMS = 10000;
|
|
23
|
+
export declare const MAX_CONFIG_PATH_CHARACTERS = 4096;
|
|
24
|
+
export declare const MAX_CONFIG_TEXT_CHARACTERS = 2048;
|
|
25
|
+
export declare const MAX_EXTERNAL_COMMAND_ARGUMENTS = 128;
|
|
26
|
+
export declare const MAX_EXTERNAL_COMMAND_TIMEOUT_MS = 900000;
|
|
27
|
+
export declare const MAX_INCLUDE_EXTENSIONS = 128;
|
|
28
|
+
export declare const MAX_MCP_OUTPUT_BYTES = 1048576;
|
|
29
|
+
export declare const MAX_REDACTION_PATTERNS = 64;
|
|
30
|
+
export declare const MAX_REDACTION_PATTERN_CHARACTERS = 2048;
|
|
31
|
+
export declare const MAX_CHUNK_SIZE = 1000000;
|
|
32
|
+
export declare const MAX_WORKLOAD_CONCURRENCY = 16;
|
|
33
|
+
export declare const MAX_WORKLOAD_QUEUE = 1000;
|
|
34
|
+
export declare const MAX_WORKLOAD_QUEUE_TIMEOUT_MS = 900000;
|
|
35
|
+
export declare const DEFAULT_EMBEDDING_MODEL = "intfloat/multilingual-e5-small";
|
|
36
|
+
export declare const DEFAULT_EMBEDDING_MODEL_REVISION = "614241f622f53c4eeff9890bdc4f31cfecc418b3";
|
|
37
|
+
export declare const KNOWN_EMBEDDING_MODEL_REVISIONS: Readonly<Record<string, string>>;
|
|
38
|
+
export declare function defaultEmbeddingModelRevision(model: string): string;
|
|
12
39
|
export declare const RAGMIR_GITIGNORE_ENTRY = ".ragmir/";
|
|
13
40
|
export declare const LEGACY_KB_GITIGNORE_ENTRY = ".kb/";
|
|
14
41
|
export declare const LEGACY_PRIVATE_GITIGNORE_ENTRY = "private/";
|
package/dist/defaults.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,eAAO,MAAM,UAAU,YAAY,CAAA;AACnC,eAAO,MAAM,aAAa,QAAQ,CAAA;AAClC,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAC3C,eAAO,MAAM,cAAc,gBAAsB,CAAA;AACjD,eAAO,MAAM,WAAW,wBAA8B,CAAA;AACtD,eAAO,MAAM,kBAAkB,oBAAiC,CAAA;AAChE,eAAO,MAAM,wBAAwB,mBAAyB,CAAA;AAC9D,eAAO,MAAM,uBAAuB,wBAAwB,CAAA;AAE5D,eAAO,MAAM,uBAAuB,wBAAwB,CAAA;AAC5D,eAAO,MAAM,sBAAsB,OAAO,CAAA;AAE1C,eAAO,MAAM,sBAAsB,aAAmB,CAAA;AACtD,eAAO,MAAM,yBAAyB,SAAsB,CAAA;AAC5D,eAAO,MAAM,8BAA8B,aAA2B,CAAA;AACtE,eAAO,MAAM,uCAAuC,eAA6B,CAAA;AAEjF,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,
|
|
1
|
+
{"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MAAM,gCAAgC,OAAQ,CAAA;AACrD,eAAO,MAAM,cAAc,UAAY,CAAA;AACvC,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAC1C,eAAO,MAAM,kBAAkB,OAAQ,CAAA;AACvC,eAAO,MAAM,6BAA6B,SAAU,CAAA;AACpD,eAAO,MAAM,uBAAuB,mCAAmC,CAAA;AACvE,eAAO,MAAM,gCAAgC,6CAA6C,CAAA;AAC1F,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAG5E,CAAA;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,eAAO,MAAM,sBAAsB,aAAmB,CAAA;AACtD,eAAO,MAAM,yBAAyB,SAAsB,CAAA;AAC5D,eAAO,MAAM,8BAA8B,aAA2B,CAAA;AACtE,eAAO,MAAM,uCAAuC,eAA6B,CAAA;AAEjF,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,CA6CtD,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,CAM7D,CAAA"}
|
package/dist/defaults.js
CHANGED
|
@@ -8,6 +8,38 @@ export const DEFAULT_SKILL_TARGET_DIR = `${RAGMIR_DIR}/skills`;
|
|
|
8
8
|
export const INDEX_MANIFEST_FILENAME = "index-manifest.json";
|
|
9
9
|
export const RAGMIR_PROJECT_ROOT_ENV = "RAGMIR_PROJECT_ROOT";
|
|
10
10
|
export const VECTOR_DISTANCE_METRIC = "l2";
|
|
11
|
+
export const MAX_CONFIGURED_FILE_BYTES = 50_000_000;
|
|
12
|
+
export const MAX_INGEST_CONCURRENCY = 8;
|
|
13
|
+
export const MAX_EMBEDDING_BATCH_SIZE = 128;
|
|
14
|
+
export const MAX_INGEST_FILE_BATCH_SIZE = 128;
|
|
15
|
+
export const MAX_INGEST_SOURCE_WINDOW_BYTES = 50_000_000;
|
|
16
|
+
export const MAX_INGEST_CHUNK_WINDOW = 8_192;
|
|
17
|
+
export const MAX_INGEST_CHUNKS_PER_FILE = 65_536;
|
|
18
|
+
export const MAX_INGEST_VECTOR_BYTES_PER_FILE = 256 * 1_024 * 1_024;
|
|
19
|
+
export const MAX_SEARCH_TOP_K = 100;
|
|
20
|
+
export const MAX_HYBRID_TEXT_SCAN_LIMIT = 10_000;
|
|
21
|
+
export const MAX_CONFIG_ARRAY_ITEMS = 10_000;
|
|
22
|
+
export const MAX_CONFIG_PATH_CHARACTERS = 4_096;
|
|
23
|
+
export const MAX_CONFIG_TEXT_CHARACTERS = 2_048;
|
|
24
|
+
export const MAX_EXTERNAL_COMMAND_ARGUMENTS = 128;
|
|
25
|
+
export const MAX_EXTERNAL_COMMAND_TIMEOUT_MS = 900_000;
|
|
26
|
+
export const MAX_INCLUDE_EXTENSIONS = 128;
|
|
27
|
+
export const MAX_MCP_OUTPUT_BYTES = 1_048_576;
|
|
28
|
+
export const MAX_REDACTION_PATTERNS = 64;
|
|
29
|
+
export const MAX_REDACTION_PATTERN_CHARACTERS = 2_048;
|
|
30
|
+
export const MAX_CHUNK_SIZE = 1_000_000;
|
|
31
|
+
export const MAX_WORKLOAD_CONCURRENCY = 16;
|
|
32
|
+
export const MAX_WORKLOAD_QUEUE = 1_000;
|
|
33
|
+
export const MAX_WORKLOAD_QUEUE_TIMEOUT_MS = 900_000;
|
|
34
|
+
export const DEFAULT_EMBEDDING_MODEL = "intfloat/multilingual-e5-small";
|
|
35
|
+
export const DEFAULT_EMBEDDING_MODEL_REVISION = "614241f622f53c4eeff9890bdc4f31cfecc418b3";
|
|
36
|
+
export const KNOWN_EMBEDDING_MODEL_REVISIONS = {
|
|
37
|
+
[DEFAULT_EMBEDDING_MODEL]: DEFAULT_EMBEDDING_MODEL_REVISION,
|
|
38
|
+
"mixedbread-ai/mxbai-embed-xsmall-v1": "e6ac24e5d6efb8782b59de1647b3ececb4ece94e",
|
|
39
|
+
};
|
|
40
|
+
export function defaultEmbeddingModelRevision(model) {
|
|
41
|
+
return KNOWN_EMBEDDING_MODEL_REVISIONS[model] ?? "main";
|
|
42
|
+
}
|
|
11
43
|
export const RAGMIR_GITIGNORE_ENTRY = `${RAGMIR_DIR}/`;
|
|
12
44
|
export const LEGACY_KB_GITIGNORE_ENTRY = `${LEGACY_KB_DIR}/`;
|
|
13
45
|
export const LEGACY_PRIVATE_GITIGNORE_ENTRY = `${LEGACY_PRIVATE_DIR}/`;
|
|
@@ -24,8 +56,9 @@ export const DEFAULT_CONFIG = {
|
|
|
24
56
|
embeddingModelPath: `${RAGMIR_DIR}/models`,
|
|
25
57
|
tableName: "chunks",
|
|
26
58
|
embeddingProvider: "local-hash",
|
|
27
|
-
embeddingModel:
|
|
28
|
-
embeddingModelRevision:
|
|
59
|
+
embeddingModel: DEFAULT_EMBEDDING_MODEL,
|
|
60
|
+
embeddingModelRevision: DEFAULT_EMBEDDING_MODEL_REVISION,
|
|
61
|
+
embeddingModelDigest: null,
|
|
29
62
|
transformersAllowRemoteModels: false,
|
|
30
63
|
redaction: {
|
|
31
64
|
enabled: true,
|
|
@@ -41,7 +74,14 @@ export const DEFAULT_CONFIG = {
|
|
|
41
74
|
maxFileBytes: 50_000_000,
|
|
42
75
|
ingestConcurrency: 4,
|
|
43
76
|
embeddingBatchSize: 32,
|
|
77
|
+
sourceFingerprintMode: "fast",
|
|
78
|
+
incrementalFailurePolicy: "preserve-last-good",
|
|
44
79
|
hybridTextScanLimit: 5_000,
|
|
80
|
+
workloadLimits: {
|
|
81
|
+
search: { concurrency: 8, maxQueue: 64, queueTimeoutMs: 30_000 },
|
|
82
|
+
embedding: { concurrency: 1, maxQueue: 64, queueTimeoutMs: 30_000 },
|
|
83
|
+
ingestion: { concurrency: 1, maxQueue: 4, queueTimeoutMs: 120_000 },
|
|
84
|
+
},
|
|
45
85
|
includeExtensions: [],
|
|
46
86
|
pdfOcrCommand: [],
|
|
47
87
|
pdfOcrTimeoutMs: 120_000,
|
package/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ACrB,aAAa,EAAE,EAAE;IACjB,eAAe,EAAE,OAAO;IACxB,eAAe,EAAE,EAAE;IACnB,iBAAiB,EAAE,OAAO;IAC1B,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,OAAO;CAC7B,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAgC;IAChE,GAAG,cAAc;IACjB,MAAM,EAAE,kBAAkB;IAC1B,UAAU,EAAE,GAAG,aAAa,UAAU;IACtC,WAAW,EAAE,GAAG,aAAa,cAAc;IAC3C,aAAa,EAAE,GAAG,aAAa,aAAa;CAC7C,CAAA"}
|
package/dist/destroy.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { DestroyIndexResult } from "./types.js";
|
|
2
|
-
export declare function destroyIndex(cwd?: string): Promise<DestroyIndexResult>;
|
|
1
|
+
import type { DestroyIndexResult, OperationOptions } from "./types.js";
|
|
2
|
+
export declare function destroyIndex(cwd?: string, options?: OperationOptions): Promise<DestroyIndexResult>;
|
|
3
3
|
//# sourceMappingURL=destroy.d.ts.map
|
package/dist/destroy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destroy.d.ts","sourceRoot":"","sources":["../src/destroy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"destroy.d.ts","sourceRoot":"","sources":["../src/destroy.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEtE,wBAAsB,YAAY,CAChC,GAAG,SAAgB,EACnB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CAkC7B"}
|
package/dist/destroy.js
CHANGED
|
@@ -6,24 +6,43 @@ import { recordAccess } from "./access-log.js";
|
|
|
6
6
|
import { loadConfig } from "./config.js";
|
|
7
7
|
import { INDEX_MANIFEST_FILENAME } from "./defaults.js";
|
|
8
8
|
import { disposeTransformersCache } from "./embeddings.js";
|
|
9
|
+
import { withIndexWriteLock } from "./index-write-lock.js";
|
|
9
10
|
import { readIngestionState } from "./ingestion-state.js";
|
|
10
|
-
|
|
11
|
+
import { operationSignal } from "./operation.js";
|
|
12
|
+
import { SOURCE_FINGERPRINT_CACHE_FILENAME } from "./source-fingerprint-cache.js";
|
|
13
|
+
export async function destroyIndex(cwd = process.cwd(), options = {}) {
|
|
11
14
|
const config = await loadConfig(cwd);
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
await
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
const existedBeforeLock = existsSync(config.storageDir);
|
|
16
|
+
const signal = operationSignal(options);
|
|
17
|
+
await assertSafeIndexStoragePath(config.projectRoot, config.storageDir, existedBeforeLock);
|
|
18
|
+
return withIndexWriteLock(config.storageDir, signal, async () => {
|
|
19
|
+
const hasIngestionState = (await readIngestionState(config)) !== null;
|
|
20
|
+
const hasManifest = existsSync(path.join(config.storageDir, INDEX_MANIFEST_FILENAME));
|
|
21
|
+
const hasFingerprintCache = existsSync(path.join(config.storageDir, SOURCE_FINGERPRINT_CACHE_FILENAME));
|
|
22
|
+
const existed = existedBeforeLock || hasIngestionState || hasManifest || hasFingerprintCache;
|
|
23
|
+
await assertSafeIndexStorage(config.projectRoot, config.storageDir, existed, hasIngestionState, hasFingerprintCache);
|
|
24
|
+
await recordAccess(config, { action: "destroy-index" });
|
|
25
|
+
await rm(config.storageDir, { recursive: true, force: true });
|
|
26
|
+
// Release any cached Transformers.js pipelines so a subsequent re-ingest with
|
|
27
|
+
// a different embedding config does not pin stale ONNX weights in memory.
|
|
28
|
+
await disposeTransformersCache();
|
|
29
|
+
return {
|
|
30
|
+
storageDir: config.storageDir,
|
|
31
|
+
removed: existed,
|
|
32
|
+
note: "Generated index removed. For forensic deletion guarantees, keep .ragmir/ on an encrypted volume and rotate/destroy the volume key.",
|
|
33
|
+
};
|
|
34
|
+
});
|
|
25
35
|
}
|
|
26
|
-
async function assertSafeIndexStorage(projectRoot, storageDir, existed, hasIngestionState) {
|
|
36
|
+
async function assertSafeIndexStorage(projectRoot, storageDir, existed, hasIngestionState, hasFingerprintCache) {
|
|
37
|
+
await assertSafeIndexStoragePath(projectRoot, storageDir, existed);
|
|
38
|
+
if (existed &&
|
|
39
|
+
!hasIngestionState &&
|
|
40
|
+
!hasFingerprintCache &&
|
|
41
|
+
!existsSync(path.join(storageDir, INDEX_MANIFEST_FILENAME))) {
|
|
42
|
+
throw new Error(`Refusing to remove ${JSON.stringify(storageDir)} because it contains neither ${INDEX_MANIFEST_FILENAME} nor a valid ingestion state.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function assertSafeIndexStoragePath(projectRoot, storageDir, existed) {
|
|
27
46
|
const resolvedProjectRoot = await realpath(projectRoot);
|
|
28
47
|
const resolvedStorageDir = existed ? await realpath(storageDir) : path.resolve(storageDir);
|
|
29
48
|
const filesystemRoot = path.parse(resolvedStorageDir).root;
|
|
@@ -33,11 +52,6 @@ async function assertSafeIndexStorage(projectRoot, storageDir, existed, hasInges
|
|
|
33
52
|
isSameOrAncestor(resolvedStorageDir, homeDir)) {
|
|
34
53
|
throw new Error(`Refusing to remove unsafe storageDir ${JSON.stringify(storageDir)}. Configure a dedicated Ragmir index directory.`);
|
|
35
54
|
}
|
|
36
|
-
if (existed &&
|
|
37
|
-
!hasIngestionState &&
|
|
38
|
-
!existsSync(path.join(resolvedStorageDir, INDEX_MANIFEST_FILENAME))) {
|
|
39
|
-
throw new Error(`Refusing to remove ${JSON.stringify(storageDir)} because it contains neither ${INDEX_MANIFEST_FILENAME} nor a valid ingestion state.`);
|
|
40
|
-
}
|
|
41
55
|
}
|
|
42
56
|
function isSameOrAncestor(candidate, target) {
|
|
43
57
|
const relative = path.relative(candidate, target);
|
package/dist/destroy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destroy.js","sourceRoot":"","sources":["../src/destroy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"destroy.js","sourceRoot":"","sources":["../src/destroy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,iCAAiC,EAAE,MAAM,+BAA+B,CAAA;AAGjF,MAAM,CAAC,KAAK,UAAU,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ACH,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,SAAiB,EAAE,MAAc;IACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IACjD,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;AACtF,CAAC"}
|
package/dist/doctor.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function doctor(cwd?: string, options?:
|
|
1
|
+
import type { Config, DoctorOptions, DoctorReport } from "./types.js";
|
|
2
|
+
export declare function doctor(cwd?: string, options?: DoctorOptions): Promise<DoctorReport>;
|
|
3
|
+
export declare function doctorWithConfig(config: Config, options?: DoctorOptions): Promise<DoctorReport>;
|
|
3
4
|
//# sourceMappingURL=doctor.d.ts.map
|
package/dist/doctor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAErE,wBAAsB,MAAM,CAC1B,GAAG,SAAgB,EACnB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAKvB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAsIvB"}
|
package/dist/doctor.js
CHANGED
|
@@ -3,61 +3,95 @@ import path from "node:path";
|
|
|
3
3
|
import { findProjectConfig, loadConfig } from "./config.js";
|
|
4
4
|
import { RAGMIR_DIR } from "./defaults.js";
|
|
5
5
|
import { countSkippedByReason } from "./files.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { getLexicalScanWarning, indexFreshnessWarning } from "./index-diagnostics.js";
|
|
7
|
+
import { auditWithConfig } from "./ingest.js";
|
|
8
8
|
import { operationSignal, throwIfAborted } from "./operation.js";
|
|
9
9
|
import { RGR_RUNNER_FILENAME, rgrCommand } from "./package-manager.js";
|
|
10
|
-
import {
|
|
10
|
+
import { isCompatibleQualityReport } from "./quality-report.js";
|
|
11
|
+
import { runtimeInfo } from "./runtime-info.js";
|
|
12
|
+
import { securityAuditWithConfig } from "./security.js";
|
|
11
13
|
import { AGENT_HELPER_CONFIG_FILENAMES, AGENT_SETUP_FILENAME, inspectAgentIntegration, MCP_CONFIG_FILENAME, SKILL_NAMES, } from "./skill.js";
|
|
12
|
-
import {
|
|
14
|
+
import { readIndexManifest, readIndexManifestHeader } from "./store.js";
|
|
13
15
|
export async function doctor(cwd = process.cwd(), options = {}) {
|
|
14
16
|
const signal = operationSignal(options);
|
|
15
17
|
throwIfAborted(signal);
|
|
16
|
-
const projectConfig = findProjectConfig(cwd);
|
|
17
|
-
const initialized = existsSync(projectConfig.configPath);
|
|
18
18
|
const config = await loadConfig(cwd);
|
|
19
|
+
return doctorWithConfig(config, options);
|
|
20
|
+
}
|
|
21
|
+
export async function doctorWithConfig(config, options = {}) {
|
|
22
|
+
const signal = operationSignal(options);
|
|
23
|
+
throwIfAborted(signal);
|
|
24
|
+
const projectConfig = findProjectConfig(config.projectRoot);
|
|
25
|
+
const initialized = existsSync(projectConfig.configPath);
|
|
19
26
|
throwIfAborted(signal);
|
|
20
27
|
const command = await rgrCommand(config.projectRoot, []);
|
|
21
28
|
throwIfAborted(signal);
|
|
22
29
|
const agentKitInstalled = isAgentKitInstalled(config.projectRoot);
|
|
23
30
|
const agentIntegration = inspectAgentIntegration(config.projectRoot);
|
|
24
31
|
const operationOptions = signal ? { signal } : {};
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const deep = options.deep === true;
|
|
33
|
+
const [auditReport, securityReport, manifest] = deep
|
|
34
|
+
? await Promise.all([
|
|
35
|
+
auditWithConfig(config, operationOptions),
|
|
36
|
+
securityAuditWithConfig(config, operationOptions),
|
|
37
|
+
readIndexManifest(config),
|
|
38
|
+
])
|
|
39
|
+
: [null, null, await readIndexManifestHeader(config)];
|
|
32
40
|
throwIfAborted(signal);
|
|
41
|
+
const health = manifest?.health;
|
|
42
|
+
const supportedFiles = auditReport?.supportedFiles.length ?? health?.supportedFiles ?? 0;
|
|
43
|
+
const supportedBytes = auditReport?.supportedBytes ?? health?.supportedBytes ?? 0;
|
|
44
|
+
const largestFileBytes = auditReport?.largestFileBytes ?? health?.largestFileBytes ?? 0;
|
|
45
|
+
const skippedFiles = auditReport?.skippedFiles.length ?? health?.skippedFiles ?? 0;
|
|
46
|
+
const unsupportedFiles = auditReport
|
|
47
|
+
? countSkippedByReason(auditReport.skippedFiles, "unsupported-extension")
|
|
48
|
+
: (health?.unsupportedFiles ?? 0);
|
|
49
|
+
const oversizedFiles = auditReport
|
|
50
|
+
? countSkippedByReason(auditReport.skippedFiles, "oversized")
|
|
51
|
+
: (health?.oversizedFiles ?? 0);
|
|
52
|
+
const sensitiveFiles = auditReport
|
|
53
|
+
? countSkippedByReason(auditReport.skippedFiles, "sensitive-name")
|
|
54
|
+
: (health?.sensitiveFiles ?? 0);
|
|
55
|
+
const emptyTextFiles = auditReport?.emptyTextFiles.length ?? health?.emptyTextFiles ?? 0;
|
|
56
|
+
const indexedFiles = auditReport?.indexedFiles.length ?? manifest?.fileCount ?? 0;
|
|
57
|
+
const chunksIndexed = auditReport?.totalChunks ?? manifest?.chunkCount ?? 0;
|
|
58
|
+
const missingFromIndex = auditReport?.missingFromIndex.length ?? health?.missingFromIndex ?? 0;
|
|
59
|
+
const staleInIndex = auditReport?.staleInIndex.length ?? health?.staleInIndex ?? 0;
|
|
60
|
+
const securityWarnings = securityReport?.warnings ?? health?.securityWarnings ?? [];
|
|
61
|
+
const freshnessWarning = indexFreshnessWarning(config, manifest);
|
|
33
62
|
const lexicalScanWarning = chunksIndexed > 0 ? getLexicalScanWarning(config, chunksIndexed) : null;
|
|
34
63
|
const indexFreshness = {
|
|
35
64
|
manifestFound: manifest !== null,
|
|
36
65
|
warning: freshnessWarning,
|
|
37
66
|
};
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
67
|
+
const diagnosticSnapshotAvailable = deep || health !== undefined;
|
|
68
|
+
const coverageComplete = diagnosticSnapshotAvailable &&
|
|
69
|
+
missingFromIndex === 0 &&
|
|
70
|
+
staleInIndex === 0 &&
|
|
71
|
+
emptyTextFiles === 0 &&
|
|
43
72
|
oversizedFiles === 0;
|
|
44
|
-
const operationalReady = initialized && chunksIndexed > 0 && coverageComplete;
|
|
45
|
-
const indexPolicyCurrent = freshnessWarning === null;
|
|
46
|
-
const privacyCompliant =
|
|
73
|
+
const operationalReady = initialized && manifest !== null && chunksIndexed > 0 && coverageComplete;
|
|
74
|
+
const indexPolicyCurrent = manifest !== null && freshnessWarning === null;
|
|
75
|
+
const privacyCompliant = diagnosticSnapshotAvailable && securityWarnings.length === 0;
|
|
76
|
+
const retrievalQualityVerified = deep
|
|
77
|
+
? await isCompatibleQualityReport(manifest?.qualityReport, manifest, config)
|
|
78
|
+
: false;
|
|
79
|
+
throwIfAborted(signal);
|
|
47
80
|
const nextSteps = nextActions({
|
|
48
81
|
initialized,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
82
|
+
diagnosticSnapshotAvailable,
|
|
83
|
+
supportedFiles,
|
|
84
|
+
supportedBytes,
|
|
85
|
+
largestFileBytes,
|
|
86
|
+
skippedFiles,
|
|
87
|
+
unsupportedFiles,
|
|
54
88
|
chunksIndexed,
|
|
55
|
-
missingFromIndex
|
|
56
|
-
staleInIndex
|
|
57
|
-
emptyTextFiles
|
|
89
|
+
missingFromIndex,
|
|
90
|
+
staleInIndex,
|
|
91
|
+
emptyTextFiles,
|
|
58
92
|
oversizedFiles,
|
|
59
93
|
sensitiveFiles,
|
|
60
|
-
warnings:
|
|
94
|
+
warnings: securityWarnings.length,
|
|
61
95
|
embeddingProvider: config.embeddingProvider,
|
|
62
96
|
agentKitInstalled,
|
|
63
97
|
agentRunnerReady: agentIntegration.runnerReady,
|
|
@@ -68,10 +102,15 @@ export async function doctor(cwd = process.cwd(), options = {}) {
|
|
|
68
102
|
});
|
|
69
103
|
throwIfAborted(signal);
|
|
70
104
|
return {
|
|
105
|
+
mode: deep ? "deep" : "manifest",
|
|
106
|
+
inventoryVerified: deep,
|
|
107
|
+
securityVerified: deep,
|
|
108
|
+
cost: deep ? "O(corpus)" : "O(1)",
|
|
71
109
|
projectRoot: config.projectRoot,
|
|
72
110
|
initialized,
|
|
73
111
|
packageManager: command.packageManager,
|
|
74
112
|
runCommand: command.display,
|
|
113
|
+
runtime: runtimeInfo(),
|
|
75
114
|
agentKitInstalled,
|
|
76
115
|
agentIntegration,
|
|
77
116
|
rawDir: config.rawDir,
|
|
@@ -82,20 +121,21 @@ export async function doctor(cwd = process.cwd(), options = {}) {
|
|
|
82
121
|
accessLog: config.accessLog,
|
|
83
122
|
privacyProfile: config.privacyProfile,
|
|
84
123
|
retrievalProfile: config.retrievalProfile,
|
|
85
|
-
supportedFiles
|
|
86
|
-
supportedBytes
|
|
87
|
-
largestFileBytes
|
|
124
|
+
supportedFiles,
|
|
125
|
+
supportedBytes,
|
|
126
|
+
largestFileBytes,
|
|
88
127
|
maxFileBytes: config.maxFileBytes,
|
|
89
|
-
skippedFiles
|
|
90
|
-
unsupportedFiles
|
|
128
|
+
skippedFiles,
|
|
129
|
+
unsupportedFiles,
|
|
91
130
|
oversizedFiles,
|
|
92
131
|
sensitiveFiles,
|
|
93
|
-
emptyTextFiles
|
|
94
|
-
indexedFiles
|
|
132
|
+
emptyTextFiles,
|
|
133
|
+
indexedFiles,
|
|
95
134
|
chunksIndexed,
|
|
96
|
-
missingFromIndex
|
|
97
|
-
staleInIndex
|
|
98
|
-
|
|
135
|
+
missingFromIndex,
|
|
136
|
+
staleInIndex,
|
|
137
|
+
corpusFingerprint: manifest?.corpusFingerprint ?? null,
|
|
138
|
+
securityWarnings,
|
|
99
139
|
indexFreshness,
|
|
100
140
|
ready: operationalReady && indexPolicyCurrent && privacyCompliant,
|
|
101
141
|
readiness: {
|
|
@@ -103,7 +143,7 @@ export async function doctor(cwd = process.cwd(), options = {}) {
|
|
|
103
143
|
coverageComplete,
|
|
104
144
|
indexPolicyCurrent,
|
|
105
145
|
privacyCompliant,
|
|
106
|
-
retrievalQualityVerified
|
|
146
|
+
retrievalQualityVerified,
|
|
107
147
|
acceptedRisks: config.acceptedRisks,
|
|
108
148
|
},
|
|
109
149
|
nextSteps,
|
|
@@ -115,6 +155,11 @@ function nextActions(input) {
|
|
|
115
155
|
steps.push(`Run \`${input.run(["setup"])}\` to initialize Ragmir and install the agent kit.`);
|
|
116
156
|
return steps;
|
|
117
157
|
}
|
|
158
|
+
if (!input.diagnosticSnapshotAvailable) {
|
|
159
|
+
steps.push(`Run \`${input.run(["doctor", "--deep"])}\` for an O(corpus) source and security audit.`);
|
|
160
|
+
steps.push(`Run \`${input.run(["ingest"])}\` to create a current manifest before relying on status or search.`);
|
|
161
|
+
return steps;
|
|
162
|
+
}
|
|
118
163
|
if (input.supportedFiles === 0) {
|
|
119
164
|
if (input.skippedFiles > 0) {
|
|
120
165
|
steps.push("Ragmir found files, but none are currently indexable. Run `rgr audit --unsupported` to inspect skipped files.");
|