troxy-cli 1.7.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "description": "AI payment control — protect your agent's payments with policies",
5
5
  "type": "module",
6
6
  "bin": {
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
- const beat = () =>
23
- api.mcpHeartbeat(apiKey, agentName)
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();
package/src/uninstall.js CHANGED
@@ -3,6 +3,7 @@ import os from 'os';
3
3
  import path from 'path';
4
4
  import { execSync } from 'child_process';
5
5
  import readline from 'readline';
6
+ import { loadConfig } from './config.js';
6
7
 
7
8
  const MCP_CLIENTS = [
8
9
  {
@@ -105,7 +106,15 @@ export async function runUninstall() {
105
106
  console.log('none found');
106
107
  }
107
108
 
108
- // 3. Delete ~/.troxy config
109
+ // 3. Warn about API key (requires login to revoke — user must do it from dashboard)
110
+ const cfg = loadConfig();
111
+ if (cfg?.apiKey) {
112
+ const prefix = cfg.apiKey.slice(0, 12) + '...';
113
+ console.log(`\n ⚠ API key ${prefix} was NOT revoked automatically.`);
114
+ console.log(' Go to dash.troxy.io → Settings → API Keys to revoke it.\n');
115
+ }
116
+
117
+ // 4. Delete ~/.troxy config
109
118
  process.stdout.write(' Removing config (~/.troxy)... ');
110
119
  const configDir = path.join(os.homedir(), '.troxy');
111
120
  if (fs.existsSync(configDir)) {
@@ -115,5 +124,14 @@ export async function runUninstall() {
115
124
  console.log('not found');
116
125
  }
117
126
 
127
+ // 5. Remove npm package
128
+ process.stdout.write(' Uninstalling troxy CLI... ');
129
+ try {
130
+ execSync('npm uninstall -g troxy-cli 2>/dev/null || npm uninstall -g troxy 2>/dev/null', { stdio: 'pipe' });
131
+ console.log('✓');
132
+ } catch {
133
+ console.log('skipped (run manually: sudo npm uninstall -g troxy-cli)');
134
+ }
135
+
118
136
  console.log('\n Troxy removed. Your payments are no longer protected by Troxy.\n');
119
137
  }