triflux 3.3.0-dev.1 → 3.3.0-dev.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triflux",
3
- "version": "3.3.0-dev.1",
3
+ "version": "3.3.0-dev.3",
4
4
  "description": "CLI-first multi-model orchestrator for Claude Code — route tasks to Codex, Gemini, and Claude",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,7 +29,7 @@ const { extractPrompt, sanitizeForKeywordDetection } = detectorModule;
29
29
 
30
30
  function loadCompiledRules() {
31
31
  const rules = loadRules(rulesPath);
32
- assert.equal(rules.length, 19);
32
+ assert.equal(rules.length, 20);
33
33
  return compileRules(rules);
34
34
  }
35
35
 
@@ -100,7 +100,7 @@ test("sanitizeForKeywordDetection: 코드블록/URL/파일경로/XML 태그 제
100
100
 
101
101
  test("loadRules: 유효한 JSON 로드", () => {
102
102
  const rules = loadRules(rulesPath);
103
- assert.equal(rules.length, 19);
103
+ assert.equal(rules.length, 20);
104
104
  assert.equal(rules.filter((rule) => rule.skill).length, 9);
105
105
  assert.equal(rules.filter((rule) => rule.mcp_route).length, 10);
106
106
  });
@@ -122,7 +122,7 @@ test("loadRules: 잘못된 파일 처리", () => {
122
122
  test("compileRules: 정규식 컴파일 성공", () => {
123
123
  const rules = loadRules(rulesPath);
124
124
  const compiled = compileRules(rules);
125
- assert.equal(compiled.length, 19);
125
+ assert.equal(compiled.length, 20);
126
126
  for (const rule of compiled) {
127
127
  assert.ok(Array.isArray(rule.compiledPatterns));
128
128
  assert.ok(rule.compiledPatterns.length > 0);
@@ -0,0 +1,34 @@
1
+ import { describe, it } from "node:test";
2
+ import assert from "node:assert/strict";
3
+
4
+ describe("smoke: 주요 모듈 import 검증", () => {
5
+ it("scripts/lib/keyword-rules.mjs — 순수 함수 export", async () => {
6
+ const mod = await import("../lib/keyword-rules.mjs");
7
+ assert.equal(typeof mod.loadRules, "function");
8
+ assert.equal(typeof mod.compileRules, "function");
9
+ assert.equal(typeof mod.matchRules, "function");
10
+ assert.equal(typeof mod.resolveConflicts, "function");
11
+ });
12
+
13
+ it("hub/team/shared.mjs — ANSI 상수 export", async () => {
14
+ const mod = await import("../../hub/team/shared.mjs");
15
+ assert.equal(typeof mod.AMBER, "string");
16
+ assert.equal(typeof mod.RESET, "string");
17
+ });
18
+
19
+ it("hub/team/staleState.mjs — stale 상태 유틸 export", async () => {
20
+ const mod = await import("../../hub/team/staleState.mjs");
21
+ assert.equal(typeof mod.TEAM_STATE_FILE_NAME, "string");
22
+ assert.equal(typeof mod.STALE_TEAM_MAX_AGE_MS, "number");
23
+ });
24
+
25
+ it("hub/pipeline/transitions.mjs — 파이프라인 전이 규칙 export", async () => {
26
+ const mod = await import("../../hub/pipeline/transitions.mjs");
27
+ assert.ok(Array.isArray(mod.PHASES));
28
+ assert.ok(mod.PHASES.includes("plan"));
29
+ assert.ok(mod.PHASES.includes("complete"));
30
+ assert.ok(mod.TERMINAL instanceof Set);
31
+ assert.ok(mod.TERMINAL.has("complete"));
32
+ assert.ok(mod.TERMINAL.has("failed"));
33
+ });
34
+ });
@@ -63,7 +63,7 @@ async function isHubHealthy(host, port) {
63
63
 
64
64
  function startHubDetached(port) {
65
65
  const serverPath = join(PLUGIN_ROOT, "hub", "server.mjs");
66
- if (!existsSync(serverPath)) return;
66
+ if (!existsSync(serverPath)) return false;
67
67
 
68
68
  try {
69
69
  const child = spawn(process.execPath, [serverPath], {
@@ -72,12 +72,30 @@ function startHubDetached(port) {
72
72
  stdio: "ignore",
73
73
  });
74
74
  child.unref();
75
+ return true;
75
76
  } catch {
76
- // best effort
77
+ return false;
78
+ }
79
+ }
80
+
81
+ /** Hub 기동 후 ready 상태까지 대기 (최대 maxWaitMs) */
82
+ async function waitForHubReady(host, port, maxWaitMs = 5000) {
83
+ const interval = 250;
84
+ const deadline = Date.now() + maxWaitMs;
85
+ while (Date.now() < deadline) {
86
+ if (await isHubHealthy(host, port)) return true;
87
+ await new Promise((r) => setTimeout(r, interval));
77
88
  }
89
+ return false;
78
90
  }
79
91
 
80
92
  const { host, port } = resolveHubTarget();
81
93
  if (!(await isHubHealthy(host, port))) {
82
- startHubDetached(port);
94
+ const started = startHubDetached(port);
95
+ if (started) {
96
+ const ready = await waitForHubReady(host, port);
97
+ if (!ready) {
98
+ console.error("[tfx-hub-ensure] Hub 시작했으나 ready 대기 초과 — MCP 연결 실패 가능");
99
+ }
100
+ }
83
101
  }
package/scripts/setup.mjs CHANGED
@@ -57,16 +57,21 @@ const SYNC_MAP = [
57
57
  dst: join(CLAUDE_DIR, "scripts", "tfx-route-worker.mjs"),
58
58
  label: "tfx-route-worker.mjs",
59
59
  },
60
- {
61
- src: join(PLUGIN_ROOT, "hub", "workers", "codex-mcp.mjs"),
62
- dst: join(CLAUDE_DIR, "scripts", "hub", "workers", "codex-mcp.mjs"),
63
- label: "hub/workers/codex-mcp.mjs",
64
- },
65
- {
66
- src: join(PLUGIN_ROOT, "hub", "workers", "interface.mjs"),
67
- dst: join(CLAUDE_DIR, "scripts", "hub", "workers", "interface.mjs"),
68
- label: "hub/workers/interface.mjs",
69
- },
60
+ {
61
+ src: join(PLUGIN_ROOT, "hub", "workers", "codex-mcp.mjs"),
62
+ dst: join(CLAUDE_DIR, "scripts", "hub", "workers", "codex-mcp.mjs"),
63
+ label: "hub/workers/codex-mcp.mjs",
64
+ },
65
+ {
66
+ src: join(PLUGIN_ROOT, "hub", "workers", "delegator-mcp.mjs"),
67
+ dst: join(CLAUDE_DIR, "scripts", "hub", "workers", "delegator-mcp.mjs"),
68
+ label: "hub/workers/delegator-mcp.mjs",
69
+ },
70
+ {
71
+ src: join(PLUGIN_ROOT, "hub", "workers", "interface.mjs"),
72
+ dst: join(CLAUDE_DIR, "scripts", "hub", "workers", "interface.mjs"),
73
+ label: "hub/workers/interface.mjs",
74
+ },
70
75
  {
71
76
  src: join(PLUGIN_ROOT, "hub", "workers", "gemini-worker.mjs"),
72
77
  dst: join(CLAUDE_DIR, "scripts", "hub", "workers", "gemini-worker.mjs"),