@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
package/hub/bridge.mjs
ADDED
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// hub/bridge.mjs — tfx-route.sh ↔ tfx-hub 브릿지 CLI
|
|
3
|
+
//
|
|
4
|
+
// Named Pipe/Unix Socket 제어 채널을 우선 사용하고,
|
|
5
|
+
// 연결이 없을 때만 HTTP /bridge/* 엔드포인트로 내려간다.
|
|
6
|
+
|
|
7
|
+
import net from 'node:net';
|
|
8
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, openSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { spawn } from 'node:child_process';
|
|
12
|
+
import { parseArgs as nodeParseArgs } from 'node:util';
|
|
13
|
+
import { randomUUID } from 'node:crypto';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
|
|
16
|
+
import { getPipelineStateDbPath } from './pipeline/state.mjs';
|
|
17
|
+
|
|
18
|
+
const HUB_PID_FILE = join(homedir(), '.claude', 'cache', 'tfx-hub', 'hub.pid');
|
|
19
|
+
const HUB_TOKEN_FILE = join(homedir(), '.claude', '.tfx-hub-token');
|
|
20
|
+
const PROJECT_ROOT = fileURLToPath(new URL('..', import.meta.url));
|
|
21
|
+
|
|
22
|
+
function normalizeToken(raw) {
|
|
23
|
+
if (raw == null) return null;
|
|
24
|
+
const token = String(raw).trim();
|
|
25
|
+
return token || null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Hub 인증 토큰 읽기 (파일 없으면 null → 하위 호환)
|
|
29
|
+
function readHubToken() {
|
|
30
|
+
const envToken = normalizeToken(process.env.TFX_HUB_TOKEN);
|
|
31
|
+
if (envToken) return envToken;
|
|
32
|
+
try {
|
|
33
|
+
return normalizeToken(readFileSync(HUB_TOKEN_FILE, 'utf8'));
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getHubUrl() {
|
|
40
|
+
if (process.env.TFX_HUB_URL) return process.env.TFX_HUB_URL.replace(/\/mcp$/, '');
|
|
41
|
+
|
|
42
|
+
if (existsSync(HUB_PID_FILE)) {
|
|
43
|
+
try {
|
|
44
|
+
const info = JSON.parse(readFileSync(HUB_PID_FILE, 'utf8'));
|
|
45
|
+
return `http://${info.host || '127.0.0.1'}:${info.port || 27888}`;
|
|
46
|
+
} catch {
|
|
47
|
+
// 무시
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const port = process.env.TFX_HUB_PORT || '27888';
|
|
52
|
+
return `http://127.0.0.1:${port}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getHubPipePath() {
|
|
56
|
+
if (process.env.TFX_HUB_PIPE) return process.env.TFX_HUB_PIPE;
|
|
57
|
+
|
|
58
|
+
if (!existsSync(HUB_PID_FILE)) return null;
|
|
59
|
+
try {
|
|
60
|
+
const info = JSON.parse(readFileSync(HUB_PID_FILE, 'utf8'));
|
|
61
|
+
return info.pipe_path || info.pipePath || null;
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const HUB_OPERATIONS = Object.freeze({
|
|
68
|
+
register: { transport: 'command', action: 'register', httpPath: '/bridge/register' },
|
|
69
|
+
result: { transport: 'command', action: 'result', httpPath: '/bridge/result' },
|
|
70
|
+
control: { transport: 'command', action: 'control', httpPath: '/bridge/control' },
|
|
71
|
+
context: { transport: 'query', action: 'drain', httpPath: '/bridge/context' },
|
|
72
|
+
deregister: { transport: 'command', action: 'deregister', httpPath: '/bridge/deregister' },
|
|
73
|
+
assignAsync: { transport: 'command', action: 'assign', httpPath: '/bridge/assign/async' },
|
|
74
|
+
assignResult: { transport: 'command', action: 'assign_result', httpPath: '/bridge/assign/result' },
|
|
75
|
+
assignStatus: { transport: 'query', action: 'assign_status', httpPath: '/bridge/assign/status' },
|
|
76
|
+
assignRetry: { transport: 'command', action: 'assign_retry', httpPath: '/bridge/assign/retry' },
|
|
77
|
+
teamInfo: { transport: 'query', action: 'team_info', httpPath: '/bridge/team/info' },
|
|
78
|
+
teamTaskList: { transport: 'query', action: 'team_task_list', httpPath: '/bridge/team/task-list' },
|
|
79
|
+
teamTaskUpdate: { transport: 'command', action: 'team_task_update', httpPath: '/bridge/team/task-update' },
|
|
80
|
+
teamSendMessage: { transport: 'command', action: 'team_send_message', httpPath: '/bridge/team/send-message' },
|
|
81
|
+
pipelineState: { transport: 'query', action: 'pipeline_state', httpPath: '/bridge/pipeline/state' },
|
|
82
|
+
pipelineAdvance: { transport: 'command', action: 'pipeline_advance', httpPath: '/bridge/pipeline/advance' },
|
|
83
|
+
pipelineInit: { transport: 'command', action: 'pipeline_init', httpPath: '/bridge/pipeline/init' },
|
|
84
|
+
pipelineList: { transport: 'query', action: 'pipeline_list', httpPath: '/bridge/pipeline/list' },
|
|
85
|
+
hubStatus: { transport: 'query', action: 'status', httpPath: '/status', httpMethod: 'GET' },
|
|
86
|
+
delegatorDelegate: { transport: 'command', action: 'delegator_delegate', httpPath: '/bridge/delegator/delegate' },
|
|
87
|
+
delegatorReply: { transport: 'command', action: 'delegator_reply', httpPath: '/bridge/delegator/reply' },
|
|
88
|
+
delegatorStatus: { transport: 'query', action: 'delegator_status', httpPath: '/bridge/delegator/status' },
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export async function requestJson(path, { method = 'POST', body, timeoutMs = 5000 } = {}) {
|
|
92
|
+
const controller = new AbortController();
|
|
93
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
const headers = {};
|
|
97
|
+
const token = readHubToken();
|
|
98
|
+
if (token) {
|
|
99
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
100
|
+
}
|
|
101
|
+
if (body !== undefined) {
|
|
102
|
+
headers['Content-Type'] = 'application/json';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const res = await fetch(`${getHubUrl()}${path}`, {
|
|
106
|
+
method,
|
|
107
|
+
headers,
|
|
108
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
109
|
+
signal: controller.signal,
|
|
110
|
+
});
|
|
111
|
+
clearTimeout(timer);
|
|
112
|
+
return await res.json();
|
|
113
|
+
} catch {
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export async function post(path, body, timeoutMs = 5000) {
|
|
120
|
+
return await requestJson(path, { method: 'POST', body, timeoutMs });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function connectPipe(timeoutMs = 1200) {
|
|
124
|
+
const pipePath = getHubPipePath();
|
|
125
|
+
if (!pipePath) return null;
|
|
126
|
+
|
|
127
|
+
return await new Promise((resolve) => {
|
|
128
|
+
const socket = net.createConnection(pipePath);
|
|
129
|
+
const timer = setTimeout(() => {
|
|
130
|
+
try { socket.destroy(); } catch {}
|
|
131
|
+
resolve(null);
|
|
132
|
+
}, timeoutMs);
|
|
133
|
+
|
|
134
|
+
socket.once('connect', () => {
|
|
135
|
+
clearTimeout(timer);
|
|
136
|
+
socket.setEncoding('utf8');
|
|
137
|
+
resolve(socket);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
socket.once('error', () => {
|
|
141
|
+
clearTimeout(timer);
|
|
142
|
+
try { socket.destroy(); } catch {}
|
|
143
|
+
resolve(null);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function pipeRequest(type, action, payload, timeoutMs = 3000) {
|
|
149
|
+
const socket = await connectPipe(Math.min(timeoutMs, 1500));
|
|
150
|
+
if (!socket) return null;
|
|
151
|
+
|
|
152
|
+
return await new Promise((resolve) => {
|
|
153
|
+
const requestId = randomUUID();
|
|
154
|
+
let buffer = '';
|
|
155
|
+
let settled = false;
|
|
156
|
+
const timer = setTimeout(() => {
|
|
157
|
+
finish(null);
|
|
158
|
+
}, timeoutMs);
|
|
159
|
+
|
|
160
|
+
const finish = (result) => {
|
|
161
|
+
if (settled) return;
|
|
162
|
+
settled = true;
|
|
163
|
+
clearTimeout(timer);
|
|
164
|
+
try { socket.end(); } catch {}
|
|
165
|
+
resolve(result);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
socket.on('data', (chunk) => {
|
|
169
|
+
buffer += chunk;
|
|
170
|
+
let newlineIndex = buffer.indexOf('\n');
|
|
171
|
+
while (newlineIndex >= 0) {
|
|
172
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
173
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
174
|
+
newlineIndex = buffer.indexOf('\n');
|
|
175
|
+
if (!line) continue;
|
|
176
|
+
|
|
177
|
+
let frame;
|
|
178
|
+
try {
|
|
179
|
+
frame = JSON.parse(line);
|
|
180
|
+
} catch {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (frame?.type !== 'response' || frame.request_id !== requestId) continue;
|
|
185
|
+
finish({
|
|
186
|
+
ok: frame.ok,
|
|
187
|
+
error: frame.error,
|
|
188
|
+
data: frame.data,
|
|
189
|
+
});
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
socket.on('error', () => finish(null));
|
|
195
|
+
socket.write(JSON.stringify({
|
|
196
|
+
type,
|
|
197
|
+
request_id: requestId,
|
|
198
|
+
payload: { action, ...payload },
|
|
199
|
+
}) + '\n');
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async function pipeCommand(action, payload, timeoutMs = 3000) {
|
|
204
|
+
return await pipeRequest('command', action, payload, timeoutMs);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async function pipeQuery(action, payload, timeoutMs = 3000) {
|
|
208
|
+
return await pipeRequest('query', action, payload, timeoutMs);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function parseArgs(argv) {
|
|
212
|
+
const { values } = nodeParseArgs({
|
|
213
|
+
args: argv,
|
|
214
|
+
options: {
|
|
215
|
+
agent: { type: 'string' },
|
|
216
|
+
cli: { type: 'string' },
|
|
217
|
+
timeout: { type: 'string' },
|
|
218
|
+
topics: { type: 'string' },
|
|
219
|
+
capabilities: { type: 'string' },
|
|
220
|
+
file: { type: 'string' },
|
|
221
|
+
payload: { type: 'string' },
|
|
222
|
+
topic: { type: 'string' },
|
|
223
|
+
trace: { type: 'string' },
|
|
224
|
+
correlation: { type: 'string' },
|
|
225
|
+
'exit-code': { type: 'string' },
|
|
226
|
+
max: { type: 'string' },
|
|
227
|
+
out: { type: 'string' },
|
|
228
|
+
team: { type: 'string' },
|
|
229
|
+
'task-id': { type: 'string' },
|
|
230
|
+
'job-id': { type: 'string' },
|
|
231
|
+
owner: { type: 'string' },
|
|
232
|
+
status: { type: 'string' },
|
|
233
|
+
statuses: { type: 'string' },
|
|
234
|
+
claim: { type: 'boolean' },
|
|
235
|
+
actor: { type: 'string' },
|
|
236
|
+
command: { type: 'string' },
|
|
237
|
+
reason: { type: 'string' },
|
|
238
|
+
from: { type: 'string' },
|
|
239
|
+
to: { type: 'string' },
|
|
240
|
+
text: { type: 'string' },
|
|
241
|
+
task: { type: 'string' },
|
|
242
|
+
'supervisor-agent': { type: 'string' },
|
|
243
|
+
'worker-agent': { type: 'string' },
|
|
244
|
+
priority: { type: 'string' },
|
|
245
|
+
'ttl-ms': { type: 'string' },
|
|
246
|
+
'timeout-ms': { type: 'string' },
|
|
247
|
+
'max-retries': { type: 'string' },
|
|
248
|
+
attempt: { type: 'string' },
|
|
249
|
+
result: { type: 'string' },
|
|
250
|
+
error: { type: 'string' },
|
|
251
|
+
metadata: { type: 'string' },
|
|
252
|
+
'requested-by': { type: 'string' },
|
|
253
|
+
summary: { type: 'string' },
|
|
254
|
+
color: { type: 'string' },
|
|
255
|
+
limit: { type: 'string' },
|
|
256
|
+
'include-internal': { type: 'boolean' },
|
|
257
|
+
subject: { type: 'string' },
|
|
258
|
+
description: { type: 'string' },
|
|
259
|
+
'fix-max': { type: 'string' },
|
|
260
|
+
'ralph-max': { type: 'string' },
|
|
261
|
+
'active-form': { type: 'string' },
|
|
262
|
+
'add-blocks': { type: 'string' },
|
|
263
|
+
'add-blocked-by': { type: 'string' },
|
|
264
|
+
'metadata-patch': { type: 'string' },
|
|
265
|
+
'if-match-mtime-ms': { type: 'string' },
|
|
266
|
+
provider: { type: 'string' },
|
|
267
|
+
mode: { type: 'string' },
|
|
268
|
+
prompt: { type: 'string' },
|
|
269
|
+
reply: { type: 'string' },
|
|
270
|
+
done: { type: 'boolean' },
|
|
271
|
+
'mcp-profile': { type: 'string' },
|
|
272
|
+
'session-key': { type: 'string' },
|
|
273
|
+
},
|
|
274
|
+
strict: false,
|
|
275
|
+
});
|
|
276
|
+
return values;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export function parseJsonSafe(raw, fallback = null) {
|
|
280
|
+
if (!raw) return fallback;
|
|
281
|
+
try {
|
|
282
|
+
return JSON.parse(raw);
|
|
283
|
+
} catch {
|
|
284
|
+
return fallback;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Hub 자동 재시작 (Pipe+HTTP 모두 실패 시 1회 시도, 최대 4초 대기)
|
|
289
|
+
async function tryRestartHub() {
|
|
290
|
+
const serverPath = join(PROJECT_ROOT, 'hub', 'server.mjs');
|
|
291
|
+
if (!existsSync(serverPath)) return false;
|
|
292
|
+
|
|
293
|
+
if (existsSync(HUB_PID_FILE)) {
|
|
294
|
+
try {
|
|
295
|
+
const info = JSON.parse(readFileSync(HUB_PID_FILE, 'utf8'));
|
|
296
|
+
if (info.pid) {
|
|
297
|
+
try { process.kill(info.pid, 0); return false; } // still alive
|
|
298
|
+
catch (e) { if (e.code === 'EPERM') return false; } // alive, no permission
|
|
299
|
+
}
|
|
300
|
+
} catch {} // corrupt PID file, proceed with restart
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
try {
|
|
304
|
+
const logDir = join(process.cwd(), '.tfx', 'logs');
|
|
305
|
+
if (!existsSync(logDir)) mkdirSync(logDir, { recursive: true });
|
|
306
|
+
const logFile = join(logDir, 'hub-restart.log');
|
|
307
|
+
const logFd = openSync(logFile, 'a');
|
|
308
|
+
const child = spawn(process.execPath, [serverPath], {
|
|
309
|
+
detached: true,
|
|
310
|
+
stdio: ['ignore', 'ignore', logFd],
|
|
311
|
+
windowsHide: true,
|
|
312
|
+
});
|
|
313
|
+
child.unref();
|
|
314
|
+
} catch {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
for (let i = 0; i < 8; i++) {
|
|
319
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
320
|
+
try {
|
|
321
|
+
const res = await fetch(`${getHubUrl()}/status`, {
|
|
322
|
+
signal: AbortSignal.timeout(1000),
|
|
323
|
+
});
|
|
324
|
+
if (res.ok) {
|
|
325
|
+
const data = await res.json();
|
|
326
|
+
if (data?.hub?.state === 'healthy') return true;
|
|
327
|
+
}
|
|
328
|
+
} catch {}
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
async function requestHub(operation, body, timeoutMs = 3000, fallback = null) {
|
|
334
|
+
const viaPipe = operation.transport === 'command'
|
|
335
|
+
? await pipeCommand(operation.action, body, timeoutMs)
|
|
336
|
+
: await pipeQuery(operation.action, body, timeoutMs);
|
|
337
|
+
if (viaPipe) {
|
|
338
|
+
return { transport: 'pipe', result: viaPipe };
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const viaHttp = operation.httpPath
|
|
342
|
+
? await requestJson(operation.httpPath, {
|
|
343
|
+
method: operation.httpMethod || 'POST',
|
|
344
|
+
body: operation.httpMethod === 'GET' ? undefined : body,
|
|
345
|
+
timeoutMs: Math.max(timeoutMs, 5000),
|
|
346
|
+
})
|
|
347
|
+
: null;
|
|
348
|
+
if (viaHttp) {
|
|
349
|
+
return { transport: 'http', result: viaHttp };
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Hub 재시작 시도 → Pipe/HTTP 재시도
|
|
353
|
+
if (await tryRestartHub()) {
|
|
354
|
+
const retryPipe = operation.transport === 'command'
|
|
355
|
+
? await pipeCommand(operation.action, body, timeoutMs)
|
|
356
|
+
: await pipeQuery(operation.action, body, timeoutMs);
|
|
357
|
+
if (retryPipe) {
|
|
358
|
+
return { transport: 'pipe', result: retryPipe };
|
|
359
|
+
}
|
|
360
|
+
const retryHttp = operation.httpPath
|
|
361
|
+
? await requestJson(operation.httpPath, {
|
|
362
|
+
method: operation.httpMethod || 'POST',
|
|
363
|
+
body: operation.httpMethod === 'GET' ? undefined : body,
|
|
364
|
+
timeoutMs: Math.max(timeoutMs, 5000),
|
|
365
|
+
})
|
|
366
|
+
: null;
|
|
367
|
+
if (retryHttp) {
|
|
368
|
+
return { transport: 'http', result: retryHttp };
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (!fallback) return null;
|
|
373
|
+
const viaFallback = await fallback();
|
|
374
|
+
if (!viaFallback) return null;
|
|
375
|
+
return { transport: 'fallback', result: viaFallback };
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function unavailableResult() {
|
|
379
|
+
return { ok: false, reason: 'hub_unavailable' };
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function emitJson(payload) {
|
|
383
|
+
if (payload !== undefined) {
|
|
384
|
+
console.log(JSON.stringify(payload));
|
|
385
|
+
}
|
|
386
|
+
return payload?.ok !== false;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
async function cmdRegister(args) {
|
|
390
|
+
const agentId = args.agent;
|
|
391
|
+
const timeoutSec = parseInt(args.timeout || '600', 10);
|
|
392
|
+
const outcome = await requestHub(HUB_OPERATIONS.register, {
|
|
393
|
+
agent_id: agentId,
|
|
394
|
+
cli: args.cli || 'other',
|
|
395
|
+
timeout_sec: timeoutSec,
|
|
396
|
+
heartbeat_ttl_ms: (timeoutSec + 120) * 1000,
|
|
397
|
+
topics: args.topics ? args.topics.split(',') : [],
|
|
398
|
+
capabilities: args.capabilities ? args.capabilities.split(',') : ['code'],
|
|
399
|
+
metadata: {
|
|
400
|
+
pid: process.ppid,
|
|
401
|
+
registered_at: Date.now(),
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
const result = outcome?.result;
|
|
405
|
+
|
|
406
|
+
if (result?.ok) {
|
|
407
|
+
return emitJson({
|
|
408
|
+
ok: true,
|
|
409
|
+
agent_id: agentId,
|
|
410
|
+
lease_expires_ms: result.data?.lease_expires_ms,
|
|
411
|
+
pipe_path: result.data?.pipe_path || getHubPipePath(),
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return emitJson(result || unavailableResult());
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
async function cmdResult(args) {
|
|
419
|
+
let output = '';
|
|
420
|
+
if (args.file && existsSync(args.file)) {
|
|
421
|
+
output = readFileSync(args.file, 'utf8').slice(0, 49152);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const defaultPayload = {
|
|
425
|
+
agent_id: args.agent,
|
|
426
|
+
exit_code: parseInt(args['exit-code'] || '0', 10),
|
|
427
|
+
output_length: output.length,
|
|
428
|
+
output_preview: output.slice(0, 4096),
|
|
429
|
+
output_file: args.file || null,
|
|
430
|
+
completed_at: Date.now(),
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const outcome = await requestHub(HUB_OPERATIONS.result, {
|
|
434
|
+
agent_id: args.agent,
|
|
435
|
+
topic: args.topic || 'task.result',
|
|
436
|
+
payload: args.payload ? parseJsonSafe(args.payload, defaultPayload) : defaultPayload,
|
|
437
|
+
trace_id: args.trace || undefined,
|
|
438
|
+
correlation_id: args.correlation || undefined,
|
|
439
|
+
});
|
|
440
|
+
const result = outcome?.result;
|
|
441
|
+
|
|
442
|
+
if (result?.ok) {
|
|
443
|
+
return emitJson({ ok: true, message_id: result.data?.message_id });
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return emitJson(result || unavailableResult());
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
async function cmdControl(args) {
|
|
450
|
+
const outcome = await requestHub(HUB_OPERATIONS.control, {
|
|
451
|
+
from_agent: args.from || 'lead',
|
|
452
|
+
to_agent: args.to,
|
|
453
|
+
command: args.command,
|
|
454
|
+
reason: args.reason || '',
|
|
455
|
+
payload: args.payload ? parseJsonSafe(args.payload, {}) : {},
|
|
456
|
+
trace_id: args.trace || undefined,
|
|
457
|
+
correlation_id: args.correlation || undefined,
|
|
458
|
+
ttl_ms: args['ttl-ms'] != null ? Number(args['ttl-ms']) : undefined,
|
|
459
|
+
});
|
|
460
|
+
const result = outcome?.result;
|
|
461
|
+
return emitJson(result || unavailableResult());
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
async function cmdContext(args) {
|
|
465
|
+
const outcome = await requestHub(HUB_OPERATIONS.context, {
|
|
466
|
+
agent_id: args.agent,
|
|
467
|
+
topics: args.topics ? args.topics.split(',') : undefined,
|
|
468
|
+
max_messages: parseInt(args.max || '10', 10),
|
|
469
|
+
auto_ack: true,
|
|
470
|
+
});
|
|
471
|
+
const result = outcome?.result;
|
|
472
|
+
|
|
473
|
+
if (result?.ok && result.data?.messages?.length) {
|
|
474
|
+
const parts = result.data.messages.map((message, index) => {
|
|
475
|
+
const payload = typeof message.payload === 'string'
|
|
476
|
+
? message.payload
|
|
477
|
+
: JSON.stringify(message.payload, null, 2);
|
|
478
|
+
return `=== Context ${index + 1}: ${message.from_agent || 'unknown'} (${message.topic || 'unknown'}) ===\n${payload}`;
|
|
479
|
+
});
|
|
480
|
+
const combined = parts.join('\n\n');
|
|
481
|
+
|
|
482
|
+
if (args.out) {
|
|
483
|
+
writeFileSync(args.out, combined, 'utf8');
|
|
484
|
+
return emitJson({ ok: true, count: result.data.messages.length, file: args.out });
|
|
485
|
+
} else {
|
|
486
|
+
return emitJson({ ok: true, count: result.data.messages.length, context: combined });
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (result?.ok) {
|
|
491
|
+
if (args.out) {
|
|
492
|
+
return emitJson({ ok: true, count: 0 });
|
|
493
|
+
}
|
|
494
|
+
return emitJson({ ok: true, count: 0, context: '' });
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return emitJson(result || unavailableResult());
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
async function cmdDeregister(args) {
|
|
501
|
+
const outcome = await requestHub(HUB_OPERATIONS.deregister, {
|
|
502
|
+
agent_id: args.agent,
|
|
503
|
+
});
|
|
504
|
+
const result = outcome?.result;
|
|
505
|
+
|
|
506
|
+
if (result?.ok) {
|
|
507
|
+
return emitJson({ ok: true, agent_id: args.agent, status: 'offline' });
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return emitJson(result || unavailableResult());
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
async function cmdAssignAsync(args) {
|
|
514
|
+
const outcome = await requestHub(HUB_OPERATIONS.assignAsync, {
|
|
515
|
+
supervisor_agent: args['supervisor-agent'],
|
|
516
|
+
worker_agent: args['worker-agent'],
|
|
517
|
+
task: args.task,
|
|
518
|
+
topic: args.topic || 'assign.job',
|
|
519
|
+
payload: args.payload ? parseJsonSafe(args.payload, {}) : {},
|
|
520
|
+
priority: args.priority != null ? Number(args.priority) : undefined,
|
|
521
|
+
ttl_ms: args['ttl-ms'] != null ? Number(args['ttl-ms']) : undefined,
|
|
522
|
+
timeout_ms: args['timeout-ms'] != null ? Number(args['timeout-ms']) : undefined,
|
|
523
|
+
max_retries: args['max-retries'] != null ? Number(args['max-retries']) : undefined,
|
|
524
|
+
trace_id: args.trace || undefined,
|
|
525
|
+
correlation_id: args.correlation || undefined,
|
|
526
|
+
});
|
|
527
|
+
const result = outcome?.result;
|
|
528
|
+
return emitJson(result || unavailableResult());
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
async function cmdAssignResult(args) {
|
|
532
|
+
const outcome = await requestHub(HUB_OPERATIONS.assignResult, {
|
|
533
|
+
job_id: args['job-id'],
|
|
534
|
+
worker_agent: args['worker-agent'],
|
|
535
|
+
status: args.status,
|
|
536
|
+
attempt: args.attempt != null ? Number(args.attempt) : undefined,
|
|
537
|
+
result: args.result ? parseJsonSafe(args.result, null) : undefined,
|
|
538
|
+
error: args.error ? parseJsonSafe(args.error, null) : undefined,
|
|
539
|
+
payload: args.payload ? parseJsonSafe(args.payload, {}) : {},
|
|
540
|
+
metadata: args.metadata ? parseJsonSafe(args.metadata, {}) : {},
|
|
541
|
+
});
|
|
542
|
+
const result = outcome?.result;
|
|
543
|
+
return emitJson(result || unavailableResult());
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
async function cmdAssignStatus(args) {
|
|
547
|
+
const outcome = await requestHub(HUB_OPERATIONS.assignStatus, {
|
|
548
|
+
job_id: args['job-id'],
|
|
549
|
+
});
|
|
550
|
+
const result = outcome?.result;
|
|
551
|
+
return emitJson(result || unavailableResult());
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
async function cmdAssignRetry(args) {
|
|
555
|
+
const outcome = await requestHub(HUB_OPERATIONS.assignRetry, {
|
|
556
|
+
job_id: args['job-id'],
|
|
557
|
+
reason: args.reason,
|
|
558
|
+
requested_by: args['requested-by'],
|
|
559
|
+
});
|
|
560
|
+
const result = outcome?.result;
|
|
561
|
+
return emitJson(result || unavailableResult());
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
async function cmdTeamInfo(args) {
|
|
565
|
+
const body = {
|
|
566
|
+
team_name: args.team,
|
|
567
|
+
include_members: true,
|
|
568
|
+
include_paths: true,
|
|
569
|
+
};
|
|
570
|
+
const outcome = await requestHub(HUB_OPERATIONS.teamInfo, body, 3000, async () => {
|
|
571
|
+
const { teamInfo } = await import('./team/nativeProxy.mjs');
|
|
572
|
+
return await teamInfo(body);
|
|
573
|
+
});
|
|
574
|
+
const result = outcome?.result;
|
|
575
|
+
return emitJson(result || unavailableResult());
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
async function cmdTeamTaskList(args) {
|
|
579
|
+
const body = {
|
|
580
|
+
team_name: args.team,
|
|
581
|
+
owner: args.owner,
|
|
582
|
+
statuses: args.statuses ? args.statuses.split(',').map((status) => status.trim()).filter(Boolean) : [],
|
|
583
|
+
include_internal: !!args['include-internal'],
|
|
584
|
+
limit: parseInt(args.limit || '200', 10),
|
|
585
|
+
};
|
|
586
|
+
const outcome = await requestHub(HUB_OPERATIONS.teamTaskList, body, 3000, async () => {
|
|
587
|
+
const { teamTaskList } = await import('./team/nativeProxy.mjs');
|
|
588
|
+
return await teamTaskList(body);
|
|
589
|
+
});
|
|
590
|
+
const result = outcome?.result;
|
|
591
|
+
return emitJson(result || unavailableResult());
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
async function cmdTeamTaskUpdate(args) {
|
|
595
|
+
const body = {
|
|
596
|
+
team_name: args.team,
|
|
597
|
+
task_id: args['task-id'],
|
|
598
|
+
claim: !!args.claim,
|
|
599
|
+
owner: args.owner,
|
|
600
|
+
status: args.status,
|
|
601
|
+
subject: args.subject,
|
|
602
|
+
description: args.description,
|
|
603
|
+
activeForm: args['active-form'],
|
|
604
|
+
add_blocks: args['add-blocks'] ? args['add-blocks'].split(',').map((value) => value.trim()).filter(Boolean) : undefined,
|
|
605
|
+
add_blocked_by: args['add-blocked-by'] ? args['add-blocked-by'].split(',').map((value) => value.trim()).filter(Boolean) : undefined,
|
|
606
|
+
metadata_patch: args['metadata-patch'] ? parseJsonSafe(args['metadata-patch'], null) : undefined,
|
|
607
|
+
if_match_mtime_ms: args['if-match-mtime-ms'] != null ? Number(args['if-match-mtime-ms']) : undefined,
|
|
608
|
+
actor: args.actor,
|
|
609
|
+
};
|
|
610
|
+
const outcome = await requestHub(HUB_OPERATIONS.teamTaskUpdate, body, 3000, async () => {
|
|
611
|
+
const { teamTaskUpdate } = await import('./team/nativeProxy.mjs');
|
|
612
|
+
return await teamTaskUpdate(body);
|
|
613
|
+
});
|
|
614
|
+
const result = outcome?.result;
|
|
615
|
+
return emitJson(result || unavailableResult());
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
async function cmdTeamSendMessage(args) {
|
|
619
|
+
const body = {
|
|
620
|
+
team_name: args.team,
|
|
621
|
+
from: args.from,
|
|
622
|
+
to: args.to || 'team-lead',
|
|
623
|
+
text: args.text,
|
|
624
|
+
summary: args.summary,
|
|
625
|
+
color: args.color || 'blue',
|
|
626
|
+
};
|
|
627
|
+
const outcome = await requestHub(HUB_OPERATIONS.teamSendMessage, body, 3000, async () => {
|
|
628
|
+
const { teamSendMessage } = await import('./team/nativeProxy.mjs');
|
|
629
|
+
return await teamSendMessage(body);
|
|
630
|
+
});
|
|
631
|
+
const result = outcome?.result;
|
|
632
|
+
return emitJson(result || unavailableResult());
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function getHubDbPath() {
|
|
636
|
+
return getPipelineStateDbPath(PROJECT_ROOT);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
async function cmdPipelineState(args) {
|
|
640
|
+
const outcome = await requestHub(HUB_OPERATIONS.pipelineState, { team_name: args.team }, 3000, async () => {
|
|
641
|
+
try {
|
|
642
|
+
const { default: Database } = await import('better-sqlite3');
|
|
643
|
+
const { ensurePipelineTable, readPipelineState } = await import('./pipeline/state.mjs');
|
|
644
|
+
const dbPath = getHubDbPath();
|
|
645
|
+
if (!existsSync(dbPath)) {
|
|
646
|
+
return { ok: false, error: 'hub_db_not_found' };
|
|
647
|
+
}
|
|
648
|
+
const db = new Database(dbPath, { readonly: true });
|
|
649
|
+
ensurePipelineTable(db);
|
|
650
|
+
const state = readPipelineState(db, args.team);
|
|
651
|
+
db.close();
|
|
652
|
+
return state
|
|
653
|
+
? { ok: true, data: state }
|
|
654
|
+
: { ok: false, error: 'pipeline_not_found' };
|
|
655
|
+
} catch (e) {
|
|
656
|
+
return { ok: false, error: e.message };
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
const result = outcome?.result;
|
|
660
|
+
return emitJson(result || unavailableResult());
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
async function cmdPipelineAdvance(args) {
|
|
664
|
+
const body = {
|
|
665
|
+
team_name: args.team,
|
|
666
|
+
phase: args.status, // --status를 phase로 재활용
|
|
667
|
+
};
|
|
668
|
+
const outcome = await requestHub(HUB_OPERATIONS.pipelineAdvance, body, 3000, async () => {
|
|
669
|
+
try {
|
|
670
|
+
const { default: Database } = await import('better-sqlite3');
|
|
671
|
+
const { createPipeline } = await import('./pipeline/index.mjs');
|
|
672
|
+
const dbPath = getHubDbPath();
|
|
673
|
+
if (!existsSync(dbPath)) {
|
|
674
|
+
return { ok: false, error: 'hub_db_not_found' };
|
|
675
|
+
}
|
|
676
|
+
const db = new Database(dbPath);
|
|
677
|
+
const pipeline = createPipeline(db, args.team);
|
|
678
|
+
const advanceResult = pipeline.advance(args.status);
|
|
679
|
+
db.close();
|
|
680
|
+
return advanceResult;
|
|
681
|
+
} catch (e) {
|
|
682
|
+
return { ok: false, error: e.message };
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
const result = outcome?.result;
|
|
686
|
+
return emitJson(result || unavailableResult());
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
async function cmdPipelineInit(args) {
|
|
690
|
+
const outcome = await requestHub(HUB_OPERATIONS.pipelineInit, {
|
|
691
|
+
team_name: args.team,
|
|
692
|
+
fix_max: args['fix-max'] != null ? Number(args['fix-max']) : undefined,
|
|
693
|
+
ralph_max: args['ralph-max'] != null ? Number(args['ralph-max']) : undefined,
|
|
694
|
+
});
|
|
695
|
+
const result = outcome?.result;
|
|
696
|
+
return emitJson(result || unavailableResult());
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
async function cmdPipelineList() {
|
|
700
|
+
const outcome = await requestHub(HUB_OPERATIONS.pipelineList, {});
|
|
701
|
+
const result = outcome?.result;
|
|
702
|
+
return emitJson(result || unavailableResult());
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
async function cmdPing() {
|
|
706
|
+
const outcome = await requestHub(HUB_OPERATIONS.hubStatus, { scope: 'hub' }, 2000);
|
|
707
|
+
|
|
708
|
+
if (outcome?.transport === 'pipe' && outcome.result?.ok) {
|
|
709
|
+
return emitJson({
|
|
710
|
+
ok: true,
|
|
711
|
+
hub: outcome.result.data?.hub?.state || 'healthy',
|
|
712
|
+
pipe_path: getHubPipePath(),
|
|
713
|
+
transport: 'pipe',
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
if (outcome?.transport === 'http' && outcome.result) {
|
|
718
|
+
const data = outcome.result;
|
|
719
|
+
return emitJson({
|
|
720
|
+
ok: true,
|
|
721
|
+
hub: data.hub?.state,
|
|
722
|
+
sessions: data.sessions,
|
|
723
|
+
pipe_path: data.pipe?.path || data.pipe_path || null,
|
|
724
|
+
transport: 'http',
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
return emitJson(unavailableResult());
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
async function cmdDelegatorDelegate(args) {
|
|
732
|
+
const body = {
|
|
733
|
+
prompt: args.text || args.prompt,
|
|
734
|
+
provider: args.provider || 'auto',
|
|
735
|
+
mode: args.mode || 'sync',
|
|
736
|
+
agent_type: args.agent || 'executor',
|
|
737
|
+
mcp_profile: args['mcp-profile'] || 'auto',
|
|
738
|
+
session_key: args['session-key'] || undefined,
|
|
739
|
+
timeout_ms: args['timeout-ms'] != null ? Number(args['timeout-ms']) : undefined,
|
|
740
|
+
};
|
|
741
|
+
const timeoutMs = body.mode === 'async' ? 10000 : 120000;
|
|
742
|
+
const outcome = await requestHub(HUB_OPERATIONS.delegatorDelegate, body, timeoutMs);
|
|
743
|
+
return emitJson(outcome?.result || unavailableResult());
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
async function cmdDelegatorReply(args) {
|
|
747
|
+
const body = {
|
|
748
|
+
job_id: args['job-id'],
|
|
749
|
+
reply: args.text || args.reply,
|
|
750
|
+
done: !!args.done,
|
|
751
|
+
};
|
|
752
|
+
const outcome = await requestHub(HUB_OPERATIONS.delegatorReply, body, 120000);
|
|
753
|
+
return emitJson(outcome?.result || unavailableResult());
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
async function cmdDelegatorStatus(args) {
|
|
757
|
+
const body = {
|
|
758
|
+
job_id: args['job-id'],
|
|
759
|
+
};
|
|
760
|
+
const outcome = await requestHub(HUB_OPERATIONS.delegatorStatus, body, 5000);
|
|
761
|
+
return emitJson(outcome?.result || unavailableResult());
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
765
|
+
const cmd = argv[0];
|
|
766
|
+
const args = parseArgs(argv.slice(1));
|
|
767
|
+
|
|
768
|
+
switch (cmd) {
|
|
769
|
+
case 'register': return await cmdRegister(args);
|
|
770
|
+
case 'result': return await cmdResult(args);
|
|
771
|
+
case 'control': return await cmdControl(args);
|
|
772
|
+
case 'context': return await cmdContext(args);
|
|
773
|
+
case 'deregister': return await cmdDeregister(args);
|
|
774
|
+
case 'assign-async': return await cmdAssignAsync(args);
|
|
775
|
+
case 'assign-result': return await cmdAssignResult(args);
|
|
776
|
+
case 'assign-status': return await cmdAssignStatus(args);
|
|
777
|
+
case 'assign-retry': return await cmdAssignRetry(args);
|
|
778
|
+
case 'team-info': return await cmdTeamInfo(args);
|
|
779
|
+
case 'team-task-list': return await cmdTeamTaskList(args);
|
|
780
|
+
case 'team-task-update': return await cmdTeamTaskUpdate(args);
|
|
781
|
+
case 'team-send-message': return await cmdTeamSendMessage(args);
|
|
782
|
+
case 'pipeline-state': return await cmdPipelineState(args);
|
|
783
|
+
case 'pipeline-advance': return await cmdPipelineAdvance(args);
|
|
784
|
+
case 'pipeline-init': return await cmdPipelineInit(args);
|
|
785
|
+
case 'pipeline-list': return await cmdPipelineList(args);
|
|
786
|
+
case 'ping': return await cmdPing(args);
|
|
787
|
+
case 'delegator-delegate': return await cmdDelegatorDelegate(args);
|
|
788
|
+
case 'delegator-reply': return await cmdDelegatorReply(args);
|
|
789
|
+
case 'delegator-status': return await cmdDelegatorStatus(args);
|
|
790
|
+
default:
|
|
791
|
+
console.error('사용법: bridge.mjs <register|result|control|context|deregister|assign-async|assign-result|assign-status|assign-retry|team-info|team-task-list|team-task-update|team-send-message|pipeline-state|pipeline-advance|pipeline-init|pipeline-list|ping|delegator-delegate|delegator-reply|delegator-status> [--옵션]');
|
|
792
|
+
process.exit(1);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
const selfRun = process.argv[1]?.replace(/\\/g, '/').endsWith('hub/bridge.mjs');
|
|
797
|
+
if (selfRun) {
|
|
798
|
+
process.exitCode = await main() ? 0 : 1;
|
|
799
|
+
}
|