@triflux/core 10.1.0 → 10.26.0
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/hooks/agent-route-guard.mjs +14 -10
- package/hooks/cross-review-tracker.mjs +21 -8
- package/hooks/error-context.mjs +20 -8
- package/hooks/hook-adaptive-collector.mjs +18 -16
- package/hooks/hook-manager.mjs +93 -32
- package/hooks/hook-orchestrator.mjs +267 -35
- package/hooks/hook-registry.json +343 -256
- package/hooks/hooks.json +49 -1
- package/hooks/keyword-rules.json +191 -31
- package/hooks/lib/resolve-root.mjs +1 -1
- package/hooks/mcp-config-watcher.mjs +6 -2
- package/hooks/permission-safe-allow.mjs +233 -0
- package/hooks/pipeline-stop.mjs +369 -22
- package/hooks/post-tool-tips.mjs +306 -0
- package/hooks/pre-compact-snapshot.mjs +181 -0
- package/hooks/safety-guard.mjs +262 -34
- package/hooks/session-end-cleanup.mjs +345 -0
- package/hooks/session-start-fast.mjs +214 -0
- package/hooks/subagent-tracker.mjs +267 -0
- package/hooks/subagent-verifier.mjs +9 -4
- package/hub/account-broker.mjs +1036 -66
- package/hub/adaptive-diagnostic.mjs +75 -48
- package/hub/adaptive-inject.mjs +96 -58
- package/hub/adaptive-memory.mjs +156 -42
- package/hub/adaptive.mjs +60 -31
- package/hub/assign-callbacks.mjs +163 -126
- package/hub/bridge.mjs +1051 -290
- package/hub/cli-adapter-base.mjs +321 -97
- package/hub/codex-adapter.mjs +179 -93
- package/hub/codex-compat.mjs +4 -4
- package/hub/codex-preflight.mjs +113 -37
- package/hub/delegator/contracts.mjs +22 -21
- package/hub/delegator/index.mjs +14 -14
- package/hub/delegator/schema/delegator-tools.schema.json +1 -1
- package/hub/delegator/service.mjs +93 -64
- package/hub/delegator/tool-definitions.mjs +35 -35
- package/hub/dynamic-routing-engine.mjs +511 -0
- package/hub/fullcycle.mjs +34 -18
- package/hub/gemini-adapter.mjs +82 -108
- package/hub/hitl.mjs +202 -143
- package/hub/intent.mjs +167 -38
- package/hub/lib/bash-path.mjs +73 -0
- package/hub/lib/cache-guard.mjs +43 -17
- package/hub/lib/env-detect.mjs +145 -0
- package/hub/lib/hosts-compat.mjs +319 -0
- package/hub/lib/mcp-response-cache.mjs +239 -0
- package/hub/lib/memory-store.mjs +285 -111
- package/hub/lib/path-utils.mjs +165 -0
- package/hub/lib/phase-manager.mjs +493 -0
- package/hub/lib/process-utils.mjs +797 -104
- package/hub/lib/prompt-tmp.mjs +33 -0
- package/hub/lib/risk-tier.mjs +53 -0
- package/hub/lib/spawn-trace.mjs +561 -0
- package/hub/lib/ssh-command.mjs +44 -24
- package/hub/lib/ssh-retry.mjs +5 -1
- package/hub/lib/staged-file-detect.mjs +43 -0
- package/hub/lib/state-snapshot.mjs +293 -0
- package/hub/lib/tfx-route-args.mjs +309 -0
- package/hub/lib/timeline-adapter.mjs +190 -0
- package/hub/lib/trace-recorder.mjs +153 -0
- package/hub/lib/uuidv7.mjs +4 -3
- package/hub/memory-doctor.mjs +266 -106
- package/hub/middleware/quota-middleware.mjs +70 -0
- package/hub/middleware/request-logger.mjs +61 -34
- package/hub/paths.mjs +9 -9
- package/hub/pipeline/gates/confidence.mjs +34 -15
- package/hub/pipeline/gates/consensus.mjs +27 -15
- package/hub/pipeline/gates/index.mjs +7 -3
- package/hub/pipeline/gates/selfcheck.mjs +57 -19
- package/hub/pipeline/index.mjs +77 -42
- package/hub/pipeline/state.mjs +10 -10
- package/hub/pipeline/transitions.mjs +40 -23
- package/hub/platform.mjs +65 -48
- package/hub/quality/deslop.mjs +70 -49
- package/hub/reflexion.mjs +87 -13
- package/hub/research.mjs +33 -25
- package/hub/router.mjs +941 -791
- package/hub/routing/complexity.mjs +132 -29
- package/hub/routing/index.mjs +17 -12
- package/hub/routing/q-learning.mjs +78 -30
- package/hub/routing-snapshot.mjs +261 -0
- package/hub/session-fingerprint.mjs +127 -61
- package/hub/state.mjs +86 -44
- package/hub/team/claude-daemon-control.mjs +1130 -0
- package/hub/team/retry-state-machine.mjs +336 -0
- package/hub/token-mode.mjs +72 -71
- package/hub/workers/worker-utils.mjs +23 -17
- package/hud/colors.mjs +27 -9
- package/hud/constants.mjs +190 -27
- package/hud/context-monitor.mjs +133 -44
- package/hud/hud-qos-status.mjs +157 -50
- package/hud/mission-board.mjs +56 -0
- package/hud/providers/claude.mjs +398 -114
- package/hud/providers/codex.mjs +96 -21
- package/hud/providers/gemini.mjs +210 -52
- package/hud/renderers.mjs +440 -127
- package/hud/terminal.mjs +101 -31
- package/hud/utils.mjs +81 -39
- package/mesh/index.mjs +69 -0
- package/mesh/mesh-budget.mjs +137 -0
- package/mesh/mesh-heartbeat.mjs +100 -0
- package/mesh/mesh-protocol.mjs +96 -0
- package/mesh/mesh-queue.mjs +163 -0
- package/mesh/mesh-registry.mjs +78 -0
- package/mesh/mesh-router.mjs +77 -0
- package/package.json +5 -1
- package/scripts/lib/agent-json.mjs +27 -0
- package/scripts/lib/async.mjs +174 -0
- package/scripts/lib/claudemd-scanner.mjs +6 -1
- package/scripts/lib/cli-agy.mjs +62 -0
- package/scripts/lib/cli-claude.mjs +78 -0
- package/scripts/lib/cli-codex.mjs +199 -0
- package/scripts/lib/cli-gemini.mjs +37 -0
- package/scripts/lib/codex-recovery.sh +50 -0
- package/scripts/lib/context.mjs +3 -3
- package/scripts/lib/cross-review-utils.mjs +13 -5
- package/scripts/lib/doctor-env-checks.mjs +121 -0
- package/scripts/lib/dynamic-route-cli.mjs +107 -0
- package/scripts/lib/env-probe.mjs +58 -30
- package/scripts/lib/env.mjs +14 -0
- package/scripts/lib/gemini-profiles.mjs +44 -10
- package/scripts/lib/handoff.mjs +33 -17
- package/scripts/lib/hook-utils.mjs +8 -6
- package/scripts/lib/hub.mjs +48 -0
- package/scripts/lib/keyword-rules.mjs +49 -20
- package/scripts/lib/logger.mjs +24 -24
- package/scripts/lib/mcp-filter.mjs +391 -247
- package/scripts/lib/mcp-gateway-health-check.mjs +159 -0
- package/scripts/lib/mcp-gateway-servers.mjs +70 -0
- package/scripts/lib/mcp-gateway-wrapper-check.mjs +35 -0
- package/scripts/lib/mcp-guard-engine.mjs +1281 -115
- package/scripts/lib/mcp-health.mjs +773 -0
- package/scripts/lib/mcp-manifest.mjs +24 -14
- package/scripts/lib/mcp-server-catalog.mjs +355 -118
- package/scripts/lib/pid.mjs +63 -0
- package/scripts/lib/process-utils.mjs +26 -0
- package/scripts/lib/psmux-info.mjs +117 -12
- package/scripts/lib/quota.mjs +47 -0
- package/scripts/lib/remote-spawn-transfer.mjs +44 -14
- package/scripts/lib/skill-state.mjs +220 -0
- package/scripts/lib/skill-template.mjs +32 -7
- package/scripts/lib/team.mjs +75 -0
- package/scripts/lib/timeout.mjs +66 -0
- package/scripts/lib/tmp.mjs +26 -0
- package/scripts/lib/toml.mjs +113 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
|
|
3
|
-
const VALID_MCP_ROUTES = new Set(["codex", "gemini", "claude"]);
|
|
3
|
+
const VALID_MCP_ROUTES = new Set(["codex", "antigravity", "gemini", "claude"]);
|
|
4
4
|
|
|
5
5
|
function logRuleError(message, error) {
|
|
6
6
|
if (error) {
|
|
@@ -28,21 +28,34 @@ function normalizeRule(rule) {
|
|
|
28
28
|
if (!rule || typeof rule !== "object") return null;
|
|
29
29
|
if (typeof rule.id !== "string" || !rule.id.trim()) return null;
|
|
30
30
|
if (!Array.isArray(rule.patterns) || rule.patterns.length === 0) return null;
|
|
31
|
-
if (typeof rule.priority !== "number" || !Number.isFinite(rule.priority))
|
|
31
|
+
if (typeof rule.priority !== "number" || !Number.isFinite(rule.priority))
|
|
32
|
+
return null;
|
|
32
33
|
|
|
33
34
|
const patterns = rule.patterns.map(normalizePattern).filter(Boolean);
|
|
34
35
|
if (patterns.length === 0) return null;
|
|
35
36
|
|
|
36
|
-
const skill =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const skill =
|
|
38
|
+
typeof rule.skill === "string" && rule.skill.trim()
|
|
39
|
+
? rule.skill.trim()
|
|
40
|
+
: null;
|
|
41
|
+
const action =
|
|
42
|
+
typeof rule.action === "string" && rule.action.trim()
|
|
43
|
+
? rule.action.trim()
|
|
44
|
+
: null;
|
|
45
|
+
const mcpRoute =
|
|
46
|
+
typeof rule.mcp_route === "string" && VALID_MCP_ROUTES.has(rule.mcp_route)
|
|
47
|
+
? rule.mcp_route
|
|
48
|
+
: null;
|
|
41
49
|
|
|
42
50
|
if (!skill && !mcpRoute && !action) return null;
|
|
43
51
|
|
|
52
|
+
const hint =
|
|
53
|
+
typeof rule.hint === "string" && rule.hint.trim() ? rule.hint.trim() : null;
|
|
54
|
+
|
|
44
55
|
const supersedes = Array.isArray(rule.supersedes)
|
|
45
|
-
? rule.supersedes
|
|
56
|
+
? rule.supersedes
|
|
57
|
+
.filter((id) => typeof id === "string" && id.trim())
|
|
58
|
+
.map((id) => id.trim())
|
|
46
59
|
: [];
|
|
47
60
|
|
|
48
61
|
const state = normalizeState(rule.state);
|
|
@@ -53,11 +66,12 @@ function normalizeRule(rule) {
|
|
|
53
66
|
patterns,
|
|
54
67
|
skill,
|
|
55
68
|
action,
|
|
69
|
+
hint,
|
|
56
70
|
priority: rule.priority,
|
|
57
71
|
supersedes,
|
|
58
72
|
exclusive: rule.exclusive === true,
|
|
59
73
|
state,
|
|
60
|
-
mcp_route: mcpRoute
|
|
74
|
+
mcp_route: mcpRoute,
|
|
61
75
|
};
|
|
62
76
|
}
|
|
63
77
|
|
|
@@ -81,26 +95,40 @@ export function loadRules(rulesPath) {
|
|
|
81
95
|
|
|
82
96
|
// pattern.source / flags를 RegExp로 컴파일
|
|
83
97
|
export function compileRules(rules) {
|
|
84
|
-
return rules
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
return rules
|
|
99
|
+
.map((rule) => {
|
|
100
|
+
try {
|
|
101
|
+
return {
|
|
102
|
+
...rule,
|
|
103
|
+
compiledPatterns: rule.patterns.map(
|
|
104
|
+
(p) => new RegExp(p.source, p.flags),
|
|
105
|
+
),
|
|
106
|
+
};
|
|
107
|
+
} catch (error) {
|
|
108
|
+
logRuleError(`정규식 컴파일 실패: ${rule.id}`, error);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
.filter(Boolean);
|
|
92
113
|
}
|
|
93
114
|
|
|
94
115
|
// 입력 텍스트에서 매칭된 규칙 목록 반환
|
|
95
116
|
export function matchRules(compiledRules, cleanText) {
|
|
96
|
-
if (
|
|
117
|
+
if (
|
|
118
|
+
!Array.isArray(compiledRules) ||
|
|
119
|
+
typeof cleanText !== "string" ||
|
|
120
|
+
!cleanText
|
|
121
|
+
) {
|
|
97
122
|
return [];
|
|
98
123
|
}
|
|
99
124
|
|
|
100
125
|
const matches = [];
|
|
101
126
|
|
|
102
127
|
for (const rule of compiledRules) {
|
|
103
|
-
if (
|
|
128
|
+
if (
|
|
129
|
+
!Array.isArray(rule.compiledPatterns) ||
|
|
130
|
+
rule.compiledPatterns.length === 0
|
|
131
|
+
) {
|
|
104
132
|
continue;
|
|
105
133
|
}
|
|
106
134
|
|
|
@@ -115,11 +143,12 @@ export function matchRules(compiledRules, cleanText) {
|
|
|
115
143
|
id: rule.id,
|
|
116
144
|
skill: rule.skill,
|
|
117
145
|
action: rule.action,
|
|
146
|
+
hint: rule.hint || null,
|
|
118
147
|
priority: rule.priority,
|
|
119
148
|
supersedes: rule.supersedes || [],
|
|
120
149
|
exclusive: rule.exclusive === true,
|
|
121
150
|
state: rule.state || null,
|
|
122
|
-
mcp_route: rule.mcp_route || null
|
|
151
|
+
mcp_route: rule.mcp_route || null,
|
|
123
152
|
});
|
|
124
153
|
}
|
|
125
154
|
|
package/scripts/lib/logger.mjs
CHANGED
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
* error — 작업 실패 (CLI 실행 실패, MCP 연결 끊김)
|
|
28
28
|
* fatal — 프로세스 위협 (DB 연결 불가, 포트 충돌)
|
|
29
29
|
*/
|
|
30
|
-
import pino from
|
|
30
|
+
import pino from "pino";
|
|
31
31
|
|
|
32
|
-
const isDev = process.env.NODE_ENV !==
|
|
32
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
33
33
|
|
|
34
34
|
export const logger = pino({
|
|
35
|
-
level: process.env.LOG_LEVEL || (isDev ?
|
|
35
|
+
level: process.env.LOG_LEVEL || (isDev ? "debug" : "info"),
|
|
36
36
|
|
|
37
37
|
// 모든 로그에 포함되는 기본 필드
|
|
38
38
|
base: {
|
|
39
|
-
service: process.env.SERVICE_NAME ||
|
|
40
|
-
env: process.env.NODE_ENV ||
|
|
39
|
+
service: process.env.SERVICE_NAME || "triflux",
|
|
40
|
+
env: process.env.NODE_ENV || "development",
|
|
41
41
|
},
|
|
42
42
|
|
|
43
43
|
// 레벨을 대문자로 출력 (AI 파싱 용이)
|
|
@@ -51,18 +51,18 @@ export const logger = pino({
|
|
|
51
51
|
// 민감정보 자동 필터링
|
|
52
52
|
redact: {
|
|
53
53
|
paths: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
"password",
|
|
55
|
+
"token",
|
|
56
|
+
"apiKey",
|
|
57
|
+
"secret",
|
|
58
|
+
"authorization",
|
|
59
|
+
"*.password",
|
|
60
|
+
"*.token",
|
|
61
|
+
"*.apiKey",
|
|
62
|
+
"*.secret",
|
|
63
|
+
"req.headers.authorization",
|
|
64
|
+
"req.headers.cookie",
|
|
65
|
+
"hubToken",
|
|
66
66
|
],
|
|
67
67
|
remove: true,
|
|
68
68
|
},
|
|
@@ -70,11 +70,11 @@ export const logger = pino({
|
|
|
70
70
|
// 개발 환경: 컬러 콘솔 출력
|
|
71
71
|
transport: isDev
|
|
72
72
|
? {
|
|
73
|
-
target:
|
|
73
|
+
target: "pino-pretty",
|
|
74
74
|
options: {
|
|
75
75
|
colorize: true,
|
|
76
|
-
translateTime:
|
|
77
|
-
ignore:
|
|
76
|
+
translateTime: "yyyy-mm-dd HH:MM:ss",
|
|
77
|
+
ignore: "pid,hostname",
|
|
78
78
|
},
|
|
79
79
|
}
|
|
80
80
|
: undefined,
|
|
@@ -92,14 +92,14 @@ export function createModuleLogger(module) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// 정상 종료 시 버퍼 flush 보장
|
|
95
|
-
process.on(
|
|
96
|
-
logger.fatal({ err },
|
|
95
|
+
process.on("uncaughtException", (err) => {
|
|
96
|
+
logger.fatal({ err }, "process.uncaught_exception");
|
|
97
97
|
logger.flush();
|
|
98
98
|
process.exit(1);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
process.on(
|
|
102
|
-
logger.fatal({ reason: String(reason) },
|
|
101
|
+
process.on("unhandledRejection", (reason) => {
|
|
102
|
+
logger.fatal({ reason: String(reason) }, "process.unhandled_rejection");
|
|
103
103
|
logger.flush();
|
|
104
104
|
process.exit(1);
|
|
105
105
|
});
|