@triflux/core 10.0.0-alpha.1
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 +109 -0
- package/hooks/cross-review-tracker.mjs +122 -0
- package/hooks/error-context.mjs +148 -0
- package/hooks/hook-manager.mjs +352 -0
- package/hooks/hook-orchestrator.mjs +312 -0
- package/hooks/hook-registry.json +213 -0
- package/hooks/hooks.json +89 -0
- package/hooks/keyword-rules.json +581 -0
- package/hooks/lib/resolve-root.mjs +59 -0
- package/hooks/mcp-config-watcher.mjs +85 -0
- package/hooks/pipeline-stop.mjs +76 -0
- package/hooks/safety-guard.mjs +106 -0
- package/hooks/subagent-verifier.mjs +80 -0
- package/hub/assign-callbacks.mjs +133 -0
- package/hub/bridge.mjs +799 -0
- package/hub/cli-adapter-base.mjs +192 -0
- package/hub/codex-adapter.mjs +190 -0
- package/hub/codex-compat.mjs +78 -0
- package/hub/codex-preflight.mjs +147 -0
- package/hub/delegator/contracts.mjs +37 -0
- package/hub/delegator/index.mjs +14 -0
- package/hub/delegator/schema/delegator-tools.schema.json +250 -0
- package/hub/delegator/service.mjs +307 -0
- package/hub/delegator/tool-definitions.mjs +35 -0
- package/hub/fullcycle.mjs +96 -0
- package/hub/gemini-adapter.mjs +179 -0
- package/hub/hitl.mjs +143 -0
- package/hub/intent.mjs +193 -0
- package/hub/lib/process-utils.mjs +361 -0
- package/hub/middleware/request-logger.mjs +81 -0
- package/hub/paths.mjs +30 -0
- package/hub/pipeline/gates/confidence.mjs +56 -0
- package/hub/pipeline/gates/consensus.mjs +94 -0
- package/hub/pipeline/gates/index.mjs +5 -0
- package/hub/pipeline/gates/selfcheck.mjs +82 -0
- package/hub/pipeline/index.mjs +318 -0
- package/hub/pipeline/state.mjs +191 -0
- package/hub/pipeline/transitions.mjs +124 -0
- package/hub/platform.mjs +225 -0
- package/hub/quality/deslop.mjs +253 -0
- package/hub/reflexion.mjs +372 -0
- package/hub/research.mjs +146 -0
- package/hub/router.mjs +791 -0
- package/hub/routing/complexity.mjs +166 -0
- package/hub/routing/index.mjs +117 -0
- package/hub/routing/q-learning.mjs +336 -0
- package/hub/session-fingerprint.mjs +352 -0
- package/hub/state.mjs +245 -0
- package/hub/team-bridge.mjs +25 -0
- package/hub/token-mode.mjs +224 -0
- package/hub/workers/worker-utils.mjs +104 -0
- package/hud/colors.mjs +88 -0
- package/hud/constants.mjs +81 -0
- package/hud/hud-qos-status.mjs +206 -0
- package/hud/providers/claude.mjs +309 -0
- package/hud/providers/codex.mjs +151 -0
- package/hud/providers/gemini.mjs +320 -0
- package/hud/renderers.mjs +424 -0
- package/hud/terminal.mjs +140 -0
- package/hud/utils.mjs +287 -0
- package/package.json +31 -0
- package/scripts/lib/claudemd-manager.mjs +325 -0
- package/scripts/lib/context.mjs +67 -0
- package/scripts/lib/cross-review-utils.mjs +51 -0
- package/scripts/lib/env-probe.mjs +241 -0
- package/scripts/lib/gemini-profiles.mjs +85 -0
- package/scripts/lib/hook-utils.mjs +14 -0
- package/scripts/lib/keyword-rules.mjs +166 -0
- package/scripts/lib/logger.mjs +105 -0
- package/scripts/lib/mcp-filter.mjs +739 -0
- package/scripts/lib/mcp-guard-engine.mjs +940 -0
- package/scripts/lib/mcp-manifest.mjs +79 -0
- package/scripts/lib/mcp-server-catalog.mjs +118 -0
- package/scripts/lib/psmux-info.mjs +119 -0
- package/scripts/lib/remote-spawn-transfer.mjs +196 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logify — triflux 구조화 로깅 설정
|
|
3
|
+
*
|
|
4
|
+
* 사용법:
|
|
5
|
+
* import { logger, createModuleLogger } from './lib/logger.mjs';
|
|
6
|
+
*
|
|
7
|
+
* // 기본 로거
|
|
8
|
+
* logger.info({ taskId: 'abc' }, 'task.started');
|
|
9
|
+
*
|
|
10
|
+
* // 모듈별 로거
|
|
11
|
+
* const log = createModuleLogger('hub');
|
|
12
|
+
* log.info({ port: 27888 }, 'server.started');
|
|
13
|
+
* log.error({ err }, 'server.error');
|
|
14
|
+
*
|
|
15
|
+
* 이벤트 네이밍: {도메인}.{액션} 형식
|
|
16
|
+
* hub.started, hub.stopped, route.started, route.completed,
|
|
17
|
+
* worker.spawned, worker.completed, worker.timeout,
|
|
18
|
+
* mcp.connected, mcp.disconnected, mcp.error,
|
|
19
|
+
* team.created, team.deleted, task.claimed, task.completed,
|
|
20
|
+
* pipe.connected, pipe.message, pipe.error,
|
|
21
|
+
* http.request, http.response, http.error
|
|
22
|
+
*
|
|
23
|
+
* 로그 레벨 가이드:
|
|
24
|
+
* debug — 개발/트러블슈팅용 (변수 값, MCP 메시지, 캐시 키)
|
|
25
|
+
* info — 정상 흐름 상태 변경 (서버 시작, 워커 완료, 팀 생성)
|
|
26
|
+
* warn — 위험 신호 (재시도 발생, 쿼타 임박, 느린 워커)
|
|
27
|
+
* error — 작업 실패 (CLI 실행 실패, MCP 연결 끊김)
|
|
28
|
+
* fatal — 프로세스 위협 (DB 연결 불가, 포트 충돌)
|
|
29
|
+
*/
|
|
30
|
+
import pino from 'pino';
|
|
31
|
+
|
|
32
|
+
const isDev = process.env.NODE_ENV !== 'production';
|
|
33
|
+
|
|
34
|
+
export const logger = pino({
|
|
35
|
+
level: process.env.LOG_LEVEL || (isDev ? 'debug' : 'info'),
|
|
36
|
+
|
|
37
|
+
// 모든 로그에 포함되는 기본 필드
|
|
38
|
+
base: {
|
|
39
|
+
service: process.env.SERVICE_NAME || 'triflux',
|
|
40
|
+
env: process.env.NODE_ENV || 'development',
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// 레벨을 대문자로 출력 (AI 파싱 용이)
|
|
44
|
+
formatters: {
|
|
45
|
+
level: (label) => ({ level: label.toUpperCase() }),
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
// ISO 8601 타임스탬프
|
|
49
|
+
timestamp: pino.stdTimeFunctions.isoTime,
|
|
50
|
+
|
|
51
|
+
// 민감정보 자동 필터링
|
|
52
|
+
redact: {
|
|
53
|
+
paths: [
|
|
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
|
+
],
|
|
67
|
+
remove: true,
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// 개발 환경: 컬러 콘솔 출력
|
|
71
|
+
transport: isDev
|
|
72
|
+
? {
|
|
73
|
+
target: 'pino-pretty',
|
|
74
|
+
options: {
|
|
75
|
+
colorize: true,
|
|
76
|
+
translateTime: 'yyyy-mm-dd HH:MM:ss',
|
|
77
|
+
ignore: 'pid,hostname',
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
: undefined,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 모듈별 Child Logger 생성.
|
|
85
|
+
* 모듈 이름이 모든 로그에 자동 포함된다.
|
|
86
|
+
*
|
|
87
|
+
* @param {string} module — 모듈 이름 (hub, route, worker, mcp, team 등)
|
|
88
|
+
* @returns {import('pino').Logger}
|
|
89
|
+
*/
|
|
90
|
+
export function createModuleLogger(module) {
|
|
91
|
+
return logger.child({ module });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 정상 종료 시 버퍼 flush 보장
|
|
95
|
+
process.on('uncaughtException', (err) => {
|
|
96
|
+
logger.fatal({ err }, 'process.uncaught_exception');
|
|
97
|
+
logger.flush();
|
|
98
|
+
process.exit(1);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
process.on('unhandledRejection', (reason) => {
|
|
102
|
+
logger.fatal({ reason: String(reason) }, 'process.unhandled_rejection');
|
|
103
|
+
logger.flush();
|
|
104
|
+
process.exit(1);
|
|
105
|
+
});
|