@triflux/core 10.51.0 → 10.53.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.
Files changed (61) hide show
  1. package/hub/bridge.mjs +69 -1197
  2. package/hub/cli-adapter-base.mjs +4 -104
  3. package/hub/codex-adapter.mjs +7 -116
  4. package/hub/index.mjs +3 -20
  5. package/hub/lib/process-utils.mjs +1 -33
  6. package/hub/team/claude-daemon-control.mjs +1 -2
  7. package/hub/team/claude-session-projection.mjs +5 -73
  8. package/hub/team/claude-transcript.mjs +19 -0
  9. package/hub/team/nativeProxy.mjs +759 -0
  10. package/hub/team/session-context.mjs +1 -1
  11. package/hud/constants.mjs +9 -22
  12. package/hud/hud-qos-status.mjs +16 -19
  13. package/hud/providers/codex-probe.mjs +2 -31
  14. package/hud/providers/codex.mjs +16 -58
  15. package/hud/providers/gemini.mjs +20 -0
  16. package/hud/renderers.mjs +101 -77
  17. package/hud/utils.mjs +9 -13
  18. package/package.json +3 -6
  19. package/scripts/lib/agent-route-policy.mjs +0 -67
  20. package/scripts/lib/cli-claude.mjs +0 -12
  21. package/scripts/lib/env-probe.mjs +0 -70
  22. package/scripts/lib/legacy-mcp-cleanup.mjs +283 -0
  23. package/scripts/lib/mcp-guard-engine.mjs +42 -101
  24. package/scripts/lib/session-presence.mjs +1 -99
  25. package/hub/account-broker.mjs +0 -1221
  26. package/hub/adaptive-diagnostic.mjs +0 -350
  27. package/hub/adaptive-inject.mjs +0 -224
  28. package/hub/adaptive-memory.mjs +0 -277
  29. package/hub/adaptive.mjs +0 -172
  30. package/hub/assign-callbacks.mjs +0 -170
  31. package/hub/delegator/contracts.mjs +0 -38
  32. package/hub/delegator/index.mjs +0 -14
  33. package/hub/delegator/schema/delegator-tools.schema.json +0 -250
  34. package/hub/delegator/service.mjs +0 -336
  35. package/hub/delegator/tool-definitions.mjs +0 -35
  36. package/hub/hitl.mjs +0 -202
  37. package/hub/lib/known-errors.json +0 -72
  38. package/hub/lib/memory-store.mjs +0 -1001
  39. package/hub/lib/phase-manager.mjs +0 -493
  40. package/hub/lib/state-snapshot.mjs +0 -293
  41. package/hub/lib/trace-recorder.mjs +0 -153
  42. package/hub/lib/uuidv7.mjs +0 -45
  43. package/hub/memory-doctor.mjs +0 -640
  44. package/hub/middleware/quota-middleware.mjs +0 -70
  45. package/hub/middleware/request-logger.mjs +0 -191
  46. package/hub/paths.mjs +0 -24
  47. package/hub/pipeline/index.mjs +0 -163
  48. package/hub/pipeline/state.mjs +0 -191
  49. package/hub/pipeline/transitions.mjs +0 -131
  50. package/hub/reflexion.mjs +0 -290
  51. package/hub/role-contract.mjs +0 -312
  52. package/hub/router.mjs +0 -2026
  53. package/hub/session-fingerprint.mjs +0 -418
  54. package/hub/state.mjs +0 -300
  55. package/hub/team/synapse-http.mjs +0 -311
  56. package/hub/team-bridge.mjs +0 -27
  57. package/scripts/lib/claudemd-scanner.mjs +0 -26
  58. package/scripts/lib/context.mjs +0 -51
  59. package/scripts/lib/handoff.mjs +0 -187
  60. package/scripts/lib/logger.mjs +0 -122
  61. package/scripts/lib/stealth-fetch.mjs +0 -176
