troxy-cli 1.8.0 → 1.8.2

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/bin/troxy.js CHANGED
@@ -44,7 +44,7 @@ function _handleError(err) {
44
44
  } else if (source === 'config') {
45
45
  console.error('\n API key revoked or invalid.');
46
46
  console.error(' Your saved key is no longer accepted by Troxy.');
47
- console.error(' Run: npx troxy init --key <new-key> to reconnect.\n');
47
+ console.error(' Run: npx troxy-cli init --key <new-key> to reconnect.\n');
48
48
  } else {
49
49
  console.error('\n API key invalid or revoked.');
50
50
  console.error(' Check the key in your Troxy dashboard → API Keys.\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "AI payment control — protect your agent's payments with policies",
5
5
  "type": "module",
6
6
  "bin": {
package/src/auth.js CHANGED
@@ -58,7 +58,7 @@ export function requireKey(flags = {}) {
58
58
  return saved;
59
59
  }
60
60
  console.error('\n No API key found.');
61
- console.error(' Run: npx troxy init --key txy-... to connect this machine.\n');
61
+ console.error(' Run: npx troxy-cli init --key txy-... to connect this machine.\n');
62
62
  process.exit(1);
63
63
  }
64
64
 
package/src/init.js CHANGED
@@ -4,7 +4,7 @@ import path from 'path';
4
4
  import readline from 'readline';
5
5
  import { execSync, execFileSync } from 'child_process';
6
6
  import { saveConfig } from './config.js';
7
- import { evaluatePayment } from './api.js';
7
+ import { evaluatePayment, api } from './api.js';
8
8
 
9
9
  function prompt(question) {
10
10
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
@@ -63,7 +63,7 @@ const MCP_CLIENTS = [
63
63
  export async function runInit({ key } = {}) {
64
64
  if (!key || !key.startsWith('txy-')) {
65
65
  console.error('\n Error: --key is required and must start with txy-');
66
- console.error(' Usage: npx troxy init --key txy-...\n');
66
+ console.error(' Usage: npx troxy-cli init --key txy-...\n');
67
67
  process.exit(1);
68
68
  }
69
69
 
@@ -103,6 +103,15 @@ export async function runInit({ key } = {}) {
103
103
  saveConfig({ apiKey: key, agentName });
104
104
  console.log(' Config saved (~/.troxy/config.json) ✓');
105
105
 
106
+ // Push the name to the dashboard immediately (force: this is a deliberate
107
+ // user action, not a routine heartbeat, so it should overwrite any existing
108
+ // agent_name rather than waiting on the daemon's next non-forcing heartbeat).
109
+ try {
110
+ await api.mcpHeartbeat(key, agentName, true);
111
+ } catch {
112
+ // Non-fatal: the daemon's own heartbeat will retry this later.
113
+ }
114
+
106
115
  // Detect and patch MCP clients
107
116
  const platform = process.platform;
108
117
  const detected = MCP_CLIENTS.filter(c => {
package/src/mcp-server.js CHANGED
@@ -21,7 +21,7 @@ export async function runMcp() {
21
21
 
22
22
  if (!apiKey) {
23
23
  process.stderr.write(
24
- 'Troxy: no API key found. Run: npx troxy init --key txy-...\n',
24
+ 'Troxy: no API key found. Run: npx troxy-cli init --key txy-...\n',
25
25
  );
26
26
  process.exit(1);
27
27
  }