triflux 10.14.2 → 10.14.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": "10.14.2",
3
+ "version": "10.14.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": {
@@ -101,14 +101,16 @@ describe("mcp guard engine", () => {
101
101
  );
102
102
  });
103
103
 
104
- it("replaces stdio MCP entries with tfx-hub and writes a backup", () => {
104
+ it("replaces stdio MCP entries with tfx-hub and writes a backup (TFX_HUB_PORT env overrides)", () => {
105
105
  const homeDir = createHomeDir();
106
106
  withHome(homeDir);
107
+ process.env.TFX_HUB_PORT = "30123";
107
108
 
109
+ // hub.pid port 는 무시되어야 한다 (PR #158: pid = host hint only).
108
110
  const pidPath = join(homeDir, ".claude", "cache", "tfx-hub", "hub.pid");
109
111
  writeFileSync(
110
112
  pidPath,
111
- JSON.stringify({ host: "127.0.0.1", port: 30123 }),
113
+ JSON.stringify({ host: "127.0.0.1", port: 40404 }),
112
114
  "utf8",
113
115
  );
114
116
 
@@ -141,9 +143,18 @@ describe("mcp guard engine", () => {
141
143
  assert.equal(Object.hasOwn(updated.mcpServers, "unsafe-stdio"), false);
142
144
  });
143
145
 
144
- it("uses hub.pid port before registry fallback when resolving Hub URL", () => {
146
+ it("uses TFX_HUB_PORT env as single source when resolving Hub URL", () => {
145
147
  const homeDir = createHomeDir();
146
148
  withHome(homeDir);
149
+ process.env.TFX_HUB_PORT = "29991";
150
+
151
+ assert.equal(resolveHubUrl(), "http://127.0.0.1:29991/mcp");
152
+ });
153
+
154
+ it("ignores hub.pid port (pid is host hint only, PR #158 policy)", () => {
155
+ const homeDir = createHomeDir();
156
+ withHome(homeDir);
157
+ delete process.env.TFX_HUB_PORT;
147
158
 
148
159
  writeFileSync(
149
160
  join(homeDir, ".claude", "cache", "tfx-hub", "hub.pid"),
@@ -151,6 +162,8 @@ describe("mcp guard engine", () => {
151
162
  "utf8",
152
163
  );
153
164
 
154
- assert.equal(resolveHubUrl(), "http://127.0.0.1:29991/mcp");
165
+ // env 없음 + hub.pid port 존재 → registry/default 27888 fallback.
166
+ // pid port cascade 가 제거되어 29991 이 쓰이면 안 됨.
167
+ assert.equal(resolveHubUrl(), "http://127.0.0.1:27888/mcp");
155
168
  });
156
169
  });
@@ -851,14 +851,13 @@ export function resolveHubUrl() {
851
851
  : DEFAULT_HUB_PATH,
852
852
  };
853
853
 
854
+ // PR #158 정책: port = TFX_HUB_PORT env (없으면 registry/default 27888) single source.
855
+ // hub.pid 는 loopback host 힌트 전용. 과거 pid port cascade 는 오염된 port 영속화의
856
+ // 원인이었고 hub-ensure.resolveHubTarget 에서 이미 제거됨. 여기도 일관 적용.
854
857
  const hubPidPath = join(homedir(), ".claude", "cache", "tfx-hub", "hub.pid");
855
858
  if (existsSync(hubPidPath)) {
856
859
  try {
857
860
  const info = readJsonFile(hubPidPath);
858
- if (!envPort) {
859
- const pidPort = Number(info?.port);
860
- if (Number.isFinite(pidPort) && pidPort > 0) target.port = pidPort;
861
- }
862
861
  if (typeof info?.host === "string") {
863
862
  const host = info.host.trim();
864
863
  if (LOOPBACK_HOSTS.has(host)) target.host = host;