@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.
Files changed (145) hide show
  1. package/hooks/agent-route-guard.mjs +14 -10
  2. package/hooks/cross-review-tracker.mjs +21 -8
  3. package/hooks/error-context.mjs +20 -8
  4. package/hooks/hook-adaptive-collector.mjs +18 -16
  5. package/hooks/hook-manager.mjs +93 -32
  6. package/hooks/hook-orchestrator.mjs +267 -35
  7. package/hooks/hook-registry.json +343 -256
  8. package/hooks/hooks.json +49 -1
  9. package/hooks/keyword-rules.json +191 -31
  10. package/hooks/lib/resolve-root.mjs +1 -1
  11. package/hooks/mcp-config-watcher.mjs +6 -2
  12. package/hooks/permission-safe-allow.mjs +233 -0
  13. package/hooks/pipeline-stop.mjs +369 -22
  14. package/hooks/post-tool-tips.mjs +306 -0
  15. package/hooks/pre-compact-snapshot.mjs +181 -0
  16. package/hooks/safety-guard.mjs +262 -34
  17. package/hooks/session-end-cleanup.mjs +345 -0
  18. package/hooks/session-start-fast.mjs +214 -0
  19. package/hooks/subagent-tracker.mjs +267 -0
  20. package/hooks/subagent-verifier.mjs +9 -4
  21. package/hub/account-broker.mjs +1036 -66
  22. package/hub/adaptive-diagnostic.mjs +75 -48
  23. package/hub/adaptive-inject.mjs +96 -58
  24. package/hub/adaptive-memory.mjs +156 -42
  25. package/hub/adaptive.mjs +60 -31
  26. package/hub/assign-callbacks.mjs +163 -126
  27. package/hub/bridge.mjs +1051 -290
  28. package/hub/cli-adapter-base.mjs +321 -97
  29. package/hub/codex-adapter.mjs +179 -93
  30. package/hub/codex-compat.mjs +4 -4
  31. package/hub/codex-preflight.mjs +113 -37
  32. package/hub/delegator/contracts.mjs +22 -21
  33. package/hub/delegator/index.mjs +14 -14
  34. package/hub/delegator/schema/delegator-tools.schema.json +1 -1
  35. package/hub/delegator/service.mjs +93 -64
  36. package/hub/delegator/tool-definitions.mjs +35 -35
  37. package/hub/dynamic-routing-engine.mjs +511 -0
  38. package/hub/fullcycle.mjs +34 -18
  39. package/hub/gemini-adapter.mjs +82 -108
  40. package/hub/hitl.mjs +202 -143
  41. package/hub/intent.mjs +167 -38
  42. package/hub/lib/bash-path.mjs +73 -0
  43. package/hub/lib/cache-guard.mjs +43 -17
  44. package/hub/lib/env-detect.mjs +145 -0
  45. package/hub/lib/hosts-compat.mjs +319 -0
  46. package/hub/lib/mcp-response-cache.mjs +239 -0
  47. package/hub/lib/memory-store.mjs +285 -111
  48. package/hub/lib/path-utils.mjs +165 -0
  49. package/hub/lib/phase-manager.mjs +493 -0
  50. package/hub/lib/process-utils.mjs +797 -104
  51. package/hub/lib/prompt-tmp.mjs +33 -0
  52. package/hub/lib/risk-tier.mjs +53 -0
  53. package/hub/lib/spawn-trace.mjs +561 -0
  54. package/hub/lib/ssh-command.mjs +44 -24
  55. package/hub/lib/ssh-retry.mjs +5 -1
  56. package/hub/lib/staged-file-detect.mjs +43 -0
  57. package/hub/lib/state-snapshot.mjs +293 -0
  58. package/hub/lib/tfx-route-args.mjs +309 -0
  59. package/hub/lib/timeline-adapter.mjs +190 -0
  60. package/hub/lib/trace-recorder.mjs +153 -0
  61. package/hub/lib/uuidv7.mjs +4 -3
  62. package/hub/memory-doctor.mjs +266 -106
  63. package/hub/middleware/quota-middleware.mjs +70 -0
  64. package/hub/middleware/request-logger.mjs +61 -34
  65. package/hub/paths.mjs +9 -9
  66. package/hub/pipeline/gates/confidence.mjs +34 -15
  67. package/hub/pipeline/gates/consensus.mjs +27 -15
  68. package/hub/pipeline/gates/index.mjs +7 -3
  69. package/hub/pipeline/gates/selfcheck.mjs +57 -19
  70. package/hub/pipeline/index.mjs +77 -42
  71. package/hub/pipeline/state.mjs +10 -10
  72. package/hub/pipeline/transitions.mjs +40 -23
  73. package/hub/platform.mjs +65 -48
  74. package/hub/quality/deslop.mjs +70 -49
  75. package/hub/reflexion.mjs +87 -13
  76. package/hub/research.mjs +33 -25
  77. package/hub/router.mjs +941 -791
  78. package/hub/routing/complexity.mjs +132 -29
  79. package/hub/routing/index.mjs +17 -12
  80. package/hub/routing/q-learning.mjs +78 -30
  81. package/hub/routing-snapshot.mjs +261 -0
  82. package/hub/session-fingerprint.mjs +127 -61
  83. package/hub/state.mjs +86 -44
  84. package/hub/team/claude-daemon-control.mjs +1130 -0
  85. package/hub/team/retry-state-machine.mjs +336 -0
  86. package/hub/token-mode.mjs +72 -71
  87. package/hub/workers/worker-utils.mjs +23 -17
  88. package/hud/colors.mjs +27 -9
  89. package/hud/constants.mjs +190 -27
  90. package/hud/context-monitor.mjs +133 -44
  91. package/hud/hud-qos-status.mjs +157 -50
  92. package/hud/mission-board.mjs +56 -0
  93. package/hud/providers/claude.mjs +398 -114
  94. package/hud/providers/codex.mjs +96 -21
  95. package/hud/providers/gemini.mjs +210 -52
  96. package/hud/renderers.mjs +440 -127
  97. package/hud/terminal.mjs +101 -31
  98. package/hud/utils.mjs +81 -39
  99. package/mesh/index.mjs +69 -0
  100. package/mesh/mesh-budget.mjs +137 -0
  101. package/mesh/mesh-heartbeat.mjs +100 -0
  102. package/mesh/mesh-protocol.mjs +96 -0
  103. package/mesh/mesh-queue.mjs +163 -0
  104. package/mesh/mesh-registry.mjs +78 -0
  105. package/mesh/mesh-router.mjs +77 -0
  106. package/package.json +5 -1
  107. package/scripts/lib/agent-json.mjs +27 -0
  108. package/scripts/lib/async.mjs +174 -0
  109. package/scripts/lib/claudemd-scanner.mjs +6 -1
  110. package/scripts/lib/cli-agy.mjs +62 -0
  111. package/scripts/lib/cli-claude.mjs +78 -0
  112. package/scripts/lib/cli-codex.mjs +199 -0
  113. package/scripts/lib/cli-gemini.mjs +37 -0
  114. package/scripts/lib/codex-recovery.sh +50 -0
  115. package/scripts/lib/context.mjs +3 -3
  116. package/scripts/lib/cross-review-utils.mjs +13 -5
  117. package/scripts/lib/doctor-env-checks.mjs +121 -0
  118. package/scripts/lib/dynamic-route-cli.mjs +107 -0
  119. package/scripts/lib/env-probe.mjs +58 -30
  120. package/scripts/lib/env.mjs +14 -0
  121. package/scripts/lib/gemini-profiles.mjs +44 -10
  122. package/scripts/lib/handoff.mjs +33 -17
  123. package/scripts/lib/hook-utils.mjs +8 -6
  124. package/scripts/lib/hub.mjs +48 -0
  125. package/scripts/lib/keyword-rules.mjs +49 -20
  126. package/scripts/lib/logger.mjs +24 -24
  127. package/scripts/lib/mcp-filter.mjs +391 -247
  128. package/scripts/lib/mcp-gateway-health-check.mjs +159 -0
  129. package/scripts/lib/mcp-gateway-servers.mjs +70 -0
  130. package/scripts/lib/mcp-gateway-wrapper-check.mjs +35 -0
  131. package/scripts/lib/mcp-guard-engine.mjs +1281 -115
  132. package/scripts/lib/mcp-health.mjs +773 -0
  133. package/scripts/lib/mcp-manifest.mjs +24 -14
  134. package/scripts/lib/mcp-server-catalog.mjs +355 -118
  135. package/scripts/lib/pid.mjs +63 -0
  136. package/scripts/lib/process-utils.mjs +26 -0
  137. package/scripts/lib/psmux-info.mjs +117 -12
  138. package/scripts/lib/quota.mjs +47 -0
  139. package/scripts/lib/remote-spawn-transfer.mjs +44 -14
  140. package/scripts/lib/skill-state.mjs +220 -0
  141. package/scripts/lib/skill-template.mjs +32 -7
  142. package/scripts/lib/team.mjs +75 -0
  143. package/scripts/lib/timeout.mjs +66 -0
  144. package/scripts/lib/tmp.mjs +26 -0
  145. package/scripts/lib/toml.mjs +113 -0
