@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
package/hub/assign-callbacks.mjs
CHANGED
|
@@ -1,133 +1,170 @@
|
|
|
1
|
-
// hub/assign-callbacks.mjs — assign job 상태 변경용 Named Pipe/Unix socket 브로드캐스터
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { IS_WINDOWS, pipePath } from
|
|
1
|
+
// hub/assign-callbacks.mjs — assign job 상태 변경용 Named Pipe/Unix socket 브로드캐스터
|
|
2
|
+
|
|
3
|
+
import { existsSync, unlinkSync } from "node:fs";
|
|
4
|
+
import net from "node:net";
|
|
5
|
+
import { IS_WINDOWS, pipePath } from "./platform.mjs";
|
|
6
6
|
|
|
7
7
|
export function getAssignCallbackPipePath(sessionId = process.pid) {
|
|
8
|
-
return pipePath(
|
|
8
|
+
return pipePath("triflux-assign-callback", sessionId);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
function buildAssignCallbackEvent(event = {}, row = null) {
|
|
12
|
-
const source = row || event || {};
|
|
13
|
-
const updatedAtMs = Number(source.updated_at_ms);
|
|
14
|
-
const createdAtMs = Number(source.created_at_ms);
|
|
15
|
-
const timestampMs = Number.isFinite(updatedAtMs)
|
|
16
|
-
? updatedAtMs
|
|
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
|
-
|
|
10
|
+
|
|
11
|
+
function buildAssignCallbackEvent(event = {}, row = null) {
|
|
12
|
+
const source = row || event || {};
|
|
13
|
+
const updatedAtMs = Number(source.updated_at_ms);
|
|
14
|
+
const createdAtMs = Number(source.created_at_ms);
|
|
15
|
+
const timestampMs = Number.isFinite(updatedAtMs)
|
|
16
|
+
? updatedAtMs
|
|
17
|
+
: Number.isFinite(createdAtMs)
|
|
18
|
+
? createdAtMs
|
|
19
|
+
: Date.now();
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
event: "assign_job_status",
|
|
23
|
+
job_id: source.job_id || event.job_id || null,
|
|
24
|
+
supervisor_agent: source.supervisor_agent || null,
|
|
25
|
+
worker_agent: source.worker_agent || null,
|
|
26
|
+
topic: source.topic || null,
|
|
27
|
+
task: source.task || null,
|
|
28
|
+
status: source.status || event.status || null,
|
|
29
|
+
attempt: Number.isFinite(Number(source.attempt))
|
|
30
|
+
? Number(source.attempt)
|
|
31
|
+
: null,
|
|
32
|
+
retry_count: Number.isFinite(Number(source.retry_count))
|
|
33
|
+
? Number(source.retry_count)
|
|
34
|
+
: null,
|
|
35
|
+
max_retries: Number.isFinite(Number(source.max_retries))
|
|
36
|
+
? Number(source.max_retries)
|
|
37
|
+
: null,
|
|
38
|
+
priority: Number.isFinite(Number(source.priority))
|
|
39
|
+
? Number(source.priority)
|
|
40
|
+
: null,
|
|
41
|
+
ttl_ms: Number.isFinite(Number(source.ttl_ms))
|
|
42
|
+
? Number(source.ttl_ms)
|
|
43
|
+
: null,
|
|
44
|
+
timeout_ms: Number.isFinite(Number(source.timeout_ms))
|
|
45
|
+
? Number(source.timeout_ms)
|
|
46
|
+
: null,
|
|
47
|
+
deadline_ms: Number.isFinite(Number(source.deadline_ms))
|
|
48
|
+
? Number(source.deadline_ms)
|
|
49
|
+
: null,
|
|
50
|
+
trace_id: source.trace_id || null,
|
|
51
|
+
correlation_id: source.correlation_id || null,
|
|
52
|
+
last_message_id: source.last_message_id || null,
|
|
53
|
+
result: Object.hasOwn(source, "result")
|
|
54
|
+
? source.result
|
|
55
|
+
: Object.hasOwn(event, "result")
|
|
56
|
+
? event.result
|
|
57
|
+
: null,
|
|
58
|
+
error: Object.hasOwn(source, "error")
|
|
59
|
+
? source.error
|
|
60
|
+
: Object.hasOwn(event, "error")
|
|
61
|
+
? event.error
|
|
62
|
+
: null,
|
|
63
|
+
created_at_ms: Number.isFinite(createdAtMs) ? createdAtMs : null,
|
|
64
|
+
updated_at_ms: Number.isFinite(updatedAtMs) ? updatedAtMs : null,
|
|
65
|
+
started_at_ms: Number.isFinite(Number(source.started_at_ms))
|
|
66
|
+
? Number(source.started_at_ms)
|
|
67
|
+
: null,
|
|
68
|
+
completed_at_ms: Number.isFinite(Number(source.completed_at_ms))
|
|
69
|
+
? Number(source.completed_at_ms)
|
|
70
|
+
: null,
|
|
71
|
+
last_retry_at_ms: Number.isFinite(Number(source.last_retry_at_ms))
|
|
72
|
+
? Number(source.last_retry_at_ms)
|
|
73
|
+
: null,
|
|
74
|
+
timestamp: new Date(timestampMs).toISOString(),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function createAssignCallbackServer({
|
|
79
|
+
store = null,
|
|
80
|
+
sessionId = process.pid,
|
|
81
|
+
} = {}) {
|
|
82
|
+
const pipePath = getAssignCallbackPipePath(sessionId);
|
|
83
|
+
const clients = new Set();
|
|
84
|
+
let server = null;
|
|
85
|
+
let detachStoreListener = null;
|
|
86
|
+
|
|
87
|
+
function removeSocket(socket) {
|
|
88
|
+
if (!socket) return;
|
|
89
|
+
clients.delete(socket);
|
|
90
|
+
try {
|
|
91
|
+
socket.destroy();
|
|
92
|
+
} catch {}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function broadcast(event) {
|
|
96
|
+
const frame = `${JSON.stringify(event)}\n`;
|
|
97
|
+
for (const socket of Array.from(clients)) {
|
|
98
|
+
if (!socket.writable || socket.destroyed) {
|
|
99
|
+
removeSocket(socket);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
socket.write(frame);
|
|
104
|
+
} catch {
|
|
105
|
+
removeSocket(socket);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
path: pipePath,
|
|
112
|
+
getStatus() {
|
|
113
|
+
return {
|
|
114
|
+
path: pipePath,
|
|
115
|
+
clients: clients.size,
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
async start() {
|
|
119
|
+
if (server) return { path: pipePath };
|
|
89
120
|
if (!IS_WINDOWS && existsSync(pipePath)) {
|
|
90
|
-
try {
|
|
121
|
+
try {
|
|
122
|
+
unlinkSync(pipePath);
|
|
123
|
+
} catch {}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
server = net.createServer((socket) => {
|
|
127
|
+
clients.add(socket);
|
|
128
|
+
socket.setEncoding("utf8");
|
|
129
|
+
socket.on("error", () => removeSocket(socket));
|
|
130
|
+
socket.on("close", () => removeSocket(socket));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
await new Promise((resolve, reject) => {
|
|
134
|
+
server.once("error", reject);
|
|
135
|
+
server.listen(pipePath, () => {
|
|
136
|
+
server?.off("error", reject);
|
|
137
|
+
resolve();
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
if (store?.onAssignStatusChange && !detachStoreListener) {
|
|
142
|
+
detachStoreListener = store.onAssignStatusChange((event, row) => {
|
|
143
|
+
broadcast(buildAssignCallbackEvent(event, row));
|
|
144
|
+
});
|
|
91
145
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (store?.onAssignStatusChange && !detachStoreListener) {
|
|
109
|
-
detachStoreListener = store.onAssignStatusChange((event, row) => {
|
|
110
|
-
broadcast(buildAssignCallbackEvent(event, row));
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return { path: pipePath };
|
|
115
|
-
},
|
|
116
|
-
async stop() {
|
|
117
|
-
if (detachStoreListener) {
|
|
118
|
-
try { detachStoreListener(); } catch {}
|
|
119
|
-
detachStoreListener = null;
|
|
120
|
-
}
|
|
121
|
-
if (!server) return;
|
|
122
|
-
for (const socket of Array.from(clients)) {
|
|
123
|
-
removeSocket(socket);
|
|
124
|
-
}
|
|
125
|
-
await new Promise((resolve) => server.close(resolve));
|
|
126
|
-
server = null;
|
|
146
|
+
|
|
147
|
+
return { path: pipePath };
|
|
148
|
+
},
|
|
149
|
+
async stop() {
|
|
150
|
+
if (detachStoreListener) {
|
|
151
|
+
try {
|
|
152
|
+
detachStoreListener();
|
|
153
|
+
} catch {}
|
|
154
|
+
detachStoreListener = null;
|
|
155
|
+
}
|
|
156
|
+
if (!server) return;
|
|
157
|
+
for (const socket of Array.from(clients)) {
|
|
158
|
+
removeSocket(socket);
|
|
159
|
+
}
|
|
160
|
+
await new Promise((resolve) => server.close(resolve));
|
|
161
|
+
server = null;
|
|
127
162
|
if (!IS_WINDOWS && existsSync(pipePath)) {
|
|
128
|
-
try {
|
|
163
|
+
try {
|
|
164
|
+
unlinkSync(pipePath);
|
|
165
|
+
} catch {}
|
|
129
166
|
}
|
|
130
|
-
},
|
|
131
|
-
broadcast,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
167
|
+
},
|
|
168
|
+
broadcast,
|
|
169
|
+
};
|
|
170
|
+
}
|