mcp-filter 1.0.1 → 1.0.2
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 +23 -13
- package/dist/index.js +0 -0
- package/package.json +1 -1
- package/dist/core/config-loader.d.ts +0 -22
- package/dist/core/config-loader.d.ts.map +0 -1
- package/dist/core/config-loader.js +0 -308
- package/dist/core/config-loader.js.map +0 -1
- package/dist/core/config-schema.d.ts +0 -1363
- package/dist/core/config-schema.d.ts.map +0 -1
- package/dist/core/config-schema.js +0 -139
- package/dist/core/config-schema.js.map +0 -1
- package/dist/core/server-manager.d.ts +0 -51
- package/dist/core/server-manager.d.ts.map +0 -1
- package/dist/core/server-manager.js +0 -149
- package/dist/core/server-manager.js.map +0 -1
- package/dist/features/discovery/config-init.d.ts +0 -37
- package/dist/features/discovery/config-init.d.ts.map +0 -1
- package/dist/features/discovery/config-init.js +0 -95
- package/dist/features/discovery/config-init.js.map +0 -1
- package/dist/features/discovery/discovery-handler.d.ts +0 -128
- package/dist/features/discovery/discovery-handler.d.ts.map +0 -1
- package/dist/features/discovery/discovery-handler.js +0 -629
- package/dist/features/discovery/discovery-handler.js.map +0 -1
- package/dist/features/discovery/initialization.d.ts +0 -126
- package/dist/features/discovery/initialization.d.ts.map +0 -1
- package/dist/features/discovery/initialization.js +0 -314
- package/dist/features/discovery/initialization.js.map +0 -1
- package/dist/features/discovery/search-phase.d.ts +0 -19
- package/dist/features/discovery/search-phase.d.ts.map +0 -1
- package/dist/features/discovery/search-phase.js +0 -76
- package/dist/features/discovery/search-phase.js.map +0 -1
- package/dist/features/discovery/simple-rag.d.ts +0 -30
- package/dist/features/discovery/simple-rag.d.ts.map +0 -1
- package/dist/features/discovery/simple-rag.js +0 -85
- package/dist/features/discovery/simple-rag.js.map +0 -1
- package/dist/features/filtering/filter.d.ts +0 -18
- package/dist/features/filtering/filter.d.ts.map +0 -1
- package/dist/features/filtering/filter.js +0 -43
- package/dist/features/filtering/filter.js.map +0 -1
- package/dist/features/overrides/override-manager.d.ts +0 -25
- package/dist/features/overrides/override-manager.d.ts.map +0 -1
- package/dist/features/overrides/override-manager.js +0 -67
- package/dist/features/overrides/override-manager.js.map +0 -1
- package/dist/utils/debug-logger.d.ts +0 -2
- package/dist/utils/debug-logger.d.ts.map +0 -1
- package/dist/utils/debug-logger.js +0 -33
- package/dist/utils/debug-logger.js.map +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simplest possible RAG implementation
|
|
3
|
-
* Uses word overlap and text similarity for semantic search
|
|
4
|
-
*/
|
|
5
|
-
export declare class SimpleRAG {
|
|
6
|
-
/**
|
|
7
|
-
* Simple tokenization - split by whitespace and punctuation
|
|
8
|
-
*/
|
|
9
|
-
private tokenize;
|
|
10
|
-
/**
|
|
11
|
-
* Calculate word overlap score between query and text
|
|
12
|
-
*/
|
|
13
|
-
private calculateOverlapScore;
|
|
14
|
-
/**
|
|
15
|
-
* Calculate semantic similarity score
|
|
16
|
-
* Uses word overlap + position weighting
|
|
17
|
-
*/
|
|
18
|
-
private calculateSimilarity;
|
|
19
|
-
/**
|
|
20
|
-
* Search tools using simple RAG
|
|
21
|
-
*/
|
|
22
|
-
search<T extends {
|
|
23
|
-
name: string;
|
|
24
|
-
description: string;
|
|
25
|
-
}>(tools: T[], query: string, threshold?: number): Array<{
|
|
26
|
-
tool: T;
|
|
27
|
-
score: number;
|
|
28
|
-
}>;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=simple-rag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple-rag.d.ts","sourceRoot":"","sources":["../../../src/features/discovery/simple-rag.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAQhB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAkB7B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;OAEG;IACH,MAAM,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EACpD,KAAK,EAAE,CAAC,EAAE,EACV,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAY,GACtB,KAAK,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAkCrC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simplest possible RAG implementation
|
|
3
|
-
* Uses word overlap and text similarity for semantic search
|
|
4
|
-
*/
|
|
5
|
-
export class SimpleRAG {
|
|
6
|
-
/**
|
|
7
|
-
* Simple tokenization - split by whitespace and punctuation
|
|
8
|
-
*/
|
|
9
|
-
tokenize(text) {
|
|
10
|
-
return text
|
|
11
|
-
.toLowerCase()
|
|
12
|
-
.replace(/[^\w\s]/g, " ")
|
|
13
|
-
.split(/\s+/)
|
|
14
|
-
.filter((word) => word.length > 0);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Calculate word overlap score between query and text
|
|
18
|
-
*/
|
|
19
|
-
calculateOverlapScore(queryTokens, textTokens) {
|
|
20
|
-
const querySet = new Set(queryTokens);
|
|
21
|
-
const textSet = new Set(textTokens);
|
|
22
|
-
// Count matching words
|
|
23
|
-
let matches = 0;
|
|
24
|
-
for (const token of querySet) {
|
|
25
|
-
if (textSet.has(token)) {
|
|
26
|
-
matches++;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// Score: matches / max(query length, text length)
|
|
30
|
-
// This gives higher scores for more relevant matches
|
|
31
|
-
const maxLength = Math.max(queryTokens.length, textTokens.length);
|
|
32
|
-
return maxLength > 0 ? matches / maxLength : 0;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Calculate semantic similarity score
|
|
36
|
-
* Uses word overlap + position weighting
|
|
37
|
-
*/
|
|
38
|
-
calculateSimilarity(query, text) {
|
|
39
|
-
const queryTokens = this.tokenize(query);
|
|
40
|
-
const textTokens = this.tokenize(text);
|
|
41
|
-
// Base overlap score
|
|
42
|
-
const overlapScore = this.calculateOverlapScore(queryTokens, textTokens);
|
|
43
|
-
// Boost score if query appears as substring (exact phrase match)
|
|
44
|
-
const queryLower = query.toLowerCase();
|
|
45
|
-
const textLower = text.toLowerCase();
|
|
46
|
-
const phraseBoost = textLower.includes(queryLower) ? 0.3 : 0;
|
|
47
|
-
// Boost score if important words match (longer words are more important)
|
|
48
|
-
let importantWordBoost = 0;
|
|
49
|
-
for (const token of queryTokens) {
|
|
50
|
-
if (token.length > 3 && textTokens.includes(token)) {
|
|
51
|
-
importantWordBoost += 0.1;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
importantWordBoost = Math.min(importantWordBoost, 0.2); // Cap at 0.2
|
|
55
|
-
return overlapScore + phraseBoost + importantWordBoost;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Search tools using simple RAG
|
|
59
|
-
*/
|
|
60
|
-
search(tools, query, threshold = 0.1) {
|
|
61
|
-
const results = [];
|
|
62
|
-
// Return empty if query is empty or just whitespace
|
|
63
|
-
if (!query || !query.trim()) {
|
|
64
|
-
return results;
|
|
65
|
-
}
|
|
66
|
-
for (const tool of tools) {
|
|
67
|
-
// Skip null/undefined tools
|
|
68
|
-
if (!tool || !tool.name) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
// Calculate scores for name and description
|
|
72
|
-
const nameScore = this.calculateSimilarity(query, tool.name);
|
|
73
|
-
const descScore = this.calculateSimilarity(query, tool.description || "");
|
|
74
|
-
// Combined score: name is more important (weighted 60%)
|
|
75
|
-
const combinedScore = nameScore * 0.6 + descScore * 0.4;
|
|
76
|
-
if (combinedScore >= threshold) {
|
|
77
|
-
results.push({ tool, score: combinedScore });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// Sort by score descending
|
|
81
|
-
results.sort((a, b) => b.score - a.score);
|
|
82
|
-
return results;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=simple-rag.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple-rag.js","sourceRoot":"","sources":["../../../src/features/discovery/simple-rag.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,SAAS;IACpB;;OAEG;IACK,QAAQ,CAAC,IAAY;QAC3B,OAAO,IAAI;aACR,WAAW,EAAE;aACb,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;aACxB,KAAK,CAAC,KAAK,CAAC;aACZ,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,WAAqB,EAAE,UAAoB;QACvE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QAEpC,uBAAuB;QACvB,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACvB,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;QAED,kDAAkD;QAClD,qDAAqD;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAClE,OAAO,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACK,mBAAmB,CAAC,KAAa,EAAE,IAAY;QACrD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CA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G,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7D,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CACxC,KAAK,EACL,IAAI,CAAC,WAAW,IAAI,EAAE,CACvB,CAAC;YAEF,wDAAwD;YACxD,MAAM,aAAa,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,GAAG,GAAG,CAAC;YAExD,IAAI,aAAa,IAAI,SAAS,EAAE,CAAC;gBAC/B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,2BAA2B;QAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAE1C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FilterPattern } from "../../types.js";
|
|
2
|
-
export declare class Filter {
|
|
3
|
-
private patterns;
|
|
4
|
-
private hasIncludePatterns;
|
|
5
|
-
constructor(patterns: FilterPattern[]);
|
|
6
|
-
shouldExclude(name: string): boolean;
|
|
7
|
-
filterList<T extends {
|
|
8
|
-
name: string;
|
|
9
|
-
}>(items: T[]): T[];
|
|
10
|
-
/**
|
|
11
|
-
* Create filter from include/exclude arrays (from config file)
|
|
12
|
-
*/
|
|
13
|
-
static fromConfig(filters?: {
|
|
14
|
-
include?: string[];
|
|
15
|
-
exclude?: string[];
|
|
16
|
-
}): Filter;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/features/filtering/filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,qBAAa,MAAM;IAGL,OAAO,CAAC,QAAQ;IAF5B,OAAO,CAAC,kBAAkB,CAAU;gBAEhB,QAAQ,EAAE,aAAa,EAAE;IAI7C,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAepC,UAAU,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;IAIvD;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM;CAiBhF"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { minimatch } from "minimatch";
|
|
2
|
-
export class Filter {
|
|
3
|
-
patterns;
|
|
4
|
-
hasIncludePatterns;
|
|
5
|
-
constructor(patterns) {
|
|
6
|
-
this.patterns = patterns;
|
|
7
|
-
this.hasIncludePatterns = patterns.some((p) => p.type === "include");
|
|
8
|
-
}
|
|
9
|
-
shouldExclude(name) {
|
|
10
|
-
// Evaluate patterns in order - first match wins (rsync-style)
|
|
11
|
-
for (const pattern of this.patterns) {
|
|
12
|
-
if (minimatch(name, pattern.pattern)) {
|
|
13
|
-
// First pattern that matches determines the outcome
|
|
14
|
-
return pattern.type === "exclude";
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
// No pattern matched - determine default behavior
|
|
18
|
-
// If there are include patterns, default is exclude (whitelist mode)
|
|
19
|
-
// Otherwise, default is include (allow all)
|
|
20
|
-
return this.hasIncludePatterns;
|
|
21
|
-
}
|
|
22
|
-
filterList(items) {
|
|
23
|
-
return items.filter((item) => !this.shouldExclude(item.name));
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Create filter from include/exclude arrays (from config file)
|
|
27
|
-
*/
|
|
28
|
-
static fromConfig(filters) {
|
|
29
|
-
const patterns = [];
|
|
30
|
-
if (filters?.exclude) {
|
|
31
|
-
for (const pattern of filters.exclude) {
|
|
32
|
-
patterns.push({ type: "exclude", pattern });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (filters?.include) {
|
|
36
|
-
for (const pattern of filters.include) {
|
|
37
|
-
patterns.push({ type: "include", pattern });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return new Filter(patterns);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/features/filtering/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,OAAO,MAAM;IAGG;IAFZ,kBAAkB,CAAU;IAEpC,YAAoB,QAAyB;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;QAC3C,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACvE,CAAC;IAED,aAAa,CAAC,IAAY;QACxB,8DAA8D;QAC9D,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBACrC,oDAAoD;gBACpD,OAAO,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC;YACpC,CAAC;QACH,CAAC;QAED,kDAAkD;QAClD,qEAAqE;QACrE,4CAA4C;QAC5C,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED,UAAU,CAA6B,KAAU;QAC/C,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAoD;QACpE,MAAM,QAAQ,GAAoB,EAAE,CAAC;QAErC,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QAED,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QAED,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ServerConfig } from "../../types.js";
|
|
2
|
-
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
-
export interface ToolWithOverrides extends Tool {
|
|
4
|
-
serverId: string;
|
|
5
|
-
originalDescription?: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Manages tool description overrides from config file
|
|
9
|
-
*/
|
|
10
|
-
export declare class OverrideManager {
|
|
11
|
-
private overrides;
|
|
12
|
-
/**
|
|
13
|
-
* Load overrides from server configs
|
|
14
|
-
*/
|
|
15
|
-
loadOverrides(serverId: string, serverConfig: ServerConfig): void;
|
|
16
|
-
/**
|
|
17
|
-
* Apply overrides to a tool
|
|
18
|
-
*/
|
|
19
|
-
applyOverrides(serverId: string, tool: Tool, useBrief?: boolean): ToolWithOverrides;
|
|
20
|
-
/**
|
|
21
|
-
* Check if a tool has overrides
|
|
22
|
-
*/
|
|
23
|
-
hasOverrides(serverId: string, toolName: string): boolean;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=override-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"override-manager.d.ts","sourceRoot":"","sources":["../../../src/features/overrides/override-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE/D,MAAM,WAAW,iBAAkB,SAAQ,IAAI;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,SAAS,CAAqD;IAEtE;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,IAAI;IAYjE;;OAEG;IACH,cAAc,CACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,IAAI,EACV,QAAQ,GAAE,OAAc,GACvB,iBAAiB;IA+CpB;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;CAG1D"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Manages tool description overrides from config file
|
|
3
|
-
*/
|
|
4
|
-
export class OverrideManager {
|
|
5
|
-
overrides = new Map();
|
|
6
|
-
/**
|
|
7
|
-
* Load overrides from server configs
|
|
8
|
-
*/
|
|
9
|
-
loadOverrides(serverId, serverConfig) {
|
|
10
|
-
if (serverConfig.toolOverrides) {
|
|
11
|
-
const serverOverrides = new Map();
|
|
12
|
-
for (const [toolName, override] of Object.entries(serverConfig.toolOverrides)) {
|
|
13
|
-
serverOverrides.set(toolName, override);
|
|
14
|
-
}
|
|
15
|
-
this.overrides.set(serverId, serverOverrides);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Apply overrides to a tool
|
|
20
|
-
*/
|
|
21
|
-
applyOverrides(serverId, tool, useBrief = true) {
|
|
22
|
-
const serverOverrides = this.overrides.get(serverId);
|
|
23
|
-
const toolOverride = serverOverrides?.get(tool.name);
|
|
24
|
-
if (!toolOverride) {
|
|
25
|
-
return { ...tool, serverId, originalDescription: tool.description };
|
|
26
|
-
}
|
|
27
|
-
const result = {
|
|
28
|
-
...tool,
|
|
29
|
-
serverId,
|
|
30
|
-
originalDescription: tool.description,
|
|
31
|
-
};
|
|
32
|
-
// Apply description override
|
|
33
|
-
if (useBrief && toolOverride.description) {
|
|
34
|
-
result.description = toolOverride.description;
|
|
35
|
-
}
|
|
36
|
-
else if (!useBrief && toolOverride.fullDescription) {
|
|
37
|
-
result.description = toolOverride.fullDescription;
|
|
38
|
-
}
|
|
39
|
-
else if (!useBrief) {
|
|
40
|
-
// Use original for RAG if no fullDescription override
|
|
41
|
-
result.description = tool.description || "";
|
|
42
|
-
}
|
|
43
|
-
// Apply argument overrides
|
|
44
|
-
if (toolOverride.argumentOverrides && tool.inputSchema?.properties) {
|
|
45
|
-
const inputSchema = { ...tool.inputSchema };
|
|
46
|
-
const properties = { ...inputSchema.properties };
|
|
47
|
-
for (const [argName, argOverride] of Object.entries(toolOverride.argumentOverrides)) {
|
|
48
|
-
if (properties[argName]) {
|
|
49
|
-
properties[argName] = {
|
|
50
|
-
...properties[argName],
|
|
51
|
-
description: argOverride.description,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
inputSchema.properties = properties;
|
|
56
|
-
result.inputSchema = inputSchema;
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Check if a tool has overrides
|
|
62
|
-
*/
|
|
63
|
-
hasOverrides(serverId, toolName) {
|
|
64
|
-
return this.overrides.get(serverId)?.has(toolName) ?? false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=override-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"override-manager.js","sourceRoot":"","sources":["../../../src/features/overrides/override-manager.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,OAAO,eAAe;IAClB,SAAS,GAA2C,IAAI,GAAG,EAAE,CAAC;IAEtE;;OAEG;IACH,aAAa,CAAC,QAAgB,EAAE,YAA0B;QACxD,IAAI,YAAY,CAAC,aAAa,EAAE,CAAC;YAC/B,MAAM,eAAe,GAAG,IAAI,GAAG,EAAwB,CAAC;YACxD,KAAK,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAC/C,YAAY,CAAC,aAAa,CAC3B,EAAE,CAAC;gBACF,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC1C,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,cAAc,CACZ,QAAgB,EAChB,IAAU,EACV,WAAoB,IAAI;QAExB,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrD,MAAM,YAAY,GAAG,eAAe,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErD,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QACtE,CAAC;QAED,MAAM,MAAM,GAAsB;YAChC,GAAG,IAAI;YACP,QAAQ;YACR,mBAAmB,EAAE,IAAI,CAAC,WAAW;SACtC,CAAC;QAEF,6BAA6B;QAC7B,IAAI,QAAQ,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC;YACzC,MAAM,CAAC,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;QAChD,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AAcA,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,CAkBN"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debug logging utility for runtime instrumentation
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* import { debugLog } from './utils/debug-logger.js';
|
|
6
|
-
* debugLog('file.ts:42', 'message', { data }, 'hypothesisId');
|
|
7
|
-
*
|
|
8
|
-
* Enable/disable via DEBUG environment variable:
|
|
9
|
-
* DEBUG=true pnpm test
|
|
10
|
-
* DEBUG=1 node dist/index.js
|
|
11
|
-
*/
|
|
12
|
-
const DEBUG_ENABLED = process.env.DEBUG === 'true' || process.env.DEBUG === '1';
|
|
13
|
-
const DEBUG_ENDPOINT = 'http://127.0.0.1:7243/ingest/198b6a8b-7e4f-4c81-a922-32b1e2e171c8';
|
|
14
|
-
export function debugLog(location, message, data, hypothesisId) {
|
|
15
|
-
if (!DEBUG_ENABLED)
|
|
16
|
-
return;
|
|
17
|
-
fetch(DEBUG_ENDPOINT, {
|
|
18
|
-
method: 'POST',
|
|
19
|
-
headers: { 'Content-Type': 'application/json' },
|
|
20
|
-
body: JSON.stringify({
|
|
21
|
-
location,
|
|
22
|
-
message,
|
|
23
|
-
data,
|
|
24
|
-
timestamp: Date.now(),
|
|
25
|
-
sessionId: 'debug-session',
|
|
26
|
-
runId: 'run1',
|
|
27
|
-
hypothesisId: hypothesisId || 'A',
|
|
28
|
-
}),
|
|
29
|
-
}).catch(() => {
|
|
30
|
-
// Silently fail if debug server not available
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=debug-logger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-logger.js","sourceRoot":"","sources":["../../src/utils/debug-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC;AAChF,MAAM,cAAc,GAAG,mEAAmE,CAAC;AAE3F,MAAM,UAAU,QAAQ,CACtB,QAAgB,EAChB,OAAe,EACf,IAA0B,EAC1B,YAAqB;IAErB,IAAI,CAAC,aAAa;QAAE,OAAO;IAE3B,KAAK,CAAC,cAAc,EAAE;QACpB,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,QAAQ;YACR,OAAO;YACP,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,SAAS,EAAE,eAAe;YAC1B,KAAK,EAAE,MAAM;YACb,YAAY,EAAE,YAAY,IAAI,GAAG;SAClC,CAAC;KACH,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;QACZ,8CAA8C;IAChD,CAAC,CAAC,CAAC;AACL,CAAC"}
|