triflux 3.3.0-dev.3 → 3.3.0-dev.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/hub/assign-callbacks.mjs +136 -0
- package/hub/bridge.mjs +283 -97
- package/hub/pipe.mjs +81 -0
- package/hub/server.mjs +56 -53
- package/hub/store.mjs +36 -2
- package/hub/team/cli-team-status.mjs +17 -3
- package/hub/team/native-supervisor.mjs +62 -22
- package/hub/team/native.mjs +266 -200
- package/hub/workers/delegator-mcp.mjs +285 -140
- package/package.json +60 -60
- package/scripts/lib/mcp-filter.mjs +637 -0
- package/scripts/lib/mcp-server-catalog.mjs +118 -0
- package/scripts/mcp-check.mjs +126 -88
- package/scripts/test-tfx-route-no-claude-native.mjs +10 -2
- package/scripts/tfx-route.sh +434 -179
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export const SEARCH_SERVER_ORDER = Object.freeze(['brave-search', 'tavily', 'exa']);
|
|
2
|
+
|
|
3
|
+
export const MCP_SERVER_TOOL_CATALOG = Object.freeze({
|
|
4
|
+
context7: Object.freeze(['resolve-library-id', 'query-docs']),
|
|
5
|
+
'brave-search': Object.freeze(['brave_web_search', 'brave_news_search']),
|
|
6
|
+
exa: Object.freeze(['web_search_exa', 'get_code_context_exa']),
|
|
7
|
+
tavily: Object.freeze(['tavily_search', 'tavily_extract']),
|
|
8
|
+
playwright: Object.freeze([
|
|
9
|
+
'browser_navigate',
|
|
10
|
+
'browser_navigate_back',
|
|
11
|
+
'browser_snapshot',
|
|
12
|
+
'browser_take_screenshot',
|
|
13
|
+
'browser_wait_for',
|
|
14
|
+
]),
|
|
15
|
+
'sequential-thinking': Object.freeze(['sequentialthinking']),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const MCP_SERVER_DOMAIN_TAGS = Object.freeze({
|
|
19
|
+
context7: Object.freeze(['docs', 'reference', 'api', 'sdk', 'library']),
|
|
20
|
+
'brave-search': Object.freeze(['web', 'search', 'news', 'current']),
|
|
21
|
+
exa: Object.freeze(['code', 'repository', 'examples', 'search']),
|
|
22
|
+
tavily: Object.freeze(['research', 'search', 'news', 'verification', 'current']),
|
|
23
|
+
playwright: Object.freeze(['browser', 'ui', 'visual', 'e2e']),
|
|
24
|
+
'sequential-thinking': Object.freeze(['analysis', 'planning', 'reasoning', 'security', 'review']),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const DOMAIN_TAG_KEYWORDS = Object.freeze({
|
|
28
|
+
docs: Object.freeze(['docs', 'documentation', 'manual', 'guide', '문서', '가이드', '매뉴얼']),
|
|
29
|
+
reference: Object.freeze(['reference', 'spec', 'schema', 'official', '레퍼런스', '공식', '스펙', '스키마']),
|
|
30
|
+
api: Object.freeze(['api', 'endpoint', 'interface', 'sdk', '호출', '엔드포인트']),
|
|
31
|
+
sdk: Object.freeze(['sdk', 'library', 'package', 'framework', '라이브러리', '패키지', '프레임워크']),
|
|
32
|
+
library: Object.freeze(['library', 'package', 'framework', 'module', '라이브러리', '패키지', '모듈']),
|
|
33
|
+
web: Object.freeze(['web', 'site', 'article', 'forum', 'blog', 'reddit', '웹', '사이트', '기사', '포럼', '블로그']),
|
|
34
|
+
search: Object.freeze(['search', 'browse', 'lookup', 'find', '검색', '조회', '탐색', '찾아']),
|
|
35
|
+
news: Object.freeze(['latest', 'recent', 'news', 'today', 'release', 'announcement', '최신', '최근', '뉴스', '오늘', '릴리즈', '공지']),
|
|
36
|
+
current: Object.freeze(['current', 'status', 'pricing', 'changelog', 'up-to-date', '현재', '상태', '가격', '변경사항']),
|
|
37
|
+
research: Object.freeze(['research', 'verify', 'fact-check', 'investigate', '리서치', '검증', '조사']),
|
|
38
|
+
verification: Object.freeze(['verify', 'validation', 'fact-check', 'audit', '검증', '확인', '감사']),
|
|
39
|
+
code: Object.freeze(['code', 'repo', 'repository', 'source', 'implementation', 'bug', 'fix', 'test', 'snippet', 'cli', '코드', '리포', '저장소', '구현', '버그', '테스트', '예제', '스크립트']),
|
|
40
|
+
repository: Object.freeze(['repo', 'repository', 'source', 'git', 'github', '리포', '저장소', '소스']),
|
|
41
|
+
examples: Object.freeze(['example', 'examples', 'snippet', 'sample', '예제', '샘플']),
|
|
42
|
+
browser: Object.freeze(['browser', 'page', 'dom', 'screenshot', 'render', '브라우저', '페이지', '스크린샷', '렌더']),
|
|
43
|
+
ui: Object.freeze(['ui', 'ux', 'layout', 'responsive', 'css', 'html', '디자인', '레이아웃', '반응형']),
|
|
44
|
+
visual: Object.freeze(['visual', 'screenshot', 'layout', 'render', 'screen', '화면', '시각', '스크린샷']),
|
|
45
|
+
e2e: Object.freeze(['playwright', 'e2e', 'click', 'navigate', 'automation', 'playwright', '클릭', '이동', '자동화']),
|
|
46
|
+
analysis: Object.freeze(['analysis', 'analyze', 'audit', 'compare', 'root cause', '분석', '검토', '비교', '원인']),
|
|
47
|
+
planning: Object.freeze(['plan', 'planning', 'strategy', 'design', '계획', '전략', '설계']),
|
|
48
|
+
reasoning: Object.freeze(['reason', 'reasoning', 'think', 'critique', '추론', '사고', '비평']),
|
|
49
|
+
security: Object.freeze(['security', 'risk', 'threat', 'vulnerability', '보안', '위험', '취약점']),
|
|
50
|
+
review: Object.freeze(['review', 'reviewer', 'inspect', '리뷰', '검수']),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const SERVER_EXPLICIT_KEYWORDS = Object.freeze({
|
|
54
|
+
context7: Object.freeze(['context7']),
|
|
55
|
+
'brave-search': Object.freeze(['brave', 'brave-search']),
|
|
56
|
+
exa: Object.freeze(['exa']),
|
|
57
|
+
tavily: Object.freeze(['tavily']),
|
|
58
|
+
playwright: Object.freeze(['playwright']),
|
|
59
|
+
'sequential-thinking': Object.freeze(['sequential-thinking', 'sequential thinking']),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export function uniqueStrings(values = []) {
|
|
63
|
+
return [...new Set(
|
|
64
|
+
values
|
|
65
|
+
.filter((value) => typeof value === 'string' && value.trim())
|
|
66
|
+
.map((value) => value.trim()),
|
|
67
|
+
)];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function inferDomainTagsFromText(text = '') {
|
|
71
|
+
if (typeof text !== 'string' || !text.trim()) return [];
|
|
72
|
+
const normalized = text.toLocaleLowerCase();
|
|
73
|
+
const matched = [];
|
|
74
|
+
|
|
75
|
+
for (const [tag, keywords] of Object.entries(DOMAIN_TAG_KEYWORDS)) {
|
|
76
|
+
if (keywords.some((keyword) => normalized.includes(String(keyword).toLocaleLowerCase()))) {
|
|
77
|
+
matched.push(tag);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return uniqueStrings(matched);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function getDefaultServerMetadata(serverName = '') {
|
|
85
|
+
const toolCount = MCP_SERVER_TOOL_CATALOG[serverName]?.length || 0;
|
|
86
|
+
const domainTags = uniqueStrings([
|
|
87
|
+
...(MCP_SERVER_DOMAIN_TAGS[serverName] || []),
|
|
88
|
+
...inferDomainTagsFromText(serverName),
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
tool_count: toolCount,
|
|
93
|
+
domain_tags: domainTags,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function normalizeServerMetadata(serverName = '', metadata = {}) {
|
|
98
|
+
const fallback = getDefaultServerMetadata(serverName);
|
|
99
|
+
const toolCount = Number.isFinite(metadata.tool_count)
|
|
100
|
+
? Math.max(0, Math.trunc(metadata.tool_count))
|
|
101
|
+
: fallback.tool_count;
|
|
102
|
+
const domainTags = uniqueStrings([
|
|
103
|
+
...fallback.domain_tags,
|
|
104
|
+
...(Array.isArray(metadata.domain_tags) ? metadata.domain_tags : []),
|
|
105
|
+
...inferDomainTagsFromText([
|
|
106
|
+
serverName,
|
|
107
|
+
typeof metadata.command === 'string' ? metadata.command : '',
|
|
108
|
+
typeof metadata.url === 'string' ? metadata.url : '',
|
|
109
|
+
...(Array.isArray(metadata.args) ? metadata.args : []),
|
|
110
|
+
...(metadata.env && typeof metadata.env === 'object' ? Object.keys(metadata.env) : []),
|
|
111
|
+
].join(' ')),
|
|
112
|
+
]);
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
tool_count: toolCount,
|
|
116
|
+
domain_tags: domainTags,
|
|
117
|
+
};
|
|
118
|
+
}
|
package/scripts/mcp-check.mjs
CHANGED
|
@@ -1,88 +1,126 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// MCP
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// MCP inventory cache for dynamic MCP filtering.
|
|
3
|
+
|
|
4
|
+
import { execSync } from 'node:child_process';
|
|
5
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
import { normalizeServerMetadata } from './lib/mcp-server-catalog.mjs';
|
|
11
|
+
|
|
12
|
+
const CACHE_DIR = join(homedir(), '.claude', 'cache');
|
|
13
|
+
const CACHE_FILE = join(CACHE_DIR, 'mcp-inventory.json');
|
|
14
|
+
|
|
15
|
+
function countConfiguredTools(config = {}, fallbackToolCount = 0) {
|
|
16
|
+
const directKeys = ['tools', 'toolNames', 'allowedTools', 'includeTools'];
|
|
17
|
+
for (const key of directKeys) {
|
|
18
|
+
if (Array.isArray(config[key])) return config[key].length;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (Array.isArray(config.excludeTools)) {
|
|
22
|
+
return Math.max(0, fallbackToolCount - config.excludeTools.length);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return fallbackToolCount;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function createServerRecord(name, status, config = {}) {
|
|
29
|
+
const normalizedName = typeof name === 'string' ? name.trim() : '';
|
|
30
|
+
const fallback = normalizeServerMetadata(normalizedName, {});
|
|
31
|
+
const toolCount = countConfiguredTools(config, fallback.tool_count);
|
|
32
|
+
const domainTags = Array.isArray(config.domain_tags)
|
|
33
|
+
? config.domain_tags
|
|
34
|
+
: Array.isArray(config.domainTags)
|
|
35
|
+
? config.domainTags
|
|
36
|
+
: [];
|
|
37
|
+
|
|
38
|
+
const metadata = normalizeServerMetadata(normalizedName, {
|
|
39
|
+
...config,
|
|
40
|
+
tool_count: toolCount,
|
|
41
|
+
domain_tags: domainTags,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
name: normalizedName,
|
|
46
|
+
status,
|
|
47
|
+
tool_count: metadata.tool_count,
|
|
48
|
+
domain_tags: metadata.domain_tags,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function getCodexMcp() {
|
|
53
|
+
try {
|
|
54
|
+
const output = execSync('codex mcp list', {
|
|
55
|
+
encoding: 'utf8',
|
|
56
|
+
timeout: 15000,
|
|
57
|
+
stdio: ['pipe', 'pipe', 'ignore'],
|
|
58
|
+
});
|
|
59
|
+
const lines = output.trim().split(/\r?\n/).filter((line) => line.trim());
|
|
60
|
+
if (lines.length < 2) return [];
|
|
61
|
+
|
|
62
|
+
const servers = [];
|
|
63
|
+
for (let i = 1; i < lines.length; i += 1) {
|
|
64
|
+
const cols = lines[i].split(/\s{2,}/);
|
|
65
|
+
if (cols.length < 2) continue;
|
|
66
|
+
|
|
67
|
+
const name = cols[0].trim();
|
|
68
|
+
const statusMatch = lines[i].match(/\b(enabled|disabled)\b/i);
|
|
69
|
+
const status = statusMatch ? statusMatch[1].toLowerCase() : 'unknown';
|
|
70
|
+
if (!name || name.startsWith('-')) continue;
|
|
71
|
+
servers.push(createServerRecord(name, status));
|
|
72
|
+
}
|
|
73
|
+
return servers;
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function getGeminiMcp() {
|
|
80
|
+
try {
|
|
81
|
+
const settingsPath = join(homedir(), '.gemini', 'settings.json');
|
|
82
|
+
if (!existsSync(settingsPath)) return null;
|
|
83
|
+
|
|
84
|
+
const settings = JSON.parse(readFileSync(settingsPath, 'utf8'));
|
|
85
|
+
const mcpServers = settings.mcpServers || {};
|
|
86
|
+
return Object.entries(mcpServers).map(([name, config]) => createServerRecord(name, 'configured', config || {}));
|
|
87
|
+
} catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function buildInventory() {
|
|
93
|
+
const inventory = {
|
|
94
|
+
timestamp: new Date().toISOString(),
|
|
95
|
+
codex: { available: false, servers: [] },
|
|
96
|
+
gemini: { available: false, servers: [] },
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const codexServers = getCodexMcp();
|
|
100
|
+
if (codexServers !== null) {
|
|
101
|
+
inventory.codex.available = true;
|
|
102
|
+
inventory.codex.servers = codexServers;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const geminiServers = getGeminiMcp();
|
|
106
|
+
if (geminiServers !== null) {
|
|
107
|
+
inventory.gemini.available = true;
|
|
108
|
+
inventory.gemini.servers = geminiServers;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return inventory;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function writeInventoryCache(inventory = buildInventory()) {
|
|
115
|
+
if (!existsSync(CACHE_DIR)) mkdirSync(CACHE_DIR, { recursive: true });
|
|
116
|
+
writeFileSync(CACHE_FILE, JSON.stringify(inventory, null, 2));
|
|
117
|
+
return inventory;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function main() {
|
|
121
|
+
writeInventoryCache();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
125
|
+
main();
|
|
126
|
+
}
|
|
@@ -11,7 +11,16 @@ const PROJECT_ROOT = resolve(SCRIPT_DIR, "..");
|
|
|
11
11
|
function runBash(command) {
|
|
12
12
|
return spawnSync("bash", ["-lc", command], {
|
|
13
13
|
cwd: PROJECT_ROOT,
|
|
14
|
-
encoding: "utf8"
|
|
14
|
+
encoding: "utf8",
|
|
15
|
+
env: {
|
|
16
|
+
...process.env,
|
|
17
|
+
TFX_TEAM_NAME: '',
|
|
18
|
+
TFX_TEAM_TASK_ID: '',
|
|
19
|
+
TFX_TEAM_AGENT_NAME: '',
|
|
20
|
+
TFX_TEAM_LEAD_NAME: '',
|
|
21
|
+
TFX_HUB_URL: '',
|
|
22
|
+
TMUX: '',
|
|
23
|
+
}
|
|
15
24
|
});
|
|
16
25
|
}
|
|
17
26
|
|
|
@@ -46,4 +55,3 @@ test("TFX_NO_CLAUDE_NATIVE는 0/1 값만 허용한다", () => {
|
|
|
46
55
|
assert.notEqual(result.status, 0, out(result));
|
|
47
56
|
assert.match(out(result), /0 또는 1/, out(result));
|
|
48
57
|
});
|
|
49
|
-
|