@noyrax/5d-database-plugin 0.1.14-beta.1 → 0.1.14-beta.11
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 +25 -0
- package/out/api/adr-api.d.ts +0 -6
- package/out/api/adr-api.d.ts.map +1 -1
- package/out/api/adr-api.js +14 -49
- package/out/api/adr-api.js.map +1 -1
- package/out/api/bootstrap-api.d.ts +32 -1
- package/out/api/bootstrap-api.d.ts.map +1 -1
- package/out/api/bootstrap-api.js +207 -14
- package/out/api/bootstrap-api.js.map +1 -1
- package/out/api/context-builder.d.ts.map +1 -1
- package/out/api/context-builder.js +21 -5
- package/out/api/context-builder.js.map +1 -1
- package/out/api/evidence-grader.d.ts +83 -0
- package/out/api/evidence-grader.d.ts.map +1 -0
- package/out/api/evidence-grader.js +161 -0
- package/out/api/evidence-grader.js.map +1 -0
- package/out/api/index.d.ts +5 -0
- package/out/api/index.d.ts.map +1 -1
- package/out/api/index.js +11 -1
- package/out/api/index.js.map +1 -1
- package/out/api/learning-path-api.d.ts +3 -0
- package/out/api/learning-path-api.d.ts.map +1 -1
- package/out/api/learning-path-api.js +15 -2
- package/out/api/learning-path-api.js.map +1 -1
- package/out/api/module-api.d.ts +0 -1
- package/out/api/module-api.d.ts.map +1 -1
- package/out/api/module-api.js +4 -38
- package/out/api/module-api.js.map +1 -1
- package/out/api/self-explanation-api.d.ts +11 -1
- package/out/api/self-explanation-api.d.ts.map +1 -1
- package/out/api/self-explanation-api.js +285 -19
- package/out/api/self-explanation-api.js.map +1 -1
- package/out/api/semantic-search-api.d.ts +3 -0
- package/out/api/semantic-search-api.d.ts.map +1 -1
- package/out/api/semantic-search-api.js +41 -4
- package/out/api/semantic-search-api.js.map +1 -1
- package/out/api/source-access-contract-api.d.ts +60 -0
- package/out/api/source-access-contract-api.d.ts.map +1 -0
- package/out/api/source-access-contract-api.js +231 -0
- package/out/api/source-access-contract-api.js.map +1 -0
- package/out/api/source-snippet-api.d.ts +58 -0
- package/out/api/source-snippet-api.d.ts.map +1 -0
- package/out/api/source-snippet-api.js +187 -0
- package/out/api/source-snippet-api.js.map +1 -0
- package/out/api/vector-backend-status-api.d.ts +68 -0
- package/out/api/vector-backend-status-api.d.ts.map +1 -0
- package/out/api/vector-backend-status-api.js +241 -0
- package/out/api/vector-backend-status-api.js.map +1 -0
- package/out/cli/debug-embedding-strategies.d.ts +3 -0
- package/out/cli/debug-embedding-strategies.d.ts.map +1 -0
- package/out/cli/debug-embedding-strategies.js +255 -0
- package/out/cli/debug-embedding-strategies.js.map +1 -0
- package/out/cli/debug-plugin-id.d.ts +9 -0
- package/out/cli/debug-plugin-id.d.ts.map +1 -0
- package/out/cli/debug-plugin-id.js +188 -0
- package/out/cli/debug-plugin-id.js.map +1 -0
- package/out/cli/ingest-cli.js +44 -5
- package/out/cli/ingest-cli.js.map +1 -1
- package/out/cli/tool-cli.js +1 -1
- package/out/cli/tool-cli.js.map +1 -1
- package/out/core/chromadb-vector-database.d.ts.map +1 -1
- package/out/core/chromadb-vector-database.js +10 -12
- package/out/core/chromadb-vector-database.js.map +1 -1
- package/out/core/migration-manager.d.ts.map +1 -1
- package/out/core/migration-manager.js +61 -32
- package/out/core/migration-manager.js.map +1 -1
- package/out/core/multi-db-manager.d.ts +26 -0
- package/out/core/multi-db-manager.d.ts.map +1 -1
- package/out/core/multi-db-manager.js +143 -2
- package/out/core/multi-db-manager.js.map +1 -1
- package/out/core/path-normalizer.d.ts +46 -0
- package/out/core/path-normalizer.d.ts.map +1 -0
- package/out/core/path-normalizer.js +152 -0
- package/out/core/path-normalizer.js.map +1 -0
- package/out/core/vector-database-factory.js +5 -5
- package/out/core/vector-database-factory.js.map +1 -1
- package/out/core/vss-vector-database.js +8 -8
- package/out/core/vss-vector-database.js.map +1 -1
- package/out/embedding/embedding-pipeline.d.ts +29 -0
- package/out/embedding/embedding-pipeline.d.ts.map +1 -1
- package/out/embedding/embedding-pipeline.js +288 -3
- package/out/embedding/embedding-pipeline.js.map +1 -1
- package/out/embedding/module-summarizer.d.ts +25 -0
- package/out/embedding/module-summarizer.d.ts.map +1 -0
- package/out/embedding/module-summarizer.js +104 -0
- package/out/embedding/module-summarizer.js.map +1 -0
- package/out/ingestors/adr-ingestor.d.ts.map +1 -1
- package/out/ingestors/adr-ingestor.js +7 -8
- package/out/ingestors/adr-ingestor.js.map +1 -1
- package/out/ingestors/module-ingestor.d.ts.map +1 -1
- package/out/ingestors/module-ingestor.js +17 -0
- package/out/ingestors/module-ingestor.js.map +1 -1
- package/out/ingestors/symbol-ingestor.d.ts.map +1 -1
- package/out/ingestors/symbol-ingestor.js +24 -2
- package/out/ingestors/symbol-ingestor.js.map +1 -1
- package/out/mcp/tools/gap-analysis.d.ts +21 -2
- package/out/mcp/tools/gap-analysis.d.ts.map +1 -1
- package/out/mcp/tools/gap-analysis.js +326 -27
- package/out/mcp/tools/gap-analysis.js.map +1 -1
- package/out/mcp/tools/learning-path.d.ts.map +1 -1
- package/out/mcp/tools/learning-path.js +19 -5
- package/out/mcp/tools/learning-path.js.map +1 -1
- package/out/mcp/tools/semantic-discovery.d.ts.map +1 -1
- package/out/mcp/tools/semantic-discovery.js +110 -22
- package/out/mcp/tools/semantic-discovery.js.map +1 -1
- package/out/mcp/tools/source-access-contract.d.ts +26 -0
- package/out/mcp/tools/source-access-contract.d.ts.map +1 -0
- package/out/mcp/tools/source-access-contract.js +45 -0
- package/out/mcp/tools/source-access-contract.js.map +1 -0
- package/out/mcp/tools/source-snippet.d.ts +71 -0
- package/out/mcp/tools/source-snippet.d.ts.map +1 -0
- package/out/mcp/tools/source-snippet.js +82 -0
- package/out/mcp/tools/source-snippet.js.map +1 -0
- package/out/models/action-hint.d.ts +36 -0
- package/out/models/action-hint.d.ts.map +1 -0
- package/out/models/action-hint.js +38 -0
- package/out/models/action-hint.js.map +1 -0
- package/out/models/evidence.d.ts +68 -0
- package/out/models/evidence.d.ts.map +1 -0
- package/out/models/evidence.js +91 -0
- package/out/models/evidence.js.map +1 -0
- package/out/models/module.d.ts +2 -0
- package/out/models/module.d.ts.map +1 -1
- package/out/models/reason-codes.d.ts +52 -0
- package/out/models/reason-codes.d.ts.map +1 -0
- package/out/models/reason-codes.js +83 -0
- package/out/models/reason-codes.js.map +1 -0
- package/out/models/symbol.d.ts +6 -0
- package/out/models/symbol.d.ts.map +1 -1
- package/out/repositories/module-repository.d.ts.map +1 -1
- package/out/repositories/module-repository.js +9 -3
- package/out/repositories/module-repository.js.map +1 -1
- package/out/repositories/symbol-repository.d.ts.map +1 -1
- package/out/repositories/symbol-repository.js +22 -4
- package/out/repositories/symbol-repository.js.map +1 -1
- package/out/services/cross-dimension-linker.d.ts +0 -5
- package/out/services/cross-dimension-linker.d.ts.map +1 -1
- package/out/services/cross-dimension-linker.js +2 -35
- package/out/services/cross-dimension-linker.js.map +1 -1
- package/package.json +196 -195
- package/schemas/sqlite/001_add_source_code_spans_modules.sql +7 -0
- package/schemas/sqlite/001_z_add_source_code_spans_modules.sql +13 -0
- package/schemas/sqlite/002_add_source_code_spans_symbols.sql +15 -0
- package/schemas/sqlite/002_z_add_source_code_spans_symbols.sql +21 -0
- package/schemas/sqlite/006_add_source_access_config.sql +33 -0
|
@@ -4,32 +4,120 @@ exports.executeSemanticDiscovery = executeSemanticDiscovery;
|
|
|
4
4
|
const semantic_search_api_1 = require("../../api/semantic-search-api");
|
|
5
5
|
const context_builder_1 = require("../../api/context-builder");
|
|
6
6
|
const embedding_generator_1 = require("../../embedding/embedding-generator");
|
|
7
|
+
const vector_backend_status_api_1 = require("../../api/vector-backend-status-api");
|
|
8
|
+
const reason_codes_1 = require("../../models/reason-codes");
|
|
7
9
|
/**
|
|
8
10
|
* Executes semantic discovery tool.
|
|
9
11
|
* Performs semantic search and returns structured context.
|
|
10
12
|
*/
|
|
11
13
|
async function executeSemanticDiscovery(args, dbManager, idMapper) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
try {
|
|
15
|
+
const embeddingGenerator = new embedding_generator_1.EmbeddingGenerator();
|
|
16
|
+
const semanticSearchApi = new semantic_search_api_1.SemanticSearchApi(dbManager, embeddingGenerator);
|
|
17
|
+
const contextBuilder = new context_builder_1.ContextBuilder(dbManager, idMapper);
|
|
18
|
+
// 1. Semantic Search
|
|
19
|
+
let results;
|
|
20
|
+
let fallbackMode = false;
|
|
21
|
+
let reasonCode = undefined;
|
|
22
|
+
try {
|
|
23
|
+
results = await semanticSearchApi.search(args.query, args.pluginId, {
|
|
24
|
+
limit: args.limit || 10
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch (searchError) {
|
|
28
|
+
// If semantic search fails, check vector backend status to determine reason code
|
|
29
|
+
fallbackMode = true;
|
|
30
|
+
try {
|
|
31
|
+
const vectorBackendStatusApi = new vector_backend_status_api_1.VectorBackendStatusApi(dbManager);
|
|
32
|
+
const status = await vectorBackendStatusApi.getVectorBackendStatus();
|
|
33
|
+
reasonCode = status.reason_code;
|
|
34
|
+
}
|
|
35
|
+
catch (statusError) {
|
|
36
|
+
// If status check fails, use generic reason code
|
|
37
|
+
reasonCode = reason_codes_1.ReasonCode.VECTOR_BACKEND_UNREACHABLE;
|
|
38
|
+
}
|
|
39
|
+
// If vector backend is not available, return fallback response
|
|
40
|
+
const errorMsg = searchError?.message || String(searchError);
|
|
41
|
+
return JSON.stringify({
|
|
42
|
+
query: args.query,
|
|
43
|
+
results: [],
|
|
44
|
+
context: {},
|
|
45
|
+
mode: 'fallback',
|
|
46
|
+
reason_code: reasonCode || reason_codes_1.ReasonCode.VECTOR_BACKEND_UNREACHABLE,
|
|
47
|
+
error: `Semantic search failed: ${errorMsg}`,
|
|
48
|
+
fallback: 'Semantic search unavailable, returning empty results'
|
|
49
|
+
}, null, 2);
|
|
50
|
+
}
|
|
51
|
+
// 2. Deterministic Context Builder
|
|
52
|
+
let context;
|
|
53
|
+
try {
|
|
54
|
+
context = await contextBuilder.buildContext(results.map(r => r.entityRef), args.pluginId);
|
|
55
|
+
}
|
|
56
|
+
catch (contextError) {
|
|
57
|
+
// If context building fails, return results without context
|
|
58
|
+
const errorMsg = contextError?.message || String(contextError);
|
|
59
|
+
return JSON.stringify({
|
|
60
|
+
query: args.query,
|
|
61
|
+
results: results.map(r => ({
|
|
62
|
+
dimension: r.dimension,
|
|
63
|
+
entityId: r.entityId,
|
|
64
|
+
externalId: r.externalId,
|
|
65
|
+
score: r.score,
|
|
66
|
+
vectorScore: r.vectorScore,
|
|
67
|
+
importanceScore: r.importanceScore
|
|
68
|
+
})),
|
|
69
|
+
context: {},
|
|
70
|
+
warning: `Context building failed: ${errorMsg}`
|
|
71
|
+
}, null, 2);
|
|
72
|
+
}
|
|
73
|
+
// 3. Check if fallback mode was used (cosine similarity instead of vector database)
|
|
74
|
+
// Note: We can't directly detect this from results, but we can check vector backend status
|
|
75
|
+
// If vector backend is not available but we got results, we're in fallback mode
|
|
76
|
+
try {
|
|
77
|
+
const vectorBackendStatusApi = new vector_backend_status_api_1.VectorBackendStatusApi(dbManager);
|
|
78
|
+
const status = await vectorBackendStatusApi.getVectorBackendStatus();
|
|
79
|
+
if (status.fallback && results.length > 0) {
|
|
80
|
+
fallbackMode = true;
|
|
81
|
+
reasonCode = status.reason_code;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (statusError) {
|
|
85
|
+
// Ignore status check errors
|
|
86
|
+
}
|
|
87
|
+
// 4. Return structured JSON (no AI generation!)
|
|
88
|
+
const response = {
|
|
89
|
+
query: args.query,
|
|
90
|
+
results: results.map(r => ({
|
|
91
|
+
dimension: r.dimension,
|
|
92
|
+
entityId: r.entityId,
|
|
93
|
+
externalId: r.externalId,
|
|
94
|
+
score: r.score,
|
|
95
|
+
vectorScore: r.vectorScore,
|
|
96
|
+
importanceScore: r.importanceScore
|
|
97
|
+
})),
|
|
98
|
+
context
|
|
99
|
+
};
|
|
100
|
+
// Add fallback signaling if in fallback mode
|
|
101
|
+
if (fallbackMode && reasonCode) {
|
|
102
|
+
response.mode = 'fallback';
|
|
103
|
+
response.reason_code = reasonCode;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
response.mode = 'normal';
|
|
107
|
+
}
|
|
108
|
+
return JSON.stringify(response, null, 2);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
// Catch-all error handler - ensure we always return valid JSON
|
|
112
|
+
const errorMsg = error?.message || String(error);
|
|
113
|
+
const errorStack = error?.stack ? String(error.stack).substring(0, 500) : undefined;
|
|
114
|
+
return JSON.stringify({
|
|
115
|
+
query: args.query,
|
|
116
|
+
results: [],
|
|
117
|
+
context: {},
|
|
118
|
+
error: `Semantic discovery failed: ${errorMsg}`,
|
|
119
|
+
stack: errorStack
|
|
120
|
+
}, null, 2);
|
|
121
|
+
}
|
|
34
122
|
}
|
|
35
123
|
//# sourceMappingURL=semantic-discovery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-discovery.js","sourceRoot":"","sources":["../../../src/mcp/tools/semantic-discovery.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"semantic-discovery.js","sourceRoot":"","sources":["../../../src/mcp/tools/semantic-discovery.ts"],"names":[],"mappings":";;AAYA,4DAsHC;AAhID,uEAAkE;AAClE,+DAA2D;AAC3D,6EAAyE;AACzE,mFAA6E;AAC7E,4DAAuD;AAEvD;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAC1C,IAAyD,EACzD,SAAyB,EACzB,QAAkB;IAElB,IAAI,CAAC;QACD,MAAM,kBAAkB,GAAG,IAAI,wCAAkB,EAAE,CAAC;QACpD,MAAM,iBAA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EAAE,8BAA8B,QAAQ,EAAE;YAC/C,KAAK,EAAE,UAAU;SACpB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MultiDbManager } from '../../core/multi-db-manager.js';
|
|
2
|
+
/**
|
|
3
|
+
* MCP Tool: source_access_contract
|
|
4
|
+
* Get source access contract (deterministic status of code availability)
|
|
5
|
+
*/
|
|
6
|
+
export declare const sourceAccessContractTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
workspaceRoot: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
required: never[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Executes source_access_contract tool.
|
|
22
|
+
*/
|
|
23
|
+
export declare function executeSourceAccessContract(args: {
|
|
24
|
+
workspaceRoot?: string;
|
|
25
|
+
}, dbManager: MultiDbManager): Promise<string>;
|
|
26
|
+
//# sourceMappingURL=source-access-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-access-contract.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/source-access-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;CAcpC,CAAC;AAEF;;GAEG;AACH,wBAAsB,2BAA2B,CAC7C,IAAI,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,SAAS,EAAE,cAAc,GAC1B,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sourceAccessContractTool = void 0;
|
|
4
|
+
exports.executeSourceAccessContract = executeSourceAccessContract;
|
|
5
|
+
const source_access_contract_api_js_1 = require("../../api/source-access-contract-api.js");
|
|
6
|
+
/**
|
|
7
|
+
* MCP Tool: source_access_contract
|
|
8
|
+
* Get source access contract (deterministic status of code availability)
|
|
9
|
+
*/
|
|
10
|
+
exports.sourceAccessContractTool = {
|
|
11
|
+
name: 'source_access_contract',
|
|
12
|
+
description: 'Get source access contract (deterministic status of code availability). ' +
|
|
13
|
+
'Returns whether source code is available, constraints, and reason codes.',
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
workspaceRoot: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Workspace root path (optional, defaults to current working directory)'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
required: []
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Executes source_access_contract tool.
|
|
27
|
+
*/
|
|
28
|
+
async function executeSourceAccessContract(args, dbManager) {
|
|
29
|
+
try {
|
|
30
|
+
const api = new source_access_contract_api_js_1.SourceAccessContractApi(dbManager);
|
|
31
|
+
// Use workspace root from dbManager if not provided
|
|
32
|
+
const workspaceRoot = args.workspaceRoot || dbManager.getWorkspaceRoot();
|
|
33
|
+
const contract = await api.getContract(workspaceRoot);
|
|
34
|
+
return JSON.stringify(contract, null, 2);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const errorMsg = error?.message || String(error);
|
|
38
|
+
return JSON.stringify({
|
|
39
|
+
error: `Failed to get source access contract: ${errorMsg}`,
|
|
40
|
+
status: 'UNAVAILABLE',
|
|
41
|
+
reason_codes: ['NOT_MOUNTED']
|
|
42
|
+
}, null, 2);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=source-access-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-access-contract.js","sourceRoot":"","sources":["../../../src/mcp/tools/source-access-contract.ts"],"names":[],"mappings":";;;AA0BA,kEAmBC;AA7CD,2FAAkF;AAGlF;;;GAGG;AACU,QAAA,wBAAwB,GAAG;IACpC,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,0EAA0E;QAC1E,0EAA0E;IACvF,WAAW,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,aAAa,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uEAAuE;aACvF;SACJ;QACD,QAAQ,EAAE,EAAE;KACf;CACJ,CAAC;AAEF;;GAEG;AACI,KAAK,UAAU,2BAA2B,CAC7C,IAAgC,EAChC,SAAyB;IAEzB,IAAI,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,uDAAuB,CAAC,SAAS,CAAC,CAAC;QACnD,oDAAoD;QACpD,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,SAAS,CAAC,gBAAgB,EAAE,CAAC;QACzE,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAEtD,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,SAAS,CAAC;YAClB,KAAK,EAAE,yCAAyC,QAAQ,EAAE;YAC1D,MAAM,EAAE,aAAa;YACrB,YAAY,EAAE,CAAC,aAAa,CAAC;SAChC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { MultiDbManager } from '../../core/multi-db-manager.js';
|
|
2
|
+
/**
|
|
3
|
+
* MCP Tool: source_snippet
|
|
4
|
+
* Fetch source code snippet by reference (gated, refs-first)
|
|
5
|
+
*/
|
|
6
|
+
export declare const sourceSnippetTool: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
symbol_id: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
file_path: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
start_line: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
end_line: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
content_hash: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
include_context: {
|
|
33
|
+
type: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
context_lines: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
verify_hash: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
pluginId: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
workspaceRoot: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
required: string[];
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Executes source_snippet tool.
|
|
58
|
+
*/
|
|
59
|
+
export declare function executeSourceSnippet(args: {
|
|
60
|
+
symbol_id?: string;
|
|
61
|
+
file_path?: string;
|
|
62
|
+
start_line?: number;
|
|
63
|
+
end_line?: number;
|
|
64
|
+
content_hash?: string;
|
|
65
|
+
include_context?: boolean;
|
|
66
|
+
context_lines?: number;
|
|
67
|
+
verify_hash?: boolean;
|
|
68
|
+
pluginId: string;
|
|
69
|
+
workspaceRoot?: string;
|
|
70
|
+
}, dbManager: MultiDbManager): Promise<string>;
|
|
71
|
+
//# sourceMappingURL=source-snippet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-snippet.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/source-snippet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD7B,CAAC;AAEF;;GAEG;AACH,wBAAsB,oBAAoB,CACtC,IAAI,EAAE;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,EACD,SAAS,EAAE,cAAc,GAC1B,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sourceSnippetTool = void 0;
|
|
4
|
+
exports.executeSourceSnippet = executeSourceSnippet;
|
|
5
|
+
const source_snippet_api_js_1 = require("../../api/source-snippet-api.js");
|
|
6
|
+
/**
|
|
7
|
+
* MCP Tool: source_snippet
|
|
8
|
+
* Fetch source code snippet by reference (gated, refs-first)
|
|
9
|
+
*/
|
|
10
|
+
exports.sourceSnippetTool = {
|
|
11
|
+
name: 'source_snippet',
|
|
12
|
+
description: 'Fetch source code snippet by reference (gated, refs-first). ' +
|
|
13
|
+
'Retrieves actual source code for a symbol or file range with size limits and hash verification.',
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
symbol_id: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Symbol ID to fetch (e.g., "ts://path/to/file.ts#ClassName.methodName()")'
|
|
20
|
+
},
|
|
21
|
+
file_path: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'File path (alternative to symbol_id)'
|
|
24
|
+
},
|
|
25
|
+
start_line: {
|
|
26
|
+
type: 'number',
|
|
27
|
+
description: 'Start line number (1-indexed, alternative to symbol_id)'
|
|
28
|
+
},
|
|
29
|
+
end_line: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
description: 'End line number (1-indexed, inclusive, alternative to symbol_id)'
|
|
32
|
+
},
|
|
33
|
+
content_hash: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'Expected content hash for verification (optional)'
|
|
36
|
+
},
|
|
37
|
+
include_context: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
description: 'Include context lines before/after (default: false)'
|
|
40
|
+
},
|
|
41
|
+
context_lines: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
description: 'Number of context lines (default: 5)'
|
|
44
|
+
},
|
|
45
|
+
verify_hash: {
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
description: 'Fail if hash mismatch (default: false)'
|
|
48
|
+
},
|
|
49
|
+
pluginId: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'Plugin ID'
|
|
52
|
+
},
|
|
53
|
+
workspaceRoot: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'Workspace root path (optional)'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
required: ['pluginId']
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Executes source_snippet tool.
|
|
63
|
+
*/
|
|
64
|
+
async function executeSourceSnippet(args, dbManager) {
|
|
65
|
+
try {
|
|
66
|
+
const api = new source_snippet_api_js_1.SourceSnippetApi(dbManager);
|
|
67
|
+
const result = await api.fetchSnippet(args);
|
|
68
|
+
return JSON.stringify(result, null, 2);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const errorMsg = error?.message || String(error);
|
|
72
|
+
return JSON.stringify({
|
|
73
|
+
error: `Failed to fetch source snippet: ${errorMsg}`,
|
|
74
|
+
evidence: {
|
|
75
|
+
grade: 'INFERRED',
|
|
76
|
+
sources: [],
|
|
77
|
+
description: `Error: ${errorMsg}`
|
|
78
|
+
}
|
|
79
|
+
}, null, 2);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=source-snippet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-snippet.js","sourceRoot":"","sources":["../../../src/mcp/tools/source-snippet.ts"],"names":[],"mappings":";;;AA8DA,oDA+BC;AA7FD,2EAAmE;AAGnE;;;GAGG;AACU,QAAA,iBAAiB,GAAG;IAC7B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,8DAA8D;QAC9D,iGAAiG;IAC9G,WAAW,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,SAAS,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0EAA0E;aAC1F;YACD,SAAS,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sCAAsC;aACtD;YACD,UAAU,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yDAAyD;aACzE;YACD,QAAQ,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kEAAkE;aAClF;YACD,YAAY,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;aACnE;YACD,eAAe,EAAE;gBACb,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,qDAAqD;aACrE;YACD,aAAa,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sCAAsC;aACtD;YACD,WAAW,EAAE;gBACT,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,wCAAwC;aACxD;YACD,QAAQ,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,WAAW;aAC3B;YACD,aAAa,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gCAAgC;aAChD;SACJ;QACD,QAAQ,EAAE,CAAC,UAAU,CAAC;KACzB;CACJ,CAAC;AAEF;;GAEG;AACI,KAAK,UAAU,oBAAoB,CACtC,IAWC,EACD,SAAyB;IAEzB,IAAI,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,wCAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAE5C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,SAAS,CAAC;YAClB,KAAK,EAAE,mCAAmC,QAAQ,EAAE;YACpD,QAAQ,EAAE;gBACN,KAAK,EAAE,UAAU;gBACjB,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,UAAU,QAAQ,EAAE;aACpC;SACJ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action hints for machine-readable fix recipes.
|
|
3
|
+
* Used to provide OS-specific commands and instructions for resolving issues.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Supported operating systems for action hints.
|
|
7
|
+
*/
|
|
8
|
+
export type OperatingSystem = 'windows' | 'linux' | 'mac';
|
|
9
|
+
/**
|
|
10
|
+
* Action hint structure for providing machine-readable fix instructions.
|
|
11
|
+
*/
|
|
12
|
+
export interface ActionHint {
|
|
13
|
+
/** Operating system this hint applies to */
|
|
14
|
+
os: OperatingSystem;
|
|
15
|
+
/** Command to execute (OS-specific) */
|
|
16
|
+
command: string;
|
|
17
|
+
/** Prerequisites that must be met before running the command */
|
|
18
|
+
prerequisites?: string[];
|
|
19
|
+
/** Steps to verify the fix worked */
|
|
20
|
+
verify_steps?: string[];
|
|
21
|
+
/** Human-readable description of what this action does */
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Helper function to create an action hint.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createActionHint(os: OperatingSystem, command: string, prerequisites?: string[], verify_steps?: string[], description?: string): ActionHint;
|
|
28
|
+
/**
|
|
29
|
+
* Helper function to get action hints for a specific OS.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getActionHintsForOS(hints: ActionHint[], os: OperatingSystem): ActionHint[];
|
|
32
|
+
/**
|
|
33
|
+
* Helper function to get all action hints for all OSes.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getAllActionHints(hints: ActionHint[]): Record<OperatingSystem, ActionHint[]>;
|
|
36
|
+
//# sourceMappingURL=action-hint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-hint.d.ts","sourceRoot":"","sources":["../../src/models/action-hint.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,4CAA4C;IAC5C,EAAE,EAAE,eAAe,CAAC;IAEpB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,YAAY,CAAC,EAAE,MAAM,EAAE,EACvB,WAAW,CAAC,EAAE,MAAM,GACrB,UAAU,CAQZ;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,eAAe,GAAG,UAAU,EAAE,CAE1F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,eAAe,EAAE,UAAU,EAAE,CAAC,CAM5F"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Action hints for machine-readable fix recipes.
|
|
4
|
+
* Used to provide OS-specific commands and instructions for resolving issues.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createActionHint = createActionHint;
|
|
8
|
+
exports.getActionHintsForOS = getActionHintsForOS;
|
|
9
|
+
exports.getAllActionHints = getAllActionHints;
|
|
10
|
+
/**
|
|
11
|
+
* Helper function to create an action hint.
|
|
12
|
+
*/
|
|
13
|
+
function createActionHint(os, command, prerequisites, verify_steps, description) {
|
|
14
|
+
return {
|
|
15
|
+
os,
|
|
16
|
+
command,
|
|
17
|
+
prerequisites,
|
|
18
|
+
verify_steps,
|
|
19
|
+
description
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Helper function to get action hints for a specific OS.
|
|
24
|
+
*/
|
|
25
|
+
function getActionHintsForOS(hints, os) {
|
|
26
|
+
return hints.filter(hint => hint.os === os);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Helper function to get all action hints for all OSes.
|
|
30
|
+
*/
|
|
31
|
+
function getAllActionHints(hints) {
|
|
32
|
+
return {
|
|
33
|
+
windows: getActionHintsForOS(hints, 'windows'),
|
|
34
|
+
linux: getActionHintsForOS(hints, 'linux'),
|
|
35
|
+
mac: getActionHintsForOS(hints, 'mac')
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=action-hint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-hint.js","sourceRoot":"","sources":["../../src/models/action-hint.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA8BH,4CAcC;AAKD,kDAEC;AAKD,8CAMC;AAnCD;;GAEG;AACH,SAAgB,gBAAgB,CAC5B,EAAmB,EACnB,OAAe,EACf,aAAwB,EACxB,YAAuB,EACvB,WAAoB;IAEpB,OAAO;QACH,EAAE;QACF,OAAO;QACP,aAAa;QACb,YAAY;QACZ,WAAW;KACd,CAAC;AACN,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,KAAmB,EAAE,EAAmB;IACxE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAAmB;IACjD,OAAO;QACH,OAAO,EAAE,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC;QAC9C,KAAK,EAAE,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC;QAC1C,GAAG,EAAE,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC;KACzC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evidence grading system for system-wide governance.
|
|
3
|
+
* Ensures all claims have structured sources and explicit grading.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Evidence grade levels.
|
|
7
|
+
*/
|
|
8
|
+
export type EvidenceGrade = 'FACT' | 'INFERRED' | 'HEURISTIC';
|
|
9
|
+
/**
|
|
10
|
+
* Evidence source types.
|
|
11
|
+
*/
|
|
12
|
+
export type EvidenceSourceType = 'ADR' | 'MODULE' | 'SYMBOL' | 'DEPENDENCY' | 'DB_QUERY' | 'STATUS_CHECK' | 'CONTRACT' | 'CODE_SNIPPET' | 'FILESYSTEM_READ' | 'HEURISTIC';
|
|
13
|
+
/**
|
|
14
|
+
* Structured evidence source.
|
|
15
|
+
* Normalform for all evidence sources.
|
|
16
|
+
*/
|
|
17
|
+
export interface EvidenceSource {
|
|
18
|
+
/** Type of source */
|
|
19
|
+
type: EvidenceSourceType;
|
|
20
|
+
/** Identifier (e.g., ADR number, symbol ID) */
|
|
21
|
+
id?: string;
|
|
22
|
+
/** File path (if applicable) */
|
|
23
|
+
path?: string;
|
|
24
|
+
/** Content hash (if applicable) */
|
|
25
|
+
hash?: string;
|
|
26
|
+
/** Additional metadata */
|
|
27
|
+
metadata?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Evidence information attached to responses.
|
|
31
|
+
*/
|
|
32
|
+
export interface Evidence {
|
|
33
|
+
/** Grade of the evidence */
|
|
34
|
+
grade: EvidenceGrade;
|
|
35
|
+
/** Structured sources */
|
|
36
|
+
sources: EvidenceSource[];
|
|
37
|
+
/** Optional description */
|
|
38
|
+
description?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Helper function to create an evidence source.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createEvidenceSource(type: EvidenceSourceType, id?: string, path?: string, hash?: string, metadata?: Record<string, any>): EvidenceSource;
|
|
44
|
+
/**
|
|
45
|
+
* Helper function to create evidence.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createEvidence(grade: EvidenceGrade, sources: EvidenceSource[], description?: string): Evidence;
|
|
48
|
+
/**
|
|
49
|
+
* Helper function to create FACT evidence.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createFactEvidence(sources: EvidenceSource[], description?: string): Evidence;
|
|
52
|
+
/**
|
|
53
|
+
* Helper function to create INFERRED evidence.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createInferredEvidence(sources: EvidenceSource[], description?: string): Evidence;
|
|
56
|
+
/**
|
|
57
|
+
* Helper function to create HEURISTIC evidence.
|
|
58
|
+
*/
|
|
59
|
+
export declare function createHeuristicEvidence(sources: EvidenceSource[], description?: string): Evidence;
|
|
60
|
+
/**
|
|
61
|
+
* Validates that evidence has sources (for FACT and INFERRED).
|
|
62
|
+
* HEURISTIC may have empty sources.
|
|
63
|
+
*/
|
|
64
|
+
export declare function validateEvidence(evidence: Evidence): {
|
|
65
|
+
valid: boolean;
|
|
66
|
+
error?: string;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../src/models/evidence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GACxB,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,cAAc,GACd,UAAU,GACV,cAAc,GACd,iBAAiB,GACjB,WAAW,CAAC;AAElB;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,qBAAqB;IACrB,IAAI,EAAE,kBAAkB,CAAC;IAEzB,+CAA+C;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,mCAAmC;IACnC,IAAI,CAAC,EAAE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for system-wide governance.
|
|
4
|
+
* Ensures all claims have structured sources and explicit grading.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createEvidenceSource = createEvidenceSource;
|
|
8
|
+
exports.createEvidence = createEvidence;
|
|
9
|
+
exports.createFactEvidence = createFactEvidence;
|
|
10
|
+
exports.createInferredEvidence = createInferredEvidence;
|
|
11
|
+
exports.createHeuristicEvidence = createHeuristicEvidence;
|
|
12
|
+
exports.validateEvidence = validateEvidence;
|
|
13
|
+
/**
|
|
14
|
+
* Helper function to create an evidence source.
|
|
15
|
+
*/
|
|
16
|
+
function createEvidenceSource(type, id, path, hash, metadata) {
|
|
17
|
+
return {
|
|
18
|
+
type,
|
|
19
|
+
id,
|
|
20
|
+
path,
|
|
21
|
+
hash,
|
|
22
|
+
metadata
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to create evidence.
|
|
27
|
+
*/
|
|
28
|
+
function createEvidence(grade, sources, description) {
|
|
29
|
+
return {
|
|
30
|
+
grade,
|
|
31
|
+
sources,
|
|
32
|
+
description
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Helper function to create FACT evidence.
|
|
37
|
+
*/
|
|
38
|
+
function createFactEvidence(sources, description) {
|
|
39
|
+
return createEvidence('FACT', sources, description);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Helper function to create INFERRED evidence.
|
|
43
|
+
*/
|
|
44
|
+
function createInferredEvidence(sources, description) {
|
|
45
|
+
return createEvidence('INFERRED', sources, description);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Helper function to create HEURISTIC evidence.
|
|
49
|
+
*/
|
|
50
|
+
function createHeuristicEvidence(sources, description) {
|
|
51
|
+
return createEvidence('HEURISTIC', sources, description);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validates that evidence has sources (for FACT and INFERRED).
|
|
55
|
+
* HEURISTIC may have empty sources.
|
|
56
|
+
*/
|
|
57
|
+
function validateEvidence(evidence) {
|
|
58
|
+
if (!evidence || !evidence.grade) {
|
|
59
|
+
return {
|
|
60
|
+
valid: false,
|
|
61
|
+
error: 'Evidence must have a grade'
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (!evidence.sources) {
|
|
65
|
+
return {
|
|
66
|
+
valid: false,
|
|
67
|
+
error: 'Evidence must have sources'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (evidence.grade === 'FACT' || evidence.grade === 'INFERRED') {
|
|
71
|
+
if (!Array.isArray(evidence.sources) || evidence.sources.length === 0) {
|
|
72
|
+
return {
|
|
73
|
+
valid: false,
|
|
74
|
+
error: `${evidence.grade} evidence must have at least one source`
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Validate sources
|
|
79
|
+
if (Array.isArray(evidence.sources)) {
|
|
80
|
+
for (const source of evidence.sources) {
|
|
81
|
+
if (!source.type) {
|
|
82
|
+
return {
|
|
83
|
+
valid: false,
|
|
84
|
+
error: 'Evidence source must have a type'
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return { valid: true };
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../src/models/evidence.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA4DH,oDAcC;AAKD,wCAUC;AAKD,gDAKC;AAKD,wDAKC;AAKD,0DAKC;AAMD,4CAqCC;AAzGD;;GAEG;AACH,SAAgB,oBAAoB,CAChC,IAAwB,EACxB,EAAW,EACX,IAAa,EACb,IAAa,EACb,QAA8B;IAE9B,OAAO;QACH,IAAI;QACJ,EAAE;QACF,IAAI;QACJ,IAAI;QACJ,QAAQ;KACX,CAAC;AACN,CAAC;AAED;;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