troxy-cli 1.7.3 → 1.7.4
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 +1 -1
- package/src/api.js +1 -1
- package/src/daemon.js +7 -4
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -58,7 +58,7 @@ export const api = {
|
|
|
58
58
|
waitApprovalStatus: (token) => request('GET', `/approvals/${encodeURIComponent(token)}/wait`),
|
|
59
59
|
|
|
60
60
|
// MCP heartbeat (agent API key)
|
|
61
|
-
mcpHeartbeat: (apiKey, agentName) => request('POST', '/mcp/heartbeat', { apiKey, body: agentName ? { agent_name: agentName } : undefined }),
|
|
61
|
+
mcpHeartbeat: (apiKey, agentName, force) => request('POST', '/mcp/heartbeat', { apiKey, body: agentName ? { agent_name: agentName, force_name: !!force } : undefined }),
|
|
62
62
|
|
|
63
63
|
// MCP status (agent API key — no login needed)
|
|
64
64
|
mcpStatus: (apiKey) => request('GET', '/mcp/status', { apiKey }),
|
package/src/daemon.js
CHANGED
|
@@ -19,14 +19,17 @@ export async function runDaemon() {
|
|
|
19
19
|
|
|
20
20
|
const { apiKey, agentName } = cfg;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
// `force` pushes the config name as the authoritative display name. We only
|
|
23
|
+
// do this on the FIRST beat after (re)start, so a `troxy restart` overrides
|
|
24
|
+
// the dashboard, while regular beats never clobber a dashboard rename.
|
|
25
|
+
const beat = (force) =>
|
|
26
|
+
api.mcpHeartbeat(apiKey, agentName, force)
|
|
24
27
|
.then(() => process.stderr.write(`[troxy-daemon] heartbeat ok\n`))
|
|
25
28
|
.catch(err => process.stderr.write(`[troxy-daemon] heartbeat failed: ${err.message}\n`));
|
|
26
29
|
|
|
27
30
|
process.stderr.write(`[troxy-daemon] starting (agent: ${agentName || 'unnamed'})\n`);
|
|
28
|
-
await beat();
|
|
29
|
-
setInterval(beat, INTERVAL_MS);
|
|
31
|
+
await beat(true); // startup beat: config name wins
|
|
32
|
+
setInterval(() => beat(false), INTERVAL_MS); // regular beats: don't touch name
|
|
30
33
|
|
|
31
34
|
// Keep process alive indefinitely
|
|
32
35
|
process.stdin.resume();
|