@monoes/monomindcli 2.7.4 → 2.7.5
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/bin/cli.js +17 -1
- package/dist/src/commands/doctor-project-checks.d.ts +3 -0
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js +81 -8
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +16 -2
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/memory-crud.d.ts.map +1 -1
- package/dist/src/commands/memory-crud.js +15 -5
- package/dist/src/commands/memory-crud.js.map +1 -1
- package/dist/src/commands/security-misc.d.ts.map +1 -1
- package/dist/src/commands/security-misc.js +7 -2
- package/dist/src/commands/security-misc.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts.map +1 -1
- package/dist/src/init/helpers-generator.js +5 -0
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +0 -2
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +1 -1
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.d.ts +2 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +11 -1
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/guidance-tools.js +17 -17
- package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +2 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +14 -2
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +0 -1
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +0 -1
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.js +1 -2
- package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +1 -1
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +2 -2
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.d.ts +2 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +11 -1
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/ui/dashboard.html +44 -618
- package/dist/src/ui/server.mjs +0 -275
- package/dist/src/utils/cosine-similarity.d.ts +2 -2
- package/dist/src/utils/cosine-similarity.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/mcp-tools/coherence/causal-infer.d.ts +0 -15
- package/dist/src/mcp-tools/coherence/causal-infer.d.ts.map +0 -1
- package/dist/src/mcp-tools/coherence/causal-infer.js +0 -333
- package/dist/src/mcp-tools/coherence/causal-infer.js.map +0 -1
- package/dist/src/mcp-tools/coherence/coherence-check.d.ts +0 -15
- package/dist/src/mcp-tools/coherence/coherence-check.d.ts.map +0 -1
- package/dist/src/mcp-tools/coherence/coherence-check.js +0 -188
- package/dist/src/mcp-tools/coherence/coherence-check.js.map +0 -1
- package/dist/src/mcp-tools/coherence/consensus-verify.d.ts +0 -14
- package/dist/src/mcp-tools/coherence/consensus-verify.d.ts.map +0 -1
- package/dist/src/mcp-tools/coherence/consensus-verify.js +0 -305
- package/dist/src/mcp-tools/coherence/consensus-verify.js.map +0 -1
- package/dist/src/mcp-tools/coherence/memory-gate.d.ts +0 -16
- package/dist/src/mcp-tools/coherence/memory-gate.d.ts.map +0 -1
- package/dist/src/mcp-tools/coherence/memory-gate.js +0 -279
- package/dist/src/mcp-tools/coherence/memory-gate.js.map +0 -1
- package/dist/src/mcp-tools/coherence/quantum-topology.d.ts +0 -15
- package/dist/src/mcp-tools/coherence/quantum-topology.d.ts.map +0 -1
- package/dist/src/mcp-tools/coherence/quantum-topology.js +0 -400
- package/dist/src/mcp-tools/coherence/quantum-topology.js.map +0 -1
- package/dist/src/mcp-tools/coherence/spectral-analyze.d.ts +0 -14
- package/dist/src/mcp-tools/coherence/spectral-analyze.d.ts.map +0 -1
- package/dist/src/mcp-tools/coherence/spectral-analyze.js +0 -312
- package/dist/src/mcp-tools/coherence/spectral-analyze.js.map +0 -1
- package/dist/src/mcp-tools/coherence/types.d.ts +0 -430
- package/dist/src/mcp-tools/coherence/types.d.ts.map +0 -1
- package/dist/src/mcp-tools/coherence/types.js +0 -144
- package/dist/src/mcp-tools/coherence/types.js.map +0 -1
- package/dist/src/mcp-tools/coherence-tools.d.ts +0 -9
- package/dist/src/mcp-tools/coherence-tools.d.ts.map +0 -1
- package/dist/src/mcp-tools/coherence-tools.js +0 -25
- package/dist/src/mcp-tools/coherence-tools.js.map +0 -1
- package/dist/src/mcp-tools/daa-tools.d.ts +0 -13
- package/dist/src/mcp-tools/daa-tools.d.ts.map +0 -1
- package/dist/src/mcp-tools/daa-tools.js +0 -553
- package/dist/src/mcp-tools/daa-tools.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI engine for Monomind — an open-source MCP server that extends Claude Code with a codebase knowledge graph (tree-sitter + SQLite), persistent memory, multi-agent task coordination, and session hooks. MIT licensed, fully local.",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Causal Graph Analysis Tool - pr_causal_infer
|
|
3
|
-
*
|
|
4
|
-
* Analyzes causal graph structure to assess identifiability.
|
|
5
|
-
* Identifies confounders, finds backdoor paths, and determines
|
|
6
|
-
* whether a causal effect can be identified from the graph.
|
|
7
|
-
* Does NOT estimate causal effect magnitude (that requires data).
|
|
8
|
-
*/
|
|
9
|
-
import type { MCPTool } from './types.js';
|
|
10
|
-
/**
|
|
11
|
-
* pr_causal_infer MCP Tool Definition
|
|
12
|
-
*/
|
|
13
|
-
export declare const causalInferTool: MCPTool;
|
|
14
|
-
export default causalInferTool;
|
|
15
|
-
//# sourceMappingURL=causal-infer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"causal-infer.d.ts","sourceRoot":"","sources":["../../../../src/mcp-tools/coherence/causal-infer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,OAAO,EAKR,MAAM,YAAY,CAAC;AA2WpB;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,OA6C7B,CAAC;eAEa,eAAe"}
|
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Causal Graph Analysis Tool - pr_causal_infer
|
|
3
|
-
*
|
|
4
|
-
* Analyzes causal graph structure to assess identifiability.
|
|
5
|
-
* Identifies confounders, finds backdoor paths, and determines
|
|
6
|
-
* whether a causal effect can be identified from the graph.
|
|
7
|
-
* Does NOT estimate causal effect magnitude (that requires data).
|
|
8
|
-
*/
|
|
9
|
-
import { CausalInputSchema, successResult, errorResult, } from './types.js';
|
|
10
|
-
// Default logger
|
|
11
|
-
const defaultLogger = {
|
|
12
|
-
debug: (msg, meta) => console.debug(`[pr_causal_infer] ${msg}`, meta),
|
|
13
|
-
info: (msg, meta) => console.info(`[pr_causal_infer] ${msg}`, meta),
|
|
14
|
-
warn: (msg, meta) => console.warn(`[pr_causal_infer] ${msg}`, meta),
|
|
15
|
-
error: (msg, meta) => console.error(`[pr_causal_infer] ${msg}`, meta),
|
|
16
|
-
};
|
|
17
|
-
function buildGraphStructure(graph) {
|
|
18
|
-
const nodes = new Map();
|
|
19
|
-
// Initialize nodes
|
|
20
|
-
for (const nodeId of graph.nodes) {
|
|
21
|
-
nodes.set(nodeId, {
|
|
22
|
-
id: nodeId,
|
|
23
|
-
parents: new Set(),
|
|
24
|
-
children: new Set(),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
// Add edges
|
|
28
|
-
for (const [from, to] of graph.edges) {
|
|
29
|
-
const fromNode = nodes.get(from);
|
|
30
|
-
const toNode = nodes.get(to);
|
|
31
|
-
if (fromNode && toNode) {
|
|
32
|
-
fromNode.children.add(to);
|
|
33
|
-
toNode.parents.add(from);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return nodes;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Find all ancestors of a node (including the node itself)
|
|
40
|
-
*/
|
|
41
|
-
function findAncestors(nodeId, graph) {
|
|
42
|
-
const ancestors = new Set();
|
|
43
|
-
const queue = [nodeId];
|
|
44
|
-
while (queue.length > 0) {
|
|
45
|
-
const current = queue.shift();
|
|
46
|
-
if (ancestors.has(current))
|
|
47
|
-
continue;
|
|
48
|
-
ancestors.add(current);
|
|
49
|
-
const node = graph.get(current);
|
|
50
|
-
if (node) {
|
|
51
|
-
for (const parent of node.parents) {
|
|
52
|
-
queue.push(parent);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return ancestors;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Find all descendants of a node (including the node itself)
|
|
60
|
-
*/
|
|
61
|
-
function findDescendants(nodeId, graph) {
|
|
62
|
-
const descendants = new Set();
|
|
63
|
-
const queue = [nodeId];
|
|
64
|
-
while (queue.length > 0) {
|
|
65
|
-
const current = queue.shift();
|
|
66
|
-
if (descendants.has(current))
|
|
67
|
-
continue;
|
|
68
|
-
descendants.add(current);
|
|
69
|
-
const node = graph.get(current);
|
|
70
|
-
if (node) {
|
|
71
|
-
for (const child of node.children) {
|
|
72
|
-
queue.push(child);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return descendants;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Identify confounders (common causes of treatment and outcome)
|
|
80
|
-
*/
|
|
81
|
-
function identifyConfounders(treatment, outcome, graph) {
|
|
82
|
-
const treatmentAncestors = findAncestors(treatment, graph);
|
|
83
|
-
const outcomeAncestors = findAncestors(outcome, graph);
|
|
84
|
-
// Confounders are ancestors of both treatment and outcome
|
|
85
|
-
// that are not the treatment itself
|
|
86
|
-
const confounders = [];
|
|
87
|
-
for (const ancestor of treatmentAncestors) {
|
|
88
|
-
if (ancestor !== treatment && ancestor !== outcome && outcomeAncestors.has(ancestor)) {
|
|
89
|
-
confounders.push(ancestor);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return confounders;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Find backdoor paths from treatment to outcome
|
|
96
|
-
* A backdoor path is a path that goes into the treatment node
|
|
97
|
-
*/
|
|
98
|
-
function findBackdoorPaths(treatment, outcome, graph, maxPaths = 10) {
|
|
99
|
-
const backdoorPaths = [];
|
|
100
|
-
const treatmentNode = graph.get(treatment);
|
|
101
|
-
if (!treatmentNode)
|
|
102
|
-
return [];
|
|
103
|
-
// Start from each parent of treatment (backdoor)
|
|
104
|
-
for (const parent of treatmentNode.parents) {
|
|
105
|
-
const paths = findAllPaths(parent, outcome, graph, new Set([treatment]), maxPaths - backdoorPaths.length);
|
|
106
|
-
for (const path of paths) {
|
|
107
|
-
backdoorPaths.push([treatment, ...path]);
|
|
108
|
-
if (backdoorPaths.length >= maxPaths)
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
if (backdoorPaths.length >= maxPaths)
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
return backdoorPaths;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Find all paths from source to target (BFS with path tracking)
|
|
118
|
-
*/
|
|
119
|
-
function findAllPaths(source, target, graph, exclude, maxPaths) {
|
|
120
|
-
const paths = [];
|
|
121
|
-
const queue = [{ node: source, path: [source] }];
|
|
122
|
-
while (queue.length > 0 && paths.length < maxPaths) {
|
|
123
|
-
const { node, path } = queue.shift();
|
|
124
|
-
if (node === target) {
|
|
125
|
-
paths.push(path);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
const currentNode = graph.get(node);
|
|
129
|
-
if (!currentNode)
|
|
130
|
-
continue;
|
|
131
|
-
// Consider both parents and children for undirected path finding
|
|
132
|
-
const neighbors = new Set([...currentNode.parents, ...currentNode.children]);
|
|
133
|
-
for (const neighbor of neighbors) {
|
|
134
|
-
if (!path.includes(neighbor) && !exclude.has(neighbor)) {
|
|
135
|
-
queue.push({
|
|
136
|
-
node: neighbor,
|
|
137
|
-
path: [...path, neighbor],
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return paths;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Check if intervention is valid (treatment must exist and have outgoing edges)
|
|
146
|
-
*/
|
|
147
|
-
function validateIntervention(treatment, outcome, graph) {
|
|
148
|
-
const treatmentNode = graph.get(treatment);
|
|
149
|
-
const outcomeNode = graph.get(outcome);
|
|
150
|
-
if (!treatmentNode || !outcomeNode) {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
// Check if there's any path from treatment to outcome
|
|
154
|
-
const descendants = findDescendants(treatment, graph);
|
|
155
|
-
return descendants.has(outcome);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Assess identifiability of the causal effect based on graph structure.
|
|
159
|
-
* Does NOT estimate the causal effect magnitude -- that requires
|
|
160
|
-
* observational or experimental data which this tool does not have.
|
|
161
|
-
* Returns an identifiability score reflecting how cleanly the effect
|
|
162
|
-
* can be estimated if data were available (fewer confounders and
|
|
163
|
-
* unblocked backdoor paths = higher identifiability).
|
|
164
|
-
*/
|
|
165
|
-
function assessIdentifiability(confounders, backdoorPaths) {
|
|
166
|
-
// Identifiability decreases with confounders and unblocked backdoor paths
|
|
167
|
-
const confounderPenalty = Math.min(confounders.length * 0.1, 0.3);
|
|
168
|
-
const pathPenalty = Math.min(backdoorPaths.length * 0.05, 0.2);
|
|
169
|
-
const identifiability = Math.max(0.1, 1 - confounderPenalty - pathPenalty);
|
|
170
|
-
return { identifiability };
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Get interpretation of causal graph analysis results
|
|
174
|
-
*/
|
|
175
|
-
function getInterpretation(interventionValid, confounders, backdoorPaths, identifiability) {
|
|
176
|
-
if (!interventionValid) {
|
|
177
|
-
return 'Intervention is not valid - no causal path exists from treatment to outcome';
|
|
178
|
-
}
|
|
179
|
-
if (confounders.length === 0 && backdoorPaths.length === 0) {
|
|
180
|
-
return 'Clean causal identification - no confounding detected. Effect is identifiable with data.';
|
|
181
|
-
}
|
|
182
|
-
if (identifiability > 0.8) {
|
|
183
|
-
return 'Strong identifiability - confounders can be adjusted for with observational data';
|
|
184
|
-
}
|
|
185
|
-
if (identifiability > 0.5) {
|
|
186
|
-
return `Moderate identifiability - ${confounders.length} confounder(s) require adjustment`;
|
|
187
|
-
}
|
|
188
|
-
return `Weak identifiability - multiple confounders (${confounders.length}) and backdoor paths (${backdoorPaths.length}) detected`;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Handler for pr_causal_infer tool
|
|
192
|
-
*/
|
|
193
|
-
async function handler(input, context) {
|
|
194
|
-
const logger = context?.logger ?? defaultLogger;
|
|
195
|
-
const startTime = performance.now();
|
|
196
|
-
try {
|
|
197
|
-
// Validate input
|
|
198
|
-
const validationResult = CausalInputSchema.safeParse(input);
|
|
199
|
-
if (!validationResult.success) {
|
|
200
|
-
logger.error('Input validation failed', { error: validationResult.error.message });
|
|
201
|
-
return errorResult(`Invalid input: ${validationResult.error.message}`);
|
|
202
|
-
}
|
|
203
|
-
const { graph, intervention, outcome } = validationResult.data;
|
|
204
|
-
logger.debug('Processing causal inference', {
|
|
205
|
-
nodes: graph.nodes.length,
|
|
206
|
-
edges: graph.edges.length,
|
|
207
|
-
intervention,
|
|
208
|
-
outcome,
|
|
209
|
-
});
|
|
210
|
-
// Validate nodes exist
|
|
211
|
-
if (!graph.nodes.includes(intervention)) {
|
|
212
|
-
return errorResult(`Intervention variable "${intervention}" not found in graph nodes`);
|
|
213
|
-
}
|
|
214
|
-
if (!graph.nodes.includes(outcome)) {
|
|
215
|
-
return errorResult(`Outcome variable "${outcome}" not found in graph nodes`);
|
|
216
|
-
}
|
|
217
|
-
const maxBackdoorPaths = context?.config?.causal?.maxBackdoorPaths ?? 10;
|
|
218
|
-
let identifiability;
|
|
219
|
-
let confounders;
|
|
220
|
-
let backdoorPaths;
|
|
221
|
-
let interventionValid;
|
|
222
|
-
// Try to use WASM bridge if available
|
|
223
|
-
if (context?.bridge?.initialized) {
|
|
224
|
-
try {
|
|
225
|
-
logger.debug('Using WASM bridge for causal inference');
|
|
226
|
-
const result = await context.bridge.inferCausal(graph, intervention, outcome);
|
|
227
|
-
confounders = result.confounders;
|
|
228
|
-
backdoorPaths = result.backdoorPaths;
|
|
229
|
-
interventionValid = result.interventionValid;
|
|
230
|
-
identifiability = assessIdentifiability(confounders, backdoorPaths).identifiability;
|
|
231
|
-
}
|
|
232
|
-
catch (wasmError) {
|
|
233
|
-
logger.warn('WASM bridge failed, falling back to JS implementation', {
|
|
234
|
-
error: wasmError instanceof Error ? wasmError.message : String(wasmError),
|
|
235
|
-
});
|
|
236
|
-
// Use JavaScript implementation
|
|
237
|
-
const graphStructure = buildGraphStructure(graph);
|
|
238
|
-
interventionValid = validateIntervention(intervention, outcome, graphStructure);
|
|
239
|
-
confounders = identifyConfounders(intervention, outcome, graphStructure);
|
|
240
|
-
backdoorPaths = findBackdoorPaths(intervention, outcome, graphStructure, maxBackdoorPaths);
|
|
241
|
-
identifiability = assessIdentifiability(confounders, backdoorPaths).identifiability;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
// Pure JavaScript fallback
|
|
246
|
-
logger.debug('Using JavaScript fallback for causal inference');
|
|
247
|
-
const graphStructure = buildGraphStructure(graph);
|
|
248
|
-
interventionValid = validateIntervention(intervention, outcome, graphStructure);
|
|
249
|
-
confounders = identifyConfounders(intervention, outcome, graphStructure);
|
|
250
|
-
backdoorPaths = findBackdoorPaths(intervention, outcome, graphStructure, maxBackdoorPaths);
|
|
251
|
-
identifiability = assessIdentifiability(confounders, backdoorPaths).identifiability;
|
|
252
|
-
}
|
|
253
|
-
const output = {
|
|
254
|
-
identifiability,
|
|
255
|
-
backdoorPaths: backdoorPaths.map(p => p.join(' -> ')),
|
|
256
|
-
details: {
|
|
257
|
-
confounders,
|
|
258
|
-
interventionValid,
|
|
259
|
-
interpretation: getInterpretation(interventionValid, confounders, backdoorPaths, identifiability),
|
|
260
|
-
nodeCount: graph.nodes.length,
|
|
261
|
-
edgeCount: graph.edges.length,
|
|
262
|
-
},
|
|
263
|
-
};
|
|
264
|
-
const duration = performance.now() - startTime;
|
|
265
|
-
logger.info('Causal graph analysis completed', {
|
|
266
|
-
identifiability: identifiability.toFixed(4),
|
|
267
|
-
confounders: confounders.length,
|
|
268
|
-
backdoorPaths: backdoorPaths.length,
|
|
269
|
-
interventionValid,
|
|
270
|
-
durationMs: duration.toFixed(2),
|
|
271
|
-
});
|
|
272
|
-
return successResult(output);
|
|
273
|
-
}
|
|
274
|
-
catch (error) {
|
|
275
|
-
const duration = performance.now() - startTime;
|
|
276
|
-
logger.error('Causal inference failed', {
|
|
277
|
-
error: error instanceof Error ? error.message : String(error),
|
|
278
|
-
durationMs: duration.toFixed(2),
|
|
279
|
-
});
|
|
280
|
-
return errorResult(error instanceof Error ? error : new Error(String(error)));
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* pr_causal_infer MCP Tool Definition
|
|
285
|
-
*/
|
|
286
|
-
export const causalInferTool = {
|
|
287
|
-
name: 'pr_causal_infer',
|
|
288
|
-
description: 'Analyze causal graph structure for identifiability. Identifies confounders, finds backdoor paths, and assesses whether a causal effect can be identified. Does not estimate effect magnitude (requires observational data).',
|
|
289
|
-
category: 'causal',
|
|
290
|
-
version: '0.1.3',
|
|
291
|
-
tags: ['causal', 'do-calculus', 'confounders', 'backdoor-paths', 'ai-interpretability'],
|
|
292
|
-
cacheable: true,
|
|
293
|
-
cacheTTL: 60000,
|
|
294
|
-
inputSchema: {
|
|
295
|
-
type: 'object',
|
|
296
|
-
properties: {
|
|
297
|
-
graph: {
|
|
298
|
-
type: 'object',
|
|
299
|
-
properties: {
|
|
300
|
-
nodes: {
|
|
301
|
-
type: 'array',
|
|
302
|
-
items: { type: 'string' },
|
|
303
|
-
description: 'List of variable names',
|
|
304
|
-
},
|
|
305
|
-
edges: {
|
|
306
|
-
type: 'array',
|
|
307
|
-
items: {
|
|
308
|
-
type: 'array',
|
|
309
|
-
items: { type: 'string' },
|
|
310
|
-
minItems: 2,
|
|
311
|
-
maxItems: 2,
|
|
312
|
-
},
|
|
313
|
-
description: 'Directed edges as [from, to] pairs',
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
required: ['nodes', 'edges'],
|
|
317
|
-
description: 'Causal graph with nodes and directed edges',
|
|
318
|
-
},
|
|
319
|
-
intervention: {
|
|
320
|
-
type: 'string',
|
|
321
|
-
description: 'Treatment/intervention variable',
|
|
322
|
-
},
|
|
323
|
-
outcome: {
|
|
324
|
-
type: 'string',
|
|
325
|
-
description: 'Outcome variable to measure effect on',
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
required: ['graph', 'intervention', 'outcome'],
|
|
329
|
-
},
|
|
330
|
-
handler,
|
|
331
|
-
};
|
|
332
|
-
export default causalInferTool;
|
|
333
|
-
//# sourceMappingUR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AI,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAqB,CAAC;IACvF,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACzB,WAAW,EAAE,wBAAwB;qBACtC;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACL,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BACzB,QAAQ,EAAE,CAAC;4BACX,QAAQ,EAAE,CAAC;yBACZ;wBACD,WAAW,EAAE,oCAAoC;qBAClD;iBACF;gBACD,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;gBAC5B,WAAW,EAAE,4CAA4C;aAC1D;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uCAAuC;aACrD;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC;KAC/C;IACD,OAAO;CACR,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coherence Check Tool - pr_coherence_check
|
|
3
|
-
*
|
|
4
|
-
* Checks coherence of vectors using Sheaf Laplacian energy.
|
|
5
|
-
* Energy 0 = fully coherent, Energy 1 = contradictory
|
|
6
|
-
*
|
|
7
|
-
* Uses CohomologyEngine from prime-radiant-advanced-wasm
|
|
8
|
-
*/
|
|
9
|
-
import type { MCPTool } from './types.js';
|
|
10
|
-
/**
|
|
11
|
-
* pr_coherence_check MCP Tool Definition
|
|
12
|
-
*/
|
|
13
|
-
export declare const coherenceCheckTool: MCPTool;
|
|
14
|
-
export default coherenceCheckTool;
|
|
15
|
-
//# sourceMappingURL=coherence-check.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coherence-check.d.ts","sourceRoot":"","sources":["../../../../src/mcp-tools/coherence/coherence-check.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,OAAO,EAIR,MAAM,YAAY,CAAC;AA2KpB;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAyBhC,CAAC;eAEa,kBAAkB"}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coherence Check Tool - pr_coherence_check
|
|
3
|
-
*
|
|
4
|
-
* Checks coherence of vectors using Sheaf Laplacian energy.
|
|
5
|
-
* Energy 0 = fully coherent, Energy 1 = contradictory
|
|
6
|
-
*
|
|
7
|
-
* Uses CohomologyEngine from prime-radiant-advanced-wasm
|
|
8
|
-
*/
|
|
9
|
-
import { cosineSimilarity } from '../../utils/cosine-similarity.js';
|
|
10
|
-
import { CoherenceInputSchema, successResult, errorResult, } from './types.js';
|
|
11
|
-
// Default logger for when context doesn't provide one
|
|
12
|
-
const defaultLogger = {
|
|
13
|
-
debug: (msg, meta) => console.debug(`[pr_coherence_check] ${msg}`, meta),
|
|
14
|
-
info: (msg, meta) => console.info(`[pr_coherence_check] ${msg}`, meta),
|
|
15
|
-
warn: (msg, meta) => console.warn(`[pr_coherence_check] ${msg}`, meta),
|
|
16
|
-
error: (msg, meta) => console.error(`[pr_coherence_check] ${msg}`, meta),
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Compute Sheaf Laplacian energy for coherence detection
|
|
20
|
-
*
|
|
21
|
-
* The Sheaf Laplacian measures how well local data sections can be
|
|
22
|
-
* glued together into a global section. High energy indicates contradictions.
|
|
23
|
-
*
|
|
24
|
-
* For vectors v1, v2, ..., vn:
|
|
25
|
-
* 1. Construct a sheaf over the complete graph
|
|
26
|
-
* 2. Compute the Laplacian matrix L = D - A (where A captures similarities)
|
|
27
|
-
* 3. Energy = sum of disagreements across edges
|
|
28
|
-
*/
|
|
29
|
-
function computeSheafLaplacianEnergy(vectors) {
|
|
30
|
-
if (vectors.length < 2)
|
|
31
|
-
return 0;
|
|
32
|
-
const n = vectors.length;
|
|
33
|
-
let totalEnergy = 0;
|
|
34
|
-
let edgeCount = 0;
|
|
35
|
-
// Compute pairwise disagreement (1 - cosine_similarity)
|
|
36
|
-
for (let i = 0; i < n; i++) {
|
|
37
|
-
for (let j = i + 1; j < n; j++) {
|
|
38
|
-
const vi = vectors[i];
|
|
39
|
-
const vj = vectors[j];
|
|
40
|
-
const similarity = cosineSimilarity(vi, vj);
|
|
41
|
-
const disagreement = 1 - Math.max(0, similarity); // Clamp negative similarities
|
|
42
|
-
totalEnergy += disagreement;
|
|
43
|
-
edgeCount++;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// Normalize by number of edges
|
|
47
|
-
return edgeCount > 0 ? totalEnergy / edgeCount : 0;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Detect contradictions in the vector set
|
|
51
|
-
*/
|
|
52
|
-
function detectContradictions(vectors, threshold) {
|
|
53
|
-
const violations = [];
|
|
54
|
-
const n = vectors.length;
|
|
55
|
-
for (let i = 0; i < n; i++) {
|
|
56
|
-
for (let j = i + 1; j < n; j++) {
|
|
57
|
-
const vi = vectors[i];
|
|
58
|
-
const vj = vectors[j];
|
|
59
|
-
const similarity = cosineSimilarity(vi, vj);
|
|
60
|
-
// Negative similarity indicates potential contradiction
|
|
61
|
-
if (similarity < -0.3) {
|
|
62
|
-
violations.push(`Contradiction between vectors ${i} and ${j} (similarity: ${similarity.toFixed(3)})`);
|
|
63
|
-
}
|
|
64
|
-
// Low similarity with high threshold indicates inconsistency
|
|
65
|
-
else if (similarity < threshold && similarity > 0) {
|
|
66
|
-
violations.push(`Weak coherence between vectors ${i} and ${j} (similarity: ${similarity.toFixed(3)})`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return violations;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get interpretation of energy level
|
|
74
|
-
*/
|
|
75
|
-
function getInterpretation(energy) {
|
|
76
|
-
if (energy < 0.1)
|
|
77
|
-
return 'Fully coherent - vectors are highly consistent';
|
|
78
|
-
if (energy < 0.3)
|
|
79
|
-
return 'Minor inconsistencies - generally coherent with small variations';
|
|
80
|
-
if (energy < 0.5)
|
|
81
|
-
return 'Moderate inconsistencies - some conflicting information detected';
|
|
82
|
-
if (energy < 0.7)
|
|
83
|
-
return 'Significant contradictions - vectors contain conflicting content';
|
|
84
|
-
return 'Major contradictions detected - high disagreement between vectors';
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Handler for pr_coherence_check tool
|
|
88
|
-
*/
|
|
89
|
-
async function handler(input, context) {
|
|
90
|
-
const logger = context?.logger ?? defaultLogger;
|
|
91
|
-
const startTime = performance.now();
|
|
92
|
-
try {
|
|
93
|
-
// Validate input
|
|
94
|
-
const validationResult = CoherenceInputSchema.safeParse(input);
|
|
95
|
-
if (!validationResult.success) {
|
|
96
|
-
logger.error('Input validation failed', { error: validationResult.error.message });
|
|
97
|
-
return errorResult(`Invalid input: ${validationResult.error.message}`);
|
|
98
|
-
}
|
|
99
|
-
const { vectors, threshold } = validationResult.data;
|
|
100
|
-
logger.debug('Processing coherence check', { vectorCount: vectors.length, threshold });
|
|
101
|
-
// Convert to Float32Arrays
|
|
102
|
-
const float32Vectors = vectors.map(v => new Float32Array(v));
|
|
103
|
-
let energy;
|
|
104
|
-
let violations;
|
|
105
|
-
// Try to use WASM bridge if available
|
|
106
|
-
if (context?.bridge?.initialized) {
|
|
107
|
-
try {
|
|
108
|
-
logger.debug('Using WASM bridge for coherence check');
|
|
109
|
-
const result = await context.bridge.checkCoherence(float32Vectors);
|
|
110
|
-
energy = result.energy;
|
|
111
|
-
violations = result.violations;
|
|
112
|
-
}
|
|
113
|
-
catch (wasmError) {
|
|
114
|
-
logger.warn('WASM bridge failed, falling back to JS implementation', {
|
|
115
|
-
error: wasmError instanceof Error ? wasmError.message : String(wasmError),
|
|
116
|
-
});
|
|
117
|
-
energy = computeSheafLaplacianEnergy(float32Vectors);
|
|
118
|
-
violations = detectContradictions(float32Vectors, threshold);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
// Pure JavaScript fallback implementation
|
|
123
|
-
logger.debug('Using JavaScript fallback for coherence check');
|
|
124
|
-
energy = computeSheafLaplacianEnergy(float32Vectors);
|
|
125
|
-
violations = detectContradictions(float32Vectors, threshold);
|
|
126
|
-
}
|
|
127
|
-
const isCoherent = energy < threshold;
|
|
128
|
-
const confidence = 1 - energy;
|
|
129
|
-
const output = {
|
|
130
|
-
energy,
|
|
131
|
-
isCoherent,
|
|
132
|
-
details: {
|
|
133
|
-
violations,
|
|
134
|
-
confidence,
|
|
135
|
-
interpretation: getInterpretation(energy),
|
|
136
|
-
vectorCount: vectors.length,
|
|
137
|
-
threshold,
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
const duration = performance.now() - startTime;
|
|
141
|
-
logger.info('Coherence check completed', {
|
|
142
|
-
energy: energy.toFixed(4),
|
|
143
|
-
isCoherent,
|
|
144
|
-
violations: violations.length,
|
|
145
|
-
durationMs: duration.toFixed(2),
|
|
146
|
-
});
|
|
147
|
-
return successResult(output);
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
const duration = performance.now() - startTime;
|
|
151
|
-
logger.error('Coherence check failed', {
|
|
152
|
-
error: error instanceof Error ? error.message : String(error),
|
|
153
|
-
durationMs: duration.toFixed(2),
|
|
154
|
-
});
|
|
155
|
-
return errorResult(error instanceof Error ? error : new Error(String(error)));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* pr_coherence_check MCP Tool Definition
|
|
160
|
-
*/
|
|
161
|
-
export const coherenceCheckTool = {
|
|
162
|
-
name: 'pr_coherence_check',
|
|
163
|
-
description: 'Check coherence of vectors using Sheaf Laplacian energy. Energy 0 = fully coherent, 1 = contradictory. Uses CohomologyEngine for mathematical validation of vector consistency.',
|
|
164
|
-
category: 'coherence',
|
|
165
|
-
version: '0.1.3',
|
|
166
|
-
tags: ['coherence', 'sheaf-laplacian', 'contradiction-detection', 'ai-interpretability'],
|
|
167
|
-
cacheable: true,
|
|
168
|
-
cacheTTL: 60000, // 1 minute cache
|
|
169
|
-
inputSchema: {
|
|
170
|
-
type: 'object',
|
|
171
|
-
properties: {
|
|
172
|
-
vectors: {
|
|
173
|
-
type: 'array',
|
|
174
|
-
items: { type: 'array', items: { type: 'number' } },
|
|
175
|
-
description: 'Array of embedding vectors to check for coherence',
|
|
176
|
-
},
|
|
177
|
-
threshold: {
|
|
178
|
-
type: 'number',
|
|
179
|
-
default: 0.3,
|
|
180
|
-
description: 'Energy threshold for coherence (0-1). Lower = stricter coherence requirement.',
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
required: ['vectors'],
|
|
184
|
-
},
|
|
185
|
-
handler,
|
|
186
|
-
};
|
|
187
|
-
export default coherenceCheckTool;
|
|
188
|
-
//# sourceMappingURL=coherence-check.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coherence-check.js","sourceRoot":"","sources":["../../../../src/mcp-tools/coherence/coherence-check.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB,sDAAsD;AACtD,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,CAAC,G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D;aACjE;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,GAAG;gBACZ,WAAW,EAAE,+EAA+E;aAC7F;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;IACD,OAAO;CACR,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consensus Verification Tool - pr_consensus_verify
|
|
3
|
-
*
|
|
4
|
-
* Verifies multi-agent consensus using cosine-similarity coherence analysis.
|
|
5
|
-
* Identifies divergent agents and measures agreement ratios.
|
|
6
|
-
* Connectivity stability uses a degree-ratio heuristic (not spectral decomposition).
|
|
7
|
-
*/
|
|
8
|
-
import type { MCPTool } from './types.js';
|
|
9
|
-
/**
|
|
10
|
-
* pr_consensus_verify MCP Tool Definition
|
|
11
|
-
*/
|
|
12
|
-
export declare const consensusVerifyTool: MCPTool;
|
|
13
|
-
export default consensusVerifyTool;
|
|
14
|
-
//# sourceMappingURL=consensus-verify.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consensus-verify.d.ts","sourceRoot":"","sources":["../../../../src/mcp-tools/coherence/consensus-verify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,OAAO,EAKR,MAAM,YAAY,CAAC;AA8TpB;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAqCjC,CAAC;eAEa,mBAAmB"}
|