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