@@ -1,37 +1,38 @@
1
1
  export const DELEGATOR_MCP_SERVER_INFO = Object.freeze({
2
- name: 'triflux-delegator',
3
- version: '0.1.0',
2
+ name: "triflux-delegator",
3
+ version: "0.1.0",
4
4
  });
5
5
 
6
6
  export const DELEGATOR_TOOL_NAMES = Object.freeze({
7
- delegate: 'delegate',
8
- delegateReply: 'delegate-reply',
9
- status: 'status',
7
+ delegate: "delegate",
8
+ delegateReply: "delegate-reply",
9
+ status: "status",
10
10
  });
11
11
 
12
12
  export const DELEGATOR_PIPE_ACTIONS = Object.freeze({
13
- delegate: 'delegator_delegate',
14
- delegateReply: 'delegator_reply',
15
- status: 'delegator_status',
13
+ delegate: "delegator_delegate",
14
+ delegateReply: "delegator_reply",
15
+ status: "delegator_status",
16
16
  });
17
17
 
18
18
  export const DELEGATOR_JOB_STATUSES = Object.freeze([
19
- 'queued',
20
- 'running',
21
- 'waiting_reply',
22
- 'completed',
23
- 'failed',
19
+ "queued",
20
+ "running",
21
+ "waiting_reply",
22
+ "completed",
23
+ "failed",
24
24
  ]);
