troxy-cli 1.29.18 → 1.29.20
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 +29 -18
- package/package.json +4 -2
- package/scripts/check-node.js +6 -0
- package/src/proxy.js +6 -0
package/bin/troxy.js
CHANGED
|
@@ -227,7 +227,7 @@ switch (command) {
|
|
|
227
227
|
|
|
228
228
|
// Re-point every real consumer (MCP client configs, the background service) at the new
|
|
229
229
|
// key BEFORE revoking the old one — otherwise every consumer, which holds the key via
|
|
230
|
-
// ENV rather than config.json, keeps presenting the now-revoked key and
|
|
230
|
+
// ENV rather than config.json, keeps presenting the now-revoked key and policy enforcement
|
|
231
231
|
// goes down until the user thinks to re-run init. (H6)
|
|
232
232
|
await reprovisionKeyConsumers(newKey, existing.agentName || 'my-agent');
|
|
233
233
|
|
|
@@ -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
|
-
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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('
|
|
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
|
-
|
|
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
|
|
@@ -747,7 +758,7 @@ switch (command) {
|
|
|
747
758
|
Everything else requires: troxy login
|
|
748
759
|
|
|
749
760
|
MCP
|
|
750
|
-
troxy pause Pause this MCP (blocks all
|
|
761
|
+
troxy pause Pause this MCP (blocks all checkpoints)
|
|
751
762
|
troxy resume Resume this MCP
|
|
752
763
|
troxy mcps list All MCPs in your account
|
|
753
764
|
troxy mcps rename --name "x" Rename this machine's MCP
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "troxy-cli",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.20",
|
|
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": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"troxy": "bin/troxy.js"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
+
"preinstall": "node scripts/check-node.js",
|
|
14
15
|
"test": "node --test src/tests/*.test.js"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
@@ -30,7 +31,8 @@
|
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
32
33
|
"bin/",
|
|
33
|
-
"src/"
|
|
34
|
+
"src/",
|
|
35
|
+
"scripts/check-node.js"
|
|
34
36
|
],
|
|
35
37
|
"keywords": [
|
|
36
38
|
"mcp",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const major = parseInt(process.versions.node.split('.')[0], 10);
|
|
3
|
+
if (major < 18) {
|
|
4
|
+
console.error(`\ntroxy-cli requires Node >=18, you have ${process.version}.\nInstall a newer Node (e.g. via nvm: https://github.com/nvm-sh/nvm) and retry.\n`);
|
|
5
|
+
process.exit(1);
|
|
6
|
+
}
|
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
|
}
|