package/hub/hitl.mjs DELETED
@@ -1,202 +0,0 @@
1
- // hub/hitl.mjs — Human-in-the-Loop 매니저
2
- // 사용자 입력 요청/응답, 타임아웃 자동 처리
3
-
4
- /**
5
- * HITL 매니저 생성
6
- * @param {object} store — createStore() 반환 객체
7
- * @param {object} router — createRouter() 반환 객체
8
- */
9
- export function createHitlManager(store, router = null) {
10
- function forwardHumanResponse({
11
- requesterAgent,
12
- requestId,
13
- action,
14
- content,
15
- submittedBy,
16
- correlationId,
17
- traceId,
18
- priority,
19
- }) {
20
- if (!router?.handlePublish) {
21
- throw new Error("router.handlePublish is required for HITL forwarding");
22
- }
23
- return router.handlePublish({
24
- from: "hub:hitl",
25
- to: requesterAgent,
26
- topic: "human.response",
27
- priority,
28
- ttl_ms: 300000,
29
- payload: {
30
- request_id: requestId,
31
- action,
32
- content,
33
- submitted_by: submittedBy,
34
- },
35
- correlation_id: correlationId,
36
- trace_id: traceId,
37
- message_type: "human_response",
38
- });
39
- }
40
-
41
- return {
42
- /**
43
- * 사용자에게 입력 요청 생성
44
- * 터미널에 알림 출력 후 pending 상태로 저장
45
- */
46
- requestHumanInput({
47
- requester_agent,
48
- kind,
49
- prompt,
50
- requested_schema = {},
51
- deadline_ms,
52
- default_action,
53
- channel_preference = "terminal",
54
- correlation_id,
55
- trace_id,
56
- }) {
57
- const result = store.insertHumanRequest({
58
- requester_agent,
59
- kind,
60
- prompt,
61
- requested_schema,
62
- deadline_ms,
63
- default_action,
64
- correlation_id,
65
- trace_id,
66
- });
67
-
68
- // 터미널 알림 (stderr — stdout은 MCP 용)
69
- const kindLabel = {
70
- captcha: "CAPTCHA",
71
- approval: "승인",
72
- credential: "자격증명",
73
- choice: "선택",
74
- text: "텍스트",
75
- };
76
- process.stderr.write(
77
- `\n[tfx-hub] 사용자 입력 요청 (${kindLabel[kind] || kind})\n` +
78
- ` 요청자: ${requester_agent}\n` +
79
- ` 내용: ${prompt}\n` +
80
- ` ID: ${result.request_id}\n` +
81
- ` 제한: ${Math.round(deadline_ms / 1000)}초\n\n`,
82
- );
83
-
84
- return { ok: true, data: result };
85
- },
86
-
87
- /**
88
- * 사용자 입력 응답 제출
89
- * 유효성 검증 → 상태 업데이트 → 요청자에게 응답 메시지 전달
90
- */
91
- submitHumanInput({
92
- request_id,
93
- action,
94
- content = null,
95
- submitted_by = "human",
96
- }) {
97
- // 요청 조회
98
- const hr = store.getHumanRequest(request_id);
99
- if (!hr) {
100
- return {
101
- ok: false,
102
- error: { code: "NOT_FOUND", message: `요청 없음: ${request_id}` },
103
- };
104
- }
105
- if (hr.state !== "pending") {
106
- return {
107
- ok: false,
108
- error: {
109
- code: "ALREADY_HANDLED",
110
- message: `이미 처리됨: ${hr.state}`,
111
- },
112
- };
113
- }
114
-
115
- // 상태 매핑
116
- const stateMap = {
117
- accept: "accepted",
118
- decline: "declined",
119
- cancel: "cancelled",
120
- };
121
- const newState = stateMap[action];
122
- if (!newState) {
123
- return {
124
- ok: false,
125
- error: {
126
- code: "INVALID_ACTION",
127
- message: `잘못된 action: ${action}`,
128
- },
129
- };
130
- }
131
-
132
- // DB 업데이트
133
- store.updateHumanRequest(request_id, newState, content);
134
-
135
- // 요청자에게 응답 메시지 전달
136
- let forwardedMessageId = null;
137
- if (action === "accept" || action === "decline") {
138
- const published = forwardHumanResponse({
139
- requesterAgent: hr.requester_agent,
140
- requestId: request_id,
141
- action,
142
- content,
143
- submittedBy: submitted_by,
144
- correlationId: hr.correlation_id,
145
- traceId: hr.trace_id,
146
- priority: 7,
147
- });
148
- forwardedMessageId = published.data?.message_id || null;
149
- }
150
-
151
- return {
152
- ok: true,
153
- data: {
154
- request_id,
155
- new_state: newState,
156
- forwarded_message_id: forwardedMessageId,
157
- },
158
- };
159
- },
160
-
161
- /**
162
- * 만료된 요청 자동 처리
163
- * deadline 초과 시 default_action 적용
164
- */
165
- checkTimeouts() {
166
- const pending = store.getPendingHumanRequests();
167
- const now = Date.now();
168
- const expired = pending.filter((hr) => hr.deadline_ms <= now);
169
- if (!expired.length) return 0;
170
-
171
- const expireRequests = () => {
172
- for (const hr of expired) {
173
- store.updateHumanRequest(hr.request_id, "timed_out", null);
174
- if (hr.default_action === "timeout_continue") {
175
- forwardHumanResponse({
176
- requesterAgent: hr.requester_agent,
177
- requestId: hr.request_id,
178
- action: "timeout_continue",
179
- content: null,
180
- submittedBy: "system",
181
- correlationId: hr.correlation_id,
182
- traceId: hr.trace_id,
183
- priority: 5,
184
- });
185
- }
186
- }
187
- return expired.length;
188
- };
189
-
190
- const processExpired = store.db?.transaction
191
- ? store.db.transaction(expireRequests)
192
- : expireRequests;
193
-
194
- return processExpired();
195
- },
196
-
197
- /** 대기 중인 요청 목록 */
198
- getPendingRequests() {
199
- return store.getPendingHumanRequests();
200
- },
201
- };
202
- }
@@ -1,72 +0,0 @@
1
- {
2
- "$schema": "Neural Memory 에러 시그니처 시드 — 자동 학습 전 수동 등록 패턴",
3
- "version": 1,
4
- "signatures": {
5
- "ssh-powershell-devnull": {
6
- "pattern": "Could not find a part of the path.*dev.null",
7
- "tool": "Bash",
8
- "context": "SSH 명령 실행",
9
- "root_cause": "원격 호스트가 PowerShell인데 bash 문법(2>/dev/null)을 사용",
10
- "dna_factor": "remote.os",
11
- "rule_template": "원격 호스트 {host}는 PowerShell 기본 셸. 2>/dev/null 대신 2>$null, && 대신 ;, $(cmd) 대신 $(cmd) PowerShell 구문 사용.",
12
- "fix": "PowerShell 호스트에서는 2>/dev/null 대신 2>$null 사용",
13
- "confidence_base": 0.95,
14
- "severity": "high"
15
- },
16
- "ssh-powershell-ampamp": {
17
- "pattern": "The token '&&' is not a valid statement separator",
18
- "tool": "Bash",
19
- "context": "SSH 명령 실행",
20
- "root_cause": "원격 호스트가 PowerShell인데 bash의 && 연결자를 사용",
21
- "dna_factor": "remote.os",
22
- "rule_template": "원격 호스트 {host}는 PowerShell 기본 셸. && 대신 ; 사용.",
23
- "fix": "PowerShell 호스트에서는 && 대신 ; 사용",
24
- "confidence_base": 0.95,
25
- "severity": "high"
26
- },
27
- "codex-sandbox-duplicate": {
28
- "pattern": "cannot be used multiple times",
29
- "tool": "Bash",
30
- "context": "codex exec 실행",
31
- "root_cause": "config.toml sandbox 설정과 CLI 플래그(--full-auto) 중복",
32
- "dna_factor": "cli.codex.config.sandbox",
33
- "rule_template": "Codex config.toml에 sandbox=\"{value}\" 설정이 있으므로 CLI에서 --full-auto 플래그 사용 금지",
34
- "fix": "config.toml에 기본값을 두고, CLI에서는 --profile만 선택",
35
- "confidence_base": 0.95,
36
- "severity": "critical"
37
- },
38
- "codex-exec-approval-stall": {
39
- "pattern": "Reading additional input from stdin",
40
- "tool": "Bash",
41
- "context": "codex exec 비대화형 실행",
42
- "root_cause": "codex exec이 config.toml approval_mode를 무시하여 무한 대기",
43
- "dna_factor": null,
44
- "rule_template": "codex exec은 config.toml approval_mode를 무시함. 반드시 --dangerously-bypass-approvals-and-sandbox 명시적 추가 필수",
45
- "fix": "codex exec 호출 시 항상 --dangerously-bypass-approvals-and-sandbox 플래그 포함",
46
- "confidence_base": 1.0,
47
- "severity": "critical"
48
- },
49
- "ssh-stdin-hang": {
50
- "pattern": "Reading additional input from stdin|Pseudo-terminal will not be allocated",
51
- "tool": "Bash",
52
- "context": "SSH 원격 CLI 실행",
53
- "root_cause": "SSH 세션에서 stdin이 리다이렉트되지 않음",
54
- "dna_factor": null,
55
- "rule_template": "SSH 원격 실행 시 ssh -n 또는 stdin: 'ignore' 옵션으로 stdin 리다이렉트 필수",
56
- "fix": "execFileSync('ssh', [...], { stdio: ['ignore', 'pipe', 'pipe'] })",
57
- "confidence_base": 0.9,
58
- "severity": "high"
59
- },
60
- "psmux-node-not-found": {
61
- "pattern": "node: not found|node: command not found",
62
- "tool": "Bash",
63
- "context": "psmux 세션에서 node 실행",
64
- "root_cause": "psmux 세션이 PowerShell 7인데 bash 경로의 node를 참조",
65
- "dna_factor": "multiplexer.name",
66
- "rule_template": "psmux pane은 PowerShell 7 환경. bash PATH의 node 경로가 아닌 PowerShell PATH를 사용해야 함. wrapCliForBash 래핑 금지.",
67
- "fix": "PowerShell 네이티브 명령 사용, bash 래핑 금지",
68
- "confidence_base": 0.9,
69
- "severity": "high"
70
- }
71
- }
72
- }