25
25
 
26
- export const DELEGATOR_MODES = Object.freeze([
27
- 'sync',
28
- 'async',
29
- ]);
26
+ export const DELEGATOR_MODES = Object.freeze(["sync", "async"]);
30
27
 
31
28
  export const DELEGATOR_PROVIDERS = Object.freeze([
32
- 'auto',
33
- 'codex',
34
- 'gemini',
29
+ "auto",
30
+ "codex",
31
+ "antigravity",
32
+ "gemini",
35
33
  ]);
36
34
 
37
- export const DELEGATOR_SCHEMA_URL = new URL('./schema/delegator-tools.schema.json', import.meta.url);
35
+ export const DELEGATOR_SCHEMA_URL = new URL(
36
+ "./schema/delegator-tools.schema.json",
37
+ import.meta.url,
38
+ );
@@ -1,14 +1,14 @@
1
- export {
2
- DELEGATOR_JOB_STATUSES,
3
- DELEGATOR_MCP_SERVER_INFO,
4
- DELEGATOR_MODES,
5
- DELEGATOR_PIPE_ACTIONS,
6
- DELEGATOR_PROVIDERS,
7
- DELEGATOR_SCHEMA_URL,
8
- DELEGATOR_TOOL_NAMES,
9
- } from './contracts.mjs';
10
- export { DelegatorService } from './service.mjs';
11
- export {
12
- getDelegatorMcpToolDefinitions,
13
- loadDelegatorSchemaBundle,
14
- } from './tool-definitions.mjs';
1
+ export {
2
+ DELEGATOR_JOB_STATUSES,
3
+ DELEGATOR_MCP_SERVER_INFO,
4
+ DELEGATOR_MODES,
5
+ DELEGATOR_PIPE_ACTIONS,
6
+ DELEGATOR_PROVIDERS,
7
+ DELEGATOR_SCHEMA_URL,
8
+ DELEGATOR_TOOL_NAMES,
9
+ } from "./contracts.mjs";
10
+ export { DelegatorService } from "./service.mjs";
11
+ export {
12
+ getDelegatorMcpToolDefinitions,
13
+ loadDelegatorSchemaBundle,
14
+ } from "./tool-definitions.mjs";
@@ -5,7 +5,7 @@
5
5
  "$defs": {
6
6
  "Provider": {
7
7
  "type": "string",
8
- "enum": ["auto", "codex", "gemini"]
8
+ "enum": ["auto", "codex", "antigravity", "gemini"]
9
9
  },
10
10
  "Mode": {
11
11
  "type": "string",
@@ -1,11 +1,11 @@
1
- import { randomUUID } from 'node:crypto';
1
+ import { randomUUID } from "node:crypto";
2
2
 
3
3
  import {
4
4
  DELEGATOR_JOB_STATUSES,
5
5
  DELEGATOR_MODES,
6
6
  DELEGATOR_PROVIDERS,
7
- } from './contracts.mjs';
8
- import { getDelegatorMcpToolDefinitions } from './tool-definitions.mjs';
7
+ } from "./contracts.mjs";
8
+ import { getDelegatorMcpToolDefinitions } from "./tool-definitions.mjs";
9
9
 
10
10
  function deepClone(value) {
11
11
  if (value == null) return value;
@@ -19,6 +19,11 @@ function assertKnown(enumValues, value, fieldName) {
19
19
  }
20
20
  }
21
21
 
22
+ function normalizeProvider(provider = "auto") {
23
+ const value = provider || "auto";
24
+ return value === "gemini" ? "antigravity" : value;
25
+ }
26
+
22
27
  export class DelegatorService {
23
28
  constructor({
24
29
  idFactory = randomUUID,
@@ -39,28 +44,28 @@ export class DelegatorService {
39
44
  createJobSnapshot(input = {}) {
40
45
  const timestamp = this.now().toISOString();
41
46
  const jobId = input.job_id || this.idFactory();
42
- const mode = input.mode || 'sync';
43
- const providerRequested = input.provider || 'auto';
47
+ const mode = input.mode || "sync";
48
+ const providerRequested = normalizeProvider(input.provider);
44
49
 
45
- assertKnown(DELEGATOR_MODES, mode, 'mode');
46
- assertKnown(DELEGATOR_PROVIDERS, providerRequested, 'provider');
50
+ assertKnown(DELEGATOR_MODES, mode, "mode");
51
+ assertKnown(DELEGATOR_PROVIDERS, providerRequested, "provider");
47
52
 
48
53
  return {
49
54
  ok: true,
50
55
  job_id: jobId,
51
- status: 'queued',
56
+ status: "queued",
52
57
  mode,
53
58
  provider_requested: providerRequested,
54
59
  provider_resolved: null,
55
- agent_type: input.agent_type || 'executor',
56
- transport: 'resident-pending',
60
+ agent_type: input.agent_type || "executor",
61
+ transport: "resident-pending",
57
62
  created_at: timestamp,
58
63
  started_at: null,
59
64
  updated_at: timestamp,
60
65
  completed_at: null,
61
- output: '',
62
- stderr: '',
63
- error: '',
66
+ output: "",
67
+ stderr: "",
68
+ error: "",
64
69
  thread_id: input.thread_id || null,
65
70
  session_key: input.session_key || null,
66
71
  conversation_open: false,
@@ -69,9 +74,9 @@ export class DelegatorService {
69
74
 
70
75
  recordJob(snapshot) {
71
76
  if (!snapshot?.job_id) {
72
- throw new Error('job_id is required');
77
+ throw new Error("job_id is required");
73
78
  }
74
- assertKnown(DELEGATOR_JOB_STATUSES, snapshot.status, 'status');
79
+ assertKnown(DELEGATOR_JOB_STATUSES, snapshot.status, "status");
75
80
  this.jobs.set(snapshot.job_id, deepClone(snapshot));
76
81
  return this.getStatusSnapshot(snapshot.job_id);
77
82
  }
@@ -86,19 +91,20 @@ export class DelegatorService {
86
91
  _normalizeInput(input = {}) {
87
92
  return {
88
93
  prompt: input.prompt,
89
- provider: input.provider || 'auto',
90
- mode: input.mode || 'sync',
91
- agent_type: input.agent_type || input.agentType || 'executor',
94
+ provider: normalizeProvider(input.provider),
95
+ mode: input.mode || "sync",
96
+ agent_type: input.agent_type || input.agentType || "executor",
92
97
  cwd: input.cwd || null,
93
98
  timeout_ms: input.timeout_ms || input.timeoutMs || null,
94
99
  session_key: input.session_key || input.sessionKey || null,
95
100
  thread_id: input.thread_id || input.threadId || null,
96
101
  reset_session: input.reset_session ?? input.resetSession ?? false,
97
- mcp_profile: input.mcp_profile || input.mcpProfile || 'auto',
102
+ mcp_profile: input.mcp_profile || input.mcpProfile || "auto",
98
103
  search_tool: input.search_tool || input.searchTool || null,
99
104
  context_file: input.context_file || input.contextFile || null,
100
105
  model: input.model || null,
101
- developer_instructions: input.developer_instructions || input.developerInstructions || null,
106
+ developer_instructions:
107
+ input.developer_instructions || input.developerInstructions || null,
102
108
  compact_prompt: input.compact_prompt || input.compactPrompt || null,
103
109
  };
104
110
  }
@@ -131,18 +137,22 @@ export class DelegatorService {
131
137
  const ok = workerResult.ok !== false;
132
138
 
133
139
  snapshot.ok = ok;
134
- snapshot.status = workerResult.status || (ok ? 'completed' : 'failed');
135
- snapshot.provider_resolved = workerResult.providerResolved || workerResult.provider_resolved || null;
140
+ snapshot.status = workerResult.status || (ok ? "completed" : "failed");
141
+ snapshot.provider_resolved =
142
+ workerResult.providerResolved || workerResult.provider_resolved || null;
136
143
  snapshot.transport = workerResult.transport || snapshot.transport;
137
- snapshot.output = workerResult.output || '';
138
- snapshot.stderr = workerResult.stderr || '';
139
- snapshot.error = workerResult.error || '';
140
- snapshot.thread_id = workerResult.threadId || workerResult.thread_id || null;
141
- snapshot.session_key = workerResult.sessionKey || workerResult.session_key || null;
142
- snapshot.conversation_open = workerResult.conversationOpen ?? workerResult.conversation_open ?? false;
144
+ snapshot.output = workerResult.output || "";
145
+ snapshot.stderr = workerResult.stderr || "";
146
+ snapshot.error = workerResult.error || "";
147
+ snapshot.thread_id =
148
+ workerResult.threadId || workerResult.thread_id || null;
149
+ snapshot.session_key =
150
+ workerResult.sessionKey || workerResult.session_key || null;
151
+ snapshot.conversation_open =
152
+ workerResult.conversationOpen ?? workerResult.conversation_open ?? false;
143
153
  snapshot.started_at = snapshot.started_at || timestamp;
144
154
  snapshot.updated_at = timestamp;
145
- if (snapshot.status === 'completed' || snapshot.status === 'failed') {
155
+ if (snapshot.status === "completed" || snapshot.status === "failed") {
146
156
  snapshot.completed_at = timestamp;
147
157
  }
148
158
 
@@ -155,7 +165,7 @@ export class DelegatorService {
155
165
  if (snapshot) {
156
166
  const timestamp = this.now().toISOString();
157
167
  snapshot.ok = false;
158
- snapshot.status = 'failed';
168
+ snapshot.status = "failed";
159
169
  snapshot.error = error;
160
170
  snapshot.updated_at = timestamp;
161
171
  snapshot.completed_at = timestamp;
@@ -169,19 +179,19 @@ export class DelegatorService {
169
179
  const timestamp = this.now().toISOString();
170
180
  return {
171
181
  ok: false,
172
- job_id: jobId || 'unknown',
173
- status: 'failed',
174
- mode: 'sync',
175
- provider_requested: 'auto',
182
+ job_id: jobId || "unknown",
183
+ status: "failed",
184
+ mode: "sync",
185
+ provider_requested: "auto",
176
186
  provider_resolved: null,
177
- agent_type: 'executor',
178
- transport: 'resident-pending',
187
+ agent_type: "executor",
188
+ transport: "resident-pending",
179
189
  created_at: timestamp,
180
190
  started_at: null,
181
191
  updated_at: timestamp,
182
192
  completed_at: timestamp,
183
- output: '',
184
- stderr: '',
193
+ output: "",
194
+ stderr: "",
185
195
  error,
186
196
  thread_id: null,
187
197
  session_key: null,
@@ -194,15 +204,19 @@ export class DelegatorService {
194
204
  async delegate(input = {}) {
195
205
  const normalized = this._normalizeInput(input);
196
206
 
197
- if (!normalized.prompt || typeof normalized.prompt !== 'string' || !normalized.prompt.trim()) {
198
- return this._errorSnapshot(null, 'prompt is required');
207
+ if (
208
+ !normalized.prompt ||
209
+ typeof normalized.prompt !== "string" ||
210
+ !normalized.prompt.trim()
211
+ ) {
212
+ return this._errorSnapshot(null, "prompt is required");
199
213
  }
200
214
 
201
215
  const snapshot = this.createJobSnapshot(normalized);
202
216
  this.recordJob(snapshot);
203
217
 
204
218
  if (!this.worker) {
205
- return this._failJob(snapshot.job_id, 'worker가 설정되지 않았습니다');
219
+ return this._failJob(snapshot.job_id, "worker가 설정되지 않았습니다");
206
220
  }
207
221
 
208
222
  const workerArgs = this._toWorkerArgs(normalized);
@@ -218,44 +232,53 @@ export class DelegatorService {
218
232
 
219
233
  return this._applyWorkerResult(snapshot.job_id, workerResult);
220
234
  } catch (err) {
221
- return this._failJob(snapshot.job_id, err instanceof Error ? err.message : String(err));
235
+ return this._failJob(
236
+ snapshot.job_id,
237
+ err instanceof Error ? err.message : String(err),
238
+ );
222
239
  }
223
240
  }
224
241
 
225
242
  async reply(input = {}) {
226
243
  const jobId = input.job_id || input.jobId;
227
244
  if (!jobId) {
228
- return this._errorSnapshot('unknown', 'job_id is required');
245
+ return this._errorSnapshot("unknown", "job_id is required");
229
246
  }
230
247
 
231
248
  const snapshot = this.jobs.get(jobId);
232
249
  if (!snapshot) {
233
- return this._errorSnapshot(jobId, 'job not found');
250
+ return this._errorSnapshot(jobId, "job not found");
234
251
  }
235
252
 
236
253
  if (!snapshot.conversation_open) {
237
- return this._failJob(jobId, 'conversation is not open');
254
+ return this._failJob(jobId, "conversation is not open");
238
255
  }
239
256
 
240
257
  if (!this.worker) {
241
- return this._failJob(jobId, 'worker가 설정되지 않았습니다');
258
+ return this._failJob(jobId, "worker가 설정되지 않았습니다");
242
259
  }
243
260
 
244
261
  const workerJobId = this._workerJobMap.get(jobId);
245
262
  if (!workerJobId) {
246
- return this._failJob(jobId, 'worker job 매핑을 찾을 수 없습니다');
263
+ return this._failJob(jobId, "worker job 매핑을 찾을 수 없습니다");
247
264
  }
248
265
 
249
266
  try {
250
- const workerResult = await this.worker.reply({
251
- job_id: workerJobId,
252
- reply: input.reply,
253
- done: input.done ?? false,
254
- }, null);
267
+ const workerResult = await this.worker.reply(
268
+ {
269
+ job_id: workerJobId,
270
+ reply: input.reply,
271
+ done: input.done ?? false,
272
+ },
273
+ null,
274
+ );
255
275
 
256
276
  return this._applyWorkerResult(jobId, workerResult);
257
277
  } catch (err) {
258
- return this._failJob(jobId, err instanceof Error ? err.message : String(err));
278
+ return this._failJob(
279
+ jobId,
280
+ err instanceof Error ? err.message : String(err),
281
+ );
259
282
  }
260
283
  }
261
284
 
@@ -267,20 +290,20 @@ export class DelegatorService {
267
290
  const timestamp = this.now().toISOString();
268
291
  return {
269
292
  ok: false,
270
- job_id: resolvedId || 'unknown-job',
271
- status: 'failed',
272
- mode: 'async',
273
- provider_requested: 'auto',
293
+ job_id: resolvedId || "unknown-job",
294
+ status: "failed",
295
+ mode: "async",
296
+ provider_requested: "auto",
274
297
  provider_resolved: null,
275
- agent_type: 'executor',
276
- transport: 'resident-pending',
298
+ agent_type: "executor",
299
+ transport: "resident-pending",
277
300
  created_at: timestamp,
278
301
  started_at: null,
279
302
  updated_at: timestamp,
280
303
  completed_at: null,
281
- output: '',
282
- stderr: '',
283
- error: 'job not found',
304
+ output: "",
305
+ stderr: "",
306
+ error: "job not found",
284
307
  thread_id: null,
285
308
  session_key: null,
286
309
  conversation_open: false,
@@ -288,11 +311,17 @@ export class DelegatorService {
288
311
  }
289
312
 
290
313
  // running/queued 상태이면 worker에서 최신 상태 갱신
291
- if (this.worker && (snapshot.status === 'running' || snapshot.status === 'queued')) {
314
+ if (
315
+ this.worker &&
316
+ (snapshot.status === "running" || snapshot.status === "queued")
317
+ ) {
292
318
  const workerJobId = this._workerJobMap.get(resolvedId);
293
319
  if (workerJobId) {
294
320
  try {
295
- const workerResult = await this.worker.getJobStatus(workerJobId, null);
321
+ const workerResult = await this.worker.getJobStatus(
322
+ workerJobId,
323
+ null,
324
+ );
296
325
  if (workerResult && workerResult.ok !== undefined) {
297
326
  return this._applyWorkerResult(resolvedId, workerResult);
298
327
  }
@@ -1,35 +1,35 @@
1
- import { readFileSync } from 'node:fs';
2
-
3
- import { DELEGATOR_SCHEMA_URL } from './contracts.mjs';
4
-
5
- let schemaBundleCache = null;
6
-
7
- function deepClone(value) {
8
- if (value == null) return value;
9
- return JSON.parse(JSON.stringify(value));
10
- }
11
-
12
- export function loadDelegatorSchemaBundle() {
13
- if (schemaBundleCache) {
14
- return schemaBundleCache;
15
- }
16
-
17
- schemaBundleCache = JSON.parse(readFileSync(DELEGATOR_SCHEMA_URL, 'utf8'));
18
- return schemaBundleCache;
19
- }
20
-
21
- export function getDelegatorMcpToolDefinitions() {
22
- const bundle = loadDelegatorSchemaBundle();
23
- const defs = bundle.$defs || {};
24
- const tools = Array.isArray(bundle['x-triflux-mcp-tools'])
25
- ? bundle['x-triflux-mcp-tools']
26
- : [];
27
-
28
- return tools.map((tool) => ({
29
- name: tool.name,
30
- description: tool.description,
31
- inputSchema: deepClone(defs[tool.inputSchemaDef]),
32
- outputSchema: deepClone(defs[tool.outputSchemaDef]),
33
- pipeAction: tool.pipeAction,
34
- }));
35
- }
1
+ import { readFileSync } from "node:fs";
2
+
3
+ import { DELEGATOR_SCHEMA_URL } from "./contracts.mjs";
4
+
5
+ let schemaBundleCache = null;
6
+
7
+ function deepClone(value) {
8
+ if (value == null) return value;
9
+ return JSON.parse(JSON.stringify(value));
10
+ }
11
+
12
+ export function loadDelegatorSchemaBundle() {
13
+ if (schemaBundleCache) {
14
+ return schemaBundleCache;
15
+ }
16
+
17
+ schemaBundleCache = JSON.parse(readFileSync(DELEGATOR_SCHEMA_URL, "utf8"));
18
+ return schemaBundleCache;
19
+ }
20
+
21
+ export function getDelegatorMcpToolDefinitions() {
22
+ const bundle = loadDelegatorSchemaBundle();
23
+ const defs = bundle.$defs || {};
24
+ const tools = Array.isArray(bundle["x-triflux-mcp-tools"])
25
+ ? bundle["x-triflux-mcp-tools"]
26
+ : [];
27
+
28
+ return tools.map((tool) => ({
29
+ name: tool.name,
30
+ description: tool.description,
31
+ inputSchema: deepClone(defs[tool.inputSchemaDef]),
32
+ outputSchema: deepClone(defs[tool.outputSchemaDef]),
33
+ pipeAction: tool.pipeAction,
34
+ }));
35
+ }