troxy-cli 1.29.19 → 1.29.21

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
@@ -484,22 +484,16 @@ switch (command) {
484
484
  process.stdout.write(` DB: ${health.db}\n`);
485
485
  process.stdout.write(` Env: ${health.env}\n`);
486
486
 
487
- // Account info from login session
488
- const session = loadSession();
489
- if (session?.jwt) {
490
- try {
491
- const data = await api.agentStatus(session.jwt);
492
- const { account } = data;
493
- console.log(`
494
- Account
495
- Active policies: ${account.active_policies}
496
- MCPs total: ${account.total_mcps} (${account.connected_mcps} connected)
497
- Requests 24h: ${account.requests_24h}
498
- Default action: ${account.default_action}
499
- `);
500
- } catch { console.log(); }
487
+ const { proxyState } = await import('../src/proxy.js');
488
+ const { INTERCEPTOR_PORT } = await import('../src/daemon.js');
489
+ const proxy = await proxyState();
490
+ console.log();
491
+ if (proxy === 'on') {
492
+ console.log(` Proxy: ✓ on (Claude traffic routed through Troxy, 127.0.0.1:${INTERCEPTOR_PORT})`);
493
+ } else if (proxy === 'down') {
494
+ console.log(` Proxy: ⚠ configured, but nothing is listening on 127.0.0.1:${INTERCEPTOR_PORT}. Run: troxy restart`);
501
495
  } else {
502
- console.log('\n Not logged in. Run: troxy login\n');
496
+ console.log(' Proxy: off (turn on: troxy proxy enable --experimental)');
503
497
  }
504
498
 
505
499
  // MCP connection info from local config (set by troxy init)
@@ -519,7 +513,24 @@ switch (command) {
519
513
  } catch {
520
514
  process.stdout.write('\n');
521
515
  }
522
- console.log();
516
+ }
517
+
518
+ // Login only unlocks account commands; protection runs off the key + proxy above.
519
+ const session = loadSession();
520
+ if (session?.jwt) {
521
+ try {
522
+ const data = await api.agentStatus(session.jwt);
523
+ const { account } = data;
524
+ console.log(`
525
+ Account
526
+ Active policies: ${account.active_policies}
527
+ MCPs total: ${account.total_mcps} (${account.connected_mcps} connected)
528
+ Requests 24h: ${account.requests_24h}
529
+ Default action: ${account.default_action}
530
+ `);
531
+ } catch { console.log(); }
532
+ } else {
533
+ console.log(' Account: not signed in. Run `troxy login` to manage policies and view activity from the CLI.\n');
523
534
  }
524
535
 
525
536
  // Version check
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.29.19",
3
+ "version": "1.29.21",
4
4
  "description": "A secure control layer for AI agents: policies across payments, messages, logins, destructive actions, model usage, and secrets, all enforceable from the CLI",
5
5
  "homepage": "https://troxy.io",
6
6
  "bugs": {
package/src/init.js CHANGED
@@ -115,10 +115,12 @@ export async function reprovisionKeyConsumers(key, agentName, proxyOptIn = null,
115
115
  const entry = JSON.stringify({ command: 'npx', args: ['troxy-cli', 'mcp'], env: { TROXY_API_KEY: key } });
116
116
  // execFileSync passes args directly to the process (no shell), so the
117
117
  // key can't break out of a quoted string and inject shell commands.
118
- execFileSync('openclaw', ['mcp', 'set', 'troxy', entry], { stdio: 'ignore' });
118
+ execFileSync('openclaw', ['mcp', 'set', 'troxy', entry], { stdio: ['ignore', 'ignore', 'pipe'] });
119
119
  console.log(` • OpenClaw ✓`);
120
120
  } catch (err) {
121
- console.log(` • OpenClaw ✗ (${err.message})`);
121
+ // err.message embeds the full argv, key included: never print it.
122
+ const reason = err.stderr?.toString().trim().split('\n').pop() || `exit code ${err.status}`;
123
+ console.log(` • OpenClaw ✗ (${reason.replaceAll(key, key.substring(0, 12) + '...')})`);
122
124
  }
123
125
  }
124
126
  // Claude Desktop's Code tab runs the same Claude Code engine under the
package/src/proxy.js CHANGED
@@ -40,6 +40,12 @@ export function probePort(port, timeoutMs = 800) {
40
40
  });
41
41
  }
42
42
 
43
+ // 'on' | 'down' (settings point at the interceptor but nothing is listening) | 'off'
44
+ export async function proxyState() {
45
+ if (!interceptionIsConfigured(claudeCodeSettingsPath())) return 'off';
46
+ return (await probePort(INTERCEPTOR_PORT)) ? 'on' : 'down';
47
+ }
48
+
43
49
  function _readCert(certPath) {
44
50
  try { return fs.readFileSync(certPath, 'utf8'); } catch { return null; }
45
51
  }